sumulige-claude 1.1.2 → 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 (102) hide show
  1. package/.claude/hooks/code-formatter.cjs +7 -2
  2. package/.claude/hooks/multi-session.cjs +9 -3
  3. package/.claude/hooks/pre-commit.cjs +0 -0
  4. package/.claude/hooks/pre-push.cjs +0 -0
  5. package/.claude/hooks/project-kickoff.cjs +22 -11
  6. package/.claude/hooks/rag-skill-loader.cjs +7 -0
  7. package/.claude/hooks/thinking-silent.cjs +9 -3
  8. package/.claude/hooks/todo-manager.cjs +19 -13
  9. package/.claude/hooks/verify-work.cjs +10 -4
  10. package/.claude/quality-gate.json +9 -3
  11. package/.claude/settings.local.json +16 -1
  12. package/.claude/templates/hooks/README.md +302 -0
  13. package/.claude/templates/hooks/hook.sh.template +94 -0
  14. package/.claude/templates/hooks/user-prompt-submit.cjs.template +116 -0
  15. package/.claude/templates/hooks/user-response-submit.cjs.template +94 -0
  16. package/.claude/templates/hooks/validate.js +173 -0
  17. package/.claude/workflow/document-scanner.js +426 -0
  18. package/.claude/workflow/knowledge-engine.js +941 -0
  19. package/.claude/workflow/notebooklm/browser.js +1028 -0
  20. package/.claude/workflow/phases/phase1-research.js +578 -0
  21. package/.claude/workflow/phases/phase1-research.ts +465 -0
  22. package/.claude/workflow/phases/phase2-approve.js +722 -0
  23. package/.claude/workflow/phases/phase3-plan.js +1200 -0
  24. package/.claude/workflow/phases/phase4-develop.js +894 -0
  25. package/.claude/workflow/search-cache.js +230 -0
  26. package/.claude/workflow/templates/approval.md +315 -0
  27. package/.claude/workflow/templates/development.md +377 -0
  28. package/.claude/workflow/templates/planning.md +328 -0
  29. package/.claude/workflow/templates/research.md +250 -0
  30. package/.claude/workflow/types.js +37 -0
  31. package/.claude/workflow/web-search.js +278 -0
  32. package/.claude-plugin/marketplace.json +2 -2
  33. package/AGENTS.md +176 -0
  34. package/CHANGELOG.md +7 -14
  35. package/cli.js +20 -0
  36. package/config/quality-gate.json +9 -3
  37. package/development/cache/web-search/search_1193d605f8eb364651fc2f2041b58a31.json +36 -0
  38. package/development/cache/web-search/search_3798bf06960edc125f744a1abb5b72c5.json +36 -0
  39. package/development/cache/web-search/search_37c7d4843a53f0d83f1122a6f908a2a3.json +36 -0
  40. package/development/cache/web-search/search_44166fa0153709ee168485a22aa0ab40.json +36 -0
  41. package/development/cache/web-search/search_4deaebb1f77e86a8ca066dc5a49c59fd.json +36 -0
  42. package/development/cache/web-search/search_94da91789466070a7f545612e73c7372.json +36 -0
  43. package/development/cache/web-search/search_dd5de8491b8b803a3cb01339cd210fb0.json +36 -0
  44. package/development/knowledge-base/.index.clean.json +0 -0
  45. package/development/knowledge-base/.index.json +486 -0
  46. package/development/knowledge-base/test-best-practices.md +29 -0
  47. package/development/projects/proj_mkh1pazz_ixmt1/phase1/feasibility-report.md +160 -0
  48. package/development/projects/proj_mkh4jvnb_z7rwf/phase1/feasibility-report.md +160 -0
  49. package/development/projects/proj_mkh4jxkd_ewz5a/phase1/feasibility-report.md +160 -0
  50. package/development/projects/proj_mkh4k84n_ni73k/phase1/feasibility-report.md +160 -0
  51. package/development/projects/proj_mkh4wfyd_u9w88/phase1/feasibility-report.md +160 -0
  52. package/development/projects/proj_mkh4wsbo_iahvf/development/projects/proj_mkh4xbpg_4na5w/phase1/feasibility-report.md +160 -0
  53. package/development/projects/proj_mkh4wsbo_iahvf/phase1/feasibility-report.md +160 -0
  54. package/development/projects/proj_mkh4xulg_1ka8x/phase1/feasibility-report.md +160 -0
  55. package/development/projects/proj_mkh4xwhj_gch8j/phase1/feasibility-report.md +160 -0
  56. package/development/projects/proj_mkh4y2qk_9lm8z/phase1/feasibility-report.md +160 -0
  57. package/development/projects/proj_mkh4y2qk_9lm8z/phase2/requirements.md +226 -0
  58. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/PRD.md +345 -0
  59. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/TASK_PLAN.md +284 -0
  60. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/prototype/README.md +14 -0
  61. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/DEVELOPMENT_LOG.md +35 -0
  62. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/TASKS.md +34 -0
  63. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/.env.example +5 -0
  64. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/README.md +60 -0
  65. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/package.json +25 -0
  66. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/index.js +70 -0
  67. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/routes/index.js +48 -0
  68. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/health.test.js +20 -0
  69. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/jest.config.js +21 -0
  70. package/development/projects/proj_mkh7veqg_3lypc/phase1/feasibility-report.md +160 -0
  71. package/development/projects/proj_mkh7veqg_3lypc/phase2/requirements.md +226 -0
  72. package/development/projects/proj_mkh7veqg_3lypc/phase3/PRD.md +345 -0
  73. package/development/projects/proj_mkh7veqg_3lypc/phase3/TASK_PLAN.md +284 -0
  74. package/development/projects/proj_mkh7veqg_3lypc/phase3/prototype/README.md +14 -0
  75. package/development/projects/proj_mkh8k8fo_rmqn5/phase1/feasibility-report.md +160 -0
  76. package/development/projects/proj_mkh8xyhy_1vshq/phase1/feasibility-report.md +178 -0
  77. package/development/projects/proj_mkh8zddd_dhamf/phase1/feasibility-report.md +377 -0
  78. package/development/projects/proj_mkh8zddd_dhamf/phase2/requirements.md +442 -0
  79. package/development/projects/proj_mkh8zddd_dhamf/phase3/api-design.md +800 -0
  80. package/development/projects/proj_mkh8zddd_dhamf/phase3/architecture.md +625 -0
  81. package/development/projects/proj_mkh8zddd_dhamf/phase3/data-model.md +830 -0
  82. package/development/projects/proj_mkh8zddd_dhamf/phase3/risks.md +957 -0
  83. package/development/projects/proj_mkh8zddd_dhamf/phase3/wbs.md +381 -0
  84. package/development/todos/.state.json +14 -1
  85. package/development/todos/INDEX.md +31 -73
  86. package/development/todos/completed/develop/local-knowledge-index.md +85 -0
  87. package/development/todos/{active → completed/develop}/todo-system.md +13 -3
  88. package/development/todos/completed/develop/web-search-integration.md +83 -0
  89. package/development/todos/completed/test/phase1-e2e-test.md +103 -0
  90. package/lib/commands.js +388 -0
  91. package/package.json +3 -2
  92. package/tests/config-manager.test.js +677 -0
  93. package/tests/config-validator.test.js +436 -0
  94. package/tests/errors.test.js +477 -0
  95. package/tests/manual/phase1-e2e.sh +389 -0
  96. package/tests/manual/phase2-test-cases.md +311 -0
  97. package/tests/manual/phase3-test-cases.md +309 -0
  98. package/tests/manual/phase4-test-cases.md +414 -0
  99. package/tests/manual/test-cases.md +417 -0
  100. package/tests/quality-gate.test.js +679 -0
  101. package/tests/quality-rules.test.js +619 -0
  102. package/tests/version-check.test.js +75 -0
@@ -0,0 +1,465 @@
1
+ /**
2
+ * Phase 1: Research - NotebookLM Feasibility Analysis
3
+ *
4
+ * This phase uses NotebookLM (via notebooklm-mcp integration) to:
5
+ * 1. Structure requirements
6
+ * 2. Connect dots with related work
7
+ * 3. Research best practices
8
+ * 4. Assess feasibility
9
+ *
10
+ * Output: feasibility-report.md
11
+ */
12
+
13
+ import * as fs from 'fs';
14
+ import * as path from 'path';
15
+ import { getKnowledgeEngine } from '../knowledge-engine';
16
+ import { FeasibilityValidator } from '../validators/feasibility';
17
+ import type { FeasibilityReport, ProjectPhase, ProgressCallback } from '../types';
18
+
19
+ // ============================================================================
20
+ // Configuration
21
+ // ============================================================================
22
+
23
+ const PROJECTS_DIR = path.join(process.cwd(), 'development/projects');
24
+
25
+ // ============================================================================
26
+ // Phase 1 Executor
27
+ // ============================================================================
28
+
29
+ export class Phase1ResearchExecutor {
30
+ private projectId: string;
31
+ private projectDir: string;
32
+ private phaseDir: string;
33
+ private reportPath: string;
34
+
35
+ constructor(projectId: string) {
36
+ this.projectId = projectId;
37
+ this.projectDir = path.join(PROJECTS_DIR, projectId);
38
+ this.phaseDir = path.join(this.projectDir, 'phase1');
39
+ this.reportPath = path.join(this.phaseDir, 'feasibility-report.md');
40
+ }
41
+
42
+ /**
43
+ * Execute Phase 1 research workflow
44
+ */
45
+ async execute(
46
+ idea: string,
47
+ context: string = '',
48
+ progressCallback?: ProgressCallback
49
+ ): Promise<FeasibilityReport> {
50
+ await progressCallback?.('Initializing Phase 1 research...', 0, 5);
51
+
52
+ // Ensure directories exist
53
+ await this.ensureDirectories();
54
+
55
+ // Step 1: Gather knowledge
56
+ await progressCallback?.('Gathering relevant knowledge...', 1, 5);
57
+ const knowledgeContext = await this.gatherKnowledge(idea);
58
+
59
+ // Step 2: Generate research prompt
60
+ await progressCallback?.('Preparing research prompt...', 2, 5);
61
+ const prompt = this.generatePrompt(idea, context, knowledgeContext);
62
+
63
+ // Step 3: Save prompt for Claude/AI to execute
64
+ await progressCallback?.('Generating feasibility report...', 3, 5);
65
+ await this.savePrompt(prompt);
66
+
67
+ // Step 4: Return structured result for AI execution
68
+ await progressCallback?.('Preparing AI execution context...', 4, 5);
69
+
70
+ const reportTemplate = this.generateReportTemplate(idea, context, knowledgeContext);
71
+ await fs.promises.writeFile(this.reportPath, reportTemplate, 'utf-8');
72
+
73
+ await progressCallback?.('Phase 1 research context prepared. Ready for AI analysis.', 5, 5);
74
+
75
+ return {
76
+ projectId: this.projectId,
77
+ createdAt: Date.now(),
78
+ requirements: {
79
+ summary: idea,
80
+ keyFeatures: [],
81
+ constraints: [],
82
+ assumptions: []
83
+ },
84
+ correlations: {
85
+ relatedProjects: [],
86
+ overlappingTech: [],
87
+ lessonsLearned: []
88
+ },
89
+ bestPractices: [],
90
+ feasibility: {
91
+ technical: 0,
92
+ time: 0,
93
+ complexity: 'medium',
94
+ risks: []
95
+ },
96
+ recommendations: {
97
+ techStack: [],
98
+ architecture: '',
99
+ potentialIssues: [],
100
+ nextSteps: [
101
+ 'Review and complete the feasibility report',
102
+ 'Validate with quality gate: smc workflow validate',
103
+ 'Proceed to Phase 2: Claude approval'
104
+ ]
105
+ },
106
+ quality: {
107
+ completeness: 0,
108
+ confidence: 0,
109
+ sourcesCount: knowledgeContext.sourceCount,
110
+ webSearchPerformed: false
111
+ }
112
+ };
113
+ }
114
+
115
+ /**
116
+ * Gather relevant knowledge from knowledge base
117
+ */
118
+ private async gatherKnowledge(idea: string): Promise<{
119
+ sources: Array<{ title: string; type: string; relevance: number }>;
120
+ excerpts: string[];
121
+ sourceCount: number;
122
+ }> {
123
+ const engine = getKnowledgeEngine();
124
+ const result = await engine.query(idea, { includeWeb: true });
125
+
126
+ return {
127
+ sources: result.sources.map(s => ({
128
+ title: s.title,
129
+ type: s.type,
130
+ relevance: s.relevance
131
+ })),
132
+ excerpts: result.sources.map(s => s.excerpt || '').filter(Boolean),
133
+ sourceCount: result.sources.length
134
+ };
135
+ }
136
+
137
+ /**
138
+ * Generate research prompt for AI execution
139
+ */
140
+ private generatePrompt(idea: string, context: string, knowledgeContext: any): string {
141
+ return `
142
+ # Phase 1 Research Task
143
+
144
+ ## User Idea
145
+ ${idea}
146
+
147
+ ${context ? `## Additional Context\n${context}\n` : ''}
148
+
149
+ ## Knowledge Context
150
+ Found ${knowledgeContext.sourceCount} relevant sources in the knowledge base.
151
+
152
+ ${knowledgeContext.sources.length > 0 ? `
153
+ ### Relevant Sources
154
+ ${knowledgeContext.sources.map((s: any) => `- ${s.title} (${(s.relevance * 100).toFixed(0)}% relevance)`).join('\n')}
155
+ ` : ''}
156
+
157
+ ## Your Task
158
+
159
+ Please complete a comprehensive feasibility analysis following the template in:
160
+ ${path.join(__dirname, '../templates/research.md')}
161
+
162
+ ## Output
163
+
164
+ Save the complete feasibility report to:
165
+ ${this.reportPath}
166
+
167
+ Then validate with: smc workflow validate ${this.reportPath}
168
+ `.trim();
169
+ }
170
+
171
+ /**
172
+ * Generate report template for AI to fill
173
+ */
174
+ private generateReportTemplate(idea: string, context: string, knowledgeContext: any): string {
175
+ const date = new Date().toLocaleDateString();
176
+ const time = new Date().toLocaleTimeString();
177
+
178
+ return `# Feasibility Analysis Report
179
+
180
+ **Project**: ${this.projectId}
181
+ **Date**: ${date} ${time}
182
+ **Phase**: 1 - Research
183
+ **Status**: 🚧 In Progress
184
+
185
+ ---
186
+
187
+ ## Executive Summary
188
+
189
+ > Brief overview of the project and feasibility assessment
190
+
191
+ ---
192
+
193
+ ## Requirements Summary
194
+
195
+ ### Problem Statement
196
+ [What problem are we solving?]
197
+
198
+ ### Target Users
199
+ [Who will use this? What are their pain points?]
200
+
201
+ ### Key Features
202
+ 1. [Feature 1]
203
+ 2. [Feature 2]
204
+ 3. [Feature 3]
205
+
206
+ ### Constraints
207
+ - [Constraint 1]
208
+ - [Constraint 2]
209
+
210
+ ### Assumptions
211
+ - [Assumption 1]
212
+ - [Assumption 2]
213
+
214
+ ---
215
+
216
+ ## Original Idea
217
+
218
+ ${idea}
219
+
220
+ ${context ? `### Additional Context\n${context}` : ''}
221
+
222
+ ---
223
+
224
+ ## Correlation Analysis (Connect The Dots)
225
+
226
+ ### Related Projects
227
+ | Project | Similarity | Reusable Components |
228
+ |---------|------------|---------------------|
229
+ | [Project A] | 85% | [Component list] |
230
+ | [Project B] | 60% | [Component list] |
231
+
232
+ ### Overlapping Technology
233
+ - [Tech stack overlap]
234
+ - [Shared libraries]
235
+ - [Common patterns]
236
+
237
+ ### Lessons from History
238
+ - [Lesson 1]: [Context and outcome]
239
+ - [Lesson 2]: [Context and outcome]
240
+
241
+ ### Risks Based on History
242
+ - [Risk from past project]: [How we'll address it]
243
+
244
+ ---
245
+
246
+ ## Industry Best Practices
247
+
248
+ ### Architecture
249
+ **Practice**: [Specific practice]
250
+ **Rationale**: [Why this is recommended]
251
+ **Sources**: [Citations]
252
+ **Applicability**: [How this applies to current project]
253
+
254
+ ### Security
255
+ **Practice**: [Security best practice]
256
+ **Rationale**: [Why this matters]
257
+ **Sources**: [Citations]
258
+
259
+ ### Performance
260
+ **Practice**: [Performance approach]
261
+ **Rationale**: [Performance considerations]
262
+
263
+ ### UX/UI
264
+ **Practice**: [UX principle]
265
+ **Rationale**: [User experience impact]
266
+
267
+ ---
268
+
269
+ ## Feasibility Assessment
270
+
271
+ ### Technical Feasibility: ⭐⭐⭐☆☆ (3/5)
272
+
273
+ **Strengths**:
274
+ - [Strength 1]
275
+ - [Strength 2]
276
+
277
+ **Challenges**:
278
+ - [Challenge 1]: [Mitigation strategy]
279
+ - [Challenge 2]: [Mitigation strategy]
280
+
281
+ ### Time Estimate: X hours
282
+
283
+ **Breakdown**:
284
+ - Research & Planning: Xh
285
+ - Design: Xh
286
+ - Implementation: Xh
287
+ - Testing: Xh
288
+ - Documentation: Xh
289
+
290
+ **Total**: X hours
291
+
292
+ ### Complexity: Medium
293
+
294
+ **Reasoning**: [Explain complexity assessment]
295
+
296
+ ### Risk Assessment
297
+
298
+ | Risk | Severity | Probability | Mitigation |
299
+ |------|----------|-------------|------------|
300
+ | [Risk 1] | High | Medium | [Mitigation strategy] |
301
+ | [Risk 2] | Medium | Low | [Mitigation strategy] |
302
+ | [Risk 3] | Low | Low | [Mitigation strategy] |
303
+
304
+ ---
305
+
306
+ ## Recommendations
307
+
308
+ ### Recommended Tech Stack
309
+
310
+ **Frontend**:
311
+ - [Choice 1] - [Rationale]
312
+ - [Choice 2] - [Rationale]
313
+
314
+ **Backend**:
315
+ - [Choice 1] - [Rationale]
316
+ - [Choice 2] - [Rationale]
317
+
318
+ **Database**:
319
+ - [Choice] - [Rationale]
320
+
321
+ **Other**:
322
+ - [Choice] - [Rationale]
323
+
324
+ ### Suggested Architecture
325
+
326
+ [High-level architecture description - could include diagrams]
327
+
328
+ ### Potential Issues to Watch
329
+
330
+ 1. **[Issue 1]**: [Monitoring approach, early warning signs]
331
+ 2. **[Issue 2]**: [Monitoring approach, early warning signs]
332
+ 3. **[Issue 3]**: [Monitoring approach, early warning signs]
333
+
334
+ ### Next Steps (Phase 2: Approval)
335
+
336
+ 1. [ ] Review this report and ensure all sections are complete
337
+ 2. [ ] Run quality gate: \`smc workflow validate ${this.reportPath}\`
338
+ 3. [ ] Address any blockers identified
339
+ 4. [ ] Proceed to Phase 2 for Claude review and consensus
340
+
341
+ ---
342
+
343
+ ## Quality Checklist
344
+
345
+ - [x] Requirement summary is clear and complete
346
+ - [ ] Correlation analysis found related work/patterns
347
+ - [ ] Best practices are cited with sources
348
+ - [ ] Feasibility has concrete ratings (not vague)
349
+ - [ ] Time estimate is justified
350
+ - [ ] Risks have mitigation strategies
351
+ - [ ] Recommendations are actionable
352
+
353
+ ---
354
+
355
+ ## Metadata
356
+
357
+ - **Generated**: ${date} ${time}
358
+ - **Knowledge Sources Queried**: ${knowledgeContext.sourceCount}
359
+ - **Web Search Performed**: No
360
+ - **Confidence Level**: [To be filled by AI]
361
+
362
+ ---
363
+
364
+ *This report was generated by the Phase 1 Research Executor. Please complete all sections before proceeding to Phase 2.*
365
+ `;
366
+ }
367
+
368
+ /**
369
+ * Save prompt for AI execution
370
+ */
371
+ private async savePrompt(prompt: string): Promise<void> {
372
+ const promptPath = path.join(this.phaseDir, 'research-prompt.md');
373
+ await fs.promises.writeFile(promptPath, prompt, 'utf-8');
374
+ }
375
+
376
+ /**
377
+ * Ensure project directories exist
378
+ */
379
+ private async ensureDirectories(): Promise<void> {
380
+ await fs.promises.mkdir(this.projectDir, { recursive: true });
381
+ await fs.promises.mkdir(this.phaseDir, { recursive: true });
382
+ }
383
+
384
+ /**
385
+ * Get the report path
386
+ */
387
+ getReportPath(): string {
388
+ return this.reportPath;
389
+ }
390
+
391
+ /**
392
+ * Check if report exists
393
+ */
394
+ reportExists(): boolean {
395
+ return fs.existsSync(this.reportPath);
396
+ }
397
+
398
+ /**
399
+ * Read the existing report
400
+ */
401
+ readReport(): string | null {
402
+ if (!this.reportExists()) return null;
403
+ return fs.readFileSync(this.reportPath, 'utf-8');
404
+ }
405
+
406
+ /**
407
+ * Validate the report
408
+ */
409
+ validateReport() {
410
+ return FeasibilityValidator.validateFile(this.reportPath);
411
+ }
412
+ }
413
+
414
+ // ============================================================================
415
+ // Project Management Helpers
416
+ // ============================================================================
417
+
418
+ export function generateProjectId(): string {
419
+ const timestamp = Date.now().toString(36);
420
+ const random = Math.random().toString(36).substr(2, 5);
421
+ return `proj_${timestamp}_${random}`;
422
+ }
423
+
424
+ export async function createProject(idea: string, context: string = ''): Promise<string> {
425
+ const projectId = generateProjectId();
426
+ const executor = new Phase1ResearchExecutor(projectId);
427
+
428
+ await executor.execute(idea, context, (msg, current, total) => {
429
+ const progress = Math.round((current / total) * 100);
430
+ console.log(`[${progress}%] ${msg}`);
431
+ });
432
+
433
+ return projectId;
434
+ }
435
+
436
+ export function listProjects(): Array<{
437
+ id: string;
438
+ path: string;
439
+ hasReport: boolean;
440
+ }> {
441
+ if (!fs.existsSync(PROJECTS_DIR)) {
442
+ return [];
443
+ }
444
+
445
+ const projects: Array<{
446
+ id: string;
447
+ path: string;
448
+ hasReport: boolean;
449
+ }> = [];
450
+
451
+ const entries = fs.readdirSync(PROJECTS_DIR, { withFileTypes: true });
452
+ for (const entry of entries) {
453
+ if (entry.isDirectory() && entry.name.startsWith('proj_')) {
454
+ const projectPath = path.join(PROJECTS_DIR, entry.name);
455
+ const reportPath = path.join(projectPath, 'phase1', 'feasibility-report.md');
456
+ projects.push({
457
+ id: entry.name,
458
+ path: projectPath,
459
+ hasReport: fs.existsSync(reportPath)
460
+ });
461
+ }
462
+ }
463
+
464
+ return projects.sort((a, b) => b.id.localeCompare(a.id));
465
+ }