fixesOf
uses tcmts.share.servedCodebase, which uses process
What needs fixing on the branch cb reads, as tcm todo lists it: conflicts, what stopped typechecking, code using
versions nothing names. With a merge waiting apart on the studio's own branch, as merged (tcm todo --json says it,
kept while the merge stays as it is); a branch only read is as it is.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { todoList } from "#codebase/tcmts/cli/main"; import type { TodoList } from "#codebase/tcmts/cli/main"; import { servedCodebase } from "#codebase/tcmts/share"; import { mergeViews, mergeWaiting, runTcm } from "#codebase/tcmts/studio"; export async function fixesOf(cb: Codebase): Promise<TodoList> { const waiting = cb === servedCodebase().cb ? mergeWaiting(cb) : undefined; if (!waiting) return todoList(cb); const key = `${cb.store.branch().name} ${waiting}`; const known = mergeViews.get(key); if (known) return known; const out = await runTcm(cb.lay.root, ["todo", "--json"], { branch: true }); const line = out.text.split("\n").find((l) => l.startsWith("{")); if (!line) throw new Error(out.text || "tcm todo --json said nothing"); const list = JSON.parse(line) as TodoList; mergeViews.clear(); // (one that left nothing to settle finished the merge: what's next is read as the branch is) if (mergeWaiting(cb)) mergeViews.set(key, list); return list; }
uses
- tcmts.cli.codebase.Codebase
- tcmts.cli.main.TodoList
- tcmts.cli.main.todoList
- tcmts.share.servedCodebase
- tcmts.studio.mergeViews
- tcmts.studio.mergeWaiting
- tcmts.studio.runTcm