Lines 1-33javascript
3 * testcase-kit init — copy bộ công cụ tạo testcase vào thư mục dự án hiện tại.
5 * Chạy: npx github:<org>/testcase-kit init (hoặc: npx testcase-kit init)
7 * Cài vào cwd: .claude/commands/testcase.md, .claude/skills/ai-test-generation/,
8 * scripts/testcases-to-xlsx.mjs, docs/{srs,prd,testcases,agent-skills}/,
9 * và thêm script "testcases:xlsx" + devDependency xlsx-js-style vào package.json.
11import { cpSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
12import { fileURLToPath } from 'node:url';
13import { dirname, resolve, join } from 'node:path';
14import { execSync } from 'node:child_process';
15
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
bin/init.mjsView on unpkg · L4 16const KIT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
17const TEMPLATES = join(KIT, 'templates');
18const TARGET = process.cwd();
20const cmd = process.argv[2] || 'init';
22 console.log('Usage: npx testcase-kit init');
26console.log(`\n📦 testcase-kit → cài vào: ${TARGET}\n`);
28// 1) Copy templates (merge; overwrite command/skill/script để cập nhật, docs chỉ có README/.gitkeep)
29cpSync(TEMPLATES, TARGET, { recursive: true, force: true });
30console.log('✓ Đã copy: .claude/commands, .claude/skills, scripts, docs/{srs,prd,testcases,agent-skills}');
32// 2) Patch package.json
33const pkgPath = join(TARGET, 'package.json');