@phren/cli 0.0.57 → 0.0.58

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 (166) hide show
  1. package/dist/capabilities/cli.d.ts +2 -0
  2. package/dist/capabilities/index.d.ts +7 -0
  3. package/dist/capabilities/mcp.d.ts +2 -0
  4. package/dist/capabilities/types.d.ts +12 -0
  5. package/dist/capabilities/vscode.d.ts +2 -0
  6. package/dist/capabilities/web-ui.d.ts +2 -0
  7. package/dist/cli/actions.d.ts +16 -0
  8. package/dist/cli/cli.d.ts +3 -0
  9. package/dist/cli/config.d.ts +24 -0
  10. package/dist/cli/extract.d.ts +22 -0
  11. package/dist/cli/govern.d.ts +11 -0
  12. package/dist/cli/graph.d.ts +15 -0
  13. package/dist/cli/hooks-citations.d.ts +8 -0
  14. package/dist/cli/hooks-context.d.ts +34 -0
  15. package/dist/cli/hooks-globs.d.ts +2 -0
  16. package/dist/cli/hooks-output.d.ts +2 -0
  17. package/dist/cli/hooks-session.d.ts +38 -0
  18. package/dist/cli/hooks.d.ts +12 -0
  19. package/dist/cli/namespaces.d.ts +11 -0
  20. package/dist/cli/ops.d.ts +5 -0
  21. package/dist/cli/search.d.ts +38 -0
  22. package/dist/cli/team.d.ts +1 -0
  23. package/dist/cli-hooks-git.d.ts +35 -0
  24. package/dist/cli-hooks-prompt.d.ts +18 -0
  25. package/dist/cli-hooks-session-handlers.d.ts +3 -0
  26. package/dist/cli-hooks-stop.d.ts +11 -0
  27. package/dist/content/archive.d.ts +13 -0
  28. package/dist/content/citation.d.ts +50 -0
  29. package/dist/content/dedup.d.ts +55 -0
  30. package/dist/content/learning.d.ts +29 -0
  31. package/dist/content/metadata.d.ts +107 -0
  32. package/dist/content/validate.d.ts +70 -0
  33. package/dist/core/finding.d.ts +25 -0
  34. package/dist/core/project.d.ts +16 -0
  35. package/dist/core/search.d.ts +13 -0
  36. package/dist/data/access.d.ts +83 -0
  37. package/dist/data/tasks.d.ts +89 -0
  38. package/dist/embedding.d.ts +54 -0
  39. package/dist/entrypoint.d.ts +1 -0
  40. package/dist/finding/context.d.ts +8 -0
  41. package/dist/finding/impact.d.ts +11 -0
  42. package/dist/finding/journal.d.ts +40 -0
  43. package/dist/finding/lifecycle.d.ts +40 -0
  44. package/dist/governance/audit.d.ts +1 -0
  45. package/dist/governance/locks.d.ts +3 -0
  46. package/dist/governance/policy.d.ts +109 -0
  47. package/dist/governance/rbac.d.ts +25 -0
  48. package/dist/governance/scores.d.ts +12 -0
  49. package/dist/hooks.d.ts +59 -0
  50. package/dist/index-query.d.ts +33 -0
  51. package/dist/index.d.ts +2 -0
  52. package/dist/init/config.d.ts +43 -0
  53. package/dist/init/init-configure.d.ts +21 -0
  54. package/dist/init/init-hooks-mode.d.ts +1 -0
  55. package/dist/init/init-mcp-mode.d.ts +1 -0
  56. package/dist/init/init-uninstall.d.ts +3 -0
  57. package/dist/init/init-walkthrough.d.ts +61 -0
  58. package/dist/init/init.d.ts +84 -0
  59. package/dist/init/preferences.d.ts +28 -0
  60. package/dist/init/setup.d.ts +86 -0
  61. package/dist/init/shared.d.ts +13 -0
  62. package/dist/init-bootstrap.d.ts +5 -0
  63. package/dist/init-detect.d.ts +8 -0
  64. package/dist/init-env.d.ts +6 -0
  65. package/dist/init-fresh.d.ts +10 -0
  66. package/dist/init-hooks.d.ts +5 -0
  67. package/dist/init-mcp.d.ts +8 -0
  68. package/dist/init-modes.d.ts +4 -0
  69. package/dist/init-npm.d.ts +10 -0
  70. package/dist/init-project-local.d.ts +2 -0
  71. package/dist/init-semantic.d.ts +4 -0
  72. package/dist/init-types.d.ts +59 -0
  73. package/dist/init-uninstall.d.ts +3 -0
  74. package/dist/init-update.d.ts +10 -0
  75. package/dist/init-walkthrough.d.ts +55 -0
  76. package/dist/link/checksums.d.ts +8 -0
  77. package/dist/link/context.d.ts +7 -0
  78. package/dist/link/doctor.d.ts +2 -0
  79. package/dist/link/link.d.ts +29 -0
  80. package/dist/link/skills.d.ts +47 -0
  81. package/dist/logger.d.ts +9 -0
  82. package/dist/machine-identity.d.ts +4 -0
  83. package/dist/package-metadata.d.ts +4 -0
  84. package/dist/phren-art.d.ts +26 -0
  85. package/dist/phren-core.d.ts +64 -0
  86. package/dist/phren-dotenv.d.ts +2 -0
  87. package/dist/phren-paths.d.ts +60 -0
  88. package/dist/proactivity.d.ts +13 -0
  89. package/dist/profile-store.d.ts +34 -0
  90. package/dist/project-config.d.ts +60 -0
  91. package/dist/project-locator.d.ts +1 -0
  92. package/dist/project-topics.d.ts +122 -0
  93. package/dist/provider-adapters.d.ts +34 -0
  94. package/dist/query-correlation.d.ts +31 -0
  95. package/dist/runtime-profile.d.ts +6 -0
  96. package/dist/session/checkpoints.d.ts +25 -0
  97. package/dist/session/utils.d.ts +43 -0
  98. package/dist/shared/content.d.ts +7 -0
  99. package/dist/shared/data-utils.d.ts +8 -0
  100. package/dist/shared/embedding-cache.d.ts +30 -0
  101. package/dist/shared/fragment-graph.d.ts +60 -0
  102. package/dist/shared/governance.d.ts +4 -0
  103. package/dist/shared/index.d.ts +29 -0
  104. package/dist/shared/ollama.d.ts +28 -0
  105. package/dist/shared/process.d.ts +17 -0
  106. package/dist/shared/retrieval.d.ts +84 -0
  107. package/dist/shared/search-fallback.d.ts +23 -0
  108. package/dist/shared/sqljs.d.ts +5 -0
  109. package/dist/shared/stemmer.d.ts +5 -0
  110. package/dist/shared/vector-index.d.ts +18 -0
  111. package/dist/shared.d.ts +9 -0
  112. package/dist/shell/entry.d.ts +26 -0
  113. package/dist/shell/input.d.ts +57 -0
  114. package/dist/shell/palette.d.ts +13 -0
  115. package/dist/shell/render-api.d.ts +29 -0
  116. package/dist/shell/render.d.ts +50 -0
  117. package/dist/shell/shell.d.ts +61 -0
  118. package/dist/shell/state-store.d.ts +14 -0
  119. package/dist/shell/types.d.ts +29 -0
  120. package/dist/shell/view-list.d.ts +5 -0
  121. package/dist/shell/view.d.ts +34 -0
  122. package/dist/skill/files.d.ts +5 -0
  123. package/dist/skill/registry.d.ts +55 -0
  124. package/dist/skill/state.d.ts +3 -0
  125. package/dist/startup-embedding.d.ts +15 -0
  126. package/dist/status.d.ts +1 -0
  127. package/dist/store-registry.d.ts +60 -0
  128. package/dist/store-routing.d.ts +37 -0
  129. package/dist/task/github.d.ts +22 -0
  130. package/dist/task/hygiene.d.ts +13 -0
  131. package/dist/task/lifecycle.d.ts +26 -0
  132. package/dist/telemetry.d.ts +10 -0
  133. package/dist/test-global-setup.d.ts +14 -0
  134. package/dist/tool-registry.d.ts +14 -0
  135. package/dist/tools/config.d.ts +3 -0
  136. package/dist/tools/data.d.ts +3 -0
  137. package/dist/tools/extract-facts.d.ts +17 -0
  138. package/dist/tools/extract.d.ts +3 -0
  139. package/dist/tools/finding.d.ts +3 -0
  140. package/dist/tools/graph.d.ts +3 -0
  141. package/dist/tools/hooks.d.ts +3 -0
  142. package/dist/tools/memory.d.ts +3 -0
  143. package/dist/tools/ops.d.ts +3 -0
  144. package/dist/tools/search.d.ts +8 -0
  145. package/dist/tools/session.d.ts +44 -0
  146. package/dist/tools/skills.d.ts +3 -0
  147. package/dist/tools/tasks.d.ts +3 -0
  148. package/dist/tools/types.d.ts +50 -0
  149. package/dist/ui/assets.d.ts +2 -0
  150. package/dist/ui/data.d.ts +113 -0
  151. package/dist/ui/graph.d.ts +1 -0
  152. package/dist/ui/memory-ui.d.ts +4 -0
  153. package/dist/ui/page.d.ts +2 -0
  154. package/dist/ui/scripts.d.ts +17 -0
  155. package/dist/ui/server.d.ts +17 -0
  156. package/dist/ui/styles.d.ts +4 -0
  157. package/dist/update.d.ts +9 -0
  158. package/dist/utils-fts.d.ts +12 -0
  159. package/dist/utils-fts.js +450 -0
  160. package/dist/utils-helpers.d.ts +12 -0
  161. package/dist/utils-helpers.js +80 -0
  162. package/dist/utils-paths.d.ts +3 -0
  163. package/dist/utils-paths.js +61 -0
  164. package/dist/utils.d.ts +3 -0
  165. package/dist/utils.js +8 -587
  166. package/package.json +45 -11
@@ -0,0 +1,4 @@
1
+ import type { McpMode } from "./init-walkthrough.js";
2
+ export declare function parseMcpMode(raw?: string): McpMode | undefined;
3
+ export declare function runMcpMode(modeArg?: string): Promise<void>;
4
+ export declare function runHooksMode(modeArg?: string): Promise<void>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Version comparison utilities for phren init and update flows.
3
+ */
4
+ /**
5
+ * Compare two semver strings. Returns true when `current` is strictly newer
6
+ * than `previous`. Pre-release versions (e.g. 1.2.3-rc.1) sort before the
7
+ * corresponding release (1.2.3). Among pre-release tags, comparison is
8
+ * lexicographic.
9
+ */
10
+ export declare function isVersionNewer(current: string, previous?: string): boolean;
@@ -0,0 +1,2 @@
1
+ import type { InitOptions } from "./init-types.js";
2
+ export declare function runProjectLocalInit(opts?: InitOptions): Promise<void>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Semantic search warm-up for init.
3
+ */
4
+ export declare function warmSemanticSearch(phrenPath: string, profile?: string): Promise<string>;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Shared types for init modules. Separated to avoid circular dependencies.
3
+ */
4
+ import type { InstallMode } from "./shared.js";
5
+ import type { ProjectOwnershipMode } from "./project-config.js";
6
+ import type { ProactivityLevel } from "./proactivity.js";
7
+ import type { McpMode, WorkflowRiskSection, StorageLocationChoice } from "./init-walkthrough.js";
8
+ import type { InitProjectDomain, InferredInitScaffold } from "./init/setup.js";
9
+ export type SkillsScope = "global" | "project";
10
+ export interface InitOptions {
11
+ mode?: InstallMode;
12
+ machine?: string;
13
+ profile?: string;
14
+ mcp?: McpMode;
15
+ hooks?: McpMode;
16
+ projectOwnershipDefault?: ProjectOwnershipMode;
17
+ findingsProactivity?: ProactivityLevel;
18
+ taskProactivity?: ProactivityLevel;
19
+ lowConfidenceThreshold?: number;
20
+ riskySections?: WorkflowRiskSection[];
21
+ taskMode?: "off" | "manual" | "suggest" | "auto";
22
+ findingSensitivity?: "minimal" | "conservative" | "balanced" | "aggressive";
23
+ skillsScope?: SkillsScope;
24
+ applyStarterUpdate?: boolean;
25
+ dryRun?: boolean;
26
+ yes?: boolean;
27
+ template?: "python-project" | "monorepo" | "library" | "frontend" | string;
28
+ /** Set by walkthrough to pass project name to init logic */
29
+ _walkthroughProject?: string;
30
+ /** Set by walkthrough for personalized GitHub next-steps output */
31
+ _walkthroughGithub?: {
32
+ username?: string;
33
+ repo: string;
34
+ };
35
+ /** Set by walkthrough to seed project docs/topics by domain */
36
+ _walkthroughDomain?: InitProjectDomain;
37
+ /** Set by walkthrough to seed adaptive project scaffold from current repo content */
38
+ _walkthroughInferredScaffold?: InferredInitScaffold;
39
+ /** Set by walkthrough when user enables auto-capture; triggers writing ~/.phren/.env */
40
+ _walkthroughAutoCapture?: boolean;
41
+ /** Set by walkthrough when user opts into local semantic search */
42
+ _walkthroughSemanticSearch?: boolean;
43
+ /** Set by walkthrough when user enables LLM semantic dedup */
44
+ _walkthroughSemanticDedup?: boolean;
45
+ /** Set by walkthrough when user enables LLM conflict detection */
46
+ _walkthroughSemanticConflict?: boolean;
47
+ /** Set by walkthrough when user provides a git clone URL for existing phren */
48
+ _walkthroughCloneUrl?: string;
49
+ /** Set by walkthrough when the user wants the current repo enrolled immediately */
50
+ _walkthroughBootstrapCurrentProject?: boolean;
51
+ /** Set by walkthrough for the ownership mode selected for the current repo */
52
+ _walkthroughBootstrapOwnership?: ProjectOwnershipMode;
53
+ /** Set by walkthrough to select where phren data is stored */
54
+ _walkthroughStorageChoice?: StorageLocationChoice;
55
+ /** Set by walkthrough to pass resolved storage path to init logic */
56
+ _walkthroughStoragePath?: string;
57
+ /** Set by walkthrough when project-local storage is chosen */
58
+ _walkthroughStorageRepoRoot?: string;
59
+ }
@@ -0,0 +1,3 @@
1
+ export declare function runUninstall(opts?: {
2
+ yes?: boolean;
3
+ }): Promise<void>;
@@ -0,0 +1,10 @@
1
+ import type { InitOptions, SkillsScope } from "./init-types.js";
2
+ export declare function runExistingInstallUpdate(phrenPath: string, opts: InitOptions, params: {
3
+ mcpEnabled: boolean;
4
+ hooksEnabled: boolean;
5
+ skillsScope: SkillsScope;
6
+ ownershipDefault: string;
7
+ syncIntent: "sync" | "local";
8
+ shouldBootstrapCurrentProject: boolean;
9
+ bootstrapOwnership: string;
10
+ }): Promise<void>;
@@ -0,0 +1,55 @@
1
+ import { type InitProjectDomain, type InferredInitScaffold } from "./init/setup.js";
2
+ import { type ProjectOwnershipMode } from "./project-config.js";
3
+ import { type ProactivityLevel } from "./proactivity.js";
4
+ export type WorkflowRiskSection = "Review" | "Stale" | "Conflicts";
5
+ export type StorageLocationChoice = "global" | "project" | "custom";
6
+ export type McpMode = "on" | "off";
7
+ export type WalkthroughChoice<T extends string> = {
8
+ value: T;
9
+ name: string;
10
+ description?: string;
11
+ };
12
+ export type WalkthroughPromptUi = {
13
+ input(message: string, initialValue?: string): Promise<string>;
14
+ confirm(message: string, defaultValue?: boolean): Promise<boolean>;
15
+ select<T extends string>(message: string, choices: WalkthroughChoice<T>[], defaultValue?: T): Promise<T>;
16
+ };
17
+ export type WalkthroughStyle = {
18
+ header: (text: string) => string;
19
+ success: (text: string) => string;
20
+ warning: (text: string) => string;
21
+ };
22
+ export declare function withFallbackColors(style?: {
23
+ header?: (text: string) => string;
24
+ success?: (text: string) => string;
25
+ warning?: (text: string) => string;
26
+ }): WalkthroughStyle;
27
+ export declare function createWalkthroughStyle(): Promise<WalkthroughStyle>;
28
+ export declare function createWalkthroughPrompts(): Promise<WalkthroughPromptUi>;
29
+ export declare function runWalkthrough(phrenPath: string): Promise<{
30
+ storageChoice: StorageLocationChoice;
31
+ storagePath: string;
32
+ storageRepoRoot?: string;
33
+ machine: string;
34
+ profile: string;
35
+ mcp: McpMode;
36
+ hooks: McpMode;
37
+ projectOwnershipDefault: ProjectOwnershipMode;
38
+ findingsProactivity: ProactivityLevel;
39
+ taskProactivity: ProactivityLevel;
40
+ lowConfidenceThreshold: number;
41
+ riskySections: WorkflowRiskSection[];
42
+ taskMode: "off" | "manual" | "suggest" | "auto";
43
+ bootstrapCurrentProject: boolean;
44
+ bootstrapOwnership?: ProjectOwnershipMode;
45
+ ollamaEnabled: boolean;
46
+ autoCaptureEnabled: boolean;
47
+ semanticDedupEnabled: boolean;
48
+ semanticConflictEnabled: boolean;
49
+ findingSensitivity: "minimal" | "conservative" | "balanced" | "aggressive";
50
+ githubUsername?: string;
51
+ githubRepo?: string;
52
+ cloneUrl?: string;
53
+ domain: InitProjectDomain;
54
+ inferredScaffold?: InferredInitScaffold;
55
+ }>;
@@ -0,0 +1,8 @@
1
+ export declare function updateFileChecksums(phrenPath: string, profileName?: string): {
2
+ updated: number;
3
+ files: string[];
4
+ };
5
+ export declare function verifyFileChecksums(phrenPath: string): Array<{
6
+ file: string;
7
+ status: "ok" | "mismatch" | "missing";
8
+ }>;
@@ -0,0 +1,7 @@
1
+ export declare function claudeProjectKey(): string;
2
+ export declare function writeContextDefault(machine: string, profile: string, mcpStatus: string, projects: string[], phrenPath: string): void;
3
+ export declare function writeContextDebugging(machine: string, profile: string, mcpStatus: string, projects: string[], phrenPath: string): void;
4
+ export declare function writeContextPlanning(machine: string, profile: string, mcpStatus: string, projects: string[], phrenPath: string): void;
5
+ export declare function writeContextClean(machine: string, profile: string, mcpStatus: string, projects: string[]): void;
6
+ export declare function readBackNativeMemory(phrenPath: string, projects: string[]): void;
7
+ export declare function rebuildMemory(phrenPath: string, projects: string[]): void;
@@ -0,0 +1,2 @@
1
+ import type { DoctorResult } from "./link.js";
2
+ export declare function runDoctor(phrenPath: string, fix?: boolean, checkData?: boolean): Promise<DoctorResult>;
@@ -0,0 +1,29 @@
1
+ import { type McpMode } from "../init/init.js";
2
+ export { runDoctor } from "./doctor.js";
3
+ export { updateFileChecksums, verifyFileChecksums } from "./checksums.js";
4
+ export { findProjectDir } from "../project-locator.js";
5
+ export { parseSkillFrontmatter, validateSkillFrontmatter, validateSkillsDir, readSkillManifestHooks, } from "./skills.js";
6
+ export type { ManifestHooks, SkillFrontmatter, } from "./skills.js";
7
+ interface LinkOptions {
8
+ machine?: string;
9
+ profile?: string;
10
+ register?: boolean;
11
+ task?: "debugging" | "planning" | "clean";
12
+ allTools?: boolean;
13
+ mcp?: McpMode;
14
+ }
15
+ export interface DoctorResult {
16
+ ok: boolean;
17
+ machine?: string;
18
+ profile?: string;
19
+ checks: Array<{
20
+ name: string;
21
+ ok: boolean;
22
+ detail: string;
23
+ }>;
24
+ }
25
+ export { getMachineName } from "../machine-identity.js";
26
+ export declare function lookupProfile(phrenPath: string, machine: string): string;
27
+ export declare function findProfileFile(phrenPath: string, profileName: string): string | null;
28
+ export declare function getProfileProjects(profileFile: string): string[];
29
+ export declare function runLink(phrenPath: string, opts?: LinkOptions): Promise<void>;
@@ -0,0 +1,47 @@
1
+ export interface ManifestHooks {
2
+ SessionStart?: string;
3
+ UserPromptSubmit?: string;
4
+ Stop?: string;
5
+ }
6
+ export interface SkillFrontmatter {
7
+ name: string;
8
+ description: string;
9
+ version?: string;
10
+ license?: string;
11
+ dependencies?: string[];
12
+ hooks?: Record<string, unknown>;
13
+ command?: string;
14
+ aliases?: string[];
15
+ }
16
+ export interface SkillValidationResult {
17
+ valid: boolean;
18
+ errors: string[];
19
+ frontmatter?: SkillFrontmatter;
20
+ }
21
+ export declare function parseSkillFrontmatter(rawContent: string): {
22
+ frontmatter: Record<string, unknown> | null;
23
+ body: string;
24
+ };
25
+ export declare function validateSkillFrontmatter(content: string, filePath?: string): SkillValidationResult;
26
+ export declare function validateSkillsDir(skillsDir: string): SkillValidationResult[];
27
+ export declare function readSkillManifestHooks(phrenPath: string): ManifestHooks | null;
28
+ export interface SkillCollision {
29
+ skillName: string;
30
+ destPath: string;
31
+ message: string;
32
+ }
33
+ /**
34
+ * Returns true if `destPath` is a symlink whose resolved target lives under
35
+ * `managedRoot`. Used to decide whether phren owns a symlink.
36
+ */
37
+ export declare function isManagedSymlink(destPath: string, managedRoot: string): boolean;
38
+ /**
39
+ * Scan destDir for files that phren would want to link (based on srcDir) but
40
+ * can't because a user-owned file already occupies the destination slot.
41
+ */
42
+ export declare function detectSkillCollisions(srcDir: string, destDir: string, managedRoot: string): SkillCollision[];
43
+ export declare function linkSkillsDir(srcDir: string, destDir: string, managedRoot: string, symlinkFile: (src: string, dest: string, managedRoot: string) => boolean, opts?: {
44
+ phrenPath?: string;
45
+ scope?: string;
46
+ }): SkillCollision[];
47
+ export declare function writeSkillMd(phrenPath: string): void;
@@ -0,0 +1,9 @@
1
+ type LogLevel = "debug" | "info" | "warn" | "error";
2
+ export declare function log(level: LogLevel, tool: string, message: string, extra?: object): void;
3
+ export declare const logger: {
4
+ debug: (tool: string, message: string, extra?: object) => void;
5
+ info: (tool: string, message: string, extra?: object) => void;
6
+ warn: (tool: string, message: string, extra?: object) => void;
7
+ error: (tool: string, message: string, extra?: object) => void;
8
+ };
9
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function machineFilePath(): string;
2
+ export declare function defaultMachineName(): string;
3
+ export declare function getMachineName(): string;
4
+ export declare function persistMachineName(machine: string): void;
@@ -0,0 +1,4 @@
1
+ export declare const ROOT: string;
2
+ export declare const PACKAGE_NAME: string;
3
+ export declare const VERSION: string;
4
+ export declare const PACKAGE_SPEC: string;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Phren character ASCII/Unicode art for CLI presence.
3
+ *
4
+ * Based on the pixel art: purple 8-bit brain with diamond eyes,
5
+ * smile, little legs, and cyan sparkle.
6
+ */
7
+ /**
8
+ * Phren truecolor art (24px wide, generated from phren-transparent.png).
9
+ * Uses half-block ▀ with RGB foreground+background for pixel-faithful rendering.
10
+ * Requires truecolor terminal (most modern terminals support it).
11
+ */
12
+ export declare const PHREN_ART: string[];
13
+ export declare const PHREN_ART_RIGHT: string[];
14
+ export interface PhrenAnimator {
15
+ getFrame(): string[];
16
+ start(): void;
17
+ stop(): void;
18
+ }
19
+ export declare function createPhrenAnimator(options?: {
20
+ facing?: "left" | "right";
21
+ size?: number;
22
+ }): PhrenAnimator;
23
+ /**
24
+ * Return the phren art as a single string, optionally indented.
25
+ */
26
+ export declare function renderPhrenArt(indent?: string): string;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Minimal cross-domain starter set for fragment/conflict detection.
3
+ *
4
+ * Kept intentionally small: only terms that are genuinely universal across
5
+ * disciplines (languages, infra primitives, version control). Framework-specific
6
+ * tools (React, Django, Unity, JUCE, Ansible, ...) are learned dynamically from
7
+ * each project's FINDINGS.md via extractDynamicEntities().
8
+ */
9
+ export declare const UNIVERSAL_TECH_TERMS_RE: RegExp;
10
+ /**
11
+ * Additional fragment patterns beyond CamelCase and acronyms.
12
+ * Each pattern has a named group so callers can identify the fragment type.
13
+ */
14
+ export declare const EXTRA_ENTITY_PATTERNS: Array<{
15
+ re: RegExp;
16
+ label: string;
17
+ }>;
18
+ /** Union of all directory names reserved by phren infrastructure — not valid project names. */
19
+ export declare const RESERVED_PROJECT_DIR_NAMES: Set<string>;
20
+ export declare const EXEC_TIMEOUT_MS = 30000;
21
+ export declare const EXEC_TIMEOUT_QUICK_MS = 10000;
22
+ export declare const PhrenError: {
23
+ readonly PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND";
24
+ readonly INVALID_PROJECT_NAME: "INVALID_PROJECT_NAME";
25
+ readonly FILE_NOT_FOUND: "FILE_NOT_FOUND";
26
+ readonly PERMISSION_DENIED: "PERMISSION_DENIED";
27
+ readonly MALFORMED_JSON: "MALFORMED_JSON";
28
+ readonly MALFORMED_YAML: "MALFORMED_YAML";
29
+ readonly NOT_FOUND: "NOT_FOUND";
30
+ readonly AMBIGUOUS_MATCH: "AMBIGUOUS_MATCH";
31
+ readonly LOCK_TIMEOUT: "LOCK_TIMEOUT";
32
+ readonly EMPTY_INPUT: "EMPTY_INPUT";
33
+ readonly VALIDATION_ERROR: "VALIDATION_ERROR";
34
+ readonly INDEX_ERROR: "INDEX_ERROR";
35
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
36
+ };
37
+ export type PhrenErrorCode = typeof PhrenError[keyof typeof PhrenError];
38
+ export type PhrenResult<T> = {
39
+ ok: true;
40
+ data: T;
41
+ } | {
42
+ ok: false;
43
+ error: string;
44
+ code?: PhrenErrorCode;
45
+ };
46
+ export declare function phrenOk<T>(data: T): PhrenResult<T>;
47
+ export declare function phrenErr<T>(error: string, code?: PhrenErrorCode): PhrenResult<T>;
48
+ export declare function forwardErr<T>(result: PhrenResult<unknown>): PhrenResult<T>;
49
+ export declare function parsePhrenErrorCode(msg: string): PhrenErrorCode | undefined;
50
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
51
+ /** Shallow-merge data onto defaults so missing keys get filled in. */
52
+ export declare function withDefaults<T extends object>(data: Partial<T>, defaults: T): T;
53
+ /** All valid finding type tags — used for writes, search filters, and hook extraction */
54
+ export declare const FINDING_TYPES: readonly ["decision", "pitfall", "pattern", "tradeoff", "architecture", "bug"];
55
+ export type FindingType = (typeof FINDING_TYPES)[number];
56
+ /** Searchable finding tags (same set as FINDING_TYPES) */
57
+ export declare const FINDING_TAGS: readonly ["decision", "pitfall", "pattern", "tradeoff", "architecture", "bug"];
58
+ export type FindingTag = FindingType;
59
+ /** Canonical set of known observation tags — derived from FINDING_TYPES */
60
+ export declare const KNOWN_OBSERVATION_TAGS: Set<string>;
61
+ /** Document types in the FTS index */
62
+ export declare const DOC_TYPES: readonly ["claude", "findings", "reference", "skills", "summary", "task", "changelog", "canonical", "review-queue", "skill", "other"];
63
+ export type DocType = (typeof DOC_TYPES)[number];
64
+ export declare function capCache<K, V>(cache: Map<K, V>): void;
@@ -0,0 +1,2 @@
1
+ export declare function bootstrapPhrenDotEnv(phrenPath?: string): string | null;
2
+ export declare function resetPhrenDotEnvBootstrapForTests(): void;
@@ -0,0 +1,60 @@
1
+ export type InstallMode = "shared" | "project-local";
2
+ export type SyncMode = "managed-git" | "workspace-git";
3
+ export interface PhrenRootManifest {
4
+ version: 1;
5
+ installMode: InstallMode;
6
+ syncMode: SyncMode;
7
+ workspaceRoot?: string;
8
+ primaryProject?: string;
9
+ }
10
+ export interface InstallContext extends PhrenRootManifest {
11
+ phrenPath: string;
12
+ }
13
+ export declare const ROOT_MANIFEST_FILENAME = "phren.root.yaml";
14
+ export declare function homeDir(): string;
15
+ export declare function homePath(...parts: string[]): string;
16
+ export declare function expandHomePath(input: string): string;
17
+ export declare function defaultPhrenPath(): string;
18
+ export declare function rootManifestPath(phrenPath: string): string;
19
+ export declare function atomicWriteText(filePath: string, content: string): void;
20
+ export declare function readRootManifest(phrenPath: string): PhrenRootManifest | null;
21
+ export declare function writeRootManifest(phrenPath: string, manifest: PhrenRootManifest): void;
22
+ export declare function resolveInstallContext(phrenPath: string): InstallContext;
23
+ export declare function findNearestPhrenPath(startDir?: string): string | null;
24
+ export declare function findPhrenPath(): string | null;
25
+ export declare function ensurePhrenPath(): string;
26
+ export declare function findPhrenPathWithArg(arg?: string): string;
27
+ export declare function isProjectLocalMode(phrenPath: string): boolean;
28
+ export declare function runtimeDir(phrenPath: string): string;
29
+ /** Unlink a file, ignoring ENOENT. Rethrows any other error. */
30
+ export declare function tryUnlink(filePath: string): void;
31
+ export declare function sessionsDir(phrenPath: string): string;
32
+ export declare function runtimeFile(phrenPath: string, name: string): string;
33
+ export declare function installPreferencesFile(phrenPath: string): string;
34
+ export declare function runtimeHealthFile(phrenPath: string): string;
35
+ export declare function shellStateFile(phrenPath: string): string;
36
+ export declare function sessionMetricsFile(phrenPath: string): string;
37
+ export declare function memoryScoresFile(phrenPath: string): string;
38
+ export declare function memoryUsageLogFile(phrenPath: string): string;
39
+ export declare function sessionMarker(phrenPath: string, name: string): string;
40
+ export declare function debugLog(msg: string): void;
41
+ /** Always-on structured error log (no PHREN_DEBUG gate). */
42
+ export declare function errorLog(tool: string, msg: string): void;
43
+ export declare function appendIndexEvent(phrenPath: string, event: Record<string, unknown>): void;
44
+ /** Resolve the canonical findings file for a project directory. */
45
+ export declare function resolveFindingsPath(projectDir: string): string | undefined;
46
+ export declare function normalizeProjectNameForCreate(name: string): string;
47
+ export declare function findProjectNameCaseInsensitive(phrenPath: string, name: string): string | null;
48
+ export declare function findArchivedProjectNameCaseInsensitive(phrenPath: string, name: string): string | null;
49
+ export declare function getProjectDirs(phrenPath: string, profile?: string): string[];
50
+ export declare function collectNativeMemoryFiles(): Array<{
51
+ project: string;
52
+ file: string;
53
+ fullPath: string;
54
+ }>;
55
+ export declare function computePhrenLiveStateToken(phrenPath: string): string;
56
+ export declare function getPhrenPath(): string;
57
+ export declare function qualityMarkers(phrenPathLocal: string): {
58
+ done: string;
59
+ lock: string;
60
+ };
@@ -0,0 +1,13 @@
1
+ export declare const PROACTIVITY_LEVELS: readonly ["high", "medium", "low"];
2
+ export type ProactivityLevel = typeof PROACTIVITY_LEVELS[number];
3
+ export declare function getProactivityLevel(explicitPhrenPath?: string): ProactivityLevel;
4
+ export declare function getProactivityLevelForFindings(explicitPhrenPath?: string): ProactivityLevel;
5
+ export declare function getProactivityLevelForTask(explicitPhrenPath?: string): ProactivityLevel;
6
+ export declare function hasExplicitFindingSignal(...texts: Array<string | undefined | null>): boolean;
7
+ export declare function hasExplicitTaskSignal(...texts: Array<string | undefined | null>): boolean;
8
+ export declare function shouldAutoCaptureFindingsForLevel(level: ProactivityLevel, ...texts: Array<string | undefined | null>): boolean;
9
+ export declare function shouldAutoCaptureTaskForLevel(level: ProactivityLevel, ...texts: Array<string | undefined | null>): boolean;
10
+ export declare function hasExecutionIntent(...texts: Array<string | undefined | null>): boolean;
11
+ export declare function hasDiscoveryIntent(...texts: Array<string | undefined | null>): boolean;
12
+ export declare function hasSuppressTaskIntent(...texts: Array<string | undefined | null>): boolean;
13
+ export declare function hasCodeChangeContext(...texts: Array<string | undefined | null>): boolean;
@@ -0,0 +1,34 @@
1
+ import { type PhrenResult } from "./shared.js";
2
+ import type { RetentionPolicyPatch } from "./governance/policy.js";
3
+ export interface ProfilePolicyDefaults {
4
+ findingSensitivity?: "minimal" | "conservative" | "balanced" | "aggressive";
5
+ proactivity?: "high" | "medium" | "low";
6
+ proactivityFindings?: "high" | "medium" | "low";
7
+ proactivityTask?: "high" | "medium" | "low";
8
+ taskMode?: "off" | "manual" | "suggest" | "auto";
9
+ retentionPolicy?: RetentionPolicyPatch;
10
+ workflowPolicy?: {
11
+ lowConfidenceThreshold?: number;
12
+ riskySections?: Array<"Review" | "Stale" | "Conflicts">;
13
+ };
14
+ }
15
+ export interface ProfileInfo {
16
+ name: string;
17
+ file: string;
18
+ projects: string[];
19
+ defaults?: ProfilePolicyDefaults;
20
+ }
21
+ export interface ProjectCard {
22
+ name: string;
23
+ summary: string;
24
+ docs: string[];
25
+ }
26
+ export declare function resolveActiveProfile(phrenPath: string, requestedProfile?: string): PhrenResult<string | undefined>;
27
+ export declare function getDefaultMachineAlias(): string;
28
+ export declare function listMachines(phrenPath: string): PhrenResult<Record<string, string>>;
29
+ export declare function setMachineProfile(phrenPath: string, machine: string, profile: string): PhrenResult<string>;
30
+ export declare function getActiveProfileDefaults(phrenPath: string, profile?: string): ProfilePolicyDefaults | undefined;
31
+ export declare function listProfiles(phrenPath: string): PhrenResult<ProfileInfo[]>;
32
+ export declare function addProjectToProfile(phrenPath: string, profile: string, project: string): PhrenResult<string>;
33
+ export declare function removeProjectFromProfile(phrenPath: string, profile: string, project: string): PhrenResult<string>;
34
+ export declare function listProjectCards(phrenPath: string, profile?: string): ProjectCard[];
@@ -0,0 +1,60 @@
1
+ import type { RetentionPolicyPatch } from "./governance/policy.js";
2
+ export declare const PROJECT_OWNERSHIP_MODES: readonly ["phren-managed", "detached", "repo-managed"];
3
+ export type ProjectOwnershipMode = typeof PROJECT_OWNERSHIP_MODES[number];
4
+ export interface ProjectMcpServerEntry {
5
+ command: string;
6
+ args?: string[];
7
+ env?: Record<string, string>;
8
+ }
9
+ export interface ProjectConfigOverrides {
10
+ findingSensitivity?: "minimal" | "conservative" | "balanced" | "aggressive";
11
+ proactivity?: "high" | "medium" | "low";
12
+ proactivityFindings?: "high" | "medium" | "low";
13
+ proactivityTask?: "high" | "medium" | "low";
14
+ taskMode?: "off" | "manual" | "suggest" | "auto";
15
+ retentionPolicy?: RetentionPolicyPatch;
16
+ workflowPolicy?: {
17
+ lowConfidenceThreshold?: number;
18
+ riskySections?: Array<"Review" | "Stale" | "Conflicts">;
19
+ };
20
+ }
21
+ export interface ProjectAccessControl {
22
+ admins?: string[];
23
+ contributors?: string[];
24
+ readers?: string[];
25
+ }
26
+ export interface ProjectConfig {
27
+ ownership?: ProjectOwnershipMode;
28
+ sourcePath?: string;
29
+ skills?: boolean;
30
+ hooks?: {
31
+ enabled?: boolean;
32
+ UserPromptSubmit?: boolean;
33
+ Stop?: boolean;
34
+ SessionStart?: boolean;
35
+ PostToolUse?: boolean;
36
+ };
37
+ mcpServers?: Record<string, ProjectMcpServerEntry>;
38
+ config?: ProjectConfigOverrides;
39
+ access?: ProjectAccessControl;
40
+ }
41
+ export declare const PROJECT_HOOK_EVENTS: readonly ["UserPromptSubmit", "Stop", "SessionStart", "PostToolUse"];
42
+ export type ProjectHookEvent = typeof PROJECT_HOOK_EVENTS[number];
43
+ type ProjectHookConfig = NonNullable<ProjectConfig["hooks"]>;
44
+ export declare function parseProjectOwnershipMode(raw: string | undefined | null): ProjectOwnershipMode | undefined;
45
+ export declare function projectConfigPath(phrenPath: string, project: string): string;
46
+ export declare function clearProjectConfigCache(): void;
47
+ export declare function readProjectConfig(phrenPath: string, project: string): ProjectConfig;
48
+ export declare function writeProjectConfig(phrenPath: string, project: string, patch: Partial<ProjectConfig>): ProjectConfig;
49
+ export declare function updateProjectConfigOverrides(phrenPath: string, project: string, updater: (current: ProjectConfigOverrides) => ProjectConfigOverrides): ProjectConfig;
50
+ export declare function getProjectSourcePath(phrenPath: string, project: string, config?: ProjectConfig): string | undefined;
51
+ export declare function getProjectOwnershipDefault(phrenPath: string): ProjectOwnershipMode;
52
+ export declare function getProjectOwnershipMode(phrenPath: string, project: string, config?: ProjectConfig): ProjectOwnershipMode;
53
+ export declare function isProjectHookEnabled(phrenPath: string, project: string | null | undefined, event: ProjectHookEvent, config?: ProjectConfig): boolean;
54
+ /**
55
+ * Remove a per-project hook override, restoring inheritance from global config.
56
+ * Pass event to clear a specific event override; omit to clear the whole hooks block.
57
+ */
58
+ export declare function clearProjectHookOverride(phrenPath: string, project: string, event?: string): ProjectConfig;
59
+ export declare function writeProjectHookConfig(phrenPath: string, project: string, patch: Partial<ProjectHookConfig>): ProjectConfig;
60
+ export {};
@@ -0,0 +1 @@
1
+ export declare function findProjectDir(name: string): string | null;