@su-record/vibe 2.12.5 → 2.14.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 (139) hide show
  1. package/CLAUDE.md +25 -16
  2. package/README.en.md +16 -14
  3. package/README.md +13 -11
  4. package/dist/cli/postinstall/constants.d.ts.map +1 -1
  5. package/dist/cli/postinstall/constants.js +1 -0
  6. package/dist/cli/postinstall/constants.js.map +1 -1
  7. package/dist/cli/postinstall/fs-utils.d.ts +23 -0
  8. package/dist/cli/postinstall/fs-utils.d.ts.map +1 -1
  9. package/dist/cli/postinstall/fs-utils.js +71 -0
  10. package/dist/cli/postinstall/fs-utils.js.map +1 -1
  11. package/dist/cli/postinstall/fs-utils.test.js +69 -1
  12. package/dist/cli/postinstall/fs-utils.test.js.map +1 -1
  13. package/dist/cli/postinstall/main.d.ts.map +1 -1
  14. package/dist/cli/postinstall/main.js +12 -2
  15. package/dist/cli/postinstall/main.js.map +1 -1
  16. package/dist/cli/setup/CodexHooks.test.js +27 -0
  17. package/dist/cli/setup/CodexHooks.test.js.map +1 -1
  18. package/dist/cli/setup/ProjectSetup.d.ts.map +1 -1
  19. package/dist/cli/setup/ProjectSetup.js +6 -5
  20. package/dist/cli/setup/ProjectSetup.js.map +1 -1
  21. package/dist/infra/lib/DecisionTracer.d.ts +4 -0
  22. package/dist/infra/lib/DecisionTracer.d.ts.map +1 -1
  23. package/dist/infra/lib/DecisionTracer.js +4 -0
  24. package/dist/infra/lib/DecisionTracer.js.map +1 -1
  25. package/dist/infra/lib/LoopBreaker.d.ts +4 -0
  26. package/dist/infra/lib/LoopBreaker.d.ts.map +1 -1
  27. package/dist/infra/lib/LoopBreaker.js +4 -0
  28. package/dist/infra/lib/LoopBreaker.js.map +1 -1
  29. package/dist/infra/lib/ReviewRace.d.ts +4 -0
  30. package/dist/infra/lib/ReviewRace.d.ts.map +1 -1
  31. package/dist/infra/lib/ReviewRace.js +4 -0
  32. package/dist/infra/lib/ReviewRace.js.map +1 -1
  33. package/dist/infra/lib/SkillQualityGate.d.ts +4 -0
  34. package/dist/infra/lib/SkillQualityGate.d.ts.map +1 -1
  35. package/dist/infra/lib/SkillQualityGate.js +4 -0
  36. package/dist/infra/lib/SkillQualityGate.js.map +1 -1
  37. package/dist/infra/lib/UltraQA.d.ts +4 -0
  38. package/dist/infra/lib/UltraQA.d.ts.map +1 -1
  39. package/dist/infra/lib/UltraQA.js +4 -0
  40. package/dist/infra/lib/UltraQA.js.map +1 -1
  41. package/dist/infra/lib/VerificationLoop.d.ts +4 -0
  42. package/dist/infra/lib/VerificationLoop.d.ts.map +1 -1
  43. package/dist/infra/lib/VerificationLoop.js +4 -0
  44. package/dist/infra/lib/VerificationLoop.js.map +1 -1
  45. package/dist/infra/orchestrator/index.d.ts.map +1 -1
  46. package/dist/infra/orchestrator/index.js +1 -3
  47. package/dist/infra/orchestrator/index.js.map +1 -1
  48. package/dist/infra/orchestrator/parallelResearch.d.ts.map +1 -1
  49. package/dist/infra/orchestrator/parallelResearch.js +1 -4
  50. package/dist/infra/orchestrator/parallelResearch.js.map +1 -1
  51. package/dist/tools/convention/validateCodeQuality.d.ts.map +1 -1
  52. package/dist/tools/convention/validateCodeQuality.js +5 -4
  53. package/dist/tools/convention/validateCodeQuality.js.map +1 -1
  54. package/dist/tools/index.d.ts +2 -0
  55. package/dist/tools/index.d.ts.map +1 -1
  56. package/dist/tools/index.js +2 -0
  57. package/dist/tools/index.js.map +1 -1
  58. package/dist/tools/loop/index.d.ts +6 -0
  59. package/dist/tools/loop/index.d.ts.map +1 -0
  60. package/dist/tools/loop/index.js +5 -0
  61. package/dist/tools/loop/index.js.map +1 -0
  62. package/dist/tools/loop/validateLoopDefinition.d.ts +38 -0
  63. package/dist/tools/loop/validateLoopDefinition.d.ts.map +1 -0
  64. package/dist/tools/loop/validateLoopDefinition.js +224 -0
  65. package/dist/tools/loop/validateLoopDefinition.js.map +1 -0
  66. package/dist/tools/loop/validateLoopDefinition.test.d.ts +14 -0
  67. package/dist/tools/loop/validateLoopDefinition.test.d.ts.map +1 -0
  68. package/dist/tools/loop/validateLoopDefinition.test.js +229 -0
  69. package/dist/tools/loop/validateLoopDefinition.test.js.map +1 -0
  70. package/dist/tools/spec/traceabilityMatrix.d.ts +2 -0
  71. package/dist/tools/spec/traceabilityMatrix.d.ts.map +1 -1
  72. package/dist/tools/spec/traceabilityMatrix.js +50 -1
  73. package/dist/tools/spec/traceabilityMatrix.js.map +1 -1
  74. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.d.ts +10 -0
  75. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.d.ts.map +1 -0
  76. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.js +89 -0
  77. package/dist/tools/spec/traceabilityMatrix.path-resolution.test.js.map +1 -0
  78. package/dist/tools/spec/traceabilityMatrix.test.js +19 -0
  79. package/dist/tools/spec/traceabilityMatrix.test.js.map +1 -1
  80. package/hooks/hooks.json +1 -0
  81. package/hooks/scripts/__tests__/.vibe/command-log.txt +60 -0
  82. package/hooks/scripts/__tests__/.vibe/memories/memories.db +0 -0
  83. package/hooks/scripts/__tests__/.vibe/memories/memories.db-shm +0 -0
  84. package/hooks/scripts/__tests__/.vibe/memories/memories.db-wal +0 -0
  85. package/hooks/scripts/__tests__/auto-test-debounce.test.js +145 -0
  86. package/hooks/scripts/__tests__/code-check-detectors.test.js +155 -0
  87. package/hooks/scripts/__tests__/dispatcher-inprocess.test.js +99 -0
  88. package/hooks/scripts/__tests__/keyword-detector.test.js +26 -18
  89. package/hooks/scripts/__tests__/loop-ledger.test.js +321 -0
  90. package/hooks/scripts/__tests__/post-edit-dispatcher.test.js +139 -0
  91. package/hooks/scripts/__tests__/pre-tool-guard.test.js +115 -1
  92. package/hooks/scripts/__tests__/run-ledger-verify-required.test.js +146 -0
  93. package/hooks/scripts/__tests__/run-ledger.test.js +330 -0
  94. package/hooks/scripts/__tests__/scope-from-spec.test.js +215 -0
  95. package/hooks/scripts/__tests__/sentinel-guard.test.js +79 -24
  96. package/hooks/scripts/__tests__/step-counter.test.js +95 -15
  97. package/hooks/scripts/__tests__/utils-npm-root.test.js +98 -0
  98. package/hooks/scripts/auto-commit.js +27 -1
  99. package/hooks/scripts/auto-format.js +85 -20
  100. package/hooks/scripts/auto-test.js +187 -37
  101. package/hooks/scripts/code-check.js +286 -90
  102. package/hooks/scripts/codex-hook-adapter.js +12 -1
  103. package/hooks/scripts/command-log.js +26 -16
  104. package/hooks/scripts/keyword-detector.js +22 -22
  105. package/hooks/scripts/lib/dispatcher.js +38 -0
  106. package/hooks/scripts/lib/hook-context.js +130 -0
  107. package/hooks/scripts/lib/loop-ledger.js +118 -0
  108. package/hooks/scripts/lib/pr-gate-runner.js +62 -0
  109. package/hooks/scripts/lib/run-ledger.js +169 -0
  110. package/hooks/scripts/lib/scope-from-spec.js +40 -7
  111. package/hooks/scripts/loop-ledger.js +56 -0
  112. package/hooks/scripts/post-edit-dispatcher.js +93 -20
  113. package/hooks/scripts/post-edit.js +40 -19
  114. package/hooks/scripts/pr-test-gate.js +8 -37
  115. package/hooks/scripts/pre-tool-dispatcher.js +18 -16
  116. package/hooks/scripts/pre-tool-guard.js +55 -52
  117. package/hooks/scripts/prompt-dispatcher.js +10 -0
  118. package/hooks/scripts/scope-guard.js +40 -39
  119. package/hooks/scripts/sentinel-guard.js +41 -41
  120. package/hooks/scripts/session-start.js +13 -1
  121. package/hooks/scripts/step-counter.js +100 -7
  122. package/hooks/scripts/stop-dispatcher.js +26 -0
  123. package/hooks/scripts/utils.js +63 -21
  124. package/hooks/scripts/verify-ledger.js +22 -0
  125. package/package.json +2 -2
  126. package/skills/spec/references/templates.md +11 -6
  127. package/skills/vibe/SKILL.md +40 -23
  128. package/skills/vibe.loop/SKILL.md +116 -0
  129. package/skills/vibe.run/SKILL.md +153 -1686
  130. package/skills/vibe.run/references/brand-assets.md +59 -0
  131. package/skills/vibe.run/references/parallel-agents.md +326 -0
  132. package/skills/vibe.run/references/race-review.md +272 -0
  133. package/skills/vibe.run/references/ralph-loop.md +173 -0
  134. package/skills/vibe.run/references/ultrawork-mode.md +151 -0
  135. package/skills/vibe.trace/SKILL.md +25 -38
  136. package/skills/vibe.verify/SKILL.md +15 -0
  137. package/vibe/rules/loop-contract.md +54 -0
  138. package/vibe/templates/loop-template.md +69 -0
  139. package/hooks/scripts/figma-guard.js +0 -219
@@ -1,219 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Figma Guard — vibe.figma 작업 시 스킬 우회 차단
4
- *
5
- * 차단 대상:
6
- * 1. /tmp/{feature}/ 하위에 자체 정제/생성 스크립트(.mjs/.js) 작성
7
- * → figma-refine.js / figma-to-scss.js 호출하라고 차단
8
- * 2. SCSS 파일을 직접 작성 (figma-to-scss.js 호출 흔적 없이)
9
- * 3. Vue/React <style> 블록에 figma 관련 SCSS 클래스 직접 작성
10
- *
11
- * 작동 조건:
12
- * - tool: Write 또는 Edit
13
- * - file_path가 figma 작업 컨텍스트에 해당
14
- *
15
- * Exit codes:
16
- * 0 — 통과
17
- * 2 — 차단
18
- */
19
-
20
- import fs from 'fs';
21
- import path from 'path';
22
- import os from 'os';
23
-
24
- // ─── stdin 읽기 ─────────────────────────────────────────────────────
25
-
26
- function readStdinSync() {
27
- try {
28
- if (process.stdin.isTTY) return null;
29
- // fd 0을 직접 사용 (Windows는 '/dev/stdin'이 없음)
30
- const buf = Buffer.alloc(1024 * 1024); // 1MB
31
- const bytesRead = fs.readSync(0, buf, 0, buf.length, null);
32
- if (bytesRead > 0) {
33
- return JSON.parse(buf.toString('utf-8', 0, bytesRead));
34
- }
35
- } catch { /* fallback */ }
36
- return null;
37
- }
38
-
39
- // ─── 검사 1: /tmp/{feature}/ 자체 작성 스크립트 ─────────────────────
40
-
41
- const FORBIDDEN_TMP_SCRIPT_PATTERNS = [
42
- /\/tmp\/[^/]+\/refine[\w-]*\.(mjs|js)$/i,
43
- /\/tmp\/[^/]+\/.*sections.*\.(mjs|js)$/i,
44
- /\/tmp\/[^/]+\/.*to-scss.*\.(mjs|js)$/i,
45
- /\/tmp\/[^/]+\/.*generate-scss.*\.(mjs|js)$/i,
46
- /\/tmp\/[^/]+\/analyze-tree\.(mjs|js)$/i,
47
- /\/tmp\/[^/]+\/analyze-section\.(mjs|js)$/i,
48
- ];
49
-
50
- function checkForbiddenTmpScript(filePath) {
51
- if (!filePath) return null;
52
- for (const pattern of FORBIDDEN_TMP_SCRIPT_PATTERNS) {
53
- if (pattern.test(filePath)) {
54
- return {
55
- block: true,
56
- reason: `자체 작성 figma 스크립트 금지: ${path.basename(filePath)}`,
57
- suggestion: 'figma-refine.js / figma-to-scss.js / figma-validate.js 사용. ' +
58
- '결과가 마음에 안 들면 ~/.vibe/hooks/scripts/figma-*.js 자체를 수정하세요.'
59
- };
60
- }
61
- }
62
- return null;
63
- }
64
-
65
- // ─── 검사 2: SCSS 직접 작성 ─────────────────────────────────────────
66
-
67
- /**
68
- * Figma 작업 컨텍스트인지 판단:
69
- * - 현재 작업 디렉토리 또는 file_path에 figma 관련 흔적이 있어야 함
70
- * - /tmp/ 하위에 sections.json이 존재 → 활성 figma 작업으로 판단
71
- */
72
- function isFigmaContext() {
73
- try {
74
- const tmpDirs = fs.readdirSync('/tmp', { withFileTypes: true });
75
- for (const entry of tmpDirs) {
76
- if (!entry.isDirectory()) continue;
77
- const moSections = path.join('/tmp', entry.name, 'mo-main', 'sections.json');
78
- const pcSections = path.join('/tmp', entry.name, 'pc-main', 'sections.json');
79
- if (fs.existsSync(moSections) || fs.existsSync(pcSections)) {
80
- return { active: true, feature: entry.name };
81
- }
82
- }
83
- } catch { /* ignore */ }
84
- return { active: false };
85
- }
86
-
87
- /**
88
- * SCSS 파일 작성 시도 검사
89
- */
90
- function checkScssWrite(filePath, content) {
91
- if (!filePath) return null;
92
- if (!filePath.endsWith('.scss')) return null;
93
-
94
- // figma 컨텍스트가 아니면 통과
95
- const ctx = isFigmaContext();
96
- if (!ctx.active) return null;
97
-
98
- // 자동 생성 표시 코멘트 있으면 통과
99
- if (typeof content === 'string' && content.includes('Auto-generated from sections.json')) {
100
- return null;
101
- }
102
-
103
- // 빈 파일 또는 @import만 있는 경우 통과
104
- if (typeof content === 'string') {
105
- const meaningfulLines = content
106
- .split('\n')
107
- .map(l => l.trim())
108
- .filter(l => l && !l.startsWith('//') && !l.startsWith('/*'));
109
- const hasOnlyImports = meaningfulLines.every(l =>
110
- l.startsWith('@import') || l.startsWith('@use') || l.startsWith('@forward')
111
- );
112
- if (hasOnlyImports) return null;
113
- }
114
-
115
- return {
116
- block: true,
117
- reason: `SCSS 직접 작성 금지: ${filePath}`,
118
- suggestion: `figma-to-scss.js로 생성하세요:\n` +
119
- ` node ~/.vibe/hooks/scripts/figma-to-scss.js \\\n` +
120
- ` /tmp/${ctx.feature}/{bp}-main/sections.json \\\n` +
121
- ` --out=$(dirname ${filePath})`
122
- };
123
- }
124
-
125
- // ─── 검사 3: Vue/React <style> 블록에 CSS 값 작성 ───────────────────
126
-
127
- function checkVueStyleBlock(filePath, content) {
128
- if (!filePath) return null;
129
- if (!/\.(vue|jsx|tsx)$/.test(filePath)) return null;
130
-
131
- const ctx = isFigmaContext();
132
- if (!ctx.active) return null;
133
-
134
- // 파일 경로에 feature 이름이 있는지 확인
135
- if (!filePath.includes(ctx.feature)) return null;
136
-
137
- if (typeof content !== 'string') return null;
138
-
139
- // <style ...> ... </style> 블록 추출
140
- const styleBlocks = content.match(/<style[^>]*>([\s\S]*?)<\/style>/g);
141
- if (!styleBlocks || styleBlocks.length === 0) return null;
142
-
143
- for (const block of styleBlocks) {
144
- const inner = block.replace(/<style[^>]*>/, '').replace(/<\/style>/, '');
145
- const meaningfulLines = inner
146
- .split('\n')
147
- .map(l => l.trim())
148
- .filter(l => l && !l.startsWith('//') && !l.startsWith('/*'));
149
-
150
- // @import / @use 만 있으면 통과
151
- const hasOnlyImports = meaningfulLines.every(l =>
152
- l.startsWith('@import') || l.startsWith('@use') || l.startsWith('@forward')
153
- );
154
- if (hasOnlyImports) continue;
155
-
156
- // CSS 값으로 보이는 라인 검출 (px, rem, color, flex 등)
157
- const hasCssValue = meaningfulLines.some(l =>
158
- /:\s*[^;]*(?:px|rem|em|%|vh|vw|#[0-9a-fA-F]|rgba?\(|flex|grid|absolute|relative|inherit)/.test(l)
159
- );
160
- if (hasCssValue) {
161
- return {
162
- block: true,
163
- reason: `Vue/React <style> 블록에 CSS 직접 작성 금지: ${path.basename(filePath)}`,
164
- suggestion: `<style> 블록은 @import만 허용:\n` +
165
- ` <style lang="scss" scoped>\n` +
166
- ` @import '~/assets/scss/${ctx.feature}/index.scss';\n` +
167
- ` </style>`
168
- };
169
- }
170
- }
171
-
172
- return null;
173
- }
174
-
175
- // ─── 메인 ───────────────────────────────────────────────────────────
176
-
177
- const stdinPayload = readStdinSync();
178
- if (!stdinPayload) {
179
- process.exit(0);
180
- }
181
-
182
- const toolName = stdinPayload.tool_name || '';
183
- const toolInput = stdinPayload.tool_input || {};
184
-
185
- // Write 또는 Edit만 검사
186
- if (toolName !== 'Write' && toolName !== 'Edit') {
187
- process.exit(0);
188
- }
189
-
190
- const filePath = toolInput.file_path || '';
191
- const content = toolInput.content || toolInput.new_string || '';
192
-
193
- // 3단계 검사
194
- const checks = [
195
- checkForbiddenTmpScript(filePath),
196
- checkScssWrite(filePath, content),
197
- checkVueStyleBlock(filePath, content),
198
- ];
199
-
200
- const violations = checks.filter(c => c !== null);
201
-
202
- if (violations.length === 0) {
203
- process.exit(0);
204
- }
205
-
206
- // 차단
207
- const messages = ['🚫 FIGMA GUARD: 스킬 규칙 위반'];
208
- for (const v of violations) {
209
- messages.push('');
210
- messages.push(` ${v.reason}`);
211
- messages.push(` 💡 ${v.suggestion}`);
212
- }
213
- messages.push('');
214
- messages.push('⛔ vibe.figma 작업 중에는 스크립트 파이프라인을 우회하지 마세요.');
215
- messages.push(' ~/.vibe/hooks/scripts/figma-{refine,to-scss,validate}.js만 사용.');
216
-
217
- // PreToolUse hook은 stderr 출력 + exit 2로 차단
218
- console.error(messages.join('\n'));
219
- process.exit(2);