@phren/cli 0.0.34 → 0.0.35
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/mcp/dist/hooks.js +5 -2
- package/mcp/dist/init/init.js +5 -6
- package/mcp/dist/init/setup.js +20 -0
- package/package.json +1 -1
package/mcp/dist/hooks.js
CHANGED
|
@@ -218,12 +218,15 @@ export function installPhrenCliWrapper(phrenPath) {
|
|
|
218
218
|
if (!existing.includes("PHREN_CLI_WRAPPER"))
|
|
219
219
|
return false;
|
|
220
220
|
}
|
|
221
|
-
catch {
|
|
221
|
+
catch {
|
|
222
|
+
// File exists but unreadable — don't overwrite, could be a real binary
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
222
225
|
}
|
|
223
226
|
const content = `#!/bin/sh
|
|
224
227
|
# PHREN_CLI_WRAPPER — managed by phren init; safe to delete
|
|
225
228
|
set -u
|
|
226
|
-
PHREN_PATH="\${PHREN_PATH:-${
|
|
229
|
+
PHREN_PATH="\${PHREN_PATH:-${phrenPath}}"
|
|
227
230
|
export PHREN_PATH
|
|
228
231
|
exec node ${shellEscape(entry)} "$@"
|
|
229
232
|
`;
|
package/mcp/dist/init/init.js
CHANGED
|
@@ -970,13 +970,12 @@ function configureHooksIfEnabled(phrenPath, hooksEnabled, verb) {
|
|
|
970
970
|
log(` Hooks are disabled by preference (run: npx phren hooks-mode on)`);
|
|
971
971
|
}
|
|
972
972
|
// Install phren CLI wrapper at ~/.local/bin/phren so the bare command works
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
}
|
|
973
|
+
const wrapperInstalled = installPhrenCliWrapper(phrenPath);
|
|
974
|
+
if (wrapperInstalled) {
|
|
975
|
+
log(` ${verb} CLI wrapper: ~/.local/bin/phren`);
|
|
977
976
|
}
|
|
978
|
-
|
|
979
|
-
|
|
977
|
+
else {
|
|
978
|
+
log(` Note: phren CLI wrapper not installed (existing non-managed binary, or no entry script found)`);
|
|
980
979
|
}
|
|
981
980
|
}
|
|
982
981
|
export async function runInit(opts = {}) {
|
package/mcp/dist/init/setup.js
CHANGED
|
@@ -6,6 +6,7 @@ import * as path from "path";
|
|
|
6
6
|
import * as os from "os";
|
|
7
7
|
import * as yaml from "js-yaml";
|
|
8
8
|
import { atomicWriteText, debugLog, findProjectNameCaseInsensitive, hookConfigPath, EXEC_TIMEOUT_QUICK_MS, readRootManifest, sessionsDir, runtimeHealthFile, isRecord, } from "../shared.js";
|
|
9
|
+
import { homePath } from "../phren-paths.js";
|
|
9
10
|
import { addProjectToProfile, listProfiles, resolveActiveProfile, setMachineProfile } from "../profile-store.js";
|
|
10
11
|
import { getMachineName } from "../machine-identity.js";
|
|
11
12
|
import { execFileSync } from "child_process";
|
|
@@ -1271,6 +1272,25 @@ export function runPostInitVerify(phrenPath) {
|
|
|
1271
1272
|
fix: ftsOk ? undefined : "Create a project: `cd ~/your-project && phren add`",
|
|
1272
1273
|
});
|
|
1273
1274
|
checks.push(getHookEntrypointCheck());
|
|
1275
|
+
// Check that the CLI wrapper at ~/.local/bin/phren exists and is executable (soft check — not mandatory)
|
|
1276
|
+
const cliWrapperPath = homePath(".local", "bin", "phren");
|
|
1277
|
+
let cliWrapperOk = false;
|
|
1278
|
+
try {
|
|
1279
|
+
const stat = fs.statSync(cliWrapperPath);
|
|
1280
|
+
cliWrapperOk = stat.isFile();
|
|
1281
|
+
if (cliWrapperOk)
|
|
1282
|
+
fs.accessSync(cliWrapperPath, fs.constants.X_OK);
|
|
1283
|
+
}
|
|
1284
|
+
catch {
|
|
1285
|
+
cliWrapperOk = false;
|
|
1286
|
+
}
|
|
1287
|
+
checks.push({
|
|
1288
|
+
name: "cli-wrapper",
|
|
1289
|
+
ok: true, // always pass — wrapper is optional (global install or npx work too)
|
|
1290
|
+
detail: cliWrapperOk
|
|
1291
|
+
? `CLI wrapper exists: ${cliWrapperPath}`
|
|
1292
|
+
: `CLI wrapper not found (optional — use 'npm i -g @phren/cli' or 'npx @phren/cli' instead)`,
|
|
1293
|
+
});
|
|
1274
1294
|
const ok = checks.every((c) => c.ok);
|
|
1275
1295
|
return { ok, checks };
|
|
1276
1296
|
}
|