@su-record/vibe 2.6.13 → 2.6.15

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 (234) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +497 -497
  3. package/agents/architect-low.md +41 -41
  4. package/agents/architect-medium.md +59 -59
  5. package/agents/architect.md +80 -80
  6. package/agents/build-error-resolver.md +115 -115
  7. package/agents/compounder.md +261 -261
  8. package/agents/diagrammer.md +178 -178
  9. package/agents/e2e-tester.md +266 -266
  10. package/agents/explorer-low.md +42 -42
  11. package/agents/explorer-medium.md +59 -59
  12. package/agents/explorer.md +48 -48
  13. package/agents/implementer-low.md +43 -43
  14. package/agents/implementer-medium.md +52 -52
  15. package/agents/implementer.md +54 -54
  16. package/agents/refactor-cleaner.md +143 -143
  17. package/agents/research/best-practices-agent.md +199 -199
  18. package/agents/research/codebase-patterns-agent.md +157 -157
  19. package/agents/research/framework-docs-agent.md +188 -188
  20. package/agents/research/security-advisory-agent.md +213 -213
  21. package/agents/review/architecture-reviewer.md +107 -107
  22. package/agents/review/complexity-reviewer.md +116 -116
  23. package/agents/review/data-integrity-reviewer.md +88 -88
  24. package/agents/review/git-history-reviewer.md +103 -103
  25. package/agents/review/performance-reviewer.md +86 -86
  26. package/agents/review/python-reviewer.md +150 -150
  27. package/agents/review/rails-reviewer.md +139 -139
  28. package/agents/review/react-reviewer.md +144 -144
  29. package/agents/review/security-reviewer.md +80 -80
  30. package/agents/review/simplicity-reviewer.md +140 -140
  31. package/agents/review/test-coverage-reviewer.md +116 -116
  32. package/agents/review/typescript-reviewer.md +127 -127
  33. package/agents/searcher.md +54 -54
  34. package/agents/simplifier.md +120 -120
  35. package/agents/tester.md +49 -49
  36. package/agents/ui-previewer.md +268 -268
  37. package/commands/vibe.analyze.md +356 -356
  38. package/commands/vibe.reason.md +329 -329
  39. package/commands/vibe.review.md +412 -412
  40. package/commands/vibe.run.md +1266 -1266
  41. package/commands/vibe.spec.md +1054 -1054
  42. package/commands/vibe.spec.review.md +319 -319
  43. package/commands/vibe.trace.md +161 -161
  44. package/commands/vibe.utils.md +376 -376
  45. package/commands/vibe.verify.md +375 -375
  46. package/dist/cli/collaborator.js +52 -52
  47. package/dist/cli/detect.d.ts.map +1 -1
  48. package/dist/cli/detect.js +118 -44
  49. package/dist/cli/detect.js.map +1 -1
  50. package/dist/cli/hud.js +20 -20
  51. package/dist/cli/index.js +118 -118
  52. package/dist/cli/index.js.map +1 -1
  53. package/dist/cli/llm.js +144 -144
  54. package/dist/cli/mcp.d.ts +49 -0
  55. package/dist/cli/mcp.d.ts.map +1 -0
  56. package/dist/cli/mcp.js +169 -0
  57. package/dist/cli/mcp.js.map +1 -0
  58. package/dist/cli/postinstall.js +858 -858
  59. package/dist/cli/setup/ProjectSetup.d.ts +3 -0
  60. package/dist/cli/setup/ProjectSetup.d.ts.map +1 -1
  61. package/dist/cli/setup/ProjectSetup.js +28 -6
  62. package/dist/cli/setup/ProjectSetup.js.map +1 -1
  63. package/dist/lib/DeepInit.js +24 -24
  64. package/dist/lib/IterationTracker.js +11 -11
  65. package/dist/lib/PythonParser.js +108 -108
  66. package/dist/lib/ReviewRace.js +96 -96
  67. package/dist/lib/SkillFrontmatter.js +28 -28
  68. package/dist/lib/SkillQualityGate.js +9 -9
  69. package/dist/lib/SkillRepository.js +159 -159
  70. package/dist/lib/UltraQA.js +77 -77
  71. package/dist/lib/gemini-api.js +5 -5
  72. package/dist/lib/gemini-mcp.d.ts +10 -0
  73. package/dist/lib/gemini-mcp.d.ts.map +1 -0
  74. package/dist/lib/gemini-mcp.js +353 -0
  75. package/dist/lib/gemini-mcp.js.map +1 -0
  76. package/dist/lib/gpt-api.js +4 -4
  77. package/dist/lib/gpt-mcp.d.ts +10 -0
  78. package/dist/lib/gpt-mcp.d.ts.map +1 -0
  79. package/dist/lib/gpt-mcp.js +352 -0
  80. package/dist/lib/gpt-mcp.js.map +1 -0
  81. package/dist/lib/memory/KnowledgeGraph.js +4 -4
  82. package/dist/lib/memory/MemorySearch.js +20 -20
  83. package/dist/lib/memory/MemoryStorage.js +64 -64
  84. package/dist/orchestrator/AgentManager.js +12 -12
  85. package/dist/orchestrator/MultiLlmResearch.js +8 -8
  86. package/dist/orchestrator/SmartRouter.js +11 -11
  87. package/dist/orchestrator/parallelResearch.js +24 -24
  88. package/dist/tools/analytics/getUsageAnalytics.d.ts +10 -0
  89. package/dist/tools/analytics/getUsageAnalytics.d.ts.map +1 -0
  90. package/dist/tools/analytics/getUsageAnalytics.js +246 -0
  91. package/dist/tools/analytics/getUsageAnalytics.js.map +1 -0
  92. package/dist/tools/analytics/index.d.ts +5 -0
  93. package/dist/tools/analytics/index.d.ts.map +1 -0
  94. package/dist/tools/analytics/index.js +5 -0
  95. package/dist/tools/analytics/index.js.map +1 -0
  96. package/dist/tools/convention/analyzeComplexity.test.js +115 -115
  97. package/dist/tools/convention/getCodingGuide.d.ts +7 -0
  98. package/dist/tools/convention/getCodingGuide.d.ts.map +1 -0
  99. package/dist/tools/convention/getCodingGuide.js +69 -0
  100. package/dist/tools/convention/getCodingGuide.js.map +1 -0
  101. package/dist/tools/convention/validateCodeQuality.test.js +104 -104
  102. package/dist/tools/planning/analyzeRequirements.d.ts +9 -0
  103. package/dist/tools/planning/analyzeRequirements.d.ts.map +1 -0
  104. package/dist/tools/planning/analyzeRequirements.js +171 -0
  105. package/dist/tools/planning/analyzeRequirements.js.map +1 -0
  106. package/dist/tools/planning/createUserStories.d.ts +9 -0
  107. package/dist/tools/planning/createUserStories.d.ts.map +1 -0
  108. package/dist/tools/planning/createUserStories.js +124 -0
  109. package/dist/tools/planning/createUserStories.js.map +1 -0
  110. package/dist/tools/planning/featureRoadmap.d.ts +10 -0
  111. package/dist/tools/planning/featureRoadmap.d.ts.map +1 -0
  112. package/dist/tools/planning/featureRoadmap.js +207 -0
  113. package/dist/tools/planning/featureRoadmap.js.map +1 -0
  114. package/dist/tools/planning/generatePrd.d.ts +11 -0
  115. package/dist/tools/planning/generatePrd.d.ts.map +1 -0
  116. package/dist/tools/planning/generatePrd.js +161 -0
  117. package/dist/tools/planning/generatePrd.js.map +1 -0
  118. package/dist/tools/planning/index.d.ts +8 -0
  119. package/dist/tools/planning/index.d.ts.map +1 -0
  120. package/dist/tools/planning/index.js +8 -0
  121. package/dist/tools/planning/index.js.map +1 -0
  122. package/dist/tools/prompt/analyzePrompt.d.ts +7 -0
  123. package/dist/tools/prompt/analyzePrompt.d.ts.map +1 -0
  124. package/dist/tools/prompt/analyzePrompt.js +150 -0
  125. package/dist/tools/prompt/analyzePrompt.js.map +1 -0
  126. package/dist/tools/prompt/enhancePrompt.d.ts +8 -0
  127. package/dist/tools/prompt/enhancePrompt.d.ts.map +1 -0
  128. package/dist/tools/prompt/enhancePrompt.js +110 -0
  129. package/dist/tools/prompt/enhancePrompt.js.map +1 -0
  130. package/dist/tools/prompt/enhancePromptGemini.d.ts +8 -0
  131. package/dist/tools/prompt/enhancePromptGemini.d.ts.map +1 -0
  132. package/dist/tools/prompt/enhancePromptGemini.js +332 -0
  133. package/dist/tools/prompt/enhancePromptGemini.js.map +1 -0
  134. package/dist/tools/prompt/index.d.ts +7 -0
  135. package/dist/tools/prompt/index.d.ts.map +1 -0
  136. package/dist/tools/prompt/index.js +7 -0
  137. package/dist/tools/prompt/index.js.map +1 -0
  138. package/dist/tools/reasoning/applyReasoningFramework.d.ts +8 -0
  139. package/dist/tools/reasoning/applyReasoningFramework.d.ts.map +1 -0
  140. package/dist/tools/reasoning/applyReasoningFramework.js +266 -0
  141. package/dist/tools/reasoning/applyReasoningFramework.js.map +1 -0
  142. package/dist/tools/reasoning/index.d.ts +5 -0
  143. package/dist/tools/reasoning/index.d.ts.map +1 -0
  144. package/dist/tools/reasoning/index.js +5 -0
  145. package/dist/tools/reasoning/index.js.map +1 -0
  146. package/dist/tools/spec/prdParser.test.js +171 -171
  147. package/dist/tools/spec/specGenerator.js +169 -169
  148. package/dist/tools/spec/traceabilityMatrix.js +64 -64
  149. package/dist/tools/spec/traceabilityMatrix.test.js +28 -28
  150. package/dist/tools/thinking/analyzeProblem.d.ts +7 -0
  151. package/dist/tools/thinking/analyzeProblem.d.ts.map +1 -0
  152. package/dist/tools/thinking/analyzeProblem.js +55 -0
  153. package/dist/tools/thinking/analyzeProblem.js.map +1 -0
  154. package/dist/tools/thinking/breakDownProblem.d.ts +8 -0
  155. package/dist/tools/thinking/breakDownProblem.d.ts.map +1 -0
  156. package/dist/tools/thinking/breakDownProblem.js +145 -0
  157. package/dist/tools/thinking/breakDownProblem.js.map +1 -0
  158. package/dist/tools/thinking/createThinkingChain.d.ts +7 -0
  159. package/dist/tools/thinking/createThinkingChain.d.ts.map +1 -0
  160. package/dist/tools/thinking/createThinkingChain.js +44 -0
  161. package/dist/tools/thinking/createThinkingChain.js.map +1 -0
  162. package/dist/tools/thinking/formatAsPlan.d.ts +9 -0
  163. package/dist/tools/thinking/formatAsPlan.d.ts.map +1 -0
  164. package/dist/tools/thinking/formatAsPlan.js +78 -0
  165. package/dist/tools/thinking/formatAsPlan.js.map +1 -0
  166. package/dist/tools/thinking/index.d.ts +10 -0
  167. package/dist/tools/thinking/index.d.ts.map +1 -0
  168. package/dist/tools/thinking/index.js +10 -0
  169. package/dist/tools/thinking/index.js.map +1 -0
  170. package/dist/tools/thinking/stepByStepAnalysis.d.ts +8 -0
  171. package/dist/tools/thinking/stepByStepAnalysis.d.ts.map +1 -0
  172. package/dist/tools/thinking/stepByStepAnalysis.js +63 -0
  173. package/dist/tools/thinking/stepByStepAnalysis.js.map +1 -0
  174. package/dist/tools/thinking/thinkAloudProcess.d.ts +8 -0
  175. package/dist/tools/thinking/thinkAloudProcess.d.ts.map +1 -0
  176. package/dist/tools/thinking/thinkAloudProcess.js +80 -0
  177. package/dist/tools/thinking/thinkAloudProcess.js.map +1 -0
  178. package/hooks/hooks.json +222 -222
  179. package/hooks/scripts/code-check.js +22 -22
  180. package/hooks/scripts/code-review.js +22 -22
  181. package/hooks/scripts/complexity.js +22 -22
  182. package/hooks/scripts/compound.js +23 -23
  183. package/hooks/scripts/context-save.js +33 -33
  184. package/hooks/scripts/gemini-ui-gen.js +281 -281
  185. package/hooks/scripts/generate-brand-assets.js +474 -474
  186. package/hooks/scripts/hud-multiline.js +262 -262
  187. package/hooks/scripts/hud-status.js +291 -291
  188. package/hooks/scripts/keyword-detector.js +214 -214
  189. package/hooks/scripts/llm-orchestrate.js +171 -171
  190. package/hooks/scripts/post-edit.js +97 -97
  191. package/hooks/scripts/post-tool-verify.js +210 -210
  192. package/hooks/scripts/pre-tool-guard.js +125 -125
  193. package/hooks/scripts/recall.js +22 -22
  194. package/hooks/scripts/session-start.js +30 -30
  195. package/hooks/scripts/skill-injector.js +191 -191
  196. package/hooks/scripts/utils.js +97 -97
  197. package/languages/csharp-unity.md +515 -515
  198. package/languages/gdscript-godot.md +470 -470
  199. package/languages/ruby-rails.md +489 -489
  200. package/languages/typescript-angular.md +433 -433
  201. package/languages/typescript-astro.md +416 -416
  202. package/languages/typescript-electron.md +406 -406
  203. package/languages/typescript-nestjs.md +524 -524
  204. package/languages/typescript-svelte.md +407 -407
  205. package/languages/typescript-tauri.md +365 -365
  206. package/package.json +84 -84
  207. package/skills/brand-assets.md +141 -141
  208. package/skills/commerce-patterns.md +361 -361
  209. package/skills/context7-usage.md +102 -102
  210. package/skills/e2e-commerce.md +304 -304
  211. package/skills/frontend-design.md +92 -92
  212. package/skills/git-worktree.md +181 -181
  213. package/skills/parallel-research.md +77 -77
  214. package/skills/priority-todos.md +239 -239
  215. package/skills/seo-checklist.md +244 -244
  216. package/skills/tool-fallback.md +190 -190
  217. package/skills/vibe-capabilities.md +161 -161
  218. package/vibe/constitution.md +227 -227
  219. package/vibe/rules/core/communication-guide.md +98 -98
  220. package/vibe/rules/core/development-philosophy.md +52 -52
  221. package/vibe/rules/core/quick-start.md +102 -102
  222. package/vibe/rules/quality/bdd-contract-testing.md +393 -393
  223. package/vibe/rules/quality/checklist.md +276 -276
  224. package/vibe/rules/quality/testing-strategy.md +440 -440
  225. package/vibe/rules/standards/anti-patterns.md +541 -541
  226. package/vibe/rules/standards/code-structure.md +291 -291
  227. package/vibe/rules/standards/complexity-metrics.md +313 -313
  228. package/vibe/rules/standards/naming-conventions.md +198 -198
  229. package/vibe/setup.sh +31 -31
  230. package/vibe/templates/constitution-template.md +252 -252
  231. package/vibe/templates/contract-backend-template.md +526 -526
  232. package/vibe/templates/contract-frontend-template.md +599 -599
  233. package/vibe/templates/feature-template.md +96 -96
  234. package/vibe/templates/spec-template.md +221 -221
@@ -4,10 +4,10 @@ import { analyzeComplexity } from './analyzeComplexity.js';
4
4
  describe('analyzeComplexity', () => {
5
5
  describe('code analysis', () => {
6
6
  it('should analyze simple code', async () => {
7
- const code = `
8
- function add(a, b) {
9
- return a + b;
10
- }
7
+ const code = `
8
+ function add(a, b) {
9
+ return a + b;
10
+ }
11
11
  `;
12
12
  const result = await analyzeComplexity({ code });
13
13
  expect(result.content).toBeDefined();
@@ -15,70 +15,70 @@ function add(a, b) {
15
15
  expect(result.content[0].text).toContain('Complexity');
16
16
  });
17
17
  it('should detect high cyclomatic complexity', async () => {
18
- const code = `
19
- function complex(a, b, c, d) {
20
- if (a > 0) {
21
- if (b > 0) {
22
- if (c > 0) {
23
- if (d > 0) {
24
- for (let i = 0; i < 10; i++) {
25
- while (true) {
26
- switch (i) {
27
- case 1: break;
28
- case 2: break;
29
- case 3: break;
30
- }
31
- break;
32
- }
33
- }
34
- }
35
- }
36
- }
37
- }
38
- }
18
+ const code = `
19
+ function complex(a, b, c, d) {
20
+ if (a > 0) {
21
+ if (b > 0) {
22
+ if (c > 0) {
23
+ if (d > 0) {
24
+ for (let i = 0; i < 10; i++) {
25
+ while (true) {
26
+ switch (i) {
27
+ case 1: break;
28
+ case 2: break;
29
+ case 3: break;
30
+ }
31
+ break;
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
39
  `;
40
40
  const result = await analyzeComplexity({ code });
41
41
  expect(result.content[0].text).toContain('Complexity');
42
42
  // High complexity code should have lower score or issues
43
43
  });
44
44
  it('should calculate cyclomatic metrics only', async () => {
45
- const code = `
46
- function test() {
47
- if (true) return 1;
48
- return 0;
49
- }
45
+ const code = `
46
+ function test() {
47
+ if (true) return 1;
48
+ return 0;
49
+ }
50
50
  `;
51
51
  const result = await analyzeComplexity({ code, metrics: 'cyclomatic' });
52
52
  expect(result.content[0].text).toContain('Complexity');
53
53
  });
54
54
  it('should calculate cognitive metrics only', async () => {
55
- const code = `
56
- function test() {
57
- if (true) {
58
- for (let i = 0; i < 10; i++) {
59
- console.log(i);
60
- }
61
- }
62
- }
55
+ const code = `
56
+ function test() {
57
+ if (true) {
58
+ for (let i = 0; i < 10; i++) {
59
+ console.log(i);
60
+ }
61
+ }
62
+ }
63
63
  `;
64
64
  const result = await analyzeComplexity({ code, metrics: 'cognitive' });
65
65
  expect(result.content[0].text).toContain('Complexity');
66
66
  });
67
67
  it('should calculate halstead metrics only', async () => {
68
- const code = `
69
- const x = 1 + 2 * 3 - 4 / 5;
68
+ const code = `
69
+ const x = 1 + 2 * 3 - 4 / 5;
70
70
  `;
71
71
  const result = await analyzeComplexity({ code, metrics: 'halstead' });
72
72
  expect(result.content[0].text).toContain('Complexity');
73
73
  });
74
74
  it('should calculate all metrics', async () => {
75
- const code = `
76
- function calculate(a, b) {
77
- if (a > b) {
78
- return a - b;
79
- }
80
- return b - a;
81
- }
75
+ const code = `
76
+ function calculate(a, b) {
77
+ if (a > b) {
78
+ return a - b;
79
+ }
80
+ return b - a;
81
+ }
82
82
  `;
83
83
  const result = await analyzeComplexity({ code, metrics: 'all' });
84
84
  expect(result.content[0].text).toContain('Complexity');
@@ -102,18 +102,18 @@ function calculate(a, b) {
102
102
  });
103
103
  describe('Python code detection', () => {
104
104
  it('should detect and analyze Python code', async () => {
105
- const pythonCode = `
106
- def calculate(a, b):
107
- if a > b:
108
- return a - b
109
- return b - a
110
-
111
- class Calculator:
112
- def __init__(self):
113
- self.value = 0
114
-
115
- def add(self, x):
116
- self.value += x
105
+ const pythonCode = `
106
+ def calculate(a, b):
107
+ if a > b:
108
+ return a - b
109
+ return b - a
110
+
111
+ class Calculator:
112
+ def __init__(self):
113
+ self.value = 0
114
+
115
+ def add(self, x):
116
+ self.value += x
117
117
  `;
118
118
  const result = await analyzeComplexity({ code: pythonCode });
119
119
  expect(result.content[0].text).toContain('Python');
@@ -121,34 +121,34 @@ class Calculator:
121
121
  });
122
122
  describe('score calculation', () => {
123
123
  it('should give high score for simple code', async () => {
124
- const simpleCode = `
125
- function simple() {
126
- return 42;
127
- }
124
+ const simpleCode = `
125
+ function simple() {
126
+ return 42;
127
+ }
128
128
  `;
129
129
  const result = await analyzeComplexity({ code: simpleCode });
130
130
  // Simple code should have good score
131
131
  expect(result.content[0].text).toContain('Score');
132
132
  });
133
133
  it('should give lower score for complex code', async () => {
134
- const complexCode = `
135
- function veryComplex(a, b, c, d, e, f, g, h) {
136
- if (a && b || c && d || e && f || g && h) {
137
- for (let i = 0; i < 10; i++) {
138
- for (let j = 0; j < 10; j++) {
139
- if (i > j) {
140
- switch (i) {
141
- case 1: break;
142
- case 2: break;
143
- case 3: break;
144
- case 4: break;
145
- case 5: break;
146
- }
147
- }
148
- }
149
- }
150
- }
151
- }
134
+ const complexCode = `
135
+ function veryComplex(a, b, c, d, e, f, g, h) {
136
+ if (a && b || c && d || e && f || g && h) {
137
+ for (let i = 0; i < 10; i++) {
138
+ for (let j = 0; j < 10; j++) {
139
+ if (i > j) {
140
+ switch (i) {
141
+ case 1: break;
142
+ case 2: break;
143
+ case 3: break;
144
+ case 4: break;
145
+ case 5: break;
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
152
  `;
153
153
  const result = await analyzeComplexity({ code: complexCode });
154
154
  expect(result.content[0].text).toContain('Score');
@@ -157,46 +157,46 @@ function veryComplex(a, b, c, d, e, f, g, h) {
157
157
  });
158
158
  describe('TypeScript code analysis', () => {
159
159
  it('should analyze TypeScript code', async () => {
160
- const tsCode = `
161
- interface User {
162
- name: string;
163
- age: number;
164
- }
165
-
166
- function greet(user: User): string {
167
- if (user.age > 18) {
168
- return \`Hello, \${user.name}!\`;
169
- }
170
- return 'Hello!';
171
- }
160
+ const tsCode = `
161
+ interface User {
162
+ name: string;
163
+ age: number;
164
+ }
165
+
166
+ function greet(user: User): string {
167
+ if (user.age > 18) {
168
+ return \`Hello, \${user.name}!\`;
169
+ }
170
+ return 'Hello!';
171
+ }
172
172
  `;
173
173
  const result = await analyzeComplexity({ code: tsCode });
174
174
  expect(result.content[0].text).toContain('Complexity');
175
175
  });
176
176
  it('should handle class definitions', async () => {
177
177
  // Use explicit TypeScript syntax that won't be mistaken for Python
178
- const tsCode = `
179
- // TypeScript class
180
- export class Calculator {
181
- private value: number = 0;
182
-
183
- public add(x: number): this {
184
- this.value += x;
185
- return this;
186
- }
187
-
188
- public subtract(x: number): this {
189
- if (x > this.value) {
190
- throw new Error('Cannot be negative');
191
- }
192
- this.value -= x;
193
- return this;
194
- }
195
-
196
- public getValue(): number {
197
- return this.value;
198
- }
199
- }
178
+ const tsCode = `
179
+ // TypeScript class
180
+ export class Calculator {
181
+ private value: number = 0;
182
+
183
+ public add(x: number): this {
184
+ this.value += x;
185
+ return this;
186
+ }
187
+
188
+ public subtract(x: number): this {
189
+ if (x > this.value) {
190
+ throw new Error('Cannot be negative');
191
+ }
192
+ this.value -= x;
193
+ return this;
194
+ }
195
+
196
+ public getValue(): number {
197
+ return this.value;
198
+ }
199
+ }
200
200
  `;
201
201
  const result = await analyzeComplexity({ code: tsCode });
202
202
  // Should analyze as TypeScript, not Python
@@ -0,0 +1,7 @@
1
+ import { ToolResult, ToolDefinition } from '../../types/tool.js';
2
+ export declare const getCodingGuideDefinition: ToolDefinition;
3
+ export declare function getCodingGuide(args: {
4
+ name: string;
5
+ category?: string;
6
+ }): Promise<ToolResult>;
7
+ //# sourceMappingURL=getCodingGuide.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCodingGuide.d.ts","sourceRoot":"","sources":["../../../src/tools/convention/getCodingGuide.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAsCjE,eAAO,MAAM,wBAAwB,EAAE,cAmBtC,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAmBnG"}
@@ -0,0 +1,69 @@
1
+ // Convention management tool - completely independent
2
+ import { promises as fs } from 'fs';
3
+ import path from 'path';
4
+ const GUIDES_DIR = path.join(process.cwd(), 'guides');
5
+ const GUIDES_FILE = path.join(GUIDES_DIR, 'coding_guides.json');
6
+ async function ensureGuidesDir() {
7
+ try {
8
+ await fs.access(GUIDES_DIR);
9
+ }
10
+ catch { /* ignore: optional operation */
11
+ await fs.mkdir(GUIDES_DIR, { recursive: true });
12
+ }
13
+ }
14
+ async function loadGuides() {
15
+ try {
16
+ await ensureGuidesDir();
17
+ const data = await fs.readFile(GUIDES_FILE, 'utf-8');
18
+ return JSON.parse(data);
19
+ }
20
+ catch { /* ignore: optional operation */
21
+ return [];
22
+ }
23
+ }
24
+ async function findGuide(name) {
25
+ const guides = await loadGuides();
26
+ return guides.find(g => g.name === name);
27
+ }
28
+ export const getCodingGuideDefinition = {
29
+ name: 'get_coding_guide',
30
+ description: '가이드|규칙|컨벤션|guide|rules|convention|standards|best practices - Get coding guide',
31
+ inputSchema: {
32
+ type: 'object',
33
+ properties: {
34
+ name: { type: 'string', description: 'Guide name to retrieve' },
35
+ category: { type: 'string', description: 'Guide category' }
36
+ },
37
+ required: ['name']
38
+ },
39
+ annotations: {
40
+ title: 'Get Coding Guide',
41
+ audience: ['user', 'assistant'],
42
+ readOnlyHint: true,
43
+ destructiveHint: false,
44
+ idempotentHint: true,
45
+ openWorldHint: false
46
+ }
47
+ };
48
+ export async function getCodingGuide(args) {
49
+ const { name: guideName, category: guideCategory } = args;
50
+ try {
51
+ const guide = await findGuide(guideName);
52
+ if (guide) {
53
+ return {
54
+ content: [{ type: 'text', text: `Guide: ${guide.name}\nCategory: ${guide.category}\n\n${guide.content}\n\nTags: ${guide.tags.join(', ')} | Updated: ${guide.lastUpdated}` }]
55
+ };
56
+ }
57
+ else {
58
+ return {
59
+ content: [{ type: 'text', text: `Guide not found: "${guideName}". Use list_coding_guides to see available guides.` }]
60
+ };
61
+ }
62
+ }
63
+ catch (error) {
64
+ return {
65
+ content: [{ type: 'text', text: `Error retrieving guide: ${error instanceof Error ? error.message : 'Unknown error'}` }]
66
+ };
67
+ }
68
+ }
69
+ //# sourceMappingURL=getCodingGuide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCodingGuide.js","sourceRoot":"","sources":["../../../src/tools/convention/getCodingGuide.ts"],"names":[],"mappings":"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"}
@@ -4,10 +4,10 @@ import { validateCodeQuality } from './validateCodeQuality.js';
4
4
  describe('validateCodeQuality', () => {
5
5
  describe('code validation', () => {
6
6
  it('should validate simple clean code', async () => {
7
- const code = `
8
- function add(a: number, b: number): number {
9
- return a + b;
10
- }
7
+ const code = `
8
+ function add(a: number, b: number): number {
9
+ return a + b;
10
+ }
11
11
  `;
12
12
  const result = await validateCodeQuality({ code });
13
13
  expect(result.content[0].type).toBe('text');
@@ -15,56 +15,56 @@ function add(a: number, b: number): number {
15
15
  expect(result.content[0].text).toContain('Grade');
16
16
  });
17
17
  it('should detect high nesting depth', async () => {
18
- const code = `
19
- function nested() {
20
- if (true) {
21
- if (true) {
22
- if (true) {
23
- if (true) {
24
- console.log('deep');
25
- }
26
- }
27
- }
28
- }
29
- }
18
+ const code = `
19
+ function nested() {
20
+ if (true) {
21
+ if (true) {
22
+ if (true) {
23
+ if (true) {
24
+ console.log('deep');
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
30
30
  `;
31
31
  const result = await validateCodeQuality({ code });
32
32
  expect(result.content[0].text).toContain('Nesting');
33
33
  });
34
34
  it('should detect any type usage', async () => {
35
- const code = `
36
- function process(data: any): any {
37
- return data;
38
- }
35
+ const code = `
36
+ function process(data: any): any {
37
+ return data;
38
+ }
39
39
  `;
40
40
  const result = await validateCodeQuality({ code });
41
41
  expect(result.content[0].text).toContain('type');
42
42
  });
43
43
  it('should detect loose equality', async () => {
44
- const code = `
45
- function compare(a, b) {
46
- return a == b;
47
- }
44
+ const code = `
45
+ function compare(a, b) {
46
+ return a == b;
47
+ }
48
48
  `;
49
49
  const result = await validateCodeQuality({ code });
50
50
  expect(result.content[0].text).toContain('Issues');
51
51
  });
52
52
  it('should detect var usage', async () => {
53
- const code = `
54
- function oldStyle() {
55
- var x = 1;
56
- var y = 2;
57
- return x + y;
58
- }
53
+ const code = `
54
+ function oldStyle() {
55
+ var x = 1;
56
+ var y = 2;
57
+ return x + y;
58
+ }
59
59
  `;
60
60
  const result = await validateCodeQuality({ code });
61
61
  expect(result.content[0].text).toContain('Issues');
62
62
  });
63
63
  it('should detect magic numbers', async () => {
64
- const code = `
65
- function calculate(value) {
66
- return value * 123 + 456;
67
- }
64
+ const code = `
65
+ function calculate(value) {
66
+ return value * 123 + 456;
67
+ }
68
68
  `;
69
69
  const result = await validateCodeQuality({ code });
70
70
  expect(result.content[0].text).toContain('Issues');
@@ -72,26 +72,26 @@ function calculate(value) {
72
72
  });
73
73
  describe('async code validation', () => {
74
74
  it('should warn about missing error handling in async', async () => {
75
- const code = `
76
- async function fetchData() {
77
- const response = await fetch('/api');
78
- return response.json();
79
- }
75
+ const code = `
76
+ async function fetchData() {
77
+ const response = await fetch('/api');
78
+ return response.json();
79
+ }
80
80
  `;
81
81
  const result = await validateCodeQuality({ code });
82
82
  expect(result.content[0].text).toContain('Issues');
83
83
  });
84
84
  it('should not warn when error handling exists', async () => {
85
- const code = `
86
- async function fetchData() {
87
- try {
88
- const response = await fetch('/api');
89
- return response.json();
90
- } catch (error) {
91
- console.error(error);
92
- throw error;
93
- }
94
- }
85
+ const code = `
86
+ async function fetchData() {
87
+ try {
88
+ const response = await fetch('/api');
89
+ return response.json();
90
+ } catch (error) {
91
+ console.error(error);
92
+ throw error;
93
+ }
94
+ }
95
95
  `;
96
96
  const result = await validateCodeQuality({ code });
97
97
  // Should have fewer issues or no error handling issue
@@ -100,27 +100,27 @@ async function fetchData() {
100
100
  });
101
101
  describe('React component validation', () => {
102
102
  it('should validate React component with type', async () => {
103
- const code = `
104
- import React from 'react';
105
-
106
- function MyComponent({ name }) {
107
- return <div>Hello, {name}!</div>;
108
- }
103
+ const code = `
104
+ import React from 'react';
105
+
106
+ function MyComponent({ name }) {
107
+ return <div>Hello, {name}!</div>;
108
+ }
109
109
  `;
110
110
  const result = await validateCodeQuality({ code, type: 'component' });
111
111
  expect(result.content[0].text).toContain('Type: component');
112
112
  });
113
113
  it('should suggest memo for React components', async () => {
114
- const code = `
115
- import React from 'react';
116
-
117
- function ExpensiveComponent({ data }) {
118
- return (
119
- <div>
120
- {data.map(item => <span key={item.id}>{item.name}</span>)}
121
- </div>
122
- );
123
- }
114
+ const code = `
115
+ import React from 'react';
116
+
117
+ function ExpensiveComponent({ data }) {
118
+ return (
119
+ <div>
120
+ {data.map(item => <span key={item.id}>{item.name}</span>)}
121
+ </div>
122
+ );
123
+ }
124
124
  `;
125
125
  const result = await validateCodeQuality({ code, type: 'component' });
126
126
  // Should mention performance optimization
@@ -144,27 +144,27 @@ function ExpensiveComponent({ data }) {
144
144
  });
145
145
  describe('grading system', () => {
146
146
  it('should give A grade for excellent code', async () => {
147
- const code = `
148
- const add = (a: number, b: number): number => a + b;
147
+ const code = `
148
+ const add = (a: number, b: number): number => a + b;
149
149
  `;
150
150
  const result = await validateCodeQuality({ code });
151
151
  expect(result.content[0].text).toContain('Grade: A');
152
152
  });
153
153
  it('should give lower grade for problematic code', async () => {
154
- const code = `
155
- function badCode(data: any) {
156
- var result;
157
- if (data == null) {
158
- if (true) {
159
- if (true) {
160
- if (true) {
161
- result = data * 123456;
162
- }
163
- }
164
- }
165
- }
166
- return result;
167
- }
154
+ const code = `
155
+ function badCode(data: any) {
156
+ var result;
157
+ if (data == null) {
158
+ if (true) {
159
+ if (true) {
160
+ if (true) {
161
+ result = data * 123456;
162
+ }
163
+ }
164
+ }
165
+ }
166
+ return result;
167
+ }
168
168
  `;
169
169
  const result = await validateCodeQuality({ code });
170
170
  // Should not be grade A
@@ -173,10 +173,10 @@ function badCode(data: any) {
173
173
  });
174
174
  describe('strict mode', () => {
175
175
  it('should accept strict flag', async () => {
176
- const code = `
177
- function test() {
178
- return 1;
179
- }
176
+ const code = `
177
+ function test() {
178
+ return 1;
179
+ }
180
180
  `;
181
181
  const result = await validateCodeQuality({ code, strict: true });
182
182
  expect(result.content[0].text).toContain('Score');
@@ -184,23 +184,23 @@ function test() {
184
184
  });
185
185
  describe('metrics option', () => {
186
186
  it('should accept complexity metrics', async () => {
187
- const code = `
188
- function test() {
189
- return 1;
190
- }
187
+ const code = `
188
+ function test() {
189
+ return 1;
190
+ }
191
191
  `;
192
192
  const result = await validateCodeQuality({ code, metrics: 'complexity' });
193
193
  expect(result.content[0].text).toContain('Complexity');
194
194
  });
195
195
  it('should accept all metrics', async () => {
196
- const code = `
197
- function test() {
198
- if (true) {
199
- for (let i = 0; i < 10; i++) {
200
- console.log(i);
201
- }
202
- }
203
- }
196
+ const code = `
197
+ function test() {
198
+ if (true) {
199
+ for (let i = 0; i < 10; i++) {
200
+ console.log(i);
201
+ }
202
+ }
203
+ }
204
204
  `;
205
205
  const result = await validateCodeQuality({ code, metrics: 'all' });
206
206
  expect(result.content[0].text).toContain('Score');
@@ -208,18 +208,18 @@ function test() {
208
208
  });
209
209
  describe('deductions', () => {
210
210
  it('should show deduction details', async () => {
211
- const code = `
212
- async function process(data: any) {
213
- var x = data == null ? 0 : data;
214
- return x * 12345;
215
- }
211
+ const code = `
212
+ async function process(data: any) {
213
+ var x = data == null ? 0 : data;
214
+ return x * 12345;
215
+ }
216
216
  `;
217
217
  const result = await validateCodeQuality({ code });
218
218
  expect(result.content[0].text).toContain('Deductions');
219
219
  });
220
220
  it('should calculate score correctly', async () => {
221
- const code = `
222
- const clean = (x: number): number => x + 1;
221
+ const code = `
222
+ const clean = (x: number): number => x + 1;
223
223
  `;
224
224
  const result = await validateCodeQuality({ code });
225
225
  // Clean code should have high score (90+)