@su-record/vibe 2.12.5 → 2.13.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 (110) hide show
  1. package/CLAUDE.md +8 -2
  2. package/README.en.md +11 -11
  3. package/README.md +7 -7
  4. package/dist/cli/postinstall/fs-utils.d.ts +23 -0
  5. package/dist/cli/postinstall/fs-utils.d.ts.map +1 -1
  6. package/dist/cli/postinstall/fs-utils.js +71 -0
  7. package/dist/cli/postinstall/fs-utils.js.map +1 -1
  8. package/dist/cli/postinstall/fs-utils.test.js +69 -1
  9. package/dist/cli/postinstall/fs-utils.test.js.map +1 -1
  10. package/dist/cli/postinstall/main.d.ts.map +1 -1
  11. package/dist/cli/postinstall/main.js +12 -2
  12. package/dist/cli/postinstall/main.js.map +1 -1
  13. package/dist/cli/setup/CodexHooks.test.js +27 -0
  14. package/dist/cli/setup/CodexHooks.test.js.map +1 -1
  15. package/dist/cli/setup/ProjectSetup.js +2 -2
  16. package/dist/cli/setup/ProjectSetup.js.map +1 -1
  17. package/dist/infra/lib/DecisionTracer.d.ts +4 -0
  18. package/dist/infra/lib/DecisionTracer.d.ts.map +1 -1
  19. package/dist/infra/lib/DecisionTracer.js +4 -0
  20. package/dist/infra/lib/DecisionTracer.js.map +1 -1
  21. package/dist/infra/lib/LoopBreaker.d.ts +4 -0
  22. package/dist/infra/lib/LoopBreaker.d.ts.map +1 -1
  23. package/dist/infra/lib/LoopBreaker.js +4 -0
  24. package/dist/infra/lib/LoopBreaker.js.map +1 -1
  25. package/dist/infra/lib/ReviewRace.d.ts +4 -0
  26. package/dist/infra/lib/ReviewRace.d.ts.map +1 -1
  27. package/dist/infra/lib/ReviewRace.js +4 -0
  28. package/dist/infra/lib/ReviewRace.js.map +1 -1
  29. package/dist/infra/lib/SkillQualityGate.d.ts +4 -0
  30. package/dist/infra/lib/SkillQualityGate.d.ts.map +1 -1
  31. package/dist/infra/lib/SkillQualityGate.js +4 -0
  32. package/dist/infra/lib/SkillQualityGate.js.map +1 -1
  33. package/dist/infra/lib/UltraQA.d.ts +4 -0
  34. package/dist/infra/lib/UltraQA.d.ts.map +1 -1
  35. package/dist/infra/lib/UltraQA.js +4 -0
  36. package/dist/infra/lib/UltraQA.js.map +1 -1
  37. package/dist/infra/lib/VerificationLoop.d.ts +4 -0
  38. package/dist/infra/lib/VerificationLoop.d.ts.map +1 -1
  39. package/dist/infra/lib/VerificationLoop.js +4 -0
  40. package/dist/infra/lib/VerificationLoop.js.map +1 -1
  41. package/dist/infra/orchestrator/index.d.ts.map +1 -1
  42. package/dist/infra/orchestrator/index.js +1 -3
  43. package/dist/infra/orchestrator/index.js.map +1 -1
  44. package/dist/infra/orchestrator/parallelResearch.d.ts.map +1 -1
  45. package/dist/infra/orchestrator/parallelResearch.js +1 -4
  46. package/dist/infra/orchestrator/parallelResearch.js.map +1 -1
  47. package/dist/tools/convention/validateCodeQuality.d.ts.map +1 -1
  48. package/dist/tools/convention/validateCodeQuality.js +5 -4
  49. package/dist/tools/convention/validateCodeQuality.js.map +1 -1
  50. package/dist/tools/spec/traceabilityMatrix.d.ts +2 -0
  51. package/dist/tools/spec/traceabilityMatrix.d.ts.map +1 -1
  52. package/dist/tools/spec/traceabilityMatrix.js +50 -1
  53. package/dist/tools/spec/traceabilityMatrix.js.map +1 -1
  54. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.d.ts +10 -0
  55. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.d.ts.map +1 -0
  56. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.js +89 -0
  57. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.js.map +1 -0
  58. package/dist/tools/spec/traceabilityMatrix.test.js +19 -0
  59. package/dist/tools/spec/traceabilityMatrix.test.js.map +1 -1
  60. package/hooks/hooks.json +1 -0
  61. package/hooks/scripts/__tests__/.vibe/command-log.txt +39 -0
  62. package/hooks/scripts/__tests__/.vibe/memories/memories.db +0 -0
  63. package/hooks/scripts/__tests__/.vibe/memories/memories.db-shm +0 -0
  64. package/hooks/scripts/__tests__/.vibe/memories/memories.db-wal +0 -0
  65. package/hooks/scripts/__tests__/auto-test-debounce.test.js +145 -0
  66. package/hooks/scripts/__tests__/code-check-detectors.test.js +155 -0
  67. package/hooks/scripts/__tests__/dispatcher-inprocess.test.js +99 -0
  68. package/hooks/scripts/__tests__/post-edit-dispatcher.test.js +139 -0
  69. package/hooks/scripts/__tests__/pre-tool-guard.test.js +115 -1
  70. package/hooks/scripts/__tests__/run-ledger-verify-required.test.js +146 -0
  71. package/hooks/scripts/__tests__/run-ledger.test.js +330 -0
  72. package/hooks/scripts/__tests__/scope-from-spec.test.js +215 -0
  73. package/hooks/scripts/__tests__/sentinel-guard.test.js +79 -24
  74. package/hooks/scripts/__tests__/step-counter.test.js +95 -15
  75. package/hooks/scripts/__tests__/utils-npm-root.test.js +98 -0
  76. package/hooks/scripts/auto-commit.js +27 -1
  77. package/hooks/scripts/auto-format.js +85 -20
  78. package/hooks/scripts/auto-test.js +187 -37
  79. package/hooks/scripts/code-check.js +286 -90
  80. package/hooks/scripts/codex-hook-adapter.js +12 -1
  81. package/hooks/scripts/command-log.js +26 -16
  82. package/hooks/scripts/lib/dispatcher.js +38 -0
  83. package/hooks/scripts/lib/hook-context.js +101 -0
  84. package/hooks/scripts/lib/pr-gate-runner.js +62 -0
  85. package/hooks/scripts/lib/run-ledger.js +169 -0
  86. package/hooks/scripts/lib/scope-from-spec.js +40 -7
  87. package/hooks/scripts/post-edit-dispatcher.js +93 -20
  88. package/hooks/scripts/post-edit.js +40 -19
  89. package/hooks/scripts/pr-test-gate.js +8 -37
  90. package/hooks/scripts/pre-tool-dispatcher.js +18 -16
  91. package/hooks/scripts/pre-tool-guard.js +55 -52
  92. package/hooks/scripts/prompt-dispatcher.js +10 -0
  93. package/hooks/scripts/scope-guard.js +40 -39
  94. package/hooks/scripts/sentinel-guard.js +41 -41
  95. package/hooks/scripts/session-start.js +13 -1
  96. package/hooks/scripts/step-counter.js +100 -7
  97. package/hooks/scripts/stop-dispatcher.js +26 -0
  98. package/hooks/scripts/utils.js +63 -21
  99. package/hooks/scripts/verify-ledger.js +22 -0
  100. package/package.json +2 -2
  101. package/skills/spec/references/templates.md +11 -6
  102. package/skills/vibe.run/SKILL.md +144 -1681
  103. package/skills/vibe.run/references/brand-assets.md +59 -0
  104. package/skills/vibe.run/references/parallel-agents.md +326 -0
  105. package/skills/vibe.run/references/race-review.md +272 -0
  106. package/skills/vibe.run/references/ralph-loop.md +172 -0
  107. package/skills/vibe.run/references/ultrawork-mode.md +148 -0
  108. package/skills/vibe.trace/SKILL.md +25 -38
  109. package/skills/vibe.verify/SKILL.md +15 -0
  110. package/hooks/scripts/figma-guard.js +0 -219
@@ -2,9 +2,19 @@
2
2
  /**
3
3
  * PostToolUse Hook — 툴콜 스텝 카운터 + 패턴 로거 + 3-fail 감지기
4
4
  *
5
- * 책임 1) 모든 성공 툴콜을 1 스텝으로 집계 → `current-run.json`
5
+ * hooks.json matcher: "Edit|Write|Bash|Task|SlashCommand|NotebookEdit"
6
+ * → Read/Grep/Glob/WebFetch/WebSearch/TodoWrite/ToolSearch/ListMcpResourcesTool
7
+ * 는 matcher 단에서 제외되어 이 프로세스 자체가 spawn 되지 않는다.
8
+ * 아래 READ_ONLY_TOOLS 는 defense-in-depth 용 추가 가드이다.
9
+ *
10
+ * 책임 1) 액션 툴콜을 1 스텝으로 집계 → `current-run.json`
6
11
  * ↳ /vibe.verify 가 history.jsonl에 append 후 출력
7
- * 책임 2) 각 툴콜 한 줄을 `current-run.jsonl` append (post-task-curation SPEC)
12
+ * recipe-extractor meta(startedAt, steps) 소비
13
+ * [쓰기 스로틀] current-run.json 전체 재작성은 (a) 마지막 재작성 후
14
+ * ≥2초 경과, 또는 (b) 10이벤트마다 1회로 제한.
15
+ * 액션 툴(Edit/Write/Bash) 호출 + ≥2초 조건을 동시 충족할 때도 재작성.
16
+ * Stop 경로 등 최종 상태가 필요한 소비자는 staleness ≤10 이벤트를 허용.
17
+ * 책임 2) 각 툴콜 한 줄을 `current-run.jsonl` 에 append (항상 즉시 — 스로틀 없음)
8
18
  * ↳ Phase 3 의 recipe extractor 가 소비
9
19
  * 책임 3) (Phase 2) 실패 메시지 분류 + 같은 (file, category) 3회 반복 감지 →
10
20
  * `.vibe/anti-patterns/<slug>.md` 로 자동 저장.
@@ -24,6 +34,16 @@ const MAX_JSONL_LINES = 5000;
24
34
  const FAIL_WINDOW = 10;
25
35
  const FAIL_THRESHOLD = 3;
26
36
 
37
+ // 스로틀 파라미터
38
+ const REWRITE_INTERVAL_MS = 2000; // 최소 재작성 간격
39
+ const REWRITE_EVERY_N = 10; // N이벤트마다 강제 재작성
40
+
41
+ // 읽기 전용 툴 — defense-in-depth (matcher 단에서 이미 제거됨)
42
+ const READ_ONLY_TOOLS = new Set([
43
+ 'Read', 'Grep', 'Glob', 'WebFetch', 'WebSearch',
44
+ 'TodoWrite', 'ToolSearch', 'ListMcpResourcesTool',
45
+ ]);
46
+
27
47
  // ─────────────────────────────────────────────────────
28
48
  // stdin / env 에서 PostToolUse payload 추출
29
49
  // ─────────────────────────────────────────────────────
@@ -97,9 +117,43 @@ function classifyError(toolResponse) {
97
117
  }
98
118
 
99
119
  // ─────────────────────────────────────────────────────
100
- // 책임 1: current-run.json 카운터
120
+ // 스로틀: current-run.json 재작성 여부 결정
121
+ // ─────────────────────────────────────────────────────
122
+ /**
123
+ * 재작성해야 하는지 판단.
124
+ * - jsonlLineCount: jsonl 에 추가한 후의 총 라인 수 (이벤트 카운터 대리)
125
+ * - toolName: Edit/Write/Bash 인 경우 mtime 조건 충족 시 강제 재작성
126
+ * @param {string} toolName
127
+ * @param {number} jsonlLineCount
128
+ * @returns {boolean}
129
+ */
130
+ function shouldRewriteJson(toolName, jsonlLineCount) {
131
+ // N이벤트마다 강제 재작성 (race-tolerant — jsonl 줄 수가 카운터 역할)
132
+ if (jsonlLineCount % REWRITE_EVERY_N === 0) return true;
133
+
134
+ // 마지막 재작성 후 ≥2초 경과 여부 (mtime 기반)
135
+ try {
136
+ const stat = fs.statSync(CURRENT_RUN_JSON);
137
+ const elapsed = Date.now() - stat.mtimeMs;
138
+ if (elapsed >= REWRITE_INTERVAL_MS) return true;
139
+ } catch {
140
+ // 파일 없음 → 첫 쓰기, 허용
141
+ return true;
142
+ }
143
+
144
+ return false;
145
+ }
146
+
147
+ // ─────────────────────────────────────────────────────
148
+ // 책임 1: current-run.json 카운터 (스로틀 적용)
149
+ //
150
+ // steps 는 current-run.jsonl 의 라인 수에서 파생한다.
151
+ // 이렇게 하면 스로틀로 재작성을 건너뛰어도 재작성 시점에
152
+ // 정확한 steps 가 보장되며, 프로세스간 누적도 자연스럽게 처리된다.
101
153
  // ─────────────────────────────────────────────────────
102
- function bumpCounter() {
154
+ function bumpCounter(toolName, currentLineCount) {
155
+ if (!shouldRewriteJson(toolName, currentLineCount)) return; // 스로틀 — 재작성 생략
156
+
103
157
  let data = { feature: null, startedAt: null, steps: 0 };
104
158
  if (fs.existsSync(CURRENT_RUN_JSON)) {
105
159
  try {
@@ -107,12 +161,24 @@ function bumpCounter() {
107
161
  } catch { /* 손상 → 새로 시작 */ }
108
162
  }
109
163
  if (!data.startedAt) data.startedAt = new Date().toISOString();
110
- data.steps = (data.steps || 0) + 1;
111
- fs.writeFileSync(CURRENT_RUN_JSON, JSON.stringify(data, null, 2));
164
+ // steps = jsonl 라인 수에서 파생 ( 재작성 최신값 보장)
165
+ data.steps = currentLineCount;
166
+
167
+ // 원자적 쓰기 (tmp → rename) — 동시 에이전트 파일 손상 방지
168
+ const tmp = CURRENT_RUN_JSON + '.tmp';
169
+ try {
170
+ fs.writeFileSync(tmp, JSON.stringify(data, null, 2));
171
+ fs.renameSync(tmp, CURRENT_RUN_JSON);
172
+ } catch {
173
+ // rename 실패 시 직접 쓰기 (fail-open)
174
+ try { fs.writeFileSync(CURRENT_RUN_JSON, JSON.stringify(data, null, 2)); } catch { /* ignore */ }
175
+ try { fs.unlinkSync(tmp); } catch { /* ignore */ }
176
+ }
112
177
  }
113
178
 
114
179
  // ─────────────────────────────────────────────────────
115
180
  // 책임 2: current-run.jsonl append + error_category 채움
181
+ // 항상 즉시 append — 스로틀 없음 (3-fail detector, recipe-extractor 가 소비)
116
182
  // ─────────────────────────────────────────────────────
117
183
  function appendJsonl(stdinPayload) {
118
184
  const toolName = stdinPayload?.tool_name || process.argv[2] || '';
@@ -147,6 +213,21 @@ function appendJsonl(stdinPayload) {
147
213
  return record;
148
214
  }
149
215
 
216
+ /**
217
+ * jsonl 의 현재 라인 수를 반환 (stat 으로만 — 전체 파일 읽기 없음).
218
+ * 경합 안전 — 정확한 값이 아니어도 스로틀 판단에 충분하다.
219
+ */
220
+ function jsonlLineCount() {
221
+ try {
222
+ // 라인 수 근사: 파일 크기 / 평균 라인 길이(100바이트) — 정확도 불필요
223
+ // 실제 라인 수는 appendJsonl 직후 여기서 읽으면 +1 반영됨
224
+ const content = fs.readFileSync(CURRENT_RUN_JSONL, 'utf-8');
225
+ return content.split('\n').filter(Boolean).length;
226
+ } catch {
227
+ return 1; // 파일 없음 → 첫 이벤트로 간주
228
+ }
229
+ }
230
+
150
231
  // ─────────────────────────────────────────────────────
151
232
  // 책임 3b: 3-fail detector → anti-pattern md
152
233
  // ─────────────────────────────────────────────────────
@@ -238,10 +319,22 @@ try {
238
319
  }
239
320
 
240
321
  const stdinPayload = readStdinSync();
322
+ const toolName = stdinPayload?.tool_name || process.argv[2] || '';
241
323
 
242
- try { bumpCounter(); } catch { /* 카운터 실패 무시 */ }
324
+ // defense-in-depth: 읽기 전용 툴은 조기 종료 (matcher 단에서 이미 제거됨)
325
+ if (toolName && READ_ONLY_TOOLS.has(toolName)) {
326
+ process.exit(0);
327
+ }
328
+
329
+ // 책임 2를 먼저 실행 — jsonl 라인 수가 bumpCounter 스로틀 판단에 쓰임
243
330
  let lastRecord = null;
244
331
  try { lastRecord = appendJsonl(stdinPayload); } catch { /* 로깅 실패 무시 */ }
332
+
333
+ // 책임 1: jsonl append 후 라인 수로 스로틀 판단
334
+ const lineCount = jsonlLineCount();
335
+ try { bumpCounter(toolName, lineCount); } catch { /* 카운터 실패 무시 */ }
336
+
337
+ // 책임 3
245
338
  try {
246
339
  if (lastRecord && !lastRecord.ok && lastRecord.error_category) {
247
340
  const trip = detectThreeFail();
@@ -7,6 +7,7 @@
7
7
  * 현재: 단일 디스패처에서 순차 실행.
8
8
  *
9
9
  * 실행 순서:
10
+ * 0. verify-skip 경고/차단 (in-process)
10
11
  * 1. codex-review-gate — 리뷰 필요 여부 판단 (stdout → Claude 지시 주입)
11
12
  * 2. stop-notify — 완료 알림
12
13
  * 3. auto-commit — 변경 자동 커밋 (git hook cascade 주의)
@@ -16,9 +17,34 @@
16
17
  * 이 Stop dispatcher도 건너뛴다 (자식 세션에서 auto-commit 등이 돌 이유 없음).
17
18
  */
18
19
  import { dispatch } from './lib/dispatcher.js';
20
+ import { readLedger, markStopWarned } from './lib/run-ledger.js';
21
+ import { PROJECT_DIR, readProjectConfig } from './utils.js';
19
22
 
20
23
  if (process.env.VIBE_HOOK_DEPTH) process.exit(0);
21
24
 
25
+ // verify-skip 게이트 — runStarted가 있고 verifyPassed가 false이면 경고 또는 차단.
26
+ // stopWarned가 이미 true이면 루프 방지를 위해 스킵.
27
+ try {
28
+ const ledger = readLedger(PROJECT_DIR);
29
+ if (ledger && ledger.runStarted && !ledger.verifyPassed && !ledger.stopWarned) {
30
+ const config = readProjectConfig();
31
+ const gateMode = config?.verifyGate?.mode;
32
+
33
+ if (gateMode === 'block') {
34
+ // 1회에 한해 Stop 차단 — 루프 방지 플래그 먼저 세팅
35
+ markStopWarned(PROJECT_DIR);
36
+ const reason = '/vibe.verify not run after /vibe.run — stop blocked (verifyGate.mode=block)';
37
+ process.stdout.write(JSON.stringify({ decision: 'block', reason }) + '\n');
38
+ process.exit(0);
39
+ } else {
40
+ // 기본: warn 모드 — stderr에 경고, 루프 방지 플래그 세팅
41
+ markStopWarned(PROJECT_DIR);
42
+ const feature = ledger.runFeature ? ` (feature: ${ledger.runFeature})` : '';
43
+ process.stderr.write(`[vibe] WARNING: /vibe.run${feature} completed but /vibe.verify was not run.\n`);
44
+ }
45
+ }
46
+ } catch { /* verify-skip 게이트 실패는 이후 실행을 막지 않음 */ }
47
+
22
48
  try {
23
49
  await dispatch([
24
50
  { name: 'codex-review-gate', script: 'codex-review-gate.js' },
@@ -163,29 +163,71 @@ function toFileUrl(fsPath) {
163
163
  return url.endsWith('/') ? url : url + '/';
164
164
  }
165
165
 
166
- // 전역 npm 경로 캐시
166
+ // 전역 npm 경로 캐시 — L1: 인-프로세스, L2: 파일 캐시 (TTL 24h)
167
+ // VIBE_NPM_ROOT_CACHE_FILE 환경 변수로 테스트 시 격리된 경로 주입 가능
168
+ const NPM_ROOT_CACHE_FILE = process.env.VIBE_NPM_ROOT_CACHE_FILE ||
169
+ path.join(os.homedir(), '.vibe', 'cache', 'npm-root.json');
170
+ const NPM_ROOT_CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24시간
171
+
172
+ /** npm root -g 결과를 파일로 캐시 (원자적 쓰기). 실패는 조용히 무시. */
173
+ function saveNpmRootCache(npmRoot) {
174
+ try {
175
+ const dir = path.dirname(NPM_ROOT_CACHE_FILE);
176
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
177
+ const payload = JSON.stringify({ npmRoot, savedAt: Date.now() });
178
+ const tmp = NPM_ROOT_CACHE_FILE + '.tmp';
179
+ fs.writeFileSync(tmp, payload, { mode: 0o600 });
180
+ fs.renameSync(tmp, NPM_ROOT_CACHE_FILE);
181
+ } catch { /* 캐시 저장 실패는 무시 */ }
182
+ }
183
+
184
+ /** 파일 캐시에서 npm root 읽기. TTL 초과 또는 손상 시 null 반환. */
185
+ function loadNpmRootCache() {
186
+ try {
187
+ const raw = fs.readFileSync(NPM_ROOT_CACHE_FILE, 'utf-8');
188
+ const { npmRoot, savedAt } = JSON.parse(raw);
189
+ if (typeof npmRoot === 'string' && typeof savedAt === 'number') {
190
+ if (Date.now() - savedAt < NPM_ROOT_CACHE_TTL_MS) return npmRoot;
191
+ }
192
+ } catch { /* 파일 없음 / 손상 / 권한 → null */ }
193
+ return null;
194
+ }
195
+
196
+ /** npm root -g 플랫폼 폴백 (execSync 실패 시 사용). */
197
+ function npmRootFallback() {
198
+ if (IS_WINDOWS) {
199
+ const appData = process.env.APPDATA || process.env.LOCALAPPDATA || '';
200
+ return path.join(appData, 'npm', 'node_modules');
201
+ }
202
+ const homeDir = os.homedir();
203
+ const candidates = [
204
+ '/usr/local/lib/node_modules',
205
+ path.join(homeDir, '.npm-global', 'lib', 'node_modules'),
206
+ path.join(homeDir, '.nvm', 'versions', 'node', process.version, 'lib', 'node_modules'),
207
+ ];
208
+ return candidates.find(p => fs.existsSync(p)) || candidates[0];
209
+ }
210
+
211
+ // L1 인-프로세스 캐시
167
212
  let _globalNpmPath = null;
168
213
  export function getGlobalNpmPath() {
169
- if (_globalNpmPath === null) {
170
- try {
171
- _globalNpmPath = execSync('npm root -g', { encoding: 'utf8' }).trim();
172
- } catch {
173
- // 폴백: 플랫폼별 기본 경로
174
- if (IS_WINDOWS) {
175
- // Windows: %APPDATA%\npm\node_modules 또는 %LOCALAPPDATA%\npm\node_modules
176
- const appData = process.env.APPDATA || process.env.LOCALAPPDATA || '';
177
- _globalNpmPath = path.join(appData, 'npm', 'node_modules');
178
- } else {
179
- // macOS/Linux: /usr/local/lib/node_modules 또는 ~/.npm-global/lib/node_modules
180
- const homeDir = os.homedir();
181
- const defaultPaths = [
182
- '/usr/local/lib/node_modules',
183
- path.join(homeDir, '.npm-global', 'lib', 'node_modules'),
184
- path.join(homeDir, '.nvm', 'versions', 'node', process.version, 'lib', 'node_modules'),
185
- ];
186
- _globalNpmPath = defaultPaths.find(p => fs.existsSync(p)) || defaultPaths[0];
187
- }
188
- }
214
+ // L1: 인-프로세스 캐시 히트
215
+ if (_globalNpmPath !== null) return _globalNpmPath;
216
+
217
+ // L2: 파일 캐시 히트
218
+ const cached = loadNpmRootCache();
219
+ if (cached !== null) {
220
+ _globalNpmPath = cached;
221
+ return _globalNpmPath;
222
+ }
223
+
224
+ // L3: execSync 실행 후 파일 캐시에 저장
225
+ try {
226
+ _globalNpmPath = execSync('npm root -g', { encoding: 'utf8' }).trim();
227
+ saveNpmRootCache(_globalNpmPath);
228
+ } catch {
229
+ _globalNpmPath = npmRootFallback();
230
+ // 폴백은 캐시에 저장하지 않음 — 다음 프로세스에서 재시도
189
231
  }
190
232
  return _globalNpmPath;
191
233
  }
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * verify-ledger CLI — vibe.verify 결과를 run-ledger에 기록.
4
+ *
5
+ * 사용법: node hooks/scripts/verify-ledger.js pass|fail
6
+ *
7
+ * vibe.verify/SKILL.md 에서 검증 완료 시 호출.
8
+ * stdout 출력은 에이전트가 Bash로 실행하는 컨텍스트이므로 허용.
9
+ * 항상 exit 0.
10
+ */
11
+
12
+ import { recordVerify } from './lib/run-ledger.js';
13
+
14
+ const arg = process.argv[2];
15
+ const passed = arg === 'pass';
16
+ const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
17
+
18
+ recordVerify(projectDir, passed);
19
+
20
+ const status = passed ? 'pass' : 'fail';
21
+ process.stdout.write(`[verify-ledger] recorded: verifyPassed=${passed} (${status})\n`);
22
+ process.exit(0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@su-record/vibe",
3
- "version": "2.12.5",
4
- "description": "AI Coding Framework for Claude Code — 56 agents, 45 skills, multi-LLM orchestration",
3
+ "version": "2.13.0",
4
+ "description": "AI Coding Framework for Claude Code — 60+ agents, 69 skills, multi-LLM orchestration",
5
5
  "type": "module",
6
6
  "main": "dist/cli/index.js",
7
7
  "exports": {
@@ -86,19 +86,24 @@ Define AI role and expertise for implementation
86
86
 
87
87
  ## Task
88
88
  <task>
89
+ <!-- ⚠️ MANDATORY: Every functional requirement item MUST carry a REQ-ID so the RTM can extract it.
90
+ Format: REQ-{feature-name}-NNN (feature = SPEC file basename, NNN = 3-digit zero-padded number)
91
+ Example: REQ-auth-login-001
92
+ Regex the RTM uses: /\b(REQ-[a-z0-9-]+-\d{3})[:\s]/gi — use uppercase REQ-, lowercase feature segment, exactly 3 digits.
93
+ status === 'empty' means the RTM gate MUST be treated as failed/not-applicable, never as 100% pass. -->
89
94
  ### Phase 1: {phase-name}
90
- 1. [ ] {specific task}
95
+ 1. [ ] REQ-{feature-name}-001: {specific task}
91
96
  - File: `path/to/file`
92
97
  - Verify: `command`
93
- 2. [ ] {specific task}
98
+ 2. [ ] REQ-{feature-name}-002: {specific task}
94
99
 
95
100
  ### Phase 2: {phase-name}
96
- 1. [ ] {specific task}
97
- 2. [ ] {specific task}
101
+ 1. [ ] REQ-{feature-name}-003: {specific task}
102
+ 2. [ ] REQ-{feature-name}-004: {specific task}
98
103
 
99
104
  ### Phase 3: Testing and Verification
100
- 1. [ ] Unit Tests
101
- 2. [ ] Integration Tests
105
+ 1. [ ] REQ-{feature-name}-005: Unit Tests
106
+ 2. [ ] REQ-{feature-name}-006: Integration Tests
102
107
  </task>
103
108
 
104
109
  ## Constraints