@phren/cli 0.1.17 → 0.1.20
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/cli/cli.js +0 -4
- package/dist/cli/hooks.js +5 -1
- package/dist/cli/session-stop.js +1 -1
- package/dist/cli-hooks-stop.js +2 -2
- package/dist/entrypoint.d.ts +0 -3
- package/dist/entrypoint.js +19 -74
- package/dist/generated/memory-ui-graph.browser.js +27 -27
- package/dist/hooks.d.ts +43 -3
- package/dist/hooks.js +196 -16
- package/dist/index.js +5 -6
- package/dist/init/config.d.ts +28 -0
- package/dist/init/config.js +107 -2
- package/dist/init/init-configure.js +13 -1
- package/dist/init/preferences.d.ts +8 -0
- package/dist/link/doctor.js +13 -6
- package/dist/memory-ui-graph.runtime.js +27 -27
- package/dist/shell/render-api.d.ts +1 -1
- package/dist/tools/finding.js +2 -2
- package/dist/tools/hooks.js +38 -0
- package/dist/ui/deep-void.d.ts +1 -0
- package/dist/ui/deep-void.js +413 -0
- package/dist/ui/graph.js +3 -0
- package/dist/ui/page.js +3 -1
- package/package.json +3 -3
- package/dist/agent-launch.d.ts +0 -1
- package/dist/agent-launch.js +0 -48
package/dist/cli/cli.js
CHANGED
|
@@ -13,7 +13,6 @@ import { handleTaskView, handleSessionsView, handleQuickstart, handleDebugInject
|
|
|
13
13
|
import { handleAddFinding, handleDoctor, handleFragmentSearch, handleMemoryUi, handleTruths, handlePinCanonical, handleQualityFeedback, handleRelatedDocs, handleConsolidationStatus, handleSessionContext, handleSearch, handleShell, handleStatus, handleUpdate, } from "./actions.js";
|
|
14
14
|
import { handleGraphNamespace } from "./graph.js";
|
|
15
15
|
import { resolveRuntimeProfile } from "../runtime-profile.js";
|
|
16
|
-
import { runBundledAgentCli } from "../agent-launch.js";
|
|
17
16
|
// ── CLI router ───────────────────────────────────────────────────────────────
|
|
18
17
|
export async function runCliCommand(command, args) {
|
|
19
18
|
const getProfile = () => resolveRuntimeProfile(getPhrenPath());
|
|
@@ -119,9 +118,6 @@ export async function runCliCommand(command, args) {
|
|
|
119
118
|
return handleTeamNamespace(args);
|
|
120
119
|
case "promote":
|
|
121
120
|
return handlePromoteNamespace(args);
|
|
122
|
-
case "agent": {
|
|
123
|
-
return runBundledAgentCli(args);
|
|
124
|
-
}
|
|
125
121
|
default:
|
|
126
122
|
console.error(`Unknown command: ${command}\nRun 'phren --help' for available commands.`);
|
|
127
123
|
process.exit(1);
|
package/dist/cli/hooks.js
CHANGED
|
@@ -12,7 +12,7 @@ import { checkConsolidationNeeded, } from "../shared/content.js";
|
|
|
12
12
|
import { buildRobustFtsQuery, extractKeywordEntries, isFeatureEnabled, clampInt, errorMessage, } from "../utils.js";
|
|
13
13
|
import { getHooksEnabledPreference } from "../init/init.js";
|
|
14
14
|
import { logger } from "../logger.js";
|
|
15
|
-
import { isToolHookEnabled } from "../hooks.js";
|
|
15
|
+
import { isToolHookEnabled, runPrePromptHooks } from "../hooks.js";
|
|
16
16
|
import { handleExtractMemories } from "./extract.js";
|
|
17
17
|
import { appendAuditLog } from "../shared.js";
|
|
18
18
|
import { updateRuntimeHealth } from "../shared/governance.js";
|
|
@@ -316,6 +316,10 @@ export async function handleHookPrompt() {
|
|
|
316
316
|
debugLog(`slow-fs: hook-prompt took ${totalMs}ms (index=${stage.indexMs} search=${stage.searchMs} trust=${stage.trustMs} rank=${stage.rankMs} select=${stage.selectMs})`);
|
|
317
317
|
process.stderr.write(`phren: hook-prompt took ${totalMs}ms, check if ~/.phren is on a slow or network filesystem\n`);
|
|
318
318
|
}
|
|
319
|
+
// Run pre-prompt custom hooks and prepend their output
|
|
320
|
+
const prePromptOutput = runPrePromptHooks(getPhrenPath(), raw);
|
|
321
|
+
if (prePromptOutput)
|
|
322
|
+
parts.unshift(prePromptOutput);
|
|
319
323
|
console.log(parts.join("\n"));
|
|
320
324
|
}
|
|
321
325
|
catch (err) {
|
package/dist/cli/session-stop.js
CHANGED
|
@@ -282,7 +282,7 @@ export async function handleHookStop() {
|
|
|
282
282
|
// Stage all changes first, then unstage any sensitive files that slipped
|
|
283
283
|
// through. Using pathspec exclusions with `git add -A` can fail when
|
|
284
284
|
// excluded paths are also gitignored (git treats the pathspec as an error).
|
|
285
|
-
let add = await runBestEffortGit(["add", "-A"], phrenPath);
|
|
285
|
+
let add = await runBestEffortGit(["add", "--sparse", "-A"], phrenPath);
|
|
286
286
|
if (add.ok) {
|
|
287
287
|
// Belt-and-suspenders: unstage sensitive files that .gitignore should
|
|
288
288
|
// already block. Failures here are non-fatal (files may not exist).
|
package/dist/cli-hooks-stop.js
CHANGED
|
@@ -341,7 +341,7 @@ export async function handleHookStop() {
|
|
|
341
341
|
// Stage all changes first, then unstage any sensitive files that slipped
|
|
342
342
|
// through. Using pathspec exclusions with `git add -A` can fail when
|
|
343
343
|
// excluded paths are also gitignored (git treats the pathspec as an error).
|
|
344
|
-
let add = await runBestEffortGit(["add", "-A"], phrenPath);
|
|
344
|
+
let add = await runBestEffortGit(["add", "--sparse", "-A"], phrenPath);
|
|
345
345
|
if (add.ok) {
|
|
346
346
|
// Belt-and-suspenders: unstage sensitive files that .gitignore should
|
|
347
347
|
// already block. Failures here are non-fatal (files may not exist).
|
|
@@ -486,7 +486,7 @@ export async function handleHookStop() {
|
|
|
486
486
|
const storeStatus = await runBestEffortGit(["status", "--porcelain"], store.path);
|
|
487
487
|
if (storeStatus.ok && storeStatus.output) {
|
|
488
488
|
// Only stage journal/, tasks.md, truths.md, FINDINGS.md, summary.md — NOT .runtime/
|
|
489
|
-
await runBestEffortGit(["add", "--", "*/journal/*", "*/tasks.md", "*/truths.md", "*/FINDINGS.md", "*/summary.md", ".phren-team.yaml"], store.path);
|
|
489
|
+
await runBestEffortGit(["add", "--sparse", "--", "*/journal/*", "*/tasks.md", "*/truths.md", "*/FINDINGS.md", "*/FINDINGS.md.bak", "*/summary.md", "*/review.md", "*/CLAUDE.md", "*/topic-config.json", "*/phren.project.yaml", "*/reference/**", "*/skills/**", ".phren-team.yaml"], store.path);
|
|
490
490
|
const actor = process.env.PHREN_ACTOR || process.env.USER || "unknown";
|
|
491
491
|
const teamCommit = await runBestEffortGit(["commit", "-m", `phren: ${actor} team sync`], store.path);
|
|
492
492
|
if (teamCommit.ok) {
|
package/dist/entrypoint.d.ts
CHANGED
package/dist/entrypoint.js
CHANGED
|
@@ -7,63 +7,30 @@ import { defaultPhrenPath, expandHomePath, findPhrenPath, readRootManifest } fro
|
|
|
7
7
|
import { VERSION } from "./package-metadata.js";
|
|
8
8
|
import { addProjectFromPath } from "./core/project.js";
|
|
9
9
|
import { PROJECT_OWNERSHIP_MODES, getProjectOwnershipDefault, parseProjectOwnershipMode, } from "./project-config.js";
|
|
10
|
-
const HELP_TEXT = `phren
|
|
10
|
+
const HELP_TEXT = `phren - persistent memory for AI agents
|
|
11
11
|
|
|
12
|
-
phren
|
|
13
|
-
phren
|
|
14
|
-
phren
|
|
15
|
-
phren
|
|
16
|
-
phren
|
|
17
|
-
phren
|
|
18
|
-
phren
|
|
19
|
-
phren
|
|
20
|
-
phren
|
|
21
|
-
phren
|
|
12
|
+
phren Interactive memory shell
|
|
13
|
+
phren init Set up phren
|
|
14
|
+
phren quickstart Quick setup: init + project scaffold
|
|
15
|
+
phren add [path] Register a project
|
|
16
|
+
phren search <query> Search what phren knows
|
|
17
|
+
phren status Health check
|
|
18
|
+
phren doctor [--fix] Diagnose and repair
|
|
19
|
+
phren web-ui Open the knowledge graph
|
|
20
|
+
phren tasks Cross-project task view
|
|
21
|
+
phren graph Fragment knowledge graph
|
|
22
|
+
phren shell Interactive memory shell
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
phren
|
|
25
|
-
phren "fix the login bug" One-shot coding task
|
|
26
|
-
phren --provider openai-codex -i Interactive agent with explicit provider
|
|
27
|
-
phren --reasoning high "..." Run GPT-5.4 with higher reasoning
|
|
24
|
+
phren manage <command> Alias for the top-level commands above
|
|
25
|
+
phren mem <command> Alias for \`phren manage\`
|
|
28
26
|
|
|
29
27
|
Legacy shortcuts still work:
|
|
30
28
|
phren init, phren search, phren task, phren config, ...
|
|
31
29
|
|
|
32
|
-
phren
|
|
30
|
+
phren help <topic> Detailed help
|
|
33
31
|
Topics: projects, skills, hooks, config, maintain, setup, stores, team, env, all
|
|
34
32
|
`;
|
|
35
|
-
const INTEGRATED_HELP_TEXT =
|
|
36
|
-
|
|
37
|
-
Agent:
|
|
38
|
-
phren Interactive coding agent
|
|
39
|
-
phren "fix the login bug" One-shot coding task
|
|
40
|
-
phren -i Interactive agent TUI
|
|
41
|
-
phren --provider openai-codex "..." Run the agent with an explicit provider
|
|
42
|
-
phren --reasoning high "..." Override the default medium thinking level
|
|
43
|
-
phren agent ... Explicit alias for agent mode
|
|
44
|
-
phren auth status Show configured provider auth
|
|
45
|
-
phren auth login Sign in with your Codex subscription
|
|
46
|
-
|
|
47
|
-
Memory and management:
|
|
48
|
-
phren manage <command> Memory/store/setup/config operations
|
|
49
|
-
phren mem <command> Alias for \`phren manage\`
|
|
50
|
-
phren manage shell Interactive memory shell
|
|
51
|
-
phren manage search <query> Search what phren knows
|
|
52
|
-
phren manage task add <project> "..."
|
|
53
|
-
phren manage config ...
|
|
54
|
-
phren manage init
|
|
55
|
-
|
|
56
|
-
Legacy shortcuts still work:
|
|
57
|
-
phren init
|
|
58
|
-
phren search <query>
|
|
59
|
-
phren task ...
|
|
60
|
-
phren config ...
|
|
61
|
-
phren store ...
|
|
62
|
-
|
|
63
|
-
Machine-facing mode:
|
|
64
|
-
phren <phren-root-path> Start the MCP server over stdio
|
|
65
|
-
|
|
66
|
-
Use \`phren manage help\` for the full management command reference.`;
|
|
33
|
+
const INTEGRATED_HELP_TEXT = HELP_TEXT;
|
|
67
34
|
const HELP_TOPICS = {
|
|
68
35
|
projects: `Projects:
|
|
69
36
|
phren add [path] [--ownership <mode>] Register a project
|
|
@@ -225,20 +192,7 @@ export const CLI_COMMANDS = [
|
|
|
225
192
|
"store",
|
|
226
193
|
"team",
|
|
227
194
|
"promote",
|
|
228
|
-
"agent",
|
|
229
195
|
];
|
|
230
|
-
const DIRECT_MANAGE_COMMANDS = new Set([
|
|
231
|
-
"add",
|
|
232
|
-
"init",
|
|
233
|
-
"uninstall",
|
|
234
|
-
"status",
|
|
235
|
-
"verify",
|
|
236
|
-
"mcp-mode",
|
|
237
|
-
"hooks-mode",
|
|
238
|
-
"link",
|
|
239
|
-
"--health",
|
|
240
|
-
...CLI_COMMANDS,
|
|
241
|
-
]);
|
|
242
196
|
function looksLikePhrenRootArg(arg) {
|
|
243
197
|
if (!arg || arg.startsWith("-"))
|
|
244
198
|
return false;
|
|
@@ -269,21 +223,12 @@ export function resolveTopLevelInvocation(argv) {
|
|
|
269
223
|
return argv.length > 1 ? { kind: "manage", argv } : { kind: "help" };
|
|
270
224
|
}
|
|
271
225
|
if (argvCommand === "manage" || argvCommand === "mem") {
|
|
272
|
-
return { kind: "manage", argv: argv.slice(1).length > 0 ? argv.slice(1) : [
|
|
273
|
-
}
|
|
274
|
-
if (argvCommand === "agent") {
|
|
275
|
-
return { kind: "agent", argv: argv.slice(1) };
|
|
276
|
-
}
|
|
277
|
-
if (argvCommand === "auth") {
|
|
278
|
-
return { kind: "agent", argv };
|
|
226
|
+
return { kind: "manage", argv: argv.slice(1).length > 0 ? argv.slice(1) : [] };
|
|
279
227
|
}
|
|
280
228
|
if (!argvCommand) {
|
|
281
|
-
return { kind: "
|
|
282
|
-
}
|
|
283
|
-
if (DIRECT_MANAGE_COMMANDS.has(argvCommand)) {
|
|
284
|
-
return { kind: "manage", argv };
|
|
229
|
+
return { kind: "manage", argv: [] };
|
|
285
230
|
}
|
|
286
|
-
return { kind: "
|
|
231
|
+
return { kind: "manage", argv };
|
|
287
232
|
}
|
|
288
233
|
export function printIntegratedHelp() {
|
|
289
234
|
console.log(INTEGRATED_HELP_TEXT);
|