@cruxy/cli 1.11.2 → 1.11.4

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 (38) hide show
  1. package/dist/agent/instruction-loss.js +204 -0
  2. package/dist/agent/prompts.js +25 -4
  3. package/dist/agent/session.js +165 -33
  4. package/dist/agent/status.js +18 -0
  5. package/dist/cli/commands/pr.js +14 -0
  6. package/dist/cli/commands/run.js +44 -8
  7. package/dist/cli/session-commands.js +3 -1
  8. package/dist/cli/session-factory.js +54 -6
  9. package/dist/config/schema.js +9 -0
  10. package/dist/mcp/bounds.js +8 -1
  11. package/dist/plan/execute.js +4 -1
  12. package/dist/plan/service.js +42 -5
  13. package/dist/plan/step-message.js +49 -0
  14. package/dist/render/context-view.js +44 -1
  15. package/dist/render/status-view.js +13 -0
  16. package/dist/session/index.js +6 -3
  17. package/dist/session/log.js +97 -2
  18. package/dist/session/recorded-runs.js +56 -0
  19. package/dist/session/replay.js +75 -1
  20. package/dist/session/resume.js +88 -0
  21. package/dist/session/types.js +158 -0
  22. package/dist/testing/run-tests-tool.js +3 -1
  23. package/dist/tools/create-pull-request.js +8 -1
  24. package/dist/tools/file/apply-patch.js +6 -2
  25. package/dist/tools/file/edit-file.js +6 -2
  26. package/dist/tools/file/snapshot.js +9 -4
  27. package/dist/tools/file/write-file.js +7 -2
  28. package/dist/tools/registry.js +39 -8
  29. package/dist/tools/schema-depth.js +79 -6
  30. package/dist/tools/shell/exec.js +7 -0
  31. package/dist/tools/shell/run-command.js +45 -21
  32. package/dist/tui/renderer.js +59 -8
  33. package/dist/vcs/generate.js +48 -6
  34. package/dist/verification/index.js +15 -0
  35. package/dist/verification/ledger.js +99 -0
  36. package/dist/verification/types.js +26 -0
  37. package/dist/verification/view.js +87 -0
  38. package/package.json +1 -1
@@ -0,0 +1,87 @@
1
+ import { formatDuration } from "../render/test-view.js";
2
+ /**
3
+ * Rendering the verification record — the shared formatter behind every
4
+ * surface that reads it, so the one-shot summary, `/status`, the resume
5
+ * notice and the PR body all describe a run the same way.
6
+ *
7
+ * The honesty rules are `verification/types`'s, carried through rather than
8
+ * re-derived: the exit code is the fact, the tool and command are named as
9
+ * they ran, and nothing here calls a run "the build" or "the tests" from its
10
+ * text. A non-zero exit is shown as that exit — never as "1 test failed"
11
+ * unless a parser actually counted one.
12
+ */
13
+ /** `run_tests pnpm test → exit 0 (4.2s)`, coloured by exit. */
14
+ export function describeRun(rec, t) {
15
+ const exit = rec.exitCode === null ? "no exit code" : `exit ${rec.exitCode}`;
16
+ const verdict = rec.passed ? t.muted(exit) : t.danger(exit);
17
+ const counts = countClause(rec);
18
+ return (`${t.muted(rec.tool)} ${rec.command} ${t.glyph.arrow} ${verdict}` +
19
+ (counts ? ` ${t.danger(counts)}` : "") +
20
+ ` ${t.muted(`(${formatDuration(rec.durationMs)})`)}`);
21
+ }
22
+ /** "3 of 128 failed" / "3 failures" / "" — only what a parser actually counted. */
23
+ function countClause(rec) {
24
+ if (rec.passed)
25
+ return "";
26
+ if (rec.total !== undefined && rec.failureCount > 0)
27
+ return `${rec.failureCount} of ${rec.total} failed`;
28
+ if (rec.failureCount > 0)
29
+ return `${rec.failureCount} failure${rec.failureCount === 1 ? "" : "s"}`;
30
+ return "";
31
+ }
32
+ /**
33
+ * The one-shot summary's block (the CI reader). Printed next to the exit code
34
+ * CI already trusts, for BOTH a completed run and one that gave up, so the
35
+ * line that says "completed" is never read on its own.
36
+ *
37
+ * "none ran this turn" is a sentence, not an omitted row: the whole point of
38
+ * the record is that the absence of verification is visible.
39
+ */
40
+ export function verificationTurnLines(turn, t) {
41
+ const lines = [];
42
+ const key = t.strong("verification");
43
+ if (turn.verifications.length === 0) {
44
+ lines.push(`${key} ${t.warning("none ran this turn")}`);
45
+ }
46
+ else {
47
+ turn.verifications.forEach((rec, i) => {
48
+ lines.push(`${i === 0 ? key : " ".repeat(12)} ${describeRun(rec, t)}`);
49
+ });
50
+ }
51
+ turn.externalChanges.forEach((change, i) => {
52
+ lines.push(`${i === 0 ? t.strong("refused") : " ".repeat(7)} ${t.warning(`${change.path} ${change.what} — nothing was written`)}`);
53
+ });
54
+ return lines;
55
+ }
56
+ /**
57
+ * The `## Verification` section for a PR body, from the runs a session
58
+ * recorded — newest first, with their timestamps, so a run from before the
59
+ * last edit is dated rather than presented as current. Returns `null` when
60
+ * nothing ran: a missing section is the honest shape for missing evidence.
61
+ *
62
+ * `from` names where the runs were read from when it is NOT the live session
63
+ * — `cruxy pr` runs outside any session and reads the project's latest log —
64
+ * so the header never says "this session" about a session that has ended.
65
+ */
66
+ export function verificationMarkdown(runs, opts = {}) {
67
+ if (runs.length === 0)
68
+ return null;
69
+ const shown = [...runs].reverse().slice(0, opts.limit ?? MARKDOWN_LIMIT);
70
+ const items = shown.map((rec) => {
71
+ const exit = rec.exitCode === null ? "no exit code" : `exit ${rec.exitCode}`;
72
+ const counts = countClause(rec);
73
+ return (`- \`${rec.command}\` — ${exit}${counts ? ` (${counts})` : ""}, ` +
74
+ `${formatDuration(rec.durationMs)}, via ${rec.tool} at ${rec.at}`);
75
+ });
76
+ const omitted = runs.length - shown.length;
77
+ return [
78
+ `Runs recorded by cruxy ${opts.from ?? "this session"}, newest first (exit codes as observed; nothing inferred):`,
79
+ "",
80
+ ...items,
81
+ ...(omitted > 0
82
+ ? ["", `…and ${omitted} earlier run${omitted === 1 ? "" : "s"}.`]
83
+ : []),
84
+ ].join("\n");
85
+ }
86
+ /** Most runs listed in a PR body. */
87
+ export const MARKDOWN_LIMIT = 8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cruxy/cli",
3
- "version": "1.11.2",
3
+ "version": "1.11.4",
4
4
  "description": "an agentic coding CLI",
5
5
  "type": "module",
6
6
  "bin": {