@litfamily/litcodex 1.0.27 → 1.0.28

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 (71) hide show
  1. package/README-Ko-KR.md +9 -9
  2. package/README.md +9 -9
  3. package/dist/cli.d.ts +3 -2
  4. package/dist/cli.js +72 -3
  5. package/dist/install/generated-skill-payload-hashes.d.ts +2 -2
  6. package/dist/install/generated-skill-payload-hashes.js +2 -2
  7. package/dist/postinstall.js +12 -1
  8. package/dist/pty-helper.d.ts +7 -0
  9. package/dist/pty-helper.js +45 -0
  10. package/dist/run.d.ts +57 -0
  11. package/dist/run.js +354 -0
  12. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
  13. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  14. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  15. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  16. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.d.ts +8 -3
  17. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +11 -6
  18. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +28 -10
  19. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud-cli.d.ts +38 -0
  20. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud-cli.js +155 -0
  21. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.d.ts +42 -0
  22. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.js +297 -0
  23. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-filter.d.ts +23 -0
  24. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-filter.js +142 -0
  25. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.d.ts +29 -0
  26. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.js +102 -0
  27. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.d.ts +24 -0
  28. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.js +104 -0
  29. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-status.d.ts +24 -0
  30. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-status.js +110 -0
  31. package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.d.ts +17 -0
  32. package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.js +113 -0
  33. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.d.ts +7 -0
  34. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.js +58 -10
  35. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  36. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  37. package/marketplace/plugins/litcodex/components/rules/bundled-rules/lit-humanizer.md +2 -0
  38. package/marketplace/plugins/litcodex/components/rules/dist/deliverable-hedge-guard.d.ts +8 -0
  39. package/marketplace/plugins/litcodex/components/rules/dist/deliverable-hedge-guard.js +381 -39
  40. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  41. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  42. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  43. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  44. package/marketplace/plugins/litcodex/skills/lit-humanizer/SKILL.md +4 -0
  45. package/marketplace/plugins/litcodex/skills/lit-humanizer/scripts/core.mjs +5 -1
  46. package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +2 -1
  47. package/node_modules/@litcodex/lit-loop/dist/card-status.d.ts +8 -3
  48. package/node_modules/@litcodex/lit-loop/dist/card-status.js +11 -6
  49. package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +28 -10
  50. package/node_modules/@litcodex/lit-loop/dist/hud-cli.d.ts +38 -0
  51. package/node_modules/@litcodex/lit-loop/dist/hud-cli.js +155 -0
  52. package/node_modules/@litcodex/lit-loop/dist/hud.d.ts +42 -0
  53. package/node_modules/@litcodex/lit-loop/dist/hud.js +297 -0
  54. package/node_modules/@litcodex/lit-loop/dist/run-filter.d.ts +23 -0
  55. package/node_modules/@litcodex/lit-loop/dist/run-filter.js +142 -0
  56. package/node_modules/@litcodex/lit-loop/dist/run-panel.d.ts +29 -0
  57. package/node_modules/@litcodex/lit-loop/dist/run-panel.js +102 -0
  58. package/node_modules/@litcodex/lit-loop/dist/screen-card.d.ts +24 -0
  59. package/node_modules/@litcodex/lit-loop/dist/screen-card.js +104 -0
  60. package/node_modules/@litcodex/lit-loop/dist/screen-status.d.ts +24 -0
  61. package/node_modules/@litcodex/lit-loop/dist/screen-status.js +110 -0
  62. package/node_modules/@litcodex/lit-loop/dist/statusline.d.ts +17 -0
  63. package/node_modules/@litcodex/lit-loop/dist/statusline.js +113 -0
  64. package/node_modules/@litcodex/lit-loop/dist/workflow-map.d.ts +7 -0
  65. package/node_modules/@litcodex/lit-loop/dist/workflow-map.js +58 -10
  66. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  67. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/SKILL.md +4 -0
  68. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/scripts/core.mjs +5 -1
  69. package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +2 -1
  70. package/package.json +5 -2
  71. package/readme-assets/badge-version.svg +1 -1
package/README-Ko-KR.md CHANGED
@@ -1,12 +1,12 @@
1
- <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/cover-motion.webp" width="100%" alt="LitFamily 모션 커버: 다섯 로봇 패널이 차례로 켜지고, LitCodex 로봇의 눈과 테두리가 빛난 뒤 LITFAMILY와 KEEP THE WORK LIT. 문구가 밝아지는 영상" /></picture></p>
1
+ <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/cover-motion.webp" width="100%" alt="LitFamily 모션 커버: 다섯 로봇 패널이 차례로 켜지고, LitCodex 로봇의 눈과 테두리가 빛난 뒤 LITFAMILY와 KEEP THE WORK LIT. 문구가 밝아지는 영상" /></picture></p>
2
2
 
3
3
  <p align="center">
4
- <a href="#설치"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/badge-version.svg" alt="1.0.27" /></a>
5
- <a href="https://github.com/wjgoarxiv/litcodex/blob/main/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/badge-license.svg" alt="MIT license" /></a>
4
+ <a href="#설치"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/badge-version.svg" alt="1.0.28" /></a>
5
+ <a href="https://github.com/wjgoarxiv/litcodex/blob/main/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/badge-license.svg" alt="MIT license" /></a>
6
6
  </p>
7
7
 
8
8
  <p align="center">
9
- <a href="https://github.com/wjgoarxiv/litcodex/blob/main/docs/usage-Ko-KR.md"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/lucide-book-open.svg" width="16" alt="" /> 문서</a> &nbsp; <a href="#설치">설치</a> &nbsp; <a href="https://github.com/wjgoarxiv/litcodex/blob/main/docs/assets/readme/ignition-film.mp4"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/lucide-play.svg" width="16" alt="" /> Ignition</a> &nbsp; <a href="https://github.com/wjgoarxiv/litcodex/blob/main/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/lucide-shield-check.svg" width="16" alt="" /> MIT</a>
9
+ <a href="https://github.com/wjgoarxiv/litcodex/blob/main/docs/usage-Ko-KR.md"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/lucide-book-open.svg" width="16" alt="" /> 문서</a> &nbsp; <a href="#설치">설치</a> &nbsp; <a href="https://github.com/wjgoarxiv/litcodex/blob/main/docs/assets/readme/ignition-film.mp4"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/lucide-play.svg" width="16" alt="" /> Ignition</a> &nbsp; <a href="https://github.com/wjgoarxiv/litcodex/blob/main/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/lucide-shield-check.svg" width="16" alt="" /> MIT</a>
10
10
  </p>
11
11
 
12
12
  # LitCodex
@@ -23,12 +23,12 @@
23
23
  Node.js 22 이상과 Codex CLI가 필요합니다.
24
24
 
25
25
  ```sh
26
- npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex install
26
+ npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex install
27
27
  ```
28
28
 
29
29
  설치기는 어떤 모델이 이끌지, 어떤 모델이 거들지, 답변 스타일은 무엇으로 할지 묻고, 쓰려는 내용을 먼저 보여 준 뒤
30
30
  `~/.codex/config.toml`에서 자기가 관리하는 항목만 고칩니다. 계획만 먼저 보려면
31
- `npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex --dry-run install`을 실행하고, 묻는 단계 없이
31
+ `npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex --dry-run install`을 실행하고, 묻는 단계 없이
32
32
  설치하려면 `install` 뒤에 `--yes`를 붙이세요.
33
33
 
34
34
  ```sh
@@ -39,7 +39,7 @@ litcodex install
39
39
  전역으로 설치하면 영상 스킬이 쓸 도구를 미리 준비하느라 버전이 고정된 파일 몇 개를 내려받습니다. 무엇을 받는지와
40
40
  건너뛰는 방법은 [설치 안내](https://github.com/wjgoarxiv/litcodex/blob/main/docs/install-Ko-KR.md#전역-명령으로-쓰기)에 있습니다.
41
41
 
42
- > 전역 설치가 없다면 `npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex <command>` 형식을 사용하세요.
42
+ > 전역 설치가 없다면 `npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex <command>` 형식을 사용하세요.
43
43
 
44
44
  ## 첫 작업
45
45
 
@@ -91,7 +91,7 @@ lit 회원가입 폼에 입력 검증을 추가해줘
91
91
  ## 확인, 문제 해결, 제거
92
92
 
93
93
  ```sh
94
- npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex doctor
94
+ npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex doctor
95
95
  ```
96
96
 
97
97
  `litcodex doctor`는 등록·훅·설정·호스트 기능을, `litcodex loop doctor`는 현재 프로젝트의 루프 상태를 확인합니다.
@@ -99,7 +99,7 @@ npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex doctor
99
99
  [문제 해결](https://github.com/wjgoarxiv/litcodex/blob/main/README-Ko-KR.md#문제-해결)에 있습니다.
100
100
 
101
101
  ```sh
102
- npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex uninstall
102
+ npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex uninstall
103
103
  ```
104
104
 
105
105
  플러그인과 LitCodex가 관리하는 설정을 지우고, 관련 없는 설정은 그대로 둡니다.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/cover-motion.webp" width="100%" alt="LitFamily motion cover: five armored robots power on one by one, the LitCodex robot wakes with glowing eyes and a lit frame, then LITFAMILY and KEEP THE WORK LIT. light up." /></picture></p>
1
+ <p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/cover-motion.webp" width="100%" alt="LitFamily motion cover: five armored robots power on one by one, the LitCodex robot wakes with glowing eyes and a lit frame, then LITFAMILY and KEEP THE WORK LIT. light up." /></picture></p>
2
2
 
3
3
  <p align="center">
4
- <a href="#install"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/badge-version.svg" alt="1.0.27" /></a>
5
- <a href="https://github.com/wjgoarxiv/litcodex/blob/main/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/badge-license.svg" alt="MIT license" /></a>
4
+ <a href="#install"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/badge-version.svg" alt="1.0.28" /></a>
5
+ <a href="https://github.com/wjgoarxiv/litcodex/blob/main/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/badge-license.svg" alt="MIT license" /></a>
6
6
  </p>
7
7
 
8
8
  <p align="center">
9
- <a href="https://github.com/wjgoarxiv/litcodex/blob/main/docs/usage.md"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/lucide-book-open.svg" width="16" alt="" /> Docs</a> &nbsp; <a href="#install">Install</a> &nbsp; <a href="https://github.com/wjgoarxiv/litcodex/blob/main/docs/assets/readme/ignition-film.mp4"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/lucide-play.svg" width="16" alt="" /> Ignition</a> &nbsp; <a href="https://github.com/wjgoarxiv/litcodex/blob/main/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.27/readme-assets/lucide-shield-check.svg" width="16" alt="" /> MIT</a>
9
+ <a href="https://github.com/wjgoarxiv/litcodex/blob/main/docs/usage.md"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/lucide-book-open.svg" width="16" alt="" /> Docs</a> &nbsp; <a href="#install">Install</a> &nbsp; <a href="https://github.com/wjgoarxiv/litcodex/blob/main/docs/assets/readme/ignition-film.mp4"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/lucide-play.svg" width="16" alt="" /> Ignition</a> &nbsp; <a href="https://github.com/wjgoarxiv/litcodex/blob/main/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litcodex@1.0.28/readme-assets/lucide-shield-check.svg" width="16" alt="" /> MIT</a>
10
10
  </p>
11
11
 
12
12
  # LitCodex
@@ -24,12 +24,12 @@ today's stopped.
24
24
  You need Node.js 22 or later and Codex CLI.
25
25
 
26
26
  ```sh
27
- npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex install
27
+ npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex install
28
28
  ```
29
29
 
30
30
  The installer asks which model leads, which model helps and which output style you like, shows what it is
31
31
  about to write, and changes only the keys it manages in `~/.codex/config.toml`. To see the plan first, run
32
- `npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex --dry-run install`. To skip the
32
+ `npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex --dry-run install`. To skip the
33
33
  questions, add `--yes` after `install`.
34
34
 
35
35
  ```sh
@@ -41,7 +41,7 @@ A global install also gets the video skill's tools ready with a few pinned downl
41
41
  [install guide](https://github.com/wjgoarxiv/litcodex/blob/main/docs/install.md#a-global-command) lists them
42
42
  and shows how to skip them.
43
43
 
44
- > Without a global install, use `npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex <command>`.
44
+ > Without a global install, use `npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex <command>`.
45
45
 
46
46
  ## First task
47
47
 
@@ -97,7 +97,7 @@ rather have neither, set `LITCODEX_NO_UPDATE_CHECK=1`. A doctor run that failed,
97
97
  ## Check, fix, remove
98
98
 
99
99
  ```sh
100
- npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex doctor
100
+ npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex doctor
101
101
  ```
102
102
 
103
103
  `litcodex doctor` checks registration, hooks, config and host capabilities; `litcodex loop doctor` checks
@@ -105,7 +105,7 @@ the current project's loop state. If `lit` does nothing, run doctor and check th
105
105
  in Codex. More fixes are under [troubleshooting](https://github.com/wjgoarxiv/litcodex#troubleshooting).
106
106
 
107
107
  ```sh
108
- npm exec --yes --package @litfamily/litcodex@1.0.27 -- litcodex uninstall
108
+ npm exec --yes --package @litfamily/litcodex@1.0.28 -- litcodex uninstall
109
109
  ```
110
110
 
111
111
  This removes the plugin and the config LitCodex manages, and leaves your other settings alone.
package/dist/cli.d.ts CHANGED
@@ -17,7 +17,8 @@ export declare function dispatch(argv: readonly string[]): DispatchResult;
17
17
  /**
18
18
  * Async process entry used by `bin/litcodex.js`. It owns the side-effecting routes: install/doctor/
19
19
  * uninstall (install/* modules, which are the ONLY code that ever spawns `codex`), `config migrate`
20
- * (M13, in-process), and the bundled `@litcodex/lit-loop` runtime routes `loop`/`hook`. Returns the
21
- * integer exit code; the bin owns `process.exit`. No forwarding, no exec-wrapper, no harness.
20
+ * (M13, in-process), and the bundled `@litcodex/lit-loop` runtime routes `loop`/`hook`. `run` starts
21
+ * Codex itself from its own module (run.ts), only when the user asks for it. Returns the integer exit
22
+ * code; the bin owns `process.exit`. No forwarding, no harness.
22
23
  */
23
24
  export declare function runCli(rawArgv: readonly string[]): Promise<number>;
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Self-contained LitCodex CLI dispatcher. Side-effecting child processes remain
2
2
  // behind dedicated modules; unknown routes return a plain usage error.
3
- // `dispatch` is pure; `runCli` owns install/config/loop/hook process routes.
3
+ // `dispatch` is pure; `runCli` owns install/config/loop/hud/hook process routes.
4
4
  import { createRequire } from "node:module";
5
5
  import { runForegroundAutoUpdate } from "./auto-update.js";
6
6
  import { readEffortChoice, readLeadModelChoice, readModelChoice, readSubagentEffortChoice, readSubagentModelChoice, } from "./cli-model-route.js";
@@ -68,6 +68,12 @@ const ROUTES = {
68
68
  },
69
69
  config: configRouteHandler,
70
70
  loop: () => ok("litcodex loop\n"),
71
+ hud: () => ok("litcodex hud\n"),
72
+ statusline: () => ok(""),
73
+ run: () => ok("litcodex run\n"),
74
+ "screen-status": (rest) => rest.length === 1 && (rest[0] === "on" || rest[0] === "off" || rest[0] === "status")
75
+ ? ok(`litcodex screen-status ${rest[0]}\n`)
76
+ : { stdout: "", stderr: "Usage: litcodex screen-status on|off|status\n", exitCode: 64 },
71
77
  hook: () => ok("litcodex hook\n"),
72
78
  };
73
79
  /**
@@ -101,6 +107,10 @@ function renderHelp() {
101
107
  " litcodex uninstall Remove LitCodex from Codex",
102
108
  " litcodex config migrate Migrate Codex config for LitCodex",
103
109
  " litcodex loop <sub> Run a Lit-Loop subcommand",
110
+ " litcodex hud [--session <id>] [--once] Watch the LIT card live from a second terminal window",
111
+ " litcodex screen-status on|off|status Colour the LIT card; terminal `codex` only (off by default)",
112
+ " litcodex statusline Print the newest LIT status as one line for a status line command",
113
+ " litcodex run [-- <codex args>] Run Codex with a live LIT panel in the bottom rows of this terminal",
104
114
  " litcodex hook user-prompt-submit Run the UserPromptSubmit hook",
105
115
  " litcodex --dry-run <command> Resolve a command without applying it",
106
116
  " litcodex --help Show this help",
@@ -171,10 +181,17 @@ export function dispatch(argv) {
171
181
  /**
172
182
  * Async process entry used by `bin/litcodex.js`. It owns the side-effecting routes: install/doctor/
173
183
  * uninstall (install/* modules, which are the ONLY code that ever spawns `codex`), `config migrate`
174
- * (M13, in-process), and the bundled `@litcodex/lit-loop` runtime routes `loop`/`hook`. Returns the
175
- * integer exit code; the bin owns `process.exit`. No forwarding, no exec-wrapper, no harness.
184
+ * (M13, in-process), and the bundled `@litcodex/lit-loop` runtime routes `loop`/`hook`. `run` starts
185
+ * Codex itself from its own module (run.ts), only when the user asks for it. Returns the integer exit
186
+ * code; the bin owns `process.exit`. No forwarding, no harness.
176
187
  */
177
188
  export async function runCli(rawArgv) {
189
+ // `run` passes everything after `--` to Codex untouched, so it is routed before any flag is read.
190
+ const split = rawArgv.indexOf("--");
191
+ const own = split < 0 ? rawArgv : rawArgv.slice(0, split);
192
+ if (own.find((token) => !token.startsWith("--dry-run")) === "run") {
193
+ return runRoute(own, split < 0 ? [] : rawArgv.slice(split + 1));
194
+ }
178
195
  const normalized = normalizeDryRunValue(rawArgv);
179
196
  if (typeof normalized === "string") {
180
197
  process.stderr.write(`litcodex: ${normalized} is not a valid --dry-run; use --dry-run, --dry-run=true or --dry-run=false. Nothing was changed.\n`);
@@ -186,6 +203,26 @@ export async function runCli(rawArgv) {
186
203
  const head = rest[0];
187
204
  const isHelp = rest.includes("--help") || rest.includes("-h");
188
205
  const isVersion = rest.includes("--version") || rest.includes("-v");
206
+ if (head === "hud") {
207
+ // Read-only, so a dry run is the real run; `hud --help` prints the command's own usage.
208
+ const { hudCommand } = await import("@litcodex/lit-loop/dist/hud-cli.js");
209
+ return hudCommand(rest.slice(1), { stdout: process.stdout, stderr: process.stderr, env: process.env });
210
+ }
211
+ if (head === "statusline" && !isHelp) {
212
+ // Read-only and always exit 0, so a dry run is the real run.
213
+ const { statuslineCommand } = await import("@litcodex/lit-loop/dist/statusline.js");
214
+ return statuslineCommand(rest.slice(1), { stdin: process.stdin, stdout: process.stdout, env: process.env });
215
+ }
216
+ if (head === "screen-status") {
217
+ const { screenStatusCommand } = await import("@litcodex/lit-loop/dist/screen-status.js");
218
+ const verb = rest[1];
219
+ if (dryRun && (verb === "on" || verb === "off") && rest.length === 2) {
220
+ return writeDryRun(`litcodex screen-status ${verb}`, [
221
+ `Write ${resolveCodexHome(process.env)}/litcodex/screen-status.json with the card colour ${verb}`,
222
+ ]);
223
+ }
224
+ return screenStatusCommand(rest.slice(1), { stdout: process.stdout, stderr: process.stderr, env: process.env });
225
+ }
189
226
  if (!isHelp && !isVersion) {
190
227
  if (head === "config" && rest[1] === "migrate") {
191
228
  const passthrough = dryRun ? [...rest.slice(2), "--dry-run"] : rest.slice(2);
@@ -296,6 +333,38 @@ export async function runCli(rawArgv) {
296
333
  }
297
334
  return exitCode;
298
335
  }
336
+ /** `litcodex run [--dry-run] [--help] [-- <codex args>]`; Codex's own arguments go only after `--`. */
337
+ async function runRoute(own, codexArgs) {
338
+ const { findCodex, RUN_HELP_TEXT, runCommand } = await import("./run.js");
339
+ const normalized = normalizeDryRunValue(own);
340
+ if (typeof normalized === "string") {
341
+ process.stderr.write(`litcodex: ${normalized} is not a valid --dry-run; use --dry-run, --dry-run=true or --dry-run=false. Nothing was changed.\n`);
342
+ return USAGE_EXIT_CODE;
343
+ }
344
+ const dryRun = normalized.includes("--dry-run");
345
+ const flags = normalized.filter((token) => token !== "--dry-run").slice(1);
346
+ if (flags.includes("--help") || flags.includes("-h")) {
347
+ process.stdout.write(RUN_HELP_TEXT);
348
+ return 0;
349
+ }
350
+ if (flags.length > 0) {
351
+ process.stderr.write(`litcodex run: unknown option "${flags[0]}". Put Codex's own arguments after \`--\`.\n\n${RUN_HELP_TEXT}`);
352
+ return USAGE_EXIT_CODE;
353
+ }
354
+ if (dryRun) {
355
+ const command = [findCodex(process.env) ?? "codex", ...codexArgs].join(" ");
356
+ return writeDryRun("litcodex run", [
357
+ `Start ${command} in a pseudo-terminal four rows shorter and draw the LIT panel below it (writes no file)`,
358
+ ]);
359
+ }
360
+ return runCommand(codexArgs, {
361
+ stdin: process.stdin,
362
+ stdout: process.stdout,
363
+ stderr: process.stderr,
364
+ env: process.env,
365
+ cwd: process.cwd(),
366
+ });
367
+ }
299
368
  /** Loop subcommands that write project state; a `--dry-run` of these prints the step instead. */
300
369
  const LOOP_WRITE_STEPS = {
301
370
  create: "Derive goals and criteria from the brief and write the project's lit-loop plan and ledger",
@@ -224,7 +224,7 @@ export declare const FRONTEND_UIUX_PAYLOAD_HASHES: {
224
224
  };
225
225
  export declare const HUMANIZER_PAYLOAD_HASHES: {
226
226
  readonly NOTICE: "f1587efda830c594a727d651da82265c565e178a4665eb7327c0c07f516673f0";
227
- readonly "SKILL.md": "d9aca49209e78c0986a9043e15fe77477fa8d5c17523abe87bb4b57da43e7020";
227
+ readonly "SKILL.md": "f0d4f43efc9c9600586c16fc958f918e3f14e3ec34cd00cbe187cad1a3fcccc1";
228
228
  readonly "always-on-rule.md": "1c0e1d9724f012f05142c69d06e8a8cc89596556cba2c8ff1438e99c7848a5cf";
229
229
  readonly "assets/always-on-rule.md": "1c0e1d9724f012f05142c69d06e8a8cc89596556cba2c8ff1438e99c7848a5cf";
230
230
  readonly "assets/report-skeleton.md": "c5a45b1b096babe24328ec18362e6909de911299a62ed1e1e4efe11c37293cb1";
@@ -285,7 +285,7 @@ export declare const HUMANIZER_PAYLOAD_HASHES: {
285
285
  readonly "references/rewrite-playbook.md": "3b0bae2e24e9aada73ea527402e80c25a9bf471b65871248858496f1a2fe8ffb";
286
286
  readonly "references/taxonomy.md": "f29d9543f32178764eb07c49461785c6d1bd346b9c3419ec271b6062a74f92f9";
287
287
  readonly "rules.json": "ea2cc0aabafbdd9a94a60a29614cce8fba3ed9b813de0e4b5229f49b7356aaec";
288
- readonly "scripts/core.mjs": "8a5987a605f42787e7b0a48887c1c5042765c59839afe29afce3cee33f47e8b2";
288
+ readonly "scripts/core.mjs": "cd700c49bf00799bedc3563da0ee555018ea8c6eec92e3ef15b277041bf4f867";
289
289
  readonly "scripts/detect.mjs": "183446709f861299d088af4587fafb808adf2094e08b82c2279c0b50cc39e872";
290
290
  readonly "scripts/extract_office_text.py": "2badb7a32335d28c0dd029617ffe866c27053ef54b8951a40a14475b56633265";
291
291
  readonly "scripts/ko-metrics.mjs": "5e53d6dfb212241fbcbddaa5d89cacfda61fa739616b4d1a3dd4d76268b0d871";
@@ -225,7 +225,7 @@ export const FRONTEND_UIUX_PAYLOAD_HASHES = {
225
225
  };
226
226
  export const HUMANIZER_PAYLOAD_HASHES = {
227
227
  NOTICE: "f1587efda830c594a727d651da82265c565e178a4665eb7327c0c07f516673f0",
228
- "SKILL.md": "d9aca49209e78c0986a9043e15fe77477fa8d5c17523abe87bb4b57da43e7020",
228
+ "SKILL.md": "f0d4f43efc9c9600586c16fc958f918e3f14e3ec34cd00cbe187cad1a3fcccc1",
229
229
  "always-on-rule.md": "1c0e1d9724f012f05142c69d06e8a8cc89596556cba2c8ff1438e99c7848a5cf",
230
230
  "assets/always-on-rule.md": "1c0e1d9724f012f05142c69d06e8a8cc89596556cba2c8ff1438e99c7848a5cf",
231
231
  "assets/report-skeleton.md": "c5a45b1b096babe24328ec18362e6909de911299a62ed1e1e4efe11c37293cb1",
@@ -286,7 +286,7 @@ export const HUMANIZER_PAYLOAD_HASHES = {
286
286
  "references/rewrite-playbook.md": "3b0bae2e24e9aada73ea527402e80c25a9bf471b65871248858496f1a2fe8ffb",
287
287
  "references/taxonomy.md": "f29d9543f32178764eb07c49461785c6d1bd346b9c3419ec271b6062a74f92f9",
288
288
  "rules.json": "ea2cc0aabafbdd9a94a60a29614cce8fba3ed9b813de0e4b5229f49b7356aaec",
289
- "scripts/core.mjs": "8a5987a605f42787e7b0a48887c1c5042765c59839afe29afce3cee33f47e8b2",
289
+ "scripts/core.mjs": "cd700c49bf00799bedc3563da0ee555018ea8c6eec92e3ef15b277041bf4f867",
290
290
  "scripts/detect.mjs": "183446709f861299d088af4587fafb808adf2094e08b82c2279c0b50cc39e872",
291
291
  "scripts/extract_office_text.py": "2badb7a32335d28c0dd029617ffe866c27053ef54b8951a40a14475b56633265",
292
292
  "scripts/ko-metrics.mjs": "5e53d6dfb212241fbcbddaa5d89cacfda61fa739616b4d1a3dd4d76268b0d871",
@@ -2,11 +2,14 @@
2
2
  //
3
3
  // Prints a fire/ember-branded welcome + next-steps box ONLY on a real `npm install -g` (not CI,
4
4
  // not workspace installs, not dev). A motion pre-warm is attempted from the installed marketplace;
5
- // failure leaves the base package installed and names the explicit retry command.
5
+ // failure leaves the base package installed and names the explicit retry command. On every install,
6
+ // the macOS helper of the optional node-pty package gets its execute bit back (see below).
6
7
  import { spawnSync } from "node:child_process";
7
8
  import { existsSync } from "node:fs";
8
9
  import { createRequire } from "node:module";
9
10
  import { join } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+ import { ensurePtyHelperExecutable } from "./pty-helper.js";
10
13
  import { renderBanner, shouldDecorate } from "./ui.js";
11
14
  function main() {
12
15
  // Gate: only show on a real global install, not CI/workspace/dev.
@@ -39,6 +42,14 @@ function main() {
39
42
  process.stdout.write(`${result.status === 0 && receipt ? receipt : "[litcodex] Motion runtime pre-warm unavailable; run `litcodex motion-runtime install` outside the sandbox."}\n`);
40
43
  }
41
44
  }
45
+ try {
46
+ // Only the node-pty under this package's own node_modules: one found further up belongs to someone else.
47
+ const installedAt = fileURLToPath(new URL("..", import.meta.url));
48
+ ensurePtyHelperExecutable(join(installedAt, "node_modules", "node-pty"), process.platform, installedAt);
49
+ }
50
+ catch {
51
+ // Never fail npm install; without the helper `litcodex run` names it in its note.
52
+ }
42
53
  try {
43
54
  main();
44
55
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Makes `<root>/prebuilds/<platform>-<arch>/spawn-helper` executable when it is not. With `within`, only a
3
+ * `root` under `<within>/node_modules/` is touched; a node-pty found anywhere else belongs to someone else.
4
+ * Returns null when the helper is fine, absent, not needed or not ours, else the path of a helper that
5
+ * stays not executable.
6
+ */
7
+ export declare function ensurePtyHelperExecutable(root: string, platform?: NodeJS.Platform, within?: string): string | null;
@@ -0,0 +1,45 @@
1
+ // node-pty 1.1.0 ships its macOS `spawn-helper` prebuild without the execute bit, so every pseudo-terminal
2
+ // then fails with `posix_spawnp failed`. `litcodex run` needs it, so the postinstall step (for the copy
3
+ // under this package's own node_modules) and the command itself (for the copy it loads, again only under this
4
+ // package's own node_modules) set it.
5
+ // A helper built from source, another platform, or a missing package is left alone.
6
+ import { accessSync, chmodSync, constants, statSync } from "node:fs";
7
+ import { join, resolve, sep } from "node:path";
8
+ /**
9
+ * Makes `<root>/prebuilds/<platform>-<arch>/spawn-helper` executable when it is not. With `within`, only a
10
+ * `root` under `<within>/node_modules/` is touched; a node-pty found anywhere else belongs to someone else.
11
+ * Returns null when the helper is fine, absent, not needed or not ours, else the path of a helper that
12
+ * stays not executable.
13
+ */
14
+ export function ensurePtyHelperExecutable(root, platform = process.platform, within) {
15
+ if (platform !== "darwin")
16
+ return null;
17
+ if (within !== undefined && !resolve(root).startsWith(`${join(resolve(within), "node_modules")}${sep}`))
18
+ return null;
19
+ const helper = join(root, "prebuilds", `${platform}-${process.arch}`, "spawn-helper");
20
+ let mode;
21
+ try {
22
+ const stat = statSync(helper);
23
+ if (!stat.isFile())
24
+ return null;
25
+ mode = stat.mode;
26
+ }
27
+ catch {
28
+ return null;
29
+ }
30
+ try {
31
+ accessSync(helper, constants.X_OK);
32
+ return null;
33
+ }
34
+ catch {
35
+ // Not executable yet.
36
+ }
37
+ try {
38
+ chmodSync(helper, mode | 0o755);
39
+ accessSync(helper, constants.X_OK);
40
+ return null;
41
+ }
42
+ catch {
43
+ return helper;
44
+ }
45
+ }
package/dist/run.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ export declare const RUN_HELP_TEXT = "litcodex run [-- <codex args>...]\n\nStart Codex with a live LIT panel in the bottom 4 rows of this terminal. Codex runs in a\npseudo-terminal 4 rows shorter, in this folder; the panel follows the newest LIT turn started\nhere: the route and its clock, the stage map, the running step and the open checklist row.\nEverything after `--` goes to Codex unchanged, and Codex's exit code is the command's.\n\nWithout the optional node-pty package, outside a terminal, or in a terminal smaller than\n40\u00D712, Codex runs as usual after a one-line note. The command writes no file.\n\nOptions:\n --help Show this help.\n";
2
+ /** The part of a node-pty child this command uses. */
3
+ export interface PtyProcess {
4
+ onData(listener: (data: Buffer | string) => void): unknown;
5
+ onExit(listener: (event: {
6
+ exitCode: number;
7
+ signal?: number;
8
+ }) => void): unknown;
9
+ write(data: string | Buffer): void;
10
+ resize(columns: number, rows: number): void;
11
+ kill(signal?: string): void;
12
+ }
13
+ export interface PtyModule {
14
+ spawn(file: string, args: string[], options: {
15
+ name: string;
16
+ cols: number;
17
+ rows: number;
18
+ cwd: string;
19
+ env: NodeJS.ProcessEnv;
20
+ encoding: null;
21
+ }): PtyProcess;
22
+ }
23
+ interface Events {
24
+ on(event: string, listener: (...args: unknown[]) => void): unknown;
25
+ removeListener(event: string, listener: (...args: unknown[]) => void): unknown;
26
+ }
27
+ export interface RunIo {
28
+ readonly stdin: Events & {
29
+ readonly isTTY?: boolean;
30
+ setRawMode?(mode: boolean): unknown;
31
+ resume(): unknown;
32
+ pause(): unknown;
33
+ };
34
+ readonly stdout: Events & {
35
+ readonly isTTY?: boolean;
36
+ readonly rows?: number;
37
+ readonly columns?: number;
38
+ write(data: string | Uint8Array): unknown;
39
+ };
40
+ readonly stderr: {
41
+ readonly isTTY?: boolean;
42
+ write(text: string): unknown;
43
+ };
44
+ readonly env: NodeJS.ProcessEnv;
45
+ readonly cwd: string;
46
+ /** Process signals and uncaught errors; a test passes its own emitter. */
47
+ readonly signals?: Events;
48
+ readonly now?: () => number;
49
+ /** node-pty; null when it is not installed or cannot load; a string saying why it cannot be used. */
50
+ readonly loadPty?: () => Promise<PtyModule | string | null>;
51
+ /** Runs Codex with this terminal and resolves its exit code. */
52
+ readonly runPlain?: (file: string, args: readonly string[], io: RunIo) => Promise<number>;
53
+ }
54
+ /** The `codex` executable on PATH, or null. */
55
+ export declare function findCodex(env: NodeJS.ProcessEnv): string | null;
56
+ export declare function runCommand(args: readonly string[], io: RunIo): Promise<number>;
57
+ export {};