@phren/cli 0.1.38 → 0.1.40
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/cli/session-background.js +4 -0
- package/dist/cli/session-stop.js +16 -0
- package/dist/cli-handlers.d.ts +2 -0
- package/dist/cli-handlers.js +40 -0
- package/dist/cli-registry.js +15 -1
- package/dist/generated/memory-ui-graph.browser.js +363 -293
- package/dist/hooks.d.ts +6 -0
- package/dist/hooks.js +6 -3
- package/dist/init/init-configure.d.ts +7 -2
- package/dist/init/init-configure.js +36 -10
- package/dist/init/init-preset.d.ts +3 -0
- package/dist/init/init-preset.js +122 -0
- package/dist/init/init-uninstall.js +9 -0
- package/dist/init/init-walkthrough.d.ts +2 -0
- package/dist/init/init-walkthrough.js +42 -17
- package/dist/init/init.d.ts +5 -0
- package/dist/init/init.js +62 -14
- package/dist/init/management-preset.d.ts +42 -0
- package/dist/init/management-preset.js +122 -0
- package/dist/init/preferences.d.ts +17 -0
- package/dist/init/preferences.js +3 -0
- package/dist/init/self-wiring.d.ts +5 -0
- package/dist/init/self-wiring.js +52 -0
- package/dist/init/setup.d.ts +5 -1
- package/dist/init/setup.js +19 -7
- package/dist/init/teardown.d.ts +15 -0
- package/dist/init/teardown.js +241 -0
- package/dist/link/doctor.js +41 -14
- package/dist/link/link.js +49 -26
- package/dist/memory-ui-graph.runtime.js +363 -293
- package/dist/status.js +13 -1
- package/dist/ui/scripts.js +35 -14
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import { fileURLToPath } from "url";
|
|
|
8
8
|
import { debugLog, errorMessage, runtimeFile, isFeatureEnabled, } from "./hooks-context.js";
|
|
9
9
|
import { qualityMarkers } from "../shared.js";
|
|
10
10
|
import { spawnDetachedChild } from "../shared/process.js";
|
|
11
|
+
import { resolveManagementCapabilities } from "../init/management-preset.js";
|
|
11
12
|
import { logger } from "../logger.js";
|
|
12
13
|
const SYNC_LOCK_STALE_MS = 10 * 60 * 1000; // 10 minutes
|
|
13
14
|
const MAINTENANCE_LOCK_STALE_MS = 2 * 60 * 60 * 1000; // 2 hours
|
|
@@ -64,6 +65,9 @@ export function scheduleBackgroundSync(phrenPathLocal) {
|
|
|
64
65
|
export function scheduleBackgroundMaintenance(phrenPathLocal, project) {
|
|
65
66
|
if (!isFeatureEnabled("PHREN_FEATURE_DAILY_MAINTENANCE", true))
|
|
66
67
|
return false;
|
|
68
|
+
// Lifecycle automations (daily maintenance) are off under the manual preset.
|
|
69
|
+
if (!resolveManagementCapabilities(phrenPathLocal).lifecycleAutomations)
|
|
70
|
+
return false;
|
|
67
71
|
const markers = qualityMarkers(phrenPathLocal);
|
|
68
72
|
if (fs.existsSync(markers.done))
|
|
69
73
|
return false;
|
package/dist/cli/session-stop.js
CHANGED
|
@@ -10,6 +10,7 @@ import { logger } from "../logger.js";
|
|
|
10
10
|
import { runBestEffortGit, countUnsyncedCommits, recoverPushConflict, } from "./session-git.js";
|
|
11
11
|
import { resolveSubprocessArgs, scheduleBackgroundSync, } from "./session-background.js";
|
|
12
12
|
import { spawnDetachedChild } from "../shared/process.js";
|
|
13
|
+
import { resolveManagementCapabilities } from "../init/management-preset.js";
|
|
13
14
|
// ── Utility ─────────────────────────────────────────────────────────────────
|
|
14
15
|
/** Read JSON from stdin if it's not a TTY. Returns null if stdin is a TTY or parsing fails. */
|
|
15
16
|
function readStdinJson() {
|
|
@@ -225,6 +226,21 @@ export async function handleHookStop() {
|
|
|
225
226
|
appendAuditLog(phrenPath, "hook_stop", "status=skipped-local");
|
|
226
227
|
return;
|
|
227
228
|
}
|
|
229
|
+
// Under the manual preset lifecycle automations are off: never auto commit or
|
|
230
|
+
// push the store, even if a stale Stop hook fires. Files on disk are the record.
|
|
231
|
+
if (!resolveManagementCapabilities(phrenPath).lifecycleAutomations) {
|
|
232
|
+
updateRuntimeHealth(phrenPath, {
|
|
233
|
+
lastStopAt: now,
|
|
234
|
+
lastAutoSave: { at: now, status: "saved-local", detail: "manual preset: auto-commit disabled" },
|
|
235
|
+
lastSync: {
|
|
236
|
+
lastPushAt: now,
|
|
237
|
+
lastPushStatus: "saved-local",
|
|
238
|
+
lastPushDetail: "manual preset does not auto-commit or push",
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
appendAuditLog(phrenPath, "hook_stop", "status=skipped-manual-preset");
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
228
244
|
const gitRepo = ensureLocalGitRepo(phrenPath);
|
|
229
245
|
if (!gitRepo.ok) {
|
|
230
246
|
finalizeTaskSession({
|
package/dist/cli-handlers.d.ts
CHANGED
|
@@ -14,4 +14,6 @@ export declare function runStatusCommand(_args: string[]): Promise<number>;
|
|
|
14
14
|
export declare function runVerifyCommand(_args: string[]): Promise<number>;
|
|
15
15
|
export declare function runMcpModeCommand(args: string[]): Promise<number>;
|
|
16
16
|
export declare function runHooksModeCommand(args: string[]): Promise<number>;
|
|
17
|
+
export declare function runPresetCommand(args: string[]): Promise<number>;
|
|
18
|
+
export declare function runSnippetCommand(_args: string[]): Promise<number>;
|
|
17
19
|
export declare function runLinkRemovedNotice(_args: string[]): Promise<number>;
|
package/dist/cli-handlers.js
CHANGED
|
@@ -79,6 +79,7 @@ export async function runAddCommand(args) {
|
|
|
79
79
|
}
|
|
80
80
|
export async function runInitCommand(args) {
|
|
81
81
|
const { parseMcpMode, runInit } = await import("./init/init.js");
|
|
82
|
+
const { parseManagementPreset, MANAGEMENT_PRESETS } = await import("./init/management-preset.js");
|
|
82
83
|
const machineIdx = args.indexOf("--machine");
|
|
83
84
|
const profileIdx = args.indexOf("--profile");
|
|
84
85
|
const mcpIdx = args.indexOf("--mcp");
|
|
@@ -118,6 +119,18 @@ export async function runInitCommand(args) {
|
|
|
118
119
|
console.error(`Invalid --task-proactivity value "${taskArg}". Use one of: high, medium, low.`);
|
|
119
120
|
return 1;
|
|
120
121
|
}
|
|
122
|
+
const presetArg = getOptionValue(args, "--preset") ?? getOptionValue(args, "--management");
|
|
123
|
+
const managementPreset = parseManagementPreset(presetArg);
|
|
124
|
+
if (presetArg && !managementPreset) {
|
|
125
|
+
console.error(`Invalid --preset value "${presetArg}". Use one of: ${MANAGEMENT_PRESETS.join(", ")}`);
|
|
126
|
+
return 1;
|
|
127
|
+
}
|
|
128
|
+
const hooksMode = parseMcpMode(getOptionValue(args, "--hooks") ?? "");
|
|
129
|
+
const hooksArg = getOptionValue(args, "--hooks");
|
|
130
|
+
if (hooksArg && !hooksMode) {
|
|
131
|
+
console.error(`Invalid --hooks value "${hooksArg}". Use "on" or "off".`);
|
|
132
|
+
return 1;
|
|
133
|
+
}
|
|
121
134
|
const cloneUrl = getOptionValue(args, "--clone-url");
|
|
122
135
|
try {
|
|
123
136
|
await runInit({
|
|
@@ -125,7 +138,9 @@ export async function runInitCommand(args) {
|
|
|
125
138
|
machine: machineIdx !== -1 ? args[machineIdx + 1] : undefined,
|
|
126
139
|
profile: profileIdx !== -1 ? args[profileIdx + 1] : undefined,
|
|
127
140
|
mcp: mcpMode,
|
|
141
|
+
hooks: hooksMode,
|
|
128
142
|
projectOwnershipDefault: ownershipMode,
|
|
143
|
+
managementPreset,
|
|
129
144
|
taskMode,
|
|
130
145
|
findingsProactivity,
|
|
131
146
|
taskProactivity,
|
|
@@ -198,6 +213,31 @@ export async function runHooksModeCommand(args) {
|
|
|
198
213
|
return 1;
|
|
199
214
|
}
|
|
200
215
|
}
|
|
216
|
+
export async function runPresetCommand(args) {
|
|
217
|
+
const { runPreset } = await import("./init/init.js");
|
|
218
|
+
const positional = args.filter((a) => !a.startsWith("-"));
|
|
219
|
+
const yes = args.includes("--yes") || args.includes("-y");
|
|
220
|
+
try {
|
|
221
|
+
await runPreset(positional[0], { yes });
|
|
222
|
+
return 0;
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
console.error(errorMessage(err));
|
|
226
|
+
return 1;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
export async function runSnippetCommand(_args) {
|
|
230
|
+
const { printSelfWiringSnippet } = await import("./init/init.js");
|
|
231
|
+
const phrenPath = findPhrenPath() || defaultPhrenPath();
|
|
232
|
+
try {
|
|
233
|
+
printSelfWiringSnippet(phrenPath);
|
|
234
|
+
return 0;
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
console.error(errorMessage(err));
|
|
238
|
+
return 1;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
201
241
|
export async function runLinkRemovedNotice(_args) {
|
|
202
242
|
console.error("`phren link` has been removed. Use `phren init` instead.");
|
|
203
243
|
return 1;
|
package/dist/cli-registry.js
CHANGED
|
@@ -117,7 +117,7 @@ export const REGISTRY = [
|
|
|
117
117
|
{
|
|
118
118
|
name: "init",
|
|
119
119
|
topic: "setup",
|
|
120
|
-
usage: "phren init [--mode shared|project-local] [--machine <n>] [--profile <n>] [--dry-run] [-y]",
|
|
120
|
+
usage: "phren init [--preset managed|assisted|manual] [--mode shared|project-local] [--machine <n>] [--profile <n>] [--dry-run] [-y]",
|
|
121
121
|
cheatUsage: "phren init",
|
|
122
122
|
summary: "Set up phren",
|
|
123
123
|
featured: true,
|
|
@@ -456,6 +456,20 @@ export const REGISTRY = [
|
|
|
456
456
|
summary: "Toggle hook execution",
|
|
457
457
|
run: native("runHooksModeCommand"),
|
|
458
458
|
},
|
|
459
|
+
{
|
|
460
|
+
name: "preset",
|
|
461
|
+
topic: "setup",
|
|
462
|
+
usage: "phren preset [status|managed|assisted|manual] [-y]",
|
|
463
|
+
summary: "Set the management preset (how much phren wires up)",
|
|
464
|
+
run: native("runPresetCommand"),
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
name: "snippet",
|
|
468
|
+
topic: "setup",
|
|
469
|
+
usage: "phren snippet",
|
|
470
|
+
summary: "Print the self-wiring snippet for assisted/manual presets",
|
|
471
|
+
run: native("runSnippetCommand"),
|
|
472
|
+
},
|
|
459
473
|
{
|
|
460
474
|
name: "verify",
|
|
461
475
|
topic: "setup",
|