@azure-id/orc 1.9.2 → 2.1.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.
Files changed (228) hide show
  1. package/CHANGELOG.md +722 -0
  2. package/README-id.md +56 -42
  3. package/README.md +58 -41
  4. package/bin/build-agents.js +125 -29
  5. package/bin/clear-logs.js +620 -0
  6. package/bin/cli.js +1873 -180
  7. package/bin/fix.js +459 -0
  8. package/bin/gotcha-import.js +1081 -0
  9. package/bin/gotcha.js +1566 -0
  10. package/bin/graph-query.js +1 -1
  11. package/bin/graph.js +717 -717
  12. package/bin/habit.js +1538 -0
  13. package/bin/mockrun-catalog.js +284 -276
  14. package/bin/onboarding-content.js +2 -1
  15. package/bin/pricing.json +28 -21
  16. package/bin/run-undo.js +398 -0
  17. package/bin/trace-write.js +869 -0
  18. package/bin/verify-contracts.js +627 -100
  19. package/bin/verify-package.js +68 -10
  20. package/bin/webui/api.js +151 -6
  21. package/bin/webui/app.html +239 -232
  22. package/bin/webui/css/00-tokens.css +110 -92
  23. package/bin/webui/css/04-motion.css +87 -0
  24. package/bin/webui/css/06-responsive.css +203 -178
  25. package/bin/webui/css/panels/behaviour.css +205 -0
  26. package/bin/webui/css/panels/hookui.css +79 -0
  27. package/bin/webui/fixtures/behaviour.js +562 -0
  28. package/bin/webui/fixtures/extra.js +9 -9
  29. package/bin/webui/fixtures/flow.js +81 -81
  30. package/bin/webui/fixtures/hookui.js +506 -431
  31. package/bin/webui/fixtures/index.js +66 -3
  32. package/bin/webui/fixtures/knowledge.js +9 -3
  33. package/bin/webui/fixtures/maintenance.js +123 -42
  34. package/bin/webui/fixtures/rules.js +1007 -1002
  35. package/bin/webui/fixtures/settings.js +6 -7
  36. package/bin/webui/fixtures/stats.js +25 -6
  37. package/bin/webui/fixtures/wait.js +98 -97
  38. package/bin/webui/i18n/en/behaviour.json +156 -0
  39. package/bin/webui/i18n/en/hookui.json +290 -194
  40. package/bin/webui/i18n/en/maintenance.json +71 -52
  41. package/bin/webui/i18n/en/nav.json +25 -24
  42. package/bin/webui/i18n/en/settings.json +60 -60
  43. package/bin/webui/i18n/en/tour.json +37 -35
  44. package/bin/webui/i18n/id/behaviour.json +156 -0
  45. package/bin/webui/i18n/id/hookui.json +290 -194
  46. package/bin/webui/i18n/id/maintenance.json +71 -52
  47. package/bin/webui/i18n/id/nav.json +25 -24
  48. package/bin/webui/i18n/id/settings.json +60 -60
  49. package/bin/webui/i18n/id/tour.json +37 -35
  50. package/bin/webui/js/01-i18n.js +155 -154
  51. package/bin/webui/js/05-banners.js +181 -172
  52. package/bin/webui/js/06-edit.js +193 -183
  53. package/bin/webui/js/90-tour.js +498 -494
  54. package/bin/webui/js/91-shortcuts.js +126 -126
  55. package/bin/webui/js/99-boot.js +121 -118
  56. package/bin/webui/js/panels/behaviour.js +1087 -0
  57. package/bin/webui/js/panels/hookui.js +2196 -1691
  58. package/bin/webui/js/panels/maintenance.js +336 -235
  59. package/bin/webui/js/panels/settings.js +726 -719
  60. package/mock-run/INDEX.md +110 -107
  61. package/mock-run/extra-slots.md +1 -1
  62. package/mock-run/gotcha-import.md +118 -0
  63. package/mock-run/habits.md +129 -0
  64. package/mock-run/orc-aftermath.md +392 -392
  65. package/mock-run/orc-budget.md +29 -33
  66. package/mock-run/orc-cli.md +200 -200
  67. package/mock-run/orc-explain.md +86 -86
  68. package/mock-run/orc-extra.md +389 -392
  69. package/mock-run/orc-fix.md +87 -0
  70. package/mock-run/orc-pattern.md +112 -112
  71. package/mock-run/orc-quick.md +6 -1
  72. package/mock-run/orc.md +157 -157
  73. package/package.json +1 -1
  74. package/templates/agents/MODEL-MAPPING.md +37 -34
  75. package/templates/agents/orc-advisor-opus-5-xhigh.md +1 -7
  76. package/templates/agents/orc-analyze-mini-opus-5-med.md +1 -6
  77. package/templates/agents/orc-analyze-mini-sonnet-5-high.md +2 -5
  78. package/templates/agents/{orc-claude-writer-opus-4-8-high.md → orc-claude-writer-opus-5-low.md} +48 -53
  79. package/templates/agents/orc-context-combiner-opus-5-high.md +1 -11
  80. package/templates/agents/orc-executor-haiku-4-5.md +14 -6
  81. package/templates/agents/orc-executor-opus-4-7-high.md +14 -6
  82. package/templates/agents/orc-executor-opus-4-7-med.md +14 -6
  83. package/templates/agents/orc-executor-opus-4-8-high.md +14 -6
  84. package/templates/agents/orc-executor-opus-5-high.md +14 -6
  85. package/templates/agents/orc-executor-opus-5-low.md +14 -6
  86. package/templates/agents/orc-executor-opus-5-med.md +14 -6
  87. package/templates/agents/orc-executor-sonnet-4-6-high.md +14 -6
  88. package/templates/agents/orc-executor-sonnet-4-6-med.md +14 -6
  89. package/templates/agents/orc-executor-sonnet-5-high.md +15 -7
  90. package/templates/agents/orc-executor-sonnet-5-low.md +155 -0
  91. package/templates/agents/orc-executor-sonnet-5-med.md +155 -0
  92. package/templates/agents/orc-graph-noter-sonnet-4-6-med.md +1 -10
  93. package/templates/agents/orc-judge-opus-5-xhigh.md +5 -9
  94. package/templates/agents/orc-learn-writer-opus-5-low.md +1 -7
  95. package/templates/agents/orc-pattern-codifier-opus-5-med.md +1 -8
  96. package/templates/agents/orc-pattern-codifier-sonnet-5-high.md +58 -63
  97. package/templates/agents/orc-planner-mini-opus-5-med.md +1 -4
  98. package/templates/agents/orc-planner-mini-sonnet-5-high.md +2 -3
  99. package/templates/agents/orc-planner-opus-5-med.md +1 -4
  100. package/templates/agents/orc-recon-opus-5-low.md +1 -8
  101. package/templates/agents/orc-recon-sonnet-4-6-med.md +1 -8
  102. package/templates/agents/orc-retro-opus-5-med.md +6 -8
  103. package/templates/agents/orc-retro-sonnet-5-high.md +7 -8
  104. package/templates/agents/orc-reviewer-opus-5-low.md +96 -0
  105. package/templates/agents/orc-scout-opus-5-low.md +1 -6
  106. package/templates/agents/orc-scout-sonnet-4-6-high.md +35 -39
  107. package/templates/agents/orc-system-analyst-opus-5-high.md +1 -6
  108. package/templates/agents/orc-test-author-opus-5-med.md +4 -5
  109. package/templates/agents/orc-trace-writer-haiku-4-5.md +3 -7
  110. package/templates/agents/orc-verifier-opus-5-med.md +16 -8
  111. package/templates/agents/{orc-wiki-scanner-opus-4-8-high.md → orc-wiki-scanner-opus-5-low.md} +74 -79
  112. package/templates/agents/orc-wiki-scanner-sonnet-5-high.md +97 -106
  113. package/templates/commands/orc-analyze.md +13 -21
  114. package/templates/commands/orc-fast.md +10 -15
  115. package/templates/commands/orc-fix.md +18 -0
  116. package/templates/commands/orc-poly.md +12 -21
  117. package/templates/commands/orc-pr-driver.md +11 -30
  118. package/templates/commands/orc-pr-setup.md +10 -31
  119. package/templates/commands/orc-route.md +11 -41
  120. package/templates/commands/orc-test.md +5 -60
  121. package/templates/commands/orc-wiki.md +64 -64
  122. package/templates/hooks/README.md +109 -7
  123. package/templates/hooks/orc-session-hook.js +339 -0
  124. package/templates/hooks/orc-statusline-render.js +317 -23
  125. package/templates/hooks/orc-statusline.js +165 -50
  126. package/templates/hooks/orc-subagent-line.js +23 -5
  127. package/templates/hooks/orc-weather-fetch.js +123 -0
  128. package/templates/skills/_shared/README.md +9 -0
  129. package/templates/skills/_shared/code-graph.md +47 -55
  130. package/templates/skills/_shared/config-precedence.md +3 -1
  131. package/templates/skills/_shared/extra-dispatch.md +78 -93
  132. package/templates/skills/_shared/gotchas.md +248 -177
  133. package/templates/skills/_shared/habits.md +101 -0
  134. package/templates/skills/_shared/lane-contract.md +84 -0
  135. package/templates/skills/_shared/opus5-only.md +14 -14
  136. package/templates/skills/_shared/phases/README.md +142 -83
  137. package/templates/skills/_shared/phases/analyst-gates.md +10 -21
  138. package/templates/skills/_shared/phases/execution.md +8 -14
  139. package/templates/skills/_shared/phases/house-rules.md +27 -32
  140. package/templates/skills/_shared/phases/intake.md +127 -133
  141. package/templates/skills/_shared/phases/mock-example.md +46 -56
  142. package/templates/skills/_shared/phases/plan-handoff.md +91 -97
  143. package/templates/skills/_shared/phases/planning.md +7 -17
  144. package/templates/skills/_shared/phases/preflight.md +19 -42
  145. package/templates/skills/_shared/phases/review.md +24 -28
  146. package/templates/skills/_shared/phases/rules.md +18 -42
  147. package/templates/skills/_shared/phases/scoring.md +55 -65
  148. package/templates/skills/_shared/phases/security-checklist.md +46 -50
  149. package/templates/skills/_shared/phases/security.md +45 -55
  150. package/templates/skills/_shared/phases/ship.md +6 -15
  151. package/templates/skills/_shared/phases/stop-resume.md +2 -5
  152. package/templates/skills/_shared/phases/summary.md +73 -48
  153. package/templates/skills/_shared/phases/testgen.md +41 -51
  154. package/templates/skills/_shared/phases/trace-verbs.md +447 -0
  155. package/templates/skills/_shared/phases/trace.md +66 -297
  156. package/templates/skills/_shared/phases/verify.md +62 -70
  157. package/templates/skills/_shared/phases/wave-grouping.md +128 -133
  158. package/templates/skills/_shared/phases/wiki-consult.md +10 -6
  159. package/templates/skills/_shared/read-ladder.md +2 -55
  160. package/templates/skills/_shared/return-validation.md +17 -70
  161. package/templates/skills/_shared/review-slice.md +106 -0
  162. package/templates/skills/_shared/smoke-gate.md +46 -28
  163. package/templates/skills/_shared/wait.md +1 -0
  164. package/templates/skills/context-combiner/SKILL.md +15 -44
  165. package/templates/skills/orc/README.md +2 -2
  166. package/templates/skills/orc/SKILL.md +35 -63
  167. package/templates/skills/orc/config.md +25 -27
  168. package/templates/skills/orc/examples/full-run-mock.md +2 -1
  169. package/templates/skills/orc/references/effort-and-mode.md +17 -17
  170. package/templates/skills/orc/references/pattern-gate.md +89 -89
  171. package/templates/skills/orc/references/phases/intake.md +41 -47
  172. package/templates/skills/orc/references/phases/integration.md +13 -19
  173. package/templates/skills/orc/references/preflight-report.md +11 -12
  174. package/templates/skills/orc/references/ultra-mode.md +9 -7
  175. package/templates/skills/orc/schemas/checkpoint.md +122 -122
  176. package/templates/skills/orc/subskills/orc-execution/SKILL.md +27 -73
  177. package/templates/skills/orc/subskills/orc-execution/core.md +12 -99
  178. package/templates/skills/orc/subskills/orc-execution/subagent.md +14 -13
  179. package/templates/skills/orc/subskills/orc-review-verify/SKILL.md +12 -53
  180. package/templates/skills/orc/subskills/orc-review-verify/core.md +52 -135
  181. package/templates/skills/orc/subskills/orc-review-verify/subagent.md +7 -7
  182. package/templates/skills/orc/subskills/orc-testgen/SKILL.md +11 -22
  183. package/templates/skills/orc/subskills/orc-testgen/core.md +20 -59
  184. package/templates/skills/orc/subskills/orc-testgen/subagent.md +7 -7
  185. package/templates/skills/orc-advisor/SKILL.md +56 -60
  186. package/templates/skills/orc-analyze/SKILL.md +33 -67
  187. package/templates/skills/orc-analyze/schemas/report-audit.md +2 -1
  188. package/templates/skills/orc-analyze/schemas/report-prose.md +2 -1
  189. package/templates/skills/orc-analyze-mini/SKILL.md +35 -70
  190. package/templates/skills/orc-claude/SKILL.md +14 -14
  191. package/templates/skills/orc-claude/examples/claude-run-mock.md +65 -65
  192. package/templates/skills/orc-diy/README.md +31 -0
  193. package/templates/skills/orc-diy/SKILL.md +27 -78
  194. package/templates/skills/orc-diy/references/blocks/pattern.md +18 -18
  195. package/templates/skills/orc-fast/SKILL.md +49 -75
  196. package/templates/skills/orc-fix/SKILL.md +110 -0
  197. package/templates/skills/orc-judge/SKILL.md +77 -82
  198. package/templates/skills/orc-mini/SKILL.md +64 -112
  199. package/templates/skills/orc-mini/examples/mini-run-mock.md +4 -2
  200. package/templates/skills/orc-pattern/SKILL.md +27 -48
  201. package/templates/skills/orc-poly/SKILL.md +32 -61
  202. package/templates/skills/orc-pr-driver/SKILL.md +25 -51
  203. package/templates/skills/orc-pr-driver/references/green-gate.md +113 -105
  204. package/templates/skills/orc-pr-setup/SKILL.md +20 -45
  205. package/templates/skills/orc-quick/README.md +44 -3
  206. package/templates/skills/orc-quick/SKILL.md +77 -108
  207. package/templates/skills/orc-quick/references/dispatch-gate.md +18 -6
  208. package/templates/skills/orc-quick/references/gh-mode.md +50 -1
  209. package/templates/skills/orc-quick/references/look.md +3 -1
  210. package/templates/skills/orc-retro/SKILL.md +20 -19
  211. package/templates/skills/orc-retro/examples/retro-mock.md +17 -17
  212. package/templates/skills/orc-route/SKILL.md +25 -45
  213. package/templates/skills/orc-test/SKILL.md +16 -37
  214. package/templates/skills/orc-verify/SKILL.md +14 -32
  215. package/templates/skills/orc-wait/SKILL.md +156 -163
  216. package/templates/skills/orc-wiki/README.md +325 -325
  217. package/templates/skills/orc-wiki/SKILL.md +195 -195
  218. package/templates/skills/orc-wiki/examples/wiki-run-mock.md +37 -37
  219. package/templates/skills/orc-wiki/references/extra.md +2 -2
  220. package/templates/skills/orc-wiki/references/partial-refresh.md +276 -271
  221. package/templates/skills/orc-wiki/references/phases/phase-0.md +2 -7
  222. package/templates/skills/orc-wiki/references/phases/phase-1.md +1 -6
  223. package/templates/skills/orc-wiki/references/phases/phase-2.md +4 -9
  224. package/templates/skills/orc-wiki/references/phases/phase-3.md +1 -6
  225. package/templates/skills/orc-wiki/references/phases/phase-3c.md +4 -8
  226. package/templates/agents/orc-claude-writer-opus-5-med.md +0 -55
  227. package/templates/agents/orc-reviewer-opus-5-med.md +0 -60
  228. package/templates/agents/orc-wiki-scanner-opus-5-med.md +0 -81
@@ -1,276 +1,284 @@
1
- "use strict";
2
- /**
3
- * mockrun-catalog.js — the catalogue of MOCKED RUNS that ship with ORC.
4
- *
5
- * A mocked run is a written walkthrough of ONE lane: what you type, what ORC
6
- * prints back, what lands on disk. Nothing was executed to produce them — they
7
- * are documentation — and that is exactly why they exist: a new user needs to
8
- * know what a lane LOOKS like before paying tokens to find out.
9
- *
10
- * Two sources, one catalogue:
11
- * · `mock-run/*.md` the reader-facing walkthroughs
12
- * · `templates/skills/<skill>/examples/*` the dense annotated examples that
13
- * already shipped with each skill
14
- *
15
- * DERIVED, never hand-listed. A new file in either place appears by itself:
16
- * the title comes from the file's own `# ` heading, the lane from whether
17
- * `templates/commands/<name>.md` exists, and the one-line summary from the
18
- * `> ` blockquote the walkthroughs open with. The only hand-written table here
19
- * is the READING ORDER (`GROUPS` + `GROUP_OF`) — an order is editorial and
20
- * cannot be derived from a filename. A file nobody placed still shows up, in
21
- * the `other` group, because a mocked run that exists and is invisible is the
22
- * failure mode this module is meant to make impossible.
23
- *
24
- * This is package content, not project state: it is the same on every machine
25
- * and needs no `.claude/`. `orc mock-run` reads it, and `orc ui` serves it the
26
- * same way it serves the onboarding walkthrough — straight from the module,
27
- * because spawning a subprocess to read files that ship in this package would
28
- * be ceremony with a cost. It is NOT `orc mock`, which lists the runnable
29
- * `mock-examples/<slug>/` folders a green verify left in YOUR project.
30
- */
31
-
32
- const fs = require("fs");
33
- const path = require("path");
34
-
35
- const ROOT = path.join(__dirname, "..");
36
- const WALKTHROUGH_DIR = path.join(ROOT, "mock-run");
37
- const SKILLS_DIR = path.join(ROOT, "templates", "skills");
38
- const COMMANDS_DIR = path.join(ROOT, "templates", "commands");
39
-
40
- // The reading order. Group titles are DATA (the panel prints them as written
41
- // and never translates them, exactly like a config key or a doctor message).
42
- const GROUPS = [
43
- { id: "start", title: "Start here" },
44
- { id: "build", title: "Build a change" },
45
- { id: "decide", title: "Decide what to build" },
46
- { id: "knowledge", title: "Teach ORC your project" },
47
- { id: "check", title: "Check what happened" },
48
- { id: "ship", title: "Ship and hand over" },
49
- { id: "tools", title: "Panel and terminal" },
50
- { id: "other", title: "More" },
51
- ];
52
-
53
- // slug (or lane name) → group. Anything absent lands in `other`.
54
- const GROUP_OF = {
55
- "the-example-project": "start",
56
- "a-normal-day": "start",
57
-
58
- orc: "build",
59
- "orc-ultra": "build",
60
- "orc-mini": "build",
61
- "orc-fast": "build",
62
- "orc-quick": "build",
63
- "orc-diy": "build",
64
-
65
- // v0.48.0. It sits with the deciding lanes rather than the knowledge ones: a
66
- // /orc-doc document is derived from what you DECIDED, not from the code —
67
- // which is exactly what separates it from /orc-wiki and /orc-learn.
68
- "orc-doc": "decide",
69
-
70
- "orc-brainstorm": "decide",
71
- "orc-grill": "decide",
72
- "orc-plan": "decide",
73
- "orc-route": "decide",
74
- "orc-explain": "decide",
75
- "orc-analyze": "decide",
76
- "orc-analyze-mini": "decide",
77
- "context-combiner": "decide",
78
- "orc-poly": "decide",
79
-
80
- // v0.50.0. It sits with the TOOLS rather than the build lanes: `orc extra` is
81
- // not a lane you invoke — it is a setting that changes where the lanes you
82
- // already run send their work.
83
- "orc-extra": "tools",
84
- // v0.54.0. It sits beside `orc-extra` for the same reason: recovering a
85
- // half-finished foreign dispatch is a thing you do at the terminal and in the
86
- // panel, not a lane you invoke.
87
- "extra-recovery": "tools",
88
- // v0.55.0. Same shelf again: the four lanes that pin an agent instead of
89
- // scoring a task are a routing decision, and routing is where `orc-extra`
90
- // already lives.
91
- "extra-slots": "tools",
92
-
93
- // v1.7.0. It sits with the KNOWLEDGE lanes rather than the tools: a rule set
94
- // is something you teach ORC about this project, the same shelf as the wiki
95
- // and the code patterns — and like both of those it is read on every run.
96
- "orc-rules": "knowledge",
97
-
98
- "orc-wiki": "knowledge",
99
- "orc-pattern": "knowledge",
100
- "orc-learn": "knowledge",
101
- "orc-claude": "knowledge",
102
- "orc-export": "knowledge",
103
-
104
- // v1.5.0. It sits with the CHECKING lanes rather than the build ones:
105
- // /orc-test makes nothing. It runs the requests, writes down what came back,
106
- // and hands the machine back — the same shape as /orc-verify beside it.
107
- "orc-test": "check",
108
- "orc-verify": "check",
109
- "orc-challenge": "check",
110
- // v0.49.1. It sits beside the lane it belongs to, and it is a SEPARATE
111
- // walkthrough because the council is a decision the reader takes before the
112
- // first review runs — not a detail of one.
113
- "orc-challenge-council": "check",
114
- "orc-pact": "check",
115
- "orc-boundary": "check",
116
- "orc-aftermath": "check",
117
- "orc-budget": "check",
118
- "orc-retro": "check",
119
-
120
- "orc-pr-setup": "ship",
121
- "orc-pr-driver": "ship",
122
- "orc-handoff": "ship",
123
-
124
- "orc-ui": "tools",
125
- "orc-cli": "tools",
126
- };
127
-
128
- // A few docs lead their group because they are prerequisites for reading the
129
- // rest, which alphabetical order cannot know. Everything else sorts by title.
130
- const PINNED_FIRST = ["the-example-project", "orc", "orc-brainstorm", "orc-wiki-example", "orc-verify-example"];
131
-
132
- // Files in mock-run/ that are not themselves a mocked run.
133
- const NOT_A_DOC = new Set(["INDEX.md", "README.md"]);
134
-
135
- function readSafe(p) {
136
- try {
137
- return fs.readFileSync(p, "utf8");
138
- } catch (_) {
139
- return null;
140
- }
141
- }
142
-
143
- function listSafe(dir) {
144
- try {
145
- return fs.readdirSync(dir, { withFileTypes: true });
146
- } catch (_) {
147
- return [];
148
- }
149
- }
150
-
151
- // `# Mock run — \`/orc-pact\`` → `Mock run — /orc-pact`. Backticks are markup
152
- // for a reader, not part of the title.
153
- function titleOf(md, fallback) {
154
- const m = String(md || "").match(/^#\s+(.+?)\s*$/m);
155
- return m ? m[1].replace(/`/g, "").trim() : fallback;
156
- }
157
-
158
- // The walkthroughs open with a `> one line` blockquote under the title. The
159
- // older annotated examples do not, so the first real line stands in.
160
- function summaryOf(md) {
161
- const lines = String(md || "").split(/\r?\n/);
162
- let seenTitle = false;
163
- for (const raw of lines) {
164
- const line = raw.trim();
165
- if (!line) continue;
166
- if (line.startsWith("# ")) {
167
- seenTitle = true;
168
- continue;
169
- }
170
- if (!seenTitle) continue;
171
- if (line.startsWith(">")) return clip(line.replace(/^>\s?/, ""));
172
- if (line.startsWith("#") || line.startsWith("---")) continue;
173
- return clip(line);
174
- }
175
- return "";
176
- }
177
-
178
- // A summary is read as one line of prose, so the markup that made it readable
179
- // in the file (`**bold**`, `` `code` ``) is noise here.
180
- function clip(s, max = 200) {
181
- const t = String(s).replace(/\*\*/g, "").replace(/`/g, "").trim();
182
- return t.length > max ? t.slice(0, max - 1).trimEnd() + "…" : t;
183
- }
184
-
185
- // A name is a lane only when the payload really ships that slash command. This
186
- // is what keeps `/orc-pact` a link and `a-normal-day` plain text, with no list
187
- // to maintain in two places.
188
- function laneOf(name) {
189
- return fs.existsSync(path.join(COMMANDS_DIR, name + ".md")) ? "/" + name : null;
190
- }
191
-
192
- function entry(slug, file, kind, name, md) {
193
- const stat = (() => {
194
- try {
195
- return fs.statSync(file);
196
- } catch (_) {
197
- return null;
198
- }
199
- })();
200
- const body = md === null ? "" : md;
201
- return {
202
- slug,
203
- title: titleOf(body, slug),
204
- lane: laneOf(name),
205
- kind, // "walkthrough" = written for a reader · "annotated" = the dense one
206
- group: GROUP_OF[name] || GROUP_OF[slug] || "other",
207
- summary: summaryOf(body),
208
- path: path.relative(ROOT, file).split(path.sep).join("/"),
209
- bytes: stat ? stat.size : body.length,
210
- lines: body ? body.split(/\r?\n/).length : 0,
211
- };
212
- }
213
-
214
- // Every mocked run that ships in this package, in reading order.
215
- function list() {
216
- const out = [];
217
-
218
- for (const e of listSafe(WALKTHROUGH_DIR)) {
219
- if (!e.isFile() || !e.name.endsWith(".md") || NOT_A_DOC.has(e.name)) continue;
220
- const name = e.name.replace(/\.md$/, "");
221
- const file = path.join(WALKTHROUGH_DIR, e.name);
222
- out.push(entry(name, file, "walkthrough", name, readSafe(file)));
223
- }
224
-
225
- for (const s of listSafe(SKILLS_DIR)) {
226
- if (!s.isDirectory()) continue;
227
- const exDir = path.join(SKILLS_DIR, s.name, "examples");
228
- for (const f of listSafe(exDir)) {
229
- if (!f.isFile() || !f.name.endsWith(".md")) continue;
230
- const file = path.join(exDir, f.name);
231
- // One example per skill is the shipped shape; a second one keeps its own
232
- // file name so neither can hide the other.
233
- const base = f.name.replace(/\.md$/, "");
234
- const slug = `${s.name}-example`;
235
- const taken = out.some((d) => d.slug === slug);
236
- out.push(entry(taken ? `${s.name}-${base}` : slug, file, "annotated", s.name, readSafe(file)));
237
- }
238
- }
239
-
240
- const rank = new Map(GROUPS.map((g, i) => [g.id, i]));
241
- out.sort((a, b) => {
242
- const g = (rank.get(a.group) ?? 99) - (rank.get(b.group) ?? 99);
243
- if (g) return g;
244
- // Inside a group: pinned docs first, then the reader-facing walkthrough
245
- // before the dense annotated example, then by title.
246
- const p = (d) => {
247
- const i = PINNED_FIRST.indexOf(d.slug);
248
- return i === -1 ? PINNED_FIRST.length : i;
249
- };
250
- const pin = p(a) - p(b);
251
- if (pin) return pin;
252
- if (a.kind !== b.kind) return a.kind === "walkthrough" ? -1 : 1;
253
- return a.title.localeCompare(b.title);
254
- });
255
- return out;
256
- }
257
-
258
- // The catalogue, grouped, with the counts a header can print without counting.
259
- function catalogue() {
260
- const docs = list();
261
- const groups = GROUPS.map((g) => ({
262
- ...g,
263
- docs: docs.filter((d) => d.group === g.id),
264
- })).filter((g) => g.docs.length);
265
- return { root: path.relative(ROOT, WALKTHROUGH_DIR) || "mock-run", total: docs.length, groups, docs };
266
- }
267
-
268
- // One doc, with its body. Returns null when the slug is unknown — the caller
269
- // decides what a miss means (exit 1 in the CLI, a 404 in the panel).
270
- function get(slug) {
271
- const hit = list().find((d) => d.slug === slug);
272
- if (!hit) return null;
273
- return { ...hit, body: readSafe(path.join(ROOT, hit.path)) || "" };
274
- }
275
-
276
- module.exports = { GROUPS, catalogue, list, get };
1
+ "use strict";
2
+ /**
3
+ * mockrun-catalog.js — the catalogue of MOCKED RUNS that ship with ORC.
4
+ *
5
+ * A mocked run is a written walkthrough of ONE lane: what you type, what ORC
6
+ * prints back, what lands on disk. Nothing was executed to produce them — they
7
+ * are documentation — and that is exactly why they exist: a new user needs to
8
+ * know what a lane LOOKS like before paying tokens to find out.
9
+ *
10
+ * Two sources, one catalogue:
11
+ * · `mock-run/*.md` the reader-facing walkthroughs
12
+ * · `templates/skills/<skill>/examples/*` the dense annotated examples that
13
+ * already shipped with each skill
14
+ *
15
+ * DERIVED, never hand-listed. A new file in either place appears by itself:
16
+ * the title comes from the file's own `# ` heading, the lane from whether
17
+ * `templates/commands/<name>.md` exists, and the one-line summary from the
18
+ * `> ` blockquote the walkthroughs open with. The only hand-written table here
19
+ * is the READING ORDER (`GROUPS` + `GROUP_OF`) — an order is editorial and
20
+ * cannot be derived from a filename. A file nobody placed still shows up, in
21
+ * the `other` group, because a mocked run that exists and is invisible is the
22
+ * failure mode this module is meant to make impossible.
23
+ *
24
+ * This is package content, not project state: it is the same on every machine
25
+ * and needs no `.claude/`. `orc mock-run` reads it, and `orc ui` serves it the
26
+ * same way it serves the onboarding walkthrough — straight from the module,
27
+ * because spawning a subprocess to read files that ship in this package would
28
+ * be ceremony with a cost. It is NOT `orc mock`, which lists the runnable
29
+ * `mock-examples/<slug>/` folders a green verify left in YOUR project.
30
+ */
31
+
32
+ const fs = require("fs");
33
+ const path = require("path");
34
+
35
+ const ROOT = path.join(__dirname, "..");
36
+ const WALKTHROUGH_DIR = path.join(ROOT, "mock-run");
37
+ const SKILLS_DIR = path.join(ROOT, "templates", "skills");
38
+ const COMMANDS_DIR = path.join(ROOT, "templates", "commands");
39
+
40
+ // The reading order. Group titles are DATA (the panel prints them as written
41
+ // and never translates them, exactly like a config key or a doctor message).
42
+ const GROUPS = [
43
+ { id: "start", title: "Start here" },
44
+ { id: "build", title: "Build a change" },
45
+ { id: "decide", title: "Decide what to build" },
46
+ { id: "knowledge", title: "Teach ORC your project" },
47
+ { id: "check", title: "Check what happened" },
48
+ { id: "ship", title: "Ship and hand over" },
49
+ { id: "tools", title: "Panel and terminal" },
50
+ { id: "other", title: "More" },
51
+ ];
52
+
53
+ // slug (or lane name) → group. Anything absent lands in `other`.
54
+ const GROUP_OF = {
55
+ "the-example-project": "start",
56
+ "a-normal-day": "start",
57
+
58
+ orc: "build",
59
+ "orc-ultra": "build",
60
+ "orc-mini": "build",
61
+ "orc-fast": "build",
62
+ "orc-quick": "build",
63
+ "orc-diy": "build",
64
+
65
+ // v0.48.0. It sits with the deciding lanes rather than the knowledge ones: a
66
+ // /orc-doc document is derived from what you DECIDED, not from the code —
67
+ // which is exactly what separates it from /orc-wiki and /orc-learn.
68
+ "orc-doc": "decide",
69
+
70
+ "orc-brainstorm": "decide",
71
+ "orc-grill": "decide",
72
+ "orc-plan": "decide",
73
+ "orc-route": "decide",
74
+ "orc-explain": "decide",
75
+ "orc-analyze": "decide",
76
+ "orc-analyze-mini": "decide",
77
+ "context-combiner": "decide",
78
+ "orc-poly": "decide",
79
+
80
+ // v0.50.0. It sits with the TOOLS rather than the build lanes: `orc extra` is
81
+ // not a lane you invoke — it is a setting that changes where the lanes you
82
+ // already run send their work.
83
+ "orc-extra": "tools",
84
+ // v0.54.0. It sits beside `orc-extra` for the same reason: recovering a
85
+ // half-finished foreign dispatch is a thing you do at the terminal and in the
86
+ // panel, not a lane you invoke.
87
+ "extra-recovery": "tools",
88
+ // v0.55.0. Same shelf again: the four lanes that pin an agent instead of
89
+ // scoring a task are a routing decision, and routing is where `orc-extra`
90
+ // already lives.
91
+ "extra-slots": "tools",
92
+
93
+ // v1.7.0. It sits with the KNOWLEDGE lanes rather than the tools: a rule set
94
+ // is something you teach ORC about this project, the same shelf as the wiki
95
+ // and the code patterns — and like both of those it is read on every run.
96
+ "orc-rules": "knowledge",
97
+
98
+ "orc-wiki": "knowledge",
99
+ "orc-pattern": "knowledge",
100
+ "orc-learn": "knowledge",
101
+ "orc-claude": "knowledge",
102
+ "orc-export": "knowledge",
103
+ // v2.0.0. Both sit with the KNOWLEDGE lanes: a habit is what ORC learns about
104
+ // how YOU work, and an import teaches the repair memory what this project
105
+ // already got wrong. Neither is a lane you invoke.
106
+ habits: "knowledge",
107
+ "gotcha-import": "knowledge",
108
+
109
+ // v1.5.0. It sits with the CHECKING lanes rather than the build ones:
110
+ // /orc-test makes nothing. It runs the requests, writes down what came back,
111
+ // and hands the machine back — the same shape as /orc-verify beside it.
112
+ "orc-test": "check",
113
+ "orc-verify": "check",
114
+ "orc-challenge": "check",
115
+ // v0.49.1. It sits beside the lane it belongs to, and it is a SEPARATE
116
+ // walkthrough because the council is a decision the reader takes before the
117
+ // first review runs — not a detail of one.
118
+ "orc-challenge-council": "check",
119
+ "orc-pact": "check",
120
+ "orc-boundary": "check",
121
+ "orc-aftermath": "check",
122
+ "orc-budget": "check",
123
+ "orc-retro": "check",
124
+ // v2.1.0. It sits with the CHECKING lanes: a fix record says what an earlier
125
+ // review missed, and Review Quality shows it beside the reviews.
126
+ "orc-fix": "check",
127
+
128
+ "orc-pr-setup": "ship",
129
+ "orc-pr-driver": "ship",
130
+ "orc-handoff": "ship",
131
+
132
+ "orc-ui": "tools",
133
+ "orc-cli": "tools",
134
+ };
135
+
136
+ // A few docs lead their group because they are prerequisites for reading the
137
+ // rest, which alphabetical order cannot know. Everything else sorts by title.
138
+ const PINNED_FIRST = ["the-example-project", "orc", "orc-brainstorm", "orc-wiki-example", "orc-verify-example"];
139
+
140
+ // Files in mock-run/ that are not themselves a mocked run.
141
+ const NOT_A_DOC = new Set(["INDEX.md", "README.md"]);
142
+
143
+ function readSafe(p) {
144
+ try {
145
+ return fs.readFileSync(p, "utf8");
146
+ } catch (_) {
147
+ return null;
148
+ }
149
+ }
150
+
151
+ function listSafe(dir) {
152
+ try {
153
+ return fs.readdirSync(dir, { withFileTypes: true });
154
+ } catch (_) {
155
+ return [];
156
+ }
157
+ }
158
+
159
+ // `# Mock run — \`/orc-pact\`` → `Mock run — /orc-pact`. Backticks are markup
160
+ // for a reader, not part of the title.
161
+ function titleOf(md, fallback) {
162
+ const m = String(md || "").match(/^#\s+(.+?)\s*$/m);
163
+ return m ? m[1].replace(/`/g, "").trim() : fallback;
164
+ }
165
+
166
+ // The walkthroughs open with a `> one line` blockquote under the title. The
167
+ // older annotated examples do not, so the first real line stands in.
168
+ function summaryOf(md) {
169
+ const lines = String(md || "").split(/\r?\n/);
170
+ let seenTitle = false;
171
+ for (const raw of lines) {
172
+ const line = raw.trim();
173
+ if (!line) continue;
174
+ if (line.startsWith("# ")) {
175
+ seenTitle = true;
176
+ continue;
177
+ }
178
+ if (!seenTitle) continue;
179
+ if (line.startsWith(">")) return clip(line.replace(/^>\s?/, ""));
180
+ if (line.startsWith("#") || line.startsWith("---")) continue;
181
+ return clip(line);
182
+ }
183
+ return "";
184
+ }
185
+
186
+ // A summary is read as one line of prose, so the markup that made it readable
187
+ // in the file (`**bold**`, `` `code` ``) is noise here.
188
+ function clip(s, max = 200) {
189
+ const t = String(s).replace(/\*\*/g, "").replace(/`/g, "").trim();
190
+ return t.length > max ? t.slice(0, max - 1).trimEnd() + "…" : t;
191
+ }
192
+
193
+ // A name is a lane only when the payload really ships that slash command. This
194
+ // is what keeps `/orc-pact` a link and `a-normal-day` plain text, with no list
195
+ // to maintain in two places.
196
+ function laneOf(name) {
197
+ return fs.existsSync(path.join(COMMANDS_DIR, name + ".md")) ? "/" + name : null;
198
+ }
199
+
200
+ function entry(slug, file, kind, name, md) {
201
+ const stat = (() => {
202
+ try {
203
+ return fs.statSync(file);
204
+ } catch (_) {
205
+ return null;
206
+ }
207
+ })();
208
+ const body = md === null ? "" : md;
209
+ return {
210
+ slug,
211
+ title: titleOf(body, slug),
212
+ lane: laneOf(name),
213
+ kind, // "walkthrough" = written for a reader · "annotated" = the dense one
214
+ group: GROUP_OF[name] || GROUP_OF[slug] || "other",
215
+ summary: summaryOf(body),
216
+ path: path.relative(ROOT, file).split(path.sep).join("/"),
217
+ bytes: stat ? stat.size : body.length,
218
+ lines: body ? body.split(/\r?\n/).length : 0,
219
+ };
220
+ }
221
+
222
+ // Every mocked run that ships in this package, in reading order.
223
+ function list() {
224
+ const out = [];
225
+
226
+ for (const e of listSafe(WALKTHROUGH_DIR)) {
227
+ if (!e.isFile() || !e.name.endsWith(".md") || NOT_A_DOC.has(e.name)) continue;
228
+ const name = e.name.replace(/\.md$/, "");
229
+ const file = path.join(WALKTHROUGH_DIR, e.name);
230
+ out.push(entry(name, file, "walkthrough", name, readSafe(file)));
231
+ }
232
+
233
+ for (const s of listSafe(SKILLS_DIR)) {
234
+ if (!s.isDirectory()) continue;
235
+ const exDir = path.join(SKILLS_DIR, s.name, "examples");
236
+ for (const f of listSafe(exDir)) {
237
+ if (!f.isFile() || !f.name.endsWith(".md")) continue;
238
+ const file = path.join(exDir, f.name);
239
+ // One example per skill is the shipped shape; a second one keeps its own
240
+ // file name so neither can hide the other.
241
+ const base = f.name.replace(/\.md$/, "");
242
+ const slug = `${s.name}-example`;
243
+ const taken = out.some((d) => d.slug === slug);
244
+ out.push(entry(taken ? `${s.name}-${base}` : slug, file, "annotated", s.name, readSafe(file)));
245
+ }
246
+ }
247
+
248
+ const rank = new Map(GROUPS.map((g, i) => [g.id, i]));
249
+ out.sort((a, b) => {
250
+ const g = (rank.get(a.group) ?? 99) - (rank.get(b.group) ?? 99);
251
+ if (g) return g;
252
+ // Inside a group: pinned docs first, then the reader-facing walkthrough
253
+ // before the dense annotated example, then by title.
254
+ const p = (d) => {
255
+ const i = PINNED_FIRST.indexOf(d.slug);
256
+ return i === -1 ? PINNED_FIRST.length : i;
257
+ };
258
+ const pin = p(a) - p(b);
259
+ if (pin) return pin;
260
+ if (a.kind !== b.kind) return a.kind === "walkthrough" ? -1 : 1;
261
+ return a.title.localeCompare(b.title);
262
+ });
263
+ return out;
264
+ }
265
+
266
+ // The catalogue, grouped, with the counts a header can print without counting.
267
+ function catalogue() {
268
+ const docs = list();
269
+ const groups = GROUPS.map((g) => ({
270
+ ...g,
271
+ docs: docs.filter((d) => d.group === g.id),
272
+ })).filter((g) => g.docs.length);
273
+ return { root: path.relative(ROOT, WALKTHROUGH_DIR) || "mock-run", total: docs.length, groups, docs };
274
+ }
275
+
276
+ // One doc, with its body. Returns null when the slug is unknown — the caller
277
+ // decides what a miss means (exit 1 in the CLI, a 404 in the panel).
278
+ function get(slug) {
279
+ const hit = list().find((d) => d.slug === slug);
280
+ if (!hit) return null;
281
+ return { ...hit, body: readSafe(path.join(ROOT, hit.path)) || "" };
282
+ }
283
+
284
+ module.exports = { GROUPS, catalogue, list, get };
@@ -73,7 +73,7 @@ const SECTIONS = [
73
73
  },
74
74
  {
75
75
  id: "lanes",
76
- title: "④ Lanes cheat-sheet (28 commands)",
76
+ title: "④ Lanes cheat-sheet (29 commands)",
77
77
  lines: [
78
78
  " /orc full orchestrated pipeline",
79
79
  " /orc-quick ask for almost anything — 3 steps, always asks which agent",
@@ -81,6 +81,7 @@ const SECTIONS = [
81
81
  " /orc-grill sharpen a vague idea by conversation (no scan, no build)",
82
82
  " /orc-route you have a PLAN — which lane should build it? (refuses prose)",
83
83
  " /orc-explain say the last ORC message again, with the background it assumed",
84
+ " /orc-fix record a fix and what it fixes, so the next review sees it",
84
85
  " /orc-mini lightweight single-subagent build",
85
86
  " /orc-fast knowledge-gated single-executor build (wiki + pattern)",
86
87
  " /orc-ultra max rigor: + advisor + 3 judgment gates",