midas-mcp 1.2.0 → 1.4.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.
package/dist/ai.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export interface CodebaseContext {
2
+ files: string[];
3
+ summary: string;
4
+ techStack: string[];
5
+ suggestedNextStep: string;
6
+ }
7
+ export declare function analyzeCodebase(projectPath: string): Promise<CodebaseContext>;
8
+ export declare function generateSmartPrompt(projectPath: string, phase: string, step: string, context?: CodebaseContext): Promise<string>;
9
+ export declare function detectStepCompletion(projectPath: string, currentStep: string): Promise<{
10
+ completed: boolean;
11
+ confidence: number;
12
+ reason: string;
13
+ }>;
14
+ //# sourceMappingURL=ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAkFA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAsEnF;AAED,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAiCrE"}
package/dist/ai.js ADDED
@@ -0,0 +1,199 @@
1
+ import { getApiKey } from './config.js';
2
+ import { readdirSync, readFileSync } from 'fs';
3
+ import { join, extname } from 'path';
4
+ // Simple HTTP client for Anthropic API (no external dependency)
5
+ async function callClaude(prompt, systemPrompt) {
6
+ const apiKey = getApiKey();
7
+ if (!apiKey) {
8
+ throw new Error('No API key configured');
9
+ }
10
+ const response = await fetch('https://api.anthropic.com/v1/messages', {
11
+ method: 'POST',
12
+ headers: {
13
+ 'Content-Type': 'application/json',
14
+ 'x-api-key': apiKey,
15
+ 'anthropic-version': '2023-06-01',
16
+ },
17
+ body: JSON.stringify({
18
+ model: 'claude-sonnet-4-20250514',
19
+ max_tokens: 1024,
20
+ system: systemPrompt || 'You are Midas, an elite vibecoding coach. Be concise and actionable.',
21
+ messages: [{ role: 'user', content: prompt }],
22
+ }),
23
+ });
24
+ if (!response.ok) {
25
+ const error = await response.text();
26
+ throw new Error(`API error: ${response.status} - ${error}`);
27
+ }
28
+ const data = await response.json();
29
+ return data.content[0]?.text || '';
30
+ }
31
+ // Scan codebase for context
32
+ function scanCodebase(projectPath, maxFiles = 20) {
33
+ const files = [];
34
+ const importantExtensions = ['.ts', '.tsx', '.js', '.jsx', '.py', '.go', '.rs', '.swift'];
35
+ const ignoreDirs = ['node_modules', '.git', 'dist', 'build', '.next', '__pycache__'];
36
+ function scan(dir, depth = 0) {
37
+ if (depth > 3 || files.length >= maxFiles)
38
+ return;
39
+ try {
40
+ const entries = readdirSync(dir, { withFileTypes: true });
41
+ for (const entry of entries) {
42
+ if (files.length >= maxFiles)
43
+ break;
44
+ if (entry.name.startsWith('.'))
45
+ continue;
46
+ if (ignoreDirs.includes(entry.name))
47
+ continue;
48
+ const fullPath = join(dir, entry.name);
49
+ if (entry.isDirectory()) {
50
+ scan(fullPath, depth + 1);
51
+ }
52
+ else if (entry.isFile()) {
53
+ const ext = extname(entry.name);
54
+ if (importantExtensions.includes(ext)) {
55
+ files.push(fullPath);
56
+ }
57
+ }
58
+ }
59
+ }
60
+ catch {
61
+ // Permission denied or other error
62
+ }
63
+ }
64
+ scan(projectPath);
65
+ return files;
66
+ }
67
+ function getFileContent(filePath, maxLines = 50) {
68
+ try {
69
+ const content = readFileSync(filePath, 'utf-8');
70
+ const lines = content.split('\n').slice(0, maxLines);
71
+ return lines.join('\n');
72
+ }
73
+ catch {
74
+ return '';
75
+ }
76
+ }
77
+ export async function analyzeCodebase(projectPath) {
78
+ const apiKey = getApiKey();
79
+ // Get file list
80
+ const files = scanCodebase(projectPath);
81
+ if (!apiKey) {
82
+ // Return basic analysis without AI
83
+ const techStack = [];
84
+ // Detect tech stack from files
85
+ const hasPackageJson = files.some(f => f.endsWith('package.json'));
86
+ const hasTsConfig = files.some(f => f.endsWith('tsconfig.json'));
87
+ const hasRequirements = files.some(f => f.endsWith('requirements.txt'));
88
+ const hasCargoToml = files.some(f => f.endsWith('Cargo.toml'));
89
+ if (hasPackageJson)
90
+ techStack.push('Node.js');
91
+ if (hasTsConfig)
92
+ techStack.push('TypeScript');
93
+ if (hasRequirements)
94
+ techStack.push('Python');
95
+ if (hasCargoToml)
96
+ techStack.push('Rust');
97
+ if (files.some(f => f.includes('react') || f.endsWith('.tsx') || f.endsWith('.jsx')))
98
+ techStack.push('React');
99
+ return {
100
+ files,
101
+ summary: `Found ${files.length} source files`,
102
+ techStack,
103
+ suggestedNextStep: 'Continue with current phase',
104
+ };
105
+ }
106
+ // Build context for AI
107
+ const fileList = files.map(f => f.replace(projectPath, '')).join('\n');
108
+ const sampleContent = files.slice(0, 5).map(f => {
109
+ const content = getFileContent(f);
110
+ return `--- ${f.replace(projectPath, '')} ---\n${content}`;
111
+ }).join('\n\n');
112
+ try {
113
+ const response = await callClaude(`Analyze this codebase and provide:
114
+ 1. A one-line summary of what it does
115
+ 2. The tech stack (list)
116
+ 3. The most important next step for production readiness
117
+
118
+ Files:
119
+ ${fileList}
120
+
121
+ Sample content:
122
+ ${sampleContent}
123
+
124
+ Respond in JSON format:
125
+ {"summary": "...", "techStack": ["..."], "suggestedNextStep": "..."}`, 'You are a senior engineer analyzing a codebase. Be concise. Respond only with valid JSON.');
126
+ const parsed = JSON.parse(response);
127
+ return {
128
+ files,
129
+ summary: parsed.summary || `Found ${files.length} source files`,
130
+ techStack: parsed.techStack || [],
131
+ suggestedNextStep: parsed.suggestedNextStep || 'Continue with current phase',
132
+ };
133
+ }
134
+ catch (error) {
135
+ return {
136
+ files,
137
+ summary: `Found ${files.length} source files`,
138
+ techStack: [],
139
+ suggestedNextStep: 'Continue with current phase',
140
+ };
141
+ }
142
+ }
143
+ export async function generateSmartPrompt(projectPath, phase, step, context) {
144
+ const apiKey = getApiKey();
145
+ if (!apiKey) {
146
+ return ''; // Fall back to default prompts
147
+ }
148
+ const codebaseContext = context || await analyzeCodebase(projectPath);
149
+ try {
150
+ const response = await callClaude(`Generate a specific, actionable prompt for a developer to paste into Cursor AI.
151
+
152
+ Project: ${codebaseContext.summary}
153
+ Tech stack: ${codebaseContext.techStack.join(', ')}
154
+ Current phase: ${phase}
155
+ Current step: ${step}
156
+
157
+ The prompt should:
158
+ 1. Be specific to THIS codebase
159
+ 2. Reference actual files/patterns if known
160
+ 3. Be immediately actionable
161
+ 4. Follow the Elite Vibecoding methodology
162
+
163
+ Respond with just the prompt text, no explanation.`, 'You are Midas, an elite vibecoding coach. Generate prompts that are specific, actionable, and context-aware.');
164
+ return response.trim();
165
+ }
166
+ catch {
167
+ return '';
168
+ }
169
+ }
170
+ export async function detectStepCompletion(projectPath, currentStep) {
171
+ const apiKey = getApiKey();
172
+ if (!apiKey) {
173
+ return { completed: false, confidence: 0, reason: 'No API key' };
174
+ }
175
+ const context = await analyzeCodebase(projectPath);
176
+ try {
177
+ const response = await callClaude(`Based on this codebase analysis, determine if the following step is complete:
178
+
179
+ Step: ${currentStep}
180
+ Files: ${context.files.length} source files
181
+ Tech stack: ${context.techStack.join(', ')}
182
+
183
+ Consider:
184
+ - IDEA: Is there a clear project purpose?
185
+ - RESEARCH: Are there docs about alternatives?
186
+ - BRAINLIFT: Is there a brainlift.md with insights?
187
+ - PRD: Is there a prd.md with requirements?
188
+ - GAMEPLAN: Is there a gameplan.md with plan?
189
+ - BUILD steps: Is there working code with tests?
190
+
191
+ Respond in JSON:
192
+ {"completed": true/false, "confidence": 0-100, "reason": "..."}`, 'You are analyzing project completeness. Be conservative - only mark complete if clearly done.');
193
+ return JSON.parse(response);
194
+ }
195
+ catch {
196
+ return { completed: false, confidence: 0, reason: 'Analysis failed' };
197
+ }
198
+ }
199
+ //# sourceMappingURL=ai.js.map
package/dist/ai.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAY,MAAM,IAAI,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAErC,gEAAgE;AAChE,KAAK,UAAU,UAAU,CAAC,MAAc,EAAE,YAAqB;IAC7D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,uCAAuC,EAAE;QACpE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,WAAW,EAAE,MAAM;YACnB,mBAAmB,EAAE,YAAY;SAClC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,KAAK,EAAE,0BAA0B;YACjC,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,YAAY,IAAI,sEAAsE;YAC9F,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SAC9C,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,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,CAAC,WAAW,CAAC,CAAC;IAEtE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAC/B;;WAEK,eAAe,CAAC,OAAO;cACpB,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;iBACjC,KAAK;gBACN,IAAI;;;;;;;;mDAQ+B,EAC7C,8GAA8G,CAC/G,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,WAAmB,EACnB,WAAmB;IAEnB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;IACnE,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAC/B;;QAEE,WAAW;SACV,OAAO,CAAC,KAAK,CAAC,MAAM;cACf,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;gEAWsB,EAC1D,+FAA+F,CAChG,CAAC;QAEF,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;IACxE,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Phase } from './state/phase.js';
2
+ export interface ProjectAnalysis {
3
+ currentPhase: Phase;
4
+ summary: string;
5
+ whatsDone: string[];
6
+ whatsNext: string;
7
+ suggestedPrompt: string;
8
+ confidence: number;
9
+ techStack: string[];
10
+ }
11
+ export declare function analyzeProject(projectPath: string): Promise<ProjectAnalysis>;
12
+ //# sourceMappingURL=analyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAiD,MAAM,kBAAkB,CAAC;AA8E7F,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,KAAK,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAmKlF"}
@@ -0,0 +1,238 @@
1
+ import { getApiKey } from './config.js';
2
+ import { getRecentConversationIds, getConversation } from './cursor.js';
3
+ import { readdirSync, readFileSync, existsSync } from 'fs';
4
+ import { join, extname } from 'path';
5
+ async function callClaude(prompt, systemPrompt) {
6
+ const apiKey = getApiKey();
7
+ if (!apiKey)
8
+ throw new Error('No API key');
9
+ const response = await fetch('https://api.anthropic.com/v1/messages', {
10
+ method: 'POST',
11
+ headers: {
12
+ 'Content-Type': 'application/json',
13
+ 'x-api-key': apiKey,
14
+ 'anthropic-version': '2023-06-01',
15
+ },
16
+ body: JSON.stringify({
17
+ model: 'claude-sonnet-4-20250514',
18
+ max_tokens: 2048,
19
+ system: systemPrompt,
20
+ messages: [{ role: 'user', content: prompt }],
21
+ }),
22
+ });
23
+ if (!response.ok) {
24
+ throw new Error(`API error: ${response.status}`);
25
+ }
26
+ const data = await response.json();
27
+ return data.content[0]?.text || '';
28
+ }
29
+ function scanFiles(dir, maxFiles = 30) {
30
+ const files = [];
31
+ const extensions = ['.ts', '.tsx', '.js', '.jsx', '.py', '.swift', '.go', '.rs', '.md'];
32
+ const ignore = ['node_modules', '.git', 'dist', 'build', '.next', '__pycache__'];
33
+ function scan(d, depth = 0) {
34
+ if (depth > 3 || files.length >= maxFiles)
35
+ return;
36
+ try {
37
+ for (const entry of readdirSync(d, { withFileTypes: true })) {
38
+ if (files.length >= maxFiles)
39
+ break;
40
+ if (entry.name.startsWith('.') || ignore.includes(entry.name))
41
+ continue;
42
+ const path = join(d, entry.name);
43
+ if (entry.isDirectory())
44
+ scan(path, depth + 1);
45
+ else if (extensions.includes(extname(entry.name)))
46
+ files.push(path);
47
+ }
48
+ }
49
+ catch { }
50
+ }
51
+ scan(dir);
52
+ return files;
53
+ }
54
+ function readFile(path, maxLines = 30) {
55
+ try {
56
+ return readFileSync(path, 'utf-8').split('\n').slice(0, maxLines).join('\n');
57
+ }
58
+ catch {
59
+ return '';
60
+ }
61
+ }
62
+ function getRecentChatHistory(limit = 30) {
63
+ const ids = getRecentConversationIds(3);
64
+ const messages = [];
65
+ for (const id of ids) {
66
+ const conv = getConversation(id);
67
+ if (!conv)
68
+ continue;
69
+ for (const msg of conv.messages.slice(-15)) {
70
+ const role = msg.type === 'user' ? 'USER' : 'ASSISTANT';
71
+ const text = msg.text.slice(0, 500);
72
+ messages.push(`${role}: ${text}`);
73
+ if (messages.length >= limit)
74
+ break;
75
+ }
76
+ if (messages.length >= limit)
77
+ break;
78
+ }
79
+ return messages.join('\n\n');
80
+ }
81
+ export async function analyzeProject(projectPath) {
82
+ const apiKey = getApiKey();
83
+ if (!apiKey) {
84
+ return {
85
+ currentPhase: { phase: 'IDLE' },
86
+ summary: 'No API key - cannot analyze',
87
+ whatsDone: [],
88
+ whatsNext: 'Add API key to ~/.midas/config.json',
89
+ suggestedPrompt: '',
90
+ confidence: 0,
91
+ techStack: [],
92
+ };
93
+ }
94
+ // Gather context
95
+ const files = scanFiles(projectPath);
96
+ const fileList = files.map(f => f.replace(projectPath + '/', '')).join('\n');
97
+ // Check for Eagle Sight docs
98
+ const hasbrainlift = existsSync(join(projectPath, 'docs', 'brainlift.md'));
99
+ const hasPrd = existsSync(join(projectPath, 'docs', 'prd.md'));
100
+ const hasGameplan = existsSync(join(projectPath, 'docs', 'gameplan.md'));
101
+ const brainliftContent = hasbrainlift ? readFile(join(projectPath, 'docs', 'brainlift.md')) : '';
102
+ const prdContent = hasPrd ? readFile(join(projectPath, 'docs', 'prd.md')) : '';
103
+ const gameplanContent = hasGameplan ? readFile(join(projectPath, 'docs', 'gameplan.md')) : '';
104
+ // Check for deployment/monitoring
105
+ const hasDockerfile = existsSync(join(projectPath, 'Dockerfile')) || existsSync(join(projectPath, 'docker-compose.yml'));
106
+ const hasCI = existsSync(join(projectPath, '.github', 'workflows'));
107
+ const hasTests = files.some(f => f.includes('.test.') || f.includes('.spec.') || f.includes('__tests__'));
108
+ // Get chat history
109
+ const chatHistory = getRecentChatHistory();
110
+ // Sample some code files
111
+ const codeSamples = files.slice(0, 5).map(f => {
112
+ const content = readFile(f, 20);
113
+ return `--- ${f.replace(projectPath + '/', '')} ---\n${content}`;
114
+ }).join('\n\n');
115
+ const prompt = `Analyze this project and determine where the developer is in the product lifecycle.
116
+
117
+ ## Project Files (${files.length} total):
118
+ ${fileList}
119
+
120
+ ## Eagle Sight Docs:
121
+ - brainlift.md: ${hasbrainlift ? 'exists' : 'missing'}
122
+ ${brainliftContent ? `Preview:\n${brainliftContent.slice(0, 400)}` : ''}
123
+
124
+ - prd.md: ${hasPrd ? 'exists' : 'missing'}
125
+ ${prdContent ? `Preview:\n${prdContent.slice(0, 400)}` : ''}
126
+
127
+ - gameplan.md: ${hasGameplan ? 'exists' : 'missing'}
128
+ ${gameplanContent ? `Preview:\n${gameplanContent.slice(0, 400)}` : ''}
129
+
130
+ ## Infrastructure:
131
+ - Tests: ${hasTests ? 'yes' : 'no'}
132
+ - Dockerfile/compose: ${hasDockerfile ? 'yes' : 'no'}
133
+ - CI/CD (.github/workflows): ${hasCI ? 'yes' : 'no'}
134
+
135
+ ## Recent Chat History:
136
+ ${chatHistory || 'No recent chat history'}
137
+
138
+ ## Code Samples:
139
+ ${codeSamples || 'No code files yet'}
140
+
141
+ ## The 4 Phases with Steps:
142
+
143
+ EAGLE_SIGHT (Planning):
144
+ - IDEA: Define core idea, problem, audience
145
+ - RESEARCH: Landscape scan, competitors
146
+ - BRAINLIFT: Document unique insights
147
+ - PRD: Write requirements
148
+ - GAMEPLAN: Plan the build
149
+
150
+ BUILD (Development - the 7-step cycle):
151
+ - RULES: Read .cursorrules, understand constraints
152
+ - INDEX: Index codebase structure, architecture
153
+ - READ: Read specific implementation files
154
+ - RESEARCH: Look up docs, APIs, best practices
155
+ - IMPLEMENT: Write code with tests
156
+ - TEST: Run tests, fix failures
157
+ - DEBUG: Tornado cycle (research + logs + tests)
158
+
159
+ SHIP (Deployment):
160
+ - REVIEW: Code review, security audit
161
+ - DEPLOY: CI/CD, production deploy
162
+ - MONITOR: Logs, alerts, health checks
163
+
164
+ GROW (Iteration):
165
+ - FEEDBACK: Collect user feedback
166
+ - ANALYZE: Study metrics and behavior
167
+ - ITERATE: Plan next cycle (back to EAGLE_SIGHT)
168
+
169
+ Based on all evidence, determine:
170
+ 1. Current phase and step
171
+ 2. What's completed
172
+ 3. What's next
173
+ 4. Specific prompt for Cursor
174
+
175
+ Respond ONLY with valid JSON:
176
+ {
177
+ "phase": "EAGLE_SIGHT" | "BUILD" | "SHIP" | "GROW" | "IDLE",
178
+ "step": "step name",
179
+ "summary": "one-line project summary",
180
+ "techStack": ["tech1", "tech2"],
181
+ "whatsDone": ["done1", "done2"],
182
+ "whatsNext": "specific next action",
183
+ "suggestedPrompt": "exact prompt to paste in Cursor",
184
+ "confidence": 0-100
185
+ }`;
186
+ try {
187
+ const response = await callClaude(prompt, 'You are Midas, an elite vibecoding coach. Analyze projects and determine their exact phase in the development lifecycle. Be specific and actionable. Respond only with valid JSON.');
188
+ // Parse JSON from response
189
+ let jsonStr = response;
190
+ if (response.includes('```')) {
191
+ const match = response.match(/```(?:json)?\s*([\s\S]*?)```/);
192
+ if (match)
193
+ jsonStr = match[1];
194
+ }
195
+ const data = JSON.parse(jsonStr.trim());
196
+ // Convert to Phase type
197
+ let currentPhase;
198
+ if (data.phase === 'IDLE' || !data.phase) {
199
+ currentPhase = { phase: 'IDLE' };
200
+ }
201
+ else if (data.phase === 'EAGLE_SIGHT') {
202
+ currentPhase = { phase: 'EAGLE_SIGHT', step: data.step };
203
+ }
204
+ else if (data.phase === 'BUILD') {
205
+ currentPhase = { phase: 'BUILD', step: data.step };
206
+ }
207
+ else if (data.phase === 'SHIP') {
208
+ currentPhase = { phase: 'SHIP', step: data.step };
209
+ }
210
+ else if (data.phase === 'GROW') {
211
+ currentPhase = { phase: 'GROW', step: data.step };
212
+ }
213
+ else {
214
+ currentPhase = { phase: 'IDLE' };
215
+ }
216
+ return {
217
+ currentPhase,
218
+ summary: data.summary || 'Project analyzed',
219
+ whatsDone: data.whatsDone || [],
220
+ whatsNext: data.whatsNext || 'Continue development',
221
+ suggestedPrompt: data.suggestedPrompt || '',
222
+ confidence: data.confidence || 50,
223
+ techStack: data.techStack || [],
224
+ };
225
+ }
226
+ catch (error) {
227
+ return {
228
+ currentPhase: { phase: 'IDLE' },
229
+ summary: 'Analysis failed',
230
+ whatsDone: [],
231
+ whatsNext: 'Try again or check API key',
232
+ suggestedPrompt: '',
233
+ confidence: 0,
234
+ techStack: [],
235
+ };
236
+ }
237
+ }
238
+ //# sourceMappingURL=analyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer.js","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO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AO,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAmBjD;AAED,wBAAgB,QAAQ,IAAI,IAAI,CAmC/B;AAED,wBAAgB,YAAY,IAAI,IAAI,CAgCnC;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,CAqC3E"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAiCA,wBAAgB,QAAQ,IAAI,IAAI,CAoB/B;AAED,wBAAgB,UAAU,IAAI,IAAI,CA6DjC;AAED,wBAAgB,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAmBjD;AAED,wBAAgB,QAAQ,IAAI,IAAI,CAmC/B;AAED,wBAAgB,YAAY,IAAI,IAAI,CAgCnC;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,CAqC3E"}
package/dist/cli.js CHANGED
@@ -57,68 +57,50 @@ export function showStatus() {
57
57
  console.log(`\n Run: ${cyan}npx midas-mcp init <project-name>${reset}\n`);
58
58
  return;
59
59
  }
60
- if (phase.phase === 'EAGLE_SIGHT') {
61
- const steps = ['IDEA', 'RESEARCH', 'BRAINLIFT', 'PRD', 'GAMEPLAN'];
62
- const currentIdx = steps.indexOf(phase.step);
63
- const progress = currentIdx + 1;
64
- console.log(box(`${yellow}${bold}EAGLE SIGHT${reset} ${progressBar(progress, 5)} ${progress}/5`));
65
- console.log('');
66
- steps.forEach((step, i) => {
67
- if (i < currentIdx) {
68
- console.log(` ${green}✓${reset} ${dim}${step}${reset}`);
69
- }
70
- else if (i === currentIdx) {
71
- console.log(` ${yellow}→${reset} ${bold}${step}${reset} ${dim}(current)${reset}`);
72
- }
73
- else {
74
- console.log(` ${dim}○ ${step}${reset}`);
75
- }
76
- });
77
- console.log('');
78
- const nextActions = {
79
- IDEA: 'Define your core idea. What problem are you solving?',
80
- RESEARCH: 'Scan the landscape. What already exists?',
81
- BRAINLIFT: 'Fill out docs/brainlift.md with YOUR unique insights',
82
- PRD: 'Fill out docs/prd.md with requirements',
83
- GAMEPLAN: 'Fill out docs/gameplan.md with your build plan',
84
- };
85
- console.log(` ${bold}Next:${reset} ${nextActions[phase.step]}\n`);
86
- return;
87
- }
88
- if (phase.phase === 'BUILD') {
89
- const steps = ['RULES_LOADED', 'CODEBASE_INDEXED', 'FILES_READ', 'RESEARCHING', 'IMPLEMENTING', 'TESTING', 'DEBUGGING'];
90
- const currentIdx = steps.indexOf(phase.step);
91
- const progress = currentIdx + 1;
92
- console.log(box(`${blue}${bold}BUILD${reset} ${progressBar(progress, 7)} ${progress}/7`));
93
- console.log('');
94
- const stepLabels = {
95
- RULES_LOADED: 'Load Rules',
96
- CODEBASE_INDEXED: 'Index Codebase',
97
- FILES_READ: 'Read Files',
98
- RESEARCHING: 'Research',
99
- IMPLEMENTING: 'Implement',
100
- TESTING: 'Test',
101
- DEBUGGING: 'Debug',
102
- };
103
- steps.forEach((step, i) => {
104
- const label = stepLabels[step];
105
- if (i < currentIdx) {
106
- console.log(` ${green}✓${reset} ${dim}${label}${reset}`);
107
- }
108
- else if (i === currentIdx) {
109
- console.log(` ${blue}→${reset} ${bold}${label}${reset} ${dim}(current)${reset}`);
110
- }
111
- else {
112
- console.log(` ${dim}○ ${label}${reset}`);
113
- }
114
- });
115
- console.log('');
60
+ const phaseConfig = {
61
+ EAGLE_SIGHT: {
62
+ color: yellow,
63
+ steps: ['IDEA', 'RESEARCH', 'BRAINLIFT', 'PRD', 'GAMEPLAN'],
64
+ },
65
+ BUILD: {
66
+ color: blue,
67
+ steps: ['RULES', 'INDEX', 'READ', 'RESEARCH', 'IMPLEMENT', 'TEST', 'DEBUG'],
68
+ labels: { RULES: 'Rules', INDEX: 'Index', READ: 'Read', RESEARCH: 'Research', IMPLEMENT: 'Implement', TEST: 'Test', DEBUG: 'Debug' },
69
+ },
70
+ SHIP: {
71
+ color: green,
72
+ steps: ['REVIEW', 'DEPLOY', 'MONITOR'],
73
+ labels: { REVIEW: 'Review', DEPLOY: 'Deploy', MONITOR: 'Monitor' },
74
+ },
75
+ GROW: {
76
+ color: '\x1b[35m', // magenta
77
+ steps: ['FEEDBACK', 'ANALYZE', 'ITERATE'],
78
+ labels: { FEEDBACK: 'Feedback', ANALYZE: 'Analyze', ITERATE: 'Iterate' },
79
+ },
80
+ };
81
+ const config = phaseConfig[phase.phase];
82
+ if (!config) {
83
+ console.log(box(`${dim}Unknown phase${reset}`));
116
84
  return;
117
85
  }
118
- if (phase.phase === 'SHIPPED') {
119
- console.log(box(`${green}${bold}SHIPPED${reset} ${progressBar(1, 1)} Done!`));
120
- console.log(`\n Run ${cyan}npx midas-mcp audit${reset} to check production readiness.\n`);
121
- }
86
+ const steps = config.steps;
87
+ const currentIdx = steps.indexOf(phase.step);
88
+ const progress = currentIdx + 1;
89
+ console.log(box(`${config.color}${bold}${phase.phase.replace('_', ' ')}${reset} ${progressBar(progress, steps.length)} ${progress}/${steps.length}`));
90
+ console.log('');
91
+ steps.forEach((step, i) => {
92
+ const label = config.labels?.[step] || step;
93
+ if (i < currentIdx) {
94
+ console.log(` ${green}✓${reset} ${dim}${label}${reset}`);
95
+ }
96
+ else if (i === currentIdx) {
97
+ console.log(` ${config.color}→${reset} ${bold}${label}${reset} ${dim}(current)${reset}`);
98
+ }
99
+ else {
100
+ console.log(` ${dim}○ ${label}${reset}`);
101
+ }
102
+ });
103
+ console.log('');
122
104
  }
123
105
  export function runInit(projectName) {
124
106
  if (!projectName) {