@ritualai/cli 0.7.13 → 0.7.14

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.
Files changed (31) hide show
  1. package/dist/commands/status.js +190 -0
  2. package/dist/commands/status.js.map +1 -0
  3. package/dist/index.js +15 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/status-formatter.js +162 -0
  6. package/dist/lib/status-formatter.js.map +1 -0
  7. package/package.json +1 -1
  8. package/skills/claude-code/ritual/.ritual-bundle.json +2 -2
  9. package/skills/claude-code/ritual/manifest.json +7 -2
  10. package/skills/claude-code/ritual/references/build-flow.md +129 -3
  11. package/skills/claude-code/ritual/references/ui-ux-checklist.md +198 -0
  12. package/skills/codex/ritual/.ritual-bundle.json +2 -2
  13. package/skills/codex/ritual/manifest.json +7 -2
  14. package/skills/codex/ritual/references/build-flow.md +129 -3
  15. package/skills/codex/ritual/references/ui-ux-checklist.md +198 -0
  16. package/skills/cursor/ritual/.ritual-bundle.json +2 -2
  17. package/skills/cursor/ritual/manifest.json +7 -2
  18. package/skills/cursor/ritual/references/build-flow.md +129 -3
  19. package/skills/cursor/ritual/references/ui-ux-checklist.md +198 -0
  20. package/skills/gemini/ritual/.ritual-bundle.json +2 -2
  21. package/skills/gemini/ritual/manifest.json +7 -2
  22. package/skills/gemini/ritual/references/build-flow.md +129 -3
  23. package/skills/gemini/ritual/references/ui-ux-checklist.md +198 -0
  24. package/skills/kiro/ritual/.ritual-bundle.json +2 -2
  25. package/skills/kiro/ritual/manifest.json +7 -2
  26. package/skills/kiro/ritual/references/build-flow.md +129 -3
  27. package/skills/kiro/ritual/references/ui-ux-checklist.md +198 -0
  28. package/skills/vscode/ritual/.ritual-bundle.json +2 -2
  29. package/skills/vscode/ritual/manifest.json +7 -2
  30. package/skills/vscode/ritual/references/build-flow.md +129 -3
  31. package/skills/vscode/ritual/references/ui-ux-checklist.md +198 -0
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.statusCommand = statusCommand;
4
+ const config_1 = require("../lib/config");
5
+ const api_client_1 = require("../lib/api-client");
6
+ const project_config_1 = require("../lib/project-config");
7
+ const status_formatter_1 = require("../lib/status-formatter");
8
+ async function statusCommand(explorationIdArg, options) {
9
+ const token = await (0, config_1.getValidAccessToken)();
10
+ if (token.kind === 'not-signed-in') {
11
+ console.error(' ✗ Not signed in. Run `ritual login` first.');
12
+ process.exit(1);
13
+ }
14
+ if (token.kind === 're-auth-required') {
15
+ console.error(` ✗ Session expired (${token.reason}). Run \`ritual login\` to re-auth.`);
16
+ process.exit(1);
17
+ }
18
+ const api = new api_client_1.ApiClient({
19
+ issuer: token.creds.issuer,
20
+ accessToken: token.accessToken,
21
+ });
22
+ if (options.watch) {
23
+ await runWatchLoop(api, explorationIdArg);
24
+ }
25
+ else {
26
+ await runOnce(api, explorationIdArg);
27
+ }
28
+ }
29
+ async function runOnce(api, explorationIdArg) {
30
+ const inputs = await fetchStatus(api, explorationIdArg);
31
+ if (!inputs) {
32
+ // Already printed a friendly error in fetchStatus.
33
+ process.exit(1);
34
+ }
35
+ console.log((0, status_formatter_1.formatStatus)(inputs));
36
+ }
37
+ /**
38
+ * --watch loop. Renders the status snapshot every 5s, in-place using
39
+ * ANSI cursor controls. Exits on:
40
+ * - terminal run states (`completed` / `failed` / `cancelled`)
41
+ * - the user pressing Ctrl+C
42
+ * - 3 consecutive fetch errors (no point thrashing if the API is down)
43
+ *
44
+ * Cadence locked at 5s — short enough to feel live, polite enough not
45
+ * to hammer the API on a long-running poll.
46
+ */
47
+ async function runWatchLoop(api, explorationIdArg) {
48
+ let lastRenderedLines = 0;
49
+ let consecutiveErrors = 0;
50
+ const POLL_MS = 5000;
51
+ const stop = (code) => {
52
+ process.stdout.write('\n');
53
+ process.exit(code);
54
+ };
55
+ process.on('SIGINT', () => stop(130));
56
+ // First render: print fresh, no clear.
57
+ while (true) {
58
+ let inputs = null;
59
+ try {
60
+ inputs = await fetchStatus(api, explorationIdArg);
61
+ consecutiveErrors = 0;
62
+ }
63
+ catch (err) {
64
+ consecutiveErrors += 1;
65
+ if (consecutiveErrors >= 3) {
66
+ console.error(`\n ✗ Repeated errors fetching status (${err.message}). Exiting watch.`);
67
+ process.exit(1);
68
+ }
69
+ }
70
+ if (inputs) {
71
+ const rendered = (0, status_formatter_1.formatStatus)(inputs);
72
+ if (lastRenderedLines > 0) {
73
+ // Move cursor up by the previous render's line count + clear from there.
74
+ process.stdout.write(`\x1b[${lastRenderedLines}A\x1b[0J`);
75
+ }
76
+ process.stdout.write(rendered + '\n');
77
+ lastRenderedLines = rendered.split('\n').length + 1;
78
+ // Exit if run reached a terminal state.
79
+ const status = inputs.run?.status?.toLowerCase();
80
+ if (status === 'completed' || status === 'completed_with_errors') {
81
+ process.stdout.write('\n ✓ Run finished. Exiting watch.\n');
82
+ process.exit(0);
83
+ }
84
+ if (status === 'failed') {
85
+ process.stdout.write('\n ✗ Run failed. Exiting watch.\n');
86
+ process.exit(1);
87
+ }
88
+ if (status === 'cancelled') {
89
+ process.stdout.write('\n · Run cancelled. Exiting watch.\n');
90
+ process.exit(0);
91
+ }
92
+ }
93
+ await sleep(POLL_MS);
94
+ }
95
+ }
96
+ async function fetchStatus(api, explorationIdArg) {
97
+ let explorationId;
98
+ if (explorationIdArg) {
99
+ explorationId = explorationIdArg;
100
+ }
101
+ else {
102
+ // Auto-resolve from .ritual/config.json.
103
+ const project = (0, project_config_1.loadProjectConfig)(process.cwd());
104
+ if (!project) {
105
+ console.error(' ✗ No `.ritual/config.json` in this directory. Either:\n' +
106
+ ' ritual init — bind a workspace to this repo, OR\n' +
107
+ ' ritual status <exploration-id> — fetch a specific exploration');
108
+ return null;
109
+ }
110
+ const picked = await pickCurrentExploration(api, project.workspaceId);
111
+ if (!picked) {
112
+ console.error(` ✗ No active or recent explorations found in workspace ${project.workspaceName}.`);
113
+ return null;
114
+ }
115
+ explorationId = picked;
116
+ }
117
+ // Fetch exploration shell + agentic-status + run in parallel.
118
+ const [exp, agenticStatus, runs] = await Promise.all([
119
+ api
120
+ .get(`/explorations/${encodeURIComponent(explorationId)}`)
121
+ .catch((err) => {
122
+ if (err.status === 404) {
123
+ console.error(` ✗ Exploration ${explorationId} not found.`);
124
+ return null;
125
+ }
126
+ throw err;
127
+ }),
128
+ api
129
+ .get(`/explorations/${encodeURIComponent(explorationId)}/agentic-status`)
130
+ .catch(() => null),
131
+ api
132
+ .get(`/agentic-runs?exploration_id=${encodeURIComponent(explorationId)}&status=running`)
133
+ .catch(() => []),
134
+ ]);
135
+ if (!exp)
136
+ return null;
137
+ const run = runs && runs.length > 0
138
+ ? { id: runs[0].agentic_run_id, status: runs[0].status }
139
+ : null;
140
+ return {
141
+ exploration: {
142
+ id: exp.id,
143
+ name: exp.name,
144
+ step: exp.step,
145
+ updatedAt: exp.updatedAt,
146
+ },
147
+ progress: agenticStatus?.progress ?? null,
148
+ run,
149
+ };
150
+ }
151
+ /**
152
+ * Pick the "current" exploration for `ritual status` with no arg.
153
+ *
154
+ * Ranking:
155
+ * 1. Any exploration with a RUNNING agentic run → return its id.
156
+ * 2. Else most-recently-updated where step != COMPLETED.
157
+ * 3. Else most-recently-updated full stop.
158
+ *
159
+ * Multiple RUNNING runs is uncommon. For v1 we pick whichever the API
160
+ * returns first (most-recently-started in practice); a multi-run picker
161
+ * can land in MVP-2 with `ritual status --runs`.
162
+ */
163
+ async function pickCurrentExploration(api, workspaceId) {
164
+ const exps = await api.get(`/explorations?workspaceId=${encodeURIComponent(workspaceId)}&withImplementationStatus=true`);
165
+ if (!exps || exps.length === 0)
166
+ return null;
167
+ // Probe for a RUNNING run across explorations. Sorted by updatedAt
168
+ // desc first so the most recently-touched exploration gets the
169
+ // first run-probe — usually the right answer in one call.
170
+ const sorted = [...exps].sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
171
+ for (const e of sorted.slice(0, 5)) {
172
+ try {
173
+ const runs = await api.get(`/agentic-runs?exploration_id=${encodeURIComponent(e.id)}&status=running`);
174
+ if (runs && runs.length > 0)
175
+ return e.id;
176
+ }
177
+ catch {
178
+ // fall through — never block on a probe failure
179
+ }
180
+ }
181
+ // No RUNNING runs — pick most-recently-updated non-completed.
182
+ const nonComplete = sorted.find((e) => e.step !== 'COMPLETED');
183
+ if (nonComplete)
184
+ return nonComplete.id;
185
+ return sorted[0]?.id ?? null;
186
+ }
187
+ function sleep(ms) {
188
+ return new Promise((resolve) => setTimeout(resolve, ms));
189
+ }
190
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":";;AAmCA,sCAwBC;AA3DD,0CAAoD;AACpD,kDAA8C;AAC9C,0DAA0D;AAC1D,8DAA0E;AAgCnE,KAAK,UAAU,aAAa,CAClC,gBAAoC,EACpC,OAAsB;IAEtB,MAAM,KAAK,GAAG,MAAM,IAAA,4BAAmB,GAAE,CAAC;IAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QACpC,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;QACvC,OAAO,CAAC,KAAK,CAAC,wBAAwB,KAAK,CAAC,MAAM,qCAAqC,CAAC,CAAC;QACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,sBAAS,CAAC;QACzB,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;QAC1B,WAAW,EAAE,KAAK,CAAC,WAAW;KAC9B,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,YAAY,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAC3C,CA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IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC;YACJ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,GAAG,CACzB,gCAAgC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,CACzE,CAAC;YACF,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,CAAC,CAAC,EAAE,CAAC;QAC1C,CAAC;QAAC,MAAM,CAAC;YACR,gDAAgD;QACjD,CAAC;IACF,CAAC;IAED,8DAA8D;IAC9D,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IAC/D,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC,EAAE,CAAC;IAEvC,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC;AAC9B,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC"}
package/dist/index.js CHANGED
@@ -8,6 +8,14 @@ const whoami_1 = require("./commands/whoami");
8
8
  const refresh_1 = require("./commands/refresh");
9
9
  const init_1 = require("./commands/init");
10
10
  const doctor_1 = require("./commands/doctor");
11
+ // 2026-05-15 (PR D) — `ritual status [--watch]` instant snapshot of
12
+ // an in-flight agentic run. Auto-resolves the current exploration
13
+ // from `.ritual/config.json` so the user doesn't have to remember
14
+ // IDs; --watch polls every 5s and redraws in place. Paired with the
15
+ // SKILL Step 8 reframe ("you're unblocked; runs continue server-
16
+ // side") to break the mental model where users feel obligated to
17
+ // stare at the polling loop.
18
+ const status_1 = require("./commands/status");
11
19
  const graph_1 = require("./commands/graph");
12
20
  const package_info_1 = require("./lib/package-info");
13
21
  // 2026-05-15 (PR C) — pre-flight one-line stderr warning when the
@@ -61,6 +69,13 @@ program
61
69
  .command('refresh')
62
70
  .description('Force-refresh the cached access token using the stored refresh token')
63
71
  .action(refresh_1.refreshCommand);
72
+ program
73
+ .command('status')
74
+ .description('Show the current agentic run status. With --watch, polls every 5s and redraws in place. ' +
75
+ 'With no exploration ID, auto-resolves the workspace\'s currently-active run.')
76
+ .argument('[exploration-id]', 'Specific exploration to inspect (defaults to the current run)')
77
+ .option('--watch', 'Poll every 5s and redraw in place; exits on terminal state or Ctrl+C')
78
+ .action((explorationId, opts) => (0, status_1.statusCommand)(explorationId, { watch: opts.watch }));
64
79
  program
65
80
  .command('doctor')
66
81
  .description('Sanity check the CLI environment: credentials, endpoints, detected agents')
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,4CAAgD;AAChD,8CAAkD;AAClD,8CAAkD;AAClD,gDAAoD;AACpD,0CAA8C;AAC9C,8CAAkD;AAClD,4CAAsD;AACtD,qDAA4D;AAC5D,kEAAkE;AAClE,oEAAoE;AACpE,+DAA+D;AAC/D,iEAAiE;AACjE,oEAAoE;AACpE,oEAAoE;AACpE,oCAAoC;AACpC,qEAAqE;AAErE,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACL,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CACX,yDAAyD;IACxD,yDAAyD,CAC1D;KACA,OAAO,CAAC,IAAA,qCAAsB,GAAE,CAAC,CAAC;AAEpC,oEAAoE;AACpE,+DAA+D;AAC/D,OAAO;KACL,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,kFAAkF,CAAC;KAC/F,MAAM,CAAC,cAAc,EAAE,wDAAwD,CAAC;KAChF,MAAM,CAAC,QAAQ,EAAE,4BAA4B,CAAC;KAC9C,MAAM,CACN,gBAA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AC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ /**
3
+ * Pure formatter for `ritual status` output.
4
+ *
5
+ * Kept as a side-effect-free function so it can be unit-tested in
6
+ * isolation without HTTP / filesystem / clock mocks. The command
7
+ * orchestration in `commands/status.ts` does the fetching; this just
8
+ * turns shapes into strings.
9
+ *
10
+ * Design choices (locked in `backlog_ritual_status_and_unblocked_framing.md`):
11
+ *
12
+ * - Run line first. "RUNNING for 17m 41s" is the headline; exploration
13
+ * name is a footer parenthetical, not the lead.
14
+ * - Pace + ETA computed only when `completedQuestions >= 3` so the
15
+ * average doesn't get whiplashed by the first question's latency.
16
+ * - Activity / last-write age is the real "is it actually moving?"
17
+ * signal — climbing past ~3 min without `completedQuestions`
18
+ * advancing is actionable info, not a snapshot lie.
19
+ *
20
+ * The shape this formatter consumes is the merged view (live progress
21
+ * from `Exploration.agenticProgress` + run id from
22
+ * `GET /agentic-runs?explorationId=...&status=RUNNING&limit=1`), never
23
+ * the raw `AgenticJob` row whose `totalQuestions` / `progress.steps`
24
+ * fields can sit unwritten for entire runs (bug filed
25
+ * 2026-05-15 — see `backlog_ritual_status_and_unblocked_framing.md`).
26
+ */
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.formatStatus = formatStatus;
29
+ exports.humanizeDuration = humanizeDuration;
30
+ function formatStatus(input) {
31
+ const now = (input.now ?? new Date()).getTime();
32
+ const lines = [];
33
+ if (input.run && input.progress) {
34
+ lines.push(...formatRunSection(input.run, input.progress, input.exploration, now));
35
+ }
36
+ else if (input.progress) {
37
+ lines.push(...formatNoRunButProgress(input.progress, input.exploration, now));
38
+ }
39
+ else {
40
+ lines.push(...formatNoProgress(input.exploration));
41
+ }
42
+ lines.push('');
43
+ lines.push(`(Exploration: ${input.exploration.name})`);
44
+ lines.push(` ${input.exploration.id} · step: ${input.exploration.step}`);
45
+ return lines.join('\n');
46
+ }
47
+ function formatRunSection(run, progress, exploration, now) {
48
+ const runShort = truncateId(run.id);
49
+ const ageSec = progress.startedAt
50
+ ? Math.round((now - new Date(progress.startedAt).getTime()) / 1000)
51
+ : null;
52
+ const runLine = ageSec != null
53
+ ? `Run ${runShort} · ${run.status.toUpperCase()} for ${humanizeDuration(ageSec)}`
54
+ : `Run ${runShort} · ${run.status.toUpperCase()}`;
55
+ const phaseLine = formatPhaseLine(progress);
56
+ const questionsLine = formatQuestionsLine(progress);
57
+ const activityLine = formatActivityLine(exploration.updatedAt, now);
58
+ const paceLine = formatPaceLine(progress, now);
59
+ const nextLine = formatNextLine(progress);
60
+ const out = [runLine, phaseLine];
61
+ if (questionsLine)
62
+ out.push(questionsLine);
63
+ out.push(activityLine);
64
+ if (paceLine)
65
+ out.push(paceLine);
66
+ if (nextLine)
67
+ out.push(nextLine);
68
+ return out;
69
+ }
70
+ function formatNoRunButProgress(progress, exploration, now) {
71
+ // No active run, but agenticProgress on the exploration shows past
72
+ // activity. Either the run completed or it never started. Either
73
+ // way, the last-snapshot view is what's useful.
74
+ const out = [`Run (no active run)`];
75
+ out.push(formatPhaseLine(progress));
76
+ const questionsLine = formatQuestionsLine(progress);
77
+ if (questionsLine)
78
+ out.push(questionsLine);
79
+ out.push(formatActivityLine(exploration.updatedAt, now));
80
+ return out;
81
+ }
82
+ function formatNoProgress(exploration) {
83
+ return [
84
+ `Run (no run started yet)`,
85
+ `Phase —`,
86
+ `Step ${exploration.step}`,
87
+ ];
88
+ }
89
+ function formatPhaseLine(progress) {
90
+ const phase = progress.phase ?? '—';
91
+ const pct = typeof progress.percent === 'number' ? ` (${progress.percent}%)` : '';
92
+ return `Phase ${phase}${pct}`;
93
+ }
94
+ function formatQuestionsLine(progress) {
95
+ const total = progress.totalQuestions;
96
+ const done = progress.completedQuestions;
97
+ const failed = progress.failedQuestions ?? 0;
98
+ if (typeof total !== 'number' || typeof done !== 'number')
99
+ return null;
100
+ if (total === 0)
101
+ return null;
102
+ const failedSegment = failed > 0 ? ` · ${failed} failed` : ` · 0 failed`;
103
+ return `Questions ${done} / ${total}${failedSegment}`;
104
+ }
105
+ function formatActivityLine(updatedAt, now) {
106
+ const ageSec = Math.max(0, Math.round((now - new Date(updatedAt).getTime()) / 1000));
107
+ return `Activity last DB write ${humanizeDuration(ageSec)} ago`;
108
+ }
109
+ function formatPaceLine(progress, now) {
110
+ const done = progress.completedQuestions ?? 0;
111
+ const total = progress.totalQuestions ?? 0;
112
+ if (done < 3)
113
+ return `Pace warming up — check back in 30s`;
114
+ if (!progress.startedAt || total <= done)
115
+ return null;
116
+ const elapsedSec = (now - new Date(progress.startedAt).getTime()) / 1000;
117
+ if (elapsedSec <= 0)
118
+ return null;
119
+ const secPerQ = elapsedSec / done;
120
+ const remainingSec = Math.round(secPerQ * (total - done));
121
+ return `Pace ~${Math.round(secPerQ)}s/question · ETA ~${humanizeDuration(remainingSec)} remaining`;
122
+ }
123
+ function formatNextLine(progress) {
124
+ const phase = (progress.phase ?? '').toLowerCase();
125
+ const nextByPhase = {
126
+ discovery: 'Accepting questions',
127
+ accepting: 'Answering',
128
+ answering: 'Recommendations (auto-advances when questions are done)',
129
+ submitting: 'Recommendations',
130
+ recommendations: 'Build brief (after admin review)',
131
+ complete: '—',
132
+ failed: '—',
133
+ };
134
+ const next = nextByPhase[phase];
135
+ return next ? `Next ${next}` : null;
136
+ }
137
+ function humanizeDuration(seconds) {
138
+ if (seconds < 0)
139
+ seconds = 0;
140
+ if (seconds < 60)
141
+ return `${seconds}s`;
142
+ const m = Math.floor(seconds / 60);
143
+ const s = seconds % 60;
144
+ if (m < 60) {
145
+ return s === 0 ? `${m}m` : `${m}m ${s}s`;
146
+ }
147
+ const h = Math.floor(m / 60);
148
+ const remM = m % 60;
149
+ return remM === 0 ? `${h}h` : `${h}h ${remM}m`;
150
+ }
151
+ function truncateId(id) {
152
+ // "ba4d2b42-…" form — first 8 chars + ellipsis. Matches the agent-
153
+ // facing copy in the SKILL so users can pattern-match against IDs
154
+ // they've seen elsewhere. UUIDs slice cleanly at 8 (no trailing
155
+ // hyphen); for non-UUID inputs we strip a trailing dash so we
156
+ // don't render "r1-aaaa--…" with double hyphens.
157
+ if (id.length <= 8)
158
+ return id;
159
+ const head = id.slice(0, 8).replace(/-+$/, '');
160
+ return `${head}-…`;
161
+ }
162
+ //# sourceMappingURL=status-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-formatter.js","sourceRoot":"","sources":["../../src/lib/status-formatter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;AA4BH,oCAiBC;AAyGD,4CAWC;AArID,SAAgB,YAAY,CAAC,KAAmB;IAC/C,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;IACpF,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,GAAG,sBAAsB,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;IAC/E,CAAC;SAAM,CAAC;QACP,KAAK,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC;IACvD,KAAK,CAAC,IAAI,CAAC,KAAK,K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E,CAAC,CAAC;IAC7B,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;IACpB,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC;AAChD,CAAC;AAED,SAAS,UAAU,CAAC,EAAU;IAC7B,mEAAmE;IACnE,kEAAkE;IAClE,gEAAgE;IAChE,8DAA8D;IAC9D,iDAAiD;IACjD,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/C,OAAO,GAAG,IAAI,IAAI,CAAC;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ritualai/cli",
3
- "version": "0.7.13",
3
+ "version": "0.7.14",
4
4
  "description": "Ritual CLI — scaffold AI coding agent skills + register MCP servers. Connects Claude Code, Cursor, Windsurf, Kiro, Gemini CLI, VS Code/Copilot, and Codex to Ritual Cloud.",
5
5
  "private": false,
6
6
  "license": "Apache-2.0",
@@ -1,4 +1,4 @@
1
1
  {
2
- "cliVersion": "0.7.13",
3
- "builtAt": "2026-05-15T14:17:47.561Z"
2
+ "cliVersion": "0.7.14",
3
+ "builtAt": "2026-05-15T16:06:46.162Z"
4
4
  }
@@ -21,8 +21,8 @@
21
21
  },
22
22
  {
23
23
  "path": "references/build-flow.md",
24
- "lines": 1519,
25
- "bytes": 88142
24
+ "lines": 2466,
25
+ "bytes": 148766
26
26
  },
27
27
  {
28
28
  "path": "references/cli-output-contract.md",
@@ -53,5 +53,10 @@
53
53
  "path": "references/scoring-fallback.md",
54
54
  "lines": 126,
55
55
  "bytes": 6494
56
+ },
57
+ {
58
+ "path": "references/ui-ux-checklist.md",
59
+ "lines": 198,
60
+ "bytes": 12167
56
61
  }
57
62
  ]
@@ -1416,7 +1416,54 @@ Reply `1` or `2`. Reply `pause` to stop here.
1416
1416
 
1417
1417
  If they pick 1, call `start_agentic_run` with `stop_after: 'answers'` and continue to Step 8.5 when it pauses. If they pick 2, call without `stop_after` and continue to Step 9 when complete.
1418
1418
 
1419
- Poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: **`Bash sleep 5` (always 5 never escalate to 15/20/25)** per iteration, then a fresh status call. Even if the run takes 2+ minutes, the sleep value stays 5; the harness blocks chained-shorter-sleeps-at-increasing-N just like it blocks `sleep 30`. Agentic runs CAN exceed 5 min for large explorations — if you see status still running past ~5 min of polling, switch to the `Monitor` + `until <check>; do sleep 2; done` pattern from `references/async-polling.md` § Long waits. Print progress only when `progress_pct` or `current_step` changes, or every ~3 polls if unchanged:
1419
+ ##### 8.0"You're unblocked" pre-roll (right after `start_agentic_run` returns the run_id)
1420
+
1421
+ **Lock the product promise BEFORE you enter the polling loop.** The run continues server-side; the user is free to step away. The polling loop becomes the agent's job, not the user's obligation.
1422
+
1423
+ Tier the pre-roll by projected duration. Latency baseline: ~15s/question (V5.2 + KG injection, calibrate quarterly against `recs-pipeline.ts` eval results). Multiply the picked-question count by 15s, divide by 60 to get minutes.
1424
+
1425
+ **Projected ≤ 2 min** — skip the pre-roll entirely. The polling micro-copy below covers the framing.
1426
+
1427
+ **Projected 2–20 min** — warm framing:
1428
+
1429
+ ```text
1430
+ Deep reasoning run started — this may take ~{minutes} minutes.
1431
+
1432
+ You're unblocked: the run continues server-side while you do other work.
1433
+ Grab coffee, switch tasks, or close the terminal safely.
1434
+
1435
+ Live progress:
1436
+ ritual status --watch
1437
+
1438
+ Come back later:
1439
+ /ritual resume
1440
+ ```
1441
+
1442
+ **Projected 20+ min** — longer framing:
1443
+
1444
+ ```text
1445
+ Long reasoning run started — this one may take 20+ minutes.
1446
+
1447
+ You can safely step away; the run continues server-side even if this terminal
1448
+ closes. For live progress:
1449
+
1450
+ ritual status --watch
1451
+
1452
+ To come back later:
1453
+ /ritual resume
1454
+ ```
1455
+
1456
+ The two affordances (`ritual status --watch` from a second terminal, `/ritual resume` later) are NOT modes the user has to opt into — they're the natural escape hatches the user can reach for without re-engaging this session. Do not introduce a `reply watch` mode in this SKILL; the CLI command IS the watch affordance.
1457
+
1458
+ ##### 8.1 — Polling loop
1459
+
1460
+ Poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: **`Bash sleep 5` (always 5 — never escalate to 15/20/25)** per iteration, then a fresh status call. Even if the run takes 2+ minutes, the sleep value stays 5; the harness blocks chained-shorter-sleeps-at-increasing-N just like it blocks `sleep ≥ 30`. Agentic runs CAN exceed 5 min for large explorations — if you see status still running past ~5 min of polling, switch to the `Monitor` + `until <check>; do sleep 2; done` pattern from `references/async-polling.md` § Long waits.
1461
+
1462
+ **On the FIRST poll only** (not every poll), prepend one line that locks the "background execution is default" mental model:
1463
+
1464
+ > I'll keep working in the background. Use `ritual status --watch` if you want to follow along live.
1465
+
1466
+ Then print progress only when `progress_pct` or `current_step` changes, or every ~3 polls if unchanged:
1420
1467
 
1421
1468
  > Agentic run: {progress_pct}% — {current_step}
1422
1469
 
@@ -1983,18 +2030,97 @@ Build brief ready
1983
2030
  · `refine` — something's off; tell me what and I'll regenerate
1984
2031
  · `drill {N}` — drill into RB-{N} before deciding
1985
2032
 
1986
- Reply `pause` to stop here.
2033
+ Before `go`, you can run `ux-review` for a design-quality pass on the brief (recommended for UI/UX features — produces `UX-REVIEW.md` and a tailored plan-mode prompt so plan mode stops asking you the same UX questions it always does). Reply `pause` to stop here.
1987
2034
  ```
1988
2035
 
1989
2036
  Branch by user response. Accept `go`, `y`, `yes`, `proceed`, `continue`, `next` as the visible-CTA path (do not display all aliases):
1990
2037
 
1991
2038
  - **`go` / proceed / yes / y**: continue to Step 11.
2039
+ - **`ux-review` / review / `ux`**: continue to Step 10.5 (writes `UX-REVIEW.md`, then continues to Step 11 with the tailored plan-mode prompt). Opt-in; absence is the existing path.
1992
2040
  - **`refine`**: ask what's off, then call `generate_build_brief` with `force: true` after applying their feedback to the exploration (typically a recommendation re-accept or a requirement adjustment via the web UI).
1993
2041
  - **`drill {N}`**: open RB-{N} in the markdown, discuss inline, then loop back to the gate above.
1994
2042
  - **`pause`**: stop here. The brief is on disk; the user can resume with `/ritual resume`.
1995
2043
 
1996
2044
  **Pulse (Step 10 done):** Emit a pulse — this often crosses into **Implementation-ready** (90%+). Render full when that crossing happens. Use the build-brief celebration line: `✓ Build brief ready — discovery has become an implementation path.` If still below 90% (e.g. brief flagged residual debt), surface that in the pulse line itself and propose addressing it before coding.
1997
2045
 
2046
+ #### Step 10.5 — Optional UX brief review (entered ONLY when the user picks `ux-review` at Step 10d)
2047
+
2048
+ This step is opt-in. If the user picked `go` at Step 10d, skip directly to Step 11. The `ux-review` path is reached only when the user explicitly asks for it at the Step 10d gate — there is no auto-gating in this MVP (later iterations may use Stage E's UI-surface classifier to suggest the path automatically; see `backlog_design_recon_stage_e.md`).
2049
+
2050
+ Purpose: make the coding agent reason about the experience BEFORE it reasons about files. Plan mode otherwise interrogates the user for the same 10-question UX checklist on every UI-shaped feature. Paying for it once at the right moment — with the brief and the codebase both available — is cheaper than paying it implicitly through plan-mode interrogation.
2051
+
2052
+ This step is **SKILL-only — no MCP tool, no LLM-cost on Ritual's API.** The analysis happens locally in the calling agent because the agent is the one with repo access. The reference `references/ui-ux-checklist.md` is the canonical instruction set (methodology + output schema + plan-mode prompt template); this Step 10.5 is the thin orchestration layer that drives the agent through it.
2053
+
2054
+ Steps:
2055
+
2056
+ 1. **Tell the user what's about to happen** (one line, not a multi-line pre-roll):
2057
+
2058
+ > Running a design-quality pass on the brief. Reading `BUILD-BRIEF.md`, mining the repo for existing UI patterns, writing `UX-REVIEW.md` — about 30–60 seconds.
2059
+
2060
+ 2. **Read `references/ui-ux-checklist.md`** for the methodology, output schema, and plan-mode prompt template. **Walk the methodology in order — do not skip to the output schema.** The methodology's six steps (read brief → identify UI surfaces → find repo analogues → compare brief vs analogues → fill schema with evidence → generate tailored plan-mode prompt) are load-bearing; the output schema only gets filled correctly when the analysis upstream is done.
2061
+
2062
+ 3. **Read `BUILD-BRIEF.md`** end-to-end. Classify what it covers vs what it's silent on. The brief itself is the input signal — the review's value is on the gaps and codebase-grounding, not on re-deriving brief content.
2063
+
2064
+ 4. **Mine the repo for existing UI analogues.** Use Grep / Glob / Read against the implied UI surfaces from the brief. Cite file paths in the review; every claim must trace back to either a brief line or a real repo file. **Do not fabricate analogues** — if `Grep` returns nothing, the surface is "new work," not a hallucinated path.
2065
+
2066
+ 5. **Write `UX-REVIEW.md`** to disk alongside `BUILD-BRIEF.md` (same directory — repo root or `.ritual/`, whichever the brief landed in). Use the exact output schema from the reference file. Prepend the Ritual attribution header:
2067
+
2068
+ ```markdown
2069
+ <!--
2070
+ Generated by Ritual — UX brief review
2071
+ Exploration: https://app.ritualapp.cloud/e/{exploration_id}
2072
+ Source brief: BUILD-BRIEF.md
2073
+ Do not remove this header; it preserves implementation lineage.
2074
+ -->
2075
+ ```
2076
+
2077
+ If a `UX-REVIEW.md` already exists:
2078
+ - **Same exploration**: silent overwrite + one-line note in the summary.
2079
+ - **Different exploration**: confirm before overwriting (same convention as `BUILD-BRIEF.md` in Step 10c — *"A `UX-REVIEW.md` already exists from `{previous}`. Overwrite, or save-to-`UX-REVIEW-{slug}.md`?"*).
2080
+
2081
+ 6. **Print a compact CLI summary** — the file path + the load-bearing findings only, capped at ≤ 10 lines (CLI Tenet #1, #6):
2082
+
2083
+ ```
2084
+ ✓ UX review ready — `UX-REVIEW.md` is on disk.
2085
+
2086
+ Mismatches surfaced: {N}
2087
+ {first mismatch one-liner — brief X vs analogue Y}
2088
+ {second mismatch one-liner}
2089
+
2090
+ Gaps surfaced: {M}
2091
+ {first gap one-liner — brief silent on Z, codebase default is W}
2092
+
2093
+ New-work surfaces: {K}
2094
+ {first new-work surface one-liner}
2095
+
2096
+ Plan mode will read this first when you proceed to `go`.
2097
+ ```
2098
+
2099
+ Rules:
2100
+ - Cap each list at 3 entries. The full set is in the file.
2101
+ - Omit any list that's empty (e.g. "Mismatches surfaced: 0" → don't print the line).
2102
+ - If ALL THREE lists are empty: the brief is unusually complete. Print one line: *"Brief is unusually complete — no mismatches, gaps, or new-work surfaces. Plan mode will verify state coverage against codebase."*
2103
+
2104
+ 7. **Offer to open the file** — same OS-aware affordance as Step 10c (VS Code → idea → $EDITOR → macOS open). Single yes/no, never a multi-way picker.
2105
+
2106
+ 8. **Return to the Step 10d gate** with the updated framing — `UX-REVIEW.md` is now part of the implementation context:
2107
+
2108
+ ```text
2109
+ Reply `go` to start implementation with the UX review as plan-mode input,
2110
+ or `refine` / `drill {N}` / `pause` per the earlier options.
2111
+ ```
2112
+
2113
+ When the user replies `go`, continue to Step 11 with the explicit instruction (passed to plan mode) to read both `BUILD-BRIEF.md` AND `UX-REVIEW.md`, and to use the "Plan Mode Prompt" block at the bottom of `UX-REVIEW.md` as its first numbered list — not a generic plan.
2114
+
2115
+ **Anti-patterns to avoid in this step:**
2116
+
2117
+ - **Don't render the full `UX-REVIEW.md` to the terminal.** It belongs in the file; the CLI surface is the summary plus the path.
2118
+ - **Don't auto-`go` after writing the file.** The user explicitly opted into the review — let them open the file and decide when to proceed.
2119
+ - **Don't enter plan mode mid-step.** Plan mode is Step 11. This step writes the artifact plan mode will read.
2120
+ - **Don't propose visual designs.** This is a planning packet, not a design tool. Where the codebase has no design system, surface that fact and route back to the user.
2121
+
2122
+ **Pulse (Step 10.5 done):** Re-emit the Step 10 pulse if the review surfaced material gaps or mismatches — Readiness can dip back below 90% when significant UX work is flagged that the brief didn't capture. If the review came back clean (zero mismatches, zero gaps, zero new-work), keep the existing pulse — the brief was already implementation-ready.
2123
+
1998
2124
  #### Step 11 — Implement
1999
2125
 
2000
2126
  This step happens **inside** the same `/ritual build` chat if the agent is also the coding agent (Claude Code / Cursor / etc.), or hand-off if the user is implementing themselves.
@@ -2045,7 +2171,7 @@ Next: I'll create a feature branch, then start on RB-1.
2045
2171
 
2046
2172
  ##### 11.1 — Implement
2047
2173
 
2048
- 1. Take the build brief as input.
2174
+ 1. Take the build brief as input. **If `UX-REVIEW.md` also exists alongside `BUILD-BRIEF.md` (the user opted into Step 10.5), read it too.** When both files are present, use the "Plan Mode Prompt" block at the bottom of `UX-REVIEW.md` as the FIRST input to plan mode — its numbered list of mismatches / gaps / new-work surfaces is the tailored agenda. The generic plan-mode template is the fallback for when only the brief exists.
2049
2175
  2. Use the standard coding-loop tools (Edit/Write/Bash/etc.) to make the code change.
2050
2176
  3. Run tests, lint, build per the repo's conventions.
2051
2177
  4. Track each architectural decision as you go — the input to Step 12's `sync_implementation` call. Per decision, write down: `area`, `choice`, `alternatives_considered`, `rationale`, `source_recommendation_id` (the RB-N or recommendation id the decision implements). This is what makes lineage queryable later — don't skip it.