@litfamily/litcodex 1.0.27 → 1.0.29

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 (204) hide show
  1. package/README-Ko-KR.md +10 -10
  2. package/README.md +10 -10
  3. package/dist/cli.d.ts +3 -2
  4. package/dist/cli.js +73 -4
  5. package/dist/config-migration/cli.js +11 -3
  6. package/dist/install/generated-skill-payload-hashes.d.ts +58 -30
  7. package/dist/install/generated-skill-payload-hashes.js +58 -30
  8. package/dist/install/index.js +1 -1
  9. package/dist/install/motion-runtime.d.ts +4 -1
  10. package/dist/install/motion-runtime.js +15 -4
  11. package/dist/install/office-runtime.d.ts +10 -11
  12. package/dist/install/office-runtime.js +8 -3
  13. package/dist/install/skill-catalog.d.ts +1 -1
  14. package/dist/install/skill-catalog.js +1 -0
  15. package/dist/postinstall.js +16 -3
  16. package/dist/pty-helper.d.ts +7 -0
  17. package/dist/pty-helper.js +45 -0
  18. package/dist/run.d.ts +57 -0
  19. package/dist/run.js +354 -0
  20. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
  21. package/marketplace/plugins/litcodex/components/auto-update/dist/auto-update.d.ts +12 -0
  22. package/marketplace/plugins/litcodex/components/auto-update/dist/auto-update.js +31 -2
  23. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  24. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  25. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  26. package/marketplace/plugins/litcodex/components/lit-loop/directive.md +2 -1
  27. package/marketplace/plugins/litcodex/components/lit-loop/directives/deep-interview.md +2 -0
  28. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-brainstorm.md +216 -0
  29. package/marketplace/plugins/litcodex/components/lit-loop/directives/litgoal.md +8 -1
  30. package/marketplace/plugins/litcodex/components/lit-loop/directives/review-work.md +12 -4
  31. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.d.ts +8 -3
  32. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +11 -6
  33. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.d.ts +6 -1
  34. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +16 -5
  35. package/marketplace/plugins/litcodex/components/lit-loop/dist/guards.d.ts +3 -1
  36. package/marketplace/plugins/litcodex/components/lit-loop/dist/guards.js +5 -2
  37. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +2 -0
  38. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +53 -17
  39. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud-cli.d.ts +38 -0
  40. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud-cli.js +155 -0
  41. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.d.ts +42 -0
  42. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.js +297 -0
  43. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.d.ts +2 -0
  44. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.js +2 -0
  45. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.d.ts +1 -1
  46. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.js +9 -1
  47. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.js +2 -0
  48. package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.d.ts +2 -0
  49. package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.js +8 -0
  50. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.d.ts +56 -0
  51. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.js +171 -0
  52. package/marketplace/plugins/litcodex/components/lit-loop/dist/route-context.js +5 -2
  53. package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +35 -15
  54. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-filter.d.ts +23 -0
  55. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-filter.js +142 -0
  56. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.d.ts +29 -0
  57. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.js +102 -0
  58. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.d.ts +24 -0
  59. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.js +104 -0
  60. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-status.d.ts +24 -0
  61. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-status.js +110 -0
  62. package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-mention-scope.js +2 -0
  63. package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.d.ts +17 -0
  64. package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.js +113 -0
  65. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.d.ts +2 -2
  66. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.js +15 -5
  67. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.d.ts +7 -0
  68. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.js +59 -10
  69. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  70. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  71. package/marketplace/plugins/litcodex/components/rules/bundled-rules/lit-humanizer.md +2 -0
  72. package/marketplace/plugins/litcodex/components/rules/dist/deliverable-hedge-guard.d.ts +8 -0
  73. package/marketplace/plugins/litcodex/components/rules/dist/deliverable-hedge-guard.js +381 -39
  74. package/marketplace/plugins/litcodex/components/rules/dist/model-metadata.d.ts +16 -0
  75. package/marketplace/plugins/litcodex/components/rules/dist/model-metadata.js +37 -1
  76. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  77. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  78. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  79. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  80. package/marketplace/plugins/litcodex/skills/browser-drive/scripts/capability-probe.mjs +24 -4
  81. package/marketplace/plugins/litcodex/skills/deep-interview/SKILL.md +3 -1
  82. package/marketplace/plugins/litcodex/skills/lit-brainstorm/SKILL.md +271 -0
  83. package/marketplace/plugins/litcodex/skills/lit-brainstorm/agents/openai.yaml +6 -0
  84. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/doctor.mjs +4 -3
  85. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/export.mjs +6 -5
  86. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/runtime-probes.mjs +25 -0
  87. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/convert_md_to_pdf.py +31 -1
  88. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/acs/template.tex +2 -0
  89. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/elsevier/template.tex +2 -0
  90. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/ieee/template.tex +2 -0
  91. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/korean-generic/template.tex +2 -0
  92. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/nature/template.tex +2 -0
  93. package/marketplace/plugins/litcodex/skills/lit-humanizer/SKILL.md +4 -0
  94. package/marketplace/plugins/litcodex/skills/lit-humanizer/scripts/core.mjs +5 -1
  95. package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +10 -2
  96. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +42 -10
  97. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +11 -9
  98. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/agents/openai.yaml +3 -0
  99. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +4 -0
  100. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/constants.mjs +38 -0
  101. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-assets.mjs +113 -0
  102. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-capture.mjs +161 -0
  103. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-gate.mjs +327 -0
  104. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-image.mjs +136 -0
  105. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-init.js +43 -0
  106. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-sheet.mjs +69 -0
  107. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-treatment.mjs +102 -0
  108. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-worker.mjs +21 -0
  109. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover.mjs +352 -0
  110. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/driver.mjs +19 -1
  111. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/fonts.mjs +11 -0
  112. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/look.mjs +128 -2
  113. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/loop-kit.js +104 -0
  114. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/runtime.mjs +92 -18
  115. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage.mjs +2 -0
  116. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/treatment.mjs +3 -2
  117. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/webp.mjs +140 -0
  118. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/jetbrains-mono/JetBrainsMono-wght-latin.woff2 +0 -0
  119. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/jetbrains-mono/OFL.txt +93 -0
  120. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/card-scenes/expected.json +16 -0
  121. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/card-scenes/index.html +42 -0
  122. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/reset-sweep/expected.json +16 -0
  123. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/reset-sweep/index.html +27 -0
  124. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/still-glow/expected.json +17 -0
  125. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/still-glow/index.html +29 -0
  126. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/title-slam/expected.json +17 -0
  127. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/title-slam/index.html +44 -0
  128. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +67 -0
  129. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/orbit-loop/index.html +182 -0
  130. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/painted-light/expected.json +95 -0
  131. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/painted-light/index.html +231 -0
  132. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/weight-tide/expected.json +67 -0
  133. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/weight-tide/index.html +103 -0
  134. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/cover.md +389 -0
  135. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/quality-gate.md +4 -0
  136. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +7 -6
  137. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +3 -1
  138. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +2 -0
  139. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/render.mjs +37 -5
  140. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/runtime.mjs +1 -1
  141. package/marketplace/plugins/litcodex/skills/litgoal/SKILL.md +8 -3
  142. package/marketplace/plugins/litcodex/skills/lsp-setup/scripts/verify-lsp.ts +43 -7
  143. package/marketplace/plugins/litcodex/skills/review-work/SKILL.md +21 -4
  144. package/node_modules/@litcodex/lit-loop/CHANGELOG.md +7 -0
  145. package/node_modules/@litcodex/lit-loop/README.md +6 -0
  146. package/node_modules/@litcodex/lit-loop/directive.md +2 -1
  147. package/node_modules/@litcodex/lit-loop/directives/deep-interview.md +2 -0
  148. package/node_modules/@litcodex/lit-loop/directives/lit-brainstorm.md +216 -0
  149. package/node_modules/@litcodex/lit-loop/directives/litgoal.md +8 -1
  150. package/node_modules/@litcodex/lit-loop/directives/review-work.md +12 -4
  151. package/node_modules/@litcodex/lit-loop/dist/card-status.d.ts +8 -3
  152. package/node_modules/@litcodex/lit-loop/dist/card-status.js +11 -6
  153. package/node_modules/@litcodex/lit-loop/dist/codex-hook.d.ts +6 -1
  154. package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +16 -5
  155. package/node_modules/@litcodex/lit-loop/dist/guards.d.ts +3 -1
  156. package/node_modules/@litcodex/lit-loop/dist/guards.js +5 -2
  157. package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +2 -0
  158. package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +53 -17
  159. package/node_modules/@litcodex/lit-loop/dist/hud-cli.d.ts +38 -0
  160. package/node_modules/@litcodex/lit-loop/dist/hud-cli.js +155 -0
  161. package/node_modules/@litcodex/lit-loop/dist/hud.d.ts +42 -0
  162. package/node_modules/@litcodex/lit-loop/dist/hud.js +297 -0
  163. package/node_modules/@litcodex/lit-loop/dist/markers.d.ts +2 -0
  164. package/node_modules/@litcodex/lit-loop/dist/markers.js +2 -0
  165. package/node_modules/@litcodex/lit-loop/dist/modes.d.ts +1 -1
  166. package/node_modules/@litcodex/lit-loop/dist/modes.js +9 -1
  167. package/node_modules/@litcodex/lit-loop/dist/motion-route.js +2 -0
  168. package/node_modules/@litcodex/lit-loop/dist/plan-persistence.d.ts +2 -0
  169. package/node_modules/@litcodex/lit-loop/dist/plan-persistence.js +8 -0
  170. package/node_modules/@litcodex/lit-loop/dist/reentry.d.ts +56 -0
  171. package/node_modules/@litcodex/lit-loop/dist/reentry.js +171 -0
  172. package/node_modules/@litcodex/lit-loop/dist/route-context.js +5 -2
  173. package/node_modules/@litcodex/lit-loop/dist/route-heads.js +35 -15
  174. package/node_modules/@litcodex/lit-loop/dist/run-filter.d.ts +23 -0
  175. package/node_modules/@litcodex/lit-loop/dist/run-filter.js +142 -0
  176. package/node_modules/@litcodex/lit-loop/dist/run-panel.d.ts +29 -0
  177. package/node_modules/@litcodex/lit-loop/dist/run-panel.js +102 -0
  178. package/node_modules/@litcodex/lit-loop/dist/screen-card.d.ts +24 -0
  179. package/node_modules/@litcodex/lit-loop/dist/screen-card.js +104 -0
  180. package/node_modules/@litcodex/lit-loop/dist/screen-status.d.ts +24 -0
  181. package/node_modules/@litcodex/lit-loop/dist/screen-status.js +110 -0
  182. package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.js +2 -0
  183. package/node_modules/@litcodex/lit-loop/dist/statusline.d.ts +17 -0
  184. package/node_modules/@litcodex/lit-loop/dist/statusline.js +113 -0
  185. package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +2 -2
  186. package/node_modules/@litcodex/lit-loop/dist/trigger.js +15 -5
  187. package/node_modules/@litcodex/lit-loop/dist/workflow-map.d.ts +7 -0
  188. package/node_modules/@litcodex/lit-loop/dist/workflow-map.js +59 -10
  189. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  190. package/node_modules/@litcodex/lit-loop/skills/browser-drive/scripts/capability-probe.mjs +24 -4
  191. package/node_modules/@litcodex/lit-loop/skills/deep-interview/SKILL.md +3 -1
  192. package/node_modules/@litcodex/lit-loop/skills/lit-brainstorm/SKILL.md +271 -0
  193. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/SKILL.md +4 -0
  194. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/scripts/core.mjs +5 -1
  195. package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +10 -2
  196. package/node_modules/@litcodex/lit-loop/skills/litgoal/SKILL.md +8 -3
  197. package/node_modules/@litcodex/lit-loop/skills/review-work/SKILL.md +21 -4
  198. package/package.json +5 -2
  199. package/readme-assets/badge-version.svg +1 -1
  200. package/readme-assets/cover-motion-still.webp +0 -0
  201. package/readme-assets/cover-motion.webp +0 -0
  202. package/readme-assets/cover.webp +0 -0
  203. package/readme-assets/litfamily-machines.png +0 -0
  204. package/readme-assets/skills/lit-brainstorm.webp +0 -0
@@ -0,0 +1,110 @@
1
+ // src/screen-status.ts — the user-level switch for the LIT card's colour.
2
+ //
3
+ // Off by default. `litcodex screen-status on` colours the LIT card the hooks print, `off` keeps it plain and
4
+ // `status` reports the state. The choice lives in `$CODEX_HOME/litcodex/screen-status.json` (else
5
+ // `~/.codex`), written atomically and never through a symlink; `LITCODEX_SCREEN_STATUS=1|0` overrides it.
6
+ // Codex 0.162.0 and later draw ANSI colour inside hook text in the terminal UI, but the desktop app and IDE
7
+ // show the escape codes as raw text, and the hook input does not say which client is attached, hence the
8
+ // switch. NO_COLOR keeps the card plain either way; without colour the card has the same rows.
9
+ import { lstatSync } from "node:fs";
10
+ import { join } from "node:path";
11
+ import { writeSmallFile } from "./auto-handoff-settings.js";
12
+ import { codexHomeFrom, readSmallJson } from "./live-step.js";
13
+ export const SCREEN_STATUS_ENV = "LITCODEX_SCREEN_STATUS";
14
+ const SETTINGS_DIR = "litcodex";
15
+ const SETTINGS_FILE = "screen-status.json";
16
+ const MAX_SETTINGS_BYTES = 4_096;
17
+ const USAGE_EXIT_CODE = 64;
18
+ export const SCREEN_STATUS_HELP_TEXT = `litcodex screen-status on|off|status
19
+
20
+ Colour the LIT card the hooks print inside Codex. Off by default.
21
+ Only the terminal \`codex\` draws the colour:
22
+ the Codex desktop app and IDE extensions show the colour codes as raw text,
23
+ so turn it on only if you use the terminal \`codex\`. Without colour the card has the same rows.
24
+ The setting is stored in $CODEX_HOME/litcodex/screen-status.json; ${SCREEN_STATUS_ENV}=1 or 0 overrides it.
25
+ NO_COLOR keeps the card plain.
26
+ `;
27
+ function settingsPath(env) {
28
+ const home = codexHomeFrom(env);
29
+ return home === null ? null : { home, path: join(home, SETTINGS_DIR, SETTINGS_FILE) };
30
+ }
31
+ function isRecord(value) {
32
+ return typeof value === "object" && value !== null && !Array.isArray(value);
33
+ }
34
+ /** True when something sits at `path`, readable or not. */
35
+ function present(path) {
36
+ try {
37
+ return lstatSync(path, { throwIfNoEntry: false }) !== undefined;
38
+ }
39
+ catch {
40
+ return true;
41
+ }
42
+ }
43
+ /** The stored choice and the environment override; a missing, corrupt or linked file reads as off. */
44
+ export function readScreenStatus(env) {
45
+ const warnings = [];
46
+ const flag = env[SCREEN_STATUS_ENV]?.trim() ?? "";
47
+ if (flag === "1" || flag === "0")
48
+ return { enabled: flag === "1", source: "environment", warnings };
49
+ if (flag !== "")
50
+ warnings.push(`${SCREEN_STATUS_ENV} is not 1 or 0 and was ignored.`);
51
+ const settings = settingsPath(env);
52
+ if (settings === null)
53
+ return { enabled: false, source: "default", warnings };
54
+ const stored = readSmallJson(settings.path, MAX_SETTINGS_BYTES);
55
+ if (!isRecord(stored)) {
56
+ if (present(settings.path))
57
+ warnings.push(`${SETTINGS_DIR}/${SETTINGS_FILE} could not be read, so the card stays plain.`);
58
+ return { enabled: false, source: "default", warnings };
59
+ }
60
+ const enabled = stored["enabled"] === true;
61
+ return { enabled, source: enabled ? "command" : "default", warnings };
62
+ }
63
+ /** True when the hooks may colour the card: the switch is on and NO_COLOR is unset or empty. */
64
+ export function screenColor(env) {
65
+ const noColor = env["NO_COLOR"];
66
+ return readScreenStatus(env).enabled && (noColor === undefined || noColor === "");
67
+ }
68
+ export function writeScreenStatus(env, enabled) {
69
+ const settings = settingsPath(env);
70
+ if (settings === null)
71
+ return false;
72
+ return writeSmallFile(settings.path, `${JSON.stringify({ version: 1, enabled })}\n`, settings.home);
73
+ }
74
+ function describe(state, noColor) {
75
+ const origin = state.source === "environment" ? ` (set by ${SCREEN_STATUS_ENV})` : "";
76
+ const value = state.enabled ? (noColor ? "ON, but NO_COLOR keeps it plain" : "ON") : "OFF";
77
+ const lines = [`LIT card colour is ${value}${origin}.`];
78
+ for (const warning of state.warnings)
79
+ lines.push(`Warning: ${warning}`);
80
+ return `${lines.join("\n")}\n`;
81
+ }
82
+ /** `litcodex screen-status on|off|status`; resolves an exit code and never throws. */
83
+ export function screenStatusCommand(args, io) {
84
+ const [verb, ...extra] = args;
85
+ if (verb === "--help" || verb === "-h") {
86
+ io.stdout.write(SCREEN_STATUS_HELP_TEXT);
87
+ return 0;
88
+ }
89
+ if ((verb !== "on" && verb !== "off" && verb !== "status") || extra.length > 0) {
90
+ io.stderr.write("Usage: litcodex screen-status on|off|status\n");
91
+ return USAGE_EXIT_CODE;
92
+ }
93
+ if (verb === "status") {
94
+ const noColor = io.env["NO_COLOR"] !== undefined && io.env["NO_COLOR"] !== "";
95
+ io.stdout.write(describe(readScreenStatus(io.env), noColor));
96
+ return 0;
97
+ }
98
+ if (!writeScreenStatus(io.env, verb === "on")) {
99
+ io.stderr.write("litcodex screen-status: the setting could not be saved, so nothing changed.\n");
100
+ return 1;
101
+ }
102
+ const overridden = readScreenStatus(io.env).source === "environment"
103
+ ? ` ${SCREEN_STATUS_ENV} is set in the environment and takes priority over this setting.`
104
+ : "";
105
+ const note = verb === "on"
106
+ ? " The Codex desktop app and IDE show colour codes as raw text; use it with the terminal `codex`."
107
+ : "";
108
+ io.stdout.write(`LIT card colour is ${verb === "on" ? "ON" : "OFF"}.${note}${overridden}\n`);
109
+ return 0;
110
+ }
@@ -53,6 +53,8 @@ function tokenForSkillName(skillName) {
53
53
  return "lit-recap";
54
54
  case "lit-comprehend":
55
55
  return "lit-comprehend";
56
+ case "lit-brainstorm":
57
+ return "lit-brainstorm";
56
58
  case "lit-crucible":
57
59
  return "lit-crucible";
58
60
  case "lit-init":
@@ -0,0 +1,17 @@
1
+ import { type CardStatus } from "./card-status.js";
2
+ export interface StatuslineIo {
3
+ readonly stdin: NodeJS.ReadableStream & {
4
+ readonly isTTY?: boolean;
5
+ };
6
+ readonly stdout: {
7
+ write(text: string): unknown;
8
+ };
9
+ readonly env: NodeJS.ProcessEnv;
10
+ readonly now?: () => number;
11
+ }
12
+ /** The one line, coloured on request and cut to `width` cells; "" when there is no LIT turn to show. */
13
+ export declare function statuslineText(status: CardStatus | null, options: {
14
+ width: number;
15
+ color: boolean;
16
+ }): string;
17
+ export declare function statuslineCommand(_args: readonly string[], io: StatuslineIo): Promise<number>;
@@ -0,0 +1,113 @@
1
+ // src/statusline.ts — `litcodex statusline`: the LIT status as one line, for a host status line command.
2
+ //
3
+ // Codex 0.163.0 has no command-backed status line yet; this prints the line such a command would show, in
4
+ // the shape Claude-compatible status line hosts use: optional JSON on stdin naming `session_id` and `cwd`
5
+ // (or `workspace.current_dir`), one line on stdout, the width from `COLUMNS`. It picks that session's LIT
6
+ // records, else the newest LIT session in the same folder, else the newest LIT session, the way
7
+ // `litcodex hud` does (hud.ts), and reads the same card (card-status.ts) without opening a Codex rollout.
8
+ // Stdin is capped at 64 KiB and read for at most 200 ms. Nothing is written but the line; any problem
9
+ // prints an empty line, and the exit code is always 0.
10
+ import { clock } from "./card-status.js";
11
+ import { cleanStatus, fit, listSessions, readHud } from "./hud.js";
12
+ import { stageText } from "./screen-card.js";
13
+ const MAX_STDIN_BYTES = 64 * 1024;
14
+ const STDIN_BUDGET_MS = 200;
15
+ const DEFAULT_WIDTH = 120;
16
+ const ACCENT = "\u001b[38;2;255;155;94m";
17
+ const BOLD = "\u001b[1m";
18
+ const DIM = "\u001b[2m";
19
+ const RESET = "\u001b[0m";
20
+ const NO_INPUT = { sessionId: null, cwd: null };
21
+ /** Whatever arrives within the budget and the cap; null when the cap is passed. */
22
+ function readInput(stdin) {
23
+ if (stdin.isTTY === true)
24
+ return Promise.resolve("");
25
+ return new Promise((resolve) => {
26
+ const chunks = [];
27
+ let total = 0;
28
+ let settled = false;
29
+ const finish = (value) => {
30
+ if (settled)
31
+ return;
32
+ settled = true;
33
+ clearTimeout(timer);
34
+ stdin.removeListener("data", onData);
35
+ stdin.pause();
36
+ resolve(value);
37
+ };
38
+ const onData = (chunk) => {
39
+ const buffer = typeof chunk === "string" ? Buffer.from(chunk) : chunk;
40
+ total += buffer.length;
41
+ if (total > MAX_STDIN_BYTES)
42
+ finish(null);
43
+ else
44
+ chunks.push(buffer);
45
+ };
46
+ const timer = setTimeout(() => finish(Buffer.concat(chunks).toString("utf8")), STDIN_BUDGET_MS);
47
+ stdin.on("data", onData);
48
+ stdin.once("end", () => finish(Buffer.concat(chunks).toString("utf8")));
49
+ stdin.once("error", () => finish(null));
50
+ });
51
+ }
52
+ function parseInput(raw) {
53
+ if (raw === null || raw.trim() === "")
54
+ return NO_INPUT;
55
+ try {
56
+ const value = JSON.parse(raw);
57
+ if (typeof value !== "object" || value === null || Array.isArray(value))
58
+ return NO_INPUT;
59
+ const record = value;
60
+ const workspace = record["workspace"];
61
+ const current = typeof workspace === "object" && workspace !== null
62
+ ? workspace["current_dir"]
63
+ : undefined;
64
+ const cwd = typeof current === "string" ? current : typeof record["cwd"] === "string" ? record["cwd"] : null;
65
+ const sessionId = typeof record["session_id"] === "string" ? record["session_id"] : null;
66
+ return { sessionId: sessionId === "" ? null : sessionId, cwd: cwd === "" ? null : cwd };
67
+ }
68
+ catch {
69
+ return NO_INPUT;
70
+ }
71
+ }
72
+ /** The session the line is about: the named one when LIT knows it, else the newest one in `cwd`, else null (newest). */
73
+ function wantedSession(env, input) {
74
+ const sessions = listSessions(env);
75
+ if (input.sessionId !== null && sessions.some((session) => session.id === input.sessionId))
76
+ return input.sessionId;
77
+ return sessions.find((session) => input.cwd !== null && session.cwd === input.cwd)?.id ?? null;
78
+ }
79
+ /** The one line, coloured on request and cut to `width` cells; "" when there is no LIT turn to show. */
80
+ export function statuslineText(status, options) {
81
+ if (status === null || status.state === "ready")
82
+ return "";
83
+ const card = cleanStatus(status);
84
+ const route = `🔥 LIT · ${card.mode ?? "lit"}${card.state === "complete" ? " ✓" : ""}`;
85
+ const parts = [card.map === null ? null : card.map.cells.map(stageText).join(" › ")];
86
+ if (card.step !== null)
87
+ parts.push(`⠹ ${card.step.tool} ${clock(card.now - card.step.startedAt)}`);
88
+ const rest = parts.filter((part) => part !== null && part !== "").join(" ");
89
+ const line = fit(rest === "" ? route : `${route} ${rest}`, Math.max(10, options.width));
90
+ if (!options.color)
91
+ return line;
92
+ return line.startsWith(route)
93
+ ? `${BOLD}${ACCENT}${route}${RESET}${DIM}${line.slice(route.length)}${RESET}`
94
+ : `${BOLD}${ACCENT}${line}${RESET}`;
95
+ }
96
+ export async function statuslineCommand(_args, io) {
97
+ try {
98
+ const input = parseInput(await readInput(io.stdin));
99
+ const now = (io.now ?? Date.now)();
100
+ const view = readHud(io.env, wantedSession(io.env, input), now);
101
+ const columns = Number.parseInt(io.env["COLUMNS"] ?? "", 10);
102
+ const noColor = io.env["NO_COLOR"];
103
+ const line = statuslineText(view.status, {
104
+ width: Number.isFinite(columns) && columns > 0 ? columns : DEFAULT_WIDTH,
105
+ color: noColor === undefined || noColor === "",
106
+ });
107
+ io.stdout.write(`${line}\n`);
108
+ }
109
+ catch {
110
+ io.stdout.write("\n");
111
+ }
112
+ return 0;
113
+ }
@@ -1,5 +1,5 @@
1
1
  /** The accepted bounded lit-family tokens, longest-first (ordering is load-bearing — see below). */
2
- export type LitTriggerToken = "lit-comprehend" | "deep-interview" | "lit-crucible" | "lit-init" | "start-work" | "review-work" | "litresearch" | "lit-recap" | "lit-loop" | "lit-plan" | "litcodex" | "litgoal" | "litwork" | "lit";
2
+ export type LitTriggerToken = "lit-comprehend" | "lit-brainstorm" | "deep-interview" | "lit-crucible" | "lit-init" | "start-work" | "review-work" | "litresearch" | "lit-recap" | "lit-loop" | "lit-plan" | "litcodex" | "litgoal" | "litwork" | "lit";
3
3
  /**
4
4
  * Frozen tuple of the accepted tokens in match-priority (longest-first) order.
5
5
  * Exported so tests and the mode router (modes.ts) can enumerate without re-deriving.
@@ -15,7 +15,7 @@ export declare const LIT_TRIGGER_TOKENS: readonly LitTriggerToken[];
15
15
  *
16
16
  * MUST NOT carry the /g or /y flag: a global regex retains `lastIndex` between calls and would
17
17
  * make `.test()` return alternating results for the same input. Longest-first alternation
18
- * (`lit-comprehend|lit-crucible|lit-init|hyperplan|init-deep|start-work|review-work|litresearch|comprehend|lit-recap|lit-loop|lit-plan|litcodex|litrecap|litgoal|litwork|recap|리캡|lit`)
18
+ * (`lit-comprehend|lit-brainstorm|lit-crucible|lit-init|hyperplan|init-deep|start-work|review-work|litresearch|comprehend|lit-recap|lit-loop|lit-plan|litcodex|litrecap|litgoal|litwork|recap|리캡|lit`)
19
19
  * guarantees a longer family token wins over a bare `lit` at the same start; the trailing-`-`
20
20
  * lookahead means `lit work` (space) is a bare `lit` while `litwork` (glued) is the work mode.
21
21
  * The `litrecap` / `recap` / `리캡` alternatives are ROUTING ALIASES normalized to the canonical
@@ -6,7 +6,9 @@
6
6
  // Explicit leading `start-work ...` routes execute with the installed skill body, while ordinary
7
7
  // discussion stays inert and scoped mentions such as `$litcodex:start-work ...` stay native.
8
8
  // Recap aliases (`litrecap` / `recap` / `리캡`) normalize to the single `lit-recap` token.
9
- // The bare `comprehend` alias normalizes to the `lit-comprehend` token. Rejects
9
+ // The bare `comprehend` alias normalizes to the `lit-comprehend` token. `lit` followed by an ideation
10
+ // word (brainstorm, brainstorming, ideation, ideate, idea, ideas) routes to `lit-brainstorm`; those words
11
+ // never route without the `lit` in front. Rejects
10
12
  // every substring collision (`split`, `literal`, `litmus`, `lithium`, `glitter`, `flit`, `slit`,
11
13
  // `litter`, `recapture`, …) while respecting Korean (Hangul) and English boundaries.
12
14
  //
@@ -22,6 +24,7 @@ import { renamedSkillId } from "./skill-renames.js";
22
24
  */
23
25
  export const LIT_TRIGGER_TOKENS = Object.freeze([
24
26
  "lit-comprehend",
27
+ "lit-brainstorm",
25
28
  "deep-interview",
26
29
  "lit-crucible",
27
30
  "lit-init",
@@ -46,7 +49,7 @@ export const LIT_TRIGGER_TOKENS = Object.freeze([
46
49
  *
47
50
  * MUST NOT carry the /g or /y flag: a global regex retains `lastIndex` between calls and would
48
51
  * make `.test()` return alternating results for the same input. Longest-first alternation
49
- * (`lit-comprehend|lit-crucible|lit-init|hyperplan|init-deep|start-work|review-work|litresearch|comprehend|lit-recap|lit-loop|lit-plan|litcodex|litrecap|litgoal|litwork|recap|리캡|lit`)
52
+ * (`lit-comprehend|lit-brainstorm|lit-crucible|lit-init|hyperplan|init-deep|start-work|review-work|litresearch|comprehend|lit-recap|lit-loop|lit-plan|litcodex|litrecap|litgoal|litwork|recap|리캡|lit`)
50
53
  * guarantees a longer family token wins over a bare `lit` at the same start; the trailing-`-`
51
54
  * lookahead means `lit work` (space) is a bare `lit` while `litwork` (glued) is the work mode.
52
55
  * The `litrecap` / `recap` / `리캡` alternatives are ROUTING ALIASES normalized to the canonical
@@ -54,7 +57,7 @@ export const LIT_TRIGGER_TOKENS = Object.freeze([
54
57
  * (they are not members of the token union).
55
58
  * No nested quantifiers / no backreferences ⇒ ReDoS-free.
56
59
  */
57
- export const LIT_TRIGGER_PATTERN = /(?:^|[^\p{L}\p{N}_])(lit-comprehend|deep-interview|lit-crucible|lit-init|hyperplan|init-deep|start-work|review-work|litresearch|comprehend|lit-recap|lit-loop|lit-plan|litcodex|litrecap|litgoal|litwork|recap|리캡|lit)(?![\p{L}\p{N}_-])/iu;
60
+ export const LIT_TRIGGER_PATTERN = /(?:^|[^\p{L}\p{N}_])(lit-comprehend|lit-brainstorm|deep-interview|lit-crucible|lit-init|hyperplan|init-deep|start-work|review-work|litresearch|comprehend|lit-recap|lit-loop|lit-plan|litcodex|litrecap|litgoal|litwork|recap|리캡|lit)(?![\p{L}\p{N}_-])/iu;
58
61
  const NOT_A_STRING = "lit trigger: prompt must be a string";
59
62
  /**
60
63
  * Returns true iff `prompt` contains at least one bounded lit trigger.
@@ -87,7 +90,7 @@ export function matchLitTrigger(prompt) {
87
90
  return { token: "start-work", raw: explicitStartWork, index: 0 };
88
91
  }
89
92
  const searchable = maskMarkdownCode(prompt);
90
- const scan = /(?:^|[^\p{L}\p{N}_])(lit-comprehend|deep-interview|lit-crucible|lit-init|hyperplan|init-deep|start-work|review-work|litresearch|comprehend|lit-recap|lit-loop|lit-plan|litcodex|litrecap|litgoal|litwork|recap|리캡|lit)(?![\p{L}\p{N}_-])/giu;
93
+ const scan = /(?:^|[^\p{L}\p{N}_])(lit-comprehend|lit-brainstorm|deep-interview|lit-crucible|lit-init|hyperplan|init-deep|start-work|review-work|litresearch|comprehend|lit-recap|lit-loop|lit-plan|litcodex|litrecap|litgoal|litwork|recap|리캡|lit)(?![\p{L}\p{N}_-])/giu;
91
94
  for (const m of searchable.matchAll(scan)) {
92
95
  const raw = m[1];
93
96
  if (raw === undefined) {
@@ -172,7 +175,7 @@ function explicitStartWorkPrefix(prompt) {
172
175
  function naturalPhraseAfterLit(prompt, searchable, index, rawLength) {
173
176
  const start = index + rawLength;
174
177
  const rest = searchable.slice(start);
175
- const m = /^(\s+)(start\s+work|deep\s+interview|lit-crucible|lit-init|hyperplan|init-deep|comprehend|plan|review|research|goal|recap)(?![\p{L}\p{N}_-])/iu.exec(rest);
178
+ const m = /^(\s+)(start\s+work|deep\s+interview|lit-brainstorm|lit-crucible|lit-init|hyperplan|init-deep|comprehend|brainstorming|brainstorm|ideation|ideate|ideas?|plan|review|research|goal|recap)(?![\p{L}\p{N}_-])/iu.exec(rest);
176
179
  if (m === null || m[1] === undefined || m[2] === undefined) {
177
180
  return null;
178
181
  }
@@ -180,11 +183,18 @@ function naturalPhraseAfterLit(prompt, searchable, index, rawLength) {
180
183
  const tokenByPhrase = {
181
184
  "start work": "start-work",
182
185
  "deep interview": "deep-interview",
186
+ "lit-brainstorm": "lit-brainstorm",
183
187
  "lit-crucible": "lit-crucible",
184
188
  hyperplan: "lit-crucible",
185
189
  "lit-init": "lit-init",
186
190
  "init-deep": "lit-init",
187
191
  comprehend: "lit-comprehend",
192
+ brainstorming: "lit-brainstorm",
193
+ brainstorm: "lit-brainstorm",
194
+ ideation: "lit-brainstorm",
195
+ ideate: "lit-brainstorm",
196
+ idea: "lit-brainstorm",
197
+ ideas: "lit-brainstorm",
188
198
  plan: "lit-plan",
189
199
  review: "review-work",
190
200
  research: "litresearch",
@@ -34,6 +34,13 @@ export declare function progressBar(done: number, total: number): string;
34
34
  * with fewer than three words left before the cut is dropped.
35
35
  */
36
36
  export declare function safeTitle(label: string): string | null;
37
+ /** One row of the card's checklist: a plan task or a lit-loop goal. */
38
+ export interface ChecklistRow {
39
+ readonly state: "done" | "current" | "pending";
40
+ readonly label: string;
41
+ }
42
+ /** The checklist under the map: the start-work plan rows, else this session's lit-loop goals; [] when neither. */
43
+ export declare function readChecklist(repoRoot: string, sessionId: string | null): ChecklistRow[];
37
44
  export declare function readWorkflowSignals(repoRoot: string, sessionId: string | null, now?: number): WorkflowSignals;
38
45
  /** One stage of the map, as the text line and the LIT card both draw it. */
39
46
  export interface MapCell {
@@ -1,9 +1,11 @@
1
- // src/workflow-map.ts — the plain-text LIT workflow map.
1
+ // src/workflow-map.ts — the LIT workflow map and the checklist under it.
2
2
  //
3
- // Codex shows a hook `systemMessage` as plain text (escape codes appear literally), so the map uses
4
- // emoji and block cells instead of colour. It is built from saved state only: the start-work record
5
- // and its plan checkboxes, lit-loop goals, the lit-plan activation record and the litresearch
6
- // journal. A stage with no saved signal is left out rather than guessed. Every read fails open.
3
+ // The map is plain text: emoji and block cells. Codex 0.162.0 and later draw ANSI colour inside a hook
4
+ // `systemMessage` in the terminal UI, but other clients may show escape codes literally, so colour is
5
+ // added only by the card (screen-card.ts) and only when the user turns it on. Everything here is built
6
+ // from saved state only: the start-work record and its plan checkboxes, lit-loop goals, the lit-plan
7
+ // activation record and the litresearch journal. A stage with no saved signal is left out rather than
8
+ // guessed. Every read fails open.
7
9
  import { createHash } from "node:crypto";
8
10
  import { lstatSync, mkdirSync, readdirSync, readFileSync, statSync } from "node:fs";
9
11
  import { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
@@ -19,6 +21,7 @@ const STAGES = [
19
21
  /** Where each LIT skill sits in the main chain; `research` is its own short family. */
20
22
  const MODE_STAGE = {
21
23
  "deep-interview": "interview",
24
+ "lit-brainstorm": "interview",
22
25
  "lit-crucible": "interview",
23
26
  "lit-plan": "plan",
24
27
  litgoal: "plan",
@@ -172,7 +175,8 @@ export function safeTitle(label) {
172
175
  return `${title.slice(0, MAX_TITLE - 1)}…`;
173
176
  return cut < 0 ? title : `${title} …`;
174
177
  }
175
- function readWork(repoRoot, sessionId) {
178
+ /** The start-work plan this session shows, with its status and text; null when there is none. */
179
+ function activeWorkPlan(repoRoot, sessionId) {
176
180
  const state = readJson(repoRoot, join(repoRoot, ".litcodex/start-work/state.json"));
177
181
  if (!isRecord(state) || !isRecord(state["works"]))
178
182
  return null;
@@ -198,17 +202,28 @@ function readWork(repoRoot, sessionId) {
198
202
  const text = readText(repoRoot, join(repoRoot, ".litcodex/plans", file));
199
203
  if (text === null)
200
204
  return null;
201
- const rows = countPlanRows(text);
205
+ return { status: work["status"], text };
206
+ }
207
+ function readWork(repoRoot, sessionId) {
208
+ const plan = activeWorkPlan(repoRoot, sessionId);
209
+ if (plan === null)
210
+ return null;
211
+ const rows = countPlanRows(plan.text);
202
212
  if (rows.total === 0)
203
213
  return null;
204
- return { ...rows, status: work["status"] };
214
+ return { ...rows, status: plan.status };
205
215
  }
206
- function goalProgress(repoRoot, path) {
216
+ /** The goal records of one lit-loop goals file; null when it has none. */
217
+ function goalList(repoRoot, path) {
207
218
  const plan = readJson(repoRoot, path);
208
219
  if (!isRecord(plan) || !Array.isArray(plan["goals"]))
209
220
  return null;
210
221
  const goals = plan["goals"].filter(isRecord);
211
- if (goals.length === 0)
222
+ return goals.length === 0 ? null : goals;
223
+ }
224
+ function goalProgress(repoRoot, path) {
225
+ const goals = goalList(repoRoot, path);
226
+ if (goals === null)
212
227
  return null;
213
228
  const open = goals.find((goal) => goal["status"] === "in_progress") ?? goals.find((goal) => goal["status"] === "pending");
214
229
  return {
@@ -226,6 +241,40 @@ function readGoals(repoRoot, sessionId) {
226
241
  const shared = goalProgress(repoRoot, join(repoRoot, LIT_LOOP_DIR, LIT_LOOP_GOALS));
227
242
  return shared !== null && shared.done < shared.total ? shared : null;
228
243
  }
244
+ const MAX_CHECKLIST = 3;
245
+ /**
246
+ * At most three rows around the open one: the last finished row, the open row and the next one. With
247
+ * nothing open, the last three finished rows. A label cut down to nothing by `safeTitle` reads `#<n>`.
248
+ */
249
+ function checklistWindow(items, current) {
250
+ const start = current < 0
251
+ ? Math.max(0, items.length - MAX_CHECKLIST)
252
+ : Math.max(0, Math.min(current - 1, items.length - MAX_CHECKLIST));
253
+ return items.slice(start, start + MAX_CHECKLIST).map((item, offset) => ({
254
+ state: start + offset === current ? "current" : item.done ? "done" : "pending",
255
+ label: safeTitle(item.label) ?? `#${start + offset + 1}`,
256
+ }));
257
+ }
258
+ /** The checklist under the map: the start-work plan rows, else this session's lit-loop goals; [] when neither. */
259
+ export function readChecklist(repoRoot, sessionId) {
260
+ if (typeof repoRoot !== "string" || !isAbsolute(repoRoot))
261
+ return [];
262
+ const id = normalizeSessionId(sessionId);
263
+ const plan = activeWorkPlan(repoRoot, id);
264
+ const rows = plan === null ? [] : planRows(plan.text);
265
+ if (rows.length > 0)
266
+ return checklistWindow(rows, rows.findIndex((row) => !row.done));
267
+ const scoped = id === null ? null : goalList(repoRoot, join(repoRoot, LIT_LOOP_DIR, id, LIT_LOOP_GOALS));
268
+ const goals = scoped ?? goalList(repoRoot, join(repoRoot, LIT_LOOP_DIR, LIT_LOOP_GOALS));
269
+ if (goals === null)
270
+ return [];
271
+ const items = goals.map((goal) => ({
272
+ done: goal["status"] === "complete",
273
+ label: typeof goal["title"] === "string" ? goal["title"] : "",
274
+ }));
275
+ const running = goals.findIndex((goal) => goal["status"] === "in_progress");
276
+ return checklistWindow(items, running >= 0 ? running : items.findIndex((item) => !item.done));
277
+ }
229
278
  function readPlanRecord(repoRoot, sessionId) {
230
279
  if (sessionId === null)
231
280
  return null;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litcodex/lit-loop",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "LitCodex Lit-Loop runtime: durable repo-native multi-goal orchestration with embedded success criteria and observable evidence audit.",
5
5
  "type": "module",
6
6
  "private": true,
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawnSync } from "node:child_process";
4
- import { accessSync, constants, statSync } from "node:fs";
5
- import { delimiter, join } from "node:path";
4
+ import { accessSync, constants, readFileSync, statSync } from "node:fs";
5
+ import { delimiter, join, win32 } from "node:path";
6
6
  import process from "node:process";
7
7
 
8
8
  export const DRIVER_COMMAND = "agent-browser";
@@ -246,11 +246,27 @@ function decodeSupervisorOutput(value) {
246
246
  }
247
247
  }
248
248
 
249
+ /**
250
+ * The shell-free way to run a resolved driver path. Node refuses to spawn a .cmd/.bat shim without a
251
+ * shell (CVE-2024-27980), so on Windows the npm shim is unwrapped to the script or binary it launches;
252
+ * a .cmd that is not an npm shim is refused, so no argument ever passes through cmd.exe.
253
+ */
254
+ export function shellFreeInvocation(command, args, platform = process.platform, read = (file) => readFileSync(file, "utf8")) {
255
+ if (platform !== "win32" || !/\.(?:cmd|bat)$/iu.test(command)) return { command, args };
256
+ const target = [...read(command).matchAll(/"%~?dp0%?\\([^"\r\n]+)"\s+%\*/gu)].at(-1)?.[1];
257
+ if (!target) return null;
258
+ const resolved = win32.join(win32.dirname(command), target);
259
+ if (hasRawPathControl(resolved) || containsCredentialShape(resolved)) return null;
260
+ return /\.[cm]?js$/iu.test(resolved) ? { command: process.execPath, args: [resolved, ...args] } : { command: resolved, args };
261
+ }
262
+
249
263
  function runVersionCommand(command, args, environment, timeoutMs) {
250
264
  try {
265
+ const invocation = shellFreeInvocation(command, args);
266
+ if (invocation === null) return null;
251
267
  const result = spawnSync(
252
268
  process.execPath,
253
- ["--input-type=module", "-e", POSIX_SUPERVISOR, command, JSON.stringify(args), String(timeoutMs), String(VERSION_OUTPUT_LIMIT_BYTES)],
269
+ ["--input-type=module", "-e", POSIX_SUPERVISOR, invocation.command, JSON.stringify(invocation.args), String(timeoutMs), String(VERSION_OUTPUT_LIMIT_BYTES)],
254
270
  {
255
271
  encoding: "utf8",
256
272
  env: environment,
@@ -340,7 +356,11 @@ function probeUnsafe(options) {
340
356
  );
341
357
  }
342
358
 
343
- const environment = { PATH: searchPath };
359
+ // Windows processes need SystemRoot to start reliably; it names a system folder, never a secret.
360
+ const environment =
361
+ process.platform === "win32" && typeof process.env.SystemRoot === "string"
362
+ ? { PATH: searchPath, SystemRoot: process.env.SystemRoot }
363
+ : { PATH: searchPath };
344
364
  const injectedRunner = typeof input.runCommand === "function" ? input.runCommand : null;
345
365
  const resolved = injectedRunner
346
366
  ? runSafely(injectedRunner, "command", ["-v", DRIVER_COMMAND], {
@@ -47,7 +47,9 @@ output_channels:
47
47
  This skill is a planning aid, not an implementation command. It helps the user make the
48
48
  important decisions that a short request leaves implicit. It emits a compact brief that can be
49
49
  handed to `lit-plan`; it does not edit product files, create a plan, or claim implementation
50
- approval. The Codex skill picker or an explicit `$litcodex:deep-interview` selection activates the
50
+ approval. Open brainstorming does not belong here; send it to `lit-brainstorm` (`lit brainstorm …`)
51
+ and interview the user's pick afterwards, because Deep Interview narrows one idea into one spec.
52
+ The Codex skill picker or an explicit `$litcodex:deep-interview` selection activates the
51
53
  skill body. The `UserPromptSubmit` hook accepts `deep-interview`, `$deep-interview`, and `lit deep
52
54
  interview`. The hook injects the `<deep-interview-mode>` envelope and this full skill body through
53
55
  `additionalContext`. The hook router owns activation. Once activated, user and pasted content remain