@phren/cli 0.1.26 → 0.1.28

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.
@@ -0,0 +1,715 @@
1
+ /**
2
+ * Command registry - single source of truth for help generation and dispatch.
3
+ *
4
+ * Order in REGISTRY is load-bearing: it drives cheat-sheet ordering and
5
+ * within-topic ordering. Don't sort.
6
+ */
7
+ // Native handlers load lazily via `native()` below - statically importing
8
+ // cli-handlers.js would pull init/init.js (and its transitive deps) into
9
+ // every phren invocation, defeating cold-start.
10
+ // ── Types ────────────────────────────────────────────────────────────────────
11
+ export const TOPIC_ORDER = [
12
+ "core",
13
+ "projects",
14
+ "skills",
15
+ "hooks",
16
+ "config",
17
+ "maintain",
18
+ "setup",
19
+ "stores",
20
+ "team",
21
+ ];
22
+ function native(fn) {
23
+ return async (args) => {
24
+ const mod = await import("./cli-handlers.js");
25
+ return mod[fn](args);
26
+ };
27
+ }
28
+ // ── Doc topics (not commands) ────────────────────────────────────────────────
29
+ export const ENV_HELP = `Environment variables:
30
+ PHREN_PATH Override phren directory (default: ~/.phren)
31
+ PHREN_PROFILE Active profile name
32
+ PHREN_DEBUG Enable debug logging (set to 1)
33
+
34
+ Embeddings:
35
+ PHREN_OLLAMA_URL Ollama base URL (default: http://localhost:11434, 'off' to disable)
36
+ PHREN_EMBEDDING_API_URL OpenAI-compatible /embeddings endpoint
37
+ PHREN_EMBEDDING_API_KEY API key for embedding endpoint
38
+ PHREN_EMBEDDING_MODEL Embedding model (default: nomic-embed-text)
39
+
40
+ Context injection:
41
+ PHREN_CONTEXT_TOKEN_BUDGET Max tokens injected per prompt (default: 550)
42
+ PHREN_MAX_INJECT_TOKENS Hard cap on total injected tokens (default: 2000)
43
+ PHREN_HOOK_TIMEOUT_MS Hook subprocess timeout in ms (default: 14000)
44
+
45
+ Feature flags:
46
+ PHREN_FEATURE_AUTO_EXTRACT=0 Disable auto memory extraction
47
+ PHREN_FEATURE_AUTO_CAPTURE=1 Extract insights from conversations
48
+ PHREN_FEATURE_SEMANTIC_DEDUP=1 LLM-based dedup on add_finding
49
+ PHREN_FEATURE_HYBRID_SEARCH=0 Disable TF-IDF cosine fallback
50
+
51
+ Run 'phren help all' to see everything.
52
+ `;
53
+ export const DOC_TOPICS = {
54
+ env: ENV_HELP,
55
+ };
56
+ // ── Subcommand catalogues ────────────────────────────────────────────────────
57
+ // Lifted from the old HELP_TOPICS string blocks. Verbatim where preserved.
58
+ const PROJECTS_SUBCOMMANDS = [
59
+ { name: "list", usage: "phren projects list", summary: "List all tracked projects" },
60
+ { name: "configure", usage: "phren projects configure <name> [--ownership <mode>] [--hooks on|off]", summary: "Update per-project settings" },
61
+ { name: "remove", usage: "phren projects remove <name>", summary: "Remove a project" },
62
+ ];
63
+ const SKILLS_SUBCOMMANDS = [
64
+ { name: "list", usage: "phren skills list", summary: "List installed skills" },
65
+ { name: "add", usage: "phren skills add <project> <path>", summary: "Link a skill into a project" },
66
+ { name: "show", usage: "phren skills show <name>", summary: "Show skill content" },
67
+ { name: "resolve", usage: "phren skills resolve <project|global>", summary: "Print resolved skill manifest" },
68
+ { name: "doctor", usage: "phren skills doctor <project|global>", summary: "Diagnose skill visibility" },
69
+ { name: "sync", usage: "phren skills sync <project|global>", summary: "Regenerate skill mirror" },
70
+ { name: "enable", usage: "phren skills enable <project|global> <name>", summary: "Enable a disabled skill" },
71
+ { name: "disable", usage: "phren skills disable <project|global> <name>", summary: "Disable a skill without deleting" },
72
+ { name: "remove", usage: "phren skills remove <project> <name>", summary: "Remove a skill" },
73
+ ];
74
+ const HOOKS_SUBCOMMANDS = [
75
+ { name: "list", usage: "phren hooks list [--project <name>]", summary: "Show hook status per tool" },
76
+ { name: "enable", usage: "phren hooks enable <tool>", summary: "Enable hooks for a tool" },
77
+ { name: "disable", usage: "phren hooks disable <tool>", summary: "Disable hooks for a tool" },
78
+ { name: "add-custom", usage: "phren hooks add-custom <event> <cmd>", summary: "Add a custom hook" },
79
+ { name: "remove-custom", usage: "phren hooks remove-custom <event>", summary: "Remove custom hooks" },
80
+ { name: "errors", usage: "phren hooks errors [--limit <n>]", summary: "Show recent hook errors" },
81
+ ];
82
+ const CONFIG_SUBCOMMANDS = [
83
+ { name: "show", usage: "phren config show [--project <name>]", summary: "Show current config" },
84
+ { name: "policy", usage: "phren config policy [get|set ...]", summary: "Retention, TTL, confidence, decay" },
85
+ { name: "workflow", usage: "phren config workflow [get|set ...]", summary: "Risky-memory thresholds" },
86
+ { name: "proactivity", usage: "phren config proactivity [level]", summary: "Set proactivity level" },
87
+ { name: "task-mode", usage: "phren config task-mode [mode]", summary: "Set task automation mode" },
88
+ { name: "finding-sensitivity", usage: "phren config finding-sensitivity [lvl]", summary: "Set finding capture sensitivity" },
89
+ { name: "index", usage: "phren config index [get|set ...]", summary: "Indexer include/exclude globs" },
90
+ { name: "synonyms", usage: "phren config synonyms [list|add|remove]", summary: "Manage learned synonyms" },
91
+ { name: "project-ownership", usage: "phren config project-ownership [mode]", summary: "Default ownership for new projects" },
92
+ { name: "machines", usage: "phren config machines", summary: "Registered machines" },
93
+ { name: "profiles", usage: "phren config profiles", summary: "Profiles and projects" },
94
+ { name: "telemetry", usage: "phren config telemetry [on|off]", summary: "Opt-in usage telemetry" },
95
+ ];
96
+ const MAINTAIN_SUBCOMMANDS = [
97
+ { name: "govern", usage: "phren maintain govern [project]", summary: "Queue stale memories for review" },
98
+ { name: "prune", usage: "phren maintain prune [project]", summary: "Delete expired entries" },
99
+ { name: "consolidate", usage: "phren maintain consolidate [project]", summary: "Deduplicate findings" },
100
+ { name: "extract", usage: "phren maintain extract [project]", summary: "Mine git/GitHub signals" },
101
+ ];
102
+ const STORE_SUBCOMMANDS = [
103
+ { name: "list", usage: "phren store list", summary: "List registered stores" },
104
+ { name: "add", usage: "phren store add <name> --remote <url>", summary: "Add a team store" },
105
+ { name: "remove", usage: "phren store remove <name>", summary: "Remove a store (local only)" },
106
+ { name: "sync", usage: "phren store sync", summary: "Pull all stores" },
107
+ ];
108
+ const TEAM_SUBCOMMANDS = [
109
+ { name: "init", usage: "phren team init <name> [--remote <url>]", summary: "Create a new team store" },
110
+ { name: "join", usage: "phren team join <git-url> [--name <name>]", summary: "Join an existing team store" },
111
+ { name: "add-project", usage: "phren team add-project <store> <project>", summary: "Add a project to a team store" },
112
+ { name: "list", usage: "phren team list", summary: "List team stores" },
113
+ ];
114
+ // ── Registry ─────────────────────────────────────────────────────────────────
115
+ export const REGISTRY = [
116
+ // Setup (featured: init, quickstart)
117
+ {
118
+ name: "init",
119
+ topic: "setup",
120
+ usage: "phren init [--mode shared|project-local] [--machine <n>] [--profile <n>] [--dry-run] [-y]",
121
+ cheatUsage: "phren init",
122
+ summary: "Set up phren",
123
+ featured: true,
124
+ run: native("runInitCommand"),
125
+ },
126
+ {
127
+ name: "quickstart",
128
+ topic: "setup",
129
+ usage: "phren quickstart",
130
+ summary: "Quick setup: init + project scaffold",
131
+ featured: true,
132
+ run: async () => {
133
+ const { handleQuickstart } = await import("./cli/ops.js");
134
+ await handleQuickstart();
135
+ },
136
+ },
137
+ // Projects (featured: add)
138
+ {
139
+ name: "add",
140
+ topic: "projects",
141
+ usage: "phren add [path] [--ownership <mode>]",
142
+ summary: "Register a project",
143
+ featured: true,
144
+ run: native("runAddCommand"),
145
+ },
146
+ {
147
+ name: "projects",
148
+ topic: "projects",
149
+ usage: "phren projects <subcommand>",
150
+ summary: "Manage tracked projects",
151
+ subcommands: PROJECTS_SUBCOMMANDS,
152
+ run: async (args, ctx) => {
153
+ const { handleProjectsNamespace } = await import("./cli/namespaces.js");
154
+ await handleProjectsNamespace(args, ctx.profile());
155
+ },
156
+ },
157
+ // Core (featured: search, status, doctor, web-ui, tasks, graph, shell)
158
+ {
159
+ name: "search",
160
+ topic: "core",
161
+ usage: "phren search <query>",
162
+ summary: "Search what phren knows",
163
+ featured: true,
164
+ run: async (args, ctx) => {
165
+ const { parseSearchArgs } = await import("./cli/search.js");
166
+ const { handleSearch } = await import("./cli/actions.js");
167
+ const opts = parseSearchArgs(ctx.phrenPath(), args);
168
+ if (!opts)
169
+ return;
170
+ await handleSearch(opts, ctx.profile());
171
+ },
172
+ },
173
+ {
174
+ name: "status",
175
+ topic: "core",
176
+ usage: "phren status",
177
+ summary: "Health check",
178
+ featured: true,
179
+ run: native("runStatusCommand"),
180
+ },
181
+ {
182
+ name: "doctor",
183
+ topic: "core",
184
+ usage: "phren doctor [--fix]",
185
+ summary: "Diagnose and repair",
186
+ featured: true,
187
+ run: async (args) => {
188
+ const { handleDoctor } = await import("./cli/actions.js");
189
+ await handleDoctor(args);
190
+ },
191
+ },
192
+ {
193
+ name: "web-ui",
194
+ topic: "core",
195
+ usage: "phren web-ui [--port <n>]",
196
+ summary: "Open the knowledge graph",
197
+ featured: true,
198
+ run: async (args) => {
199
+ const { handleMemoryUi } = await import("./cli/actions.js");
200
+ await handleMemoryUi(args);
201
+ },
202
+ },
203
+ {
204
+ name: "tasks",
205
+ topic: "core",
206
+ usage: "phren tasks",
207
+ summary: "Cross-project task view",
208
+ featured: true,
209
+ run: async (_args, ctx) => {
210
+ const { handleTaskView } = await import("./cli/ops.js");
211
+ await handleTaskView(ctx.profile());
212
+ },
213
+ },
214
+ {
215
+ name: "graph",
216
+ topic: "core",
217
+ usage: "phren graph",
218
+ summary: "Fragment knowledge graph",
219
+ featured: true,
220
+ run: async (args) => {
221
+ const { handleGraphNamespace } = await import("./cli/graph.js");
222
+ await handleGraphNamespace(args);
223
+ },
224
+ },
225
+ {
226
+ name: "shell",
227
+ topic: "core",
228
+ usage: "phren shell",
229
+ summary: "Interactive memory shell",
230
+ featured: true,
231
+ run: async (args, ctx) => {
232
+ const { handleShell } = await import("./cli/actions.js");
233
+ await handleShell(args, ctx.profile());
234
+ },
235
+ },
236
+ // Other core commands
237
+ {
238
+ name: "add-finding",
239
+ topic: "core",
240
+ usage: 'phren add-finding <project> "<insight>"',
241
+ summary: "Tell phren what you learned",
242
+ run: async (args) => {
243
+ const { handleAddFinding } = await import("./cli/actions.js");
244
+ await handleAddFinding(args[0], args.slice(1).join(" "));
245
+ },
246
+ },
247
+ {
248
+ name: "pin",
249
+ topic: "core",
250
+ usage: 'phren pin <project> "<truth>"',
251
+ summary: "Save a truth (always-inject, never decays)",
252
+ run: async (args) => {
253
+ const { handlePinCanonical } = await import("./cli/actions.js");
254
+ await handlePinCanonical(args[0], args.slice(1).join(" "));
255
+ },
256
+ },
257
+ {
258
+ name: "review",
259
+ topic: "core",
260
+ usage: "phren review [project]",
261
+ summary: "Show review queue",
262
+ run: async (args) => {
263
+ const { handleReviewNamespace } = await import("./cli/namespaces.js");
264
+ await handleReviewNamespace(args);
265
+ },
266
+ },
267
+ {
268
+ name: "session-context",
269
+ topic: "core",
270
+ usage: "phren session-context",
271
+ summary: "Current session state",
272
+ run: async () => {
273
+ const { handleSessionContext } = await import("./cli/actions.js");
274
+ await handleSessionContext();
275
+ },
276
+ },
277
+ {
278
+ name: "sessions",
279
+ topic: "core",
280
+ usage: "phren sessions",
281
+ summary: "List recent sessions",
282
+ run: async (args) => {
283
+ const { handleSessionsView } = await import("./cli/ops.js");
284
+ await handleSessionsView(args);
285
+ },
286
+ },
287
+ {
288
+ name: "task",
289
+ topic: "core",
290
+ usage: "phren task <subcommand>",
291
+ summary: "Manage tasks",
292
+ run: async (args) => {
293
+ const { handleTaskNamespace } = await import("./cli/namespaces.js");
294
+ await handleTaskNamespace(args);
295
+ },
296
+ },
297
+ {
298
+ name: "finding",
299
+ topic: "core",
300
+ usage: "phren finding <subcommand>",
301
+ summary: "Manage findings",
302
+ run: async (args) => {
303
+ const { handleFindingNamespace } = await import("./cli/namespaces.js");
304
+ await handleFindingNamespace(args);
305
+ },
306
+ },
307
+ {
308
+ name: "search-fragments",
309
+ topic: "core",
310
+ usage: "phren search-fragments <query>",
311
+ summary: "Search the named-fragment graph",
312
+ run: async (args, ctx) => {
313
+ const { handleFragmentSearch } = await import("./cli/actions.js");
314
+ await handleFragmentSearch(args, ctx.profile());
315
+ },
316
+ },
317
+ {
318
+ name: "related-docs",
319
+ topic: "core",
320
+ usage: "phren related-docs <entity>",
321
+ summary: "Find docs that share fragments with an entity",
322
+ run: async (args, ctx) => {
323
+ const { handleRelatedDocs } = await import("./cli/actions.js");
324
+ await handleRelatedDocs(args, ctx.profile());
325
+ },
326
+ },
327
+ {
328
+ name: "truths",
329
+ topic: "core",
330
+ usage: "phren truths [project]",
331
+ summary: "Show pinned truths for a project",
332
+ run: async (args) => {
333
+ const { handleTruths } = await import("./cli/actions.js");
334
+ await handleTruths(args[0]);
335
+ },
336
+ },
337
+ {
338
+ name: "promote",
339
+ topic: "core",
340
+ usage: "phren promote <finding> --to <store>",
341
+ summary: "Move a finding from personal to a team store",
342
+ run: async (args) => {
343
+ const { handlePromoteNamespace } = await import("./cli/namespaces.js");
344
+ await handlePromoteNamespace(args);
345
+ },
346
+ },
347
+ // Skills
348
+ {
349
+ name: "skills",
350
+ topic: "skills",
351
+ usage: "phren skills <subcommand>",
352
+ summary: "Manage skills",
353
+ subcommands: SKILLS_SUBCOMMANDS,
354
+ run: async (args, ctx) => {
355
+ const { handleSkillsNamespace } = await import("./cli/namespaces.js");
356
+ await handleSkillsNamespace(args, ctx.profile());
357
+ },
358
+ },
359
+ {
360
+ name: "detect-skills",
361
+ topic: "skills",
362
+ usage: "phren detect-skills [--import]",
363
+ summary: "Find untracked skills in ~/.claude/skills/",
364
+ run: async (args, ctx) => {
365
+ const { handleDetectSkills } = await import("./cli/namespaces.js");
366
+ await handleDetectSkills(args, ctx.profile());
367
+ },
368
+ },
369
+ // Hooks (namespace shares name with topic - distinct concept)
370
+ {
371
+ name: "hooks",
372
+ topic: "hooks",
373
+ usage: "phren hooks <subcommand>",
374
+ summary: "Manage lifecycle hooks",
375
+ subcommands: HOOKS_SUBCOMMANDS,
376
+ run: async (args) => {
377
+ const { handleHooksNamespace } = await import("./cli/namespaces.js");
378
+ await handleHooksNamespace(args);
379
+ },
380
+ },
381
+ // Config
382
+ {
383
+ name: "config",
384
+ topic: "config",
385
+ usage: "phren config <subcommand>",
386
+ summary: "View and update configuration",
387
+ subcommands: CONFIG_SUBCOMMANDS,
388
+ run: async (args) => {
389
+ const { handleConfig } = await import("./cli/config.js");
390
+ await handleConfig(args);
391
+ },
392
+ },
393
+ // Maintain
394
+ {
395
+ name: "maintain",
396
+ topic: "maintain",
397
+ usage: "phren maintain <subcommand>",
398
+ summary: "Memory maintenance operations",
399
+ subcommands: MAINTAIN_SUBCOMMANDS,
400
+ run: async (args) => {
401
+ const { handleMaintain } = await import("./cli/govern.js");
402
+ await handleMaintain(args);
403
+ },
404
+ },
405
+ {
406
+ name: "consolidation-status",
407
+ topic: "maintain",
408
+ usage: "phren consolidation-status",
409
+ summary: "Report findings consolidation health",
410
+ run: async (args) => {
411
+ const { handleConsolidationStatus } = await import("./cli/actions.js");
412
+ await handleConsolidationStatus(args);
413
+ },
414
+ },
415
+ {
416
+ name: "quality-feedback",
417
+ topic: "maintain",
418
+ usage: "phren quality-feedback",
419
+ summary: "Inspect injected-memory feedback",
420
+ run: async (args) => {
421
+ const { handleQualityFeedback } = await import("./cli/actions.js");
422
+ await handleQualityFeedback(args);
423
+ },
424
+ },
425
+ // Setup (the rest)
426
+ {
427
+ name: "mcp-mode",
428
+ topic: "setup",
429
+ usage: "phren mcp-mode [on|off|status]",
430
+ summary: "Toggle MCP integration",
431
+ run: native("runMcpModeCommand"),
432
+ },
433
+ {
434
+ name: "hooks-mode",
435
+ topic: "setup",
436
+ usage: "phren hooks-mode [on|off|status]",
437
+ summary: "Toggle hook execution",
438
+ run: native("runHooksModeCommand"),
439
+ },
440
+ {
441
+ name: "verify",
442
+ topic: "setup",
443
+ usage: "phren verify",
444
+ summary: "Check init completed OK",
445
+ run: native("runVerifyCommand"),
446
+ },
447
+ {
448
+ name: "uninstall",
449
+ topic: "setup",
450
+ usage: "phren uninstall",
451
+ summary: "Remove phren config and hooks",
452
+ run: native("runUninstallCommand"),
453
+ },
454
+ {
455
+ name: "update",
456
+ topic: "setup",
457
+ usage: "phren update [--refresh-starter]",
458
+ summary: "Update to latest version",
459
+ run: async (args) => {
460
+ const { handleUpdate } = await import("./cli/actions.js");
461
+ await handleUpdate(args);
462
+ },
463
+ },
464
+ {
465
+ name: "profile",
466
+ topic: "setup",
467
+ usage: "phren profile <subcommand>",
468
+ summary: "Manage machine-to-profile mappings",
469
+ run: async (args) => {
470
+ const { handleProfileNamespace } = await import("./cli/namespaces.js");
471
+ await handleProfileNamespace(args);
472
+ },
473
+ },
474
+ // Stores
475
+ {
476
+ name: "store",
477
+ topic: "stores",
478
+ usage: "phren store <subcommand>",
479
+ summary: "Manage knowledge stores",
480
+ subcommands: STORE_SUBCOMMANDS,
481
+ run: async (args) => {
482
+ const { handleStoreNamespace } = await import("./cli/namespaces.js");
483
+ await handleStoreNamespace(args);
484
+ },
485
+ },
486
+ // Team
487
+ {
488
+ name: "team",
489
+ topic: "team",
490
+ usage: "phren team <subcommand>",
491
+ summary: "Manage team stores",
492
+ subcommands: TEAM_SUBCOMMANDS,
493
+ run: async (args) => {
494
+ const { handleTeamNamespace } = await import("./cli/team.js");
495
+ await handleTeamNamespace(args);
496
+ },
497
+ },
498
+ // Hidden - internal hooks (called by Claude/Cursor/etc., not by humans)
499
+ {
500
+ name: "hook-prompt",
501
+ topic: "core",
502
+ usage: "phren hook-prompt",
503
+ summary: "Internal: UserPromptSubmit hook",
504
+ hidden: true,
505
+ run: async () => {
506
+ const { handleHookPrompt } = await import("./cli/hooks.js");
507
+ await handleHookPrompt();
508
+ },
509
+ },
510
+ {
511
+ name: "hook-session-start",
512
+ topic: "core",
513
+ usage: "phren hook-session-start",
514
+ summary: "Internal: SessionStart hook",
515
+ hidden: true,
516
+ run: async () => {
517
+ const { handleHookSessionStart } = await import("./cli/hooks.js");
518
+ await handleHookSessionStart();
519
+ },
520
+ },
521
+ {
522
+ name: "hook-stop",
523
+ topic: "core",
524
+ usage: "phren hook-stop",
525
+ summary: "Internal: Stop hook",
526
+ hidden: true,
527
+ run: async () => {
528
+ const { handleHookStop } = await import("./cli/hooks.js");
529
+ await handleHookStop();
530
+ },
531
+ },
532
+ {
533
+ name: "hook-context",
534
+ topic: "core",
535
+ usage: "phren hook-context",
536
+ summary: "Internal: context-injection hook",
537
+ hidden: true,
538
+ run: async () => {
539
+ const { handleHookContext } = await import("./cli/hooks.js");
540
+ await handleHookContext();
541
+ },
542
+ },
543
+ {
544
+ name: "hook-tool",
545
+ topic: "core",
546
+ usage: "phren hook-tool",
547
+ summary: "Internal: PostToolUse hook",
548
+ hidden: true,
549
+ run: async () => {
550
+ const { handleHookTool } = await import("./cli/hooks.js");
551
+ await handleHookTool();
552
+ },
553
+ },
554
+ {
555
+ name: "background-sync",
556
+ topic: "core",
557
+ usage: "phren background-sync",
558
+ summary: "Internal: background git sync",
559
+ hidden: true,
560
+ run: async () => {
561
+ const { handleBackgroundSync } = await import("./cli/hooks.js");
562
+ await handleBackgroundSync();
563
+ },
564
+ },
565
+ {
566
+ name: "background-maintenance",
567
+ topic: "core",
568
+ usage: "phren background-maintenance",
569
+ summary: "Internal: scheduled maintenance",
570
+ hidden: true,
571
+ run: async (args) => {
572
+ const { handleBackgroundMaintenance } = await import("./cli/govern.js");
573
+ await handleBackgroundMaintenance(args[0]);
574
+ },
575
+ },
576
+ {
577
+ name: "debug-injection",
578
+ topic: "core",
579
+ usage: "phren debug-injection",
580
+ summary: "Internal: dump injection rationale",
581
+ hidden: true,
582
+ run: async (args, ctx) => {
583
+ const { handleDebugInjection } = await import("./cli/ops.js");
584
+ await handleDebugInjection(args, ctx.profile());
585
+ },
586
+ },
587
+ {
588
+ name: "inspect-index",
589
+ topic: "core",
590
+ usage: "phren inspect-index",
591
+ summary: "Internal: dump index contents",
592
+ hidden: true,
593
+ run: async (args, ctx) => {
594
+ const { handleInspectIndex } = await import("./cli/ops.js");
595
+ await handleInspectIndex(args, ctx.profile());
596
+ },
597
+ },
598
+ // Hidden - undocumented aliases of namespaced commands (kept for back-compat;
599
+ // user-facing form lives under config / maintain / skills).
600
+ {
601
+ name: "skill-list",
602
+ topic: "skills",
603
+ usage: "phren skill-list",
604
+ summary: "Alias of `phren skills list`",
605
+ hidden: true,
606
+ run: async (_args, ctx) => {
607
+ const { handleSkillList } = await import("./cli/namespaces.js");
608
+ await handleSkillList(ctx.profile());
609
+ },
610
+ },
611
+ {
612
+ name: "policy",
613
+ topic: "config",
614
+ usage: "phren policy [get|set ...]",
615
+ summary: "Alias of `phren config policy`",
616
+ hidden: true,
617
+ run: async (args) => {
618
+ const { handleRetentionPolicy } = await import("./cli/config.js");
619
+ await handleRetentionPolicy(args);
620
+ },
621
+ },
622
+ {
623
+ name: "workflow",
624
+ topic: "config",
625
+ usage: "phren workflow [get|set ...]",
626
+ summary: "Alias of `phren config workflow`",
627
+ hidden: true,
628
+ run: async (args) => {
629
+ const { handleWorkflowPolicy } = await import("./cli/config.js");
630
+ await handleWorkflowPolicy(args);
631
+ },
632
+ },
633
+ {
634
+ name: "index-policy",
635
+ topic: "config",
636
+ usage: "phren index-policy [...]",
637
+ summary: "Alias of `phren config index`",
638
+ hidden: true,
639
+ run: async (args) => {
640
+ const { handleIndexPolicy } = await import("./cli/config.js");
641
+ await handleIndexPolicy(args);
642
+ },
643
+ },
644
+ {
645
+ name: "extract-memories",
646
+ topic: "maintain",
647
+ usage: "phren extract-memories [project]",
648
+ summary: "Alias of `phren maintain extract`",
649
+ hidden: true,
650
+ run: async (args) => {
651
+ const { handleExtractMemories } = await import("./cli/extract.js");
652
+ await handleExtractMemories(args[0]);
653
+ },
654
+ },
655
+ {
656
+ name: "govern-memories",
657
+ topic: "maintain",
658
+ usage: "phren govern-memories [project]",
659
+ summary: "Alias of `phren maintain govern`",
660
+ hidden: true,
661
+ run: async (args) => {
662
+ const { handleGovernMemories } = await import("./cli/govern.js");
663
+ await handleGovernMemories(args[0]);
664
+ },
665
+ },
666
+ {
667
+ name: "prune-memories",
668
+ topic: "maintain",
669
+ usage: "phren prune-memories [project]",
670
+ summary: "Alias of `phren maintain prune`",
671
+ hidden: true,
672
+ run: async (args) => {
673
+ const { handlePruneMemories } = await import("./cli/govern.js");
674
+ await handlePruneMemories(args);
675
+ },
676
+ },
677
+ {
678
+ name: "consolidate-memories",
679
+ topic: "maintain",
680
+ usage: "phren consolidate-memories [project]",
681
+ summary: "Alias of `phren maintain consolidate`",
682
+ hidden: true,
683
+ run: async (args) => {
684
+ const { handleConsolidateMemories } = await import("./cli/govern.js");
685
+ await handleConsolidateMemories(args);
686
+ },
687
+ },
688
+ // Hidden - `phren link` was removed; this prints a removal notice.
689
+ {
690
+ name: "link",
691
+ topic: "setup",
692
+ usage: "phren link",
693
+ summary: "Removed - use `phren init`",
694
+ hidden: true,
695
+ run: native("runLinkRemovedNotice"),
696
+ },
697
+ ];
698
+ // ── Lookup ───────────────────────────────────────────────────────────────────
699
+ export function lookupCommand(name) {
700
+ for (const cmd of REGISTRY) {
701
+ if (cmd.name === name)
702
+ return cmd;
703
+ if (cmd.aliases?.includes(name))
704
+ return cmd;
705
+ }
706
+ return undefined;
707
+ }
708
+ /** Topic IDs available to `phren help <topic>`, including doc topics and `all`. */
709
+ export function helpTopicNames() {
710
+ return [...TOPIC_ORDER, ...Object.keys(DOC_TOPICS), "all"];
711
+ }
712
+ /** Topic IDs that are command groups (excludes doc topics and `all`). */
713
+ export function commandTopics() {
714
+ return TOPIC_ORDER;
715
+ }