mycontext-cli 2.0.30 → 2.0.32
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 +91 -26
- package/dist/agents/implementations/CodeGenSubAgent.d.ts +4 -0
- package/dist/agents/implementations/CodeGenSubAgent.d.ts.map +1 -1
- package/dist/agents/implementations/CodeGenSubAgent.js +108 -22
- package/dist/agents/implementations/CodeGenSubAgent.js.map +1 -1
- package/dist/agents/implementations/DesignPipelineAgent.d.ts.map +1 -1
- package/dist/agents/implementations/DesignPipelineAgent.js +21 -16
- package/dist/agents/implementations/DesignPipelineAgent.js.map +1 -1
- package/dist/cli.js +11 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/generate-components.d.ts +5 -0
- package/dist/commands/generate-components.d.ts.map +1 -1
- package/dist/commands/generate-components.js +138 -12
- package/dist/commands/generate-components.js.map +1 -1
- package/dist/commands/generate.d.ts +4 -0
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +74 -56
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +43 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/config/intent-dictionary.json +47 -4
- package/dist/config/model-versions.json +26 -0
- package/dist/package.json +5 -1
- package/dist/types/intent-dictionary.d.ts +61 -0
- package/dist/types/intent-dictionary.d.ts.map +1 -1
- package/dist/utils/envExampleGenerator.d.ts.map +1 -1
- package/dist/utils/envExampleGenerator.js +36 -27
- package/dist/utils/envExampleGenerator.js.map +1 -1
- package/dist/utils/hostedApiClient.d.ts +10 -3
- package/dist/utils/hostedApiClient.d.ts.map +1 -1
- package/dist/utils/hostedApiClient.js +144 -209
- package/dist/utils/hostedApiClient.js.map +1 -1
- package/dist/utils/hybridAIClient.d.ts.map +1 -1
- package/dist/utils/hybridAIClient.js +8 -26
- package/dist/utils/hybridAIClient.js.map +1 -1
- package/dist/utils/openRouterClient.d.ts.map +1 -1
- package/dist/utils/openRouterClient.js +4 -14
- package/dist/utils/openRouterClient.js.map +1 -1
- package/dist/utils/unifiedDesignContextLoader.d.ts.map +1 -1
- package/dist/utils/unifiedDesignContextLoader.js +25 -12
- package/dist/utils/unifiedDesignContextLoader.js.map +1 -1
- package/package.json +5 -1
|
@@ -299,25 +299,20 @@ class GenerateCommand {
|
|
|
299
299
|
// Friendlier handling for missing providers
|
|
300
300
|
const message = error instanceof Error ? error.message : String(error);
|
|
301
301
|
if (/No AI providers available/i.test(message)) {
|
|
302
|
-
console.log(chalk_1.default.yellow("\n
|
|
303
|
-
console.log(chalk_1.default.blue("\n
|
|
304
|
-
console.log(chalk_1.default.gray(" 1.
|
|
305
|
-
console.log(chalk_1.default.gray(" 2.
|
|
306
|
-
console.log(chalk_1.default.gray(" 3.
|
|
307
|
-
console.log(chalk_1.default.blue("\n
|
|
308
|
-
console.log(chalk_1.default.gray("
|
|
309
|
-
console.log(chalk_1.default.
|
|
310
|
-
console.log(chalk_1.default.gray("
|
|
311
|
-
|
|
312
|
-
console.log(chalk_1.default.
|
|
313
|
-
console.log(chalk_1.default.
|
|
314
|
-
console.log(chalk_1.default.blue("🔄 Retry options:"));
|
|
315
|
-
console.log(chalk_1.default.gray(" 1. Wait for rate limits to reset"));
|
|
316
|
-
console.log(chalk_1.default.gray(" 2. Use a different AI provider"));
|
|
317
|
-
console.log(chalk_1.default.gray(" 3. Check your API key configuration"));
|
|
318
|
-
console.log(chalk_1.default.gray(" 4. Try again later with: mycontext generate context --full"));
|
|
302
|
+
console.log(chalk_1.default.yellow("\n🔑 No AI providers available - Quick Setup:"));
|
|
303
|
+
console.log(chalk_1.default.blue("\n📝 Get Free OpenRouter API Key (Recommended):"));
|
|
304
|
+
console.log(chalk_1.default.gray(" 1. Visit: https://openrouter.ai/keys"));
|
|
305
|
+
console.log(chalk_1.default.gray(" 2. Sign up for free account"));
|
|
306
|
+
console.log(chalk_1.default.gray(" 3. Create API key"));
|
|
307
|
+
console.log(chalk_1.default.blue("\n🔧 Add to your project:"));
|
|
308
|
+
console.log(chalk_1.default.gray(" echo 'MYCONTEXT_OPENROUTER_API_KEY=sk-or-xxx' > .mycontext/.env"));
|
|
309
|
+
console.log(chalk_1.default.blue("\n🔄 Then retry:"));
|
|
310
|
+
console.log(chalk_1.default.gray(" mycontext generate context --full"));
|
|
311
|
+
console.log(chalk_1.default.blue("\n💡 Other Options:"));
|
|
312
|
+
console.log(chalk_1.default.gray(" • Claude (best quality): ANTHROPIC_API_KEY=sk-ant-xxx"));
|
|
313
|
+
console.log(chalk_1.default.gray(" • XAI/Grok: XAI_API_KEY=xai-xxx"));
|
|
319
314
|
this.spinner.fail("Generation failed");
|
|
320
|
-
throw new Error("AI
|
|
315
|
+
throw new Error("No AI providers available - configure OpenRouter and retry");
|
|
321
316
|
}
|
|
322
317
|
this.spinner.fail("Generation failed");
|
|
323
318
|
throw error;
|
|
@@ -407,6 +402,8 @@ class GenerateCommand {
|
|
|
407
402
|
// 5) Interactive prompt to capture description (when not in --yes)
|
|
408
403
|
if (!options.yes) {
|
|
409
404
|
this.spinner.stop();
|
|
405
|
+
console.log(chalk_1.default.yellow("\n⚠️ No context files found (.mycontext/01-prd.md or .mycontext/types/)"));
|
|
406
|
+
console.log(chalk_1.default.gray("Make sure you're in the project directory with context files."));
|
|
410
407
|
console.log(chalk_1.default.blue("\n📝 Project Description"));
|
|
411
408
|
console.log(chalk_1.default.gray("Enter your project description or PRD. Press Ctrl-D when finished."));
|
|
412
409
|
const pasted = await this.readStdinBlockUntilEOF();
|
|
@@ -908,19 +905,12 @@ Use the business entities from the context above, not generic types.`;
|
|
|
908
905
|
console.log(chalk_1.default.blue("🔀 Merge flag detected, will merge with existing PRD"));
|
|
909
906
|
return { shouldSkip: false, content: existingContent };
|
|
910
907
|
}
|
|
911
|
-
//
|
|
912
|
-
console.log(chalk_1.default.
|
|
913
|
-
console.log(chalk_1.default.gray("What would you like to do?"));
|
|
914
|
-
console.log(chalk_1.default.gray(" 1. Overwrite existing PRD (--force)"));
|
|
915
|
-
console.log(chalk_1.default.gray(" 2. Merge with existing PRD (--merge)"));
|
|
916
|
-
console.log(chalk_1.default.gray(" 3. Skip generation (keep existing)"));
|
|
917
|
-
// For now, default to skip to avoid breaking existing workflows
|
|
918
|
-
// In a full implementation, you'd use inquirer or similar for interactive prompts
|
|
919
|
-
console.log(chalk_1.default.blue("ℹ️ Skipping PRD generation (use --force to overwrite or --merge to merge)"));
|
|
908
|
+
// PRD exists - just use it (unless --force or --merge is specified)
|
|
909
|
+
console.log(chalk_1.default.blue("ℹ️ Using existing PRD (use --force to overwrite or --merge to merge)"));
|
|
920
910
|
return {
|
|
921
911
|
shouldSkip: true,
|
|
922
912
|
content: existingContent,
|
|
923
|
-
reason: "PRD already exists
|
|
913
|
+
reason: "PRD already exists",
|
|
924
914
|
};
|
|
925
915
|
}
|
|
926
916
|
/**
|
|
@@ -2352,12 +2342,21 @@ Make the CSS immediately usable - no placeholders, actual working values!`;
|
|
|
2352
2342
|
case "context":
|
|
2353
2343
|
return [
|
|
2354
2344
|
{
|
|
2355
|
-
description: "
|
|
2356
|
-
command: "mycontext
|
|
2345
|
+
description: "Generate TypeScript types",
|
|
2346
|
+
command: "mycontext generate types",
|
|
2347
|
+
},
|
|
2348
|
+
{
|
|
2349
|
+
description: "Generate brand guidelines",
|
|
2350
|
+
command: "mycontext generate brand",
|
|
2351
|
+
},
|
|
2352
|
+
{
|
|
2353
|
+
description: "Generate component list",
|
|
2354
|
+
command: "mycontext generate:components --list-only",
|
|
2355
|
+
optional: true,
|
|
2357
2356
|
},
|
|
2358
2357
|
{
|
|
2359
|
-
description: "Generate
|
|
2360
|
-
command: "mycontext generate
|
|
2358
|
+
description: "Generate all components",
|
|
2359
|
+
command: "mycontext generate:components",
|
|
2361
2360
|
},
|
|
2362
2361
|
];
|
|
2363
2362
|
case "architecture":
|
|
@@ -2375,30 +2374,30 @@ Make the CSS immediately usable - no placeholders, actual working values!`;
|
|
|
2375
2374
|
case "types":
|
|
2376
2375
|
return [
|
|
2377
2376
|
{
|
|
2378
|
-
description: "Generate brand guidelines
|
|
2377
|
+
description: "Generate brand guidelines",
|
|
2379
2378
|
command: "mycontext generate brand",
|
|
2380
2379
|
},
|
|
2381
2380
|
{
|
|
2382
|
-
description: "Generate
|
|
2383
|
-
command: "mycontext generate
|
|
2381
|
+
description: "Generate all components",
|
|
2382
|
+
command: "mycontext generate-components all",
|
|
2384
2383
|
},
|
|
2385
2384
|
];
|
|
2386
2385
|
case "brand":
|
|
2387
2386
|
return [
|
|
2388
2387
|
{
|
|
2389
|
-
description: "Generate component list
|
|
2388
|
+
description: "Generate component list",
|
|
2390
2389
|
command: "mycontext generate components-list",
|
|
2391
2390
|
},
|
|
2391
|
+
{
|
|
2392
|
+
description: "Generate all components",
|
|
2393
|
+
command: "mycontext generate-components all",
|
|
2394
|
+
},
|
|
2392
2395
|
];
|
|
2393
2396
|
case "components-list":
|
|
2394
2397
|
return [
|
|
2395
2398
|
{
|
|
2396
|
-
description: "Generate
|
|
2397
|
-
command: "mycontext generate
|
|
2398
|
-
},
|
|
2399
|
-
{
|
|
2400
|
-
description: "Start generating components",
|
|
2401
|
-
command: "mycontext generate-components all --with-tests",
|
|
2399
|
+
description: "Generate all components",
|
|
2400
|
+
command: "mycontext generate-components all",
|
|
2402
2401
|
},
|
|
2403
2402
|
];
|
|
2404
2403
|
case "project-structure":
|
|
@@ -2443,8 +2442,9 @@ Make the CSS immediately usable - no placeholders, actual working values!`;
|
|
|
2443
2442
|
outputPath = path_1.default.join(outputDir, "01-prd.md");
|
|
2444
2443
|
const preserve = Boolean(options.preservePrd);
|
|
2445
2444
|
// Don't overwrite PRD if content is just a success message
|
|
2446
|
-
if (content === "Context files generated successfully"
|
|
2447
|
-
|
|
2445
|
+
if (content === "Context files generated successfully" ||
|
|
2446
|
+
content.includes("Full context generated successfully")) {
|
|
2447
|
+
// This means context generation completed but we should preserve existing PRD
|
|
2448
2448
|
// Don't overwrite the existing PRD
|
|
2449
2449
|
return outputPath;
|
|
2450
2450
|
}
|
|
@@ -3812,17 +3812,12 @@ ${isEcommerce
|
|
|
3812
3812
|
console.log(chalk_1.default.gray(" mycontext generate brand"));
|
|
3813
3813
|
break;
|
|
3814
3814
|
case "brand":
|
|
3815
|
-
console.log(chalk_1.default.blue("\n➡️ Next:
|
|
3816
|
-
console.log(chalk_1.default.gray(" mycontext generate components-list
|
|
3815
|
+
console.log(chalk_1.default.blue("\n➡️ Next: Generate component list"));
|
|
3816
|
+
console.log(chalk_1.default.gray(" mycontext generate components-list"));
|
|
3817
3817
|
break;
|
|
3818
3818
|
case "components-list":
|
|
3819
|
-
console.log(chalk_1.default.blue("\n➡️ Next: Generate
|
|
3820
|
-
console.log(chalk_1.default.gray(" mycontext generate
|
|
3821
|
-
console.log(chalk_1.default.blue("\n💡 Then: Generate components"));
|
|
3822
|
-
console.log(chalk_1.default.gray(" mycontext generate-components all --with-tests # optional tests"));
|
|
3823
|
-
console.log(chalk_1.default.blue("➡️ Preview:"));
|
|
3824
|
-
console.log(chalk_1.default.gray(" Visit /preview (dev server)"));
|
|
3825
|
-
console.log(chalk_1.default.gray(" mycontext normalize preview # optional final layout"));
|
|
3819
|
+
console.log(chalk_1.default.blue("\n➡️ Next: Generate components"));
|
|
3820
|
+
console.log(chalk_1.default.gray(" mycontext generate-components all"));
|
|
3826
3821
|
break;
|
|
3827
3822
|
case "project-structure":
|
|
3828
3823
|
console.log(chalk_1.default.blue("\n➡️ Next: Generate components"));
|
|
@@ -3867,23 +3862,26 @@ ${isEcommerce
|
|
|
3867
3862
|
github: !!process.env.MYCONTEXT_GITHUB_TOKEN,
|
|
3868
3863
|
qwen: !!process.env.MYCONTEXT_QWEN_API_KEY,
|
|
3869
3864
|
gemini: !!process.env.MYCONTEXT_GEMINI_API_KEY,
|
|
3870
|
-
xai: !!process.env.MYCONTEXT_XAI_API_KEY,
|
|
3865
|
+
xai: !!(process.env.MYCONTEXT_XAI_API_KEY || process.env.XAI_API_KEY),
|
|
3871
3866
|
claude: !!process.env.MYCONTEXT_CLAUDE_API_KEY,
|
|
3872
3867
|
openai: !!process.env.OPENAI_API_KEY,
|
|
3873
3868
|
anthropic: !!process.env.ANTHROPIC_API_KEY,
|
|
3874
3869
|
huggingface: !!process.env.HUGGINGFACE_API_KEY,
|
|
3875
|
-
openrouter: !!process.env.MYCONTEXT_OPENROUTER_API_KEY
|
|
3870
|
+
openrouter: !!(process.env.MYCONTEXT_OPENROUTER_API_KEY ||
|
|
3871
|
+
process.env.OPENROUTER_API_KEY),
|
|
3876
3872
|
};
|
|
3877
3873
|
console.log(`[GenerateCommand] API Keys detected:`, keys);
|
|
3878
3874
|
return !!(process.env.MYCONTEXT_GITHUB_TOKEN ||
|
|
3879
3875
|
process.env.MYCONTEXT_QWEN_API_KEY ||
|
|
3880
3876
|
process.env.MYCONTEXT_GEMINI_API_KEY ||
|
|
3881
3877
|
process.env.MYCONTEXT_XAI_API_KEY ||
|
|
3878
|
+
process.env.XAI_API_KEY ||
|
|
3882
3879
|
process.env.MYCONTEXT_CLAUDE_API_KEY ||
|
|
3883
3880
|
process.env.OPENAI_API_KEY ||
|
|
3884
3881
|
process.env.ANTHROPIC_API_KEY ||
|
|
3885
3882
|
process.env.HUGGINGFACE_API_KEY ||
|
|
3886
|
-
process.env.MYCONTEXT_OPENROUTER_API_KEY
|
|
3883
|
+
process.env.MYCONTEXT_OPENROUTER_API_KEY ||
|
|
3884
|
+
process.env.OPENROUTER_API_KEY);
|
|
3887
3885
|
}
|
|
3888
3886
|
getModelCandidates(options) {
|
|
3889
3887
|
const raw = options.modelCandidates ||
|
|
@@ -3952,6 +3950,8 @@ ${isEcommerce
|
|
|
3952
3950
|
return contextFilesResult;
|
|
3953
3951
|
}
|
|
3954
3952
|
console.log("[GenerateCommand] A/B/C/D files generation successful");
|
|
3953
|
+
// Update config.json status after successful context generation
|
|
3954
|
+
await this.updateConfigStatus("context-generated");
|
|
3955
3955
|
return {
|
|
3956
3956
|
success: true,
|
|
3957
3957
|
content: "Full context generated successfully (PRD + A/B/C/D files)",
|
|
@@ -3959,6 +3959,24 @@ ${isEcommerce
|
|
|
3959
3959
|
metadata: { model: "hybrid", tokens: 0, latency: 0 },
|
|
3960
3960
|
};
|
|
3961
3961
|
}
|
|
3962
|
+
/**
|
|
3963
|
+
* Update config.json status
|
|
3964
|
+
*/
|
|
3965
|
+
async updateConfigStatus(status) {
|
|
3966
|
+
try {
|
|
3967
|
+
const configPath = path_1.default.join(".mycontext", "config.json");
|
|
3968
|
+
if (await fs.pathExists(configPath)) {
|
|
3969
|
+
const config = await fs.readJson(configPath);
|
|
3970
|
+
config.status = status;
|
|
3971
|
+
config.updatedAt = new Date().toISOString();
|
|
3972
|
+
await fs.writeJson(configPath, config, { spaces: 2 });
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3975
|
+
catch (error) {
|
|
3976
|
+
// Don't fail if config update fails
|
|
3977
|
+
console.warn("⚠️ Could not update config.json status");
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3962
3980
|
/**
|
|
3963
3981
|
* Get the project root directory, handling cases where we're inside .mycontext
|
|
3964
3982
|
*/
|