@phren/cli 0.2.10 → 0.2.12

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.
Files changed (52) hide show
  1. package/README.md +3 -0
  2. package/dist/bridge/activity.d.ts +8 -0
  3. package/dist/bridge/activity.js +43 -0
  4. package/dist/bridge/agent-hooks.d.ts +15 -0
  5. package/dist/bridge/agent-hooks.js +160 -0
  6. package/dist/bridge/command.d.ts +1 -0
  7. package/dist/bridge/command.js +42 -0
  8. package/dist/bridge/herdr.d.ts +12 -0
  9. package/dist/bridge/herdr.js +147 -0
  10. package/dist/bridge/hook-main.d.ts +1 -0
  11. package/dist/bridge/hook-main.js +7 -0
  12. package/dist/bridge/install.d.ts +15 -0
  13. package/dist/bridge/install.js +264 -0
  14. package/dist/bridge/projects.d.ts +10 -0
  15. package/dist/bridge/projects.js +89 -0
  16. package/dist/bridge/protocol.d.ts +35 -0
  17. package/dist/bridge/protocol.js +34 -0
  18. package/dist/bridge/server.d.ts +16 -0
  19. package/dist/bridge/server.js +291 -0
  20. package/dist/bridge/transcripts.d.ts +30 -0
  21. package/dist/bridge/transcripts.js +177 -0
  22. package/dist/bridge/transport.d.ts +4 -0
  23. package/dist/bridge/transport.js +64 -0
  24. package/dist/bridge/uploads.d.ts +2 -0
  25. package/dist/bridge/uploads.js +45 -0
  26. package/dist/bridge-hook.mjs +22571 -0
  27. package/dist/cli/config.js +27 -0
  28. package/dist/cli/namespaces-skills.js +2 -2
  29. package/dist/cli/session-git.d.ts +6 -0
  30. package/dist/cli/session-git.js +26 -0
  31. package/dist/cli/session-start.js +3 -3
  32. package/dist/cli/session-stop.js +54 -52
  33. package/dist/cli-registry.d.ts +1 -1
  34. package/dist/cli-registry.js +11 -0
  35. package/dist/generated/memory-ui-graph.browser.js +86 -86
  36. package/dist/governance/locks.d.ts +2 -0
  37. package/dist/governance/locks.js +45 -0
  38. package/dist/index.js +38 -2
  39. package/dist/init/preferences.d.ts +2 -0
  40. package/dist/link/refresh.d.ts +1 -0
  41. package/dist/link/refresh.js +47 -0
  42. package/dist/memory-ui-graph.runtime.js +86 -86
  43. package/dist/shared/index.d.ts +3 -1
  44. package/dist/shared/index.js +3 -2
  45. package/dist/skill/state.d.ts +10 -0
  46. package/dist/skill/state.js +41 -17
  47. package/dist/sync/pull.d.ts +29 -0
  48. package/dist/sync/pull.js +225 -0
  49. package/dist/tools/finding.js +4 -2
  50. package/dist/tools/skills.js +3 -3
  51. package/dist/ui/server.js +1 -1
  52. package/package.json +3 -1
@@ -22,7 +22,9 @@ export declare function normalizeIndexedContent(content: string, type: string, p
22
22
  * Touches the sentinel file to invalidate caches.
23
23
  */
24
24
  export declare function updateFileInIndex(db: SqlJsDatabase, filePath: string, phrenPath: string): void;
25
- export declare function buildIndex(phrenPath: string, profile?: string): Promise<SqlJsDatabase>;
25
+ export declare function buildIndex(phrenPath: string, profile?: string, options?: {
26
+ force?: boolean;
27
+ }): Promise<SqlJsDatabase>;
26
28
  /**
27
29
  * @internal Exported for tests. The prune is a one-shot per process, so a test
28
30
  * that needs to set up state *after* a build (which consumes it) has no other
@@ -1681,10 +1681,11 @@ function isDbOpen(db) {
1681
1681
  return false;
1682
1682
  }
1683
1683
  }
1684
- export async function buildIndex(phrenPath, profile) {
1684
+ export async function buildIndex(phrenPath, profile, options = {}) {
1685
1685
  const debounceMs = getIndexDebounceMs();
1686
1686
  const buildKey = `${phrenPath}|${profile ?? ""}`;
1687
- if (debounceMs > 0 &&
1687
+ if (!options.force &&
1688
+ debounceMs > 0 &&
1688
1689
  _lastBuiltDb !== null &&
1689
1690
  _lastBuildKey === buildKey &&
1690
1691
  Date.now() - _lastBuildTimestamp < debounceMs &&
@@ -1,3 +1,13 @@
1
1
  export type SkillScope = string;
2
+ export declare const SKILL_PREFERENCES_PATH = ".config/skill-preferences.json";
3
+ interface SkillPreferences {
4
+ schemaVersion: 1;
5
+ enabledSkills: Record<string, boolean>;
6
+ [key: string]: unknown;
7
+ }
8
+ export declare function skillStateKey(scope: SkillScope, name: string): string;
9
+ /** Strict on writes: never replace malformed or future settings with defaults. */
10
+ export declare function readSkillPreferences(phrenPath: string): SkillPreferences;
2
11
  export declare function isSkillEnabled(phrenPath: string, scope: SkillScope, name: string): boolean;
3
12
  export declare function setSkillEnabled(phrenPath: string, scope: SkillScope, name: string, enabled: boolean): void;
13
+ export {};
@@ -1,25 +1,49 @@
1
- import { readInstallPreferences, writeInstallPreferences } from "../init/preferences.js";
2
- function skillStateKey(scope, name) {
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import { readInstallPreferences } from "../init/preferences.js";
4
+ import { atomicWriteText, debugLog } from "../phren-paths.js";
5
+ import { withFileLock } from "../governance/locks.js";
6
+ export const SKILL_PREFERENCES_PATH = ".config/skill-preferences.json";
7
+ export function skillStateKey(scope, name) {
3
8
  return `${scope}:${name.replace(/\.md$/i, "").trim().toLowerCase()}`;
4
9
  }
5
- function readDisabledSkillMap(phrenPath) {
6
- const prefs = readInstallPreferences(phrenPath);
7
- return prefs.disabledSkills && typeof prefs.disabledSkills === "object"
8
- ? { ...prefs.disabledSkills }
9
- : {};
10
+ /** Strict on writes: never replace malformed or future settings with defaults. */
11
+ export function readSkillPreferences(phrenPath) {
12
+ const file = path.join(phrenPath, SKILL_PREFERENCES_PATH);
13
+ if (!fs.existsSync(file))
14
+ return { schemaVersion: 1, enabledSkills: {} };
15
+ const value = JSON.parse(fs.readFileSync(file, "utf8"));
16
+ if (!value || typeof value !== "object" || Array.isArray(value))
17
+ throw new Error("Invalid skill preferences.");
18
+ const prefs = value;
19
+ const settings = prefs.enabledSkills;
20
+ if (prefs.schemaVersion !== 1 || !settings || typeof settings !== "object" || Array.isArray(settings)
21
+ || !Object.values(settings).every((entry) => typeof entry === "boolean")) {
22
+ throw new Error("Invalid or unsupported skill preferences. Update phren or repair .config/skill-preferences.json.");
23
+ }
24
+ return prefs;
10
25
  }
11
26
  export function isSkillEnabled(phrenPath, scope, name) {
12
- const disabled = readDisabledSkillMap(phrenPath);
13
- return disabled[skillStateKey(scope, name)] !== true;
27
+ const key = skillStateKey(scope, name);
28
+ try {
29
+ const shared = readSkillPreferences(phrenPath).enabledSkills;
30
+ if (Object.hasOwn(shared, key))
31
+ return shared[key];
32
+ }
33
+ catch (error) {
34
+ // A broken settings file must not accidentally re-enable disabled skills.
35
+ debugLog(`skill preferences: ${String(error)}`);
36
+ return false;
37
+ }
38
+ // Older machine-local choices remain effective until a synced choice exists.
39
+ return readInstallPreferences(phrenPath).disabledSkills?.[key] !== true;
14
40
  }
15
41
  export function setSkillEnabled(phrenPath, scope, name, enabled) {
16
- const disabled = readDisabledSkillMap(phrenPath);
17
- const key = skillStateKey(scope, name);
18
- if (enabled)
19
- delete disabled[key];
20
- else
21
- disabled[key] = true;
22
- writeInstallPreferences(phrenPath, {
23
- disabledSkills: Object.keys(disabled).length ? disabled : undefined,
42
+ const file = path.join(phrenPath, SKILL_PREFERENCES_PATH);
43
+ fs.mkdirSync(path.dirname(file), { recursive: true });
44
+ withFileLock(file, () => {
45
+ const prefs = readSkillPreferences(phrenPath);
46
+ const enabledSkills = { ...prefs.enabledSkills, [skillStateKey(scope, name)]: enabled };
47
+ atomicWriteText(file, `${JSON.stringify({ ...prefs, enabledSkills }, null, 2)}\n`);
24
48
  });
25
49
  }
@@ -0,0 +1,29 @@
1
+ export declare const DEFAULT_PULL_INTERVAL_SECONDS = 0;
2
+ export declare const MIN_PULL_INTERVAL_SECONDS = 30;
3
+ export declare const MAX_PULL_INTERVAL_SECONDS = 86400;
4
+ export declare function parsePullInterval(value: unknown): number | undefined;
5
+ export declare function resolvePullInterval(phrenPath: string, env?: NodeJS.ProcessEnv): number;
6
+ export declare function periodicPullEnabled(phrenPath: string): boolean;
7
+ export interface GitResult {
8
+ ok: boolean;
9
+ output: string;
10
+ error?: string;
11
+ }
12
+ export type RunGit = (cwd: string, args: string[]) => Promise<GitResult>;
13
+ export declare const runPollGit: RunGit;
14
+ export interface PullResult {
15
+ status: "unchanged" | "updated" | "deferred" | "error" | "not-due";
16
+ detail: string;
17
+ }
18
+ /** Shared timestamps + a process lock give all MCP clients one check per store/interval. */
19
+ export declare function pollStore(phrenPath: string, seconds: number, git?: RunGit, now?: number): Promise<PullResult>;
20
+ interface PollingOptions {
21
+ onChange: () => Promise<void>;
22
+ /** Share the MCP write queue so background updates cannot overlap its writes. */
23
+ runExclusive: (fn: () => Promise<void>) => Promise<unknown>;
24
+ git?: RunGit;
25
+ }
26
+ export declare function startPullPolling(phrenPath: string, options: PollingOptions): {
27
+ stop: () => Promise<void>;
28
+ };
29
+ export {};
@@ -0,0 +1,225 @@
1
+ /** Periodic, non-interactive remote checks for running MCP servers. */
2
+ import { execFile } from "child_process";
3
+ import * as fs from "fs";
4
+ import * as path from "path";
5
+ import { promisify } from "util";
6
+ import { atomicWriteText, readRootManifest, runtimeFile } from "../phren-paths.js";
7
+ import { readInstallPreferences } from "../init/preferences.js";
8
+ import { resolveManagementCapabilities } from "../init/management-preset.js";
9
+ import { tryFileLock } from "../governance/locks.js";
10
+ import { getNonPrimaryStores } from "../store-registry.js";
11
+ import { updateRuntimeHealth } from "../governance/policy.js";
12
+ import { debugLog } from "../shared.js";
13
+ import { errorMessage } from "../utils.js";
14
+ export const DEFAULT_PULL_INTERVAL_SECONDS = 0;
15
+ export const MIN_PULL_INTERVAL_SECONDS = 30;
16
+ export const MAX_PULL_INTERVAL_SECONDS = 86_400;
17
+ export function parsePullInterval(value) {
18
+ if (value === "off")
19
+ return 0;
20
+ if (typeof value !== "string" && typeof value !== "number")
21
+ return undefined;
22
+ if (!/^\d+$/.test(String(value)))
23
+ return undefined;
24
+ const seconds = Number(value);
25
+ return Number.isInteger(seconds) && (seconds === 0 || (seconds >= MIN_PULL_INTERVAL_SECONDS && seconds <= MAX_PULL_INTERVAL_SECONDS))
26
+ ? seconds : undefined;
27
+ }
28
+ export function resolvePullInterval(phrenPath, env = process.env) {
29
+ return parsePullInterval(env.PHREN_PULL_INTERVAL_SECONDS)
30
+ ?? parsePullInterval(readInstallPreferences(phrenPath).pullIntervalSeconds)
31
+ ?? DEFAULT_PULL_INTERVAL_SECONDS;
32
+ }
33
+ export function periodicPullEnabled(phrenPath) {
34
+ const manifest = readRootManifest(phrenPath);
35
+ return manifest?.installMode !== "project-local"
36
+ && (!manifest || manifest.syncMode === "managed-git")
37
+ && resolveManagementCapabilities(phrenPath).lifecycleAutomations;
38
+ }
39
+ const execAsync = promisify(execFile);
40
+ export const runPollGit = async (cwd, args) => {
41
+ try {
42
+ const { stdout } = await execAsync("git", args, {
43
+ cwd, encoding: "utf8", timeout: 10_000, maxBuffer: 1024 * 1024,
44
+ env: { ...process.env, GIT_TERMINAL_PROMPT: "0", GCM_INTERACTIVE: "never", GIT_OPTIONAL_LOCKS: "0" },
45
+ });
46
+ return { ok: true, output: stdout.trim() };
47
+ }
48
+ catch (err) {
49
+ return { ok: false, output: "", error: errorMessage(err) };
50
+ }
51
+ };
52
+ function readPollState(phrenPath) {
53
+ try {
54
+ const value = JSON.parse(fs.readFileSync(runtimeFile(phrenPath, "pull-poll.json"), "utf8"));
55
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
56
+ }
57
+ catch {
58
+ return {};
59
+ }
60
+ }
61
+ /** Includes user-owned operations: polling never continues or aborts these. */
62
+ async function worktreeBusy(cwd, git) {
63
+ const dir = await git(cwd, ["rev-parse", "--absolute-git-dir"]);
64
+ if (!dir.ok)
65
+ return true;
66
+ return ["rebase-merge", "rebase-apply", "MERGE_HEAD", "CHERRY_PICK_HEAD", "REVERT_HEAD", "sequencer", "index.lock"]
67
+ .some((name) => fs.existsSync(path.join(dir.output, name)));
68
+ }
69
+ /** Shared timestamps + a process lock give all MCP clients one check per store/interval. */
70
+ export async function pollStore(phrenPath, seconds, git = runPollGit, now = Date.now()) {
71
+ const skipped = { status: "not-due", detail: "Periodic check not due." };
72
+ if (!seconds || !periodicPullEnabled(phrenPath) || !fs.existsSync(path.join(phrenPath, ".git")))
73
+ return skipped;
74
+ const releasePoll = tryFileLock(runtimeFile(phrenPath, "pull-poll"));
75
+ if (!releasePoll)
76
+ return skipped;
77
+ try {
78
+ const previous = readPollState(phrenPath);
79
+ const failures = Math.min(10, Math.max(0, Number(previous.failures) || 0));
80
+ const delay = Math.min(seconds * 2 ** failures, Math.max(seconds, 1800)) * 1000;
81
+ if (typeof previous.checkedAt === "number" && now >= previous.checkedAt && now - previous.checkedAt < delay)
82
+ return skipped;
83
+ const finish = (result, verifiedRemote = false) => {
84
+ atomicWriteText(runtimeFile(phrenPath, "pull-poll.json"), JSON.stringify({
85
+ checkedAt: now, failures: result.status === "error" ? failures + 1 : 0, ...result,
86
+ }) + "\n");
87
+ if (verifiedRemote || result.status === "updated" || result.status === "error" || result.status === "deferred") {
88
+ const at = new Date(now).toISOString();
89
+ const ok = result.status === "updated" || result.status === "unchanged";
90
+ updateRuntimeHealth(phrenPath, { lastSync: {
91
+ lastPullAt: at, lastPullStatus: ok ? "ok" : "error",
92
+ lastPullDetail: result.detail,
93
+ ...(ok ? { lastSuccessfulPullAt: at } : {}),
94
+ } });
95
+ }
96
+ return result;
97
+ };
98
+ const deferred = (detail) => finish({ status: "deferred", detail });
99
+ const failed = (detail) => finish({ status: "error", detail });
100
+ if (await worktreeBusy(phrenPath, git))
101
+ return deferred("Periodic pull deferred: a Git operation is in progress.");
102
+ const branch = await git(phrenPath, ["symbolic-ref", "--quiet", "HEAD"]);
103
+ if (!branch.ok)
104
+ return deferred("Periodic pull deferred: no branch checked out.");
105
+ const refs = await git(phrenPath, ["for-each-ref", "--format=%(upstream:remotename)%09%(upstream:remoteref)%09%(upstream)", branch.output]);
106
+ const [remote, remoteRef, trackingRef] = refs.output.split("\t");
107
+ if (!refs.ok || !remote || !remoteRef || !trackingRef)
108
+ return finish({ status: "unchanged", detail: "No tracking remote configured." });
109
+ const advertised = await git(phrenPath, ["ls-remote", "--quiet", "--exit-code", "--", remote, remoteRef]);
110
+ if (!advertised.ok)
111
+ return failed(`Periodic remote check failed: ${advertised.error}`);
112
+ const remoteHead = advertised.output.split("\n").map((line) => line.split(/\s+/))
113
+ .find(([, ref]) => ref === remoteRef)?.[0];
114
+ if (!remoteHead || !/^[0-9a-f]{40,64}$/.test(remoteHead))
115
+ return failed("Tracking branch was not advertised by the remote.");
116
+ const head = await git(phrenPath, ["rev-parse", "HEAD"]);
117
+ if (!head.ok)
118
+ return failed("Cannot read the store's current commit.");
119
+ if (remoteHead === head.output)
120
+ return finish({ status: "unchanged", detail: "Remote is unchanged." }, true);
121
+ const releaseGit = tryFileLock(runtimeFile(phrenPath, "git-op"));
122
+ if (!releaseGit)
123
+ return deferred("Periodic pull deferred: another Phren Git operation is running.");
124
+ try {
125
+ // Recheck after taking the mutation lock: hooks or another client may have changed the store.
126
+ if (await worktreeBusy(phrenPath, git))
127
+ return deferred("Periodic pull deferred: a Git operation is in progress.");
128
+ const currentBranch = await git(phrenPath, ["symbolic-ref", "--quiet", "HEAD"]);
129
+ const status = await git(phrenPath, ["status", "--porcelain"]);
130
+ if (!currentBranch.ok || currentBranch.output !== branch.output || !status.ok || status.output) {
131
+ return deferred("Periodic pull deferred: the branch changed or the store has uncommitted edits.");
132
+ }
133
+ const tracking = await git(phrenPath, ["rev-parse", "--verify", trackingRef]);
134
+ if (!tracking.ok || tracking.output !== remoteHead) {
135
+ const fetched = await git(phrenPath, ["fetch", "--quiet", "--no-tags", "--no-recurse-submodules", "--", remote, `${remoteRef}:${trackingRef}`]);
136
+ if (!fetched.ok)
137
+ return failed(`Periodic fetch failed: ${fetched.error}`);
138
+ }
139
+ const target = await git(phrenPath, ["rev-parse", "--verify", trackingRef]);
140
+ if (!target.ok)
141
+ return failed("Cannot read the fetched tracking branch.");
142
+ if ((await git(phrenPath, ["merge-base", "--is-ancestor", target.output, "HEAD"])).ok) {
143
+ return finish({ status: "unchanged", detail: "The store already contains the remote changes." }, true);
144
+ }
145
+ if (!(await git(phrenPath, ["merge-base", "--is-ancestor", "HEAD", target.output])).ok) {
146
+ return deferred("Periodic pull deferred: local and remote history diverged. Resolve the store's sync conflict before pulling.");
147
+ }
148
+ const merged = await git(phrenPath, ["merge", "--ff-only", "--no-edit", target.output]);
149
+ return merged.ok
150
+ ? finish({ status: "updated", detail: "Store fast-forwarded by periodic pull." })
151
+ : deferred(`Periodic fast-forward deferred: ${merged.error}`);
152
+ }
153
+ finally {
154
+ releaseGit();
155
+ }
156
+ }
157
+ finally {
158
+ releasePoll();
159
+ }
160
+ }
161
+ export function startPullPolling(phrenPath, options) {
162
+ let stopped = false;
163
+ let running;
164
+ const heads = new Map();
165
+ const startedAt = Date.now();
166
+ const git = options.git ?? runPollGit;
167
+ let timer;
168
+ const tick = async () => {
169
+ if (stopped)
170
+ return;
171
+ try {
172
+ const seconds = resolvePullInterval(phrenPath);
173
+ if (!seconds || !periodicPullEnabled(phrenPath))
174
+ return;
175
+ const stores = [...new Set([phrenPath, ...getNonPrimaryStores(phrenPath).map((store) => store.path)])];
176
+ for (const store of stores) {
177
+ if (stopped)
178
+ break;
179
+ await options.runExclusive(async () => {
180
+ if (stopped || !fs.existsSync(path.join(store, ".git")))
181
+ return;
182
+ const before = await git(store, ["rev-parse", "HEAD"]);
183
+ if (!before.ok)
184
+ return;
185
+ const previous = heads.get(store) ?? before.output;
186
+ if (Date.now() - startedAt >= seconds * 1000) {
187
+ const result = await pollStore(store, seconds, git);
188
+ if (result.status === "error")
189
+ debugLog(result.detail);
190
+ }
191
+ const after = await git(store, ["rev-parse", "HEAD"]);
192
+ if (!after.ok)
193
+ return;
194
+ if (after.output !== previous)
195
+ await options.onChange();
196
+ heads.set(store, after.output);
197
+ });
198
+ }
199
+ }
200
+ catch (err) {
201
+ debugLog(`periodic pull: ${errorMessage(err)}`);
202
+ }
203
+ finally {
204
+ if (!stopped) {
205
+ timer = setTimeout(run, 5000);
206
+ timer.unref();
207
+ }
208
+ }
209
+ };
210
+ const run = () => { running = tick(); };
211
+ // Establish a local baseline without a startup network burst; first check is due after the configured interval.
212
+ running = (async () => {
213
+ for (const store of [phrenPath, ...getNonPrimaryStores(phrenPath).map((s) => s.path)]) {
214
+ const head = await git(store, ["rev-parse", "HEAD"]);
215
+ if (head.ok)
216
+ heads.set(store, head.output);
217
+ }
218
+ })().catch((err) => { debugLog(`periodic pull startup: ${errorMessage(err)}`); })
219
+ .finally(() => { if (!stopped) {
220
+ timer = setTimeout(run, 5000);
221
+ timer.unref();
222
+ } });
223
+ return { stop: async () => { stopped = true; if (timer)
224
+ clearTimeout(timer); await running; } };
225
+ }
@@ -19,6 +19,8 @@ import { getActiveTaskForSession } from "../task/lifecycle.js";
19
19
  import { isInactiveFindingLine, supersedeFinding, retractFinding as retractFindingLifecycle, resolveFindingContradiction, } from "../finding/lifecycle.js";
20
20
  import { permissionDeniedError } from "../governance/rbac.js";
21
21
  import { TEAM_STORE_PATHSPECS } from "../cli/session-git.js";
22
+ import { withFileLock } from "../governance/locks.js";
23
+ import { runtimeFile } from "../phren-paths.js";
22
24
  const JACCARD_MAYBE_LOW = 0.25;
23
25
  const JACCARD_MAYBE_HIGH = 0.40; // above this isDuplicateFinding already catches it
24
26
  function findJaccardCandidates(phrenPath, project, finding) {
@@ -496,7 +498,7 @@ async function handleRemoveFinding(ctx, { project: projectInput, finding }) {
496
498
  }
497
499
  async function handlePushChanges(ctx, { message }) {
498
500
  const { phrenPath, withWriteQueue } = ctx;
499
- return withWriteQueue(async () => {
501
+ return withWriteQueue(async () => withFileLock(runtimeFile(phrenPath, "git-op"), async () => {
500
502
  const { execFileSync } = await import("child_process");
501
503
  const runGit = (args, opts = {}) => execFileSync("git", args, {
502
504
  cwd: phrenPath,
@@ -666,7 +668,7 @@ async function handlePushChanges(ctx, { message }) {
666
668
  catch {
667
669
  // store-registry not available — skip silently
668
670
  }
669
- });
671
+ }));
670
672
  }
671
673
  // ── Registration ─────────────────────────────────────────────────────────────
672
674
  export function register(server, ctx) {
@@ -196,11 +196,11 @@ export function register(server, ctx) {
196
196
  }
197
197
  const verb = enabled ? "Enable" : "Disable";
198
198
  return withWriteQueue(async () => {
199
- setSkillEnabledAndSync(phrenPath, project, result.name, enabled);
199
+ setSkillEnabledAndSync(phrenPath, result.source, result.name, enabled);
200
200
  return mcpResponse({
201
201
  ok: true,
202
- message: `${verb}d skill "${result.name}" in ${project}.`,
203
- data: { name: result.name, project, enabled },
202
+ message: `${verb}d skill "${result.name}" in ${result.source}${result.source === "global" ? " (all projects)" : ""}.`,
203
+ data: { name: result.name, project: result.source, enabled },
204
204
  });
205
205
  });
206
206
  });
package/dist/ui/server.js CHANGED
@@ -760,7 +760,7 @@ function handlePostSkillToggle(req, res, url, ctx) {
760
760
  const skill = findSkill(ctx.phrenPath, ctx.profile || "", project, name);
761
761
  if (!skill || "error" in skill)
762
762
  return jsonErr(res, skill && "error" in skill ? skill.error : "Skill not found");
763
- setSkillEnabledAndSync(ctx.phrenPath, project, skill.name, enabled);
763
+ setSkillEnabledAndSync(ctx.phrenPath, skill.source, skill.name, enabled);
764
764
  jsonOk(res, { ok: true, enabled });
765
765
  });
766
766
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {
@@ -114,6 +114,7 @@
114
114
  "inquirer": "^14.1.0",
115
115
  "js-yaml": "^5.3.0",
116
116
  "sql.js-fts5": "^1.4.0",
117
+ "ws": "8.21.3",
117
118
  "zod": "^4.4.3"
118
119
  },
119
120
  "engines": {
@@ -135,6 +136,7 @@
135
136
  },
136
137
  "devDependencies": {
137
138
  "3d-force-graph": "^1.80.0",
139
+ "@types/ws": "8.18.1",
138
140
  "three": "^0.185.1"
139
141
  },
140
142
  "publishConfig": {