tickmarkr 1.65.0 → 1.67.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.
@@ -4,6 +4,7 @@ import { ROUTING_MODES } from "../../config/config.js";
4
4
  import { pickDriver } from "../../drivers/index.js";
5
5
  import { loadGraph } from "../../graph/graph.js";
6
6
  import { formatSummary, resolveRunMode, runDaemon } from "../../run/daemon.js";
7
+ import { isRunLockLive } from "../../run/lock.js";
7
8
  import { route, NO_EXPLORE_ENV } from "../../route/router.js";
8
9
  import { formatJournalNarration, loadRoutingProfile } from "../../run/journal.js";
9
10
  import { ttyVisual } from "../../adapters/model-lints.js";
@@ -65,6 +66,14 @@ export async function run(argv, cwd = process.cwd()) {
65
66
  throw new Error(`--route-strict: refusing to dispatch — ${conflict}`);
66
67
  console.warn(`tickmarkr: !! ${conflict}`);
67
68
  }
69
+ // OBS-107 (v1.67 T5): advisory only — a stale compiled graph with prior terminal statuses and no
70
+ // live daemon will otherwise finish with zero work and confuse the operator. The recompile remedy
71
+ // is named; dispatch proceeds unchanged.
72
+ const TERMINAL_STATUSES = ["done", "failed", "human"];
73
+ if (graph.tasks.some((t) => TERMINAL_STATUSES.includes(t.status)) && !isRunLockLive(cwd)) {
74
+ console.warn("tickmarkr: compiled graph carries terminal statuses from a prior run and no daemon is active — "
75
+ + "run `tickmarkr compile <src>` to recompile; proceeding with stale graph");
76
+ }
68
77
  const noExplore = !!values["no-explore"];
69
78
  const exploreCtx = noExplore ? { noExplore } : undefined;
70
79
  if (noExplore)
@@ -60,8 +60,6 @@ const GATE_STATE_TOKEN = { pass: ok, fail, skip: dim, open: dim };
60
60
  const gateChain = (states, unicode) => GATE_NAMES.map((gate, i) => unicode
61
61
  ? GATE_STATE_TOKEN[states[i]](gateBox(states[i], true))
62
62
  : `${GATE_KEYS[gate]}${gateBox(states[i], false)}`).join(" ");
63
- // plain (uncolored) cell width for column math — ANSI codes have zero display width
64
- const gateChainWidth = (unicode) => GATE_NAMES.reduce((w, gate) => w + (unicode ? 1 : GATE_KEYS[gate].length + 3) + 1, -1);
65
63
  const failedGates = (states) => GATE_NAMES.filter((_, i) => states[i] === "fail");
66
64
  // plain-text form of the failed-gate words for column math; rendered with a dim dot + red names
67
65
  const failedSuffix = (states) => {
@@ -182,10 +180,13 @@ const renderFrame = (cwd) => {
182
180
  const done = effective.tasks.filter((t) => t.status === "done").length;
183
181
  const cells = g.tasks.map((t) => {
184
182
  const st = replayed?.get(t.id) ?? t.status;
185
- const label = starved.has(t.id) ? " starved" : activity.cells.has(t.id) ? ` ${activity.cells.get(t.id)}` : "";
183
+ const isStarved = starved.has(t.id);
184
+ const phrase = isStarved ? undefined : activity.cells.get(t.id);
185
+ const label = isStarved ? " starved" : phrase ? ` ${phrase}` : "";
186
186
  const channel = assignments.get(t.id) ?? "-";
187
- const assignCol = contexts.has(t.id) ? `${channel}${divider}ctx ${contexts.get(t.id)}` : channel;
188
- return { t, st, label, assignCol, states: comparable ? gateStates(t, events) : defaultGateStates(t) };
187
+ const ctx = contexts.get(t.id);
188
+ const assignCol = ctx !== undefined ? `${channel}${divider}ctx ${ctx}` : channel;
189
+ return { t, st, label, assignCol, isStarved, phrase, channel, ctx, states: comparable ? gateStates(t, events) : defaultGateStates(t) };
189
190
  });
190
191
  if (!unicode) {
191
192
  // machine/CI surface — layout unchanged (pipes, greps, and the golden pins depend on it)
@@ -227,26 +228,39 @@ const renderFrame = (cwd) => {
227
228
  // rows: the line names task ids, and rows must stay the first id-bearing lines for grep consumers.
228
229
  const nowLine = activity.now ? [legend(` now: ${activity.now}`)] : [];
229
230
  const gatesLegend = legend(` gates: ${GATE_NAMES.join(" · ")}`);
231
+ // Two-line card per task (operator request, v1.67): line 1 carries identity + verdict — glyph,
232
+ // id, goal at full width, and only SHORT status words. Line 2 carries the machinery, dim and
233
+ // aligned under the goal: gate chain, live activity phrase (or channel), ctx. Long channel names
234
+ // and activity phrases live on line 2 only, so they can never squeeze the goal or wrap line 1.
230
235
  const taskVerdict = (st) => st === "done" ? "pass" : st === "failed" ? "fail" : st === "human" ? "warn" : "neutral";
231
236
  const idW = Math.max(...cells.map((c) => c.t.id.length), 2);
232
- const stW = Math.max(...cells.map((c) => (String(c.st) + c.label + failedSuffix(c.states) + humanGateSuffix(c.t, c.st, c.states)).length));
233
- const chainW = gateChainWidth(true);
234
- const assignW = Math.max(...cells.map((c) => c.assignCol.length));
235
- const goalW = Math.max(8, width - (5 + idW) - 2 - chainW - 2 - stW - 2 - assignW);
236
- const rows = cells.map(({ t, st, label, assignCol, states }) => {
237
- const goal = shortGoal(t.goal, goalW).padEnd(goalW);
237
+ // plain-text status suffixes for width math only — starved / failed gate names / approval hint
238
+ const suffixPlain = (c) => (c.isStarved ? " · starved" : "") + failedSuffix(c.states) + humanGateSuffix(c.t, c.st, c.states);
239
+ const stW = Math.max(...cells.map((c) => String(c.st).length + suffixPlain(c).length));
240
+ const avail = Math.max(8, width - (5 + idW) - 2 - stW);
241
+ const goals = cells.map((c) => shortGoal(c.t.goal, avail));
242
+ const goalW = Math.max(8, ...goals.map((s) => s.length));
243
+ const indent = " ".repeat(idW + 5); // line 2 starts under the goal column
244
+ const rows = cells.map(({ t, st, states, isStarved, phrase, channel, ctx }, i) => {
238
245
  const stWord = st === "done" ? ok(String(st)) : st === "failed" ? fail(String(st)) : st === "human" ? warn(String(st)) : String(st);
239
246
  // a fail names its gate in words right here — the one moment gate identity is needed on a row
240
247
  const f = failedGates(states);
241
248
  const human = humanGateSuffix(t, st, states);
242
249
  const statusCell = stWord +
243
- (label ? (label === " starved" ? fail(label) : dim(label)) : "") +
244
- (f.length ? dim(" · ") + fail(f.join(", ")) : "") +
245
- (human ? dim(" · ") + warn("awaiting approval") : "") +
246
- " ".repeat(stW - (String(st) + label + failedSuffix(states) + human).length);
247
- return ` ${statusRow(taskVerdict(st), `${t.id.padEnd(idW)} ${goal} ${gateChain(states, true)} ${statusCell} ${dim(assignCol)}`)}`;
248
- });
249
- return [header, hr, gatesLegend, ...rows, ...nowLine].join("\n");
250
+ (isStarved ? dot + fail("starved") : "") +
251
+ (f.length ? dot + fail(f.join(", ")) : "") +
252
+ (human ? dot + warn("awaiting approval") : "");
253
+ const line1 = ` ${statusRow(taskVerdict(st), `${t.id.padEnd(idW)} ${goals[i].padEnd(goalW)} ${statusCell}`)}`;
254
+ // activity already names its channel for in-flight attempts — never repeat it
255
+ const detail = [
256
+ ...(phrase ? [phrase, ...(phrase.includes(channel) || channel === "-" ? [] : [channel])] : [channel]),
257
+ ...(ctx !== undefined ? [`ctx ${ctx}`] : []),
258
+ ].join(" · ");
259
+ return [line1, `${indent}${gateChain(states, true)} ${dim(detail)}`, ""];
260
+ }).flat();
261
+ if (!nowLine.length)
262
+ rows.pop(); // cards end blank-separated; drop the dangling one
263
+ return [header, hr, gatesLegend, "", ...rows, ...nowLine].join("\n");
250
264
  };
251
265
  export async function status(argv, cwd = process.cwd(), opts = {}) {
252
266
  // cockpit surface: banner + frame on a TTY (doctor's pattern); pipes get the bare frame
@@ -0,0 +1,5 @@
1
+ import { type StudioOptions } from "../../tui/app.js";
2
+ export declare function ui(_argv: string[], io?: Partial<StudioOptions>): Promise<string | {
3
+ out: string;
4
+ code: number;
5
+ }>;
@@ -0,0 +1,13 @@
1
+ import { StudioApp } from "../../tui/app.js";
2
+ const NON_TTY_MSG = "tickmarkr ui: studio requires a TTY — use `tickmarkr fleet --print` or `tickmarkr status --watch` for line-mode output";
3
+ export async function ui(_argv, io = {}) {
4
+ const input = io.input ?? process.stdin;
5
+ const output = io.output ?? process.stdout;
6
+ if (input.isTTY !== true || output.isTTY !== true) {
7
+ return { out: NON_TTY_MSG, code: 1 };
8
+ }
9
+ const app = new StudioApp({ input, output });
10
+ app.start();
11
+ await app.exited;
12
+ return "ui: closed";
13
+ }
@@ -5,7 +5,7 @@ export type CommandResult = string | {
5
5
  };
6
6
  export type CommandMap = Record<string, (argv: string[]) => Promise<CommandResult>>;
7
7
  export declare const COMMANDS: CommandMap;
8
- export declare const USAGE = "tickmarkr \u2014 spec-driven orchestration harness for AI coding agents\nusage: tickmarkr <command>\n init guided setup + doctor; init --agent [--force] [--docs] adds agent skills/docs\n doctor re-probe adapters, herdr, auth; print capability matrix\n fleet interactive fleet editor (fleet --print for CI drift checks)\n compile <src> spec \u2192 .tickmarkr/graph.json (fails without acceptance criteria)\n scope <intent> draft a compiled native spec beside an answered intent (--force to overwrite)\n plan dry-run routing table + cost estimate + floor lints\n run execute the graph (--concurrency N --driver herdr|subprocess --route-strict)\n status live run state\n resume <id> continue a run from its journal\n report <id> cost/quality report (--md for committable execution record)\n profile show learned routing profile (profile reset = forget history via cursor, keeps telemetry)\n unlock remove a stale/garbage run lock (refuses if the holder is alive)\n approve <id> <task> approve a parked human gate (--by <name> --reason <text>); takes effect on resume";
8
+ export declare const USAGE = "tickmarkr \u2014 spec-driven orchestration harness for AI coding agents\nusage: tickmarkr <command>\n init guided setup + doctor; init --agent [--force] [--docs] adds agent skills/docs\n doctor re-probe adapters, herdr, auth; print capability matrix\n fleet interactive fleet editor (fleet --print for CI drift checks)\n compile <src> spec \u2192 .tickmarkr/graph.json (fails without acceptance criteria)\n scope <intent> draft a compiled native spec beside an answered intent (--force to overwrite)\n plan dry-run routing table + cost estimate + floor lints\n run execute the graph (--concurrency N --driver herdr|subprocess --route-strict)\n status live run state\n resume <id> continue a run from its journal\n report <id> cost/quality report (--md for committable execution record)\n profile show learned routing profile (profile reset = forget history via cursor, keeps telemetry)\n ui open the Fleet Studio TUI (full-screen tabbed cockpit)\n unlock remove a stale/garbage run lock (refuses if the holder is alive)\n approve <id> <task> approve a parked human gate (--by <name> --reason <text>); takes effect on resume";
9
9
  export declare function dispatch(cmd: string | undefined, argv: string[], commands?: CommandMap): Promise<{
10
10
  out: string;
11
11
  code: number;
package/dist/cli/index.js CHANGED
@@ -13,11 +13,12 @@ import { resume } from "./commands/resume.js";
13
13
  import { run } from "./commands/run.js";
14
14
  import { scope } from "./commands/scope.js";
15
15
  import { status } from "./commands/status.js";
16
+ import { ui } from "./commands/ui.js";
16
17
  import { unlock } from "./commands/unlock.js";
17
18
  import { version } from "./commands/version.js";
18
19
  const normalize = (r) => typeof r === "string" ? { out: r, code: 0 } : r;
19
20
  export const COMMANDS = {
20
- init, doctor, fleet, compile, scope, plan, run, status, resume, report, profile, unlock, approve, version,
21
+ init, doctor, fleet, compile, scope, plan, run, status, resume, report, profile, ui, unlock, approve, version,
21
22
  };
22
23
  const VERSION_FLAGS = new Set(["version", "--version", "-v"]);
23
24
  const HELP_CMDS = new Set(["help", "-h", "--help"]);
@@ -35,6 +36,7 @@ usage: tickmarkr <command>
35
36
  resume <id> continue a run from its journal
36
37
  report <id> cost/quality report (--md for committable execution record)
37
38
  profile show learned routing profile (profile reset = forget history via cursor, keeps telemetry)
39
+ ui open the Fleet Studio TUI (full-screen tabbed cockpit)
38
40
  unlock remove a stale/garbage run lock (refuses if the holder is alive)
39
41
  approve <id> <task> approve a parked human gate (--by <name> --reason <text>); takes effect on resume`;
40
42
  // pure, testable dispatcher: resolves a command, forwards argv, shapes the result — no side effects.
@@ -4,6 +4,7 @@ import { type Task } from "../graph/schema.js";
4
4
  * Each line names the task id and at least one missing collateral test path.
5
5
  */
6
6
  export declare function collateralLints(tasks: ReadonlyArray<Pick<Task, "id" | "files">>, repoRoot: string): string[];
7
+ export declare function newDirectoryLints(tasks: ReadonlyArray<Pick<Task, "id" | "files">>, repoRoot: string): string[];
7
8
  /**
8
9
  * OBS-76 class: sweep src/ for out-of-scope source files that reference a symbol the acceptance
9
10
  * criteria name — the v1.52 router.ts omission, named at plan time instead of one judge round in.
@@ -145,20 +145,69 @@ function criteriaSymbols(acceptance) {
145
145
  }
146
146
  return [...out].sort();
147
147
  }
148
+ const ARCH_PAGES = ["docs/codebase/ARCHITECTURE.md", "docs/codebase/STRUCTURE.md"];
149
+ function topLevelSrcDir(file) {
150
+ const parts = file.replace(/^\.\//, "").replace(/\/+$/, "").split("/");
151
+ if (parts[0] !== "src" || parts.length < 2 || !parts[1])
152
+ return undefined;
153
+ return parts[1];
154
+ }
155
+ function existingSrcTopLevels(repoRoot) {
156
+ const out = new Set();
157
+ let entries;
158
+ try {
159
+ entries = readdirSync(join(repoRoot, "src"), { withFileTypes: true });
160
+ }
161
+ catch {
162
+ return out;
163
+ }
164
+ for (const e of entries) {
165
+ if (e.isDirectory())
166
+ out.add(e.name);
167
+ }
168
+ return out;
169
+ }
170
+ // OBS-108 (v1.67 T5): a task whose files[] creates a new top-level src/ directory must also
171
+ // include the architecture pages the docs-truth suite pins. Advisory only — never blocks compile.
172
+ export function newDirectoryLints(tasks, repoRoot) {
173
+ const existing = existingSrcTopLevels(repoRoot);
174
+ const lines = [];
175
+ for (const t of tasks) {
176
+ // OBS-22: scopeGate accepts picomatch globs; advisory warnings must agree.
177
+ const scoped = picomatch(t.files.map((f) => f.replace(/^\.\//, "")), { dot: true });
178
+ const newDirs = new Set();
179
+ for (const f of t.files) {
180
+ const dir = topLevelSrcDir(f);
181
+ if (!dir || existing.has(dir))
182
+ continue;
183
+ newDirs.add(`src/${dir}/`);
184
+ }
185
+ if (!newDirs.size)
186
+ continue;
187
+ const missing = ARCH_PAGES.filter((p) => !scoped(p));
188
+ if (!missing.length)
189
+ continue;
190
+ const dirList = [...newDirs].sort().join(", ");
191
+ const dirLabel = newDirs.size > 1 ? "directories" : "directory";
192
+ lines.push(`${t.id}: new top-level source ${dirLabel} ${dirList} must include ${missing.join(" and ")} in files[]`);
193
+ }
194
+ return lines;
195
+ }
148
196
  /**
149
197
  * OBS-76 class: sweep src/ for out-of-scope source files that reference a symbol the acceptance
150
198
  * criteria name — the v1.52 router.ts omission, named at plan time instead of one judge round in.
151
199
  * Advisory plan output only, same contract as collateralLints.
152
200
  */
153
201
  export function sourceScopeLints(tasks, repoRoot) {
202
+ const newDirLints = newDirectoryLints(tasks, repoRoot);
154
203
  const perTask = tasks
155
204
  .map((t) => ({ t, needles: criteriaSymbols(t.acceptance) }))
156
205
  .filter((x) => x.needles.length);
157
206
  if (!perTask.length)
158
- return [];
207
+ return newDirLints;
159
208
  const srcFiles = walkCode(repoRoot, "src");
160
209
  if (!srcFiles.length)
161
- return [];
210
+ return newDirLints;
162
211
  const read = makeReader(repoRoot);
163
212
  const lines = [];
164
213
  for (const { t, needles } of perTask) {
@@ -183,5 +232,5 @@ export function sourceScopeLints(tasks, repoRoot) {
183
232
  const tail = hits.length > MAX_HITS_PER_TASK ? " (capped)" : "";
184
233
  lines.push(`${t.id}: criteria implicate out-of-scope source not in files[]: ${listed}${tail}`);
185
234
  }
186
- return lines;
235
+ return [...newDirLints, ...lines];
187
236
  }
@@ -72,16 +72,23 @@ export async function runGates(task, ctx) {
72
72
  // worker attempt — exactly what this fix forbids; only its meta-carries-channel pattern is mirrored.
73
73
  // Straight-line single `if` — NO loop/counter/knob: exactly-once by construction (a knob is a
74
74
  // fail-closed weakening vector); a second garbage verdict fails the gate closed exactly as today.
75
+ // T6: exclusion mirrors consult reroute semantics — the flaked channel's whole adapter is banned, not
76
+ // just its exact channel key, so an outage window cannot re-select the vendor being routed around.
77
+ // If no other adapter is live, the exclusion degrades to a channel-level reroute within the same
78
+ // adapter so a single-adapter fleet still retries (matching the daemon's unknown-excludeAdapter
79
+ // degradation path).
75
80
  if (a.meta?.unparseable === true && typeof a.meta.judge === "string") {
76
81
  const flakedKey = a.meta.judge;
77
- const candidate = ctx.channels
78
- .filter((c) => channelKey(c) !== flakedKey)
82
+ const flakedAdapter = flakedKey.slice(0, flakedKey.indexOf(":"));
83
+ const pick = (pool) => pool
79
84
  // pickReviewer's sort (review.ts:37): TIER_RANK desc, marginalCostRank asc — proven ordering; both
80
- // symbols already imported by a sibling gate file. No vendor-diversity axis (the judge isn't review).
85
+ // symbols already imported by a sibling gate file.
81
86
  .sort((x, y) => TIER_RANK[y.tier] - TIER_RANK[x.tier] || marginalCostRank(x) - marginalCostRank(y))[0];
82
- // ponytail: same-channel fallback when the fleet has no alternative (D-03). One judge call against a
83
- // deterministic garbage source is wasted, bounded; fail-closed unchanged on a second garbage verdict.
84
- const retry = candidate ?? { adapter: ctx.cfg.judge.adapter, model: ctx.cfg.judge.model };
87
+ const crossAdapter = pick(ctx.channels.filter((c) => c.adapter !== flakedAdapter));
88
+ const sameAdapter = pick(ctx.channels.filter((c) => c.adapter === flakedAdapter && channelKey(c) !== flakedKey));
89
+ // Prefer a different adapter; if the fleet only has one adapter, retry on a different channel of
90
+ // that adapter; if the fleet has only one channel, fall back to the original judge config.
91
+ const retry = crossAdapter ?? sameAdapter ?? { adapter: ctx.cfg.judge.adapter, model: ctx.cfg.judge.model };
85
92
  const retryAdapter = getAdapter(retry.adapter, ctx.adapters);
86
93
  const retryJvia = ctx.via
87
94
  // unconditional -r1 suffix: under keepPanes:forever a same-channel retry cannot collide with the
@@ -0,0 +1,69 @@
1
+ import { type OutputStream } from "../tui/engine.js";
2
+ import type { InputStream } from "../tui/input.js";
3
+ import type { FleetEditable } from "../config/config.js";
4
+ import { type FleetEdit } from "./staging.js";
5
+ export type View = {
6
+ id: string;
7
+ label: string;
8
+ render(props: {
9
+ cols: number;
10
+ rows: number;
11
+ }): string[];
12
+ };
13
+ export type StudioOptions = {
14
+ input: InputStream;
15
+ output: OutputStream;
16
+ /** Loaded fleet state the buffer wraps. Defaults to an empty editable for the no-arg shell path. */
17
+ loaded?: FleetEditable;
18
+ /** Repository root used for overlay paths and live-run detection. Defaults to cwd. */
19
+ repoRoot?: string;
20
+ /** Global config directory override. */
21
+ globalDir?: string;
22
+ };
23
+ export declare class StudioApp {
24
+ private engine;
25
+ private views;
26
+ private active;
27
+ private showingHelp;
28
+ private confirmingQuit;
29
+ private showingSave;
30
+ private saveTarget;
31
+ private saveProposal;
32
+ private notice;
33
+ private staging;
34
+ private repoRoot;
35
+ private globalDir;
36
+ private _lines;
37
+ private resolveExit;
38
+ readonly exited: Promise<void>;
39
+ constructor(opts: StudioOptions);
40
+ /** Current line model last rendered or prepared. */
41
+ get lines(): string[];
42
+ /** Labels of every registered view, in order. */
43
+ get viewLabels(): string[];
44
+ /** Enter the alternate screen and start routing input. */
45
+ start(): void;
46
+ /** Restore the terminal and release the input stream. */
47
+ stop(): void;
48
+ /** Apply an edit to the staging buffer and repaint. Intended as the test seam and future edit hook. */
49
+ stageEdit(edit: FleetEdit): void;
50
+ private get isModalOpen();
51
+ private bindKeys;
52
+ private handleEscape;
53
+ private handleQuit;
54
+ private handleSaveOpen;
55
+ private handleSaveToggle;
56
+ private handleConfirm;
57
+ private handleCancel;
58
+ private executeSave;
59
+ private closeSave;
60
+ private handleRevert;
61
+ private setView;
62
+ private showNotice;
63
+ private paint;
64
+ private buildFrame;
65
+ private renderTabBar;
66
+ private renderStatusBar;
67
+ private renderHelp;
68
+ private renderQuitConfirm;
69
+ }