@phren/cli 0.1.42 → 0.1.45
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/dist/capabilities/cli.js +1 -1
- package/dist/capabilities/mcp.js +1 -1
- package/dist/capabilities/vscode.js +3 -3
- package/dist/capabilities/web-ui.js +29 -29
- package/dist/cli/actions.d.ts +1 -1
- package/dist/cli/actions.js +7 -2
- package/dist/cli/config-proactivity.d.ts +6 -6
- package/dist/cli/hooks-output.js +15 -6
- package/dist/cli/hooks.d.ts +1 -1
- package/dist/cli/hooks.js +16 -5
- package/dist/cli/session-stop.d.ts +1 -1
- package/dist/cli/session-tool-hook.d.ts +1 -1
- package/dist/cli-registry.js +1 -1
- package/dist/data/access.js +2 -1
- package/dist/generated/memory-ui-graph.browser.js +481 -318
- package/dist/governance/locks.js +6 -0
- package/dist/governance/scores.d.ts +9 -1
- package/dist/governance/scores.js +12 -1
- package/dist/graph-core/index.d.ts +2 -0
- package/dist/graph-core/index.js +2 -0
- package/dist/graph-core/model.d.ts +84 -0
- package/dist/graph-core/model.js +355 -0
- package/dist/graph-core/types.d.ts +110 -0
- package/dist/graph-core/types.js +43 -0
- package/dist/index.js +4 -1
- package/dist/init/init-uninstall.d.ts +1 -0
- package/dist/init/init-uninstall.js +13 -3
- package/dist/init/setup.js +11 -4
- package/dist/link/context.js +2 -1
- package/dist/link/link.js +3 -2
- package/dist/link/skills.js +2 -1
- package/dist/memory-ui-graph.runtime.js +481 -318
- package/dist/phren-core.d.ts +16 -0
- package/dist/phren-core.js +21 -0
- package/dist/phren-paths.js +8 -4
- package/dist/profile-store.d.ts +2 -0
- package/dist/profile-store.js +16 -19
- package/dist/project-config.js +2 -1
- package/dist/shared/fragment-graph.js +7 -2
- package/dist/shared/index.js +1 -1
- package/dist/shared/retrieval.d.ts +38 -0
- package/dist/shared/retrieval.js +62 -4
- package/dist/shell/entry.d.ts +10 -2
- package/dist/shell/entry.js +128 -97
- package/dist/shell/graph/canvas.d.ts +64 -0
- package/dist/shell/graph/canvas.js +256 -0
- package/dist/shell/graph/controller.d.ts +164 -0
- package/dist/shell/graph/controller.js +645 -0
- package/dist/shell/graph/glyphs.d.ts +12 -0
- package/dist/shell/graph/glyphs.js +31 -0
- package/dist/shell/graph/graph-view.d.ts +12 -0
- package/dist/shell/graph/graph-view.js +408 -0
- package/dist/shell/graph/layout.d.ts +68 -0
- package/dist/shell/graph/layout.js +267 -0
- package/dist/shell/input.d.ts +4 -1
- package/dist/shell/input.js +28 -5
- package/dist/shell/intro.d.ts +37 -0
- package/dist/shell/intro.js +82 -0
- package/dist/shell/keys.d.ts +36 -0
- package/dist/shell/keys.js +107 -0
- package/dist/shell/logo-fx.d.ts +35 -0
- package/dist/shell/logo-fx.js +128 -0
- package/dist/shell/render.d.ts +34 -1
- package/dist/shell/render.js +220 -66
- package/dist/shell/shell.d.ts +13 -1
- package/dist/shell/shell.js +61 -10
- package/dist/shell/startup.d.ts +37 -0
- package/dist/shell/startup.js +105 -0
- package/dist/shell/state-store.d.ts +1 -1
- package/dist/shell/state-store.js +1 -1
- package/dist/shell/types.js +1 -0
- package/dist/shell/view.d.ts +3 -0
- package/dist/shell/view.js +26 -4
- package/dist/store-registry.d.ts +13 -0
- package/dist/store-registry.js +109 -37
- package/dist/test-global-setup.d.ts +1 -0
- package/dist/test-global-setup.js +22 -0
- package/dist/tool-registry.js +1 -0
- package/dist/tools/memory.js +12 -5
- package/dist/tools/ops.js +1 -1
- package/dist/ui/data.d.ts +15 -7
- package/dist/ui/data.js +102 -3
- package/dist/utils-fts.js +2 -1
- package/dist/utils-helpers.d.ts +1 -0
- package/dist/utils-helpers.js +6 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +38 -7
- package/starter/global/skills/phren-consolidate/SKILL.md +152 -0
- package/starter/global/skills/phren-discover/SKILL.md +175 -0
- package/starter/global/skills/phren-init/SKILL.md +216 -0
- package/starter/global/skills/phren-profiles/SKILL.md +121 -0
- package/starter/global/skills/phren-sync/SKILL.md +261 -0
- package/dist/init-uninstall.d.ts +0 -3
- package/dist/init-uninstall.js +0 -514
- package/dist/init-walkthrough.d.ts +0 -55
- package/dist/init-walkthrough.js +0 -524
|
@@ -37,9 +37,19 @@ function runSyncCommand(command, args) {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function shouldUninstallCurrentGlobalPackage() {
|
|
41
|
-
//
|
|
42
|
-
//
|
|
40
|
+
export function shouldUninstallCurrentGlobalPackage() {
|
|
41
|
+
// `npm uninstall -g` resolves against the machine's real npm prefix, which
|
|
42
|
+
// no amount of PHREN_PATH/HOME redirection sandboxes. A test that spawns
|
|
43
|
+
// `phren uninstall` against temp directories would therefore delete the
|
|
44
|
+
// developer's actual global install — it did, repeatedly, before this
|
|
45
|
+
// guard. The test helpers set this for every spawned CLI.
|
|
46
|
+
if (process.env.PHREN_SKIP_GLOBAL_NPM_UNINSTALL === "1") {
|
|
47
|
+
log(` Skipped global npm package removal (PHREN_SKIP_GLOBAL_NPM_UNINSTALL=1)`);
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
// Otherwise always attempt to remove the global package if it exists,
|
|
51
|
+
// regardless of whether the uninstaller was invoked from the global install
|
|
52
|
+
// or a local repo.
|
|
43
53
|
const npmRootResult = runSyncCommand(getNpmCommand(), ["root", "-g"]);
|
|
44
54
|
if (!npmRootResult.ok)
|
|
45
55
|
return false;
|
package/dist/init/setup.js
CHANGED
|
@@ -5,6 +5,7 @@ import * as fs from "fs";
|
|
|
5
5
|
import * as path from "path";
|
|
6
6
|
import * as os from "os";
|
|
7
7
|
import * as yaml from "js-yaml";
|
|
8
|
+
import { loadYamlDocument } from "../phren-core.js";
|
|
8
9
|
import { atomicWriteText, debugLog, findProjectNameCaseInsensitive, findProjectNamesByCanonicalKey, projectSlugFromPath, hookConfigPath, EXEC_TIMEOUT_QUICK_MS, readRootManifest, sessionsDir, runtimeHealthFile, isRecord, } from "../shared.js";
|
|
9
10
|
import { ensurePrivateDir, homePath } from "../phren-paths.js";
|
|
10
11
|
import { isLiveForeignPhrenRoot, phrenRootFromGlobalClaudeLink } from "./guard-globals.js";
|
|
@@ -45,7 +46,7 @@ function pruneLegacySampleProjectsFromProfiles(phrenPath) {
|
|
|
45
46
|
continue;
|
|
46
47
|
const fullPath = path.join(profilesDir, file);
|
|
47
48
|
try {
|
|
48
|
-
const parsed =
|
|
49
|
+
const parsed = loadYamlDocument(fs.readFileSync(fullPath, "utf8"), (text) => yaml.load(text, { schema: yaml.CORE_SCHEMA }));
|
|
49
50
|
if (!isRecord(parsed))
|
|
50
51
|
continue;
|
|
51
52
|
const originalProjects = normalizeProjects(parsed.projects);
|
|
@@ -88,11 +89,17 @@ export function resolvePreferredHomeDir(phrenPath) {
|
|
|
88
89
|
if (scoreAgentFootprint(resolvedUserProfile) > 0)
|
|
89
90
|
return resolvedUserProfile;
|
|
90
91
|
}
|
|
92
|
+
// An explicit HOME/USERPROFILE is authoritative. Only fall back to
|
|
93
|
+
// os.homedir() and the store's parent when neither is set — otherwise a
|
|
94
|
+
// caller that deliberately points HOME elsewhere (the test suite, a
|
|
95
|
+
// sandbox) loses the footprint contest to the developer's real home and
|
|
96
|
+
// we write symlinks into it.
|
|
91
97
|
const candidates = [
|
|
92
98
|
resolvedHome,
|
|
93
99
|
resolvedUserProfile,
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
...(resolvedHome || resolvedUserProfile
|
|
101
|
+
? []
|
|
102
|
+
: [path.resolve(os.homedir()), path.resolve(path.dirname(phrenPath))]),
|
|
96
103
|
].filter((entry) => Boolean(entry && entry.trim()));
|
|
97
104
|
const unique = [...new Set(candidates)];
|
|
98
105
|
let bestPath = null;
|
|
@@ -1267,7 +1274,7 @@ export function updateMachinesYaml(phrenPath, machine, profile) {
|
|
|
1267
1274
|
const profileName = profile?.trim() || (activeProfile.ok ? (activeProfile.data || "") : "") || "personal";
|
|
1268
1275
|
let hasExistingMapping = false;
|
|
1269
1276
|
try {
|
|
1270
|
-
const loaded =
|
|
1277
|
+
const loaded = loadYamlDocument(fs.readFileSync(machinesFile, "utf8"), (text) => yaml.load(text, { schema: yaml.CORE_SCHEMA }));
|
|
1271
1278
|
if (loaded && typeof loaded === "object" && !Array.isArray(loaded)) {
|
|
1272
1279
|
hasExistingMapping = Object.prototype.hasOwnProperty.call(loaded, machineName);
|
|
1273
1280
|
}
|
package/dist/link/context.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import * as yaml from "js-yaml";
|
|
4
|
+
import { loadYamlDocument } from "../phren-core.js";
|
|
4
5
|
import { isValidProjectName } from "../utils.js";
|
|
5
6
|
import { homeDir, homePath } from "../shared.js";
|
|
6
7
|
import { resolveTaskFilePath } from "../data/tasks.js";
|
|
@@ -25,7 +26,7 @@ function allKnownProjects(phrenPath) {
|
|
|
25
26
|
for (const f of fs.readdirSync(profilesDir)) {
|
|
26
27
|
if (!f.endsWith(".yaml"))
|
|
27
28
|
continue;
|
|
28
|
-
const data =
|
|
29
|
+
const data = loadYamlDocument(fs.readFileSync(path.join(profilesDir, f), "utf8"), (text) => yaml.load(text, { schema: yaml.CORE_SCHEMA }));
|
|
29
30
|
for (const p of (data?.projects ?? []))
|
|
30
31
|
projects.add(p);
|
|
31
32
|
}
|
package/dist/link/link.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as fs from "fs";
|
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import * as readline from "readline";
|
|
4
4
|
import * as yaml from "js-yaml";
|
|
5
|
+
import { loadYamlDocument } from "../phren-core.js";
|
|
5
6
|
import { execFileSync } from "child_process";
|
|
6
7
|
import { ROOT } from "../package-metadata.js";
|
|
7
8
|
import { configureMcpTargets, ensureGovernanceFiles, getHooksEnabledPreference, getMcpEnabledPreference, isVersionNewer, patchJsonFile, setMcpEnabledPreference, } from "../init/init.js";
|
|
@@ -48,14 +49,14 @@ export function findProfileFile(phrenPath, profileName) {
|
|
|
48
49
|
for (const f of fs.readdirSync(profilesDir)) {
|
|
49
50
|
if (!f.endsWith(".yaml"))
|
|
50
51
|
continue;
|
|
51
|
-
const data =
|
|
52
|
+
const data = loadYamlDocument(fs.readFileSync(path.join(profilesDir, f), "utf8"), (text) => yaml.load(text, { schema: yaml.CORE_SCHEMA }));
|
|
52
53
|
if (data?.name === profileName)
|
|
53
54
|
return path.join(profilesDir, f);
|
|
54
55
|
}
|
|
55
56
|
return null;
|
|
56
57
|
}
|
|
57
58
|
export function getProfileProjects(profileFile) {
|
|
58
|
-
const data =
|
|
59
|
+
const data = loadYamlDocument(fs.readFileSync(profileFile, "utf8"), (text) => yaml.load(text, { schema: yaml.CORE_SCHEMA }));
|
|
59
60
|
return Array.isArray(data?.projects) ? data.projects : [];
|
|
60
61
|
}
|
|
61
62
|
function currentPackageVersion() {
|
package/dist/link/skills.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import * as yaml from "js-yaml";
|
|
4
|
+
import { loadYamlDocument } from "../phren-core.js";
|
|
4
5
|
import { debugLog } from "../shared.js";
|
|
5
6
|
import { errorMessage } from "../utils.js";
|
|
6
7
|
import { buildSharedLifecycleCommands } from "../hooks.js";
|
|
@@ -16,7 +17,7 @@ export function parseSkillFrontmatter(rawContent) {
|
|
|
16
17
|
if (!match)
|
|
17
18
|
return { frontmatter: null, body: content };
|
|
18
19
|
try {
|
|
19
|
-
const parsed =
|
|
20
|
+
const parsed = loadYamlDocument(match[1], (text) => yaml.load(text));
|
|
20
21
|
return { frontmatter: parsed && typeof parsed === "object" ? parsed : null, body: match[2] };
|
|
21
22
|
}
|
|
22
23
|
catch (err) {
|