@phren/cli 0.0.25 → 0.0.26
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/link-doctor.js +29 -6
- package/package.json +1 -1
package/mcp/dist/link-doctor.js
CHANGED
|
@@ -17,6 +17,7 @@ import { repairPreexistingInstall } from "./init-setup.js";
|
|
|
17
17
|
import { getMachineName, lookupProfile, findProfileFile, getProfileProjects, findProjectDir, } from "./link.js";
|
|
18
18
|
import { claudeProjectKey } from "./link-context.js";
|
|
19
19
|
import { getProjectOwnershipMode, readProjectConfig } from "./project-config.js";
|
|
20
|
+
import { readInstallPreferences } from "./init-preferences.js";
|
|
20
21
|
// ── Doctor ──────────────────────────────────────────────────────────────────
|
|
21
22
|
function isWrapperActive(tool) {
|
|
22
23
|
const wrapperPath = homePath(".local", "bin", tool);
|
|
@@ -35,7 +36,7 @@ function isWrapperActive(tool) {
|
|
|
35
36
|
return false;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
function gitRemoteStatus(phrenPath) {
|
|
39
|
+
function gitRemoteStatus(phrenPath, syncIntent) {
|
|
39
40
|
try {
|
|
40
41
|
execFileSync("git", ["-C", phrenPath, "rev-parse", "--is-inside-work-tree"], {
|
|
41
42
|
stdio: ["ignore", "ignore", "ignore"],
|
|
@@ -45,19 +46,40 @@ function gitRemoteStatus(phrenPath) {
|
|
|
45
46
|
catch {
|
|
46
47
|
return { ok: false, detail: "phren path is not a git repository" };
|
|
47
48
|
}
|
|
49
|
+
let remote;
|
|
48
50
|
try {
|
|
49
|
-
|
|
51
|
+
remote = execFileSync("git", ["-C", phrenPath, "remote", "get-url", "origin"], {
|
|
50
52
|
encoding: "utf8",
|
|
51
53
|
stdio: ["ignore", "pipe", "ignore"],
|
|
52
54
|
timeout: EXEC_TIMEOUT_QUICK_MS,
|
|
53
55
|
}).trim();
|
|
54
|
-
return remote
|
|
55
|
-
? { ok: true, detail: `origin=${remote}` }
|
|
56
|
-
: { ok: true, detail: "no remote configured (local-only sync mode)" };
|
|
57
56
|
}
|
|
58
57
|
catch {
|
|
58
|
+
// no remote configured
|
|
59
|
+
}
|
|
60
|
+
if (!remote) {
|
|
61
|
+
if (syncIntent === "sync") {
|
|
62
|
+
return {
|
|
63
|
+
ok: false,
|
|
64
|
+
detail: "sync configured but no git remote found. Run: cd ~/.phren && git remote add origin <YOUR_REPO_URL> && git push -u origin main",
|
|
65
|
+
};
|
|
66
|
+
}
|
|
59
67
|
return { ok: true, detail: "no remote configured (local-only sync mode)" };
|
|
60
68
|
}
|
|
69
|
+
// Remote exists — verify it's reachable
|
|
70
|
+
try {
|
|
71
|
+
execFileSync("git", ["-C", phrenPath, "ls-remote", "--exit-code", "origin"], {
|
|
72
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
73
|
+
timeout: 10_000,
|
|
74
|
+
});
|
|
75
|
+
return { ok: true, detail: `origin=${remote}` };
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
if (syncIntent === "sync") {
|
|
79
|
+
return { ok: false, detail: `origin=${remote} (unreachable) — check your network or SSH keys` };
|
|
80
|
+
}
|
|
81
|
+
return { ok: true, detail: `origin=${remote} (unreachable, local-only mode)` };
|
|
82
|
+
}
|
|
61
83
|
}
|
|
62
84
|
function pushSkillMirrorChecks(checks, scope, manifest, destDir) {
|
|
63
85
|
const parentDir = path.dirname(destDir);
|
|
@@ -117,7 +139,8 @@ export async function runDoctor(phrenPath, fix = false, checkData = false) {
|
|
|
117
139
|
ok: versionAtLeast(nodeVersion, 20),
|
|
118
140
|
detail: nodeVersion || "node not found in PATH",
|
|
119
141
|
});
|
|
120
|
-
const
|
|
142
|
+
const prefs = readInstallPreferences(phrenPath);
|
|
143
|
+
const gitRemote = gitRemoteStatus(phrenPath, prefs.syncIntent);
|
|
121
144
|
checks.push({
|
|
122
145
|
name: "git-remote",
|
|
123
146
|
ok: gitRemote.ok,
|