Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:mcp-conformance": "pnpm build && AGENT_BUNDLE_MCP_CONFORMANCE=1 rstest --config rstest.mcp-conformance.config.ts",
"test:native-host": "pnpm build && AGENT_BUNDLE_NATIVE_HOST_CONTRACTS=1 rstest --config rstest.native-host.config.ts",
"test:watch": "rstest --config rstest.config.ts --watch",
"lint": "rslint .",
"lint": "rslint . && node scripts/check-test-remove-tree.mjs",
"bench:hook-cold-start": "node scripts/measure-hook-cold-start.mjs",
"record:claude-hooks-fixtures": "node scripts/record-claude-hooks-schema-fixtures.mjs",
"typecheck": "node scripts/check-dist-fresh.mjs && tsc --noEmit && tsc --project packages/workbench/tsconfig.json && tsc --project packages/create-agent-bundle/tsconfig.json && tsc --project packages/rsc-markdown-stream/tsconfig.json && tsc --project packages/agent-bundle/tsconfig.web-host.json && pnpm --filter @agent-bundle/docs typecheck",
Expand Down
9 changes: 5 additions & 4 deletions packages/agent-bundle/tests/adapter-contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { supportedCapabilities } from './support/adapter-capabilities.ts';
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
import { mkdtemp, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';

Expand All @@ -11,6 +11,7 @@ import type { TargetAdapter } from '../src/adapters/types.ts';
import { normalizeProject } from '../src/config/normalize.ts';
import type { LoadedConfig } from '../src/config/load.ts';
import { validateModel } from '../src/config/validate.ts';
import { removeTree } from './support/remove-tree.ts';

const metadata = Object.freeze({
adapterRevision: 'test',
Expand Down Expand Up @@ -87,7 +88,7 @@ it('delegates selected native hook sources through registered adapters', async (
target: 'example',
}]);
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand Down Expand Up @@ -180,7 +181,7 @@ it('normalizes malformed native hook source values into diagnostics without skip
target: 'invalid',
});
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand Down Expand Up @@ -216,6 +217,6 @@ it('normalizes thrown native hook sources into diagnostics', async () => {
target: 'throws',
});
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});
13 changes: 7 additions & 6 deletions packages/agent-bundle/tests/amp-adapter.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from 'node:fs/promises';
import { mkdir, mkdtemp, readFile, rename, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { pathToFileURL } from 'node:url';
Expand All @@ -16,6 +16,7 @@ import { projectEventDocument } from '../src/events/projection.ts';
import { compileRouteGraph, emptyCompiledRouteGraph } from '../src/routes/graph.ts';
import { build } from './support/build.ts';
import { runNodeScript } from './support/run-node-script.ts';
import { removeTree } from './support/remove-tree.ts';

const configPath = '/workspace/agent-bundle.config.ts';
const skillSource = '/workspace/src/skills/review/SKILL.md';
Expand Down Expand Up @@ -200,7 +201,7 @@ it('emits compilable private factory names for punctuation and reserved bindings
expect(typeof loaded.default).toBe('function');
}
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand Down Expand Up @@ -540,7 +541,7 @@ it('registers inline documented callbacks and maps every native result exactly',
} finally {
if (previousBun === undefined) Reflect.deleteProperty(globalThis, 'Bun');
else Reflect.set(globalThis, 'Bun', previousBun);
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand Down Expand Up @@ -683,7 +684,7 @@ it('builds a relocatable self-contained Amp artifact with manifest and evidence
});
expect(registrations).toEqual(['skills/review']);
} finally {
await rm(projectRoot, { force: true, recursive: true });
await removeTree(projectRoot);
}
});

Expand Down Expand Up @@ -747,7 +748,7 @@ it('compiles a nested Amp hook wrapper that returns the documented tool.call dec
stdout: '{"action":"reject-and-continue","message":"blocked"}',
});
} finally {
await rm(projectRoot, { force: true, recursive: true });
await removeTree(projectRoot);
}
});

Expand Down Expand Up @@ -832,6 +833,6 @@ it('runs a relocated standalone event route with its worker inside the Amp plugi
stdout: '{"action":"reject-and-continue","message":"blocked"}',
});
} finally {
await rm(projectRoot, { force: true, recursive: true });
await removeTree(projectRoot);
}
});
17 changes: 9 additions & 8 deletions packages/agent-bundle/tests/amp-install.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mkdir, mkdtemp, readFile, readdir, rm, symlink, writeFile } from 'node:fs/promises';
import { mkdir, mkdtemp, readFile, readdir, symlink, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';

Expand All @@ -9,6 +9,7 @@ import { installBundle, type InstallCommandRunner } from '../src/install/install
import { readInstallReceipt } from '../src/install/receipt.ts';
import { uninstallBundle } from '../src/install/uninstall.ts';
import { writeInstallFixtureManifest } from './support/install-fixture.ts';
import { removeTree } from './support/remove-tree.ts';

const isolatedEnvironment: Readonly<NodeJS.ProcessEnv> = {};
const pluginName = 'amp-install-fixture';
Expand Down Expand Up @@ -138,7 +139,7 @@ it('installs, replaces, and uninstalls only the receipt-owned Amp directory', as
await expect(readFile(join(destination, 'disabled-state.json'), 'utf8')).resolves.toBe('{"disabled":true}\n');
await expect(readFile(settings, 'utf8')).resolves.toBe('{"amp.plugins.disabled":["amp-install-fixture"]}\n');
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand Down Expand Up @@ -185,7 +186,7 @@ it('uses the documented XDG system and project plugin roots without touching Amp
expect(uninstalled.state).toBe('uninstalled');
await expect(readFile(join(projectRoot, '.amp', 'settings.json'), 'utf8')).resolves.toBe('{"trusted":false}\n');
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand All @@ -208,7 +209,7 @@ it('installs a mixed-case portable plugin name accepted by the Amp planner', asy
});
expect(installed.destination).toBe(join(home, '.config', 'amp', 'plugins', name));
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand Down Expand Up @@ -236,7 +237,7 @@ it('rejects an Amp manifest name that could escape the plugin root', async () =>
})).rejects.toThrow('not a safe local plugin name');
await expect(readFile(join(home, '.config', 'escape', 'index.js'), 'utf8')).rejects.toThrow();
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand All @@ -261,7 +262,7 @@ it('refuses to replace a foreign Amp directory even with --replace', async () =>
})).rejects.toThrow('foreign install');
await expect(readFile(join(destination, 'index.js'), 'utf8')).resolves.toContain('foreign');
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand All @@ -287,7 +288,7 @@ it('refuses a symlinked Amp plugin ancestor before writing outside the host root
})).rejects.toThrow('unsupported filesystem entry');
expect(await readdir(outside)).toEqual([]);
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});

Expand All @@ -309,6 +310,6 @@ it('refuses modified or unlisted files inside the generated Amp directory', asyn
scope: 'user',
})).rejects.toThrow('does not match its manifest-owned directory');
} finally {
await rm(root, { force: true, recursive: true });
await removeTree(root);
}
});
Loading
Loading