sneakoscope 0.6.62 → 0.6.64
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/README.md +348 -71
- package/package.json +1 -1
- package/src/cli/main.mjs +16 -8
- package/src/core/cmux-ui.mjs +70 -9
- package/src/core/fsx.mjs +1 -1
package/README.md
CHANGED
|
@@ -2,120 +2,397 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
Codex CLI/App harness for `$`
|
|
5
|
+
Sneakoscope Codex (`sks`, displayed as `ㅅㅋㅅ`) is a Codex CLI/App harness for repeatable agent workflows. It adds terminal commands, Codex App `$` prompt commands, cmux-native CLI workspaces, Team/Ralph/QA/Research routes, Context7 evidence checks, DB safety, TriWiki context tracking, Honest Mode, and release-readiness gates.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
Fallback: `npx -y -p sneakoscope sks bootstrap`
|
|
9
|
-
Project: `npm i -D sneakoscope && npx sks setup --install-scope project`
|
|
7
|
+
## Quick Start
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
Check: `sks deps check`, `sks doctor --fix`, `sks selftest --mock`
|
|
9
|
+
Install globally, initialize the current project, then open the cmux runtime:
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
```sh
|
|
12
|
+
npm i -g sneakoscope
|
|
13
|
+
sks bootstrap
|
|
14
|
+
sks
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If you only want a one-shot run without keeping `sks` installed globally:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npx -y -p sneakoscope sks bootstrap
|
|
21
|
+
```
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
For a repo-local install:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm i -D sneakoscope
|
|
27
|
+
npx sks setup --install-scope project
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Check that the install is usable:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
sks deps check
|
|
34
|
+
sks codex-app check
|
|
35
|
+
sks dollar-commands
|
|
36
|
+
sks selftest --mock
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## What Sneakoscope Adds
|
|
17
40
|
|
|
18
41
|
| Area | What it does |
|
|
19
42
|
| --- | --- |
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
| Ralph |
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
| Honest Mode | Finishes work with a claim/evidence pass that separates verified facts, unsupported claims, blocked checks, and not-applicable items. |
|
|
30
|
-
| GX visual context | Generates deterministic visual context cartridges for structured visual review and drift checks. |
|
|
31
|
-
| Research loops | Supports Research and AutoResearch workflows with hypotheses, experiments, falsification, novelty ledgers, SEO/GEO, and evidence-backed conclusions. |
|
|
32
|
-
| Release hygiene | Checks versioning, changelog, package contents, tarball size, syntax, selftests, and dry-run packaging before publish. |
|
|
43
|
+
| CLI runtime | `sks`, `sks cmux`, and `sks --mad --high` open Codex CLI in a cmux workspace. |
|
|
44
|
+
| Codex App commands | Installs generated skills so `$Team`, `$DFix`, `$QA-LOOP`, `$Ralph`, `$DB`, `$Wiki`, `$Help`, and related routes are visible in prompt workflows. |
|
|
45
|
+
| Team orchestration | Runs substantial work through ambiguity handling, scouts, TriWiki refresh, debate, runtime task graphs, worker inboxes, implementation, review, cleanup, reflection, and Honest Mode. |
|
|
46
|
+
| QA loop | Dogfoods UI/API behavior with safety gates, Browser/Computer evidence, safe fixes, and rechecks. |
|
|
47
|
+
| Ralph | Clarifies once, seals a decision contract, then continues without repeatedly asking the user. |
|
|
48
|
+
| TriWiki | Maintains `.sneakoscope/wiki/context-pack.json` as the context SSOT with `attention.use_first` and `attention.hydrate_first`. |
|
|
49
|
+
| Context7 | Requires current docs for external packages, APIs, MCPs, SDKs, and framework/runtime behavior when correctness depends on current guidance. |
|
|
50
|
+
| DB safety | Treats SQL, migrations, Supabase, RLS, and destructive operations as high risk. |
|
|
51
|
+
| Release hygiene | Checks versioning, changelog, package contents, tarball size, syntax, selftests, and dry-run publishing. |
|
|
33
52
|
|
|
34
|
-
##
|
|
53
|
+
## Requirements
|
|
35
54
|
|
|
36
|
-
|
|
55
|
+
- Node.js `>=20.11`
|
|
56
|
+
- npm
|
|
57
|
+
- Codex CLI for terminal workflows
|
|
58
|
+
- Codex App for app-facing workflows and first-party Browser Use / Computer Use parity
|
|
59
|
+
- cmux for the CLI-first runtime
|
|
60
|
+
- Context7 MCP for current-docs-gated routes
|
|
37
61
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
On macOS, `sks --mad --high` can install cmux through Homebrew when cmux is missing. You can also install it manually:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
brew tap manaflow-ai/cmux
|
|
66
|
+
brew install --cask cmux
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If the CLI is not on `PATH`, SKS also checks the app bundle path:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
/Applications/cmux.app/Contents/Resources/bin/cmux
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
### Global Install
|
|
78
|
+
|
|
79
|
+
Use this when you want `sks` available from any repo:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
npm i -g sneakoscope
|
|
83
|
+
sks bootstrap
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`sks bootstrap` initializes the current project, installs Codex App skills/hooks/config, checks Context7/Codex App/cmux readiness, and prints a ready status.
|
|
87
|
+
|
|
88
|
+
### One-Shot Install
|
|
89
|
+
|
|
90
|
+
Use this when you do not want to keep a global install:
|
|
58
91
|
|
|
59
92
|
```sh
|
|
93
|
+
npx -y -p sneakoscope sks bootstrap
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`npx` fetches the package into npm's cache and runs the binary for that command. This is useful for first-time setup or CI-style verification.
|
|
97
|
+
|
|
98
|
+
### Project Install
|
|
99
|
+
|
|
100
|
+
Use this when a repo should pin Sneakoscope as a development dependency:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
npm i -D sneakoscope
|
|
104
|
+
npx sks setup --install-scope project
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Project installs are useful when a team wants a repeatable harness version checked through `package-lock.json`.
|
|
108
|
+
|
|
109
|
+
### Source Checkout
|
|
110
|
+
|
|
111
|
+
Use this when developing Sneakoscope itself:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
git clone https://github.com/mandarange/Sneakoscope-Codex.git
|
|
115
|
+
cd Sneakoscope-Codex
|
|
116
|
+
npm install
|
|
117
|
+
npm install -g .
|
|
118
|
+
sks --version
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Terminal CLI Usage
|
|
122
|
+
|
|
123
|
+
Use terminal commands when you want to inspect, set up, verify, or start a CLI-first workspace.
|
|
124
|
+
|
|
125
|
+
### Discovery
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
sks commands
|
|
60
129
|
sks usage install
|
|
61
130
|
sks usage team
|
|
62
|
-
sks usage qa-loop
|
|
63
131
|
sks usage codex-app
|
|
132
|
+
sks dollar-commands
|
|
133
|
+
sks --version
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Setup And Repair
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
sks bootstrap
|
|
140
|
+
sks deps check
|
|
141
|
+
sks deps install cmux
|
|
142
|
+
sks codex-app check
|
|
143
|
+
sks doctor --fix
|
|
144
|
+
sks fix-path
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Open Codex CLI With cmux
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
sks
|
|
64
151
|
sks cmux check
|
|
152
|
+
sks cmux status --once
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`sks` opens a cmux workspace for Codex CLI when running in an interactive terminal. `sks cmux check` is diagnostic and prints readiness without starting a workspace.
|
|
156
|
+
|
|
157
|
+
### MAD High cmux Workspace
|
|
158
|
+
|
|
159
|
+
```sh
|
|
65
160
|
sks --mad --high
|
|
66
|
-
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
This creates/uses the `sks-mad-high` Codex profile for a one-shot full-access, high-reasoning cmux workspace. It is scoped to that explicit command and does not change normal SKS/DB safety defaults.
|
|
164
|
+
|
|
165
|
+
### Team Missions
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
sks team "implement this feature" executor:3 reviewer:1
|
|
169
|
+
sks team watch latest
|
|
170
|
+
sks team status latest
|
|
171
|
+
sks team log latest
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Team mode prepares the mission, records live events, compiles runtime tasks and worker inboxes, and opens cmux live lanes when cmux is available.
|
|
175
|
+
|
|
176
|
+
### QA, Ralph, Research, DB, Wiki, GX
|
|
177
|
+
|
|
178
|
+
```sh
|
|
179
|
+
sks qa-loop prepare "http://localhost:3000"
|
|
180
|
+
sks qa-loop run latest --max-cycles 2
|
|
181
|
+
sks ralph prepare "migrate this workflow without asking after prepare"
|
|
182
|
+
sks research prepare "evaluate this approach"
|
|
183
|
+
sks db scan --json
|
|
67
184
|
sks wiki refresh
|
|
68
185
|
sks wiki validate .sneakoscope/wiki/context-pack.json
|
|
69
|
-
sks
|
|
186
|
+
sks gx init homepage
|
|
187
|
+
sks gx render homepage --format html
|
|
70
188
|
```
|
|
71
189
|
|
|
72
|
-
|
|
190
|
+
## Codex App Usage
|
|
191
|
+
|
|
192
|
+
Sneakoscope has two surfaces:
|
|
193
|
+
|
|
194
|
+
- Terminal commands such as `sks deps check`, `sks team "task"`, and `sks --mad --high`
|
|
195
|
+
- Codex App prompt commands such as `$Team`, `$DFix`, `$QA-LOOP`, and `$Wiki`
|
|
196
|
+
|
|
197
|
+
After installing, run:
|
|
73
198
|
|
|
74
199
|
```sh
|
|
75
|
-
sks
|
|
76
|
-
sks
|
|
77
|
-
sks
|
|
78
|
-
sks qa-loop run
|
|
79
|
-
sks ralph prepare
|
|
80
|
-
sks ralph run
|
|
81
|
-
sks db scan
|
|
82
|
-
sks gx init
|
|
200
|
+
sks bootstrap
|
|
201
|
+
sks codex-app check
|
|
202
|
+
sks dollar-commands
|
|
83
203
|
```
|
|
84
204
|
|
|
85
|
-
|
|
205
|
+
Then open Codex App and use prompt commands directly in the chat. Examples:
|
|
86
206
|
|
|
87
|
-
|
|
207
|
+
```text
|
|
208
|
+
$Team implement the checkout fix and verify it
|
|
209
|
+
$DFix change this label and spacing only
|
|
210
|
+
$QA-LOOP dogfood localhost:3000 and fix safe issues
|
|
211
|
+
$Ralph clarify once, then finish the migration without more questions
|
|
212
|
+
$Wiki refresh and validate the context pack
|
|
213
|
+
$DB inspect this migration for destructive risk
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Generated app files include:
|
|
88
217
|
|
|
89
|
-
|
|
218
|
+
| Path | Purpose |
|
|
219
|
+
| --- | --- |
|
|
220
|
+
| `.codex/SNEAKOSCOPE.md` | Codex App quick reference and route guidance. |
|
|
221
|
+
| `.agents/skills/` | Generated skill instructions for `$` commands. |
|
|
222
|
+
| `.codex/hooks.json` | Stop/finalization hooks for Honest Mode and completion summaries. |
|
|
223
|
+
| `.codex/config.toml` | Codex profiles, agents, and MCP configuration. |
|
|
224
|
+
| `.sneakoscope/` | Runtime state, missions, wiki packs, policies, and artifacts. |
|
|
90
225
|
|
|
91
|
-
|
|
226
|
+
Use `sks dollar-commands` to confirm that terminal discovery and Codex App prompt commands agree.
|
|
92
227
|
|
|
93
|
-
|
|
228
|
+
## Prompt `$` Commands
|
|
229
|
+
|
|
230
|
+
Use these inside Codex App or another agent prompt. They are prompt commands, not terminal commands.
|
|
231
|
+
|
|
232
|
+
| Prompt | Use when |
|
|
233
|
+
| --- | --- |
|
|
234
|
+
| `$Team` | You want implementation, code changes, or substantial repo work. |
|
|
235
|
+
| `$From-Chat-IMG` | You have a chat screenshot plus original attachments and want each visible request mapped to work. |
|
|
236
|
+
| `$DFix` | You need a tiny design/content edit such as copy, label, color, spacing, or translation. |
|
|
237
|
+
| `$Answer` | You want an answer only and no implementation should start. |
|
|
238
|
+
| `$SKS` | You need setup, status, usage, or workflow help. |
|
|
239
|
+
| `$QA-LOOP` | You want UI/API dogfooding, safe fixes, and rechecks. |
|
|
240
|
+
| `$Ralph` | You want one prepare-time clarification pass, then no more user questions. |
|
|
241
|
+
| `$Research` | You need frontier-style research with hypotheses and falsification. |
|
|
242
|
+
| `$AutoResearch` | You want iterative improve/test/keep-or-discard optimization. |
|
|
243
|
+
| `$DB` | You need database, Supabase, migration, SQL, or MCP safety checks. |
|
|
244
|
+
| `$MAD-SKS` | You explicitly authorize a scoped high-risk DB permission modifier for the active invocation only. |
|
|
245
|
+
| `$GX` | You need deterministic visual context cartridges. |
|
|
246
|
+
| `$Wiki` | You want TriWiki refresh, pack, prune, validate, or maintenance. |
|
|
247
|
+
| `$Help` | You want installed command and workflow explanation. |
|
|
94
248
|
|
|
95
|
-
|
|
249
|
+
## Common Workflows
|
|
250
|
+
|
|
251
|
+
### First Install Checklist
|
|
96
252
|
|
|
97
253
|
```sh
|
|
254
|
+
npm i -g sneakoscope
|
|
255
|
+
sks bootstrap
|
|
256
|
+
sks deps check
|
|
257
|
+
sks codex-app check
|
|
98
258
|
sks dollar-commands
|
|
99
|
-
sks
|
|
259
|
+
sks selftest --mock
|
|
100
260
|
```
|
|
101
261
|
|
|
102
|
-
|
|
262
|
+
### Start A CLI Workspace
|
|
263
|
+
|
|
264
|
+
```sh
|
|
265
|
+
sks cmux check
|
|
266
|
+
sks
|
|
267
|
+
```
|
|
103
268
|
|
|
104
|
-
|
|
269
|
+
For the high-reasoning full-access profile:
|
|
270
|
+
|
|
271
|
+
```sh
|
|
272
|
+
sks --mad --high
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Use Codex App `$Team`
|
|
276
|
+
|
|
277
|
+
```text
|
|
278
|
+
$Team implement the requested change, update docs if needed, and verify with the relevant tests
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Team mode records a mission under `.sneakoscope/missions/`, keeps a live transcript, uses TriWiki context, and finishes with evidence and Honest Mode.
|
|
282
|
+
|
|
283
|
+
### Dogfood A UI Or API
|
|
284
|
+
|
|
285
|
+
```sh
|
|
286
|
+
sks qa-loop prepare "http://localhost:3000"
|
|
287
|
+
sks qa-loop run latest --max-cycles 2
|
|
288
|
+
sks qa-loop status latest
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Use `$QA-LOOP` in Codex App when Browser Use or Computer Use evidence should be part of the workflow.
|
|
292
|
+
|
|
293
|
+
### Refresh Context Before Risky Work
|
|
294
|
+
|
|
295
|
+
```sh
|
|
296
|
+
sks wiki refresh
|
|
297
|
+
sks wiki validate .sneakoscope/wiki/context-pack.json
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
TriWiki is the long-running context source of truth. It keeps compact high-trust recall in `attention.use_first` and source-hydration targets in `attention.hydrate_first`.
|
|
301
|
+
|
|
302
|
+
## Safety Model
|
|
303
|
+
|
|
304
|
+
Sneakoscope intentionally treats these as high-risk:
|
|
305
|
+
|
|
306
|
+
- SQL and migrations
|
|
307
|
+
- Supabase MCP and RLS changes
|
|
308
|
+
- destructive filesystem operations
|
|
309
|
+
- user-global harness config
|
|
310
|
+
- published package/release state
|
|
311
|
+
|
|
312
|
+
By default, SKS favors inspection, local files, branch-safe changes, explicit confirmation for destructive DB operations, and completion claims backed by tests or artifacts.
|
|
313
|
+
|
|
314
|
+
## Troubleshooting
|
|
315
|
+
|
|
316
|
+
### `sks` points to an old version
|
|
317
|
+
|
|
318
|
+
```sh
|
|
319
|
+
which sks
|
|
320
|
+
sks --version
|
|
321
|
+
node ./bin/sks.mjs --version
|
|
322
|
+
npm install -g .
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
If the global command is stale, reinstall globally from the repo or from npm.
|
|
326
|
+
|
|
327
|
+
### cmux is missing
|
|
328
|
+
|
|
329
|
+
```sh
|
|
330
|
+
sks deps install cmux
|
|
331
|
+
sks cmux check
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
`sks --mad --high` also attempts Homebrew installation automatically on macOS when cmux is missing.
|
|
335
|
+
|
|
336
|
+
### Codex App tools are missing
|
|
337
|
+
|
|
338
|
+
```sh
|
|
339
|
+
sks codex-app check
|
|
340
|
+
codex mcp list
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Codex App workflows need the app installed and the first-party Browser Use / Computer Use tools available for parity with QA and visual workflows.
|
|
344
|
+
|
|
345
|
+
### Setup is blocked by another harness
|
|
346
|
+
|
|
347
|
+
```sh
|
|
348
|
+
sks conflicts check
|
|
349
|
+
sks conflicts prompt
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
OMX/DCodex conflicts intentionally block setup/doctor until the user approves cleanup.
|
|
353
|
+
|
|
354
|
+
### The route is stuck or a final hook keeps reopening
|
|
355
|
+
|
|
356
|
+
```sh
|
|
357
|
+
sks pipeline status --json
|
|
358
|
+
sks team watch latest
|
|
359
|
+
sks wiki validate .sneakoscope/wiki/context-pack.json
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Finalization requires real evidence, no unsupported critical claims, valid Team cleanup artifacts, reflection when required, and Honest Mode.
|
|
363
|
+
|
|
364
|
+
## Development And Release
|
|
365
|
+
|
|
366
|
+
Run local checks:
|
|
367
|
+
|
|
368
|
+
```sh
|
|
369
|
+
npm run repo-audit
|
|
370
|
+
npm run changelog:check
|
|
371
|
+
npm run packcheck
|
|
372
|
+
npm run selftest
|
|
373
|
+
npm run sizecheck
|
|
374
|
+
npm run release:check
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Dry-run publish:
|
|
105
378
|
|
|
106
379
|
```sh
|
|
107
380
|
npm run publish:dry
|
|
108
381
|
```
|
|
109
382
|
|
|
110
|
-
|
|
383
|
+
`publish:dry` proves the local package is packable. It does not prove npm ownership, OTP, or registry publish permission.
|
|
111
384
|
|
|
112
|
-
##
|
|
385
|
+
## Documentation Style
|
|
113
386
|
|
|
114
|
-
-
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
387
|
+
This README follows a common open-source CLI shape:
|
|
388
|
+
|
|
389
|
+
- quick start first
|
|
390
|
+
- explicit install paths
|
|
391
|
+
- separate CLI and app/plugin usage
|
|
392
|
+
- command examples before internal architecture
|
|
393
|
+
- troubleshooting and release checks near the end
|
|
394
|
+
|
|
395
|
+
That shape mirrors how projects such as `rdme` and Vite separate quick start, setup/configuration, and CLI usage while keeping copy-ready commands visible.
|
|
119
396
|
|
|
120
397
|
## License
|
|
121
398
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sneakoscope",
|
|
3
3
|
"displayName": "ㅅㅋㅅ",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.64",
|
|
5
5
|
"description": "Sneakoscope Codex: database-safe Codex CLI/App harness with Team, Ralph, AutoResearch, TriWiki, and Honest Mode.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"homepage": "https://github.com/mandarange/Sneakoscope-Codex#readme",
|
package/src/cli/main.mjs
CHANGED
|
@@ -30,7 +30,7 @@ import { context7Evidence, evaluateStop, recordContext7Evidence, recordSubagentE
|
|
|
30
30
|
import { TEAM_DECOMPOSITION_ARTIFACT, TEAM_GRAPH_ARTIFACT, TEAM_INBOX_DIR, TEAM_RUNTIME_TASKS_ARTIFACT, teamRuntimePlanMetadata, teamRuntimeRequiredArtifacts, validateTeamRuntimeArtifacts, writeTeamRuntimeArtifacts } from '../core/team-dag.mjs';
|
|
31
31
|
import { appendTeamEvent, formatRoleCounts, initTeamLive, normalizeTeamSpec, parseTeamSpecArgs, parseTeamSpecText, readTeamDashboard, readTeamLive, readTeamTranscriptTail } from '../core/team-live.mjs';
|
|
32
32
|
import { CODEX_APP_DOCS_URL, codexAppIntegrationStatus, formatCodexAppStatus } from '../core/codex-app.mjs';
|
|
33
|
-
import { buildCmuxLaunchPlan, defaultCmuxWorkspaceName, formatCmuxBanner, launchCmuxTeamView, launchCmuxUi, platformCmuxInstallHint, runCmuxStatus, sanitizeCmuxWorkspaceName, cmuxAvailable } from '../core/cmux-ui.mjs';
|
|
33
|
+
import { buildCmuxLaunchPlan, defaultCmuxWorkspaceName, ensureCmuxInstalled, formatCmuxBanner, launchCmuxTeamView, launchCmuxUi, platformCmuxInstallHint, runCmuxStatus, sanitizeCmuxWorkspaceName, cmuxAvailable } from '../core/cmux-ui.mjs';
|
|
34
34
|
import { autoReviewProfileName, autoReviewStatus, autoReviewSummary, enableAutoReview, disableAutoReview, enableMadHighProfile, madHighProfileName } from '../core/auto-review.mjs';
|
|
35
35
|
|
|
36
36
|
const flag = (args, name) => args.includes(name);
|
|
@@ -1044,13 +1044,17 @@ async function cmuxCommand(sub = 'start', args = []) {
|
|
|
1044
1044
|
}
|
|
1045
1045
|
|
|
1046
1046
|
async function madHighCommand(args = []) {
|
|
1047
|
-
const cleanArgs = args.filter((arg) => !['--mad', '--MAD', '--mad-sks', '--high'].includes(arg));
|
|
1047
|
+
const cleanArgs = args.filter((arg) => !['--mad', '--MAD', '--mad-sks', '--high', '--no-auto-install-cmux'].includes(arg));
|
|
1048
1048
|
const profile = await enableMadHighProfile();
|
|
1049
1049
|
if (flag(args, '--json')) return console.log(JSON.stringify(profile, null, 2));
|
|
1050
1050
|
console.log(`SKS MAD high profile ready: ${madHighProfileName()}`);
|
|
1051
1051
|
console.log('Scope: explicit cmux launch only; normal SKS/DB safety returns after this command.');
|
|
1052
1052
|
const workspace = readOption(cleanArgs, '--workspace', readOption(cleanArgs, '--session', `sks-mad-${defaultCmuxWorkspaceName(process.cwd())}`));
|
|
1053
|
-
return launchCmuxUi([...cleanArgs, '--workspace', workspace], {
|
|
1053
|
+
return launchCmuxUi([...cleanArgs, '--workspace', workspace], {
|
|
1054
|
+
codexArgs: ['--profile', profile.profile_name],
|
|
1055
|
+
autoInstallCmux: !flag(args, '--no-auto-install-cmux'),
|
|
1056
|
+
conciseBlockers: true
|
|
1057
|
+
});
|
|
1054
1058
|
}
|
|
1055
1059
|
|
|
1056
1060
|
async function deps(sub = 'check', args = []) {
|
|
@@ -1172,11 +1176,15 @@ async function installCmuxDependency(args = []) {
|
|
|
1172
1176
|
if (!brew) return { target: 'cmux', status: 'homebrew_missing', command: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && ${command}` };
|
|
1173
1177
|
if (flag(args, '--dry-run')) return { target: 'cmux', status: 'dry_run', command };
|
|
1174
1178
|
if (!await confirmInstall(`Install cmux with Homebrew (${command})?`, args)) return { target: 'cmux', status: 'needs_approval', command };
|
|
1175
|
-
const
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
:
|
|
1179
|
-
|
|
1179
|
+
const installed = await ensureCmuxInstalled({ autoInstall: true });
|
|
1180
|
+
return {
|
|
1181
|
+
target: 'cmux',
|
|
1182
|
+
status: installed.status,
|
|
1183
|
+
version: installed.cmux?.version || null,
|
|
1184
|
+
command,
|
|
1185
|
+
code: installed.code,
|
|
1186
|
+
error: installed.error || null
|
|
1187
|
+
};
|
|
1180
1188
|
}
|
|
1181
1189
|
return { target: 'cmux', status: 'manual_required', command: platformCmuxInstallHint() };
|
|
1182
1190
|
}
|
package/src/core/cmux-ui.mjs
CHANGED
|
@@ -5,12 +5,16 @@ import { getCodexInfo } from './codex-adapter.mjs';
|
|
|
5
5
|
import { codexAppIntegrationStatus, formatCodexAppStatus } from './codex-app.mjs';
|
|
6
6
|
|
|
7
7
|
export const SKS_CMUX_LOGO = [
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
8
|
+
' _____ __ __ _____',
|
|
9
|
+
' / ___// //_// ___/',
|
|
10
|
+
' \\__ \\/ ,< \\__ \\ ㅅㅋㅅ',
|
|
11
|
+
' ___/ / /| | ___/ /',
|
|
12
|
+
'/____/_/ |_|/____/',
|
|
13
|
+
'Sneakoscope Codex cmux'
|
|
12
14
|
].join('\n');
|
|
13
15
|
|
|
16
|
+
export const CMUX_BREW_COMMAND = 'brew tap manaflow-ai/cmux && brew install --cask cmux';
|
|
17
|
+
|
|
14
18
|
export function sanitizeCmuxWorkspaceName(input) {
|
|
15
19
|
const base = String(input || 'sks').trim().replace(/[^A-Za-z0-9_.-]+/g, '-').replace(/^-+|-+$/g, '');
|
|
16
20
|
return (base || 'sks').slice(0, 80);
|
|
@@ -29,7 +33,7 @@ export function shellEscape(value) {
|
|
|
29
33
|
export function platformCmuxInstallHint() {
|
|
30
34
|
if (process.platform !== 'darwin') return 'cmux is a native macOS app; install it on macOS 14+ from https://cmux.com or https://github.com/manaflow-ai/cmux.';
|
|
31
35
|
return [
|
|
32
|
-
|
|
36
|
+
CMUX_BREW_COMMAND,
|
|
33
37
|
'then expose the CLI if needed:',
|
|
34
38
|
'sudo ln -sf "/Applications/cmux.app/Contents/Resources/bin/cmux" /usr/local/bin/cmux'
|
|
35
39
|
].join(' ');
|
|
@@ -53,6 +57,31 @@ export async function cmuxAvailable() {
|
|
|
53
57
|
return { ok: probe.code === 0, bin, version: text || 'cmux CLI', error: probe.code === 0 ? null : text || 'cmux workspace probe failed' };
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
export async function ensureCmuxInstalled(opts = {}) {
|
|
61
|
+
const before = await cmuxAvailable().catch((err) => ({ ok: false, error: err.message || 'cmux probe failed' }));
|
|
62
|
+
if (before.ok) return { target: 'cmux', status: 'present', cmux: before, command: null };
|
|
63
|
+
if (opts.autoInstall === false || process.env.SKS_NO_CMUX_AUTO_INSTALL === '1') {
|
|
64
|
+
return { target: 'cmux', status: 'missing', cmux: before, command: CMUX_BREW_COMMAND, error: before.error || 'cmux CLI not found' };
|
|
65
|
+
}
|
|
66
|
+
if (process.platform !== 'darwin') {
|
|
67
|
+
return { target: 'cmux', status: 'manual_required', cmux: before, command: platformCmuxInstallHint(), error: before.error || 'cmux is macOS-only' };
|
|
68
|
+
}
|
|
69
|
+
const brew = await which('brew').catch(() => null);
|
|
70
|
+
if (!brew) {
|
|
71
|
+
return { target: 'cmux', status: 'homebrew_missing', cmux: before, command: CMUX_BREW_COMMAND, error: 'Homebrew is required for automatic cmux install' };
|
|
72
|
+
}
|
|
73
|
+
if (!opts.quiet) console.log('cmux CLI missing; installing cmux with Homebrew...');
|
|
74
|
+
const tap = await runProcess(brew, ['tap', 'manaflow-ai/cmux'], { timeoutMs: 180000, maxOutputBytes: 128 * 1024 }).catch((err) => ({ code: 1, stdout: '', stderr: err.message }));
|
|
75
|
+
const install = tap.code === 0
|
|
76
|
+
? await runProcess(brew, ['install', '--cask', 'cmux'], { timeoutMs: 300000, maxOutputBytes: 256 * 1024 }).catch((err) => ({ code: 1, stdout: '', stderr: err.message }))
|
|
77
|
+
: tap;
|
|
78
|
+
let after = await cmuxAvailable().catch((err) => ({ ok: false, error: err.message || 'cmux probe failed after install' }));
|
|
79
|
+
if (!after.ok && after.bin) after = await wakeCmuxAndReprobe(after);
|
|
80
|
+
if (after.ok) return { target: 'cmux', status: 'installed', cmux: after, command: CMUX_BREW_COMMAND };
|
|
81
|
+
const rawError = `${install.stderr || install.stdout || after.error || 'brew install --cask cmux failed'}`.trim();
|
|
82
|
+
return { target: 'cmux', status: 'failed', cmux: after, command: CMUX_BREW_COMMAND, code: install.code, error: rawError };
|
|
83
|
+
}
|
|
84
|
+
|
|
56
85
|
export function codexLaunchCommand(root, codexBin, codexArgs = []) {
|
|
57
86
|
const extraArgs = Array.isArray(codexArgs) ? codexArgs : [];
|
|
58
87
|
return [
|
|
@@ -126,12 +155,19 @@ export function formatCmuxBanner(status = null) {
|
|
|
126
155
|
export async function launchCmuxUi(args = [], opts = {}) {
|
|
127
156
|
const rootArg = readOption(args, '--root', opts.root);
|
|
128
157
|
const workspaceArg = readOption(args, '--workspace', readOption(args, '--session', opts.workspace || opts.session));
|
|
129
|
-
|
|
158
|
+
let plan = await buildCmuxLaunchPlan({ ...opts, root: rootArg, workspace: workspaceArg });
|
|
159
|
+
let cmuxRepair = null;
|
|
160
|
+
if (!plan.ready && plan.cmux.bin && !plan.cmux.ok && !args.includes('--json')) {
|
|
161
|
+
const warmed = await wakeCmuxAndReprobe(plan.cmux);
|
|
162
|
+
if (warmed.ok) plan = await buildCmuxLaunchPlan({ ...opts, root: rootArg, workspace: workspaceArg, cmux: warmed });
|
|
163
|
+
}
|
|
164
|
+
if (!plan.ready && !plan.cmux.ok && opts.autoInstallCmux && !args.includes('--json')) {
|
|
165
|
+
cmuxRepair = await ensureCmuxInstalled({ autoInstall: true, quiet: Boolean(opts.quietAutoInstall || args.includes('--quiet')) });
|
|
166
|
+
if (cmuxRepair.cmux?.ok) plan = await buildCmuxLaunchPlan({ ...opts, root: rootArg, workspace: workspaceArg, cmux: cmuxRepair.cmux });
|
|
167
|
+
}
|
|
130
168
|
if (args.includes('--json')) return { plan };
|
|
131
169
|
if (!plan.ready && !args.includes('--status-only')) {
|
|
132
|
-
|
|
133
|
-
console.log('\nLaunch blocked:\n');
|
|
134
|
-
for (const blocker of Array.from(new Set(plan.blockers))) console.log(`- ${blocker}`);
|
|
170
|
+
printCmuxLaunchBlocked(plan, { concise: opts.conciseBlockers, cmuxRepair });
|
|
135
171
|
process.exitCode = 1;
|
|
136
172
|
return { plan };
|
|
137
173
|
}
|
|
@@ -149,12 +185,37 @@ export async function launchCmuxUi(args = [], opts = {}) {
|
|
|
149
185
|
return { plan, created: true };
|
|
150
186
|
}
|
|
151
187
|
|
|
188
|
+
function printCmuxLaunchBlocked(plan, opts = {}) {
|
|
189
|
+
if (opts.concise) {
|
|
190
|
+
console.error('SKS cmux launch blocked.');
|
|
191
|
+
if (!plan.cmux.ok) {
|
|
192
|
+
const repair = opts.cmuxRepair;
|
|
193
|
+
const prefix = repair?.status ? `cmux ${repair.status}` : 'cmux missing';
|
|
194
|
+
console.error(`- ${prefix}: ${repair?.error || plan.cmux.error || 'cmux CLI not found'}`);
|
|
195
|
+
console.error(`- Install command: ${repair?.command || CMUX_BREW_COMMAND}`);
|
|
196
|
+
}
|
|
197
|
+
if (!plan.codex.bin) console.error('- Codex CLI missing. Install: npm i -g @openai/codex, or set SKS_CODEX_BIN.');
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
console.log(formatCmuxBanner(plan.app));
|
|
201
|
+
console.log('\nLaunch blocked:\n');
|
|
202
|
+
for (const blocker of Array.from(new Set(plan.blockers))) console.log(`- ${blocker}`);
|
|
203
|
+
}
|
|
204
|
+
|
|
152
205
|
export async function openCmuxApp() {
|
|
153
206
|
if (process.platform !== 'darwin') return { ok: false, reason: 'not_macos' };
|
|
154
207
|
const run = await runProcess('open', ['-a', 'cmux'], { timeoutMs: 5000, maxOutputBytes: 16 * 1024 }).catch((err) => ({ code: 1, stderr: err.message, stdout: '' }));
|
|
155
208
|
return { ok: run.code === 0, stdout: run.stdout || '', stderr: run.stderr || '' };
|
|
156
209
|
}
|
|
157
210
|
|
|
211
|
+
async function wakeCmuxAndReprobe(fallback = {}) {
|
|
212
|
+
if (process.platform !== 'darwin') return fallback;
|
|
213
|
+
const opened = await openCmuxApp().catch(() => null);
|
|
214
|
+
if (!opened?.ok) return fallback;
|
|
215
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
216
|
+
return cmuxAvailable().catch(() => fallback);
|
|
217
|
+
}
|
|
218
|
+
|
|
158
219
|
export async function launchCmuxTeamView({ root, missionId, plan = {}, promptFile = null, json = false } = {}) {
|
|
159
220
|
const launch = await buildCmuxLaunchPlan({ root, workspace: `sks-team-${missionId}` });
|
|
160
221
|
const agents = [
|
package/src/core/fsx.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import os from 'node:os';
|
|
|
5
5
|
import crypto from 'node:crypto';
|
|
6
6
|
import { spawn } from 'node:child_process';
|
|
7
7
|
|
|
8
|
-
export const PACKAGE_VERSION = '0.6.
|
|
8
|
+
export const PACKAGE_VERSION = '0.6.64';
|
|
9
9
|
export const DEFAULT_PROCESS_TAIL_BYTES = 256 * 1024;
|
|
10
10
|
export const DEFAULT_PROCESS_TIMEOUT_MS = 30 * 60 * 1000;
|
|
11
11
|
|