@phi-code-admin/phi-code 0.60.7 → 0.60.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.
package/extensions/phi/init.ts
CHANGED
|
@@ -590,7 +590,7 @@ _Edit this file to customize Phi Code's behavior for your project._
|
|
|
590
590
|
|
|
591
591
|
// Trigger benchmark via sendUserMessage — this runs /benchmark all
|
|
592
592
|
// which saves results to the same results.json path
|
|
593
|
-
|
|
593
|
+
pi.sendUserMessage("/benchmark all");
|
|
594
594
|
ctx.ui.notify("⏳ Benchmarks started. Once complete, run `/phi-init` again and select benchmark mode to use the results.\n", "info");
|
|
595
595
|
ctx.ui.notify("💡 The benchmark runs in the background. You'll see live results in the terminal.\n", "info");
|
|
596
596
|
|
|
@@ -129,12 +129,38 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
function findPhiBinary(): string {
|
|
132
|
+
// Try the bundled CLI relative to extensions dir
|
|
132
133
|
const bundledCli = join(__dirname, "..", "..", "..", "dist", "cli.js");
|
|
133
134
|
if (existsSync(bundledCli)) return bundledCli;
|
|
135
|
+
|
|
136
|
+
// Try npm global install paths
|
|
137
|
+
const npmGlobalPaths = [
|
|
138
|
+
join(homedir(), "AppData", "Roaming", "npm", "node_modules", "@phi-code-admin", "phi-code", "dist", "cli.js"), // Windows
|
|
139
|
+
join(homedir(), ".npm-global", "lib", "node_modules", "@phi-code-admin", "phi-code", "dist", "cli.js"), // Linux custom
|
|
140
|
+
"/usr/local/lib/node_modules/@phi-code-admin/phi-code/dist/cli.js", // Linux/Mac default
|
|
141
|
+
"/usr/lib/node_modules/@phi-code-admin/phi-code/dist/cli.js", // Some Linux
|
|
142
|
+
];
|
|
143
|
+
for (const p of npmGlobalPaths) {
|
|
144
|
+
if (existsSync(p)) return p;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Try `which phi` (Linux/Mac) or `where phi` (Windows)
|
|
134
148
|
try {
|
|
135
|
-
const
|
|
136
|
-
|
|
149
|
+
const isWin = process.platform === "win32";
|
|
150
|
+
const cmd = isWin ? "where" : "which";
|
|
151
|
+
const result = require("child_process").execSync(`${cmd} phi 2>${isWin ? "NUL" : "/dev/null"}`, { encoding: "utf-8" }).trim();
|
|
152
|
+
if (result) {
|
|
153
|
+
const firstLine = result.split("\n")[0].trim();
|
|
154
|
+
// On Windows, `where phi` returns the .cmd shim; we need the actual JS
|
|
155
|
+
if (isWin && firstLine.endsWith(".cmd")) {
|
|
156
|
+
const npmPrefix = require("child_process").execSync("npm prefix -g", { encoding: "utf-8" }).trim();
|
|
157
|
+
const jsPath = join(npmPrefix, "node_modules", "@phi-code-admin", "phi-code", "dist", "cli.js");
|
|
158
|
+
if (existsSync(jsPath)) return jsPath;
|
|
159
|
+
}
|
|
160
|
+
return firstLine;
|
|
161
|
+
}
|
|
137
162
|
} catch { /* not in PATH */ }
|
|
163
|
+
|
|
138
164
|
return "npx";
|
|
139
165
|
}
|
|
140
166
|
|
|
@@ -292,7 +318,9 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
|
|
|
292
318
|
const totalTasks = tasks.length;
|
|
293
319
|
let wave = 1;
|
|
294
320
|
|
|
321
|
+
const phiBinPath = findPhiBinary();
|
|
295
322
|
notify(`🚀 Executing ${totalTasks} tasks with sub-agents (parallel mode)...`, "info");
|
|
323
|
+
notify(`📍 Phi binary: \`${phiBinPath}\``, "info");
|
|
296
324
|
|
|
297
325
|
// Execute in waves — each wave runs independent tasks in parallel
|
|
298
326
|
while (completed.size + failed.size < totalTasks) {
|
|
@@ -591,7 +619,7 @@ All files in \`.phi/plans/\``;
|
|
|
591
619
|
return;
|
|
592
620
|
}
|
|
593
621
|
|
|
594
|
-
|
|
622
|
+
pi.sendUserMessage(
|
|
595
623
|
`Analyze this project and call the orchestrate tool. It will create the plan AND execute all tasks automatically with parallel sub-agents.
|
|
596
624
|
|
|
597
625
|
## Project
|