Lines 51-91javascript
51test('npm pack keeps product files but excludes runtime residue', async () => {
52 const logsDir = join(REPO, '.claude/logs');
53 await mkdir(logsDir, { recursive: true });
54 const ownedLogDir = await mkdtemp(join(logsDir, 'pack-runtime-'));
55 const runtimeLog = join(ownedLogDir, 'drift-guard.log');
56 const sentinelLog = join(ownedLogDir, 'preexisting.log');
57 const sentinelBytes = 'preexisting runtime log bytes\n';
58 await writeFile(sentinelLog, sentinelBytes);
59 await writeFile(runtimeLog, `${new Date().toISOString()} runtime-only\n`);
61 const output = execFileSync('npm', ['pack', '--dry-run', '--json'], {
62 cwd: REPO, encoding: 'utf8',
64 const files = JSON.parse(output)[0].files.map((file) => file.path);
65 assert.ok(files.includes('scripts/build-kit.mjs'));
66 assert.ok(files.includes('scripts/board-sync.py'));
67 assert.ok(files.includes('scripts/kit-update-pr.mjs'));
68 assert.ok(files.includes('.claude/hooks/drift-guard.py'));
69 assert.ok(files.includes('.claude/skills/tdd/SKILL.md'));
70 assert.ok(files.every((path) => !path.startsWith('.claude/logs/')));
71 assert.ok(files.every((path) => !path.includes('__pycache__') && !path.endsWith('.pyc')));
72 const pkg = JSON.parse(execFileSync('node', ['-p', 'JSON.stringify(require("./package.json"))'], {
73 cwd: REPO, encoding: 'utf8',
75 assert.ok(pkg.files.includes('scripts/'), 'package must ship future script file types');
76 assert.equal(await readFile(sentinelLog, 'utf8'), sentinelBytes);
78 await rm(ownedLogDir, { recursive: true, force: true });
82test('packed scoped artifact keeps the existing npx default-bin inference', async () => {
83 const destination = await mkdtemp(join(tmpdir(), 'awkit-pack-'));
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
scripts/build-kit.test.mjsView on unpkg · L71 85 const packed = JSON.parse(execFileSync('npm', [
86 'pack', '--pack-destination', destination, '--json',
87 ], { cwd: REPO, encoding: 'utf8' }));
88 const output = execFileSync('npx', [
89 '--yes', '--offline', `./${packed[0].filename}`,
90 ], { cwd: destination, encoding: 'utf8' });
91 assert.match(output, /Usage: agent-workflow-kit/);