@phren/cli 0.1.37 → 0.1.39
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/README.md +3 -2
- package/dist/cli/hooks.js +3 -0
- package/dist/cli/namespaces-notes.d.ts +1 -0
- package/dist/cli/namespaces-notes.js +142 -0
- package/dist/cli/namespaces-store.js +2 -3
- package/dist/cli/namespaces.d.ts +1 -0
- package/dist/cli/namespaces.js +1 -0
- package/dist/cli-hooks-git.d.ts +1 -1
- package/dist/cli-hooks-git.js +1 -0
- package/dist/cli-registry.js +19 -0
- package/dist/core/note.d.ts +9 -0
- package/dist/core/note.js +20 -0
- package/dist/data/notes.d.ts +28 -0
- package/dist/data/notes.js +193 -0
- package/dist/generated/memory-ui-graph.browser.js +363 -293
- package/dist/governance/rbac.d.ts +1 -1
- package/dist/governance/rbac.js +4 -0
- package/dist/index.js +2 -0
- package/dist/link/doctor.js +68 -0
- package/dist/link/link.js +17 -1
- package/dist/memory-ui-graph.runtime.js +363 -293
- package/dist/phren-core.d.ts +1 -1
- package/dist/phren-core.js +1 -1
- package/dist/shared/index.js +2 -0
- package/dist/store-registry.d.ts +1 -0
- package/dist/store-registry.js +1 -1
- package/dist/tools/notes.d.ts +3 -0
- package/dist/tools/notes.js +146 -0
- package/dist/ui/data.d.ts +2 -0
- package/dist/ui/data.js +7 -0
- package/dist/ui/page.js +10 -2
- package/dist/ui/scripts.d.ts +2 -0
- package/dist/ui/scripts.js +310 -14
- package/dist/ui/server.js +89 -23
- package/dist/ui/styles.d.ts +2 -0
- package/dist/ui/styles.js +59 -0
- package/package.json +9 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* The actor is read from the PHREN_ACTOR env var (falls back to open if unset).
|
|
18
18
|
*/
|
|
19
|
-
type RbacAction = "add_finding" | "remove_finding" | "edit_finding" | "complete_task" | "add_task" | "remove_task" | "update_task" | "pin_task" | "manage_config";
|
|
19
|
+
type RbacAction = "add_finding" | "remove_finding" | "edit_finding" | "complete_task" | "add_task" | "remove_task" | "update_task" | "pin_task" | "add_note" | "edit_note" | "remove_note" | "promote_note" | "manage_config";
|
|
20
20
|
export declare const ACCESS_ROLE_KEYS: readonly ["admins", "contributors", "readers"];
|
|
21
21
|
export type AccessRole = (typeof ACCESS_ROLE_KEYS)[number];
|
|
22
22
|
export type AccessRolePatch = Partial<Record<AccessRole, string[]>>;
|
package/dist/governance/rbac.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -164,6 +164,7 @@ async function main() {
|
|
|
164
164
|
// InputValidationError until the schema is fetched.
|
|
165
165
|
const ALWAYS_LOAD_TOOLS = new Set([
|
|
166
166
|
"add_finding",
|
|
167
|
+
"add_note",
|
|
167
168
|
"add_task",
|
|
168
169
|
"complete_task",
|
|
169
170
|
"search_knowledge",
|
|
@@ -252,6 +253,7 @@ async function main() {
|
|
|
252
253
|
import("./tools/hooks.js"),
|
|
253
254
|
import("./tools/extract.js"),
|
|
254
255
|
import("./tools/config.js"),
|
|
256
|
+
import("./tools/notes.js"),
|
|
255
257
|
]);
|
|
256
258
|
for (const mod of toolModules)
|
|
257
259
|
mod.register(server, ctx);
|
package/dist/link/doctor.js
CHANGED
|
@@ -3,6 +3,8 @@ import * as path from "path";
|
|
|
3
3
|
import { execFileSync } from "child_process";
|
|
4
4
|
import { debugLog, EXEC_TIMEOUT_QUICK_MS, getProjectDirs, isRecord, homeDir, homePath, hookConfigPath, listInvalidProjectDirs, runtimeHealthFile, } from "../shared.js";
|
|
5
5
|
import { migrateInvalidProjectNames, formatMigrationSummary } from "../project-migrate.js";
|
|
6
|
+
import { ROOT_MANIFEST_FILENAME } from "../phren-paths.js";
|
|
7
|
+
import { STORES_FILENAME } from "../store-registry.js";
|
|
6
8
|
import { commandVersion, versionAtLeast, nearestWritableTarget } from "../init/shared.js";
|
|
7
9
|
import { validateGovernanceJson } from "../shared/governance.js";
|
|
8
10
|
import { errorMessage } from "../utils.js";
|
|
@@ -90,6 +92,43 @@ function gitRemoteStatus(phrenPath, syncIntent) {
|
|
|
90
92
|
return { ok: true, detail: `origin=${remote} (unreachable, local-only mode)` };
|
|
91
93
|
}
|
|
92
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Root-level config the CLI reads straight off disk. Sparse-checkout can leave these
|
|
97
|
+
* tracked-but-unmaterialized, and both failures are silent: without the root manifest
|
|
98
|
+
* the MCP entrypoint never recognizes the store path (so MCP never starts), and without
|
|
99
|
+
* stores.yaml the registry falls back to a single implicit store, hiding every team store.
|
|
100
|
+
*/
|
|
101
|
+
function rootConfigStatus(phrenPath, filename) {
|
|
102
|
+
if (fs.existsSync(path.join(phrenPath, filename))) {
|
|
103
|
+
return { present: true, trackedInHead: false };
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
execFileSync("git", ["cat-file", "-e", `HEAD:${filename}`], {
|
|
107
|
+
cwd: phrenPath,
|
|
108
|
+
stdio: "ignore",
|
|
109
|
+
timeout: EXEC_TIMEOUT_QUICK_MS,
|
|
110
|
+
});
|
|
111
|
+
return { present: false, trackedInHead: true };
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return { present: false, trackedInHead: false };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** Materialize a tracked-but-excluded root config file by widening sparse-checkout. */
|
|
118
|
+
function materializeRootConfig(phrenPath, filename) {
|
|
119
|
+
try {
|
|
120
|
+
execFileSync("git", ["sparse-checkout", "add", `/${filename}`], {
|
|
121
|
+
cwd: phrenPath,
|
|
122
|
+
stdio: "ignore",
|
|
123
|
+
timeout: EXEC_TIMEOUT_QUICK_MS,
|
|
124
|
+
});
|
|
125
|
+
return fs.existsSync(path.join(phrenPath, filename));
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
debugLog(`materializeRootConfig(${filename}): ${errorMessage(err)}`);
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
93
132
|
function pushSkillMirrorChecks(checks, scope, manifest, destDir) {
|
|
94
133
|
const parentDir = path.dirname(destDir);
|
|
95
134
|
checks.push({
|
|
@@ -155,6 +194,35 @@ export async function runDoctor(phrenPath, fix = false, checkData = false) {
|
|
|
155
194
|
ok: gitRemote.ok,
|
|
156
195
|
detail: gitRemote.detail,
|
|
157
196
|
});
|
|
197
|
+
// Root config must be materialized on disk, not merely tracked in git.
|
|
198
|
+
const manifestStatus = rootConfigStatus(phrenPath, ROOT_MANIFEST_FILENAME);
|
|
199
|
+
const manifestRepaired = !manifestStatus.present && manifestStatus.trackedInHead && fix
|
|
200
|
+
? materializeRootConfig(phrenPath, ROOT_MANIFEST_FILENAME)
|
|
201
|
+
: false;
|
|
202
|
+
checks.push({
|
|
203
|
+
name: "root-manifest",
|
|
204
|
+
ok: manifestStatus.present || manifestRepaired,
|
|
205
|
+
detail: manifestStatus.present
|
|
206
|
+
? path.join(phrenPath, ROOT_MANIFEST_FILENAME)
|
|
207
|
+
: manifestRepaired
|
|
208
|
+
? `${ROOT_MANIFEST_FILENAME} restored (was excluded by sparse-checkout)`
|
|
209
|
+
: manifestStatus.trackedInHead
|
|
210
|
+
? `${ROOT_MANIFEST_FILENAME} is tracked in git but excluded by sparse-checkout — MCP cannot start; run 'phren doctor --fix'`
|
|
211
|
+
: `${ROOT_MANIFEST_FILENAME} missing from ${phrenPath}`,
|
|
212
|
+
});
|
|
213
|
+
// stores.yaml is optional (single-store installs have none), so this is only a
|
|
214
|
+
// failure when it exists in git but was never materialized.
|
|
215
|
+
const storesStatus = rootConfigStatus(phrenPath, STORES_FILENAME);
|
|
216
|
+
if (!storesStatus.present && storesStatus.trackedInHead) {
|
|
217
|
+
const storesRepaired = fix ? materializeRootConfig(phrenPath, STORES_FILENAME) : false;
|
|
218
|
+
checks.push({
|
|
219
|
+
name: "store-registry-materialized",
|
|
220
|
+
ok: storesRepaired,
|
|
221
|
+
detail: storesRepaired
|
|
222
|
+
? `${STORES_FILENAME} restored (was excluded by sparse-checkout)`
|
|
223
|
+
: `${STORES_FILENAME} is tracked in git but excluded by sparse-checkout — team stores are hidden; run 'phren doctor --fix'`,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
158
226
|
checks.push({
|
|
159
227
|
name: "machine-registered",
|
|
160
228
|
ok: Boolean(profile),
|
package/dist/link/link.js
CHANGED
|
@@ -10,6 +10,8 @@ import { getMachineName, persistMachineName } from "../machine-identity.js";
|
|
|
10
10
|
import { debugLog, EXEC_TIMEOUT_MS, EXEC_TIMEOUT_QUICK_MS, isRecord, homePath, hookConfigPath, installPreferencesFile, atomicWriteText, } from "../shared.js";
|
|
11
11
|
import { errorMessage } from "../utils.js";
|
|
12
12
|
import { FINDINGS_FILENAME } from "../data/access.js";
|
|
13
|
+
import { ROOT_MANIFEST_FILENAME } from "../phren-paths.js";
|
|
14
|
+
import { STORES_FILENAME } from "../store-registry.js";
|
|
13
15
|
import { log } from "../init/shared.js";
|
|
14
16
|
import { listMachines as listMachinesShared, listProfiles as listProfilesShared, setMachineProfile, } from "../profile-store.js";
|
|
15
17
|
import { writeSkillMd, isManagedSymlink } from "./skills.js";
|
|
@@ -120,7 +122,21 @@ function setupSparseCheckout(phrenPath, projects) {
|
|
|
120
122
|
logger.debug("link", `setupSparseCheckout notAGitRepo: ${errorMessage(err)}`);
|
|
121
123
|
return;
|
|
122
124
|
}
|
|
123
|
-
|
|
125
|
+
// Root-level config the CLI needs on disk regardless of profile. Omitting these
|
|
126
|
+
// leaves them tracked-but-unmaterialized: the MCP entrypoint can't find the root
|
|
127
|
+
// manifest (so MCP never starts) and a missing stores.yaml silently degrades to a
|
|
128
|
+
// single implicit store, hiding every team store.
|
|
129
|
+
const alwaysInclude = [
|
|
130
|
+
"profiles",
|
|
131
|
+
"machines.yaml",
|
|
132
|
+
"global",
|
|
133
|
+
"scripts",
|
|
134
|
+
"link.sh",
|
|
135
|
+
"README.md",
|
|
136
|
+
".gitignore",
|
|
137
|
+
ROOT_MANIFEST_FILENAME,
|
|
138
|
+
STORES_FILENAME,
|
|
139
|
+
];
|
|
124
140
|
const paths = [...alwaysInclude, ...projects];
|
|
125
141
|
try {
|
|
126
142
|
execFileSync("git", ["sparse-checkout", "set", ...paths], { cwd: phrenPath, stdio: "ignore", timeout: EXEC_TIMEOUT_MS });
|