commit b815491b6c7004ca1e16eed635f30f41609fe2f0
parent a4fef285a528ce8158d8fe982d027bf970fddab8
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 23:42:40 -0500
umtool: the take-patch edits say they are deprecated -- --in-take, timeline/window --take, /api/report/takes/timeline (L3 S6)
Every edit lands in the draft now (L3); the paths that still write a take's patch keep working, and each says
so in ONE line on stderr: "umtool: <what> is deprecated -- edits land in the draft now; open the take there
first (umtool takes open <p> <t>) and edit without it" (lib/report/takeDeprecation.mjs). `posts … --in-take`
(and its --take alias), `timeline <verb> --take` for a write (`ls` reads and stays quiet), `window --take`, and
the old take walk's route (GET and POST, on the server's stderr, with a `Deprecation: true` header). stdout
and --json are unchanged.
Tests: takeDeprecation.test.mjs (the line); takeEdit.test.mjs (timeline move --take warns once, ls not);
takeScope.test.mjs (posts set-item --in-take warns and still lands).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
8 files changed, 65 insertions(+), 4 deletions(-)
diff --git a/umtool/app/api/report/takes/timeline/route.ts b/umtool/app/api/report/takes/timeline/route.ts
@@ -4,6 +4,7 @@ import { StaleToken, StructureRefused } from "@/lib/report/manifest.mjs";
import { insertTakeEntry, moveTakeEntry, removeTakeEntry, takeToken, undoTakeEdit } from "@/lib/report/takeEdit.mjs";
import { resolveTakeManifest } from "@/lib/report/takeManifest.mjs";
import { isTakeId } from "@/lib/report/takes.mjs";
+import { takeEditDeprecation } from "@/lib/report/takeDeprecation.mjs";
export const dynamic = "force-dynamic";
@@ -22,6 +23,13 @@ export const dynamic = "force-dynamic";
// timeline, as the project's GET /api/report/timeline lists it (Add a clip's place picker, on a take).
//
// A stale token is a 409; a structure the build would refuse is a 400 with its sentences.
+//
+// DEPRECATED (L3 S6): no page calls it (edits land in the draft; a take is opened there first). Each call says
+// so in one line on the server's stderr and answers with a `Deprecation: true` header.
+const deprecated = (project: string | null, take: string | null) => {
+ console.warn(takeEditDeprecation("/api/report/takes/timeline", { project, take }));
+ return { deprecation: "true" };
+};
export async function GET(request: Request) {
const url = new URL(request.url);
const take = url.searchParams.get("take");
@@ -39,7 +47,7 @@ export async function GET(request: Request) {
channel: str(e.channel),
words: (str(e.quote) ?? str(e.text) ?? str(e.title) ?? "").replace(/\s+/g, " ").slice(0, 60),
}));
- return Response.json({ take, token: await takeToken(project.dir, take), timeline }, { headers: { "cache-control": "no-store" } });
+ return Response.json({ take, token: await takeToken(project.dir, take), timeline }, { headers: { "cache-control": "no-store", ...deprecated(project.id, take) } });
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
return Response.json({ error: message }, { status: /^no take /.test(message) ? 404 : 400 });
@@ -55,6 +63,7 @@ export async function POST(request: Request) {
const project = await projectRef(String(body.project ?? ""));
if (!project) return Response.json({ error: "no such project" }, { status: 404 });
const take = body.take;
+ const dep = deprecated(project.id, take);
const token = body.token === undefined || body.token === null ? null : String(body.token);
const at = body.at === undefined || body.at === null ? null : Number(body.at);
const id = typeof body.id === "string" ? body.id : "";
@@ -74,7 +83,7 @@ export async function POST(request: Request) {
} else {
return Response.json({ error: "op must be move, remove, undo or insert" }, { status: 400 });
}
- return Response.json({ ok: true, op: body.op, take, ...r }, { headers: { "cache-control": "no-store" } });
+ return Response.json({ ok: true, op: body.op, take, ...r }, { headers: { "cache-control": "no-store", ...dep } });
} catch (e) {
if (e instanceof StaleToken) return Response.json({ error: e.message, expected: e.expected, got: e.got, stale: true }, { status: 409 });
if (e instanceof StructureRefused) return Response.json({ error: e.message, errors: e.errors }, { status: 400 });
diff --git a/umtool/bin/umtool.mjs b/umtool/bin/umtool.mjs
@@ -1159,6 +1159,7 @@ async function cmdWindow() {
// same rules, an undo point first -- never into the project's manifest.
const take = val("--take");
if (take !== undefined) {
+ (await import("../lib/report/takeDeprecation.mjs")).warnTakeEdit("window --take", { project: p.id, take });
try {
const { updateTakeClip } = await import("../lib/report/takeEdit.mjs");
const res = await updateTakeClip(p.dir, take, clipId, patch);
diff --git a/umtool/lib/report/postsCli.mjs b/umtool/lib/report/postsCli.mjs
@@ -455,7 +455,12 @@ export async function postsCommand(args, { root = REPORTS_ROOT, out = (s) => con
err(e instanceof Error ? e.message : String(e));
return 2;
}
- if (scoped) return inTakeCommand(scoped, { root, out, err });
+ if (scoped) {
+ const { takeEditDeprecation } = await import("./takeDeprecation.mjs");
+ const proj = scoped.rest.filter((w) => !w.startsWith("--"))[1] ?? null;
+ err(takeEditDeprecation(`posts ${scoped.verb ?? ""} --in-take`.replace(/\s+/g, " "), { project: proj, take: scoped.take }));
+ return inTakeCommand(scoped, { root, out, err });
+ }
const words = [];
const flags = new Map();
const multis = new Map();
diff --git a/umtool/lib/report/takeDeprecation.mjs b/umtool/lib/report/takeDeprecation.mjs
@@ -0,0 +1,23 @@
+// THE TAKE-PATCH EDITS, DEPRECATED (umtool redesign L3, S6). Every edit lands in the working draft now; a saved
+// version is frozen and is edited by opening it in the draft (`umtool takes open <p> <v>`). The CLI paths that
+// still write a take's patch -- `--in-take`, `timeline --take`, `window --take` -- and the route behind the
+// old take walk (/api/report/takes/timeline) keep working for now, each saying so in ONE line on stderr, so a
+// script that leans on them hears it before they go.
+//
+// Plain ESM: the CLI and the route both read it.
+
+/**
+ * The one line, for `what` (the flag or route as typed) on take `take` of project `project`.
+ * @param {string} what
+ * @param {{ project?: string | null, take?: string | null }} [o]
+ */
+export function takeEditDeprecation(what, { project = null, take = null } = {}) {
+ const p = project ?? "<p>";
+ const t = take ?? "<take>";
+ return `umtool: ${what} is deprecated -- edits land in the draft now; open the take there first (umtool takes open ${p} ${t}) and edit without it`;
+}
+
+/** Say it on stderr (once per call). */
+export function warnTakeEdit(what, o = {}, write = (s) => process.stderr.write(`${s}\n`)) {
+ write(takeEditDeprecation(what, o));
+}
diff --git a/umtool/lib/report/takeDeprecation.test.mjs b/umtool/lib/report/takeDeprecation.test.mjs
@@ -0,0 +1,12 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import { takeEditDeprecation, warnTakeEdit } from "./takeDeprecation.mjs";
+
+test("the take-patch edits' deprecation: one line, naming the flag and the way there", () => {
+ const line = takeEditDeprecation("window --take", { project: "reports/x", take: "v2" });
+ assert.equal(line, "umtool: window --take is deprecated -- edits land in the draft now; open the take there first (umtool takes open reports/x v2) and edit without it");
+ assert.doesNotMatch(line, /\n/);
+ const said = [];
+ warnTakeEdit("--in-take", {}, (s) => said.push(s));
+ assert.deepEqual(said, ["umtool: --in-take is deprecated -- edits land in the draft now; open the take there first (umtool takes open <p> <take>) and edit without it"]);
+});
diff --git a/umtool/lib/report/takeEdit.test.mjs b/umtool/lib/report/takeEdit.test.mjs
@@ -303,6 +303,9 @@ test("the CLI twins: umtool walk --take, umtool timeline --take, umtool take --p
out.length = 0;
assert.equal(await timelineCommand(["proj", "--take", "tight", "move", "t03a", "--to", "0"], io), 0, err.join("\n"));
assert.match(out.join("\n"), /take tight: moved t03a: 3 -> 0/);
+ // Deprecated (L3 S6): one line on stderr for a write, and it still works; `ls` (a read) says nothing.
+ assert.deepEqual(err, ["umtool: timeline move --take is deprecated -- edits land in the draft now; open the take there first (umtool takes open proj tight) and edit without it"]);
+ err.length = 0;
assert.equal(await timelineCommand(["proj", "--take", "tight", "undo"], io), 0, err.join("\n"));
// "Add to this take only" (lane/ui-simplify): a clip into the take's timeline, never the project's.
const masterBefore = await masterText(dir);
@@ -316,8 +319,10 @@ test("the CLI twins: umtool walk --take, umtool timeline --take, umtool take --p
assert.equal(await timelineCommand(["proj", "--take", "tight", "undo"], io), 0, err.join("\n"));
assert.equal(await timelineCommand(["proj", "--take", "tight", "insert", "chan/vid@1-5"], io), 2, "insert needs --after");
out.length = 0;
+ err.length = 0;
assert.equal(await timelineCommand(["proj", "--take", "tight", "ls"], io), 0, err.join("\n"));
assert.match(out.join("\n"), /4 entries in take tight of proj$/, "the move was undone: nothing left to undo");
+ assert.deepEqual(err, [], "ls reads: no warning");
const log = [];
const before = await masterText(dir);
diff --git a/umtool/lib/report/takeScope.test.mjs b/umtool/lib/report/takeScope.test.mjs
@@ -108,6 +108,8 @@ test("--in-take: set-item, narrate --pick, roles --set and fx land in the take's
assert.match(r.out, /on take t1 \(its patch; scope-a's manifest untouched\): 1 edit\(s\), undo point takes\/t1\/revisions\/.*-auto-before-post-item\.take\.json -- umtool timeline scope-a --take t1 undo/);
assert.equal(await text(a), before, "the project's manifest is never written");
assert.equal((await takeDoc(a, "t1")).patch.timeline.find((e) => e.id === "p-1").hold, 4);
+ // Deprecated (L3 S6): it still lands, and says so in one line on stderr.
+ assert.equal(r.err, "umtool: posts set-item --in-take is deprecated -- edits land in the draft now; open the take there first (umtool takes open scope-a t1) and edit without it");
// The alias: set-item's --take <t> is --in-take <t>; --json is the command's own object with the take.
r = await posts("set-item", "scope-a", "p-1", "thread.group=g1", "--take", "t1", "--json");
assert.equal(r.code, 0, r.err);
diff --git a/umtool/lib/report/timelineCli.mjs b/umtool/lib/report/timelineCli.mjs
@@ -552,7 +552,11 @@ export async function timelineCommand(args, { root = REPORTS_ROOT, out = (s) =>
const project = await projectOf(projectArg, root);
// A video entry (video-entry.mjs), into the cut or a take's timeline.
if (verb === "add-video" || verb === "set-video") return await videoVerb(project, verb, rest, flags, { out, json });
- if (flags.has("--take")) return await takeTimeline(project, String(flags.get("--take")), verb, rest, flags, { out, json });
+ if (flags.has("--take")) {
+ // `ls` only reads; a write into a take's patch is the deprecated path (L3 S6).
+ if (verb !== "ls") err((await import("./takeDeprecation.mjs")).takeEditDeprecation(`timeline ${verb} --take`, { project: project.id, take: String(flags.get("--take")) }));
+ return await takeTimeline(project, String(flags.get("--take")), verb, rest, flags, { out, json });
+ }
const manifest = await readManifest(project.dir);
if (!manifest) throw new CliError(`${project.id} has no manifest`);