@phren/cli 0.3.31 → 0.3.32

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 (62) hide show
  1. package/dist/bridge/agent-hooks.js +23 -7
  2. package/dist/bridge/approval-rules.d.ts +70 -0
  3. package/dist/bridge/approval-rules.js +231 -0
  4. package/dist/bridge/authority.d.ts +1 -2
  5. package/dist/bridge/authority.js +2 -7
  6. package/dist/bridge/changes.d.ts +4 -0
  7. package/dist/bridge/changes.js +47 -33
  8. package/dist/bridge/claude-suggestion.js +1 -1
  9. package/dist/bridge/dispatch.js +1 -1
  10. package/dist/bridge/enroll.d.ts +6 -0
  11. package/dist/bridge/enroll.js +10 -4
  12. package/dist/bridge/git-worktrees.js +14 -17
  13. package/dist/bridge/git.d.ts +10 -2
  14. package/dist/bridge/git.js +148 -107
  15. package/dist/bridge/health.js +9 -5
  16. package/dist/bridge/herdr.js +6 -1
  17. package/dist/bridge/locate.js +14 -1
  18. package/dist/bridge/projects.d.ts +8 -0
  19. package/dist/bridge/projects.js +142 -24
  20. package/dist/bridge/schedule-format.d.ts +10 -0
  21. package/dist/bridge/schedule-format.js +24 -1
  22. package/dist/bridge/schedules.d.ts +3 -1
  23. package/dist/bridge/schedules.js +96 -40
  24. package/dist/bridge/server-launch.js +39 -15
  25. package/dist/bridge/server-pane-routes.js +19 -11
  26. package/dist/bridge/server-routes.d.ts +2 -0
  27. package/dist/bridge/server-routes.js +36 -8
  28. package/dist/bridge/speech-key.d.ts +2 -9
  29. package/dist/bridge/speech-key.js +4 -37
  30. package/dist/bridge/terminal-tmux.js +22 -4
  31. package/dist/bridge/tmux-test-server.d.ts +13 -0
  32. package/dist/bridge/tmux-test-server.js +103 -0
  33. package/dist/bridge/transcript-claude.d.ts +3 -3
  34. package/dist/bridge/transcript-claude.js +7 -7
  35. package/dist/bridge/transcript-codex.js +6 -4
  36. package/dist/bridge/transcript-preview.js +1 -1
  37. package/dist/bridge/transcripts.js +14 -3
  38. package/dist/bridge-hook.mjs +2753 -2216
  39. package/dist/cli/schedules.js +8 -2
  40. package/dist/cli/session-stop.js +9 -1
  41. package/dist/cli-registry.js +1 -1
  42. package/dist/core/project-registry.d.ts +1 -0
  43. package/dist/core/project-registry.js +6 -2
  44. package/dist/core/project.d.ts +1 -0
  45. package/dist/core/project.js +5 -0
  46. package/dist/modules/registry.js +9 -7
  47. package/dist/phren-core.js +1 -1
  48. package/dist/phren-paths.d.ts +2 -2
  49. package/dist/phren-paths.js +2 -2
  50. package/dist/store-routing.d.ts +2 -2
  51. package/dist/store-routing.js +2 -2
  52. package/dist/sync/git-state.d.ts +13 -0
  53. package/dist/sync/git-state.js +22 -0
  54. package/dist/sync/store-merge.d.ts +2 -0
  55. package/dist/sync/store-merge.js +6 -1
  56. package/dist/test-global-setup.js +7 -0
  57. package/dist/tools/data.js +1 -1
  58. package/dist/tools/finding.js +1 -1
  59. package/dist/tools/search.js +1 -1
  60. package/dist/tools/tasks.js +1 -1
  61. package/package.json +1 -1
  62. package/starter/global/skills/conductor/SKILL.md +2 -2
@@ -39,6 +39,8 @@ async function list(store, projectName) {
39
39
  for (const schedule of schedules) {
40
40
  count++;
41
41
  console.log(`${project} ${schedule.id} ${schedule.enabled ? "enabled " : "paused "} ${schedule.name}`);
42
+ if (schedule.projects)
43
+ console.log(` targets: ${schedule.projects.join(", ")}`);
42
44
  console.log(` ${schedule.computer} · ${schedule.harness}${schedule.model ? `/${schedule.model}` : ""} · ${scheduleDescription(schedule)}`);
43
45
  }
44
46
  }
@@ -71,6 +73,7 @@ async function add(store, args) {
71
73
  const now = new Date().toISOString();
72
74
  const schedule = {
73
75
  id: newScheduleId(file.schedules.map(item => item.id)), name, enabled: true, computer, harness,
76
+ ...(option(args, "--projects") ? { projects: option(args, "--projects").split(",").map(project => project.trim()) } : {}),
74
77
  ...(option(args, "--model") ? { model: option(args, "--model") } : {}),
75
78
  ...(option(args, "--account") ? { account: option(args, "--account") } : {}), every, prompt, createdAt: now, updatedAt: now,
76
79
  ...(option(args, "--at") ? { at: option(args, "--at") } : {}),
@@ -130,8 +133,11 @@ async function runNow(project, id) {
130
133
  if (!project || !id)
131
134
  throw new Error("Usage: phren schedule run <project> <id>");
132
135
  const result = await hookPost("/v1/schedules/run", { project, id });
133
- const run = object(result.run);
134
- console.log(`Launched schedule ${id} (${String(run.id ?? "run recorded")}).`);
136
+ const runs = Array.isArray(result.runs) ? result.runs.map(object) : [object(result.run)];
137
+ for (const run of runs)
138
+ console.log(`${String(run.project)}: ${String(run.status ?? "launched")} (${String(run.id ?? "run recorded")})${run.reason ? ` — ${String(run.reason)}` : ""}`);
139
+ if (result.ok === false)
140
+ throw new Error("Some schedule targets failed to launch; see the per-project results above.");
135
141
  }
136
142
  async function history(args) {
137
143
  const project = args[1] && !args[1].startsWith("--") ? args[1] : undefined;
@@ -13,6 +13,8 @@ import { resolveSubprocessArgs, scheduleBackgroundSync, } from "./session-backgr
13
13
  import { spawnDetachedChild } from "../shared/process.js";
14
14
  import { resolveManagementCapabilities } from "../init/management-preset.js";
15
15
  import { aheadBehind, logSyncOutcome } from "../sync/outcome.js";
16
+ import { storeAutoCommitBlocker } from "../sync/git-state.js";
17
+ import { STAGED_DIFF } from "../sync/store-merge.js";
16
18
  import { storeCommitMessage } from "../machine-identity.js";
17
19
  import { finishUnmanagedClaude } from "./claude-unmanaged.js";
18
20
  // ── Utility ─────────────────────────────────────────────────────────────────
@@ -385,7 +387,10 @@ export async function handleHookStop() {
385
387
  // Stage all changes first, then unstage any sensitive files that slipped
386
388
  // through. Using pathspec exclusions with `git add -A` can fail when
387
389
  // excluded paths are also gitignored (git treats the pathspec as an error).
388
- let add = await runBestEffortGit(["add", "--sparse", "-A"], phrenPath);
390
+ // Staging during an unfinished merge would mark its conflicts resolved and
391
+ // this commit would conclude it, markers and all.
392
+ const busy = await storeAutoCommitBlocker(phrenPath);
393
+ let add = busy ? { ok: false, error: busy } : await runBestEffortGit(["add", "--sparse", "-A"], phrenPath);
389
394
  if (add.ok) {
390
395
  // Belt-and-suspenders: unstage sensitive files that .gitignore should
391
396
  // already block. Failures here are non-fatal (files may not exist).
@@ -394,6 +399,9 @@ export async function handleHookStop() {
394
399
  // in .runtime/ (never staged by `-A`, since that directory is
395
400
  // gitignored), but this still protects a store from before that move.
396
401
  await runBestEffortGit(["reset", "HEAD", "--", ".env", "**/.env", "*.pem", "*.key", ".config/auth-profiles.json"], phrenPath);
402
+ const markers = await storeAutoCommitBlocker(phrenPath, () => runBestEffortGit(STAGED_DIFF, phrenPath));
403
+ if (markers)
404
+ add = { ok: false, error: markers };
397
405
  }
398
406
  let commitMsg = "auto-save phren";
399
407
  if (add.ok) {
@@ -66,7 +66,7 @@ const PROJECTS_SUBCOMMANDS = [
66
66
  ];
67
67
  const SCHEDULE_SUBCOMMANDS = [
68
68
  { name: "list", usage: "phren schedule list [project]", summary: "List scheduled prompts" },
69
- { name: "add", usage: "phren schedule add <project> --name <name> --harness <name> --computer <name> [--model <model>] [--account <id>] --every <kind> [timing] (--prompt <text>|--prompt-file <path>)", summary: "Add a scheduled prompt" },
69
+ { name: "add", usage: "phren schedule add <project> --name <name> --harness <name> --computer <name> [--model <model>] [--account <id>] [--projects <a,b>] --every <kind> [timing] (--prompt <text>|--prompt-file <path>)", summary: "Add a scheduled prompt" },
70
70
  { name: "remove", usage: "phren schedule remove <project> <id>", summary: "Remove a scheduled prompt" },
71
71
  { name: "enable", usage: "phren schedule enable <project> <id>", summary: "Resume a scheduled prompt" },
72
72
  { name: "disable", usage: "phren schedule disable <project> <id>", summary: "Pause a scheduled prompt" },
@@ -6,6 +6,7 @@ interface BootstrapProjectOptions {
6
6
  profile?: string;
7
7
  profilePhrenPath?: string;
8
8
  ownership?: ProjectOwnershipMode;
9
+ projectName?: string;
9
10
  }
10
11
  interface BootstrapProjectResult {
11
12
  project: string;
@@ -400,7 +400,7 @@ export function ensureProjectScaffold(projectDir, projectName, domain = "softwar
400
400
  *
401
401
  * 1. **Same source path.** Another project already points at this exact
402
402
  * directory — unambiguous, reuse it whatever it is called.
403
- * 2. **Same canonical slug.** `max4liveplugins` vs `max4live-plugins`: the same
403
+ * 2. **Same canonical slug.** `myproject` vs `my-project`: the same
404
404
  * repo spelled two ways. Only reused when the existing project has no source
405
405
  * path recorded, or records this one — if it points somewhere else it is a
406
406
  * genuinely different project that merely slugs alike, and both are kept.
@@ -483,9 +483,13 @@ export function bootstrapFromExisting(phrenPath, projectPath, opts = {}) {
483
483
  const derivedName = isProjectLocal
484
484
  ? String(manifest?.primaryProject)
485
485
  : projectSlugFromPath(sourceRoot);
486
+ const requestedName = typeof opts === "string" ? undefined : opts.projectName;
487
+ if (isProjectLocal && requestedName && requestedName !== derivedName) {
488
+ throw new Error(`Project-local phren can only enroll ${derivedName}.`);
489
+ }
486
490
  const projectName = isProjectLocal
487
491
  ? derivedName
488
- : (findExistingProjectForSource(phrenPath, sourceRoot, derivedName) ?? derivedName);
492
+ : (requestedName ?? findExistingProjectForSource(phrenPath, sourceRoot, derivedName) ?? derivedName);
489
493
  if (projectName !== derivedName) {
490
494
  debugLog(`bootstrapFromExisting: reusing existing project "${projectName}" for ${sourceRoot} (derived "${derivedName}")`);
491
495
  }
@@ -14,6 +14,7 @@ interface AddedProjectData {
14
14
  }
15
15
  interface AddProjectFromPathOptions {
16
16
  writeToPath?: string;
17
+ projectName?: string;
17
18
  }
18
19
  export declare function addProjectFromPath(phrenPath: string, targetPath: string | undefined, requestedProfile?: string, ownership?: ProjectOwnershipMode, options?: AddProjectFromPathOptions): PhrenResult<AddedProjectData>;
19
20
  export {};
@@ -2,11 +2,15 @@ import * as path from "path";
2
2
  import { phrenErr, phrenOk, readRootManifest } from "../shared.js";
3
3
  import { bootstrapFromExisting } from "./project-registry.js";
4
4
  import { resolveActiveProfile } from "../profile-store.js";
5
+ import { isValidProjectName } from "../utils-paths.js";
5
6
  import { FINDINGS_FILENAME, TASKS_FILENAME } from "../filenames.js";
6
7
  export function addProjectFromPath(phrenPath, targetPath, requestedProfile, ownership, options = {}) {
7
8
  if (!targetPath) {
8
9
  return phrenErr("Path is required. Pass the current project directory explicitly to avoid adding the wrong working directory.");
9
10
  }
11
+ if (options.projectName !== undefined && (!isValidProjectName(options.projectName) || options.projectName === "global")) {
12
+ return phrenErr("Choose a valid target project name.");
13
+ }
10
14
  const activeProfile = resolveActiveProfile(phrenPath, requestedProfile);
11
15
  if (!activeProfile.ok)
12
16
  return activeProfile;
@@ -25,6 +29,7 @@ export function addProjectFromPath(phrenPath, targetPath, requestedProfile, owne
25
29
  profile: selectedProfile,
26
30
  profilePhrenPath: phrenPath,
27
31
  ownership,
32
+ projectName: options.projectName,
28
33
  });
29
34
  return phrenOk({
30
35
  project: added.project,
@@ -77,6 +77,8 @@ export const BUILTIN_MODULES = [
77
77
  { agents: ["copilot"], events: ["SessionStart", "UserPromptSubmit"], handler: "bridge-hook.mjs hook copilot" },
78
78
  ],
79
79
  hookRoutes: [
80
+ ...routes("GET", ["/v1/approval-rules"]),
81
+ ...routes("POST", ["/v1/approval-rules"]), ...routes("DELETE", ["/v1/approval-rules"]),
80
82
  ...routes("GET", [
81
83
  "/v1/health", "/v1/health/details", "/v1/health/peers", "/v1/muxes", "/v1/activity", "/v1/metrics", "/v1/web-servers", "/v1/simulators",
82
84
  "/v1/simulators/screenshot", "/v1/simulators/apps", "/v1/files", "/v1/models", "/v1/harnesses", "/v1/projects/files",
@@ -96,7 +98,7 @@ export const BUILTIN_MODULES = [
96
98
  capabilities: [
97
99
  "hook", "transcript", "progress", "images", "prompt", "stop", "terminal", "shell", "herdr",
98
100
  "webServers", "webPreview", "activity", "approvals", "questions", "accountUsage", "providers",
99
- "files", "repositoryFiles", "fileResolution", "subagents", "sideQuestions", "approvalPush", "simulators", "overviewStream", "speech", "speechTimestamps", "speechTimestampStream", "speechLive", "speechVoices", "speechFormats", "transcribe", "promptOnce", "promptStatus", "deliveryFrames", "resources", "sessionRename", "sudo", "sudoOutcome", "previewDeltas", "quickChat",
101
+ "files", "repositoryFiles", "fileResolution", "subagents", "sideQuestions", "approvalPush", "simulators", "overviewStream", "speech", "speechTimestamps", "speechTimestampStream", "speechLive", "speechVoices", "speechFormats", "transcribe", "promptOnce", "promptStatus", "deliveryFrames", "resources", "sessionRename", "sudo", "sudoOutcome", "previewDeltas", "quickChat", "agentFolder", "launchPermissionMode",
100
102
  ],
101
103
  storeFiles: [".runtime/sessions/opencode-*.events.jsonl", ".runtime/approvals/opencode-*.json"],
102
104
  localFiles: ["<bridge>/installed.json", "<bridge>/versions/**", "<bridge>/current", "<bridge>/dispatch", "<bridge>/askpass", "<bridge>/computer-id", "<bridge>/canary.json", "<bridge>/canary-daily"],
@@ -110,11 +112,11 @@ export const BUILTIN_MODULES = [
110
112
  { agents: ["codex"], events: ["PreToolUse", "PostToolUse"], handler: "bridge-hook.mjs hook codex" },
111
113
  { agents: ["claude"], events: ["PreToolUse", "PostToolUse"], handler: "claude-hook.mjs claude" },
112
114
  ],
113
- hookRoutes: routes("POST", [
114
- "/v1/diff", "/v1/web-servers/session", "/v1/git/status", "/v1/git/log", "/v1/git/branches", "/v1/git/pulls",
115
- "/v1/git/tree", "/v1/git/worktrees", "/v1/git/stage", "/v1/git/unstage", "/v1/git/discard",
116
- "/v1/git/commit", "/v1/git/push", "/v1/git/pr",
117
- ]),
115
+ hookRoutes: [...routes("GET", ["/v1/git/status"]), ...routes("POST", [
116
+ "/v1/diff", "/v1/web-servers/session", "/v1/git/status", "/v1/git/log", "/v1/git/branches", "/v1/git/pulls",
117
+ "/v1/git/tree", "/v1/git/worktrees", "/v1/git/stage", "/v1/git/unstage", "/v1/git/discard",
118
+ "/v1/git/commit", "/v1/git/push", "/v1/git/pr",
119
+ ])],
118
120
  capabilities: ["git", "diff"], storeFiles: [], localFiles: ["<bridge>/changes/**", "<bridge>/changes-scratch/**"],
119
121
  phoneScreens: [{ screen: "AgentChangesView", capability: "git" }], skills: [],
120
122
  },
@@ -122,7 +124,7 @@ export const BUILTIN_MODULES = [
122
124
  schemaVersion: 1, name: "schedules", version: VERSION, defaultEnabled: false, requires: ["memory"],
123
125
  tools: [], cliCommands: ["schedule"], agentHooks: [],
124
126
  hookRoutes: routes("POST", ["/v1/schedules", "/v1/schedules/run", "/v1/schedules/history"]),
125
- capabilities: ["schedules"], storeFiles: ["<project>/schedules.yaml", ".runtime/agent-fanouts/<run-id>/**"],
127
+ capabilities: ["schedules", "scheduleProjects"], storeFiles: ["<project>/schedules.yaml", ".runtime/agent-fanouts/<run-id>/**"],
126
128
  localFiles: ["<bridge>/schedule-runs.jsonl"],
127
129
  phoneScreens: [{ screen: "SchedulesView", capability: "schedules" }], skills: [],
128
130
  },
@@ -7,7 +7,7 @@
7
7
  * tools (React, Django, Unity, JUCE, Ansible, ...) are learned dynamically from
8
8
  * each project's FINDINGS.md via extractDynamicEntities().
9
9
  */
10
- export const UNIVERSAL_TECH_TERMS_RE = /\b(Python|Rust|Go|Java|TypeScript|JavaScript|Docker|Kubernetes|AWS|GCP|Azure|SQL|Git|React|Vue|Angular|Svelte|Next\.?js|Nuxt|Vite|esbuild|Webpack|Rollup|Babel|ESLint|Biome|Prettier|Jest|Vitest|Playwright|Cypress|Node\.?js|Deno|Bun|Express|Fastify|Hono|Koa|NestJS|Prisma|Drizzle|Sequelize|TypeORM|Postgres|PostgreSQL|MySQL|SQLite|MongoDB|Redis|Elasticsearch|GraphQL|REST|gRPC|tRPC|Zod|Pydantic|FastAPI|Django|Flask|Rails|Spring|Laravel|Tailwind|Bootstrap|MUI|Material|Fluent|Chakra|Radix|shadcn|SharePoint|SPFx|Teams|OneDrive|Power\s*Apps|Deltek|VantagePoint|Hangfire|ASP\.?NET|MVC|Blazor|MAUI|Electron|VSCode|GitHub|GitLab|Bitbucket|Vercel|Netlify|Railway|Fly\.io|Cloudflare|Lambda|S3|EC2|RDS|DynamoDB|Stripe|Twilio|SendGrid|OpenAI|Anthropic|Claude|LLM|MCP|FTS5|SQLCipher|Sigma|ForceAtlas|Graphology|Playwright|Puppeteer|Selenium|Turbo|Turborepo|Lerna|nx|pnpm|yarn|npm|Bun)\b/gi;
10
+ export const UNIVERSAL_TECH_TERMS_RE = /\b(Python|Rust|Go|Java|TypeScript|JavaScript|Docker|Kubernetes|AWS|GCP|Azure|SQL|Git|React|Vue|Angular|Svelte|Next\.?js|Nuxt|Vite|esbuild|Webpack|Rollup|Babel|ESLint|Biome|Prettier|Jest|Vitest|Playwright|Cypress|Node\.?js|Deno|Bun|Express|Fastify|Hono|Koa|NestJS|Prisma|Drizzle|Sequelize|TypeORM|Postgres|PostgreSQL|MySQL|SQLite|MongoDB|Redis|Elasticsearch|GraphQL|REST|gRPC|tRPC|Zod|Pydantic|FastAPI|Django|Flask|Rails|Spring|Laravel|Tailwind|Bootstrap|MUI|Material|Fluent|Chakra|Radix|shadcn|SharePoint|SPFx|Teams|OneDrive|Power\s*Apps|Hangfire|ASP\.?NET|MVC|Blazor|MAUI|Electron|VSCode|GitHub|GitLab|Bitbucket|Vercel|Netlify|Railway|Fly\.io|Cloudflare|Lambda|S3|EC2|RDS|DynamoDB|Stripe|Twilio|SendGrid|OpenAI|Anthropic|Claude|LLM|MCP|FTS5|SQLCipher|Sigma|ForceAtlas|Graphology|Playwright|Puppeteer|Selenium|Turbo|Turborepo|Lerna|nx|pnpm|yarn|npm|Bun)\b/gi;
11
11
  /**
12
12
  * Additional fragment patterns beyond CamelCase and acronyms.
13
13
  * Each pattern has a named group so callers can identify the fragment type.
@@ -137,8 +137,8 @@ export declare function normalizeProjectNameForCreate(name: string): string;
137
137
  export declare function projectSlugFromPath(sourcePath: string): string;
138
138
  /**
139
139
  * Collapse a project name to the key used for duplicate detection: lowercase
140
- * with every separator removed. `Max4LivePlugins`, `max4liveplugins` and
141
- * `max4live-plugins` all map to `max4liveplugins`, so the second spelling of a
140
+ * with every separator removed. `MyProject`, `myproject` and
141
+ * `my-project` all map to `myproject`, so the second spelling of a
142
142
  * repo can be recognized as the project that already exists.
143
143
  */
144
144
  export declare function canonicalProjectKey(name: string): string;
@@ -488,8 +488,8 @@ export function projectSlugFromPath(sourcePath) {
488
488
  }
489
489
  /**
490
490
  * Collapse a project name to the key used for duplicate detection: lowercase
491
- * with every separator removed. `Max4LivePlugins`, `max4liveplugins` and
492
- * `max4live-plugins` all map to `max4liveplugins`, so the second spelling of a
491
+ * with every separator removed. `MyProject`, `myproject` and
492
+ * `my-project` all map to `myproject`, so the second spelling of a
493
493
  * repo can be recognized as the project that already exists.
494
494
  */
495
495
  export function canonicalProjectKey(name) {
@@ -11,8 +11,8 @@ export interface ParsedProjectRef {
11
11
  /**
12
12
  * Parse a project reference that may be store-qualified.
13
13
  *
14
- * "arc" → { projectName: "arc" }
15
- * "arc-team/arc" → { storeName: "arc-team", projectName: "arc" }
14
+ * "forge" → { projectName: "forge" }
15
+ * "forge-team/forge" → { storeName: "forge-team", projectName: "forge" }
16
16
  */
17
17
  export declare function parseStoreQualified(input: string): ParsedProjectRef;
18
18
  /**
@@ -8,8 +8,8 @@ import { resolveAllStores } from "./store-registry.js";
8
8
  /**
9
9
  * Parse a project reference that may be store-qualified.
10
10
  *
11
- * "arc" → { projectName: "arc" }
12
- * "arc-team/arc" → { storeName: "arc-team", projectName: "arc" }
11
+ * "forge" → { projectName: "forge" }
12
+ * "forge-team/forge" → { storeName: "forge-team", projectName: "forge" }
13
13
  */
14
14
  export function parseStoreQualified(input) {
15
15
  const trimmed = input.trim();
@@ -2,3 +2,16 @@ export type GitOperation = "rebase" | "merge" | "cherry-pick" | "revert" | "sequ
2
2
  /** Detect user-owned Git state without running a command that could alter it. */
3
3
  export declare function inProgressGitOperation(store: string): GitOperation | undefined;
4
4
  export declare function gitOperationRecovery(operation: GitOperation): string;
5
+ /**
6
+ * Why an automatic store commit must not happen now. `git add -A` during an
7
+ * unfinished merge marks every conflicted file resolved, markers and all, and
8
+ * the next commit concludes the merge with them: that is how a
9
+ * phren.project.yaml with `<<<<<<< HEAD` reached a store. Check before
10
+ * staging for the in-progress operation, and after staging for added marker
11
+ * pairs (a lone `=======` is a Markdown heading underline, so it needs both
12
+ * ends).
13
+ */
14
+ export declare function storeAutoCommitBlocker(store: string, stagedDiff?: () => Promise<{
15
+ ok: boolean;
16
+ output?: string;
17
+ }>): Promise<string | undefined>;
@@ -47,3 +47,25 @@ export function gitOperationRecovery(operation) {
47
47
  return "git revert --abort";
48
48
  return "git status";
49
49
  }
50
+ /**
51
+ * Why an automatic store commit must not happen now. `git add -A` during an
52
+ * unfinished merge marks every conflicted file resolved, markers and all, and
53
+ * the next commit concludes the merge with them: that is how a
54
+ * phren.project.yaml with `<<<<<<< HEAD` reached a store. Check before
55
+ * staging for the in-progress operation, and after staging for added marker
56
+ * pairs (a lone `=======` is a Markdown heading underline, so it needs both
57
+ * ends).
58
+ */
59
+ export async function storeAutoCommitBlocker(store, stagedDiff) {
60
+ const operation = inProgressGitOperation(store);
61
+ if (operation) {
62
+ return `The store has a Git ${operation} in progress, so nothing was committed. Run '${gitOperationRecovery(operation)}' in the store, or finish it by hand.`;
63
+ }
64
+ if (!stagedDiff)
65
+ return undefined;
66
+ const diff = await stagedDiff();
67
+ if (diff.ok && diff.output && /^\+<{7}(?: |$)/m.test(diff.output) && /^\+>{7}(?: |$)/m.test(diff.output)) {
68
+ return "Staged store changes contain merge conflict markers, so nothing was committed. Resolve them in the store first.";
69
+ }
70
+ return undefined;
71
+ }
@@ -19,6 +19,8 @@ export interface StoreMergeOptions {
19
19
  commitLocalWrites?: boolean;
20
20
  commitMessage?: string;
21
21
  }
22
+ /** The staged diff, added lines only, for `storeAutoCommitBlocker`. */
23
+ export declare const STAGED_DIFF: string[];
22
24
  /**
23
25
  * Fetch and integrate a store's configured upstream without rebasing local
24
26
  * commits. Conflicts in tasks.md (per task id against the merge base), the
@@ -1,6 +1,8 @@
1
1
  import { resolveStoreConflicts } from "./conflict-resolve.js";
2
- import { gitOperationRecovery, inProgressGitOperation } from "./git-state.js";
2
+ import { gitOperationRecovery, inProgressGitOperation, storeAutoCommitBlocker } from "./git-state.js";
3
3
  import { storeCommitMessage } from "../machine-identity.js";
4
+ /** The staged diff, added lines only, for `storeAutoCommitBlocker`. */
5
+ export const STAGED_DIFF = ["diff", "--cached", "--no-color", "--no-ext-diff", "-U0"];
4
6
  const SENSITIVE_STORE_PATHSPECS = [".env", "**/.env", "*.pem", "*.key", ".config/auth-profiles.json"];
5
7
  async function commitLocalStoreWrites(cwd, git, message) {
6
8
  const add = await git(cwd, ["add", "--sparse", "-A"]);
@@ -12,6 +14,9 @@ async function commitLocalStoreWrites(cwd, git, message) {
12
14
  return { committed: false, error: staged.error || "git diff failed" };
13
15
  if (!staged.output)
14
16
  return { committed: false };
17
+ const blocked = await storeAutoCommitBlocker(cwd, () => git(cwd, STAGED_DIFF));
18
+ if (blocked)
19
+ return { committed: false, error: blocked };
15
20
  const commit = await git(cwd, ["-c", "commit.gpgsign=false", "commit", "-m", storeCommitMessage(message)]);
16
21
  return commit.ok ? { committed: true } : { committed: false, error: commit.error || "git commit failed" };
17
22
  }
@@ -17,6 +17,7 @@ import * as os from "os";
17
17
  import * as path from "path";
18
18
  import { fileURLToPath } from "url";
19
19
  import { removeSandboxHome } from "./test-sandbox.js";
20
+ import { sweepTestServers } from "./bridge/tmux-test-server.js";
20
21
  const __filename = fileURLToPath(import.meta.url);
21
22
  const __dirname = path.dirname(__filename);
22
23
  const REPO_ROOT = path.resolve(__dirname, "../../..");
@@ -59,9 +60,15 @@ function sandboxHomeDir() {
59
60
  export async function teardown() {
60
61
  if (sandboxHome)
61
62
  removeSandboxHome(sandboxHome);
63
+ // Workers are gone now: any tmux test server still up was leaked by one.
64
+ if (process.platform !== "win32")
65
+ sweepTestServers();
62
66
  }
63
67
  export async function setup() {
64
68
  sandboxHomeDir();
69
+ // Private tmux servers and sockets earlier, killed runs left behind.
70
+ if (process.platform !== "win32")
71
+ sweepTestServers();
65
72
  if (fs.existsSync(CLI_PATH)) {
66
73
  // Dist already present — skip build. This is the common path when
67
74
  // `npm test` is used (pretest already built it) or during watch mode
@@ -37,7 +37,7 @@ export function register(server, ctx) {
37
37
  project: z.string().describe("Project name to export."),
38
38
  }),
39
39
  }, async ({ project: projectInput }) => {
40
- // Resolve store-qualified project names (e.g. "qualus-shared/arc")
40
+ // Resolve store-qualified project names (e.g. "team-shared/web")
41
41
  let resolvedPhrenPath;
42
42
  let project;
43
43
  try {
@@ -126,7 +126,7 @@ async function handleAddFinding(ctx, params) {
126
126
  const citation = params.citation
127
127
  ? { ...citationRest, ...(citedName ?? citationRest.symbol ? { symbol: citedName ?? citationRest.symbol } : {}) }
128
128
  : undefined;
129
- // Resolve store-qualified project names (e.g., "team/arc" → store path + "arc")
129
+ // Resolve store-qualified project names (e.g., "team/forge" → store path + "forge")
130
130
  let phrenPath;
131
131
  let project;
132
132
  try {
@@ -490,7 +490,7 @@ async function handleSearchKnowledge(ctx, { query, limit, project, type, tag, si
490
490
  }
491
491
  }
492
492
  async function handleGetProjectSummary(ctx, { name }) {
493
- // Support store-qualified names (e.g., "team/arc")
493
+ // Support store-qualified names (e.g., "team/forge")
494
494
  const { parseStoreQualified } = await import("../store-routing.js");
495
495
  const { storeName, projectName } = parseStoreQualified(name);
496
496
  const lookupName = projectName;
@@ -228,7 +228,7 @@ export function register(server, ctx) {
228
228
  scope: z.string().optional().describe("Optional memory scope label. Defaults to 'shared'. Example: 'researcher' or 'builder'."),
229
229
  }),
230
230
  }, async ({ project: projectInput, item, scope }) => {
231
- // Resolve store-qualified project names (e.g., "team/arc")
231
+ // Resolve store-qualified project names (e.g., "team/forge")
232
232
  let targetPhrenPath;
233
233
  let project;
234
234
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.31",
3
+ "version": "0.3.32",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {
@@ -79,7 +79,7 @@ conversational.
79
79
  twenty minutes", not "ETA ~20m".
80
80
 
81
81
  ```text
82
- Linuxbox has the parser checks on Codex, back around two twenty.
82
+ Devbox has the parser checks on Codex, back around two twenty.
83
83
  Desk finished the navigation checks: tests passed, not merged yet.
84
84
  ```
85
85
 
@@ -187,7 +187,7 @@ is retained as `live:false` until resolved; a resolved source stays resolved.
187
187
 
188
188
  `accepted` on a receipt is prompt acceptance, not worker completion. Returns
189
189
  arrive on their own: the Hook follows every worker you dispatch, and when you
190
- are idle it types one line into this session, such as `Return: Linuxbox parser
190
+ are idle it types one line into this session, such as `Return: Devbox parser
191
191
  checks done, tests passed (dispatch <id>). Call dispatch_returns.` When you see
192
192
  one, call `dispatch_returns` and report each return in one short line. You may
193
193
  also call it whenever you want the current state; do not poll it in a loop, and