sneakoscope 0.9.13 → 0.9.15

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 (88) hide show
  1. package/README.md +32 -39
  2. package/crates/sks-core/Cargo.lock +99 -1
  3. package/crates/sks-core/Cargo.toml +2 -1
  4. package/crates/sks-core/src/main.rs +77 -43
  5. package/package.json +8 -5
  6. package/src/cli/command-registry.mjs +73 -114
  7. package/src/cli/feature-commands.mjs +44 -5
  8. package/src/cli/install-helpers.mjs +2 -2
  9. package/src/cli/router.mjs +2 -3
  10. package/src/commands/aliases.mjs +2 -0
  11. package/src/commands/auto-review.mjs +5 -0
  12. package/src/commands/autoresearch.mjs +5 -0
  13. package/src/commands/bootstrap.mjs +2 -0
  14. package/src/commands/code-structure.mjs +5 -0
  15. package/src/commands/codex-lb.mjs +61 -3
  16. package/src/commands/commands.mjs +5 -0
  17. package/src/commands/commit-and-push.mjs +5 -0
  18. package/src/commands/commit.mjs +5 -0
  19. package/src/commands/computer-use.mjs +31 -0
  20. package/src/commands/conflicts.mjs +13 -0
  21. package/src/commands/context7.mjs +5 -0
  22. package/src/commands/db.mjs +1 -1
  23. package/src/commands/deps.mjs +5 -0
  24. package/src/commands/dfix.mjs +2 -0
  25. package/src/commands/doctor.mjs +2 -2
  26. package/src/commands/dollar-commands.mjs +2 -0
  27. package/src/commands/eval.mjs +5 -0
  28. package/src/commands/fix-path.mjs +2 -0
  29. package/src/commands/gc.mjs +2 -0
  30. package/src/commands/goal.mjs +5 -0
  31. package/src/commands/guard.mjs +10 -0
  32. package/src/commands/gx.mjs +5 -0
  33. package/src/commands/harness.mjs +5 -0
  34. package/src/commands/help.mjs +3 -74
  35. package/src/commands/hook.mjs +8 -0
  36. package/src/commands/hproof.mjs +5 -0
  37. package/src/commands/image-ux-review.mjs +38 -0
  38. package/src/commands/init.mjs +2 -0
  39. package/src/commands/mad-sks.mjs +14 -0
  40. package/src/commands/memory.mjs +5 -0
  41. package/src/commands/openclaw.mjs +2 -0
  42. package/src/commands/perf.mjs +2 -2
  43. package/src/commands/pipeline.mjs +25 -0
  44. package/src/commands/postinstall.mjs +2 -0
  45. package/src/commands/ppt.mjs +44 -0
  46. package/src/commands/profile.mjs +5 -0
  47. package/src/commands/proof-field.mjs +5 -0
  48. package/src/commands/proof.mjs +22 -1
  49. package/src/commands/qa-loop.mjs +5 -0
  50. package/src/commands/quickstart.mjs +2 -0
  51. package/src/commands/reasoning.mjs +2 -0
  52. package/src/commands/recallpulse.mjs +5 -0
  53. package/src/commands/research.mjs +5 -0
  54. package/src/commands/selftest.mjs +2 -0
  55. package/src/commands/setup.mjs +2 -0
  56. package/src/commands/skill-dream.mjs +5 -0
  57. package/src/commands/stats.mjs +2 -0
  58. package/src/commands/team.mjs +2 -0
  59. package/src/commands/tmux.mjs +5 -0
  60. package/src/commands/update-check.mjs +2 -0
  61. package/src/commands/usage.mjs +2 -0
  62. package/src/commands/validate-artifacts.mjs +2 -0
  63. package/src/commands/versioning.mjs +16 -0
  64. package/src/commands/wiki.mjs +2 -2
  65. package/src/core/codex-lb-circuit.mjs +18 -0
  66. package/src/core/commands/basic-cli.mjs +315 -0
  67. package/src/{cli/maintenance-commands.mjs → core/commands/route-cli.mjs} +37 -37
  68. package/src/core/feature-fixture-runner.mjs +109 -0
  69. package/src/core/feature-fixtures.mjs +1 -1
  70. package/src/core/feature-registry.mjs +19 -7
  71. package/src/core/fsx.mjs +1 -1
  72. package/src/core/git-simple.mjs +118 -0
  73. package/src/core/pipeline.mjs +1 -1
  74. package/src/core/proof/route-finalizer-fixtures.mjs +21 -0
  75. package/src/core/proof/route-finalizer-policy.mjs +13 -0
  76. package/src/core/proof/route-finalizer.mjs +82 -0
  77. package/src/core/proof-field.mjs +2 -2
  78. package/src/core/routes.mjs +31 -1
  79. package/src/core/rust-accelerator.mjs +8 -3
  80. package/src/core/version.mjs +1 -1
  81. package/src/core/wiki-image/before-after-relation.mjs +1 -0
  82. package/src/core/wiki-image/computer-use-evidence.mjs +1 -0
  83. package/src/core/wiki-image/generated-review-parser.mjs +1 -0
  84. package/src/core/wiki-image/image-ux-evidence.mjs +1 -0
  85. package/src/core/wiki-image/image-voxel-ledger.mjs +10 -3
  86. package/src/core/wiki-image/ppt-image-evidence.mjs +1 -0
  87. package/src/core/wiki-image/route-image-evidence.mjs +107 -0
  88. package/src/cli/legacy-main.mjs +0 -4147
@@ -1,126 +1,85 @@
1
- const legacy = () => import('./legacy-main.mjs');
2
-
3
1
  export const COMMANDS = {
4
- help: {
5
- maturity: 'stable',
6
- summary: 'Show SKS help',
7
- lazy: () => import('../commands/help.mjs')
8
- },
9
- version: {
10
- maturity: 'stable',
11
- summary: 'Show SKS version',
12
- lazy: () => import('../commands/version.mjs')
13
- },
14
- commands: {
15
- maturity: 'stable',
16
- summary: 'List SKS commands',
17
- lazy: () => import('../commands/help.mjs')
18
- },
19
- root: {
20
- maturity: 'stable',
21
- summary: 'Show active SKS root',
22
- lazy: () => import('../commands/root.mjs')
23
- },
24
- features: {
25
- maturity: 'beta',
26
- summary: 'Validate feature registry',
27
- lazy: () => import('../commands/features.mjs')
28
- },
29
- 'all-features': {
30
- maturity: 'beta',
31
- summary: 'Run all-features selftest',
32
- lazy: () => import('../commands/all-features.mjs')
33
- },
34
- hooks: {
35
- maturity: 'beta',
36
- summary: 'Explain and inspect Codex hooks',
37
- lazy: () => import('../commands/hooks.mjs')
38
- },
39
- proof: {
40
- maturity: 'beta',
41
- summary: 'Show and validate completion proof',
42
- lazy: () => import('../commands/proof.mjs')
43
- },
44
- wiki: {
45
- maturity: 'beta',
46
- summary: 'Manage TriWiki and image voxel ledgers',
47
- lazy: () => import('../commands/wiki.mjs')
48
- },
49
- perf: {
50
- maturity: 'beta',
51
- summary: 'Run performance checks',
52
- lazy: () => import('../commands/perf.mjs')
53
- },
54
- 'codex-lb': {
55
- maturity: 'beta',
56
- summary: 'Inspect codex-lb status and circuit health',
57
- lazy: () => import('../commands/codex-lb.mjs')
58
- },
59
- auth: {
60
- maturity: 'beta',
61
- summary: 'Alias for codex-lb auth commands',
62
- lazy: () => import('../commands/codex-lb.mjs')
63
- },
64
- postinstall: { maturity: 'stable', summary: 'Run postinstall bootstrap', lazy: legacy },
65
- wizard: { maturity: 'stable', summary: 'Open setup wizard', lazy: legacy },
66
- ui: { maturity: 'stable', summary: 'Open setup UI', lazy: legacy },
67
- 'update-check': { maturity: 'stable', summary: 'Check npm package freshness', lazy: legacy },
68
- usage: { maturity: 'stable', summary: 'Show focused usage topic', lazy: legacy },
69
- quickstart: { maturity: 'stable', summary: 'Show quickstart flow', lazy: legacy },
70
- 'codex-app': { maturity: 'beta', summary: 'Check Codex App readiness', lazy: () => import('../commands/codex-app.mjs') },
71
- openclaw: { maturity: 'labs', summary: 'Create OpenClaw skill package', lazy: legacy },
72
- bootstrap: { maturity: 'stable', summary: 'Initialize SKS project files', lazy: legacy },
73
- deps: { maturity: 'stable', summary: 'Check or install local dependencies', lazy: legacy },
74
- 'qa-loop': { maturity: 'beta', summary: 'Run QA loop missions', lazy: legacy },
75
- ppt: { maturity: 'labs', summary: 'Inspect/build PPT artifacts', lazy: legacy },
76
- 'image-ux-review': { maturity: 'labs', summary: 'Inspect image UX artifacts', lazy: legacy },
77
- 'ux-review': { maturity: 'labs', summary: 'Alias for image UX review', lazy: legacy },
78
- 'visual-review': { maturity: 'labs', summary: 'Alias for image UX review', lazy: legacy },
79
- 'ui-ux-review': { maturity: 'labs', summary: 'Alias for image UX review', lazy: legacy },
80
- context7: { maturity: 'beta', summary: 'Context7 checks and docs', lazy: legacy },
81
- recallpulse: { maturity: 'labs', summary: 'RecallPulse evidence route', lazy: legacy },
82
- pipeline: { maturity: 'beta', summary: 'Inspect pipeline missions', lazy: legacy },
83
- guard: { maturity: 'beta', summary: 'Check harness guard', lazy: legacy },
84
- conflicts: { maturity: 'beta', summary: 'Check harness conflicts', lazy: legacy },
85
- versioning: { maturity: 'stable', summary: 'Manage release version metadata', lazy: legacy },
86
- reasoning: { maturity: 'labs', summary: 'Show reasoning route', lazy: legacy },
87
- aliases: { maturity: 'stable', summary: 'Show command aliases', lazy: legacy },
88
- setup: { maturity: 'stable', summary: 'Initialize SKS state', lazy: legacy },
89
- 'fix-path': { maturity: 'stable', summary: 'Repair hook command paths', lazy: legacy },
2
+ help: { maturity: 'stable', summary: 'Show SKS help', lazy: () => import('../commands/help.mjs') },
3
+ version: { maturity: 'stable', summary: 'Show SKS version', lazy: () => import('../commands/version.mjs') },
4
+ commands: { maturity: 'stable', summary: 'List SKS commands', lazy: () => import('../commands/commands.mjs') },
5
+ root: { maturity: 'stable', summary: 'Show active SKS root', lazy: () => import('../commands/root.mjs') },
6
+ 'update-check': { maturity: 'stable', summary: 'Check npm package freshness', lazy: () => import('../commands/update-check.mjs') },
7
+ wizard: { maturity: 'stable', summary: 'Open setup wizard help', lazy: () => import('../commands/quickstart.mjs') },
8
+ usage: { maturity: 'stable', summary: 'Show focused usage topic', lazy: () => import('../commands/usage.mjs') },
9
+ quickstart: { maturity: 'stable', summary: 'Show quickstart flow', lazy: () => import('../commands/quickstart.mjs') },
10
+ setup: { maturity: 'stable', summary: 'Initialize SKS state', lazy: () => import('../commands/setup.mjs') },
11
+ bootstrap: { maturity: 'stable', summary: 'Initialize SKS project files', lazy: () => import('../commands/bootstrap.mjs') },
12
+ init: { maturity: 'stable', summary: 'Initialize local control surface', lazy: () => import('../commands/init.mjs') },
13
+ deps: { maturity: 'stable', summary: 'Check local dependencies', lazy: () => import('../commands/deps.mjs') },
14
+ 'fix-path': { maturity: 'stable', summary: 'Repair hook command paths', lazy: () => import('../commands/fix-path.mjs') },
90
15
  doctor: { maturity: 'stable', summary: 'Check and repair SKS install', lazy: () => import('../commands/doctor.mjs') },
91
- init: { maturity: 'stable', summary: 'Initialize local control surface', lazy: legacy },
92
- selftest: { maturity: 'stable', summary: 'Run local mock selftest', lazy: legacy },
93
- goal: { maturity: 'beta', summary: 'Manage Goal bridge workflow', lazy: legacy },
94
- research: { maturity: 'labs', summary: 'Run research missions', lazy: legacy },
95
- hook: { maturity: 'beta', summary: 'Codex hook entrypoint', lazy: legacy },
96
- profile: { maturity: 'labs', summary: 'Inspect/set profile', lazy: legacy },
97
- hproof: { maturity: 'beta', summary: 'Evaluate H-Proof gate', lazy: legacy },
98
- 'validate-artifacts': { maturity: 'beta', summary: 'Validate mission artifacts', lazy: legacy },
99
- 'proof-field': { maturity: 'beta', summary: 'Scan proof field', lazy: legacy },
100
- 'skill-dream': { maturity: 'labs', summary: 'Track skill dream counters', lazy: legacy },
101
- 'code-structure': { maturity: 'labs', summary: 'Scan source structure', lazy: legacy },
102
- memory: { maturity: 'labs', summary: 'Run retention checks', lazy: legacy },
103
- gx: { maturity: 'labs', summary: 'Render/validate GX cartridges', lazy: legacy },
104
- team: { maturity: 'beta', summary: 'Create and observe Team missions', lazy: legacy },
16
+ postinstall: { maturity: 'stable', summary: 'Run postinstall bootstrap', lazy: () => import('../commands/postinstall.mjs') },
17
+ 'codex-app': { maturity: 'beta', summary: 'Check Codex App readiness', lazy: () => import('../commands/codex-app.mjs') },
18
+ 'codex-lb': { maturity: 'beta', summary: 'Inspect codex-lb status and circuit health', lazy: () => import('../commands/codex-lb.mjs') },
19
+ auth: { maturity: 'beta', summary: 'Alias for codex-lb auth commands', lazy: () => import('../commands/codex-lb.mjs') },
20
+ hooks: { maturity: 'beta', summary: 'Explain and inspect Codex hooks', lazy: () => import('../commands/hooks.mjs') },
21
+ openclaw: { maturity: 'labs', summary: 'Create OpenClaw skill package', lazy: () => import('../commands/openclaw.mjs') },
22
+ tmux: { maturity: 'beta', summary: 'Open/check SKS tmux UI', lazy: () => import('../commands/tmux.mjs') },
23
+ mad: { maturity: 'beta', summary: 'MAD-SKS tmux permission launcher', lazy: () => import('../commands/mad-sks.mjs') },
24
+ 'mad-sks': { maturity: 'beta', summary: 'MAD-SKS scoped permission modifier', lazy: () => import('../commands/mad-sks.mjs') },
25
+ 'auto-review': { maturity: 'beta', summary: 'Manage auto-review profile', lazy: () => import('../commands/auto-review.mjs') },
26
+ autoreview: { maturity: 'beta', summary: 'Alias for auto-review', lazy: () => import('../commands/auto-review.mjs') },
27
+ 'dollar-commands': { maturity: 'stable', summary: 'List Codex App dollar commands', lazy: () => import('../commands/dollar-commands.mjs') },
28
+ dollars: { maturity: 'stable', summary: 'Alias for dollar-commands', lazy: () => import('../commands/dollar-commands.mjs') },
29
+ '$': { maturity: 'stable', summary: 'Alias for dollar-commands', lazy: () => import('../commands/dollar-commands.mjs') },
30
+ commit: { maturity: 'stable', summary: 'Create a simple git commit', lazy: () => import('../commands/commit.mjs') },
31
+ 'commit-and-push': { maturity: 'stable', summary: 'Create a simple git commit and push', lazy: () => import('../commands/commit-and-push.mjs') },
32
+ dfix: { maturity: 'stable', summary: 'Explain DFix route', lazy: () => import('../commands/dfix.mjs') },
33
+ team: { maturity: 'beta', summary: 'Create and observe Team missions', lazy: () => import('../commands/team.mjs') },
34
+ 'qa-loop': { maturity: 'beta', summary: 'Run QA loop missions', lazy: () => import('../commands/qa-loop.mjs') },
35
+ research: { maturity: 'labs', summary: 'Run research missions', lazy: () => import('../commands/research.mjs') },
36
+ autoresearch: { maturity: 'labs', summary: 'Alias for research/autoresearch route', lazy: () => import('../commands/autoresearch.mjs') },
37
+ ppt: { maturity: 'labs', summary: 'Inspect/build PPT artifacts', lazy: () => import('../commands/ppt.mjs') },
38
+ 'image-ux-review': { maturity: 'labs', summary: 'Inspect image UX artifacts', lazy: () => import('../commands/image-ux-review.mjs') },
39
+ 'ux-review': { maturity: 'labs', summary: 'Alias for image UX review', lazy: () => import('../commands/image-ux-review.mjs') },
40
+ 'visual-review': { maturity: 'labs', summary: 'Alias for image UX review', lazy: () => import('../commands/image-ux-review.mjs') },
41
+ 'ui-ux-review': { maturity: 'labs', summary: 'Alias for image UX review', lazy: () => import('../commands/image-ux-review.mjs') },
42
+ 'computer-use': { maturity: 'beta', summary: 'Record Computer Use visual evidence', lazy: () => import('../commands/computer-use.mjs') },
43
+ cu: { maturity: 'beta', summary: 'Alias for Computer Use', lazy: () => import('../commands/computer-use.mjs') },
44
+ context7: { maturity: 'beta', summary: 'Context7 checks and docs', lazy: () => import('../commands/context7.mjs') },
45
+ recallpulse: { maturity: 'labs', summary: 'RecallPulse evidence route', lazy: () => import('../commands/recallpulse.mjs') },
46
+ pipeline: { maturity: 'beta', summary: 'Inspect pipeline missions', lazy: () => import('../commands/pipeline.mjs') },
47
+ guard: { maturity: 'beta', summary: 'Check harness guard', lazy: () => import('../commands/guard.mjs') },
48
+ conflicts: { maturity: 'beta', summary: 'Check harness conflicts', lazy: () => import('../commands/conflicts.mjs') },
49
+ versioning: { maturity: 'stable', summary: 'Manage release version metadata', lazy: () => import('../commands/versioning.mjs') },
50
+ reasoning: { maturity: 'labs', summary: 'Show reasoning route', lazy: () => import('../commands/reasoning.mjs') },
51
+ aliases: { maturity: 'stable', summary: 'Show command aliases', lazy: () => import('../commands/aliases.mjs') },
52
+ selftest: { maturity: 'stable', summary: 'Run local mock selftest', lazy: () => import('../commands/selftest.mjs') },
53
+ goal: { maturity: 'beta', summary: 'Manage Goal bridge workflow', lazy: () => import('../commands/goal.mjs') },
54
+ hook: { maturity: 'beta', summary: 'Codex hook entrypoint', lazy: () => import('../commands/hook.mjs') },
55
+ profile: { maturity: 'labs', summary: 'Inspect/set profile', lazy: () => import('../commands/profile.mjs') },
56
+ hproof: { maturity: 'beta', summary: 'Evaluate H-Proof gate', lazy: () => import('../commands/hproof.mjs') },
57
+ 'validate-artifacts': { maturity: 'beta', summary: 'Validate mission artifacts', lazy: () => import('../commands/validate-artifacts.mjs') },
58
+ proof: { maturity: 'beta', summary: 'Show and validate completion proof', lazy: () => import('../commands/proof.mjs') },
59
+ 'proof-field': { maturity: 'beta', summary: 'Scan proof field', lazy: () => import('../commands/proof-field.mjs') },
60
+ 'skill-dream': { maturity: 'labs', summary: 'Track skill dream counters', lazy: () => import('../commands/skill-dream.mjs') },
61
+ 'code-structure': { maturity: 'labs', summary: 'Scan source structure', lazy: () => import('../commands/code-structure.mjs') },
62
+ memory: { maturity: 'labs', summary: 'Run retention checks', lazy: () => import('../commands/memory.mjs') },
63
+ gx: { maturity: 'labs', summary: 'Render/validate GX cartridges', lazy: () => import('../commands/gx.mjs') },
105
64
  db: { maturity: 'beta', summary: 'Inspect DB safety policy', lazy: () => import('../commands/db.mjs') },
106
- eval: { maturity: 'labs', summary: 'Run eval reports', lazy: legacy },
107
- harness: { maturity: 'labs', summary: 'Run harness fixtures', lazy: legacy },
108
- gc: { maturity: 'labs', summary: 'Compact/prune runtime state', lazy: legacy },
109
- stats: { maturity: 'labs', summary: 'Show storage stats', lazy: legacy },
110
- tmux: { maturity: 'beta', summary: 'Open/check SKS tmux UI', lazy: legacy },
111
- 'auto-review': { maturity: 'beta', summary: 'Manage auto-review profile', lazy: legacy },
112
- autoreview: { maturity: 'beta', summary: 'Alias for auto-review', lazy: legacy },
113
- 'dollar-commands': { maturity: 'stable', summary: 'List Codex App dollar commands', lazy: legacy },
114
- dollars: { maturity: 'stable', summary: 'Alias for dollar-commands', lazy: legacy },
115
- '$': { maturity: 'stable', summary: 'Alias for dollar-commands', lazy: legacy },
116
- dfix: { maturity: 'stable', summary: 'Explain DFix route', lazy: legacy }
65
+ eval: { maturity: 'labs', summary: 'Run eval reports', lazy: () => import('../commands/eval.mjs') },
66
+ harness: { maturity: 'labs', summary: 'Run harness fixtures', lazy: () => import('../commands/harness.mjs') },
67
+ wiki: { maturity: 'beta', summary: 'Manage TriWiki and image voxel ledgers', lazy: () => import('../commands/wiki.mjs') },
68
+ gc: { maturity: 'labs', summary: 'Compact/prune runtime state', lazy: () => import('../commands/gc.mjs') },
69
+ stats: { maturity: 'labs', summary: 'Show storage stats', lazy: () => import('../commands/stats.mjs') },
70
+ features: { maturity: 'beta', summary: 'Validate feature registry', lazy: () => import('../commands/features.mjs') },
71
+ 'all-features': { maturity: 'beta', summary: 'Run all-features selftest', lazy: () => import('../commands/all-features.mjs') },
72
+ perf: { maturity: 'beta', summary: 'Run performance checks', lazy: () => import('../commands/perf.mjs') }
117
73
  };
118
74
 
119
75
  export const COMMAND_ALIASES = {
120
76
  '--help': 'help',
121
77
  '-h': 'help',
122
78
  '--version': 'version',
123
- '-v': 'version'
79
+ '-v': 'version',
80
+ '--mad': 'mad',
81
+ '--MAD': 'mad',
82
+ '--mad-sks': 'mad-sks'
124
83
  };
125
84
 
126
85
  export function commandNames() {
@@ -52,7 +52,7 @@ export async function allFeaturesCommand(sub = 'selftest', args = []) {
52
52
  }
53
53
  const root = await projectRoot();
54
54
  const registry = await buildFeatureRegistry({ root });
55
- const result = buildAllFeaturesSelftest(registry, { executeFixtures: flag(args, '--execute-fixtures'), root });
55
+ const result = buildAllFeaturesSelftest(registry, { executeFixtures: flag(args, '--execute-fixtures'), strictArtifacts: flag(args, '--strict-artifacts'), root });
56
56
  if (flag(args, '--json')) console.log(JSON.stringify(result, null, 2));
57
57
  else {
58
58
  console.log('SKS all-features selftest');
@@ -154,9 +154,19 @@ async function hooksReplayReport(fixturePath) {
154
154
  const runtime = await evaluateHookPayload(hookName, payload, { root: tempRoot, state });
155
155
  const decision = runtime.decision || runtime.permissionDecision || (runtime.continue === true ? 'continue' : 'continue');
156
156
  const expected = await readExpectedReplay(absolute);
157
- const comparable = { decision, reason: runtime.reason || 'fixture_safe' };
158
- const matchesExpected = expected ? expected.decision === comparable.decision && (!expected.reason || expected.reason === comparable.reason) : null;
159
- const ok = expected ? matchesExpected : decision !== 'block' && decision !== 'deny';
157
+ const comparable = {
158
+ decision,
159
+ permissionDecision: runtime.permissionDecision || null,
160
+ reason: runtime.reason || 'fixture_safe',
161
+ gate: runtime.gate || runtime.hookSpecificOutput?.gate || null,
162
+ missing: runtime.missing || runtime.hookSpecificOutput?.missing || [],
163
+ issues: runtime.issues || runtime.hookSpecificOutput?.issues || runtime.missing || [],
164
+ continue: runtime.continue,
165
+ secret_policy: 'redacted'
166
+ };
167
+ const match = expected ? matchHookExpected(comparable, expected) : { ok: decision !== 'block' && decision !== 'deny', failures: [] };
168
+ const matchesExpected = expected ? match.ok : null;
169
+ const ok = match.ok;
160
170
  return redactSecrets({
161
171
  schema: 'sks.hooks-replay.v1',
162
172
  ok,
@@ -164,12 +174,41 @@ async function hooksReplayReport(fixturePath) {
164
174
  hook: hookName,
165
175
  command: payload.command || payload.tool_input?.command || payload.toolInput?.command || payload.input?.command || '',
166
176
  decision,
167
- reason: runtime.reason || 'fixture_safe',
177
+ permissionDecision: comparable.permissionDecision,
178
+ reason: comparable.reason,
179
+ gate: comparable.gate,
180
+ missing: comparable.missing,
181
+ issues: comparable.issues,
182
+ continue: comparable.continue,
168
183
  matches_expected: matchesExpected,
184
+ expected_failures: match.failures,
169
185
  secret_policy: 'redacted'
170
186
  });
171
187
  }
172
188
 
189
+ function matchHookExpected(actual = {}, expected = {}) {
190
+ const failures = [];
191
+ if (expected.decision !== undefined && expected.decision !== actual.decision) failures.push(`decision:${actual.decision}`);
192
+ if (expected.permissionDecision !== undefined && expected.permissionDecision !== actual.permissionDecision) failures.push(`permissionDecision:${actual.permissionDecision}`);
193
+ if (expected.reason !== undefined && expected.reason !== actual.reason) failures.push('reason');
194
+ if (expected.reason_contains !== undefined && !String(actual.reason || '').includes(expected.reason_contains)) failures.push('reason_contains');
195
+ if (expected.gate !== undefined && expected.gate !== actual.gate) failures.push(`gate:${actual.gate}`);
196
+ if (expected.continue !== undefined && expected.continue !== actual.continue) failures.push(`continue:${actual.continue}`);
197
+ for (const item of expected.missing_contains || []) {
198
+ if (!containsValue(actual.missing, item)) failures.push(`missing_contains:${item}`);
199
+ }
200
+ for (const item of expected.issues_contains || []) {
201
+ if (!containsValue(actual.issues, item) && !containsValue(actual.missing, item) && !String(actual.reason || '').includes(item)) failures.push(`issues_contains:${item}`);
202
+ }
203
+ if (expected.secret_policy !== undefined && expected.secret_policy !== actual.secret_policy) failures.push(`secret_policy:${actual.secret_policy}`);
204
+ return { ok: failures.length === 0, failures };
205
+ }
206
+
207
+ function containsValue(values, item) {
208
+ const list = Array.isArray(values) ? values : [values].filter(Boolean);
209
+ return list.some((value) => String(value || '').includes(item));
210
+ }
211
+
173
212
  function normalizeReplayHookName(event = '') {
174
213
  const normalized = String(event || '').replace(/[_\s]+/g, '-').toLowerCase();
175
214
  if (normalized.includes('pretool') || normalized.includes('pre-tool')) return 'pre-tool';
@@ -561,7 +561,7 @@ export async function checkCodexLbResponseChain(status = {}, opts = {}) {
561
561
 
562
562
  async function recordCodexLbChainHealth(result, opts = {}) {
563
563
  if (!result || result.skipped || opts.recordCircuit === false) return result;
564
- await recordCodexLbHealthEvent(packageRoot(), result).catch(() => null);
564
+ await recordCodexLbHealthEvent(opts.root || packageRoot(), result).catch(() => null);
565
565
  return result;
566
566
  }
567
567
 
@@ -2349,7 +2349,7 @@ export async function selftestCodexLb(tmp) {
2349
2349
  if (!codexLbLaunch.includes('sks-codex-lb.env')) throw new Error('selftest: tmux launch command does not source codex-lb env file');
2350
2350
  if (!codexLbLaunch.includes("'--model' 'gpt-5.5'")) throw new Error('selftest: tmux launch command without args did not force GPT-5.5');
2351
2351
  if (!codexLbLaunch.includes('SKS_TMUX_LOGO_ANIMATION') || !codexLbLaunch.includes('SNEAKOSCOPE CODEX')) throw new Error('selftest: tmux launch command does not include the animated SKS logo intro');
2352
- const madLaunchSource = await safeReadText(path.join(packageRoot(), 'src', 'cli', 'maintenance-commands.mjs'));
2352
+ const madLaunchSource = await safeReadText(path.join(packageRoot(), 'src', 'core', 'commands', 'route-cli.mjs'));
2353
2353
  if (!madLaunchSource.includes('const lb = await deps.maybePromptCodexLbSetupForLaunch(args)') || !madLaunchSource.includes("const launchLb = lb.status === 'present'") || !madLaunchSource.includes('codexLbImmediateLaunchOpts(cleanArgs, launchLb') || !madLaunchSource.includes('bypass_codex_lb') || !madLaunchSource.includes('model_provider="openai"') || !madLaunchSource.includes('codexLbFreshSession: true')) throw new Error('selftest: MAD launch does not sync codex-lb auth and fresh-session launch options');
2354
2354
 
2355
2355
  }
@@ -13,8 +13,8 @@ function normalizeCommand(args = []) {
13
13
  export async function dispatch(args = []) {
14
14
  const { command, args: rest } = normalizeCommand(args);
15
15
  if (!command) {
16
- const legacy = await import('./legacy-main.mjs');
17
- return legacy.main(args);
16
+ const mod = await import('../commands/tmux.mjs');
17
+ return mod.run('tmux', ['check']);
18
18
  }
19
19
  const entry = COMMANDS[command];
20
20
  if (!entry) {
@@ -25,6 +25,5 @@ export async function dispatch(args = []) {
25
25
  const mod = await entry.lazy();
26
26
  const runner = mod.run || mod.main || mod.default;
27
27
  if (typeof runner !== 'function') throw new Error(`Command ${command} has no run/main export`);
28
- if (mod.IS_LEGACY_CLI) return runner([command, ...rest]);
29
28
  return runner(command, rest);
30
29
  }
@@ -0,0 +1,2 @@
1
+ import { aliasesCommand } from '../core/commands/basic-cli.mjs';
2
+ export async function run() { return aliasesCommand(); }
@@ -0,0 +1,5 @@
1
+ import { autoReviewCommand } from '../core/commands/basic-cli.mjs';
2
+ export async function run(_command, args = []) {
3
+ const [sub = 'status', ...rest] = args;
4
+ return autoReviewCommand(sub, rest);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { researchCommand } from '../core/commands/route-cli.mjs';
2
+ export async function run(_command, args = []) {
3
+ const [sub = 'status', ...rest] = args;
4
+ return researchCommand(sub, rest);
5
+ }
@@ -0,0 +1,2 @@
1
+ import { bootstrapCommand } from '../core/commands/basic-cli.mjs';
2
+ export async function run(_command, args = []) { return bootstrapCommand(args); }
@@ -0,0 +1,5 @@
1
+ import { codeStructureCommand } from '../core/commands/route-cli.mjs';
2
+ export async function run(_command, args = []) {
3
+ const [sub = 'scan', ...rest] = args;
4
+ return codeStructureCommand(sub, rest);
5
+ }
@@ -2,7 +2,8 @@ import path from 'node:path';
2
2
  import { projectRoot } from '../core/fsx.mjs';
3
3
  import { flag, readOption } from '../cli/args.mjs';
4
4
  import { printJson } from '../cli/output.mjs';
5
- import { codexLbMetrics, readCodexLbCircuit, recordCodexLbHealthEvent, resetCodexLbCircuit } from '../core/codex-lb-circuit.mjs';
5
+ import { codexLbMetrics, readCodexLbCircuit, recordCodexLbHealthEvent, resetCodexLbCircuit, codexLbProofEvidence } from '../core/codex-lb-circuit.mjs';
6
+ import { checkCodexLbResponseChain, codexLbStatus, configureCodexLb, formatCodexLbStatusText, releaseCodexLbAuthHold, repairCodexLbAuth, unselectCodexLbProvider } from '../cli/install-helpers.mjs';
6
7
 
7
8
  export async function run(command, args = []) {
8
9
  const root = await projectRoot();
@@ -14,6 +15,57 @@ export async function run(command, args = []) {
14
15
  if (!result.ok) process.exitCode = 1;
15
16
  return;
16
17
  }
18
+ if (action === 'status' || action === 'check') {
19
+ const result = await codexLbStatus();
20
+ if (flag(args, '--json')) return printJson(result);
21
+ process.stdout.write(formatCodexLbStatusText(result));
22
+ return;
23
+ }
24
+ if (action === 'health' || action === 'verify-chain' || action === 'chain') {
25
+ const status = await codexLbStatus();
26
+ const result = status.ok ? await checkCodexLbResponseChain(status, { force: true, root }) : { ok: false, status: 'not_configured', codex_lb: status };
27
+ if (flag(args, '--json')) return printJson(result);
28
+ console.log(`codex-lb response chain: ${result.ok ? 'ok' : `failed (${result.status})`}`);
29
+ if (!result.ok) process.exitCode = 1;
30
+ return;
31
+ }
32
+ if (action === 'repair' || action === 'resync' || action === 'login') {
33
+ const result = await repairCodexLbAuth();
34
+ if (flag(args, '--json')) return printJson(result);
35
+ console.log(`codex-lb repair: ${result.ok ? 'ok' : result.status}`);
36
+ if (!result.ok) process.exitCode = 1;
37
+ return;
38
+ }
39
+ if (action === 'release') {
40
+ const result = await releaseCodexLbAuthHold({ keepProvider: flag(args, '--keep-provider'), deleteBackup: flag(args, '--delete-backup'), force: flag(args, '--force') });
41
+ if (flag(args, '--json')) return printJson(result);
42
+ console.log(`codex-lb release: ${result.status}`);
43
+ if (['no_backup', 'auth_in_use', 'failed'].includes(result.status)) process.exitCode = 1;
44
+ return;
45
+ }
46
+ if (action === 'unselect') {
47
+ const result = await unselectCodexLbProvider();
48
+ if (flag(args, '--json')) return printJson(result);
49
+ console.log(`codex-lb unselect: ${result.status}`);
50
+ if (result.status === 'failed') process.exitCode = 1;
51
+ return;
52
+ }
53
+ if (action === 'setup' || action === 'reconfigure') {
54
+ const host = readOption(args, '--host', readOption(args, '--domain', null));
55
+ const apiKey = readOption(args, '--api-key', readOption(args, '--key', null));
56
+ if (!host || !apiKey) {
57
+ const result = { ok: false, reason: 'missing_host_or_api_key' };
58
+ if (flag(args, '--json')) return printJson(result);
59
+ console.error('Usage: sks codex-lb setup|reconfigure --host <domain> --api-key <key>');
60
+ process.exitCode = 1;
61
+ return;
62
+ }
63
+ const result = await configureCodexLb({ host, apiKey });
64
+ if (flag(args, '--json')) return printJson(result);
65
+ console.log(`codex-lb configured: ${result.base_url || result.status}`);
66
+ if (!result.ok) process.exitCode = 1;
67
+ return;
68
+ }
17
69
  if (action === 'doctor' && flag(args, '--deep')) {
18
70
  const result = { schema: 'sks.codex-lb-doctor.v1', deep: true, ...codexLbMetrics(await readCodexLbCircuit(root)) };
19
71
  if (flag(args, '--json')) return printJson(result);
@@ -42,6 +94,12 @@ export async function run(command, args = []) {
42
94
  console.log(`codex-lb circuit: ${circuit.state}`);
43
95
  return;
44
96
  }
45
- const legacy = await import('../cli/legacy-main.mjs');
46
- return legacy.main([command, ...args]);
97
+ if (action === 'proof-evidence') {
98
+ const result = await codexLbProofEvidence(root);
99
+ if (flag(args, '--json')) return printJson(result);
100
+ console.log(`codex-lb proof evidence: ${result.status}`);
101
+ return;
102
+ }
103
+ console.error('Usage: sks codex-lb status|metrics|doctor --deep|health|repair|release|unselect|setup|circuit reset|circuit record-fixture|proof-evidence [--json]');
104
+ process.exitCode = 1;
47
105
  }
@@ -0,0 +1,5 @@
1
+ import { commandsCommand } from '../core/commands/basic-cli.mjs';
2
+
3
+ export async function run(_command, args = []) {
4
+ return commandsCommand(args);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { simpleGitCommitCommand } from '../core/git-simple.mjs';
2
+
3
+ export async function run(_command, args = []) {
4
+ return simpleGitCommitCommand(args, { push: true });
5
+ }
@@ -0,0 +1,5 @@
1
+ import { simpleGitCommitCommand } from '../core/git-simple.mjs';
2
+
3
+ export async function run(_command, args = []) {
4
+ return simpleGitCommitCommand(args, { push: false });
5
+ }
@@ -0,0 +1,31 @@
1
+ import { projectRoot } from '../core/fsx.mjs';
2
+ import { findLatestMission } from '../core/mission.mjs';
3
+ import { flag } from '../cli/args.mjs';
4
+ import { printJson } from '../cli/output.mjs';
5
+ import { finalizeRouteWithProof } from '../core/proof/route-finalizer.mjs';
6
+
7
+ export async function run(command, args = []) {
8
+ const root = await projectRoot();
9
+ const missionArg = args.find((arg) => !String(arg).startsWith('--')) || 'latest';
10
+ const missionId = missionArg === 'latest' ? await findLatestMission(root) : missionArg;
11
+ if (!missionId) {
12
+ const result = { schema: 'sks.computer-use-evidence.v1', ok: false, status: 'missing_mission' };
13
+ if (flag(args, '--json')) return printJson(result);
14
+ console.error('No mission found.');
15
+ process.exitCode = 1;
16
+ return;
17
+ }
18
+ const route = command === 'cu' ? '$CU' : '$Computer-Use';
19
+ const proof = await finalizeRouteWithProof(root, {
20
+ missionId,
21
+ route,
22
+ mock: flag(args, '--mock'),
23
+ requireRelation: flag(args, '--fix-claim') || flag(args, '--require-relation'),
24
+ artifacts: ['computer-use-evidence-ledger.json', 'screen-capture-ledger.json', 'image-voxel-ledger.json', 'visual-anchors.json'],
25
+ claims: [{ id: 'computer-use-evidence', status: flag(args, '--mock') ? 'verified_partial' : 'supported' }]
26
+ });
27
+ const result = { schema: 'sks.computer-use-evidence.v1', ok: proof.ok, mission_id: missionId, route, proof: proof.validation };
28
+ if (flag(args, '--json')) return printJson(result);
29
+ console.log(`Computer Use evidence: ${proof.ok ? 'ok' : 'blocked'} ${missionId}`);
30
+ if (!proof.ok) process.exitCode = 1;
31
+ }
@@ -0,0 +1,13 @@
1
+ import { projectRoot } from '../core/fsx.mjs';
2
+ import { formatHarnessConflictReport, llmHarnessCleanupPrompt, scanHarnessConflicts } from '../core/harness-conflicts.mjs';
3
+ import { flag } from '../cli/args.mjs';
4
+ import { printJson } from '../cli/output.mjs';
5
+ export async function run(_command, args = []) {
6
+ const action = args[0] || 'check';
7
+ const scan = await scanHarnessConflicts(await projectRoot());
8
+ const result = { ...scan, cleanup_prompt: scan.hard_block ? llmHarnessCleanupPrompt(scan) : null };
9
+ if (flag(args, '--json')) return printJson(result);
10
+ if (action === 'prompt') return console.log(result.cleanup_prompt || '');
11
+ console.log(formatHarnessConflictReport(scan));
12
+ if (scan.hard_block) process.exitCode = 1;
13
+ }
@@ -0,0 +1,5 @@
1
+ import { context7Command } from '../cli/context7-command.mjs';
2
+ export async function run(_command, args = []) {
3
+ const [sub = 'check', ...rest] = args;
4
+ return context7Command(sub, rest);
5
+ }
@@ -1,4 +1,4 @@
1
- import { dbCommand } from '../cli/maintenance-commands.mjs';
1
+ import { dbCommand } from '../core/commands/route-cli.mjs';
2
2
 
3
3
  export async function run(_command, args = []) {
4
4
  const [sub = 'policy', ...rest] = args;
@@ -0,0 +1,5 @@
1
+ import { depsCommand } from '../core/commands/basic-cli.mjs';
2
+ export async function run(_command, args = []) {
3
+ const [sub = 'check', ...rest] = args;
4
+ return depsCommand(sub, rest);
5
+ }
@@ -0,0 +1,2 @@
1
+ import { dfixCommand } from '../core/commands/basic-cli.mjs';
2
+ export async function run() { return dfixCommand(); }
@@ -8,8 +8,8 @@ import { codexLbMetrics, readCodexLbCircuit } from '../core/codex-lb-circuit.mjs
8
8
 
9
9
  export async function run(_command, args = []) {
10
10
  if (flag(args, '--fix')) {
11
- const legacy = await import('../cli/legacy-main.mjs');
12
- return legacy.main(['doctor', ...args]);
11
+ const { setupCommand } = await import('../core/commands/basic-cli.mjs');
12
+ await setupCommand(['--force', '--local-only']);
13
13
  }
14
14
  const root = await projectRoot();
15
15
  const codex = await getCodexInfo().catch((err) => ({ available: false, error: err.message }));
@@ -0,0 +1,2 @@
1
+ import { dollarCommandsCommand } from '../core/commands/basic-cli.mjs';
2
+ export async function run(_command, args = []) { return dollarCommandsCommand(args); }
@@ -0,0 +1,5 @@
1
+ import { evalCommand } from '../core/commands/route-cli.mjs';
2
+ export async function run(_command, args = []) {
3
+ const [sub = 'run', ...rest] = args;
4
+ return evalCommand(sub, rest);
5
+ }
@@ -0,0 +1,2 @@
1
+ import { fixPathCommand } from '../core/commands/basic-cli.mjs';
2
+ export async function run(_command, args = []) { return fixPathCommand(args); }
@@ -0,0 +1,2 @@
1
+ import { gcCommand } from '../core/commands/route-cli.mjs';
2
+ export async function run(_command, args = []) { return gcCommand(args); }
@@ -0,0 +1,5 @@
1
+ import { goalCommand } from '../core/commands/route-cli.mjs';
2
+ export async function run(_command, args = []) {
3
+ const [sub, ...rest] = args;
4
+ return goalCommand(sub, rest);
5
+ }
@@ -0,0 +1,10 @@
1
+ import { projectRoot } from '../core/fsx.mjs';
2
+ import { harnessGuardStatus } from '../core/harness-guard.mjs';
3
+ import { flag } from '../cli/args.mjs';
4
+ import { printJson } from '../cli/output.mjs';
5
+ export async function run(_command, args = []) {
6
+ const result = await harnessGuardStatus(await projectRoot());
7
+ if (flag(args, '--json')) return printJson(result);
8
+ console.log(`Harness guard: ${result.ok ? 'ok' : 'blocked'}`);
9
+ if (!result.ok) process.exitCode = 1;
10
+ }
@@ -0,0 +1,5 @@
1
+ import { gxCommand } from '../core/commands/route-cli.mjs';
2
+ export async function run(_command, args = []) {
3
+ const [sub = 'validate', ...rest] = args;
4
+ return gxCommand(sub, rest);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { harnessCommand } from '../core/commands/route-cli.mjs';
2
+ export async function run(_command, args = []) {
3
+ const [sub = 'fixture', ...rest] = args;
4
+ return harnessCommand(sub, rest);
5
+ }