@walwal-harness/cli 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +13 -2
  2. package/bin/init.js +90 -7
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -46,15 +46,26 @@ Planner → Generator-BE → Evaluator-Func(API-only)
46
46
  npm install @walwal-harness/cli
47
47
  ```
48
48
 
49
- 설치 시 자동으로:
49
+ `postinstall`이 자동으로 프로젝트 루트에 설치합니다:
50
50
  - `.harness/` 디렉토리 스캐폴딩 (actions, archive, gotchas)
51
51
  - `.claude/skills/` 에 6개 에이전트 스킬 설치
52
52
  - `AGENTS.md` 생성 + `CLAUDE.md` 심볼릭 링크
53
53
  - 기존 프로젝트면 구조 스캔 → IA-MAP 자동 생성
54
54
 
55
+ > **Note:** `npm install` 후 Claude Code 세션을 **재시작**해야 skills가 인식됩니다.
56
+ > Claude Code는 세션 시작 시 `.claude/skills/`를 스캔하므로, 설치 후 `/exit` → 재진입이 필요합니다.
57
+
58
+ ### CLI 명령
59
+
60
+ ```bash
61
+ npx walwal-harness # 초기화 (postinstall과 동일)
62
+ npx walwal-harness --force # 강제 재초기화 (기존 파일 덮어쓰기)
63
+ npx walwal-harness --help # 도움말
64
+ ```
65
+
55
66
  ## 사용법
56
67
 
57
- Claude Code에서:
68
+ Claude Code를 **재시작**한 뒤:
58
69
 
59
70
  ```
60
71
  > 하네스 엔지니어링 시작
package/bin/init.js CHANGED
@@ -13,13 +13,43 @@ const fs = require('fs');
13
13
  const path = require('path');
14
14
  const { execSync } = require('child_process');
15
15
 
16
- const PROJECT_ROOT = process.cwd();
17
16
  const PKG_ROOT = path.resolve(__dirname, '..');
18
- const HARNESS_DIR = path.join(PROJECT_ROOT, '.harness');
19
- const CLAUDE_SKILLS_DIR = path.join(PROJECT_ROOT, '.claude', 'skills');
20
-
21
17
  const isAuto = process.argv.includes('--auto');
22
18
  const isForce = process.argv.includes('--force');
19
+ const isHelp = process.argv.includes('--help') || process.argv.includes('-h');
20
+
21
+ // ─────────────────────────────────────────
22
+ // Resolve project root
23
+ // ─────────────────────────────────────────
24
+ // During `npm install` postinstall, cwd is the dependency's own directory
25
+ // inside node_modules, NOT the consumer project root.
26
+ // We detect this and walk up to find the actual project root.
27
+ function resolveProjectRoot() {
28
+ let cwd = process.cwd();
29
+
30
+ // If we're running inside node_modules, walk up to the project root
31
+ // e.g. /project/node_modules/@walwal-harness/cli → /project
32
+ const nmIndex = cwd.indexOf(path.sep + 'node_modules' + path.sep);
33
+ if (nmIndex !== -1) {
34
+ return cwd.substring(0, nmIndex);
35
+ }
36
+
37
+ // Also handle case where cwd IS a node_modules child (no trailing sep match)
38
+ if (cwd.includes(`${path.sep}node_modules`)) {
39
+ const parts = cwd.split(path.sep);
40
+ const nmIdx = parts.indexOf('node_modules');
41
+ if (nmIdx > 0) {
42
+ return parts.slice(0, nmIdx).join(path.sep);
43
+ }
44
+ }
45
+
46
+ // npx or direct invocation — cwd is the project root
47
+ return cwd;
48
+ }
49
+
50
+ const PROJECT_ROOT = resolveProjectRoot();
51
+ const HARNESS_DIR = path.join(PROJECT_ROOT, '.harness');
52
+ const CLAUDE_SKILLS_DIR = path.join(PROJECT_ROOT, '.claude', 'skills');
23
53
 
24
54
  // ─────────────────────────────────────────
25
55
  // Utility
@@ -253,17 +283,55 @@ function checkPlaywrightMcp() {
253
283
  log('');
254
284
  }
255
285
 
286
+ // ─────────────────────────────────────────
287
+ // Help
288
+ // ─────────────────────────────────────────
289
+ function showHelp() {
290
+ const pkg = require(path.join(PKG_ROOT, 'package.json'));
291
+ console.log(`
292
+ ╔══════════════════════════════════════╗
293
+ ║ walwal-harness v${pkg.version.padEnd(16)}║
294
+ ║ AI Agent Harness Engineering ║
295
+ ╚══════════════════════════════════════╝
296
+
297
+ Usage:
298
+ npx walwal-harness Initialize project for harness engineering
299
+ npx walwal-harness --force Re-initialize (overwrites existing files)
300
+ npx walwal-harness --help Show this help
301
+
302
+ What it does:
303
+ 1. Scaffolds .harness/ directory (actions, archive, gotchas, config)
304
+ 2. Installs skills to .claude/skills/ (dispatcher, planner, generators, evaluators)
305
+ 3. Copies helper scripts to scripts/
306
+ 4. Creates AGENTS.md + CLAUDE.md symlink
307
+ 5. Checks Playwright MCP configuration
308
+
309
+ After init:
310
+ 1. Restart Claude Code session (exit and re-enter) for skills to load
311
+ 2. Say "하네스 엔지니어링 시작" or invoke /harness-dispatcher
312
+ `);
313
+ }
314
+
256
315
  // ─────────────────────────────────────────
257
316
  // Main
258
317
  // ─────────────────────────────────────────
259
318
  function main() {
319
+ if (isHelp) {
320
+ showHelp();
321
+ return;
322
+ }
323
+
324
+ const pkg = require(path.join(PKG_ROOT, 'package.json'));
260
325
  console.log('');
261
326
  console.log('╔══════════════════════════════════════╗');
262
- console.log('║ walwal-harness v1.0.0 ║');
327
+ console.log(`║ walwal-harness v${pkg.version.padEnd(16)}║`);
263
328
  console.log('║ AI Agent Harness Engineering ║');
264
329
  console.log('╚══════════════════════════════════════╝');
265
330
  console.log('');
266
331
 
332
+ log(`Project root: ${PROJECT_ROOT}`);
333
+ console.log('');
334
+
267
335
  scaffoldHarness();
268
336
  installSkills();
269
337
  installScripts();
@@ -273,8 +341,23 @@ function main() {
273
341
  console.log('');
274
342
  log('═══ Initialization Complete ═══');
275
343
  log('');
276
- log('Start with: "하네스 엔지니어링 시작"');
277
- log('Or invoke: /harness-dispatcher');
344
+
345
+ if (isAuto) {
346
+ // postinstall context — Claude Code is likely already running
347
+ log('╔═══════════════════════════════════════════════════════════╗');
348
+ log('║ IMPORTANT: Restart Claude Code for skills to activate! ║');
349
+ log('║ ║');
350
+ log('║ Claude Code discovers skills at session startup. ║');
351
+ log('║ Type /exit, then re-enter this directory to begin. ║');
352
+ log('║ ║');
353
+ log('║ Then say: "하네스 엔지니어링 시작" ║');
354
+ log('║ Or invoke: /harness-dispatcher ║');
355
+ log('╚═══════════════════════════════════════════════════════════╝');
356
+ } else {
357
+ log('Next steps:');
358
+ log(' 1. Restart Claude Code session (/exit → re-enter directory)');
359
+ log(' 2. Say "하네스 엔지니어링 시작" or invoke /harness-dispatcher');
360
+ }
278
361
  console.log('');
279
362
  }
280
363
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walwal-harness/cli",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Production harness for AI agent engineering — Planner, Generator(BE/FE), Evaluator(Func/Visual) with Gotcha management",
5
5
  "bin": {
6
6
  "walwal-harness": "bin/init.js"