@phren/cli 0.3.30 → 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.
- package/dist/bridge/agent-hooks.d.ts +5 -55
- package/dist/bridge/agent-hooks.js +45 -162
- package/dist/bridge/approval-rules.d.ts +70 -0
- package/dist/bridge/approval-rules.js +231 -0
- package/dist/bridge/authority.d.ts +1 -2
- package/dist/bridge/authority.js +2 -7
- package/dist/bridge/changes.d.ts +4 -0
- package/dist/bridge/changes.js +47 -33
- package/dist/bridge/claude-suggestion.js +1 -1
- package/dist/bridge/codex-servers.d.ts +12 -0
- package/dist/bridge/codex-servers.js +35 -3
- package/dist/bridge/codex-thread-origin.d.ts +12 -0
- package/dist/bridge/codex-thread-origin.js +31 -0
- package/dist/bridge/dispatch.js +1 -1
- package/dist/bridge/enroll.d.ts +6 -0
- package/dist/bridge/enroll.js +10 -4
- package/dist/bridge/git-worktrees.js +14 -17
- package/dist/bridge/git.d.ts +10 -2
- package/dist/bridge/git.js +148 -107
- package/dist/bridge/hand-off-queue.d.ts +10 -0
- package/dist/bridge/hand-off-queue.js +33 -10
- package/dist/bridge/health.js +9 -5
- package/dist/bridge/herdr.js +6 -1
- package/dist/bridge/hook-main.js +12 -2
- package/dist/bridge/locate.js +14 -1
- package/dist/bridge/projects.d.ts +8 -0
- package/dist/bridge/projects.js +142 -24
- package/dist/bridge/prompt-deliveries.d.ts +99 -0
- package/dist/bridge/prompt-deliveries.js +327 -0
- package/dist/bridge/prompt-once.d.ts +2 -0
- package/dist/bridge/prompt-once.js +2 -0
- package/dist/bridge/schedule-format.d.ts +10 -0
- package/dist/bridge/schedule-format.js +24 -1
- package/dist/bridge/schedules.d.ts +3 -1
- package/dist/bridge/schedules.js +96 -40
- package/dist/bridge/server-launch.js +39 -15
- package/dist/bridge/server-pane-routes.js +91 -45
- package/dist/bridge/server-routes.d.ts +3 -0
- package/dist/bridge/server-routes.js +36 -8
- package/dist/bridge/server-stream.js +4 -2
- package/dist/bridge/server.js +12 -3
- package/dist/bridge/speech-key.d.ts +2 -9
- package/dist/bridge/speech-key.js +4 -37
- package/dist/bridge/sudo.d.ts +1 -1
- package/dist/bridge/sudo.js +51 -17
- package/dist/bridge/terminal-tmux.js +22 -4
- package/dist/bridge/tmux-test-server.d.ts +13 -0
- package/dist/bridge/tmux-test-server.js +103 -0
- package/dist/bridge/transcript-claude.d.ts +3 -3
- package/dist/bridge/transcript-claude.js +7 -7
- package/dist/bridge/transcript-codex.js +6 -4
- package/dist/bridge/transcript-preview.js +1 -1
- package/dist/bridge/transcripts.js +14 -3
- package/dist/bridge-hook.mjs +16011 -14121
- package/dist/cli/schedules.js +8 -2
- package/dist/cli/session-stop.js +9 -1
- package/dist/cli-registry.js +1 -1
- package/dist/core/project-registry.d.ts +1 -0
- package/dist/core/project-registry.js +6 -2
- package/dist/core/project.d.ts +1 -0
- package/dist/core/project.js +5 -0
- package/dist/generated/memory-ui-graph.browser.js +328 -333
- package/dist/init/setup.js +2 -2
- package/dist/memory-ui-graph.runtime.js +328 -333
- package/dist/modules/registry.js +9 -7
- package/dist/phren-core.js +1 -1
- package/dist/phren-paths.d.ts +2 -2
- package/dist/phren-paths.js +2 -2
- package/dist/store-routing.d.ts +2 -2
- package/dist/store-routing.js +2 -2
- package/dist/sync/git-state.d.ts +13 -0
- package/dist/sync/git-state.js +22 -0
- package/dist/sync/store-merge.d.ts +2 -0
- package/dist/sync/store-merge.js +6 -1
- package/dist/test-global-setup.js +7 -0
- package/dist/tools/data.js +1 -1
- package/dist/tools/finding.js +1 -1
- package/dist/tools/search.js +1 -1
- package/dist/tools/tasks.js +1 -1
- package/package.json +8 -8
- package/starter/global/skills/conductor/SKILL.md +2 -2
package/dist/cli/schedules.js
CHANGED
|
@@ -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
|
|
134
|
-
|
|
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;
|
package/dist/cli/session-stop.js
CHANGED
|
@@ -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
|
-
|
|
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) {
|
package/dist/cli-registry.js
CHANGED
|
@@ -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" },
|
|
@@ -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.** `
|
|
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
|
}
|
package/dist/core/project.d.ts
CHANGED
|
@@ -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 {};
|
package/dist/core/project.js
CHANGED
|
@@ -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,
|