@phi-code-admin/phi-code 0.61.7 → 0.61.9

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.
@@ -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 and the LLM does it all",
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
- const todoFile = `todo-${ts}.md`;
463
-
464
- const spec = `# Project Plan\n\n**Created:** ${new Date().toLocaleString()}\n\n## Description\n\n${description}\n`;
465
- await writeFile(join(plansDir, specFile), spec, "utf-8");
466
- await writeFile(join(plansDir, todoFile), `# Todo\n\n(LLM will execute directly)\n`, "utf-8");
467
-
468
- ctx.ui.notify(`📋 Plan created: \`${specFile}\`\n🚀 Executing project now...`, "info");
469
-
470
- // Paste the structured prompt into the editor so the user just presses Enter
471
- // This avoids sendUserMessage which fails with "Agent is already processing"
472
- const prompt = `Build this project completely. Create all necessary files, implement all features, test everything.
473
-
474
- ## Project
475
- ${description}
476
-
477
- ## Rules
478
- - Create ALL files needed for a complete, working project
479
- - Use best practices and clean code
480
- - Test that everything works (run the code if possible)
481
- - Report what you created when done`;
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, { deliverAs: "followUp" });
486
+ await ctx.waitForIdle();
487
+ }
482
488
 
483
- ctx.ui.pasteToEditor(prompt);
489
+ ctx.ui.notify(`\n✅ **Project complete!** Plan: \`${specFile}\``, "info");
484
490
  },
485
491
  });
486
492
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phi-code-admin/phi-code",
3
- "version": "0.61.7",
3
+ "version": "0.61.9",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {