@phren/cli 0.2.15 → 0.3.0
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/README.md +2 -2
- package/dist/agent-instructions.d.ts +12 -0
- package/dist/agent-instructions.js +52 -0
- package/dist/bridge/agent-hook-stores.d.ts +32 -0
- package/dist/bridge/agent-hook-stores.js +67 -0
- package/dist/bridge/agent-hooks.d.ts +195 -2
- package/dist/bridge/agent-hooks.js +1049 -38
- package/dist/bridge/canary.d.ts +27 -0
- package/dist/bridge/canary.js +189 -0
- package/dist/bridge/changes.d.ts +57 -0
- package/dist/bridge/changes.js +403 -0
- package/dist/bridge/client.d.ts +3 -0
- package/dist/bridge/client.js +36 -0
- package/dist/bridge/code-note.d.ts +23 -0
- package/dist/bridge/code-note.js +51 -0
- package/dist/bridge/code-routes.d.ts +151 -0
- package/dist/bridge/code-routes.js +442 -0
- package/dist/bridge/codex-threads.d.ts +27 -0
- package/dist/bridge/codex-threads.js +442 -0
- package/dist/bridge/command.d.ts +7 -0
- package/dist/bridge/command.js +50 -5
- package/dist/bridge/computer-names.d.ts +4 -0
- package/dist/bridge/computer-names.js +16 -0
- package/dist/bridge/computers.d.ts +9 -0
- package/dist/bridge/computers.js +111 -0
- package/dist/bridge/context.d.ts +14 -0
- package/dist/bridge/context.js +149 -0
- package/dist/bridge/dispatch-command.d.ts +3 -0
- package/dist/bridge/dispatch-command.js +93 -0
- package/dist/bridge/dispatch-hosts.d.ts +23 -0
- package/dist/bridge/dispatch-hosts.js +25 -0
- package/dist/bridge/dispatch-returns.d.ts +125 -0
- package/dist/bridge/dispatch-returns.js +283 -0
- package/dist/bridge/dispatch-tree.d.ts +54 -0
- package/dist/bridge/dispatch-tree.js +198 -0
- package/dist/bridge/dispatch.d.ts +210 -0
- package/dist/bridge/dispatch.js +286 -0
- package/dist/bridge/enroll.d.ts +31 -0
- package/dist/bridge/enroll.js +236 -0
- package/dist/bridge/fanout-messages.d.ts +74 -0
- package/dist/bridge/fanout-messages.js +230 -0
- package/dist/bridge/fanouts.d.ts +160 -0
- package/dist/bridge/fanouts.js +702 -0
- package/dist/bridge/file-range.d.ts +16 -0
- package/dist/bridge/file-range.js +90 -0
- package/dist/bridge/files.d.ts +20 -0
- package/dist/bridge/files.js +54 -0
- package/dist/bridge/git-publish.d.ts +23 -0
- package/dist/bridge/git-publish.js +145 -0
- package/dist/bridge/git-worktrees.d.ts +21 -0
- package/dist/bridge/git-worktrees.js +150 -0
- package/dist/bridge/git.d.ts +54 -0
- package/dist/bridge/git.js +552 -0
- package/dist/bridge/grants.d.ts +31 -0
- package/dist/bridge/grants.js +181 -0
- package/dist/bridge/hand-off.d.ts +79 -0
- package/dist/bridge/hand-off.js +151 -0
- package/dist/bridge/health.d.ts +128 -0
- package/dist/bridge/health.js +260 -0
- package/dist/bridge/herdr.d.ts +79 -6
- package/dist/bridge/herdr.js +292 -27
- package/dist/bridge/hook-main.js +2 -0
- package/dist/bridge/install.d.ts +28 -1
- package/dist/bridge/install.js +225 -38
- package/dist/bridge/launch-worktree.d.ts +21 -0
- package/dist/bridge/launch-worktree.js +70 -0
- package/dist/bridge/limits.d.ts +20 -0
- package/dist/bridge/limits.js +65 -0
- package/dist/bridge/locate.d.ts +16 -0
- package/dist/bridge/locate.js +75 -0
- package/dist/bridge/metrics.d.ts +29 -0
- package/dist/bridge/metrics.js +71 -0
- package/dist/bridge/model-switch.d.ts +35 -0
- package/dist/bridge/model-switch.js +250 -0
- package/dist/bridge/models.d.ts +46 -0
- package/dist/bridge/models.js +257 -0
- package/dist/bridge/opencode-approvals.d.ts +6 -0
- package/dist/bridge/opencode-approvals.js +60 -0
- package/dist/bridge/pane-text.d.ts +15 -0
- package/dist/bridge/pane-text.js +23 -0
- package/dist/bridge/peers.d.ts +27 -0
- package/dist/bridge/peers.js +130 -0
- package/dist/bridge/projects.d.ts +12 -1
- package/dist/bridge/projects.js +268 -20
- package/dist/bridge/protocol.d.ts +35 -2
- package/dist/bridge/protocol.js +61 -7
- package/dist/bridge/push.d.ts +83 -0
- package/dist/bridge/push.js +199 -0
- package/dist/bridge/questions.d.ts +38 -0
- package/dist/bridge/questions.js +205 -0
- package/dist/bridge/schedule-format.d.ts +103 -0
- package/dist/bridge/schedule-format.js +266 -0
- package/dist/bridge/schedule-launch.d.ts +11 -0
- package/dist/bridge/schedule-launch.js +169 -0
- package/dist/bridge/schedule-watch.d.ts +54 -0
- package/dist/bridge/schedule-watch.js +255 -0
- package/dist/bridge/schedules.d.ts +48 -0
- package/dist/bridge/schedules.js +205 -0
- package/dist/bridge/server-launch.d.ts +14 -0
- package/dist/bridge/server-launch.js +218 -0
- package/dist/bridge/server-overview.d.ts +45 -0
- package/dist/bridge/server-overview.js +102 -0
- package/dist/bridge/server-pane-routes.d.ts +36 -0
- package/dist/bridge/server-pane-routes.js +479 -0
- package/dist/bridge/server-routes.d.ts +108 -0
- package/dist/bridge/server-routes.js +556 -0
- package/dist/bridge/server-stream.d.ts +46 -0
- package/dist/bridge/server-stream.js +253 -0
- package/dist/bridge/server.d.ts +3 -15
- package/dist/bridge/server.js +162 -264
- package/dist/bridge/session-servers.d.ts +24 -0
- package/dist/bridge/session-servers.js +136 -0
- package/dist/bridge/side-questions.d.ts +74 -0
- package/dist/bridge/side-questions.js +252 -0
- package/dist/bridge/simulators.d.ts +28 -0
- package/dist/bridge/simulators.js +198 -0
- package/dist/bridge/speech-transcribe.d.ts +24 -0
- package/dist/bridge/speech-transcribe.js +124 -0
- package/dist/bridge/speech.d.ts +35 -0
- package/dist/bridge/speech.js +98 -0
- package/dist/bridge/steps.d.ts +13 -0
- package/dist/bridge/steps.js +222 -0
- package/dist/bridge/tab-activity.d.ts +18 -0
- package/dist/bridge/tab-activity.js +99 -0
- package/dist/bridge/terminal-choice.d.ts +64 -0
- package/dist/bridge/terminal-choice.js +281 -0
- package/dist/bridge/transcript-claude.d.ts +22 -0
- package/dist/bridge/transcript-claude.js +353 -0
- package/dist/bridge/transcript-codex.d.ts +30 -0
- package/dist/bridge/transcript-codex.js +282 -0
- package/dist/bridge/transcript-copilot.d.ts +4 -0
- package/dist/bridge/transcript-copilot.js +14 -0
- package/dist/bridge/transcript-opencode.d.ts +5 -0
- package/dist/bridge/transcript-opencode.js +26 -0
- package/dist/bridge/transcript-preview.d.ts +96 -0
- package/dist/bridge/transcript-preview.js +491 -0
- package/dist/bridge/transcripts.d.ts +81 -4
- package/dist/bridge/transcripts.js +332 -67
- package/dist/bridge/transport.d.ts +3 -0
- package/dist/bridge/transport.js +96 -15
- package/dist/bridge/uploads.d.ts +15 -0
- package/dist/bridge/uploads.js +44 -2
- package/dist/bridge/usage.d.ts +124 -0
- package/dist/bridge/usage.js +859 -0
- package/dist/bridge-hook.mjs +46545 -21051
- package/dist/cli/actions.js +14 -1
- package/dist/cli/config-policy.js +25 -0
- package/dist/cli/config-proactivity.d.ts +3 -1
- package/dist/cli/config-proactivity.js +35 -3
- package/dist/cli/config.js +4 -1
- package/dist/cli/extract.d.ts +0 -8
- package/dist/cli/extract.js +4 -7
- package/dist/cli/govern.js +5 -2
- package/dist/cli/hooks-globs.js +1 -1
- package/dist/cli/hooks.d.ts +1 -1
- package/dist/cli/hooks.js +9 -7
- package/dist/cli/namespaces-projects.js +12 -6
- package/dist/cli/namespaces-store.js +37 -6
- package/dist/cli/namespaces-tasks.js +1 -1
- package/dist/cli/schedules.d.ts +1 -0
- package/dist/cli/schedules.js +164 -0
- package/dist/cli/session-background.js +1 -1
- package/dist/cli/session-git.d.ts +8 -5
- package/dist/cli/session-git.js +45 -120
- package/dist/cli/session-start.js +3 -1
- package/dist/cli/session-stop.js +19 -8
- package/dist/cli/team.js +13 -10
- package/dist/cli-handlers.d.ts +1 -1
- package/dist/cli-handlers.js +8 -4
- package/dist/cli-help.d.ts +5 -4
- package/dist/cli-help.js +15 -15
- package/dist/cli-registry.d.ts +4 -1
- package/dist/cli-registry.js +119 -6
- package/dist/content/archive.js +2 -2
- package/dist/content/citation.d.ts +11 -0
- package/dist/content/citation.js +18 -0
- package/dist/content/learning.js +2 -0
- package/dist/content/summarize.d.ts +14 -15
- package/dist/content/summarize.js +60 -5
- package/dist/content/validate.d.ts +17 -4
- package/dist/content/validate.js +200 -122
- package/dist/core/project-registry.d.ts +26 -0
- package/dist/core/project-registry.js +573 -0
- package/dist/core/project.js +2 -3
- package/dist/data/access.d.ts +16 -1
- package/dist/data/access.js +31 -3
- package/dist/data/tasks.d.ts +18 -3
- package/dist/data/tasks.js +8 -7
- package/dist/entrypoint.js +44 -10
- package/dist/fanout/adapters/claude.d.ts +2 -0
- package/dist/fanout/adapters/claude.js +7 -0
- package/dist/fanout/adapters/codex.d.ts +2 -0
- package/dist/fanout/adapters/codex.js +9 -0
- package/dist/fanout/adapters/opencode.d.ts +4 -0
- package/dist/fanout/adapters/opencode.js +9 -0
- package/dist/fanout/adapters/types.d.ts +21 -0
- package/dist/fanout/adapters/types.js +3 -0
- package/dist/fanout/command.d.ts +2 -0
- package/dist/fanout/command.js +78 -0
- package/dist/fanout/launcher.d.ts +27 -0
- package/dist/fanout/launcher.js +156 -0
- package/dist/fanout/opencode-serve.d.ts +24 -0
- package/dist/fanout/opencode-serve.js +191 -0
- package/dist/fanout/picker.d.ts +91 -0
- package/dist/fanout/picker.js +51 -0
- package/dist/fanout/usage.d.ts +5 -0
- package/dist/fanout/usage.js +51 -0
- package/dist/fanout/watchdog.d.ts +10 -0
- package/dist/fanout/watchdog.js +27 -0
- package/dist/filenames.d.ts +9 -0
- package/dist/filenames.js +11 -0
- package/dist/finding/context.js +4 -22
- package/dist/generated/memory-ui-graph.browser.js +525 -419
- package/dist/governance/policy-constants.d.ts +11 -0
- package/dist/governance/policy-constants.js +9 -0
- package/dist/governance/policy.d.ts +5 -8
- package/dist/governance/policy.js +11 -8
- package/dist/graph-core/camera.d.ts +24 -0
- package/dist/graph-core/camera.js +18 -0
- package/dist/graph-core/index.d.ts +2 -0
- package/dist/graph-core/index.js +2 -0
- package/dist/graph-core/labels.d.ts +77 -0
- package/dist/graph-core/labels.js +124 -0
- package/dist/graph-core/model.d.ts +13 -0
- package/dist/graph-core/model.js +33 -0
- package/dist/graph-core/types.d.ts +2 -0
- package/dist/home-paths.d.ts +7 -0
- package/dist/home-paths.js +21 -0
- package/dist/hooks.d.ts +3 -15
- package/dist/hooks.js +14 -1
- package/dist/index.js +24 -2
- package/dist/init/guard-globals.d.ts +1 -1
- package/dist/init/guard-globals.js +4 -4
- package/dist/init/init-configure.js +3 -3
- package/dist/init/init-uninstall.js +15 -5
- package/dist/init/init-walkthrough.js +1 -1
- package/dist/init/init.js +26 -6
- package/dist/init/management-preset.d.ts +1 -1
- package/dist/init/management-preset.js +2 -2
- package/dist/init/preferences.js +1 -1
- package/dist/init/self-wiring.js +1 -1
- package/dist/init/setup.d.ts +3 -26
- package/dist/init/setup.js +68 -593
- package/dist/init/shared.js +2 -0
- package/dist/init/store-gitignore.d.ts +1 -6
- package/dist/init/store-gitignore.js +2 -8
- package/dist/init/teardown.d.ts +1 -1
- package/dist/init/teardown.js +2 -2
- package/dist/link/context-imports.d.ts +15 -0
- package/dist/link/context-imports.js +101 -0
- package/dist/link/context.js +1 -1
- package/dist/link/doctor.d.ts +22 -1
- package/dist/link/doctor.js +128 -58
- package/dist/link/link.js +29 -61
- package/dist/link/refresh.js +2 -2
- package/dist/link/skills.js +26 -5
- package/dist/machine-identity.d.ts +3 -0
- package/dist/machine-identity.js +6 -0
- package/dist/mcp/profile.d.ts +2 -19
- package/dist/mcp/profile.js +64 -22
- package/dist/memory-ui-graph.runtime.js +525 -419
- package/dist/modules/code-package.d.ts +16 -0
- package/dist/modules/code-package.js +160 -0
- package/dist/modules/command.d.ts +2 -0
- package/dist/modules/command.js +67 -0
- package/dist/modules/config.d.ts +4 -0
- package/dist/modules/config.js +70 -0
- package/dist/modules/manifest.d.ts +41 -0
- package/dist/modules/manifest.js +1 -0
- package/dist/modules/provision.d.ts +3 -0
- package/dist/modules/provision.js +84 -0
- package/dist/modules/registry.d.ts +16 -0
- package/dist/modules/registry.js +250 -0
- package/dist/modules/runtime.d.ts +15 -0
- package/dist/modules/runtime.js +59 -0
- package/dist/package-metadata.js +10 -2
- package/dist/phren-dotenv.js +4 -2
- package/dist/phren-paths.d.ts +3 -2
- package/dist/phren-paths.js +4 -5
- package/dist/profile-store.js +43 -8
- package/dist/project-config.d.ts +19 -1
- package/dist/project-config.js +29 -3
- package/dist/project-topics.d.ts +1 -0
- package/dist/project-topics.js +13 -10
- package/dist/provider-adapters.js +1 -4
- package/dist/query-correlation.js +6 -6
- package/dist/session/artifacts.js +5 -5
- package/dist/session/checkpoints.js +5 -0
- package/dist/session/utils.d.ts +2 -2
- package/dist/session/utils.js +6 -6
- package/dist/shared/content.d.ts +1 -1
- package/dist/shared/content.js +1 -1
- package/dist/shared/data-utils.js +1 -1
- package/dist/shared/fragment-graph.d.ts +1 -1
- package/dist/shared/fragment-graph.js +5 -5
- package/dist/shared/index.js +48 -7
- package/dist/shared/retrieval.d.ts +18 -3
- package/dist/shared/retrieval.js +101 -12
- package/dist/shared/search-fallback.js +4 -6
- package/dist/shared/sqljs.d.ts +2 -0
- package/dist/shared/sqljs.js +4 -2
- package/dist/shared.d.ts +0 -1
- package/dist/shared.js +0 -1
- package/dist/shell/input.d.ts +1 -5
- package/dist/shell/input.js +16 -10
- package/dist/shell/palette.d.ts +2 -2
- package/dist/shell/palette.js +3 -7
- package/dist/shell/render.d.ts +3 -1
- package/dist/shell/render.js +4 -4
- package/dist/shell/shell.js +4 -1
- package/dist/shell/types.d.ts +1 -0
- package/dist/shell/types.js +4 -0
- package/dist/shell/view.d.ts +0 -4
- package/dist/shell/view.js +19 -27
- package/dist/skill/registry.js +25 -17
- package/dist/skill/state.d.ts +3 -0
- package/dist/skill/state.js +13 -7
- package/dist/status.js +38 -17
- package/dist/store-registry.d.ts +44 -18
- package/dist/store-registry.js +169 -60
- package/dist/store-weight.d.ts +1 -6
- package/dist/store-weight.js +4 -2
- package/dist/sync/auth-doctor.d.ts +8 -0
- package/dist/sync/auth-doctor.js +27 -0
- package/dist/sync/auth.d.ts +27 -0
- package/dist/sync/auth.js +114 -0
- package/dist/sync/conflict-resolve.d.ts +9 -0
- package/dist/sync/conflict-resolve.js +146 -0
- package/dist/sync/git-state.d.ts +4 -0
- package/dist/sync/git-state.js +49 -0
- package/dist/sync/outcome.d.ts +34 -0
- package/dist/sync/outcome.js +57 -0
- package/dist/sync/pull.d.ts +15 -7
- package/dist/sync/pull.js +84 -35
- package/dist/sync/store-merge.d.ts +29 -0
- package/dist/sync/store-merge.js +137 -0
- package/dist/sync/task-merge.d.ts +22 -0
- package/dist/sync/task-merge.js +158 -0
- package/dist/task/github.js +1 -1
- package/dist/task/lifecycle.d.ts +5 -0
- package/dist/task/lifecycle.js +67 -23
- package/dist/terminal-text.d.ts +5 -0
- package/dist/terminal-text.js +11 -0
- package/dist/test-global-setup.js +7 -0
- package/dist/tool-registry.d.ts +1 -1
- package/dist/tool-registry.js +3 -1
- package/dist/tools/code.d.ts +3 -0
- package/dist/tools/code.js +186 -0
- package/dist/tools/config.js +8 -0
- package/dist/tools/data.js +14 -7
- package/dist/tools/dispatch.d.ts +2 -0
- package/dist/tools/dispatch.js +66 -0
- package/dist/tools/finding.d.ts +11 -0
- package/dist/tools/finding.js +180 -123
- package/dist/tools/ops.js +5 -2
- package/dist/tools/search.js +21 -8
- package/dist/tools/session.js +21 -22
- package/dist/tools/tasks.js +8 -2
- package/dist/tools/types.d.ts +2 -2
- package/dist/tools/types.js +2 -2
- package/dist/ui/assets.js +1 -1
- package/dist/ui/data.js +14 -15
- package/dist/ui/deep-void.d.ts +1 -1
- package/dist/ui/deep-void.js +0 -1
- package/dist/ui/graph-chrome.d.ts +1 -1
- package/dist/ui/graph-chrome.js +51 -0
- package/dist/ui/page.js +5 -5
- package/dist/ui/scripts.js +67 -30
- package/dist/ui/server.js +52 -7
- package/dist/update.js +22 -11
- package/dist/utils-fts.js +1 -0
- package/dist/utils-helpers.d.ts +7 -0
- package/dist/utils-helpers.js +17 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +49 -7
- package/plugins/opencode/phren-transcript.js +340 -0
- package/starter/README.md +4 -4
- package/starter/global/{CLAUDE.md → AGENTS.md} +2 -2
- package/starter/global/skills/conductor/SKILL.md +106 -0
- package/starter/global/skills/fanout/SKILL.md +20 -0
- package/starter/global/skills/phren-discover/SKILL.md +6 -6
- package/starter/global/skills/phren-init/SKILL.md +4 -4
- package/starter/global/skills/phren-sync/SKILL.md +3 -3
- package/starter/templates/frontend/reference/README.md +1 -1
- package/starter/templates/library/reference/README.md +1 -1
- package/starter/templates/monorepo/reference/README.md +1 -1
- package/starter/templates/python-project/reference/README.md +1 -1
- /package/starter/templates/frontend/{CLAUDE.md → AGENTS.md} +0 -0
- /package/starter/templates/library/{CLAUDE.md → AGENTS.md} +0 -0
- /package/starter/templates/monorepo/{CLAUDE.md → AGENTS.md} +0 -0
- /package/starter/templates/python-project/{CLAUDE.md → AGENTS.md} +0 -0
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* home skill symlinks under ~/.claude/skills are not covered, and
|
|
26
26
|
* `repairPreexistingInstall()` — which rewrites the same global surfaces and
|
|
27
27
|
* runs on every SessionStart hook, from the web UI, and from `phren doctor` —
|
|
28
|
-
* never calls into this module at all. The
|
|
28
|
+
* never calls into this module at all. The AGENTS.md symlink case is handled
|
|
29
29
|
* at its own write site in init/setup.ts (repairGlobalClaudeSymlink) using the
|
|
30
30
|
* helpers exported here, so it holds on those paths too.
|
|
31
31
|
*/
|
|
@@ -68,13 +68,13 @@ export function isLiveForeignPhrenRoot(candidate, newPhrenPath) {
|
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Recover the phren root that owns a `~/.claude/CLAUDE.md` symlink, from the
|
|
71
|
-
* link target's shape (`<root>/global/
|
|
71
|
+
* link target's shape (`<root>/global/AGENTS.md`). Returns null when the
|
|
72
72
|
* target is not structured like a phren global file, i.e. it belongs to
|
|
73
73
|
* something that is not phren and must not be touched.
|
|
74
74
|
*/
|
|
75
75
|
export function phrenRootFromGlobalClaudeLink(target) {
|
|
76
76
|
const resolved = path.resolve(target);
|
|
77
|
-
if (
|
|
77
|
+
if (!["AGENTS.md", "CLAUDE.md"].includes(path.basename(resolved)))
|
|
78
78
|
return null;
|
|
79
79
|
const globalDir = path.dirname(resolved);
|
|
80
80
|
if (path.basename(globalDir) !== "global")
|
|
@@ -153,7 +153,7 @@ export function findConflictingGlobalWiring(newPhrenPath) {
|
|
|
153
153
|
if (wrapperPath) {
|
|
154
154
|
record(`~/.local/bin/${process.platform === "win32" ? "phren.cmd" : "phren"} wrapper`, wrapperPath);
|
|
155
155
|
}
|
|
156
|
-
// ~/.claude/CLAUDE.md is a symlink into <root>/global/
|
|
156
|
+
// ~/.claude/CLAUDE.md is a symlink into <root>/global/AGENTS.md, i.e. it is
|
|
157
157
|
// global wiring exactly like the wrapper is — but it was not scanned, so
|
|
158
158
|
// `phren init` with a throwaway PHREN_PATH would repoint the user's real one
|
|
159
159
|
// and the guard would report no conflict.
|
|
@@ -305,7 +305,7 @@ export async function warmSemanticSearch(phrenPath, profile) {
|
|
|
305
305
|
export async function runProjectLocalInit(opts = {}) {
|
|
306
306
|
const detectedRoot = detectProjectDir(process.cwd(), path.join(process.cwd(), ".phren")) || process.cwd();
|
|
307
307
|
const hasWorkspaceMarker = fs.existsSync(path.join(detectedRoot, ".git")) ||
|
|
308
|
-
fs.existsSync(path.join(detectedRoot, "
|
|
308
|
+
fs.existsSync(path.join(detectedRoot, "AGENTS.md")) ||
|
|
309
309
|
fs.existsSync(path.join(detectedRoot, "AGENTS.md")) ||
|
|
310
310
|
fs.existsSync(path.join(detectedRoot, ".claude", "CLAUDE.md"));
|
|
311
311
|
if (!hasWorkspaceMarker) {
|
|
@@ -356,8 +356,8 @@ export async function runProjectLocalInit(opts = {}) {
|
|
|
356
356
|
"",
|
|
357
357
|
].join("\n"));
|
|
358
358
|
}
|
|
359
|
-
if (!fs.existsSync(path.join(phrenPath, "global", "
|
|
360
|
-
atomicWriteText(path.join(phrenPath, "global", "
|
|
359
|
+
if (!fs.existsSync(path.join(phrenPath, "global", "AGENTS.md"))) {
|
|
360
|
+
atomicWriteText(path.join(phrenPath, "global", "AGENTS.md"), "# Global Context\n\nRepo-local Phren instructions shared across this workspace.\n");
|
|
361
361
|
}
|
|
362
362
|
const created = bootstrapFromExisting(phrenPath, workspaceRoot, { ownership: ownershipDefault });
|
|
363
363
|
applyOnboardingPreferences(phrenPath, opts);
|
|
@@ -175,8 +175,14 @@ function filterAgentHooks(filePath, commandField) {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
async function promptUninstallConfirm(phrenPath) {
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
// No TTY is not consent: agent shells, CI steps and pipes all lack one, and
|
|
179
|
+
// they are exactly where an accidental `phren uninstall` must not delete the
|
|
180
|
+
// store. --yes is the explicit opt-in.
|
|
181
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
182
|
+
log(`\n Refusing to delete ${phrenPath} without confirmation.`);
|
|
183
|
+
log(" This session is non-interactive; re-run with --yes to confirm.");
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
180
186
|
// Show summary of what will be deleted
|
|
181
187
|
try {
|
|
182
188
|
const projectDirs = getProjectDirs(phrenPath);
|
|
@@ -242,7 +248,11 @@ export async function runUninstall(opts = {}) {
|
|
|
242
248
|
});
|
|
243
249
|
});
|
|
244
250
|
})()
|
|
245
|
-
:
|
|
251
|
+
: (() => {
|
|
252
|
+
log("\n Refusing to remove phren config without confirmation.");
|
|
253
|
+
log(" This session is non-interactive; re-run with --yes to confirm.");
|
|
254
|
+
return false;
|
|
255
|
+
})());
|
|
246
256
|
if (!confirmed) {
|
|
247
257
|
log("Uninstall cancelled.");
|
|
248
258
|
return;
|
|
@@ -429,12 +439,12 @@ export async function runUninstall(opts = {}) {
|
|
|
429
439
|
catch (err) {
|
|
430
440
|
debugLog(`uninstall: cleanup failed for ${contextFile}: ${errorMessage(err)}`);
|
|
431
441
|
}
|
|
432
|
-
// Remove global
|
|
442
|
+
// Remove global AGENTS.md symlink (created by linkGlobal -> ~/.claude/CLAUDE.md)
|
|
433
443
|
const globalClaudeLink = homePath(".claude", "CLAUDE.md");
|
|
434
444
|
try {
|
|
435
445
|
if (fs.lstatSync(globalClaudeLink).isSymbolicLink()) {
|
|
436
446
|
fs.unlinkSync(globalClaudeLink);
|
|
437
|
-
log(` Removed global
|
|
447
|
+
log(` Removed global AGENTS.md symlink (${globalClaudeLink})`);
|
|
438
448
|
}
|
|
439
449
|
}
|
|
440
450
|
catch {
|
|
@@ -303,7 +303,7 @@ export async function runWalkthrough(phrenPath, options) {
|
|
|
303
303
|
}
|
|
304
304
|
else {
|
|
305
305
|
log("Choose who owns repo-facing instruction files for projects you add.");
|
|
306
|
-
log(" phren-managed: Phren may mirror
|
|
306
|
+
log(" phren-managed: Phren may mirror AGENTS.md plus vendor compatibility files into the repo");
|
|
307
307
|
log(" detached: Phren keeps its own docs but does not write into the repo");
|
|
308
308
|
log(" repo-managed: keep the repo's existing CLAUDE/AGENTS files as canonical");
|
|
309
309
|
log(" Change later: phren config project-ownership <mode>");
|
package/dist/init/init.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { nonInteractiveGitEnv } from "../utils-helpers.js";
|
|
2
|
+
import { migrateInstalledModules, moduleEnabled } from "../modules/runtime.js";
|
|
3
|
+
import { initializeModules } from "../modules/config.js";
|
|
4
|
+
import { skillEnabled } from "../modules/provision.js";
|
|
5
|
+
import { reconcileModuleHooks } from "../bridge/install.js";
|
|
1
6
|
/**
|
|
2
7
|
* CLI orchestrator for phren init, mcp-mode, hooks-mode, and uninstall.
|
|
3
8
|
* Delegates to focused helpers in init-config, init-setup, init-preferences,
|
|
@@ -215,6 +220,7 @@ export async function runInit(opts = {}) {
|
|
|
215
220
|
log(`\nCloning existing phren from ${opts._walkthroughCloneUrl}...`);
|
|
216
221
|
try {
|
|
217
222
|
execFileSync("git", ["clone", opts._walkthroughCloneUrl, phrenPath], {
|
|
223
|
+
env: nonInteractiveGitEnv(),
|
|
218
224
|
stdio: ["ignore", "pipe", "pipe"],
|
|
219
225
|
timeout: 60_000,
|
|
220
226
|
});
|
|
@@ -329,7 +335,7 @@ export async function runInit(opts = {}) {
|
|
|
329
335
|
log(` Would offer to add current project directory (${pendingBootstrap.path})`);
|
|
330
336
|
}
|
|
331
337
|
if (opts.applyStarterUpdate) {
|
|
332
|
-
log(` Apply starter template updates to global/
|
|
338
|
+
log(` Apply starter template updates to global/AGENTS.md and global skills`);
|
|
333
339
|
}
|
|
334
340
|
log(` Run post-init verification checks`);
|
|
335
341
|
log(`\nDry run complete.\n`);
|
|
@@ -362,6 +368,12 @@ export async function runInit(opts = {}) {
|
|
|
362
368
|
log(` Updated storage binding: ${change}`);
|
|
363
369
|
}
|
|
364
370
|
}
|
|
371
|
+
if (hasExistingInstall)
|
|
372
|
+
migrateInstalledModules(phrenPath);
|
|
373
|
+
else {
|
|
374
|
+
initializeModules(phrenPath);
|
|
375
|
+
log("Memory only. Enable what you need with phren modules enable <name>.");
|
|
376
|
+
}
|
|
365
377
|
if (hasExistingInstall) {
|
|
366
378
|
writeRootManifest(phrenPath, {
|
|
367
379
|
version: 1,
|
|
@@ -381,16 +393,18 @@ export async function runInit(opts = {}) {
|
|
|
381
393
|
log(` MCP mode: ${mcpLabel}`);
|
|
382
394
|
log(` Hooks mode: ${hooksLabel}`);
|
|
383
395
|
log(` Default project ownership: ${ownershipDefault}`);
|
|
384
|
-
|
|
396
|
+
if (moduleEnabled(phrenPath, "tasks"))
|
|
397
|
+
log(` Task mode: ${getWorkflowPolicy(phrenPath).taskMode}`);
|
|
385
398
|
log(` Git repo: ${existingGitRepo.detail}`);
|
|
386
399
|
// Always reconfigure MCP and hooks (picks up new features on upgrade)
|
|
387
400
|
configureMcpTargets(phrenPath, { mcpEnabled, hooksEnabled, caps: managementCaps }, "Updated");
|
|
388
401
|
configureHooksIfEnabled(phrenPath, hooksEnabled, "Updated", managementCaps);
|
|
402
|
+
await reconcileModuleHooks(phrenPath);
|
|
389
403
|
const prefs = readInstallPreferences(phrenPath);
|
|
390
404
|
const previousVersion = prefs.installedVersion;
|
|
391
405
|
if (isVersionNewer(VERSION, previousVersion)) {
|
|
392
406
|
log(`\n Starter template update available: v${previousVersion} -> v${VERSION}`);
|
|
393
|
-
log(` Run \`phren init --apply-starter-update\` to refresh global/
|
|
407
|
+
log(` Run \`phren init --apply-starter-update\` to refresh global/AGENTS.md and global skills.`);
|
|
394
408
|
}
|
|
395
409
|
if (opts.applyStarterUpdate) {
|
|
396
410
|
const updated = applyStarterTemplateUpdates(phrenPath);
|
|
@@ -479,6 +493,10 @@ export async function runInit(opts = {}) {
|
|
|
479
493
|
function copyDir(src, dest) {
|
|
480
494
|
fs.mkdirSync(dest, { recursive: true });
|
|
481
495
|
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
496
|
+
if (entry.name === "tasks.md" && !moduleEnabled(phrenPath, "tasks"))
|
|
497
|
+
continue;
|
|
498
|
+
if (path.basename(src) === "skills" && !skillEnabled(phrenPath, entry.name))
|
|
499
|
+
continue;
|
|
482
500
|
const srcPath = path.join(src, entry.name);
|
|
483
501
|
const destPath = path.join(dest, entry.name);
|
|
484
502
|
if (entry.isDirectory()) {
|
|
@@ -525,7 +543,7 @@ export async function runInit(opts = {}) {
|
|
|
525
543
|
});
|
|
526
544
|
fs.mkdirSync(path.join(phrenPath, "global", "skills"), { recursive: true });
|
|
527
545
|
fs.mkdirSync(path.join(phrenPath, "profiles"), { recursive: true });
|
|
528
|
-
atomicWriteText(path.join(phrenPath, "global", "
|
|
546
|
+
atomicWriteText(path.join(phrenPath, "global", "AGENTS.md"), `# Global Context\n\nThis file is loaded in every project.\n\n## General preferences\n\n<!-- Your coding style, preferred tools, things Claude should always know -->\n`);
|
|
529
547
|
if (useTemplateProject) {
|
|
530
548
|
const projectDir = path.join(phrenPath, firstProjectName);
|
|
531
549
|
if (opts.template && applyTemplate(projectDir, opts.template, firstProjectName)) {
|
|
@@ -568,7 +586,8 @@ export async function runInit(opts = {}) {
|
|
|
568
586
|
log(` MCP mode: ${mcpLabel}`);
|
|
569
587
|
log(` Hooks mode: ${hooksLabel}`);
|
|
570
588
|
log(` Default project ownership: ${ownershipDefault}`);
|
|
571
|
-
|
|
589
|
+
if (moduleEnabled(phrenPath, "tasks"))
|
|
590
|
+
log(` Task mode: ${getWorkflowPolicy(phrenPath).taskMode}`);
|
|
572
591
|
log(` Git repo: ${localGitRepo.detail}`);
|
|
573
592
|
if (repaired.removedLegacyProjects > 0) {
|
|
574
593
|
log(` Removed ${repaired.removedLegacyProjects} legacy starter project entr${repaired.removedLegacyProjects === 1 ? "y" : "ies"} from profiles.`);
|
|
@@ -580,6 +599,7 @@ export async function runInit(opts = {}) {
|
|
|
580
599
|
// Configure MCP for all detected AI coding tools and hooks
|
|
581
600
|
configureMcpTargets(phrenPath, { mcpEnabled, hooksEnabled, caps: managementCaps }, "Configured");
|
|
582
601
|
configureHooksIfEnabled(phrenPath, hooksEnabled, "Configured", managementCaps);
|
|
602
|
+
await reconcileModuleHooks(phrenPath);
|
|
583
603
|
writeInstallPreferences(phrenPath, { mcpEnabled, hooksEnabled, skillsScope, installedVersion: VERSION, syncIntent });
|
|
584
604
|
// Post-init verification
|
|
585
605
|
log(`\nVerifying setup...`);
|
|
@@ -588,7 +608,7 @@ export async function runInit(opts = {}) {
|
|
|
588
608
|
log(` ${check.ok ? "pass" : "FAIL"} ${check.name}: ${check.detail}`);
|
|
589
609
|
}
|
|
590
610
|
log(`\nWhat was created:`);
|
|
591
|
-
log(` ${phrenPath}/global/
|
|
611
|
+
log(` ${phrenPath}/global/AGENTS.md Global instructions loaded in every session`);
|
|
592
612
|
log(` ${phrenPath}/global/skills/ Phren slash commands`);
|
|
593
613
|
log(` ${phrenPath}/profiles/ Machine-to-project mappings`);
|
|
594
614
|
log(` ${phrenPath}/.config/ Memory quality settings and config`);
|
|
@@ -3,7 +3,7 @@ export declare const MANAGEMENT_PRESETS: readonly ManagementPreset[];
|
|
|
3
3
|
export declare const DEFAULT_MANAGEMENT_PRESET: ManagementPreset;
|
|
4
4
|
/** Structural + behavioral capabilities a preset expands into. */
|
|
5
5
|
export interface ManagementCapabilities {
|
|
6
|
-
/** Symlink global/
|
|
6
|
+
/** Symlink global/AGENTS.md into ~/.claude/CLAUDE.md (+ copilot instructions). */
|
|
7
7
|
linkGlobalClaudeMd: boolean;
|
|
8
8
|
/** Symlink managed skills into ~/.claude/skills (+ other agent skill dirs). */
|
|
9
9
|
installSkillLinks: boolean;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* automations, and SessionStart self-heal of the above.
|
|
12
12
|
* - assisted: MCP + hooks (context injection, capture, store git sync) but
|
|
13
13
|
* phren writes NOTHING outside its own store and agent settings —
|
|
14
|
-
* no
|
|
14
|
+
* no AGENTS.md symlink, no skills symlinks, no ~/.local/bin
|
|
15
15
|
* wrappers, no self-heal. Project ownership defaults to detached.
|
|
16
16
|
* Init prints a self-wiring snippet so users wire their own files.
|
|
17
17
|
* - manual: MCP server registration only. No hooks, no automations, no
|
|
@@ -115,7 +115,7 @@ export function presetSummaryLines(preset) {
|
|
|
115
115
|
case "managed":
|
|
116
116
|
return "phren wires everything: MCP, hooks, ~/.claude symlinks, skills, self-heal (recommended)";
|
|
117
117
|
case "assisted":
|
|
118
|
-
return "MCP + hooks only — phren never writes outside its store; you wire
|
|
118
|
+
return "MCP + hooks only — phren never writes outside its store; you wire AGENTS.md/skills yourself";
|
|
119
119
|
case "manual":
|
|
120
120
|
return "MCP server only — pull-based knowledge base, no hooks or automations";
|
|
121
121
|
}
|
package/dist/init/preferences.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as path from "path";
|
|
|
6
6
|
import * as crypto from "crypto";
|
|
7
7
|
import { debugLog, installPreferencesFile } from "../phren-paths.js";
|
|
8
8
|
import { errorMessage } from "../utils.js";
|
|
9
|
-
import { withFileLock } from "../
|
|
9
|
+
import { withFileLock } from "../governance/locks.js";
|
|
10
10
|
function preferencesFile(phrenPath) {
|
|
11
11
|
return installPreferencesFile(phrenPath);
|
|
12
12
|
}
|
package/dist/init/self-wiring.js
CHANGED
|
@@ -11,7 +11,7 @@ import { log } from "./shared.js";
|
|
|
11
11
|
import { getManagementPreset } from "./management-preset.js";
|
|
12
12
|
/** Build the self-wiring instructions as lines (testable without stdout). */
|
|
13
13
|
export function buildSelfWiringSnippet(phrenPath, preset) {
|
|
14
|
-
const globalClaude = path.join(phrenPath, "global", "
|
|
14
|
+
const globalClaude = path.join(phrenPath, "global", "AGENTS.md");
|
|
15
15
|
const globalSkills = path.join(phrenPath, "global", "skills");
|
|
16
16
|
const lines = [];
|
|
17
17
|
lines.push("");
|
package/dist/init/setup.d.ts
CHANGED
|
@@ -4,30 +4,19 @@
|
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
import { commandVersion } from "./shared.js";
|
|
6
6
|
import { type ManagementCapabilities, type ManagementPreset } from "./management-preset.js";
|
|
7
|
-
import { type
|
|
8
|
-
|
|
7
|
+
import { bootstrapFromExisting, ensureProjectScaffold, inferInitScaffoldFromRepo, type InferredInitScaffold, type InitProjectDomain } from "../core/project-registry.js";
|
|
8
|
+
export { bootstrapFromExisting, ensureProjectScaffold, inferInitScaffoldFromRepo, type InferredInitScaffold, type InitProjectDomain, };
|
|
9
9
|
export interface PostInitCheck {
|
|
10
10
|
name: string;
|
|
11
11
|
ok: boolean;
|
|
12
12
|
detail: string;
|
|
13
13
|
fix?: string;
|
|
14
14
|
}
|
|
15
|
-
interface BootstrapProjectOptions {
|
|
16
|
-
profile?: string;
|
|
17
|
-
profilePhrenPath?: string;
|
|
18
|
-
ownership?: ProjectOwnershipMode;
|
|
19
|
-
}
|
|
20
|
-
interface BootstrapProjectResult {
|
|
21
|
-
project: string;
|
|
22
|
-
ownership: ProjectOwnershipMode;
|
|
23
|
-
claudePath: string | null;
|
|
24
|
-
}
|
|
25
15
|
interface LocalGitRepoStatus {
|
|
26
16
|
ok: boolean;
|
|
27
17
|
initialized: boolean;
|
|
28
18
|
detail: string;
|
|
29
19
|
}
|
|
30
|
-
export type InitProjectDomain = "software" | "music" | "game" | "research" | "writing" | "creative" | "other";
|
|
31
20
|
export declare function resolvePreferredHomeDir(phrenPath: string): string;
|
|
32
21
|
interface RepairInstallResult {
|
|
33
22
|
profileFilesUpdated: number;
|
|
@@ -56,25 +45,14 @@ export declare function applyStarterTemplateUpdates(phrenPath: string): string[]
|
|
|
56
45
|
export declare function ensureGovernanceFiles(phrenPath: string): string[];
|
|
57
46
|
export declare function listTemplates(): string[];
|
|
58
47
|
export declare function applyTemplate(projectDir: string, templateName: string, projectName: string): boolean;
|
|
59
|
-
export interface InferredInitScaffold {
|
|
60
|
-
domain: InitProjectDomain;
|
|
61
|
-
topics: BuiltinTopic[];
|
|
62
|
-
referenceHints: string[];
|
|
63
|
-
commandHints: string[];
|
|
64
|
-
confidence: number;
|
|
65
|
-
reason: string;
|
|
66
|
-
}
|
|
67
|
-
export declare function inferInitScaffoldFromRepo(repoRoot: string, fallbackDomain?: InitProjectDomain): InferredInitScaffold | null;
|
|
68
|
-
export declare function ensureProjectScaffold(projectDir: string, projectName: string, domain?: InitProjectDomain, inference?: InferredInitScaffold | null): void;
|
|
69
48
|
export declare function ensureLocalGitRepo(phrenPath: string): LocalGitRepoStatus;
|
|
70
|
-
export declare function bootstrapFromExisting(phrenPath: string, projectPath: string, opts?: string | BootstrapProjectOptions): BootstrapProjectResult;
|
|
71
49
|
export declare function updateMachinesYaml(phrenPath: string, machine?: string, profile?: string): void;
|
|
72
50
|
/**
|
|
73
51
|
* Detect if a directory looks like a project that should be bootstrapped.
|
|
74
52
|
* Returns the path if it qualifies, null otherwise.
|
|
75
53
|
* A directory qualifies if it:
|
|
76
54
|
* - Is not the home directory or phren directory
|
|
77
|
-
* - Has
|
|
55
|
+
* - Has an AGENTS.md, legacy CLAUDE.md, .claude/CLAUDE.md, or .git directory
|
|
78
56
|
*
|
|
79
57
|
* A git worktree resolves to the repository it belongs to. Without this a
|
|
80
58
|
* throwaway agent worktree under `.claude/worktrees/<codename>` looks like its
|
|
@@ -89,4 +67,3 @@ export declare function runPostInitVerify(phrenPath: string): {
|
|
|
89
67
|
ok: boolean;
|
|
90
68
|
checks: PostInitCheck[];
|
|
91
69
|
};
|
|
92
|
-
export {};
|