mycontext-cli 2.0.38 → 3.0.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/README.md +53 -266
- package/dist/cli.js +15 -202
- package/dist/cli.js.map +1 -1
- package/dist/clients/XAIClient.d.ts.map +1 -1
- package/dist/clients/XAIClient.js +6 -2
- package/dist/clients/XAIClient.js.map +1 -1
- package/dist/commands/analyze-screenshot.d.ts +8 -0
- package/dist/commands/analyze-screenshot.d.ts.map +1 -0
- package/dist/commands/analyze-screenshot.js +101 -0
- package/dist/commands/analyze-screenshot.js.map +1 -0
- package/dist/commands/analyze.d.ts +5 -0
- package/dist/commands/analyze.d.ts.map +1 -1
- package/dist/commands/analyze.js +59 -0
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/generate-actions.d.ts +23 -0
- package/dist/commands/generate-actions.d.ts.map +1 -0
- package/dist/commands/generate-actions.js +342 -0
- package/dist/commands/generate-actions.js.map +1 -0
- package/dist/commands/generate-components-manifest.d.ts +25 -0
- package/dist/commands/generate-components-manifest.d.ts.map +1 -0
- package/dist/commands/generate-components-manifest.js +288 -0
- package/dist/commands/generate-components-manifest.js.map +1 -0
- package/dist/commands/generate-screens-list.d.ts +23 -0
- package/dist/commands/generate-screens-list.d.ts.map +1 -0
- package/dist/commands/generate-screens-list.js +282 -0
- package/dist/commands/generate-screens-list.js.map +1 -0
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +5 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +26 -70
- package/dist/commands/init.js.map +1 -1
- package/dist/package.json +4 -2
- package/dist/services/gemini-vision.d.ts +57 -0
- package/dist/services/gemini-vision.d.ts.map +1 -0
- package/dist/services/gemini-vision.js +282 -0
- package/dist/services/gemini-vision.js.map +1 -0
- package/dist/utils/geminiClient.d.ts +21 -24
- package/dist/utils/geminiClient.d.ts.map +1 -1
- package/dist/utils/geminiClient.js +211 -162
- package/dist/utils/geminiClient.js.map +1 -1
- package/dist/utils/hybridAIClient.d.ts +1 -1
- package/dist/utils/hybridAIClient.d.ts.map +1 -1
- package/dist/utils/hybridAIClient.js +40 -23
- package/dist/utils/hybridAIClient.js.map +1 -1
- package/dist/utils/visionUtils.d.ts +19 -0
- package/dist/utils/visionUtils.d.ts.map +1 -0
- package/dist/utils/visionUtils.js +86 -0
- package/dist/utils/visionUtils.js.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-actions.js","sourceRoot":"","sources":["../../src/commands/generate-actions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsXA,wEAYC;AAlYD,kDAA0B;AAC1B,6CAA+B;AAC/B,gDAAwB;AAExB,8CAAmD;AACnD,4CAAyC;AACzC,4DAAyD;AAuCzD;;;GAGG;AACH,MAAa,sBAAsB;IAKjC;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAe,CAAC,0BAA0B,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,IAAI,+BAAc,EAAE,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,UAA0B,EAAE;QACxC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAErB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YAEzC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;gBACxE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;gBAC5C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,0CAA0C,CAAC,CAAC,CAAC;gBACtE,OAAO,CAAC,GAAG,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G,CAAC,EAAE,CAAC;oBACxD,EAAE,IAAI,wBAAwB,CAAC;oBAC/B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;wBAC/B,EAAE,IAAI,KAAK,GAAG,IAAI,CAAC;oBACrB,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,EAAE,IAAI,IAAI,CAAC;YACb,CAAC,CAAC,CAAC;QACL,CAAC;QAED,EAAE,IAAI;;iBAEO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;CACxC,CAAC;QAEE,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAnUD,wDAmUC;AAED,SAAgB,8BAA8B,CAAC,OAAgB;IAC7D,OAAO;SACJ,OAAO,CAAC,kBAAkB,CAAC;SAC3B,KAAK,CAAC,IAAI,CAAC;SACX,WAAW,CAAC,iEAAiE,CAAC;SAC9E,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,0BAA0B,CAAC;SAC7E,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC;SACjD,MAAM,CAAC,kBAAkB,EAAE,wCAAwC,CAAC;SACpE,MAAM,CAAC,KAAK,EAAE,OAAuB,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,IAAI,sBAAsB,EAAE,CAAC;QAC7C,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
export interface ComponentsManifestOptions {
|
|
3
|
+
output?: string;
|
|
4
|
+
verbose?: boolean;
|
|
5
|
+
format?: "markdown" | "json";
|
|
6
|
+
includeDemo?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Generate Components Manifest Command
|
|
10
|
+
* Creates typed component list with props, sample data, and required actions
|
|
11
|
+
*/
|
|
12
|
+
export declare class GenerateComponentsManifestCommand {
|
|
13
|
+
private spinner;
|
|
14
|
+
private aiClient;
|
|
15
|
+
private contextDir;
|
|
16
|
+
constructor();
|
|
17
|
+
execute(options?: ComponentsManifestOptions): Promise<void>;
|
|
18
|
+
private loadContext;
|
|
19
|
+
private buildComponentsPrompt;
|
|
20
|
+
private parseComponentsResponse;
|
|
21
|
+
private groupByType;
|
|
22
|
+
private generateMarkdown;
|
|
23
|
+
}
|
|
24
|
+
export declare function registerGenerateComponentsManifestCommand(program: Command): void;
|
|
25
|
+
//# sourceMappingURL=generate-components-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-components-manifest.d.ts","sourceRoot":"","sources":["../../src/commands/generate-components-manifest.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAoBD;;;GAGG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,UAAU,CAAS;;IAQrB,OAAO,CAAC,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;YA8DvD,WAAW;IA8BzB,OAAO,CAAC,qBAAqB;IA4E7B,OAAO,CAAC,uBAAuB;IA8B/B,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,gBAAgB;CAqDzB;AAED,wBAAgB,yCAAyC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAYhF"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.GenerateComponentsManifestCommand = void 0;
|
|
40
|
+
exports.registerGenerateComponentsManifestCommand = registerGenerateComponentsManifestCommand;
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const fs = __importStar(require("fs-extra"));
|
|
43
|
+
const path_1 = __importDefault(require("path"));
|
|
44
|
+
const fileNames_1 = require("../constants/fileNames");
|
|
45
|
+
const spinner_1 = require("../utils/spinner");
|
|
46
|
+
const logger_1 = require("../utils/logger");
|
|
47
|
+
const hybridAIClient_1 = require("../utils/hybridAIClient");
|
|
48
|
+
/**
|
|
49
|
+
* Generate Components Manifest Command
|
|
50
|
+
* Creates typed component list with props, sample data, and required actions
|
|
51
|
+
*/
|
|
52
|
+
class GenerateComponentsManifestCommand {
|
|
53
|
+
constructor() {
|
|
54
|
+
this.spinner = new spinner_1.EnhancedSpinner("Loading context files...");
|
|
55
|
+
this.aiClient = new hybridAIClient_1.HybridAIClient();
|
|
56
|
+
this.contextDir = ".mycontext";
|
|
57
|
+
}
|
|
58
|
+
async execute(options = {}) {
|
|
59
|
+
this.spinner.start();
|
|
60
|
+
try {
|
|
61
|
+
const context = await this.loadContext();
|
|
62
|
+
if (!context.screensList && !context.features && !context.types) {
|
|
63
|
+
this.spinner.fail("No context files found");
|
|
64
|
+
console.log(chalk_1.default.yellow("\n💡 Generate screens list first:"));
|
|
65
|
+
console.log(chalk_1.default.cyan(" mycontext generate:screens-list\n"));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.spinner.updateText("Analyzing screens and types for components...");
|
|
69
|
+
const prompt = this.buildComponentsPrompt(context);
|
|
70
|
+
this.spinner.updateText("Generating components manifest with AI...");
|
|
71
|
+
const response = await this.aiClient.generateText(prompt, {
|
|
72
|
+
maxTokens: 8192,
|
|
73
|
+
temperature: 0.3,
|
|
74
|
+
});
|
|
75
|
+
if (!response) {
|
|
76
|
+
throw new Error("AI generation failed");
|
|
77
|
+
}
|
|
78
|
+
const components = this.parseComponentsResponse(response.text);
|
|
79
|
+
const markdown = this.generateMarkdown(components);
|
|
80
|
+
const outputPath = options.output || path_1.default.join(this.contextDir, "03-components.md");
|
|
81
|
+
await fs.ensureDir(path_1.default.dirname(outputPath));
|
|
82
|
+
await fs.writeFile(outputPath, markdown, "utf-8");
|
|
83
|
+
// Also generate JSON for programmatic use
|
|
84
|
+
const jsonPath = path_1.default.join(this.contextDir, "03-components.json");
|
|
85
|
+
await fs.writeFile(jsonPath, JSON.stringify(components, null, 2), "utf-8");
|
|
86
|
+
this.spinner.succeed("Components manifest generated!");
|
|
87
|
+
console.log(chalk_1.default.green(`\n✅ Generated ${components.length} component definitions`));
|
|
88
|
+
console.log(chalk_1.default.gray(` Markdown: ${outputPath}`));
|
|
89
|
+
console.log(chalk_1.default.gray(` JSON: ${jsonPath}\n`));
|
|
90
|
+
// Print summary by type
|
|
91
|
+
const byType = this.groupByType(components);
|
|
92
|
+
console.log(chalk_1.default.bold("🧩 Components by Type:"));
|
|
93
|
+
Object.entries(byType).forEach(([type, comps]) => {
|
|
94
|
+
console.log(chalk_1.default.cyan(` ${type}: ${comps.length}`));
|
|
95
|
+
});
|
|
96
|
+
console.log(chalk_1.default.yellow("\n💡 Next Steps:"));
|
|
97
|
+
console.log(chalk_1.default.gray(" 1. mycontext generate actions"));
|
|
98
|
+
console.log(chalk_1.default.gray(" 2. mycontext generate-components"));
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
this.spinner.fail(`Failed to generate components manifest: ${error.message}`);
|
|
102
|
+
logger_1.logger.error("Components manifest generation error:", error);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async loadContext() {
|
|
106
|
+
const context = {};
|
|
107
|
+
const dir = this.contextDir;
|
|
108
|
+
const files = [
|
|
109
|
+
{ key: "screensList", path: "02-screens-list.md" },
|
|
110
|
+
{ key: "features", path: "01a-features.md" },
|
|
111
|
+
{ key: "userFlows", path: "01b-user-flows.md" },
|
|
112
|
+
{ key: "types", path: "02-types.ts" },
|
|
113
|
+
{ key: "prd", path: fileNames_1.CONTEXT_FILES.PRD },
|
|
114
|
+
{ key: "screenshotContext", path: "context.md" },
|
|
115
|
+
];
|
|
116
|
+
for (const file of files) {
|
|
117
|
+
const filePath = path_1.default.join(dir, file.path);
|
|
118
|
+
if (await fs.pathExists(filePath)) {
|
|
119
|
+
context[file.key] = await fs.readFile(filePath, "utf-8");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return context;
|
|
123
|
+
}
|
|
124
|
+
buildComponentsPrompt(context) {
|
|
125
|
+
let prompt = `You are a React component architect. Analyze the following project context and define ALL UI components needed.
|
|
126
|
+
|
|
127
|
+
For each component, provide:
|
|
128
|
+
1. Name (PascalCase, e.g., "TaskCard", "UserAvatar")
|
|
129
|
+
2. Type (layout|display|interactive|form|navigation)
|
|
130
|
+
3. Description (what it does)
|
|
131
|
+
4. Props with types and sample values
|
|
132
|
+
5. Actions/callbacks it needs
|
|
133
|
+
6. Which screens use it
|
|
134
|
+
|
|
135
|
+
OUTPUT FORMAT (JSON array):
|
|
136
|
+
\`\`\`json
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
"name": "TaskCard",
|
|
140
|
+
"type": "display",
|
|
141
|
+
"description": "Displays a single task with title, status, and actions",
|
|
142
|
+
"props": [
|
|
143
|
+
{
|
|
144
|
+
"name": "task",
|
|
145
|
+
"type": "Task",
|
|
146
|
+
"required": true,
|
|
147
|
+
"description": "The task data to display",
|
|
148
|
+
"sampleValue": { "id": "1", "title": "Buy groceries", "completed": false }
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "onComplete",
|
|
152
|
+
"type": "(id: string) => void",
|
|
153
|
+
"required": true,
|
|
154
|
+
"description": "Callback when task is marked complete",
|
|
155
|
+
"sampleValue": "() => console.log('completed')"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"sampleData": {
|
|
159
|
+
"task": { "id": "1", "title": "Sample Task", "completed": false, "priority": "high" }
|
|
160
|
+
},
|
|
161
|
+
"actions": ["onComplete", "onEdit", "onDelete"],
|
|
162
|
+
"usedInScreens": ["DashboardScreen", "TaskListScreen"]
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
\`\`\`
|
|
166
|
+
|
|
167
|
+
PROJECT CONTEXT:
|
|
168
|
+
`;
|
|
169
|
+
if (context.screensList) {
|
|
170
|
+
prompt += `\n## Screens List:\n${context.screensList.substring(0, 2500)}\n`;
|
|
171
|
+
}
|
|
172
|
+
if (context.types) {
|
|
173
|
+
prompt += `\n## TypeScript Types:\n${context.types.substring(0, 2000)}\n`;
|
|
174
|
+
}
|
|
175
|
+
if (context.features) {
|
|
176
|
+
prompt += `\n## Features:\n${context.features.substring(0, 2000)}\n`;
|
|
177
|
+
}
|
|
178
|
+
if (context.screenshotContext) {
|
|
179
|
+
prompt += `\n## Design Reference:\n${context.screenshotContext.substring(0, 1500)}\n`;
|
|
180
|
+
}
|
|
181
|
+
prompt += `
|
|
182
|
+
Include components for:
|
|
183
|
+
- Layout (Header, Footer, Sidebar, Container)
|
|
184
|
+
- Navigation (NavBar, TabBar, Breadcrumbs)
|
|
185
|
+
- Data Display (Cards, Lists, Tables, Charts)
|
|
186
|
+
- Forms (Input, Select, DatePicker, FormField)
|
|
187
|
+
- Feedback (Alert, Toast, Modal, Loading)
|
|
188
|
+
- Interactive (Button, Dropdown, Toggle)
|
|
189
|
+
|
|
190
|
+
Output ONLY the JSON array.`;
|
|
191
|
+
return prompt;
|
|
192
|
+
}
|
|
193
|
+
parseComponentsResponse(response) {
|
|
194
|
+
try {
|
|
195
|
+
const jsonMatch = response.match(/\[[\s\S]*\]/);
|
|
196
|
+
if (!jsonMatch) {
|
|
197
|
+
logger_1.logger.warn("Could not find JSON in response");
|
|
198
|
+
return [];
|
|
199
|
+
}
|
|
200
|
+
const components = JSON.parse(jsonMatch[0]);
|
|
201
|
+
return components.map((c) => ({
|
|
202
|
+
name: c.name || "UnnamedComponent",
|
|
203
|
+
type: c.type || "display",
|
|
204
|
+
description: c.description || "",
|
|
205
|
+
props: (c.props || []).map((p) => ({
|
|
206
|
+
name: p.name,
|
|
207
|
+
type: p.type || "any",
|
|
208
|
+
required: p.required ?? true,
|
|
209
|
+
description: p.description || "",
|
|
210
|
+
sampleValue: p.sampleValue,
|
|
211
|
+
})),
|
|
212
|
+
sampleData: c.sampleData || {},
|
|
213
|
+
actions: c.actions || [],
|
|
214
|
+
usedInScreens: c.usedInScreens || [],
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
logger_1.logger.error("Failed to parse components response:", error);
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
groupByType(components) {
|
|
223
|
+
return components.reduce((acc, comp) => {
|
|
224
|
+
const type = comp.type || "other";
|
|
225
|
+
if (!acc[type])
|
|
226
|
+
acc[type] = [];
|
|
227
|
+
acc[type].push(comp);
|
|
228
|
+
return acc;
|
|
229
|
+
}, {});
|
|
230
|
+
}
|
|
231
|
+
generateMarkdown(components) {
|
|
232
|
+
let md = `# Components Manifest
|
|
233
|
+
|
|
234
|
+
> Auto-generated component specifications with props and sample data.
|
|
235
|
+
> Total: ${components.length} components
|
|
236
|
+
|
|
237
|
+
## Overview
|
|
238
|
+
|
|
239
|
+
| Component | Type | Props | Actions | Used In |
|
|
240
|
+
|-----------|------|-------|---------|---------|
|
|
241
|
+
`;
|
|
242
|
+
components.forEach(comp => {
|
|
243
|
+
md += `| ${comp.name} | ${comp.type} | ${comp.props.length} | ${comp.actions.length} | ${comp.usedInScreens.length} screens |\n`;
|
|
244
|
+
});
|
|
245
|
+
md += `\n---\n\n## Component Specifications\n\n`;
|
|
246
|
+
const byType = this.groupByType(components);
|
|
247
|
+
for (const [type, comps] of Object.entries(byType)) {
|
|
248
|
+
md += `### ${type.charAt(0).toUpperCase() + type.slice(1)} Components\n\n`;
|
|
249
|
+
for (const comp of comps) {
|
|
250
|
+
md += `#### ${comp.name}\n\n`;
|
|
251
|
+
md += `**Description**: ${comp.description}\n\n`;
|
|
252
|
+
md += `**Used in**: ${comp.usedInScreens.join(", ") || "N/A"}\n\n`;
|
|
253
|
+
md += `**Props**:\n\`\`\`typescript\ninterface ${comp.name}Props {\n`;
|
|
254
|
+
comp.props.forEach(prop => {
|
|
255
|
+
md += ` ${prop.name}${prop.required ? "" : "?"}: ${prop.type}; // ${prop.description}\n`;
|
|
256
|
+
});
|
|
257
|
+
md += `}\n\`\`\`\n\n`;
|
|
258
|
+
if (Object.keys(comp.sampleData).length > 0) {
|
|
259
|
+
md += `**Sample Data**:\n\`\`\`json\n${JSON.stringify(comp.sampleData, null, 2)}\n\`\`\`\n\n`;
|
|
260
|
+
}
|
|
261
|
+
if (comp.actions.length > 0) {
|
|
262
|
+
md += `**Actions Required**: ${comp.actions.map(a => `\`${a}\``).join(", ")}\n\n`;
|
|
263
|
+
}
|
|
264
|
+
md += `---\n\n`;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
md += `\n---
|
|
268
|
+
*Generated by MyContext CLI*
|
|
269
|
+
*Last updated: ${new Date().toISOString()}*
|
|
270
|
+
`;
|
|
271
|
+
return md;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
exports.GenerateComponentsManifestCommand = GenerateComponentsManifestCommand;
|
|
275
|
+
function registerGenerateComponentsManifestCommand(program) {
|
|
276
|
+
program
|
|
277
|
+
.command("generate:components-manifest")
|
|
278
|
+
.alias("gcm")
|
|
279
|
+
.description("Generate component specifications with props, sample data, and actions")
|
|
280
|
+
.option("-o, --output <path>", "Output file path", ".mycontext/03-components.md")
|
|
281
|
+
.option("-v, --verbose", "Enable verbose logging")
|
|
282
|
+
.option("--include-demo", "Include demo/sample data for each component")
|
|
283
|
+
.action(async (options) => {
|
|
284
|
+
const command = new GenerateComponentsManifestCommand();
|
|
285
|
+
await command.execute(options);
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=generate-components-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-components-manifest.js","sourceRoot":"","sources":["../../src/commands/generate-components-manifest.ts"],"names":[],"mappings":";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O,CAAC,8BAA8B,CAAC;SACvC,KAAK,CAAC,KAAK,CAAC;SACZ,WAAW,CAAC,wEAAwE,CAAC;SACrF,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,6BAA6B,CAAC;SAChF,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC;SACjD,MAAM,CAAC,gBAAgB,EAAE,6CAA6C,CAAC;SACvE,MAAM,CAAC,KAAK,EAAE,OAAkC,EAAE,EAAE;QACnD,MAAM,OAAO,GAAG,IAAI,iCAAiC,EAAE,CAAC;QACxD,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
export interface ScreensListOptions {
|
|
3
|
+
output?: string;
|
|
4
|
+
verbose?: boolean;
|
|
5
|
+
format?: "markdown" | "json";
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Generate Screens List Command
|
|
9
|
+
* Extracts screens from user flows and creates structured list with routes, components, and demo data needs
|
|
10
|
+
*/
|
|
11
|
+
export declare class GenerateScreensListCommand {
|
|
12
|
+
private spinner;
|
|
13
|
+
private aiClient;
|
|
14
|
+
private contextDir;
|
|
15
|
+
constructor();
|
|
16
|
+
execute(options?: ScreensListOptions): Promise<void>;
|
|
17
|
+
private loadContext;
|
|
18
|
+
private buildScreensPrompt;
|
|
19
|
+
private parseScreensResponse;
|
|
20
|
+
private generateMarkdown;
|
|
21
|
+
}
|
|
22
|
+
export declare function registerGenerateScreensListCommand(program: Command): void;
|
|
23
|
+
//# sourceMappingURL=generate-screens-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-screens-list.d.ts","sourceRoot":"","sources":["../../src/commands/generate-screens-list.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAC9B;AAYD;;;GAGG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,UAAU,CAAS;;IAQrB,OAAO,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;YAiEhD,WAAW;IAyDzB,OAAO,CAAC,kBAAkB;IA6D1B,OAAO,CAAC,oBAAoB;IAyB5B,OAAO,CAAC,gBAAgB;CAmDzB;AAGD,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAYzE"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.GenerateScreensListCommand = void 0;
|
|
40
|
+
exports.registerGenerateScreensListCommand = registerGenerateScreensListCommand;
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const fs = __importStar(require("fs-extra"));
|
|
43
|
+
const path_1 = __importDefault(require("path"));
|
|
44
|
+
const fileNames_1 = require("../constants/fileNames");
|
|
45
|
+
const spinner_1 = require("../utils/spinner");
|
|
46
|
+
const logger_1 = require("../utils/logger");
|
|
47
|
+
const hybridAIClient_1 = require("../utils/hybridAIClient");
|
|
48
|
+
/**
|
|
49
|
+
* Generate Screens List Command
|
|
50
|
+
* Extracts screens from user flows and creates structured list with routes, components, and demo data needs
|
|
51
|
+
*/
|
|
52
|
+
class GenerateScreensListCommand {
|
|
53
|
+
constructor() {
|
|
54
|
+
this.spinner = new spinner_1.EnhancedSpinner("Loading context files...");
|
|
55
|
+
this.aiClient = new hybridAIClient_1.HybridAIClient();
|
|
56
|
+
this.contextDir = ".mycontext";
|
|
57
|
+
}
|
|
58
|
+
async execute(options = {}) {
|
|
59
|
+
this.spinner.start();
|
|
60
|
+
try {
|
|
61
|
+
// Load existing context files
|
|
62
|
+
const context = await this.loadContext();
|
|
63
|
+
if (!context.userFlows && !context.features && !context.prd) {
|
|
64
|
+
this.spinner.fail("No context files found");
|
|
65
|
+
console.log(chalk_1.default.yellow("\n💡 Generate context first:"));
|
|
66
|
+
console.log(chalk_1.default.cyan(" mycontext generate context --full\n"));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
this.spinner.updateText("Analyzing user flows for screens...");
|
|
70
|
+
// Build the AI prompt
|
|
71
|
+
const prompt = this.buildScreensPrompt(context);
|
|
72
|
+
this.spinner.updateText("Generating screens list with AI...");
|
|
73
|
+
// Generate with AI
|
|
74
|
+
const response = await this.aiClient.generateText(prompt, {
|
|
75
|
+
maxTokens: 8192,
|
|
76
|
+
temperature: 0.3, // Lower temperature for structured output
|
|
77
|
+
});
|
|
78
|
+
if (!response) {
|
|
79
|
+
throw new Error("AI generation failed");
|
|
80
|
+
}
|
|
81
|
+
// Parse the response
|
|
82
|
+
const screens = this.parseScreensResponse(response.text);
|
|
83
|
+
// Generate markdown output
|
|
84
|
+
const markdown = this.generateMarkdown(screens, context);
|
|
85
|
+
// Write to file
|
|
86
|
+
const outputPath = options.output || path_1.default.join(this.contextDir, "02-screens-list.md");
|
|
87
|
+
await fs.ensureDir(path_1.default.dirname(outputPath));
|
|
88
|
+
await fs.writeFile(outputPath, markdown, "utf-8");
|
|
89
|
+
this.spinner.succeed("Screens list generated!");
|
|
90
|
+
console.log(chalk_1.default.green(`\n✅ Generated ${screens.length} screens`));
|
|
91
|
+
console.log(chalk_1.default.gray(` Saved to: ${outputPath}\n`));
|
|
92
|
+
// Print summary
|
|
93
|
+
console.log(chalk_1.default.bold("📱 Screens Overview:"));
|
|
94
|
+
screens.forEach((screen, idx) => {
|
|
95
|
+
console.log(chalk_1.default.cyan(` ${idx + 1}. ${screen.name}`));
|
|
96
|
+
console.log(chalk_1.default.gray(` Route: ${screen.route}`));
|
|
97
|
+
console.log(chalk_1.default.gray(` Components: ${screen.components.slice(0, 3).join(", ")}${screen.components.length > 3 ? "..." : ""}`));
|
|
98
|
+
});
|
|
99
|
+
console.log(chalk_1.default.yellow("\n💡 Next Steps:"));
|
|
100
|
+
console.log(chalk_1.default.gray(" 1. mycontext generate components-manifest"));
|
|
101
|
+
console.log(chalk_1.default.gray(" 2. mycontext generate actions"));
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
this.spinner.fail(`Failed to generate screens list: ${error.message}`);
|
|
105
|
+
logger_1.logger.error("Screens list generation error:", error);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async loadContext() {
|
|
109
|
+
const context = {};
|
|
110
|
+
const contextDir = this.contextDir;
|
|
111
|
+
// Load PRD
|
|
112
|
+
const prdPath = path_1.default.join(contextDir, fileNames_1.CONTEXT_FILES.PRD);
|
|
113
|
+
if (await fs.pathExists(prdPath)) {
|
|
114
|
+
context.prd = await fs.readFile(prdPath, "utf-8");
|
|
115
|
+
}
|
|
116
|
+
// Load features (01a)
|
|
117
|
+
const featuresPath = path_1.default.join(contextDir, "01a-features.md");
|
|
118
|
+
if (await fs.pathExists(featuresPath)) {
|
|
119
|
+
context.features = await fs.readFile(featuresPath, "utf-8");
|
|
120
|
+
}
|
|
121
|
+
// Load user flows (01b)
|
|
122
|
+
const flowsPath = path_1.default.join(contextDir, "01b-user-flows.md");
|
|
123
|
+
if (await fs.pathExists(flowsPath)) {
|
|
124
|
+
context.userFlows = await fs.readFile(flowsPath, "utf-8");
|
|
125
|
+
}
|
|
126
|
+
// Load edge cases (01c)
|
|
127
|
+
const edgeCasesPath = path_1.default.join(contextDir, "01c-edge-cases.md");
|
|
128
|
+
if (await fs.pathExists(edgeCasesPath)) {
|
|
129
|
+
context.edgeCases = await fs.readFile(edgeCasesPath, "utf-8");
|
|
130
|
+
}
|
|
131
|
+
// Load technical specs (01d)
|
|
132
|
+
const techSpecsPath = path_1.default.join(contextDir, "01d-technical-specs.md");
|
|
133
|
+
if (await fs.pathExists(techSpecsPath)) {
|
|
134
|
+
context.technicalSpecs = await fs.readFile(techSpecsPath, "utf-8");
|
|
135
|
+
}
|
|
136
|
+
// Load types (02-types.ts)
|
|
137
|
+
const typesPath = path_1.default.join(contextDir, "02-types.ts");
|
|
138
|
+
if (await fs.pathExists(typesPath)) {
|
|
139
|
+
context.types = await fs.readFile(typesPath, "utf-8");
|
|
140
|
+
}
|
|
141
|
+
// Load screenshot-derived context
|
|
142
|
+
const screenshotContextPath = path_1.default.join(contextDir, "context.md");
|
|
143
|
+
if (await fs.pathExists(screenshotContextPath)) {
|
|
144
|
+
context.screenshotContext = await fs.readFile(screenshotContextPath, "utf-8");
|
|
145
|
+
}
|
|
146
|
+
return context;
|
|
147
|
+
}
|
|
148
|
+
buildScreensPrompt(context) {
|
|
149
|
+
let prompt = `You are a UI/UX architect. Analyze the following project context and extract ALL screens needed for this application.
|
|
150
|
+
|
|
151
|
+
For each screen, provide:
|
|
152
|
+
1. Name (PascalCase, e.g., "DashboardScreen", "TaskDetailScreen")
|
|
153
|
+
2. Route (URL path, e.g., "/dashboard", "/tasks/:id")
|
|
154
|
+
3. Brief description (1-2 sentences)
|
|
155
|
+
4. Components needed (list of component names)
|
|
156
|
+
5. User flow steps that involve this screen
|
|
157
|
+
6. Sample data needs (what data this screen displays/edits)
|
|
158
|
+
|
|
159
|
+
OUTPUT FORMAT (JSON array):
|
|
160
|
+
\`\`\`json
|
|
161
|
+
[
|
|
162
|
+
{
|
|
163
|
+
"name": "DashboardScreen",
|
|
164
|
+
"route": "/dashboard",
|
|
165
|
+
"description": "Main dashboard showing overview and quick actions",
|
|
166
|
+
"components": ["Header", "MetricCards", "TaskList", "QuickActions"],
|
|
167
|
+
"userFlowSteps": ["User lands here after login", "Can navigate to all main sections"],
|
|
168
|
+
"sampleDataNeeds": ["User stats", "Recent tasks", "Notifications count"]
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
\`\`\`
|
|
172
|
+
|
|
173
|
+
PROJECT CONTEXT:
|
|
174
|
+
`;
|
|
175
|
+
if (context.prd) {
|
|
176
|
+
prompt += `\n## PRD:\n${context.prd.substring(0, 2000)}\n`;
|
|
177
|
+
}
|
|
178
|
+
if (context.features) {
|
|
179
|
+
prompt += `\n## Features:\n${context.features.substring(0, 3000)}\n`;
|
|
180
|
+
}
|
|
181
|
+
if (context.userFlows) {
|
|
182
|
+
prompt += `\n## User Flows:\n${context.userFlows.substring(0, 3000)}\n`;
|
|
183
|
+
}
|
|
184
|
+
if (context.technicalSpecs) {
|
|
185
|
+
prompt += `\n## Technical Specs (API endpoints):\n${context.technicalSpecs.substring(0, 2000)}\n`;
|
|
186
|
+
}
|
|
187
|
+
if (context.screenshotContext) {
|
|
188
|
+
prompt += `\n## Design Reference (from screenshot):\n${context.screenshotContext.substring(0, 1500)}\n`;
|
|
189
|
+
}
|
|
190
|
+
prompt += `
|
|
191
|
+
Be comprehensive - include ALL screens including:
|
|
192
|
+
- Authentication screens (login, register, forgot password)
|
|
193
|
+
- Main navigation screens (dashboard, home)
|
|
194
|
+
- CRUD screens for each entity (list, detail, create, edit)
|
|
195
|
+
- Settings and profile screens
|
|
196
|
+
- Error and empty state screens
|
|
197
|
+
|
|
198
|
+
Output ONLY the JSON array, no explanation.`;
|
|
199
|
+
return prompt;
|
|
200
|
+
}
|
|
201
|
+
parseScreensResponse(response) {
|
|
202
|
+
try {
|
|
203
|
+
// Extract JSON from response
|
|
204
|
+
const jsonMatch = response.match(/\[[\s\S]*\]/);
|
|
205
|
+
if (!jsonMatch) {
|
|
206
|
+
logger_1.logger.warn("Could not find JSON in response, attempting to parse entire response");
|
|
207
|
+
return [];
|
|
208
|
+
}
|
|
209
|
+
const screens = JSON.parse(jsonMatch[0]);
|
|
210
|
+
return screens.map((s) => ({
|
|
211
|
+
name: s.name || "UnnamedScreen",
|
|
212
|
+
route: s.route || "/",
|
|
213
|
+
description: s.description || "",
|
|
214
|
+
components: s.components || [],
|
|
215
|
+
userFlowSteps: s.userFlowSteps || [],
|
|
216
|
+
sampleDataNeeds: s.sampleDataNeeds || [],
|
|
217
|
+
designNotes: s.designNotes,
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
logger_1.logger.error("Failed to parse screens response:", error);
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
generateMarkdown(screens, context) {
|
|
226
|
+
let md = `# Screens List
|
|
227
|
+
|
|
228
|
+
> Auto-generated from project context. ${screens.length} screens identified.
|
|
229
|
+
|
|
230
|
+
## Overview
|
|
231
|
+
|
|
232
|
+
| # | Screen | Route | Components |
|
|
233
|
+
|---|--------|-------|------------|
|
|
234
|
+
`;
|
|
235
|
+
screens.forEach((screen, idx) => {
|
|
236
|
+
md += `| ${idx + 1} | ${screen.name} | \`${screen.route}\` | ${screen.components.length} |\n`;
|
|
237
|
+
});
|
|
238
|
+
md += `\n---\n\n## Screen Details\n\n`;
|
|
239
|
+
screens.forEach((screen, idx) => {
|
|
240
|
+
md += `### ${idx + 1}. ${screen.name}\n\n`;
|
|
241
|
+
md += `**Route**: \`${screen.route}\`\n\n`;
|
|
242
|
+
md += `**Description**: ${screen.description}\n\n`;
|
|
243
|
+
md += `**Components**:\n`;
|
|
244
|
+
screen.components.forEach(comp => {
|
|
245
|
+
md += `- ${comp}\n`;
|
|
246
|
+
});
|
|
247
|
+
md += `\n**User Flow Steps**:\n`;
|
|
248
|
+
screen.userFlowSteps.forEach(step => {
|
|
249
|
+
md += `- ${step}\n`;
|
|
250
|
+
});
|
|
251
|
+
md += `\n**Sample Data Needs**:\n`;
|
|
252
|
+
screen.sampleDataNeeds.forEach(data => {
|
|
253
|
+
md += `- ${data}\n`;
|
|
254
|
+
});
|
|
255
|
+
if (screen.designNotes) {
|
|
256
|
+
md += `\n**Design Notes**: ${screen.designNotes}\n`;
|
|
257
|
+
}
|
|
258
|
+
md += `\n---\n\n`;
|
|
259
|
+
});
|
|
260
|
+
md += `\n---
|
|
261
|
+
*Generated by MyContext CLI*
|
|
262
|
+
*Last updated: ${new Date().toISOString()}*
|
|
263
|
+
`;
|
|
264
|
+
return md;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.GenerateScreensListCommand = GenerateScreensListCommand;
|
|
268
|
+
// Register the command
|
|
269
|
+
function registerGenerateScreensListCommand(program) {
|
|
270
|
+
program
|
|
271
|
+
.command("generate:screens-list")
|
|
272
|
+
.alias("gsl")
|
|
273
|
+
.description("Generate a structured list of screens from user flows and context")
|
|
274
|
+
.option("-o, --output <path>", "Output file path", ".mycontext/02-screens-list.md")
|
|
275
|
+
.option("-v, --verbose", "Enable verbose logging")
|
|
276
|
+
.option("-f, --format <format>", "Output format (markdown|json)", "markdown")
|
|
277
|
+
.action(async (options) => {
|
|
278
|
+
const command = new GenerateScreensListCommand();
|
|
279
|
+
await command.execute(options);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=generate-screens-list.js.map
|