wachiman 1.14.0 → 1.16.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 -1
- package/package.json +4 -2
- package/src/accounts/commands.ts +3 -2
- package/src/accounts/confirm.ts +63 -4
- package/src/accounts/profile-list.ts +24 -0
- package/src/cli.ts +161 -142
- package/src/config.ts +19 -6
- package/src/connectors/local-git.ts +47 -0
- package/src/doctor/checks.ts +106 -1
- package/src/doctor/run.ts +9 -1
- package/src/engine.ts +294 -97
- package/src/help.ts +637 -0
- package/src/init/args.ts +5 -2
- package/src/init/github-login.ts +13 -0
- package/src/init/options.ts +31 -3
- package/src/init/prompt.ts +46 -15
- package/src/init/run.ts +238 -32
- package/src/init/settings.ts +127 -0
- package/src/init/write.ts +16 -102
- package/src/ledger-read/command.ts +106 -0
- package/src/ledger-read/credentials.ts +103 -0
- package/src/ledger-read/files.ts +141 -0
- package/src/ledger-read/pull.ts +69 -0
- package/src/ledger-read/rows.ts +60 -0
- package/src/ledger-read/types.ts +127 -0
- package/src/ledger.ts +34 -18
- package/src/local-ask.ts +5 -4
- package/src/local.ts +55 -10
- package/src/loop/command.ts +5 -5
- package/src/pr-template/adopt.ts +434 -0
- package/src/pr-template/catalog.ts +429 -0
- package/src/pr-template/check-run.ts +328 -0
- package/src/pr-template/check.ts +338 -0
- package/src/pr-template/describe.ts +368 -0
- package/src/pr-template/format.ts +399 -0
- package/src/pr-template/gh.ts +159 -0
- package/src/pr-template/install.ts +288 -0
- package/src/pr-template/legacy-guides.ts +50 -0
- package/src/pr-template/pr-risk.ts +426 -0
- package/src/pr-template/render.ts +302 -0
- package/src/pr-template/resolve.ts +65 -0
- package/src/pr-template/run.ts +88 -0
- package/src/pr-template/strip.ts +171 -0
- package/src/pr-template/write.ts +139 -0
- package/src/providers/claude-code.ts +7 -8
- package/src/providers/codex.ts +4 -4
- package/src/providers/spawn.ts +95 -0
- package/src/providers/types.ts +5 -2
- package/src/repo-settings.ts +159 -0
- package/src/setup/prompt.ts +49 -33
- package/src/setup/run.ts +58 -16
- package/src/sinks/common.ts +10 -3
- package/src/sinks/markdown.ts +3 -2
- package/src/sinks/terminal.ts +3 -2
- package/src/spend/report.ts +349 -0
- package/src/status/command.ts +150 -36
- package/src/store/command.ts +20 -3
- package/src/store/html.ts +205 -8
- package/src/store/index.ts +64 -5
- package/src/store/rows.ts +103 -0
- package/src/upgrade/command.ts +286 -0
- package/src/upgrade/pin.ts +112 -0
- package/src/wizard/interactive.ts +11 -0
- package/src/wizard/launcher.ts +340 -0
- package/src/wizard/load.ts +30 -0
- package/src/wizard/mascot.ts +228 -0
- package/src/wizard/prompt-fancy.ts +135 -0
- package/src/wizard/prompt.ts +108 -61
- package/src/wizard/style.ts +93 -13
- package/src/wizard/tone.ts +11 -0
- package/src/wizard/ui.ts +80 -0
- package/templates/pr/sections.json +163 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing one managed file safely. `wachiman init` and `wachiman pr-template` share it: no
|
|
3
|
+
* symbolic link may stand in for a directory of the path or for the target, an existing file may be
|
|
4
|
+
* copied to a backup that never overwrites another backup, and the new content goes in through an
|
|
5
|
+
* exclusive temporary file and a rename after the target is found unchanged since it was
|
|
6
|
+
* inspected.
|
|
7
|
+
*
|
|
8
|
+
* `label` is the command named in the messages ("init", "pr-template").
|
|
9
|
+
*/
|
|
10
|
+
import { randomBytes } from "node:crypto";
|
|
11
|
+
import { constants, copyFileSync, linkSync, lstatSync, mkdirSync, realpathSync, renameSync, unlinkSync, writeFileSync, type Stats } from "node:fs";
|
|
12
|
+
import { basename, dirname, join, sep } from "node:path";
|
|
13
|
+
import { UsageError } from "../config";
|
|
14
|
+
|
|
15
|
+
export interface TargetState {
|
|
16
|
+
/** The real path the file is written to: the real repository root plus the relative path. */
|
|
17
|
+
target: string;
|
|
18
|
+
exists: boolean;
|
|
19
|
+
identity?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const identityOf = (s: Stats) => `${s.dev}:${s.ino}:${s.size}:${s.mtimeMs}`;
|
|
23
|
+
|
|
24
|
+
const lstatOrNull = (path: string) => {
|
|
25
|
+
try {
|
|
26
|
+
return lstatSync(path);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return null;
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** Looks at the target and its ancestors without following a link; refuses anything that is not a plain directory chain and a plain file. */
|
|
34
|
+
export function inspectManagedTarget(repoDir: string, relativePath: string, label: string): TargetState {
|
|
35
|
+
const root = realpathSync(repoDir);
|
|
36
|
+
let current = root;
|
|
37
|
+
const parts = relativePath.split("/");
|
|
38
|
+
for (const part of parts.slice(0, -1)) {
|
|
39
|
+
current = join(current, part);
|
|
40
|
+
const stat = lstatOrNull(current);
|
|
41
|
+
if (stat === null) break;
|
|
42
|
+
if (stat.isSymbolicLink()) throw new UsageError(`${current} is a symbolic link; ${label} does not write through links. Replace it with a real directory.`);
|
|
43
|
+
if (!stat.isDirectory()) throw new UsageError(`${current} is not a directory; ${label} cannot write ${relativePath}.`);
|
|
44
|
+
const real = realpathSync(current);
|
|
45
|
+
if (real !== root && !real.startsWith(root + sep)) throw new UsageError(`${current} resolves outside the repository (${real}); ${label} refuses it.`);
|
|
46
|
+
}
|
|
47
|
+
const target = join(root, relativePath);
|
|
48
|
+
const stat = lstatOrNull(target);
|
|
49
|
+
if (stat === null) return { target, exists: false };
|
|
50
|
+
if (stat.isSymbolicLink()) throw new UsageError(`${target} is a symbolic link; ${label} does not write through links.`);
|
|
51
|
+
if (!stat.isFile()) throw new UsageError(`${target} exists and is not a regular file.`);
|
|
52
|
+
return { target, exists: true, identity: identityOf(stat) };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** `YYYYMMDD-HHMMSS` in UTC, from an ISO timestamp. */
|
|
56
|
+
export const backupStamp = (iso: string) => iso.replace(/[-:]/g, "").replace("T", "-").slice(0, 15);
|
|
57
|
+
|
|
58
|
+
export interface WriteHooks {
|
|
59
|
+
/** Runs after the temporary file is complete and before it replaces the target; a test changes the target here. */
|
|
60
|
+
beforeCommit?: () => void;
|
|
61
|
+
/** Writes the temporary file (exclusive create); a test makes it fail halfway. */
|
|
62
|
+
writeTemp?: (path: string, content: string) => void;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Writes `content` to the inspected target. With `backup`, an existing file is copied first, to
|
|
67
|
+
* `<target>.bak-<stamp>` or, when `backupDir` is given, to `<backupDir>/<relative path>.<stamp>`
|
|
68
|
+
* (`-2`, `-3`… when that name is taken); without it, an existing file is simply replaced. It is replaced only if it is the same file that was inspected. A new file is
|
|
69
|
+
* linked into place, which fails if one appeared meanwhile. Returns the backup path when one was
|
|
70
|
+
* made.
|
|
71
|
+
*/
|
|
72
|
+
export function writeManagedFile(p: {
|
|
73
|
+
repoDir: string;
|
|
74
|
+
relativePath: string;
|
|
75
|
+
content: string;
|
|
76
|
+
inspected: TargetState;
|
|
77
|
+
now: string;
|
|
78
|
+
label: string;
|
|
79
|
+
backup: boolean;
|
|
80
|
+
/** A directory outside the working tree for the backups; without it they sit next to the target. */
|
|
81
|
+
backupDir?: string;
|
|
82
|
+
hooks?: WriteHooks;
|
|
83
|
+
}): { target: string; backup?: string } {
|
|
84
|
+
const { inspected, label } = p;
|
|
85
|
+
const dir = dirname(inspected.target);
|
|
86
|
+
mkdirSync(dir, { recursive: true });
|
|
87
|
+
// The directories exist now: look again, so a link planted between the first look and the mkdir is still refused.
|
|
88
|
+
const again = inspectManagedTarget(p.repoDir, p.relativePath, label);
|
|
89
|
+
if (again.exists !== inspected.exists || again.identity !== inspected.identity) {
|
|
90
|
+
throw new UsageError(`${inspected.target} changed while ${label} was running; nothing was written. Run it again.`);
|
|
91
|
+
}
|
|
92
|
+
let backup: string | undefined;
|
|
93
|
+
if (inspected.exists && p.backup) {
|
|
94
|
+
const stamp = backupStamp(p.now);
|
|
95
|
+
const base = p.backupDir === undefined ? `${inspected.target}.bak-` : join(p.backupDir, `${p.relativePath}.`);
|
|
96
|
+
if (p.backupDir !== undefined) {
|
|
97
|
+
try {
|
|
98
|
+
mkdirSync(dirname(base), { recursive: true });
|
|
99
|
+
} catch (error) {
|
|
100
|
+
throw new UsageError(`Cannot create the backup directory ${dirname(base)} (${(error as NodeJS.ErrnoException).code ?? "error"}); the template was not replaced.`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (let n = 1; backup === undefined; n++) {
|
|
104
|
+
const candidate = `${base}${stamp}${n === 1 ? "" : `-${n}`}`;
|
|
105
|
+
try {
|
|
106
|
+
copyFileSync(inspected.target, candidate, constants.COPYFILE_EXCL);
|
|
107
|
+
backup = candidate;
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if ((error as NodeJS.ErrnoException).code !== "EEXIST") throw error;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const tmp = join(dir, `.${basename(inspected.target)}.${process.pid}-${randomBytes(4).toString("hex")}.tmp`);
|
|
114
|
+
try {
|
|
115
|
+
(p.hooks?.writeTemp ?? ((path, content) => writeFileSync(path, content, { flag: "wx", mode: 0o644 })))(tmp, p.content);
|
|
116
|
+
p.hooks?.beforeCommit?.();
|
|
117
|
+
if (inspected.exists) {
|
|
118
|
+
const now = lstatOrNull(inspected.target);
|
|
119
|
+
if (now === null || now.isSymbolicLink() || identityOf(now) !== inspected.identity) {
|
|
120
|
+
throw new UsageError(`${inspected.target} changed while ${label} was running; it was not replaced.${backup ? ` A copy of the earlier file is at ${backup}.` : ""}`);
|
|
121
|
+
}
|
|
122
|
+
renameSync(tmp, inspected.target);
|
|
123
|
+
} else {
|
|
124
|
+
try {
|
|
125
|
+
linkSync(tmp, inspected.target);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
if ((error as NodeJS.ErrnoException).code === "EEXIST") throw new UsageError(`${inspected.target} appeared while ${label} was running; nothing was written.`);
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
} finally {
|
|
132
|
+
try {
|
|
133
|
+
unlinkSync(tmp);
|
|
134
|
+
} catch {
|
|
135
|
+
// Renamed into place, or already gone.
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return { target: inspected.target, ...(backup ? { backup } : {}) };
|
|
139
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* hardening is documented in docs/providers/claude-code.md.
|
|
4
4
|
*/
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { spawnCapture, type SpawnOutcome } from "./spawn";
|
|
6
7
|
import { existsSync, mkdtempSync, rmSync } from "node:fs";
|
|
7
8
|
import { tmpdir } from "node:os";
|
|
8
9
|
import { join } from "node:path";
|
|
@@ -349,7 +350,7 @@ export class ClaudeCodeProvider implements ProviderAdapter {
|
|
|
349
350
|
return leaksKey(texts, process.env.ANTHROPIC_API_KEY ?? "", this.auth === "oauth-token" ? (process.env[OAUTH_TOKEN_VAR] ?? "") : "");
|
|
350
351
|
}
|
|
351
352
|
|
|
352
|
-
run(request: ProviderRequest): ProviderResult {
|
|
353
|
+
async run(request: ProviderRequest): Promise<ProviderResult> {
|
|
353
354
|
// The agent never gets a GitHub token, a base URL or a proxy: see CHILD_ENV_ALLOWLIST.
|
|
354
355
|
const childEnv = this.childEnv();
|
|
355
356
|
// The session starts in an empty scratch directory, never in the head: Claude Code discovers
|
|
@@ -371,18 +372,16 @@ export class ClaudeCodeProvider implements ProviderAdapter {
|
|
|
371
372
|
});
|
|
372
373
|
const timeoutMs = request.timeoutMs ?? this.opts.timeoutMs ?? DEFAULT_CALL_TIMEOUT_S * 1000;
|
|
373
374
|
const started = Date.now();
|
|
374
|
-
let run:
|
|
375
|
+
let run: SpawnOutcome;
|
|
375
376
|
try {
|
|
376
|
-
run =
|
|
377
|
+
run = await spawnCapture(this.binary, args, {
|
|
377
378
|
cwd: workDir,
|
|
378
379
|
input: request.promptViaStdin ? prompt : undefined,
|
|
379
380
|
env: childEnv,
|
|
380
|
-
encoding: "utf8",
|
|
381
381
|
maxBuffer: 64 * 1024 * 1024,
|
|
382
|
-
// The
|
|
383
|
-
//
|
|
384
|
-
|
|
385
|
-
timeout: timeoutMs,
|
|
382
|
+
// The kill is immediate, with no graceful exit to escalate from: `claude -p` prints its
|
|
383
|
+
// result only when it ends, so a SIGTERM grace period would save nothing.
|
|
384
|
+
timeoutMs,
|
|
386
385
|
killSignal: "SIGKILL",
|
|
387
386
|
});
|
|
388
387
|
} finally {
|
package/src/providers/codex.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* variable still reached the shell until `shell_snapshot` and `unified_exec` were disabled.
|
|
17
17
|
*/
|
|
18
18
|
import { spawnSync } from "node:child_process";
|
|
19
|
+
import { spawnCapture } from "./spawn";
|
|
19
20
|
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
20
21
|
import { tmpdir } from "node:os";
|
|
21
22
|
import { join } from "node:path";
|
|
@@ -311,7 +312,7 @@ export class CodexProvider implements ProviderAdapter {
|
|
|
311
312
|
return leaksKey(texts, process.env.OPENAI_API_KEY ?? "");
|
|
312
313
|
}
|
|
313
314
|
|
|
314
|
-
run(request: ProviderRequest): ProviderResult {
|
|
315
|
+
async run(request: ProviderRequest): Promise<ProviderResult> {
|
|
315
316
|
const unknown = request.allowedTools.filter((t) => !READ_TOOLS.includes(t));
|
|
316
317
|
if (unknown.length > 0) throw new Error(`The Codex adapter only grants reads; asked for ${unknown.join(", ")}.`);
|
|
317
318
|
const scratch = mkdtempSync(join(tmpdir(), "wachiman-review-codex-"));
|
|
@@ -327,7 +328,7 @@ export class CodexProvider implements ProviderAdapter {
|
|
|
327
328
|
}
|
|
328
329
|
const lastMessageFile = join(scratch, "last-message.txt");
|
|
329
330
|
const started = Date.now();
|
|
330
|
-
const run =
|
|
331
|
+
const run = await spawnCapture(
|
|
331
332
|
this.binary,
|
|
332
333
|
buildCodexArgs({
|
|
333
334
|
model: this.opts.model,
|
|
@@ -340,9 +341,8 @@ export class CodexProvider implements ProviderAdapter {
|
|
|
340
341
|
cwd: workDir,
|
|
341
342
|
input: locatePrompt(request.prompt, request.cwd, request.addDirs),
|
|
342
343
|
env: buildChildEnv(process.env, { home, codexHome }),
|
|
343
|
-
encoding: "utf8",
|
|
344
344
|
maxBuffer: 256 * 1024 * 1024,
|
|
345
|
-
|
|
345
|
+
timeoutMs: request.timeoutMs ?? this.opts.timeoutMs ?? DEFAULT_CALL_TIMEOUT_S * 1000,
|
|
346
346
|
killSignal: "SIGKILL",
|
|
347
347
|
},
|
|
348
348
|
);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs an agent CLI to completion without blocking the process, so several calls can be in flight
|
|
3
|
+
* at once (the batches of one review). It keeps what `spawnSync` gave the adapters: the whole
|
|
4
|
+
* output as text, a hard kill at the time limit, a cap on each stream's output, and the same `error` codes
|
|
5
|
+
* (`ETIMEDOUT` for the kill, `ENOBUFS` for an output past the cap, `ENOENT` for a missing binary).
|
|
6
|
+
*/
|
|
7
|
+
import { spawn } from "node:child_process";
|
|
8
|
+
|
|
9
|
+
/** How long the pipes may stay open after the process exited before what was read is taken as the output. */
|
|
10
|
+
const PIPE_GRACE_MS = 2_000;
|
|
11
|
+
|
|
12
|
+
export interface SpawnOutcome {
|
|
13
|
+
stdout: string;
|
|
14
|
+
stderr: string;
|
|
15
|
+
/** The exit code; null when a signal ended the process or it never started. */
|
|
16
|
+
status: number | null;
|
|
17
|
+
signal: NodeJS.Signals | null;
|
|
18
|
+
/** `ETIMEDOUT` after the time limit killed it; `ENOBUFS` past `maxBuffer`; otherwise whatever `spawn` reported. */
|
|
19
|
+
error?: NodeJS.ErrnoException;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function spawnCapture(
|
|
23
|
+
binary: string,
|
|
24
|
+
args: string[],
|
|
25
|
+
opts: {
|
|
26
|
+
cwd: string;
|
|
27
|
+
env: NodeJS.ProcessEnv;
|
|
28
|
+
input?: string;
|
|
29
|
+
timeoutMs: number;
|
|
30
|
+
maxBuffer: number;
|
|
31
|
+
killSignal?: NodeJS.Signals;
|
|
32
|
+
},
|
|
33
|
+
): Promise<SpawnOutcome> {
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
let stdout = "";
|
|
36
|
+
let stderr = "";
|
|
37
|
+
// Counted per stream, as `spawnSync`'s `maxBuffer` was.
|
|
38
|
+
const bytes = { stdout: 0, stderr: 0 };
|
|
39
|
+
let error: NodeJS.ErrnoException | undefined;
|
|
40
|
+
let settled = false;
|
|
41
|
+
const child = spawn(binary, args, { cwd: opts.cwd, env: opts.env, stdio: ["pipe", "pipe", "pipe"] });
|
|
42
|
+
const kill = () => {
|
|
43
|
+
try {
|
|
44
|
+
child.kill(opts.killSignal ?? "SIGKILL");
|
|
45
|
+
} catch {
|
|
46
|
+
// Already gone.
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const fail = (code: string) => {
|
|
50
|
+
error ??= Object.assign(new Error(`spawn ${binary} ${code}`), { code }) as NodeJS.ErrnoException;
|
|
51
|
+
kill();
|
|
52
|
+
};
|
|
53
|
+
const timer = setTimeout(() => fail("ETIMEDOUT"), opts.timeoutMs);
|
|
54
|
+
const finish = (status: number | null, signal: NodeJS.Signals | null) => {
|
|
55
|
+
if (settled) return;
|
|
56
|
+
settled = true;
|
|
57
|
+
clearTimeout(timer);
|
|
58
|
+
// A grandchild that inherited the pipes may still hold them open: stop reading.
|
|
59
|
+
child.stdout.destroy();
|
|
60
|
+
child.stderr.destroy();
|
|
61
|
+
resolve({ stdout, stderr, status, signal, ...(error ? { error } : {}) });
|
|
62
|
+
};
|
|
63
|
+
const collect = (sink: "stdout" | "stderr") => (chunk: string) => {
|
|
64
|
+
bytes[sink] += Buffer.byteLength(chunk);
|
|
65
|
+
if (bytes[sink] > opts.maxBuffer) {
|
|
66
|
+
fail("ENOBUFS");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (sink === "stdout") stdout += chunk;
|
|
70
|
+
else stderr += chunk;
|
|
71
|
+
};
|
|
72
|
+
child.stdout.setEncoding("utf8");
|
|
73
|
+
child.stderr.setEncoding("utf8");
|
|
74
|
+
child.stdout.on("data", collect("stdout"));
|
|
75
|
+
child.stderr.on("data", collect("stderr"));
|
|
76
|
+
// A child that exits before reading its prompt closes the pipe: the exit status says what happened.
|
|
77
|
+
child.stdin.on("error", () => {});
|
|
78
|
+
child.on("error", (e) => {
|
|
79
|
+
error ??= e as NodeJS.ErrnoException;
|
|
80
|
+
finish(null, null);
|
|
81
|
+
});
|
|
82
|
+
child.on("close", (status, signal) => finish(status, signal));
|
|
83
|
+
// `close` waits for every holder of the pipes. After our own kill (time limit, output cap)
|
|
84
|
+
// the child's exit is the answer; otherwise a lingering holder gets a moment to let go.
|
|
85
|
+
child.on("exit", (status, signal) => {
|
|
86
|
+
if (error) finish(status, signal);
|
|
87
|
+
else {
|
|
88
|
+
// It exited by itself: the time limit no longer applies to what is only a pipe being drained.
|
|
89
|
+
clearTimeout(timer);
|
|
90
|
+
setTimeout(() => finish(status, signal), PIPE_GRACE_MS).unref();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
child.stdin.end(opts.input);
|
|
94
|
+
});
|
|
95
|
+
}
|
package/src/providers/types.ts
CHANGED
|
@@ -121,6 +121,9 @@ export interface ProviderAdapter {
|
|
|
121
121
|
* or anything shaped like one). The engine throws and posts nothing.
|
|
122
122
|
*/
|
|
123
123
|
leaksSecret(texts: string[]): boolean;
|
|
124
|
-
/**
|
|
125
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Runs one call to completion without blocking the process: the engine keeps several calls in
|
|
126
|
+
* flight at once (the batches of one review). Rejects when the call produced no result at all.
|
|
127
|
+
*/
|
|
128
|
+
run(request: ProviderRequest): Promise<ProviderResult>;
|
|
126
129
|
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The repository settings file `.wachiman.yml` as the engine reads it (ADR 0048, ADR 0049).
|
|
3
|
+
*
|
|
4
|
+
* `init` writes it with plain string handling (`src/init/settings.ts`); everything that reads it
|
|
5
|
+
* goes through `parseRepoSettings`, so what counts as valid is decided in one place. The keys are
|
|
6
|
+
* `kind` (metadata), `model` and `effort`. Unknown keys are ignored.
|
|
7
|
+
*
|
|
8
|
+
* Where the file is read from is a spend decision, not a convenience: in Actions it comes from the
|
|
9
|
+
* pull request's base commit and locally from the merge-base, never from the head, so a change
|
|
10
|
+
* cannot raise the model or the effort it is reviewed under (`readBaseSettings` in engine.ts,
|
|
11
|
+
* `localRepoSettings` in connectors/local-git.ts). The values lose to an explicit
|
|
12
|
+
* `WACHIMAN_MODEL` / `WACHIMAN_EFFORT` (a workflow input or the environment) and win over the
|
|
13
|
+
* built-in defaults.
|
|
14
|
+
*/
|
|
15
|
+
import { UsageError, type EngineConfig, type SettingSource } from "./config";
|
|
16
|
+
import { PER_BATCH_USD } from "./estimate";
|
|
17
|
+
import { DEFAULT_MODELS } from "./providers";
|
|
18
|
+
import { DEFAULT_EFFORT, EFFORTS, type Effort } from "./providers/types";
|
|
19
|
+
|
|
20
|
+
/** The file's place: the repository root, in every mode. */
|
|
21
|
+
export const SETTINGS_PATH = ".wachiman.yml";
|
|
22
|
+
|
|
23
|
+
/** The older place of a development build; never read, only reported by `wachiman doctor`. */
|
|
24
|
+
export const OLD_SETTINGS_PATH = ".github/wachiman.yml";
|
|
25
|
+
|
|
26
|
+
export interface RepoSettings {
|
|
27
|
+
/** `monorepo` or `single` when `init` wrote it; any text a person typed otherwise. Metadata only. */
|
|
28
|
+
kind?: string;
|
|
29
|
+
model?: string;
|
|
30
|
+
effort?: Effort;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The settings in a `.wachiman.yml`. An empty file, or one with only comments, holds nothing. A
|
|
35
|
+
* key set to nothing (`model:`) counts as not set. Unparseable YAML, a file that is not a
|
|
36
|
+
* mapping, a `model` that is not text and an unknown `effort` are usage errors that name the file:
|
|
37
|
+
* a silent fallback would run the review under a model or effort nobody chose.
|
|
38
|
+
*/
|
|
39
|
+
export function parseRepoSettings(content: string): RepoSettings {
|
|
40
|
+
let doc: unknown;
|
|
41
|
+
try {
|
|
42
|
+
doc = Bun.YAML.parse(content);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
throw new UsageError(`${SETTINGS_PATH} is not valid YAML (${oneLine(error instanceof Error ? error.message : String(error))}). Fix it, or remove the file to use the defaults.`);
|
|
45
|
+
}
|
|
46
|
+
if (doc === null || doc === undefined) return {};
|
|
47
|
+
if (typeof doc !== "object" || Array.isArray(doc)) {
|
|
48
|
+
throw new UsageError(`${SETTINGS_PATH} must be a mapping of settings (kind, model, effort), like \`effort: high\`.`);
|
|
49
|
+
}
|
|
50
|
+
const map = doc as Record<string, unknown>;
|
|
51
|
+
const settings: RepoSettings = {};
|
|
52
|
+
if (typeof map.kind === "string" && map.kind.trim() !== "") settings.kind = map.kind.trim();
|
|
53
|
+
const model = map.model;
|
|
54
|
+
if (model !== undefined && model !== null) {
|
|
55
|
+
if (typeof model !== "string" || model.trim() === "") {
|
|
56
|
+
throw new UsageError(`${SETTINGS_PATH}: model must be a model name such as claude-sonnet-5-5, got ${JSON.stringify(model)}.`);
|
|
57
|
+
}
|
|
58
|
+
settings.model = model.trim();
|
|
59
|
+
}
|
|
60
|
+
const effort = map.effort;
|
|
61
|
+
if (effort !== undefined && effort !== null) {
|
|
62
|
+
if (typeof effort !== "string" || !(EFFORTS as readonly string[]).includes(effort)) {
|
|
63
|
+
throw new UsageError(`${SETTINGS_PATH}: effort must be one of ${EFFORTS.join(", ")}, got "${String(effort)}".`);
|
|
64
|
+
}
|
|
65
|
+
settings.effort = effort as Effort;
|
|
66
|
+
}
|
|
67
|
+
return settings;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The warning for a broken file that a run ignores (it never blocks a review): what was wrong, and that defaults apply. */
|
|
71
|
+
export const ignoredSettingsNote = (reason: string, where: string) => `ignored ${SETTINGS_PATH} at ${where}: ${reason.trim().replace(/\.$/, "")}; using defaults`;
|
|
72
|
+
|
|
73
|
+
const oneLine = (text: string) => text.replace(/\s+/g, " ").trim().slice(0, 200);
|
|
74
|
+
|
|
75
|
+
const FAMILIES = Object.keys(PER_BATCH_USD);
|
|
76
|
+
const CLAUDE_ID = new RegExp(`^(claude-)?(${FAMILIES.join("|")})(-|$)`);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Whether Wachiman knows `model` as a Claude one: its id has the shape of Claude's own
|
|
80
|
+
* (`claude-sonnet-5-5`) or is a bare family alias (`sonnet`), for a family in the measured cost
|
|
81
|
+
* table (`PER_BATCH_USD`). A substring would let `my-sonnet-proxy` through.
|
|
82
|
+
*/
|
|
83
|
+
export const isKnownClaudeModel = (model: string) => CLAUDE_ID.test(model.toLowerCase());
|
|
84
|
+
|
|
85
|
+
/** Why a file model is skipped on this provider, or undefined when it applies. Shared by runs and `wachiman doctor`. */
|
|
86
|
+
export function skippedFileModel(provider: string, model: string): string | undefined {
|
|
87
|
+
if (provider !== "claude-code" || isKnownClaudeModel(model)) return undefined;
|
|
88
|
+
return `not a Claude model Wachiman knows (its id is not claude-<${FAMILIES.join("|")}>-...)`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* `config` with the file's `model` and `effort` where nothing explicit set them: a value that came
|
|
93
|
+
* from the environment is never replaced, and a default always is. On Claude Code a file model
|
|
94
|
+
* that is not a known Claude model is skipped with a warning naming `where` (Claude Code's
|
|
95
|
+
* preflight never checks the model, so it would fail every batch, including the pull request that
|
|
96
|
+
* fixes the file); Codex checks its own price table in preflight.
|
|
97
|
+
*/
|
|
98
|
+
export function applyRepoSettings(config: EngineConfig, settings: RepoSettings, opts: { where: string; warn: (line: string) => void }): EngineConfig {
|
|
99
|
+
const next = { ...config };
|
|
100
|
+
if (config.modelSource === "default" && settings.model !== undefined) {
|
|
101
|
+
const skipped = skippedFileModel(config.provider, settings.model);
|
|
102
|
+
if (skipped !== undefined) {
|
|
103
|
+
opts.warn(`ignored model "${settings.model}" from ${SETTINGS_PATH} at ${opts.where}: ${skipped}; using ${config.model}`);
|
|
104
|
+
} else {
|
|
105
|
+
next.model = settings.model;
|
|
106
|
+
next.modelSource = "file";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (config.effortSource === "default" && settings.effort !== undefined) {
|
|
110
|
+
next.effort = settings.effort;
|
|
111
|
+
next.effortSource = "file";
|
|
112
|
+
}
|
|
113
|
+
return next;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Whether the file may change anything: only a default is ever replaced, so an explicit pair needs no read. */
|
|
117
|
+
export const wantsRepoSettings = (config: Pick<EngineConfig, "modelSource" | "effortSource">) =>
|
|
118
|
+
config.modelSource === "default" || config.effortSource === "default";
|
|
119
|
+
|
|
120
|
+
/** `model` and `effort` that came from the file, for a log line; undefined when neither did. */
|
|
121
|
+
export function fileSettingsNote(config: Pick<EngineConfig, "model" | "modelSource" | "effort" | "effortSource">, where: string): string | undefined {
|
|
122
|
+
const parts = [
|
|
123
|
+
...(config.modelSource === "file" ? [`model ${config.model}`] : []),
|
|
124
|
+
...(config.effortSource === "file" ? [`effort ${config.effort}`] : []),
|
|
125
|
+
];
|
|
126
|
+
return parts.length === 0 ? undefined : `${parts.join(", ")} from ${SETTINGS_PATH} at ${where}`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface EffectiveSetting {
|
|
130
|
+
value: string;
|
|
131
|
+
source: SettingSource;
|
|
132
|
+
/** Set when the file's model was skipped (a run would ignore it); `value` is then the default. */
|
|
133
|
+
skipped?: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* What a run in this environment would use for the model and the effort, and why. Read-only and
|
|
138
|
+
* forgiving, for `wachiman doctor`: an unusable environment value is reported as it is, never thrown.
|
|
139
|
+
*/
|
|
140
|
+
export function effectiveSettings(
|
|
141
|
+
env: Record<string, string | undefined>,
|
|
142
|
+
settings: RepoSettings | undefined,
|
|
143
|
+
): { model: EffectiveSetting; effort: EffectiveSetting } {
|
|
144
|
+
const first = (...names: string[]) => names.map((n) => env[n]).find((v) => v !== undefined && v !== "");
|
|
145
|
+
const provider = first("WACHIMAN_PROVIDER", "CLAUDE_REVIEW_PROVIDER") ?? "claude-code";
|
|
146
|
+
const model = first("WACHIMAN_MODEL", "CLAUDE_REVIEW_MODEL");
|
|
147
|
+
const effort = first("WACHIMAN_EFFORT", "CLAUDE_REVIEW_EFFORT", "WACHIMAN_REASONING_EFFORT", "CLAUDE_REVIEW_REASONING_EFFORT");
|
|
148
|
+
const defaultModel = DEFAULT_MODELS[provider as keyof typeof DEFAULT_MODELS] ?? DEFAULT_MODELS["claude-code"];
|
|
149
|
+
const skipped = settings?.model !== undefined ? skippedFileModel(provider, settings.model) : undefined;
|
|
150
|
+
return {
|
|
151
|
+
model:
|
|
152
|
+
model !== undefined
|
|
153
|
+
? { value: model, source: "env" }
|
|
154
|
+
: settings?.model !== undefined && skipped === undefined
|
|
155
|
+
? { value: settings.model, source: "file" }
|
|
156
|
+
: { value: defaultModel, source: "default", ...(skipped !== undefined ? { skipped } : {}) },
|
|
157
|
+
effort: effort !== undefined ? { value: effort, source: "env" } : settings?.effort !== undefined ? { value: settings.effort, source: "file" } : { value: DEFAULT_EFFORT, source: "default" },
|
|
158
|
+
};
|
|
159
|
+
}
|
package/src/setup/prompt.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { basename, join } from "node:path";
|
|
8
8
|
import { binaryProblem, checkExternalConfigDir, checkNewProfileName } from "../accounts/commands";
|
|
9
9
|
import type { ProjectBinding, WachimanConfigV1 } from "../accounts/config";
|
|
10
|
-
import { buildProfileList, managedDir, refersTo, type ProfileListEntry } from "../accounts/profile-list";
|
|
10
|
+
import { buildProfileList, detectClaudeDirs, managedDir, refersTo, type ProfileListEntry } from "../accounts/profile-list";
|
|
11
11
|
import { checkProfileName, ISOLATED_NAME, parseProfileRef } from "../accounts/resolve";
|
|
12
12
|
import { UsageError } from "../config";
|
|
13
13
|
import type { HistoryRepository } from "../history/types";
|
|
@@ -30,7 +30,7 @@ export interface SetupPromptContext {
|
|
|
30
30
|
userHome: string;
|
|
31
31
|
/** Creates the managed directory and runs the sign-in; called only after the person confirmed that side effect. */
|
|
32
32
|
createManaged: (name: string) => void;
|
|
33
|
-
/** init already collected the local-mode choice
|
|
33
|
+
/** init already collected the local-mode choice: the binding is saved without a second question. */
|
|
34
34
|
fromInit?: boolean;
|
|
35
35
|
initMode?: "local" | "both";
|
|
36
36
|
}
|
|
@@ -43,13 +43,17 @@ export type SetupAnswers =
|
|
|
43
43
|
|
|
44
44
|
const REGISTER = Symbol("register");
|
|
45
45
|
const CREATE = Symbol("create");
|
|
46
|
+
/** A `~/.claude-<name>` directory found in the home, picked to be registered and used in place. */
|
|
47
|
+
interface DetectedPick {
|
|
48
|
+
detected: { name: string; configDir: string };
|
|
49
|
+
}
|
|
46
50
|
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
/**
|
|
52
|
+
* How many steps the session shows. Standalone: 3 (Project, Claude account, Checks).
|
|
53
|
+
* From init, which already showed Project, Project type and Review mode: local has 5 in all (the
|
|
54
|
+
* account and the checks follow), and both has 6 (the GitHub workflow comes before the account).
|
|
55
|
+
*/
|
|
56
|
+
export const setupStepTotal = (fromInit: boolean | undefined, initMode: "local" | "both" | undefined) => (fromInit ? (initMode === "both" ? 6 : 5) : 3);
|
|
53
57
|
|
|
54
58
|
/** A profile name proposed from a directory: `.claude-work` becomes `claude-work`; taken or reserved names get a number. */
|
|
55
59
|
export function suggestProfileName(configDir: string, taken: (name: string) => boolean) {
|
|
@@ -66,6 +70,8 @@ export function suggestProfileName(configDir: string, taken: (name: string) => b
|
|
|
66
70
|
for (let n = 2; ; n++) if (free(`${base}-${n}`)) return `${base}-${n}`;
|
|
67
71
|
}
|
|
68
72
|
|
|
73
|
+
const tildePath = (path: string, userHome: string) => (path.startsWith(`${userHome}/`) ? `~${path.slice(userHome.length)}` : path);
|
|
74
|
+
|
|
69
75
|
const problemOf = (check: () => unknown): string | undefined => {
|
|
70
76
|
try {
|
|
71
77
|
check();
|
|
@@ -81,7 +87,7 @@ export async function promptForSetup(flags: RawSetupFlags, ctx: SetupPromptConte
|
|
|
81
87
|
const registered = (name: string) => Object.hasOwn(config?.profiles ?? {}, name);
|
|
82
88
|
const say = (line: string) => prompter.say(line);
|
|
83
89
|
|
|
84
|
-
const total = ctx.fromInit
|
|
90
|
+
const total = setupStepTotal(ctx.fromInit, ctx.initMode);
|
|
85
91
|
if (!ctx.fromInit) {
|
|
86
92
|
prompter.step("Project", 1, total);
|
|
87
93
|
say(`repository: ${repo.name} (${repo.keyedBy === "remote" ? `origin ${repo.remote ?? "(unparsed)"}` : `path ${repo.path}`})`);
|
|
@@ -92,13 +98,14 @@ export async function promptForSetup(flags: RawSetupFlags, ctx: SetupPromptConte
|
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
let name = flags.profile;
|
|
95
|
-
|
|
101
|
+
// Standalone: Project, Claude account, Checks. There is no confirm step: picking the account is the confirmation.
|
|
102
|
+
prompter.step("Claude account", ctx.fromInit ? total - 1 : 2, total);
|
|
96
103
|
if (ctx.fromInit && ctx.current) say(`currently bound to ${ctx.current.profile}`);
|
|
97
104
|
let pending: PendingProfile | undefined;
|
|
98
105
|
while (name === undefined) {
|
|
99
106
|
const list = buildProfileList(home, config);
|
|
100
107
|
const profiles: ProfileListEntry[] = [{ name: "default", kind: "default", registered: true, usedBy: [] }, ...list.profiles];
|
|
101
|
-
const rows: { label: string; description?: string; value: string | typeof REGISTER | typeof CREATE }[] = profiles.map((p) => {
|
|
108
|
+
const rows: { label: string; description?: string; value: string | typeof REGISTER | typeof CREATE | DetectedPick }[] = profiles.map((p) => {
|
|
102
109
|
const marks = [
|
|
103
110
|
ctx.current && (ctx.current.profile === p.name || refersTo(ctx.current.profile, p.name)) ? "(current)" : "",
|
|
104
111
|
list.defaultProfile !== undefined && (list.defaultProfile === p.name || refersTo(list.defaultProfile, p.name)) ? "(global default)" : "",
|
|
@@ -108,6 +115,15 @@ export async function promptForSetup(flags: RawSetupFlags, ctx: SetupPromptConte
|
|
|
108
115
|
const label = p.kind === "default" ? "Use my current Claude session" : `${p.name} ${p.kind}`;
|
|
109
116
|
return { label: `${label}${marks.length ? ` ${marks.join(" ")}` : ""}`, description: p.kind === "default" ? "Shares your normal Claude settings." : where, value: p.name };
|
|
110
117
|
});
|
|
118
|
+
// Wachiman starts the claude binary itself, so a shell alias or function that points claude at another directory is invisible to it.
|
|
119
|
+
// These directories are the likely place the person's real session lives.
|
|
120
|
+
const detected = detectClaudeDirs(ctx.userHome, config).filter(
|
|
121
|
+
(d) =>
|
|
122
|
+
!registered(d.name) &&
|
|
123
|
+
problemOf(() => checkNewProfileName(d.name, home)) === undefined &&
|
|
124
|
+
problemOf(() => checkExternalConfigDir(d.configDir, home, ctx.userHome, "Configuration directory")) === undefined,
|
|
125
|
+
);
|
|
126
|
+
for (const d of detected) rows.push({ label: `${tildePath(d.configDir, ctx.userHome)} (your own Claude directory, used in place)`, description: `registers the profile ${d.name}`, value: { detected: d } });
|
|
111
127
|
rows.push({ label: "Create a new isolated profile (managed)", value: CREATE });
|
|
112
128
|
rows.push({ label: "Register an existing Claude configuration directory (external)", value: REGISTER });
|
|
113
129
|
const indexOf = (ref: string) => profiles.findIndex((p) => ref === p.name || refersTo(ref, p.name));
|
|
@@ -118,7 +134,11 @@ export async function promptForSetup(flags: RawSetupFlags, ctx: SetupPromptConte
|
|
|
118
134
|
const picked = await prompter.select(label, rows, defaultIndex);
|
|
119
135
|
if (picked === null) return { kind: "cancelled" };
|
|
120
136
|
|
|
121
|
-
if (picked ===
|
|
137
|
+
if (typeof picked === "object") {
|
|
138
|
+
const { name: proposed, configDir } = picked.detected;
|
|
139
|
+
pending = { kind: "external", name: proposed, configDir };
|
|
140
|
+
name = proposed;
|
|
141
|
+
} else if (picked === REGISTER) {
|
|
122
142
|
const dir = await prompter.text("Configuration directory (absolute; ~ is expanded)", undefined, (v) =>
|
|
123
143
|
v === "" ? "A directory is required." : problemOf(() => checkExternalConfigDir(v, home, ctx.userHome, "Configuration directory")),
|
|
124
144
|
);
|
|
@@ -138,19 +158,28 @@ export async function promptForSetup(flags: RawSetupFlags, ctx: SetupPromptConte
|
|
|
138
158
|
pending = { kind: "external", name: chosen, configDir, ...(binary ? { binary } : {}) };
|
|
139
159
|
name = chosen;
|
|
140
160
|
} else if (picked === CREATE) {
|
|
161
|
+
// The directory is claude-<name>, so "claude-isolated" would make claude-claude-isolated.
|
|
162
|
+
const claudePrefixProblem = (v: string) => {
|
|
163
|
+
if (!v.startsWith("claude-")) return undefined;
|
|
164
|
+
const bare = v.slice("claude-".length);
|
|
165
|
+
if (registered(bare)) return `The directory is already named claude-<name>, and "${bare}" is registered: pick it from the list instead.`;
|
|
166
|
+
const usable = bare !== "default" && problemOf(() => checkProfileName(bare)) === undefined;
|
|
167
|
+
return usable
|
|
168
|
+
? `The directory is already named claude-<name>: type "${bare}" for ${managedDir(home, bare)}.`
|
|
169
|
+
: "The directory is already named claude-<name>: type the name without claude-.";
|
|
170
|
+
};
|
|
141
171
|
const chosen = await prompter.text("Profile name", ISOLATED_NAME, (v) =>
|
|
142
172
|
registered(v)
|
|
143
173
|
? `"${v}" is already registered; pick it from the list instead.`
|
|
144
174
|
: v === "default"
|
|
145
175
|
? `"default" is reserved (the built-in profile); choose another name.`
|
|
146
|
-
: problemOf(() => checkProfileName(v)),
|
|
176
|
+
: (problemOf(() => checkProfileName(v)) ?? claudePrefixProblem(v)),
|
|
147
177
|
);
|
|
148
178
|
if (chosen === null) return { kind: "cancelled" };
|
|
149
179
|
const dir = managedDir(home, chosen);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
);
|
|
180
|
+
// The question stays one short line; the details go on the line above it.
|
|
181
|
+
say("Nothing is registered yet, and Wachiman cannot undo a sign-in.");
|
|
182
|
+
const ok = await prompter.confirm(`Create ${dir} (mode 0700) and open Claude there so you can sign in?`, true);
|
|
154
183
|
if (ok === null) return { kind: "cancelled" };
|
|
155
184
|
if (!ok) continue;
|
|
156
185
|
ctx.createManaged(chosen);
|
|
@@ -163,21 +192,8 @@ export async function promptForSetup(flags: RawSetupFlags, ctx: SetupPromptConte
|
|
|
163
192
|
parseProfileRef(name);
|
|
164
193
|
|
|
165
194
|
const p = pending;
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
const binary = p?.kind === "external" ? p.binary : known?.kind === "external" ? known.binary : undefined;
|
|
170
|
-
prompter.step("Confirm binding", total - 1, total);
|
|
171
|
-
say("Bind this repository:");
|
|
172
|
-
say(` profile: ${name}`);
|
|
173
|
-
say(` kind: ${kind}`);
|
|
174
|
-
say(` directory: ${directory ?? "(your shell's own Claude configuration)"}`);
|
|
175
|
-
say(` binary: ${binary ?? "claude from PATH"}`);
|
|
176
|
-
say(` repository: ${repo.name}, ${identityLine(repo)}`);
|
|
177
|
-
say(` scope: ${scopeSentence(repo)}`);
|
|
178
|
-
say(` will write: ${join(home, "config.json")}${p ? `, registering ${p.name} and binding ${repo.name} together` : `, binding ${repo.name}`}; nothing is written in the repository`);
|
|
179
|
-
const bind = await prompter.confirm(`Bind ${repo.name} to ${name}?`, true);
|
|
180
|
-
if (bind === null) return { kind: "cancelled" };
|
|
181
|
-
if (!bind) return { kind: "declined" };
|
|
195
|
+
// Picking the account is the confirmation. One plain line says what was chosen and where it is saved.
|
|
196
|
+
const scope = repo.keyedBy === "remote" ? `every clone of ${repo.remote ?? "this origin"}` : "this repository and its worktrees";
|
|
197
|
+
say(`local reviews of ${repo.name} (${scope}) will use the account "${name}"${p ? `, registered from ${p.configDir}` : ""}; saved in ${join(home, "config.json")}, nothing in the repository`);
|
|
182
198
|
return { kind: "confirmed", flags: { ...flags, profile: name }, ...(p ? { pending: p } : {}) };
|
|
183
199
|
}
|