@phren/cli 0.1.13 → 0.1.15

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 (75) hide show
  1. package/README.md +1 -1
  2. package/dist/capabilities/cli.js +1 -1
  3. package/dist/capabilities/mcp.js +1 -1
  4. package/dist/capabilities/vscode.js +1 -1
  5. package/dist/capabilities/web-ui.js +1 -1
  6. package/dist/cli/extract.js +2 -1
  7. package/dist/cli/govern.js +3 -2
  8. package/dist/cli/hooks-session.d.ts +18 -36
  9. package/dist/cli/hooks-session.js +21 -1482
  10. package/dist/cli/namespaces-findings.d.ts +1 -0
  11. package/dist/cli/namespaces-findings.js +208 -0
  12. package/dist/cli/namespaces-profile.d.ts +1 -0
  13. package/dist/cli/namespaces-profile.js +76 -0
  14. package/dist/cli/namespaces-projects.d.ts +1 -0
  15. package/dist/cli/namespaces-projects.js +371 -0
  16. package/dist/cli/namespaces-review.d.ts +1 -0
  17. package/dist/cli/namespaces-review.js +45 -0
  18. package/dist/cli/namespaces-skills.d.ts +4 -0
  19. package/dist/cli/namespaces-skills.js +550 -0
  20. package/dist/cli/namespaces-store.d.ts +2 -0
  21. package/dist/cli/namespaces-store.js +367 -0
  22. package/dist/cli/namespaces-tasks.d.ts +1 -0
  23. package/dist/cli/namespaces-tasks.js +369 -0
  24. package/dist/cli/namespaces-utils.d.ts +4 -0
  25. package/dist/cli/namespaces-utils.js +47 -0
  26. package/dist/cli/namespaces.d.ts +7 -11
  27. package/dist/cli/namespaces.js +8 -2011
  28. package/dist/cli/ops.js +2 -2
  29. package/dist/cli/session-background.d.ts +3 -0
  30. package/dist/cli/session-background.js +176 -0
  31. package/dist/cli/session-git.d.ts +17 -0
  32. package/dist/cli/session-git.js +181 -0
  33. package/dist/cli/session-metrics.d.ts +2 -0
  34. package/dist/cli/session-metrics.js +67 -0
  35. package/dist/cli/session-start.d.ts +3 -0
  36. package/dist/cli/session-start.js +290 -0
  37. package/dist/cli/session-stop.d.ts +8 -0
  38. package/dist/cli/session-stop.js +468 -0
  39. package/dist/cli/session-tool-hook.d.ts +18 -0
  40. package/dist/cli/session-tool-hook.js +376 -0
  41. package/dist/cli/team.js +7 -5
  42. package/dist/cli-hooks-session-handlers.js +2 -1
  43. package/dist/content/archive.js +2 -1
  44. package/dist/content/dedup.js +6 -5
  45. package/dist/content/learning.js +3 -2
  46. package/dist/content/validate.js +2 -1
  47. package/dist/core/project.js +2 -1
  48. package/dist/data/access.d.ts +1 -0
  49. package/dist/data/access.js +11 -10
  50. package/dist/finding/journal.js +2 -1
  51. package/dist/finding/lifecycle.js +2 -1
  52. package/dist/governance/policy.d.ts +2 -0
  53. package/dist/governance/policy.js +2 -2
  54. package/dist/hooks.js +38 -2
  55. package/dist/init/init-uninstall.js +2 -1
  56. package/dist/init/setup.js +5 -4
  57. package/dist/init-uninstall.js +2 -1
  58. package/dist/link/checksums.js +2 -1
  59. package/dist/link/context.js +2 -1
  60. package/dist/link/doctor.js +4 -3
  61. package/dist/link/link.js +2 -1
  62. package/dist/phren-paths.js +3 -2
  63. package/dist/profile-store.d.ts +1 -0
  64. package/dist/profile-store.js +15 -16
  65. package/dist/project-topics.js +4 -3
  66. package/dist/shell/input.js +3 -3
  67. package/dist/status.js +2 -2
  68. package/dist/tools/data.js +4 -4
  69. package/dist/tools/extract.js +2 -1
  70. package/dist/tools/finding.js +9 -9
  71. package/dist/tools/search.js +4 -4
  72. package/dist/tools/session.js +2 -2
  73. package/dist/ui/data.js +6 -5
  74. package/dist/ui/server.js +3 -3
  75. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@ MCP server that indexes your personal phren and exposes it to AI agents via full
4
4
 
5
5
  On startup it walks your phren directory, reads all `.md` files, and builds an in-memory SQLite FTS5 index.
6
6
 
7
- Public surface: 53 MCP tools across 12 modules (search, tasks, findings, memory, data, graph, sessions, ops/review, skills, hooks, config, extraction).
7
+ Public surface: 54 MCP tools across 12 modules (search, tasks, findings, memory, data, graph, sessions, ops/review, skills, hooks, config, extraction).
8
8
 
9
9
  Notable shipped capabilities:
10
10
  - finding lifecycle tools: `supersede_finding`, `retract_finding`, `resolve_contradiction`, `get_contradictions`
@@ -1,6 +1,6 @@
1
1
  export const cliManifest = {
2
2
  surface: "cli",
3
- version: "0.0.19",
3
+ version: "0.1.15",
4
4
  actions: {
5
5
  // Finding management
6
6
  "finding.add": { implemented: true, handler: "cli-actions.ts:handleAddFinding" },
@@ -1,6 +1,6 @@
1
1
  export const mcpManifest = {
2
2
  surface: "mcp",
3
- version: "0.0.19",
3
+ version: "0.1.15",
4
4
  actions: {
5
5
  // Finding management
6
6
  "finding.add": { implemented: true, handler: "index.ts:add_finding" },
@@ -1,6 +1,6 @@
1
1
  export const vscodeManifest = {
2
2
  surface: "vscode",
3
- version: "0.0.19",
3
+ version: "0.1.15",
4
4
  actions: {
5
5
  // Finding management
6
6
  "finding.add": { implemented: true, handler: "extension.ts:phren.addFinding" },
@@ -1,6 +1,6 @@
1
1
  export const webUiManifest = {
2
2
  surface: "web-ui",
3
- version: "0.0.19",
3
+ version: "0.1.15",
4
4
  actions: {
5
5
  // Finding management
6
6
  "finding.add": { implemented: false, reason: "Web UI is read-only for findings (review queue only)" },
@@ -4,6 +4,7 @@ import { detectProject } from "../shared/index.js";
4
4
  import { commandExists } from "../hooks.js";
5
5
  import { runGit as runGitShared, isFeatureEnabled, clampInt, errorMessage, resolveExecCommand } from "../utils.js";
6
6
  import { appendFindingJournal, compactFindingJournals } from "../finding/journal.js";
7
+ import { FINDINGS_FILENAME } from "../data/access.js";
7
8
  import { getProactivityLevelForTask, getProactivityLevelForFindings, shouldAutoCaptureFindingsForLevel } from "../proactivity.js";
8
9
  import * as fs from "fs";
9
10
  import * as os from "os";
@@ -276,7 +277,7 @@ export async function handleExtractMemories(projectArg, cwdArg, silent = false,
276
277
  continue;
277
278
  const line = `${c.text}${c.commit ? ` (source commit ${c.commit.slice(0, 8)})` : ""}`;
278
279
  if (c.text.startsWith("CI failure pattern:")) {
279
- const key = entryScoreKey(project, "FINDINGS.md", line);
280
+ const key = entryScoreKey(project, FINDINGS_FILENAME, line);
280
281
  recordFeedback(getPhrenPath(), key, "regression");
281
282
  }
282
283
  if (c.score >= threshold) {
@@ -5,6 +5,7 @@ import * as fs from "fs";
5
5
  import * as path from "path";
6
6
  import { handleExtractMemories } from "./extract.js";
7
7
  import { errorMessage } from "../utils.js";
8
+ import { FINDINGS_FILENAME } from "../data/access.js";
8
9
  import { logger } from "../logger.js";
9
10
  import { compactFindingJournals } from "../finding/journal.js";
10
11
  import { resolveRuntimeProfile } from "../runtime-profile.js";
@@ -72,7 +73,7 @@ export async function handleGovernMemories(projectArg, silent = false, dryRun =
72
73
  let conflictCount = 0;
73
74
  let reviewCount = 0;
74
75
  for (const project of projects) {
75
- const learningsPath = path.join(getPhrenPath(), project, "FINDINGS.md");
76
+ const learningsPath = path.join(getPhrenPath(), project, FINDINGS_FILENAME);
76
77
  if (!fs.existsSync(learningsPath))
77
78
  continue;
78
79
  const content = fs.readFileSync(learningsPath, "utf8");
@@ -162,7 +163,7 @@ export async function handlePruneMemories(args = []) {
162
163
  }
163
164
  let ttlExpired = 0;
164
165
  for (const project of projects) {
165
- const learningsPath = path.join(getPhrenPath(), project, "FINDINGS.md");
166
+ const learningsPath = path.join(getPhrenPath(), project, FINDINGS_FILENAME);
166
167
  if (!fs.existsSync(learningsPath))
167
168
  continue;
168
169
  const content = fs.readFileSync(learningsPath, "utf8");
@@ -1,38 +1,20 @@
1
- import type { SelectedSnippet } from "../shared/retrieval.js";
2
- export type { HookContext } from "./hooks-context.js";
3
- export { buildHookContext, handleGuardSkip } from "./hooks-context.js";
4
- export declare function getUntrackedProjectNotice(phrenPath: string, cwd: string): string | null;
5
- export declare function getSessionStartOnboardingNotice(phrenPath: string, cwd: string, activeProject: string | null): string | null;
6
- export interface GitContext {
7
- branch: string;
8
- changedFiles: Set<string>;
9
- }
10
- export declare function getGitContext(cwd?: string): GitContext | null;
11
- export declare function trackSessionMetrics(phrenPathLocal: string, sessionId: string, selected: SelectedSnippet[]): void;
12
- export declare function resolveSubprocessArgs(command: string): string[] | null;
13
- export declare function handleHookSessionStart(): Promise<void>;
14
1
  /**
15
- * Extract potential insights from conversation text using keyword heuristics.
16
- * Returns lines that contain insight-signal words and look like actionable knowledge.
2
+ * Session lifecycle hooks — orchestrator module.
3
+ *
4
+ * This file re-exports all session hook functionality from the split modules:
5
+ * - session-git.ts — Git context and command helpers
6
+ * - session-metrics.ts — Session metrics tracking
7
+ * - session-background.ts — Background sync/maintenance scheduling
8
+ * - session-start.ts — SessionStart hook handler + onboarding notices
9
+ * - session-stop.ts — Stop hook handler + background sync + conversation capture
10
+ * - session-tool-hook.ts — PostToolUse and context hook handlers + tool finding extraction
17
11
  */
18
- export declare function extractConversationInsights(text: string): string[];
19
- export declare function filterConversationInsightsForProactivity(insights: string[], level?: "high" | "medium" | "low"): string[];
20
- export declare function handleHookStop(): Promise<void>;
21
- export declare function handleBackgroundSync(): Promise<void>;
22
- export declare function handleHookContext(): Promise<void>;
23
- export declare function handleHookTool(): Promise<void>;
24
- interface LearningCandidate {
25
- text: string;
26
- confidence: number;
27
- explicit?: boolean;
28
- }
29
- export declare function filterToolFindingsForProactivity(candidates: Array<{
30
- text: string;
31
- confidence: number;
32
- explicit?: boolean;
33
- }>, level?: "high" | "medium" | "low"): Array<{
34
- text: string;
35
- confidence: number;
36
- explicit?: boolean;
37
- }>;
38
- export declare function extractToolFindings(toolName: string, input: Record<string, unknown>, responseStr: string): LearningCandidate[];
12
+ export type { HookContext } from "./hooks-context.js";
13
+ export { buildHookContext, handleGuardSkip } from "./hooks-context.js";
14
+ export type { GitContext } from "./session-git.js";
15
+ export { getGitContext } from "./session-git.js";
16
+ export { trackSessionMetrics } from "./session-metrics.js";
17
+ export { resolveSubprocessArgs } from "./session-background.js";
18
+ export { getUntrackedProjectNotice, getSessionStartOnboardingNotice, handleHookSessionStart, } from "./session-start.js";
19
+ export { extractConversationInsights, filterConversationInsightsForProactivity, handleHookStop, handleBackgroundSync, } from "./session-stop.js";
20
+ export { handleHookContext, handleHookTool, extractToolFindings, filterToolFindingsForProactivity, } from "./session-tool-hook.js";