@phi-code-admin/phi-code 0.61.6 → 0.61.7
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 +23 -41
- package/package.json +1 -1
|
@@ -438,67 +438,49 @@ 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
|
|
441
|
+
description: "Plan AND execute a project — describe what to build and the LLM does it all",
|
|
442
442
|
handler: async (args, ctx) => {
|
|
443
443
|
const description = args.trim();
|
|
444
444
|
|
|
445
445
|
if (!description) {
|
|
446
446
|
ctx.ui.notify(`**Usage:** \`/plan <project description>\`
|
|
447
447
|
|
|
448
|
-
**Full workflow in one command:**
|
|
449
|
-
1. LLM analyzes your description
|
|
450
|
-
2. Creates spec.md + todo.md
|
|
451
|
-
3. Executes each task with an isolated sub-agent
|
|
452
|
-
4. Each agent has its own context, model, and system prompt
|
|
453
|
-
5. Results saved to progress.md
|
|
454
|
-
|
|
455
448
|
**Examples:**
|
|
456
449
|
/plan Build a REST API for user authentication with JWT
|
|
450
|
+
/plan Create a cyberpunk Pong browser game
|
|
457
451
|
/plan Add test coverage to the payment module
|
|
458
|
-
/plan Refactor the frontend to use TypeScript
|
|
459
452
|
|
|
460
453
|
**Other commands:**
|
|
461
|
-
/
|
|
462
|
-
/plans — List all plans and status`, "info");
|
|
454
|
+
/plans — List all plans`, "info");
|
|
463
455
|
return;
|
|
464
456
|
}
|
|
465
457
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
## Instructions
|
|
458
|
+
// Create plan files
|
|
459
|
+
await ensurePlansDir();
|
|
460
|
+
const ts = timestamp();
|
|
461
|
+
const specFile = `spec-${ts}.md`;
|
|
462
|
+
const todoFile = `todo-${ts}.md`;
|
|
473
463
|
|
|
474
|
-
|
|
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");
|
|
475
467
|
|
|
476
|
-
|
|
477
|
-
- NO access to this conversation
|
|
478
|
-
- NO shared memory or context
|
|
479
|
-
- Its own model and system prompt
|
|
480
|
-
- Full tool access (read, write, edit, bash, grep, find, ls)
|
|
468
|
+
ctx.ui.notify(`📋 Plan created: \`${specFile}\`\n🚀 Executing project now...`, "info");
|
|
481
469
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
- FORMAT: Expected output (files created, test results, etc.)
|
|
486
|
-
- CONSTRAINTS: Rules, conventions, things to avoid
|
|
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.
|
|
487
473
|
|
|
488
|
-
|
|
474
|
+
## Project
|
|
475
|
+
${description}
|
|
489
476
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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`;
|
|
495
482
|
|
|
496
|
-
|
|
497
|
-
- title, description, goals, requirements, constraints (project metadata)
|
|
498
|
-
- tasks (array of ALL task objects with title, description, agent, dependencies)
|
|
499
|
-
|
|
500
|
-
⚠️ CRITICAL: Include the \`tasks\` array in the SAME tool call as the project metadata. Do NOT make separate calls. All data must be in ONE orchestrate() invocation.`
|
|
501
|
-
);
|
|
483
|
+
ctx.ui.pasteToEditor(prompt);
|
|
502
484
|
},
|
|
503
485
|
});
|
|
504
486
|
|