litgrok-ai 0.2.4 → 0.2.5

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.5 (pending) — 2026-09-01
4
+
5
+ - Add the shared stacked LitFamily ASCII wordmark to the installer and lead both
6
+ READMEs with the version-free wordmark.
7
+ - Add a CI-enforced, manifest-driven version-lockstep guard for all eight release
8
+ sites, counting both plain and escaped-regex pins.
9
+ - Report model-picker and output-style selection as Grok host limits rather than
10
+ shipped surfaces: the installer writes no model or style keys, and
11
+ `grok inspect --json` exposes no `model`, `outputStyles`, or `settings` keys.
12
+ - Add installer-depth coverage for explicit `--yes` consent, non-interactive
13
+ no-write behavior, host-limit receipts, measured install phases, and isolated
14
+ plugin validation.
15
+
3
16
  ## 0.2.4 (pending) — 2026-08-31
4
17
 
5
18
  - Ship the Grok plugin manifest, eleven Grok-native agents, and complete reference
package/README.md CHANGED
@@ -1,5 +1,18 @@
1
1
  <p align="center"><img src="./cover.png" width="100%" alt="LitGrok — Grok Build skills and project rules, installed with npx" /></p>
2
2
 
3
+ ```text
4
+ ██╗ ██╗████████╗
5
+ ██║ ██║╚══██╔══╝
6
+ ██║ ██║ ██║
7
+ ███████╗██║ ██║
8
+ ╚══════╝╚═╝ ╚═╝
9
+ ██████╗ ██████╗ ██████╗ ██╗ ██╗
10
+ ██╔════╝ ██╔══██╗██╔═══██╗██║ ██╔╝
11
+ ██║ ███╗██████╔╝██║ ██║█████╔╝
12
+ ╚██████╔╝██║ ██║╚██████╔╝██║ ██╗
13
+ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
14
+ ```
15
+
3
16
  <h1 align="center">LitGrok</h1>
4
17
  <p align="center">
5
18
  <em>Grok Build skills and project rules for evidence-first lit work, installed with <code>npx</code>.</em>
@@ -9,7 +22,7 @@
9
22
  </p>
10
23
  <p align="center">
11
24
  <img src="https://img.shields.io/badge/npm-litgrok--ai-cb3837" alt="npm: litgrok-ai" />
12
- <img src="https://img.shields.io/badge/version-0.2.4-2ea44f" alt="version 0.2.4" />
25
+ <img src="https://img.shields.io/badge/version-0.2.5-2ea44f" alt="version 0.2.5" />
13
26
  <img src="https://img.shields.io/badge/Grok%20Build-skills%20%2B%20rules-111827" alt="Grok Build skills and project rules" />
14
27
  <img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license" />
15
28
  </p>
@@ -18,6 +31,37 @@ LitGrok is the Grok Build member of the lit workflow family. The npm package is
18
31
 
19
32
  This package does not log in to Grok, start the TUI, or claim live host behavior.
20
33
 
34
+ ### The workflow in one view
35
+
36
+ ```mermaid
37
+ flowchart TD
38
+ R["a request<br/>make it better"] --> DI["<b>deep-interview</b><br/>turn it into a decision-complete brief"]
39
+ DI --> P["<b>lit-plan</b><br/>objective · non-goals<br/>action / output / <b>binary verification</b>"]
40
+ P --> GATE{"user approves?"}
41
+ GATE -->|no| P
42
+ GATE -->|yes| SW["<b>start-work</b><br/>execute one slice"]
43
+
44
+ subgraph LOOP["each slice: RED to GREEN to SURFACE to CLEAN"]
45
+ SW --> RED["failing test first"]
46
+ RED --> GREEN["smallest change that passes"]
47
+ GREEN --> SURF["exercise the <b>real surface</b><br/>not just the test"]
48
+ SURF --> CLEAN["tear down · cleanup receipt"]
49
+ end
50
+
51
+ CLEAN --> EV{"evidence complete?"}
52
+ EV -->|"tests only"| SW
53
+ EV -->|"artifact + receipt"| RW["<b>review-work</b><br/>scope · evidence · payload<br/>security · real surface"]
54
+ RW -->|findings| SW
55
+ RW -->|clean| HO["<b>lit-handoff</b><br/>resumable packet"]
56
+
57
+ style GATE fill:#fff3cd,stroke:#856404
58
+ style EV fill:#fff3cd,stroke:#856404
59
+ style SURF fill:#d4edda,stroke:#155724
60
+ style RW fill:#d1ecf1,stroke:#0c5460
61
+ ```
62
+
63
+ > **Execution discipline.** A plan earns approval only when every item has binary verification. A slice closes after the real surface produces an artifact and its QA resources are torn down; passing tests alone never closes it.
64
+
21
65
  ## What it is
22
66
 
23
67
  - 34 Grok-native skill documents at `.grok/skills/<name>/SKILL.md`.
@@ -31,6 +75,27 @@ This package does not log in to Grok, start the TUI, or claim live host behavior
31
75
 
32
76
  Grok Build loads skills from project, user, plugin, and configured paths. Project guidance uses AGENTS-family files and `.grok/rules/*.md`; hooks load from project or user `.grok/hooks/`. LitGrok installs only these documented direct surfaces.
33
77
 
78
+ ### How it connects to Grok Build
79
+
80
+ ```mermaid
81
+ flowchart LR
82
+ subgraph GB["Grok Build"]
83
+ PJ["plugin.json"]; HK["hooks"]; RL["rules"]
84
+ end
85
+ subgraph LG["LitGrok plugin"]
86
+ PLAN["plan gate"]
87
+ HEDGE["deliverable hedge guard"]
88
+ LEDGER[("session ledger")]
89
+ end
90
+ PJ --> LG
91
+ HK --> PLAN --> LEDGER
92
+ HK --> HEDGE
93
+ RL --> LG
94
+ LG --> S["34 skills · 11 agents"]
95
+ ```
96
+
97
+ > **A narrow host boundary.** `plugin.json` exposes the package, hooks feed the plan gate and hedge guard, and rules provide project guidance while the session ledger records bounded state. Together these surfaces carry LitGrok’s 34 skills and 11 agents into Grok Build.
98
+
34
99
  ## Install
35
100
 
36
101
  ```bash
@@ -40,7 +105,7 @@ npx --yes litgrok-ai@latest install
40
105
  Pin a version when you need a reproducible install:
41
106
 
42
107
  ```bash
43
- npx --yes litgrok-ai@0.2.4 install
108
+ npx --yes litgrok-ai@0.2.5 install
44
109
  ```
45
110
 
46
111
  Preview without writing files:
@@ -87,6 +152,24 @@ If any installed payload file was changed, uninstall refuses the whole removal.
87
152
 
88
153
  After install, trust project hooks, then open or restart Grok Build in that project. Skills and the rule are guidance surfaces; hook commands are the only executable payload files, and they receive documented event JSON on stdin.
89
154
 
155
+ ### What the packed payload guarantees
156
+
157
+ ```mermaid
158
+ flowchart LR
159
+ SK["a skill"] --> Q{"does it declare<br/>a capability?"}
160
+ Q -->|"self-contained<br/>procedure"| AL["explicit allowlist entry<br/>with a written reason"]
161
+ Q -->|"needs a corpus"| C["corpus must resolve<br/>inside the <b>packed payload</b>"]
162
+ AL --> G1
163
+ C --> G1["<b>payload-substance</b>"]
164
+ G1 --> G2["<b>cross-product parity</b><br/>one product cannot ship a stub<br/>where the family ships substance"]
165
+ G2 --> G3["<b>referenced-path resolution</b><br/>every path in a SKILL.md<br/>must exist in the tarball"]
166
+ G3 --> OK["installs and works<br/>on a machine that has<br/>nothing else"]
167
+ style C fill:#d4edda,stroke:#155724
168
+ style OK fill:#d4edda,stroke:#155724
169
+ ```
170
+
171
+ > **The tarball is the shipping boundary.** A file present in the repository is not necessarily shipped. Each `npm pack` gate checks the allowlist or required corpus, parity, and every referenced path, so a missing dependency is caught before release rather than on a user’s machine.
172
+
90
173
  Confirm the files exist:
91
174
 
92
175
  ```bash
@@ -115,12 +198,12 @@ Review is proposal-only. `autoApply` is always false, transcript text is inert d
115
198
  From an installed project, use the package CLI directly when you want a replayable foreground command:
116
199
 
117
200
  ```bash
118
- npx --yes litgrok-ai@0.2.4 skill-loop review <session-id>
119
- npx --yes litgrok-ai@0.2.4 skill-loop list
120
- npx --yes litgrok-ai@0.2.4 skill-loop apply <proposal-id>
121
- npx --yes litgrok-ai@0.2.4 skill-loop reject <proposal-id>
122
- npx --yes litgrok-ai@0.2.4 skill-loop rollback <ledger-id>
123
- npx --yes litgrok-ai@0.2.4 skill-loop curator
201
+ npx --yes litgrok-ai@0.2.5 skill-loop review <session-id>
202
+ npx --yes litgrok-ai@0.2.5 skill-loop list
203
+ npx --yes litgrok-ai@0.2.5 skill-loop apply <proposal-id>
204
+ npx --yes litgrok-ai@0.2.5 skill-loop reject <proposal-id>
205
+ npx --yes litgrok-ai@0.2.5 skill-loop rollback <ledger-id>
206
+ npx --yes litgrok-ai@0.2.5 skill-loop curator
124
207
  ```
125
208
 
126
209
  `apply` prints the ledger id needed for rollback. The deterministic curator is also user-invoked: by default it runs at most once every seven days, requires at least two idle hours, marks eligible unpinned agent-owned skills stale after 30 idle days, and archives them outside discovery after 90 idle days. It makes a full backup before a transition and never deletes a skill package; `--force` bypasses only the seven-day run interval for an explicit test or maintenance invocation.
package/README_ko-KR.md CHANGED
@@ -1,5 +1,18 @@
1
1
  <p align="center"><img src="./cover.png" width="100%" alt="LitGrok — npx로 설치하는 Grok Build skill과 project rule" /></p>
2
2
 
3
+ ```text
4
+ ██╗ ██╗████████╗
5
+ ██║ ██║╚══██╔══╝
6
+ ██║ ██║ ██║
7
+ ███████╗██║ ██║
8
+ ╚══════╝╚═╝ ╚═╝
9
+ ██████╗ ██████╗ ██████╗ ██╗ ██╗
10
+ ██╔════╝ ██╔══██╗██╔═══██╗██║ ██╔╝
11
+ ██║ ███╗██████╔╝██║ ██║█████╔╝
12
+ ╚██████╔╝██║ ██║╚██████╔╝██║ ██╗
13
+ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
14
+ ```
15
+
3
16
  <h1 align="center">LitGrok</h1>
4
17
  <p align="center">
5
18
  <em>Grok Build용 skill과 project rule. <code>npx</code>로 설치합니다.</em>
@@ -9,7 +22,7 @@
9
22
  </p>
10
23
  <p align="center">
11
24
  <img src="https://img.shields.io/badge/npm-litgrok--ai-cb3837" alt="npm: litgrok-ai" />
12
- <img src="https://img.shields.io/badge/version-0.2.4-2ea44f" alt="version 0.2.4" />
25
+ <img src="https://img.shields.io/badge/version-0.2.5-2ea44f" alt="version 0.2.5" />
13
26
  <img src="https://img.shields.io/badge/Grok%20Build-skills%20%2B%20rules-111827" alt="Grok Build skills and project rules" />
14
27
  <img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license" />
15
28
  </p>
@@ -18,6 +31,37 @@ LitGrok은 lit workflow family의 Grok Build 포트입니다. npm 패키지 이
18
31
 
19
32
  Grok에 로그인하거나 TUI를 띄우거나, live host 동작을 주장하지 않습니다.
20
33
 
34
+ ### 작업 흐름 한눈에 보기
35
+
36
+ ```mermaid
37
+ flowchart TD
38
+ R["a request<br/>make it better"] --> DI["<b>deep-interview</b><br/>turn it into a decision-complete brief"]
39
+ DI --> P["<b>lit-plan</b><br/>objective · non-goals<br/>action / output / <b>binary verification</b>"]
40
+ P --> GATE{"user approves?"}
41
+ GATE -->|no| P
42
+ GATE -->|yes| SW["<b>start-work</b><br/>execute one slice"]
43
+
44
+ subgraph LOOP["each slice: RED to GREEN to SURFACE to CLEAN"]
45
+ SW --> RED["failing test first"]
46
+ RED --> GREEN["smallest change that passes"]
47
+ GREEN --> SURF["exercise the <b>real surface</b><br/>not just the test"]
48
+ SURF --> CLEAN["tear down · cleanup receipt"]
49
+ end
50
+
51
+ CLEAN --> EV{"evidence complete?"}
52
+ EV -->|"tests only"| SW
53
+ EV -->|"artifact + receipt"| RW["<b>review-work</b><br/>scope · evidence · payload<br/>security · real surface"]
54
+ RW -->|findings| SW
55
+ RW -->|clean| HO["<b>lit-handoff</b><br/>resumable packet"]
56
+
57
+ style GATE fill:#fff3cd,stroke:#856404
58
+ style EV fill:#fff3cd,stroke:#856404
59
+ style SURF fill:#d4edda,stroke:#155724
60
+ style RW fill:#d1ecf1,stroke:#0c5460
61
+ ```
62
+
63
+ > **실행 규율.** 모든 항목에 binary verification이 있어야 계획을 승인할 수 있습니다. 한 slice는 실제 surface에서 artifact를 만들고 QA 자원을 정리한 뒤에야 닫힙니다. 테스트만 통과한 상태는 완료가 아닙니다.
64
+
21
65
  ## 무엇을 제공하나요?
22
66
 
23
67
  - `.grok/skills/<name>/SKILL.md`에 Grok-native skill 문서 34개
@@ -31,6 +75,27 @@ Grok에 로그인하거나 TUI를 띄우거나, live host 동작을 주장하지
31
75
 
32
76
  Grok Build는 project, user, plugin, configured path에서 skill을 읽습니다. Project guidance는 AGENTS-family 파일과 `.grok/rules/*.md`이고 hook은 project 또는 user `.grok/hooks/`에서 읽습니다. LitGrok은 이 문서화된 direct surface만 설치합니다.
33
77
 
78
+ ### Grok Build에 연결되는 구조
79
+
80
+ ```mermaid
81
+ flowchart LR
82
+ subgraph GB["Grok Build"]
83
+ PJ["plugin.json"]; HK["hooks"]; RL["rules"]
84
+ end
85
+ subgraph LG["LitGrok plugin"]
86
+ PLAN["plan gate"]
87
+ HEDGE["deliverable hedge guard"]
88
+ LEDGER[("session ledger")]
89
+ end
90
+ PJ --> LG
91
+ HK --> PLAN --> LEDGER
92
+ HK --> HEDGE
93
+ RL --> LG
94
+ LG --> S["34 skills · 11 agents"]
95
+ ```
96
+
97
+ > **Host 경계는 좁고 명확합니다.** `plugin.json`이 package를 노출하고, hook은 plan gate와 hedge guard로 연결되며, rule은 project guidance가 됩니다. session ledger에는 bounded state를 기록하고, 이 표면들이 34개 skill과 11개 agent를 Grok Build에서 사용할 수 있게 합니다.
98
+
34
99
  ## 설치
35
100
 
36
101
  ```bash
@@ -40,7 +105,7 @@ npx --yes litgrok-ai@latest install
40
105
  재현 가능한 설치는 버전을 고정합니다.
41
106
 
42
107
  ```bash
43
- npx --yes litgrok-ai@0.2.4 install
108
+ npx --yes litgrok-ai@0.2.5 install
44
109
  ```
45
110
 
46
111
  파일을 쓰지 않고 미리보기:
@@ -87,6 +152,24 @@ npx --yes litgrok-ai@latest uninstall --user
87
152
 
88
153
  설치 후 project hook trust를 허용하고, 그 프로젝트에서 Grok Build를 열거나 재시작합니다. Skill과 rule은 guidance surface이고, hook command만 실행 가능한 payload이며 문서화된 event JSON을 stdin으로 받습니다.
89
154
 
155
+ ### 새 머신에서도 payload가 작동하는 이유
156
+
157
+ ```mermaid
158
+ flowchart LR
159
+ SK["a skill"] --> Q{"does it declare<br/>a capability?"}
160
+ Q -->|"self-contained<br/>procedure"| AL["explicit allowlist entry<br/>with a written reason"]
161
+ Q -->|"needs a corpus"| C["corpus must resolve<br/>inside the <b>packed payload</b>"]
162
+ AL --> G1
163
+ C --> G1["<b>payload-substance</b>"]
164
+ G1 --> G2["<b>cross-product parity</b><br/>one product cannot ship a stub<br/>where the family ships substance"]
165
+ G2 --> G3["<b>referenced-path resolution</b><br/>every path in a SKILL.md<br/>must exist in the tarball"]
166
+ G3 --> OK["installs and works<br/>on a machine that has<br/>nothing else"]
167
+ style C fill:#d4edda,stroke:#155724
168
+ style OK fill:#d4edda,stroke:#155724
169
+ ```
170
+
171
+ > **Shipping의 기준은 tarball입니다.** 저장소 안에 파일이 있다는 것만으로는 package에 포함됐다고 할 수 없습니다. `npm pack`을 기준으로 allowlist/corpus, product 간 substance parity, `SKILL.md`가 가리키는 path까지 확인하므로 빠진 의존성은 사용자 환경에 도달하기 전에 드러납니다.
172
+
90
173
  파일이 생겼는지 확인:
91
174
 
92
175
  ```bash
@@ -115,12 +198,12 @@ Review는 proposal만 만듭니다. `autoApply`는 항상 false이고 transcript
115
198
  설치된 project에서는 다음 package CLI를 foreground command로 실행할 수 있습니다.
116
199
 
117
200
  ```bash
118
- npx --yes litgrok-ai@0.2.4 skill-loop review <session-id>
119
- npx --yes litgrok-ai@0.2.4 skill-loop list
120
- npx --yes litgrok-ai@0.2.4 skill-loop apply <proposal-id>
121
- npx --yes litgrok-ai@0.2.4 skill-loop reject <proposal-id>
122
- npx --yes litgrok-ai@0.2.4 skill-loop rollback <ledger-id>
123
- npx --yes litgrok-ai@0.2.4 skill-loop curator
201
+ npx --yes litgrok-ai@0.2.5 skill-loop review <session-id>
202
+ npx --yes litgrok-ai@0.2.5 skill-loop list
203
+ npx --yes litgrok-ai@0.2.5 skill-loop apply <proposal-id>
204
+ npx --yes litgrok-ai@0.2.5 skill-loop reject <proposal-id>
205
+ npx --yes litgrok-ai@0.2.5 skill-loop rollback <ledger-id>
206
+ npx --yes litgrok-ai@0.2.5 skill-loop curator
124
207
  ```
125
208
 
126
209
  `apply`는 rollback에 필요한 ledger id를 출력합니다. Deterministic curator도 user-invoked입니다. 기본적으로 7일에 한 번만 실행되고, 마지막 activity 뒤 최소 2시간이 지나야 하며, pin되지 않은 agent-owned skill을 30일 idle 뒤 stale로 표시하고 90일 idle 뒤 discovery 밖으로 archive합니다. Transition 전에는 전체 backup을 만들고 skill package를 삭제하지 않습니다. `--force`는 명시적인 test 또는 maintenance 실행에서 7일 interval만 건너뜁니다.
package/bin/litgrok.mjs CHANGED
@@ -7,18 +7,57 @@ import { fileURLToPath } from 'node:url';
7
7
 
8
8
  const PACKAGE_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
9
9
  const PAYLOAD_ROOT = join(PACKAGE_ROOT, '.grok');
10
- const USAGE = 'Usage: litgrok [install|uninstall] [--user|--project] [--dry-run] [--no-color]\n litgrok skill-loop <review|propose|list|apply|reject|rollback|curator> ...\n';
10
+ const USAGE = 'Usage: litgrok [install|uninstall] [--user|--project] [--dry-run] [--no-color] [--yes]\n litgrok skill-loop <review|propose|list|apply|reject|rollback|curator> ...\n';
11
+ const BRAILLE_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
12
+ const SPINNER_INTERVAL_MS = 80;
13
+ const CLEAR_LINE = '\r\u001b[2K';
14
+
15
+ // ANSI Shadow, compressed to 5 rows: the standard 6-row face with its duplicate
16
+ // middle row dropped, keeping the closing row. This matches the approved preview.
17
+ // This table and renderer are ported verbatim from
18
+ // .litclaude/evidence/litfamily-guard-parity-v4/ansi-shadow-authoritative.mjs.
19
+ const GLYPHS = {
20
+ a:[" █████╗ ","██╔══██╗","███████║","██╔══██║","╚═╝ ╚═╝"],
21
+ c:[" ██████╗","██╔════╝","██║ ","╚██████╗"," ╚═════╝"],
22
+ d:["██████╗ ","██╔══██╗","██║ ██║","██████╔╝","╚═════╝ "],
23
+ e:["███████╗","██╔════╝","█████╗ ","███████╗","╚══════╝"],
24
+ g:[" ██████╗ ","██╔════╝ ","██║ ███╗","╚██████╔╝"," ╚═════╝ "],
25
+ h:["██╗ ██╗","██║ ██║","███████║","██║ ██║","╚═╝ ╚═╝"],
26
+ i:["██╗","██║","██║","██║","╚═╝"],
27
+ k:["██╗ ██╗","██║ ██╔╝","█████╔╝ ","██║ ██╗","╚═╝ ╚═╝"],
28
+ l:["██╗ ","██║ ","██║ ","███████╗","╚══════╝"],
29
+ m:["███╗ ███╗","████╗ ████║","██╔████╔██║","██║ ╚═╝ ██║","╚═╝ ╚═╝"],
30
+ n:["███╗ ██╗","████╗ ██║","██╔██╗ ██║","██║ ╚████║","╚═╝ ╚═══╝"],
31
+ o:[" ██████╗ ","██╔═══██╗","██║ ██║","╚██████╔╝"," ╚═════╝ "],
32
+ p:["██████╗ ","██╔══██╗","██████╔╝","██║ ","╚═╝ "],
33
+ r:["██████╗ ","██╔══██╗","██████╔╝","██║ ██║","╚═╝ ╚═╝"],
34
+ s:["███████╗","██╔════╝","███████╗","███████║","╚══════╝"],
35
+ t:["████████╗","╚══██╔══╝"," ██║ "," ██║ "," ╚═╝ "],
36
+ u:["██╗ ██╗","██║ ██║","██║ ██║","╚██████╔╝"," ╚═════╝ "],
37
+ x:["██╗ ██╗","╚██╗██╔╝"," ╚███╔╝ ","██╔╝ ██╗","╚═╝ ╚═╝"],
38
+ };
39
+
40
+ function renderAnsiShadow(word) {
41
+ const rows = ["", "", "", "", ""];
42
+ for (const ch of word) {
43
+ const g = GLYPHS[ch];
44
+ if (!g) throw new Error(`missing glyph for '${ch}' in '${word}'`);
45
+ for (let index = 0; index < 5; index += 1) rows[index] += g[index];
46
+ }
47
+ return rows;
48
+ }
11
49
 
12
50
  function parseInstall(args) {
13
51
  const remaining = [...args];
14
52
  let command = 'install';
15
53
  if (['install', 'uninstall'].includes(remaining[0])) command = remaining.shift();
16
- if (remaining.some((argument) => !['--user', '--project', '--dry-run', '--no-color'].includes(argument))) return null;
54
+ if (remaining.some((argument) => !['--user', '--project', '--dry-run', '--no-color', '--yes'].includes(argument))) return null;
17
55
  if (remaining.includes('--user') && remaining.includes('--project')) return null;
18
56
  return {
19
57
  command,
20
58
  dryRun: remaining.includes('--dry-run'),
21
59
  noColor: remaining.includes('--no-color'),
60
+ yes: remaining.includes('--yes'),
22
61
  scope: remaining.includes('--user') ? 'user' : 'project',
23
62
  };
24
63
  }
@@ -32,25 +71,168 @@ function packageVersion() {
32
71
  }
33
72
  }
34
73
 
74
+ function paint(value, code, enabled) {
75
+ return enabled ? `\u001b[${code}m${value}\u001b[0m` : value;
76
+ }
77
+
78
+ function elapsedSince(start) {
79
+ return `${(Number(process.hrtime.bigint() - start) / 1e6).toFixed(1)}ms`;
80
+ }
81
+
82
+ function scopeDescription(options, root) {
83
+ const alternateFlag = options.scope === 'project' ? '--user' : '--project';
84
+ const alternateScope = options.scope === 'project' ? 'user' : 'project';
85
+ return `${options.scope} scope → ${root} (use ${alternateFlag} for ${alternateScope} scope)`;
86
+ }
87
+
35
88
  function printInstallFrame(stdout, options, env, fileCount, root) {
36
- const colors = !options.noColor && !Object.hasOwn(env, 'NO_COLOR') && !env.CI && Boolean(stdout.isTTY);
37
- const orange = colors ? '' : '';
38
- const yellow = colors ? '' : '';
39
- const reset = colors ? '' : '';
89
+ const colors = !options.noColor && !options.dryRun && !Object.hasOwn(env, 'NO_COLOR') && !env.CI && Boolean(stdout.isTTY);
90
+ const orange = colors ? '\u001b[38;2;255;90;31m' : '';
91
+ const yellow = colors ? '\u001b[38;2;250;204;21m' : '';
92
+ const reset = colors ? '\u001b[0m' : '';
40
93
  const rule = ` ${'━'.repeat(46)}`;
94
+ const payloadLabel = Number.isInteger(fileCount) ? `${fileCount} files · byte-identical copies only` : 'packaged .grok tree · byte-identical copies only';
41
95
  stdout.write(`${rule}\n`);
42
96
  stdout.write('\n');
43
- stdout.write(` ${orange}🔥 l i t grok v${packageVersion()}${reset}\n`);
97
+ const wordmarkRows = [
98
+ ...renderAnsiShadow('lit'),
99
+ ...renderAnsiShadow('grok').map((row, index) => index === 0 ? `${row} v${packageVersion()}` : row),
100
+ ];
101
+ stdout.write(`${wordmarkRows.map((row) => ` ${orange}${row}${reset}`).join('\n')}\n`);
44
102
  stdout.write(' Grok Build skills, project rules, and hooks\n');
45
103
  stdout.write('\n');
46
104
  stdout.write(`${rule}\n`);
47
105
  stdout.write(` ╭─ ${options.command.toUpperCase()}\n`);
48
- stdout.write(` │ ${yellow}01${reset} · Scope ${options.scope} → ${root}\n`);
49
- stdout.write(` │ ${yellow}02${reset} · Payload ${fileCount} files\n`);
106
+ stdout.write(` │ ${yellow}01${reset} · Scope ${scopeDescription(options, root)}\n`);
107
+ stdout.write(` │ ${yellow}02${reset} · Payload ${payloadLabel}\n`);
50
108
  stdout.write(' ╰─ whole packaged .grok tree, byte-identical copies only\n');
51
109
  stdout.write(' ╭─ MODEL ROUTE\n');
52
110
  stdout.write(' │ Model selection: host-owned\n');
53
111
  stdout.write(' ╰─ Grok Build owns model and effort; the installer writes no model keys\n');
112
+ return colors;
113
+ }
114
+
115
+ function statusMark(status, colors) {
116
+ if (status === 'ok') return paint('✓', '38;2;80;200;80', colors);
117
+ if (status === 'failed') return paint('✗', '38;2;230;60;60', colors);
118
+ return colors ? paint('○', '38;2;148;163;184', true) : '[skip]';
119
+ }
120
+
121
+ class InstallProgress {
122
+ constructor(stdout, colors) {
123
+ this.stdout = stdout;
124
+ this.colors = colors;
125
+ this.timer = null;
126
+ this.frameIndex = 0;
127
+ this.active = false;
128
+ this.closed = false;
129
+ }
130
+
131
+ open() {
132
+ this.stdout.write(' ╭─ INSTALL STEPS\n');
133
+ }
134
+
135
+ start(label) {
136
+ this.clearTimer();
137
+ this.active = true;
138
+ this.frameIndex = 0;
139
+ this.label = label;
140
+ if (!this.colors) return;
141
+ this.render();
142
+ this.timer = setInterval(() => {
143
+ this.frameIndex = (this.frameIndex + 1) % BRAILLE_FRAMES.length;
144
+ this.render();
145
+ }, SPINNER_INTERVAL_MS);
146
+ if (typeof this.timer.unref === 'function') this.timer.unref();
147
+ }
148
+
149
+ finish(status, label, detail, elapsed) {
150
+ this.clearTimer();
151
+ const suffix = detail ? ` · ${detail}` : '';
152
+ const line = ` │ ${statusMark(status, this.colors)} ${label}${suffix} · ${elapsed}`;
153
+ this.stdout.write(this.colors && this.active ? `${CLEAR_LINE}${line}\n` : `${line}\n`);
154
+ this.active = false;
155
+ }
156
+
157
+ close() {
158
+ this.clearTimer();
159
+ if (this.closed) return;
160
+ this.stdout.write(' ╰─\n');
161
+ this.closed = true;
162
+ }
163
+
164
+ render() {
165
+ const frame = paint(BRAILLE_FRAMES[this.frameIndex] ?? BRAILLE_FRAMES[0], '38;2;250;204;21', this.colors);
166
+ this.stdout.write(`${CLEAR_LINE} │ ${frame} ${this.label}`);
167
+ }
168
+
169
+ clearTimer() {
170
+ if (this.timer === null) return;
171
+ clearInterval(this.timer);
172
+ this.timer = null;
173
+ }
174
+ }
175
+
176
+ function runStep(progress, label, operation) {
177
+ const started = process.hrtime.bigint();
178
+ progress.start(label);
179
+ try {
180
+ const result = operation();
181
+ progress.finish('ok', label, result.detail ?? '', elapsedSince(started));
182
+ return result.value;
183
+ } catch (error) {
184
+ progress.finish('failed', label, error instanceof Error ? error.message : String(error), elapsedSince(started));
185
+ throw error;
186
+ }
187
+ }
188
+
189
+ function skipStep(progress, label, detail) {
190
+ const started = process.hrtime.bigint();
191
+ progress.finish('skipped', label, detail, elapsedSince(started));
192
+ }
193
+
194
+ function receiptCard(options, root, colors, { status, written, current }) {
195
+ const statusColor = status === 'Ready' || status === 'Already current' || status === 'Removed' ? '38;2;80;200;80' : '38;2;230;60;60';
196
+ const titleColor = status === 'Failed' ? '38;2;230;60;60' : '38;2;255;90;31';
197
+ return [
198
+ '',
199
+ ` ${paint('╭─ INSTALL RECEIPT', titleColor, colors)}`,
200
+ ` │ Status: ${paint(status, statusColor, colors)}`,
201
+ ` │ Scope: ${scopeDescription(options, root)}`,
202
+ ` │ Written vs already-current: ${written} written · ${current} already-current`,
203
+ ' │ Model route: host-owned; the installer writes no model keys',
204
+ ' │ Model picker: host limit — Grok Build owns session selection; no model keys are written',
205
+ ' │ Output styles: host limit — Grok Build exposes no output-style selector; the installer writes no style keys',
206
+ ' │ Hooks: require trust — /hooks-trust or launch Grok Build with --trust',
207
+ ' │ Next: restart Grok Build',
208
+ ` ${paint('╰─', titleColor, colors)}`,
209
+ '',
210
+ ].join('\n');
211
+ }
212
+
213
+ function failureCard(options, root, colors, step, message) {
214
+ return [
215
+ '',
216
+ ` ${paint('╭─ INSTALL FAILED', '38;2;230;60;60', colors)}`,
217
+ ` │ Status: ${paint('Failed', '38;2;230;60;60', colors)}`,
218
+ ` │ Scope: ${scopeDescription(options, root)}`,
219
+ ` │ Step: ${step}`,
220
+ ` │ Reason: ${message}`,
221
+ ' │ Hooks: require trust — /hooks-trust or launch Grok Build with --trust',
222
+ ' │ Next: resolve the issue and rerun the install',
223
+ ` ${paint('╰─', '38;2;230;60;60', colors)}`,
224
+ '',
225
+ ].join('\n');
226
+ }
227
+
228
+ function errorText(error) {
229
+ return error instanceof Error ? error.message : String(error);
230
+ }
231
+
232
+ function reportFailure(error, { stderr, stdout, options, root, colors, step }) {
233
+ const lines = Array.isArray(error?.stderrLines) ? error.stderrLines : [`litgrok: ${errorText(error)}`];
234
+ for (const line of lines) stderr.write(`${line}\n`);
235
+ stdout.write(failureCard(options, root, colors, error?.step ?? step, errorText(error)));
54
236
  }
55
237
 
56
238
  function targetState(source, target) {
@@ -133,19 +315,40 @@ export async function run(args, context = {}) {
133
315
 
134
316
  const home = env.HOME || env.USERPROFILE || homedir();
135
317
  const root = join(options.scope === 'project' ? cwd : home, '.grok');
136
- const files = discoverPayloadFiles().map(({ relativePath, source }) => ({
137
- relativePath,
138
- source,
139
- target: join(root, relativePath),
140
- }));
141
- const projectHooksIncluded =
142
- options.command === 'install' && options.scope === 'project' && files.some(({ relativePath }) => relativePath.split(sep)[0] === 'hooks');
318
+ const displayRoot = resolve(root);
319
+ const payloadStarted = process.hrtime.bigint();
320
+ let discoveredPayload;
321
+ let payloadError;
322
+ try {
323
+ discoveredPayload = discoverPayloadFiles();
324
+ } catch (error) {
325
+ payloadError = error;
326
+ }
143
327
 
144
- function printHookTrustRequirement() {
145
- if (projectHooksIncluded) stdout.write('Project hooks require trust before they run: use /hooks-trust or launch Grok Build with --trust.\n');
328
+ function filesFromPayload(discovered) {
329
+ return discovered.map(({ relativePath, source }) => ({
330
+ relativePath,
331
+ source,
332
+ target: join(root, relativePath),
333
+ }));
146
334
  }
147
335
 
148
- printInstallFrame(stdout, options, env, files.length, root);
336
+ function projectHooksIncluded(files) {
337
+ return options.command === 'install' && options.scope === 'project' && files.some(({ relativePath }) => relativePath.split(sep)[0] === 'hooks');
338
+ }
339
+
340
+ function printHookTrustRequirement(files) {
341
+ if (projectHooksIncluded(files)) stdout.write('Project hooks require trust before they run: use /hooks-trust or launch Grok Build with --trust.\n');
342
+ }
343
+
344
+ const files = discoveredPayload ? filesFromPayload(discoveredPayload) : null;
345
+ const payloadElapsed = payloadError ? null : elapsedSince(payloadStarted);
346
+ const colors = printInstallFrame(stdout, options, env, files?.length, displayRoot);
347
+
348
+ if (payloadError) {
349
+ reportFailure(payloadError, { stderr, stdout, options, root: displayRoot, colors, step: 'PAYLOAD' });
350
+ return 1;
351
+ }
149
352
 
150
353
  const reasons = [];
151
354
  if (options.dryRun) reasons.push('DRY RUN');
@@ -155,52 +358,104 @@ export async function run(args, context = {}) {
155
358
  if (reasons.length > 0) {
156
359
  stdout.write(`${reasons.join(' / ')} — no files written\n`);
157
360
  for (const { target } of files) stdout.write(`would ${options.command} ${target}\n`);
158
- printHookTrustRequirement();
361
+ printHookTrustRequirement(files);
159
362
  return 0;
160
363
  }
161
364
 
162
- const unsafeAncestor = unsafeInstallAncestor(root, files);
163
- if (unsafeAncestor) {
164
- stderr.write(`Refusing ${unsafeAncestor.reason} in install path: ${unsafeAncestor.path}\n`);
165
- return 1;
166
- }
365
+ const progress = new InstallProgress(stdout, colors);
366
+ progress.open();
367
+ let step = 'PAYLOAD';
368
+ try {
369
+ progress.finish('ok', 'PAYLOAD', `${files.length} files discovered`, payloadElapsed);
370
+
371
+ step = 'SAFETY';
372
+ runStep(progress, 'SAFETY', () => {
373
+ const unsafe = unsafeInstallAncestor(root, files);
374
+ if (unsafe) {
375
+ const message = `Refusing ${unsafe.reason} in install path: ${unsafe.path}`;
376
+ const error = new Error(message);
377
+ error.step = 'SAFETY';
378
+ error.stderrLines = [message];
379
+ throw error;
380
+ }
381
+ return { value: null, detail: 'install path clear' };
382
+ });
383
+
384
+ step = 'OWNERSHIP';
385
+ const states = runStep(progress, 'OWNERSHIP', () => {
386
+ const owned = files.map(({ source, target }) => targetState(source, target));
387
+ const counts = {
388
+ missing: owned.filter((state) => state === 'missing').length,
389
+ current: owned.filter((state) => state === 'current').length,
390
+ conflicts: owned.filter((state) => state === 'conflict').length,
391
+ };
392
+ if (counts.conflicts > 0) {
393
+ const stderrLines = [];
394
+ for (let index = 0; index < files.length; index += 1) {
395
+ if (owned[index] === 'conflict') stderrLines.push(`Refusing to ${options.command === 'install' ? 'overwrite' : 'remove'} different existing file: ${files[index].target}`);
396
+ }
397
+ const error = new Error(`${counts.missing} missing · ${counts.current} already-current · ${counts.conflicts} conflicts`);
398
+ error.step = 'OWNERSHIP';
399
+ error.stderrLines = stderrLines;
400
+ throw error;
401
+ }
402
+ return {
403
+ value: { states: owned, counts },
404
+ detail: `${counts.missing} missing · ${counts.current} already-current · ${counts.conflicts} conflicts`,
405
+ };
406
+ });
167
407
 
168
- const states = files.map(({ source, target }) => targetState(source, target));
169
- if (states.includes('conflict')) {
170
- for (let index = 0; index < files.length; index += 1) {
171
- if (states[index] === 'conflict') stderr.write(`Refusing to ${options.command === 'install' ? 'overwrite' : 'remove'} different existing file: ${files[index].target}\n`);
408
+ step = 'WRITE';
409
+ if (options.command === 'uninstall') {
410
+ const writeStarted = process.hrtime.bigint();
411
+ progress.start('WRITE');
412
+ let removed = 0;
413
+ for (let index = 0; index < files.length; index += 1) {
414
+ if (states.states[index] !== 'current') continue;
415
+ unlinkSync(files[index].target);
416
+ removed += 1;
417
+ }
418
+ progress.finish('ok', 'WRITE', `${removed} removed · ${states.counts.missing} already absent`, elapsedSince(writeStarted));
419
+ const receipt = receiptCard(options, displayRoot, colors, { status: 'Removed', written: 0, current: states.counts.current });
420
+ progress.close();
421
+ stdout.write(receipt);
422
+ return 0;
172
423
  }
173
- return 1;
174
- }
175
424
 
176
- if (options.command === 'uninstall') {
177
- let removed = 0;
178
- for (let index = 0; index < files.length; index += 1) {
179
- if (states[index] !== 'current') continue;
180
- unlinkSync(files[index].target);
181
- removed += 1;
425
+ if (states.states.every((state) => state === 'current')) {
426
+ skipStep(progress, 'WRITE', `SKIPPED · 0 written · ${states.counts.current} already-current`);
427
+ const receipt = receiptCard(options, displayRoot, colors, { status: 'Already current', written: 0, current: states.counts.current });
428
+ progress.close();
429
+ stdout.write(receipt);
430
+ return 0;
182
431
  }
183
- stdout.write(removed === 0 ? `Already absent: ${files.length} files\n` : `Removed ${removed} files\n`);
184
- return 0;
185
- }
186
432
 
187
- if (states.every((state) => state === 'current')) {
188
- stdout.write(`Already current: ${files.length} files\n`);
189
- printHookTrustRequirement();
433
+ const writeStarted = process.hrtime.bigint();
434
+ progress.start('WRITE');
435
+ let installed = 0;
436
+ try {
437
+ for (let index = 0; index < files.length; index += 1) {
438
+ if (states.states[index] === 'current') continue;
439
+ const { source, target } = files[index];
440
+ mkdirSync(dirname(target), { recursive: true });
441
+ copyFileSync(source, target, constants.COPYFILE_EXCL);
442
+ installed += 1;
443
+ }
444
+ progress.finish('ok', 'WRITE', `${installed} written · ${states.counts.current} already-current`, elapsedSince(writeStarted));
445
+ } catch (error) {
446
+ progress.finish('failed', 'WRITE', errorText(error), elapsedSince(writeStarted));
447
+ if (error && typeof error === 'object') error.step = 'WRITE';
448
+ throw error;
449
+ }
450
+ const receipt = receiptCard(options, displayRoot, colors, { status: 'Ready', written: installed, current: states.counts.current });
451
+ progress.close();
452
+ stdout.write(receipt);
190
453
  return 0;
454
+ } catch (error) {
455
+ progress.close();
456
+ reportFailure(error, { stderr, stdout, options, root: displayRoot, colors, step });
457
+ return 1;
191
458
  }
192
-
193
- let installed = 0;
194
- for (let index = 0; index < files.length; index += 1) {
195
- if (states[index] === 'current') continue;
196
- const { source, target } = files[index];
197
- mkdirSync(dirname(target), { recursive: true });
198
- copyFileSync(source, target, constants.COPYFILE_EXCL);
199
- installed += 1;
200
- }
201
- stdout.write(`Installed ${installed} files\n`);
202
- printHookTrustRequirement();
203
- return 0;
204
459
  }
205
460
 
206
461
  if (process.argv[1] && realpathSync(resolve(process.argv[1])) === fileURLToPath(import.meta.url)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litgrok-ai",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Grok Build skills, project rules, and hooks installer.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,8 @@
8
8
  "litgrok": "bin/litgrok.mjs"
9
9
  },
10
10
  "scripts": {
11
- "test": "node --test test/*.test.mjs"
11
+ "test": "node --test test/*.test.mjs",
12
+ "check:version": "node tools/check-version-lockstep.mjs"
12
13
  },
13
14
  "files": [
14
15
  "plugin.json",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litgrok",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Grok Build skills, project rules, and bounded lifecycle hooks for evidence-first lit work.",
5
5
  "author": {
6
6
  "name": "LitGrok contributors"