@phi-code-admin/phi-code 0.61.7 → 0.61.8
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/extensions/phi/orchestrator.ts +28 -22
- package/package.json +1 -1
|
@@ -438,7 +438,7 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
|
|
|
438
438
|
// ─── /plan Command — Full workflow ───────────────────────────────
|
|
439
439
|
|
|
440
440
|
pi.registerCommand("plan", {
|
|
441
|
-
description: "Plan AND execute a project — describe what to build
|
|
441
|
+
description: "Plan AND execute a project with agents — describe what to build",
|
|
442
442
|
handler: async (args, ctx) => {
|
|
443
443
|
const description = args.trim();
|
|
444
444
|
|
|
@@ -459,28 +459,34 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
|
|
|
459
459
|
await ensurePlansDir();
|
|
460
460
|
const ts = timestamp();
|
|
461
461
|
const specFile = `spec-${ts}.md`;
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
462
|
+
await writeFile(join(plansDir, specFile), `# ${description}\n\n**Created:** ${new Date().toLocaleString()}\n`, "utf-8");
|
|
463
|
+
|
|
464
|
+
ctx.ui.notify(`📋 Plan created. Executing with agents...`, "info");
|
|
465
|
+
|
|
466
|
+
// Load agent definitions for system prompts
|
|
467
|
+
const agentDefs = loadAgentDefs();
|
|
468
|
+
const phases = [
|
|
469
|
+
{ agent: "explore", label: "🔍 Exploring", instruction: `Analyze the project requirements and existing codebase. Identify what exists, what's needed, and any constraints.\n\nProject: ${description}` },
|
|
470
|
+
{ agent: "plan", label: "📐 Planning", instruction: `Design the architecture, file structure, and implementation approach.\n\nProject: ${description}` },
|
|
471
|
+
{ agent: "code", label: "💻 Coding", instruction: `Implement the complete project. Create ALL necessary files with production-quality code.\n\nProject: ${description}\n\nCreate every file needed. Do NOT leave placeholders or TODOs. Complete implementation.` },
|
|
472
|
+
{ agent: "test", label: "🧪 Testing", instruction: `Test the implementation. Run the code, check for errors, verify it works.\n\nProject: ${description}` },
|
|
473
|
+
{ agent: "review", label: "🔍 Reviewing", instruction: `Review code quality, security, and performance. Fix any issues found.\n\nProject: ${description}` },
|
|
474
|
+
];
|
|
475
|
+
|
|
476
|
+
// Execute each phase sequentially using sendUserMessage + waitForIdle
|
|
477
|
+
for (const phase of phases) {
|
|
478
|
+
const agentDef = agentDefs.get(phase.agent);
|
|
479
|
+
const systemPromptNote = agentDef?.systemPrompt
|
|
480
|
+
? `\n\n[Agent: ${phase.agent}] ${agentDef.systemPrompt.slice(0, 200)}`
|
|
481
|
+
: "";
|
|
482
|
+
|
|
483
|
+
ctx.ui.notify(`\n${phase.label} (agent: ${phase.agent})...`, "info");
|
|
484
|
+
|
|
485
|
+
pi.sendUserMessage(phase.instruction + systemPromptNote);
|
|
486
|
+
await ctx.waitForIdle();
|
|
487
|
+
}
|
|
482
488
|
|
|
483
|
-
ctx.ui.
|
|
489
|
+
ctx.ui.notify(`\n✅ **Project complete!** Plan: \`${specFile}\``, "info");
|
|
484
490
|
},
|
|
485
491
|
});
|
|
486
492
|
|