-v raises the CLI's log level per repeat; -q prints only fatal errors (closes #212)
check / check (push) Waiting to run

Every line quak prints on stderr now goes through one log, in
src/cli-log.ts, at one of six levels. The default, info, prints what quak
printed before. -v adds each retry and the start and end of each refresh
and ML data fetch; -vv adds each request with its result. -q prints only
the line a failing command exits with, and is refused with -v. Both are
program options. withRetry reports retries through a new onRetry, and
ApiClient reports requests through a new onRequest; the CLI logs what
they report. --json now changes stdout only, so backup and --json runs
log their progress on stderr.

Model: opus-5-5
This commit is contained in:
2026-10-18 18:36:33 +00:00
parent 92e0c6c791
commit f9969b2525
17 changed files with 876 additions and 155 deletions
+7 -2
View File
@@ -54,6 +54,7 @@ import {
saveSession,
type CliContext,
} from "../../src/cli-commands.js";
import { stderrLog } from "../../src/cli-log.js";
import { run } from "../../src/cli-run.js";
import { loadSession } from "../../src/cli-session.js";
import { Client } from "../../src/client.js";
@@ -303,9 +304,10 @@ const backup = async (
const prompted = async (): Promise<never> => {
throw new Error("quak backup prompted");
};
const log = stderrLog(stderr, "info");
const ctx: CliContext = {
stdout,
stderr,
log,
sessionDir,
cacheDir: `${dir}-cache`,
loadSession: (path) =>
@@ -319,7 +321,7 @@ const backup = async (
promptSecret: prompted,
};
const code = await new Promise<number>((resolve) => {
void run(backupCommand(ctx, dir, opts), stdout, stderr, resolve);
void run(backupCommand(ctx, dir, opts), stdout, stderr, log, resolve);
});
return { code, stderr: printed, stdout: output };
};
@@ -1104,6 +1106,9 @@ describe("a backup whose lock is lost", () => {
expect(code).toBe(1);
expect(stderr).toBe(
"Starting backup...\n" +
"Fetched the files of 1 of 3 collections\n" +
"Fetched the files of 2 of 3 collections\n" +
"Fetched the files of 3 of 3 collections\n" +
"Refreshing library...\n" +
"Fetching original beach.jpg (100)...\n" +
"Fetching original IMG_0002.HEIC (300)...\n" +