codehere 0.8.0 → 1.0.2

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 (119) hide show
  1. package/README.md +37 -184
  2. package/dist/application/use-cases/check-claimed-tests.js +81 -0
  3. package/dist/application/use-cases/detect-test-weakening.js +237 -0
  4. package/dist/application/use-cases/rerun-tests.js +329 -0
  5. package/dist/index.js +74 -1004
  6. package/dist/infrastructure/orchestration/artifacts-extractor.js +2 -265
  7. package/dist/presentation/cli/commands/check-command.js +251 -0
  8. package/dist/presentation/cli/commands/help-command.js +22 -286
  9. package/dist/ui.js +19 -438
  10. package/dist/utils/version.js +0 -12
  11. package/package.json +18 -27
  12. package/dist/application/use-cases/domain-trust.js +0 -110
  13. package/dist/application/use-cases/generate-final-report.js +0 -134
  14. package/dist/application/use-cases/generate-narration.js +0 -128
  15. package/dist/application/use-cases/generate-thread-title.js +0 -178
  16. package/dist/application/use-cases/narrator-prompt-template.js +0 -158
  17. package/dist/application/use-cases/thread-export.js +0 -155
  18. package/dist/application/use-cases/verify-claim.js +0 -274
  19. package/dist/application/use-cases/write-pass.js +0 -277
  20. package/dist/domain/entities/task.js +0 -61
  21. package/dist/domain/services/codebase-detector.js +0 -91
  22. package/dist/error-handler.js +0 -251
  23. package/dist/infrastructure/completion/bash-completion.js +0 -25
  24. package/dist/infrastructure/completion/fish-completion.js +0 -22
  25. package/dist/infrastructure/completion/zsh-completion.js +0 -30
  26. package/dist/infrastructure/config/config-manager.js +0 -173
  27. package/dist/infrastructure/config/product-context.js +0 -67
  28. package/dist/infrastructure/context/adapters/drawio-source.js +0 -157
  29. package/dist/infrastructure/context/adapters/figma-source.js +0 -163
  30. package/dist/infrastructure/context/adapters/github-issue-source.js +0 -159
  31. package/dist/infrastructure/context/adapters/linear-source.js +0 -190
  32. package/dist/infrastructure/context/context-resolver.js +0 -144
  33. package/dist/infrastructure/context/context-source.js +0 -114
  34. package/dist/infrastructure/context/oauth-flow.js +0 -207
  35. package/dist/infrastructure/context/oauth-store.js +0 -119
  36. package/dist/infrastructure/context/registry-bootstrap.js +0 -99
  37. package/dist/infrastructure/context/write-pass-resolver.js +0 -106
  38. package/dist/infrastructure/cost/budget-config.js +0 -113
  39. package/dist/infrastructure/cost/cost-router.js +0 -104
  40. package/dist/infrastructure/cost/spend-aggregator.js +0 -147
  41. package/dist/infrastructure/hooks/claude-sdk-hook.js +0 -888
  42. package/dist/infrastructure/hooks/hook-mode.js +0 -71
  43. package/dist/infrastructure/hooks/mirror-tool-call-to-audit.js +0 -43
  44. package/dist/infrastructure/hooks/pre-prompt-scan.js +0 -122
  45. package/dist/infrastructure/hooks/session-analyzer.js +0 -177
  46. package/dist/infrastructure/observability/execution-tracer.js +0 -227
  47. package/dist/infrastructure/orchestration/agent-adapter.js +0 -13
  48. package/dist/infrastructure/orchestration/agent-installer.js +0 -101
  49. package/dist/infrastructure/orchestration/agents-config-seed.js +0 -56
  50. package/dist/infrastructure/orchestration/aider-adapter.js +0 -447
  51. package/dist/infrastructure/orchestration/cassette-recorder.js +0 -120
  52. package/dist/infrastructure/orchestration/claude-code-adapter.js +0 -478
  53. package/dist/infrastructure/orchestration/codex-adapter.js +0 -538
  54. package/dist/infrastructure/orchestration/conductor-adapter.js +0 -377
  55. package/dist/infrastructure/orchestration/context-handoff.js +0 -144
  56. package/dist/infrastructure/orchestration/control/codex-control-surface.js +0 -99
  57. package/dist/infrastructure/orchestration/control/control-surface.js +0 -15
  58. package/dist/infrastructure/orchestration/failover-classifier.js +0 -151
  59. package/dist/infrastructure/orchestration/failover-config.js +0 -77
  60. package/dist/infrastructure/orchestration/failover-policy.js +0 -106
  61. package/dist/infrastructure/orchestration/gemini-adapter.js +0 -583
  62. package/dist/infrastructure/orchestration/generic-cli-adapter.js +0 -558
  63. package/dist/infrastructure/orchestration/graphify-context.js +0 -254
  64. package/dist/infrastructure/orchestration/memory-injector.js +0 -380
  65. package/dist/infrastructure/orchestration/mocks/mock-agent-repl.js +0 -233
  66. package/dist/infrastructure/orchestration/mocks/mock-codex-app-server.js +0 -73
  67. package/dist/infrastructure/orchestration/mocks/mock-synthesis.js +0 -83
  68. package/dist/infrastructure/orchestration/mocks/resolve-agent-spawn.js +0 -37
  69. package/dist/infrastructure/orchestration/opencode-adapter.js +0 -510
  70. package/dist/infrastructure/orchestration/progress-aggregator.js +0 -689
  71. package/dist/infrastructure/orchestration/readiness.js +0 -103
  72. package/dist/infrastructure/orchestration/session-manager.js +0 -1091
  73. package/dist/infrastructure/orchestration/session-persistence.js +0 -258
  74. package/dist/infrastructure/orchestration/thread-key-store.js +0 -127
  75. package/dist/infrastructure/orchestration/write-pass-store.js +0 -46
  76. package/dist/infrastructure/protocols/cloud-sync.js +0 -207
  77. package/dist/infrastructure/protocols/mcp-helpers.js +0 -25
  78. package/dist/infrastructure/protocols/mcp-server-impl.js +0 -2853
  79. package/dist/infrastructure/protocols/probe-port.js +0 -36
  80. package/dist/infrastructure/protocols/thread-phase.js +0 -105
  81. package/dist/infrastructure/protocols/ui-page-v2.js +0 -4418
  82. package/dist/infrastructure/protocols/ui-page.js +0 -2377
  83. package/dist/infrastructure/protocols/verify-page.js +0 -983
  84. package/dist/infrastructure/security/file-collection.js +0 -118
  85. package/dist/infrastructure/security/input-validator.js +0 -152
  86. package/dist/infrastructure/security/permissions-config.js +0 -234
  87. package/dist/infrastructure/security/trust-scorer.js +0 -657
  88. package/dist/infrastructure/storage/cross-tool-agents.js +0 -268
  89. package/dist/infrastructure/storage/embeddings-path.js +0 -37
  90. package/dist/infrastructure/storage/project-thread-migration.js +0 -237
  91. package/dist/infrastructure/storage/project-thread-mirror.js +0 -524
  92. package/dist/infrastructure/storage/project-thread-reader.js +0 -172
  93. package/dist/infrastructure/storage/project-thread-title-backfill.js +0 -214
  94. package/dist/infrastructure/storage/task-repository.js +0 -206
  95. package/dist/monitoring.js +0 -212
  96. package/dist/presentation/cli/commands/audit-command.js +0 -126
  97. package/dist/presentation/cli/commands/budget-command.js +0 -79
  98. package/dist/presentation/cli/commands/config-command.js +0 -125
  99. package/dist/presentation/cli/commands/context-source-command.js +0 -198
  100. package/dist/presentation/cli/commands/hook-command.js +0 -265
  101. package/dist/presentation/cli/commands/init-command.js +0 -578
  102. package/dist/presentation/cli/commands/memory-command.js +0 -1031
  103. package/dist/presentation/cli/commands/narrator-command.js +0 -101
  104. package/dist/presentation/cli/commands/permission-command.js +0 -116
  105. package/dist/presentation/cli/commands/protocols-builder.js +0 -254
  106. package/dist/presentation/cli/commands/protocols-command.js +0 -84
  107. package/dist/presentation/cli/commands/repo-map-builder.js +0 -247
  108. package/dist/presentation/cli/commands/report-command.js +0 -387
  109. package/dist/presentation/cli/commands/scan-tool-command.js +0 -94
  110. package/dist/presentation/cli/commands/setup-command.js +0 -307
  111. package/dist/presentation/cli/commands/status-command.js +0 -661
  112. package/dist/presentation/cli/commands/thread-command.js +0 -288
  113. package/dist/presentation/cli/commands/trust-command.js +0 -306
  114. package/dist/presentation/cli/commands/verify-command.js +0 -233
  115. package/dist/presentation/cli/error-display.js +0 -336
  116. package/dist/presentation/cli/repl.js +0 -797
  117. package/dist/presentation/cli/task-deliverable.js +0 -127
  118. package/dist/testing/cassette.js +0 -125
  119. package/dist/testing/replay-adapter.js +0 -166
@@ -1,275 +1,44 @@
1
1
  /**
2
2
  * Help Command
3
- * Provides contextual help for Codehere commands
3
+ * Contextual help for the commands codehere ships: check and help.
4
4
  */
5
5
  import { colors, newline } from '../../../ui.js';
6
6
  const COMMAND_INFO = {
7
- // === Delegate (the v0.3 PM surface) ===
8
- start: {
9
- name: 'start',
10
- description: 'Open the task intake web UI at http://127.0.0.1:3773',
11
- usage: 'codehere start [options]',
12
- examples: ['codehere start', 'codehere start --port 3773', 'codehere start --no-open'],
13
- options: [
14
- { flag: '--port <n>', description: 'Port for the local UI (default: 3773)' },
15
- { flag: '--no-open', description: "Don't auto-open the browser" },
16
- ],
17
- related: ['task', 'kill', 'status'],
18
- },
19
- task: {
20
- name: 'task',
21
- description: 'Spawn a task from the CLI (requires `codehere start` running)',
22
- usage: 'codehere task <prompt> [options]',
23
- examples: [
24
- 'codehere task "review src/auth.ts for SQL injection"',
25
- 'codehere task "add JSDoc to all exports" --agent codex',
26
- ],
27
- options: [
28
- { flag: '--agent <id>', description: 'Agent ID: claude-code | codex | aider | opencode' },
29
- { flag: '--cwd <path>', description: 'Absolute working directory for the agent' },
30
- ],
31
- related: ['start', 'kill'],
32
- },
33
- kill: {
34
- name: 'kill',
35
- description: 'Terminate a running task session',
36
- usage: 'codehere kill <sessionId>',
37
- examples: ['codehere kill abc123de-...'],
38
- related: ['task', 'status'],
39
- },
40
- // === Safety & Trust (no API key, no agents needed) ===
41
- hook: {
42
- name: 'hook',
43
- description: 'Install, manage, and monitor the safety hook for Claude Code',
44
- usage: 'codehere hook <action>',
45
- examples: ['codehere hook install', 'codehere hook status', 'codehere hook log', 'codehere hook uninstall'],
46
- related: ['trust', 'status'],
47
- },
48
- trust: {
49
- name: 'trust',
50
- description: 'Scan your project for security issues — instant score, no API key needed',
51
- usage: 'codehere trust [path] [options]',
52
- examples: [
53
- 'codehere trust .',
54
- 'codehere trust src/api/',
55
- 'codehere trust --json',
56
- 'codehere trust --ci',
57
- 'codehere trust --badge',
58
- ],
59
- options: [
60
- { flag: '--json', description: 'Output results as JSON' },
61
- { flag: '--ci', description: 'Exit 1 if score drops below threshold' },
62
- { flag: '--badge', description: 'Generate a shields.io badge for your README' },
63
- ],
64
- related: ['report', 'hook'],
65
- },
66
- report: {
67
- name: 'report',
68
- description: 'Generate a shareable markdown audit report',
69
- usage: 'codehere report [options]',
70
- examples: [
71
- 'codehere report',
72
- 'codehere report --simple',
73
- 'codehere report --json',
74
- 'codehere report --out audit.md',
75
- ],
76
- options: [
77
- { flag: '--simple', description: 'Plain English report for non-technical readers' },
78
- { flag: '--json', description: 'Machine-readable JSON output' },
79
- { flag: '--out <file>', description: 'Write report to a file' },
80
- ],
81
- related: ['trust', 'status'],
82
- },
83
- status: {
84
- name: 'status',
85
- description: 'Dashboard — sessions, blocked calls, audit trends',
86
- usage: 'codehere status [options]',
87
- examples: ['codehere status', 'codehere status --sessions', 'codehere status --weekly', 'codehere status --json'],
88
- options: [
89
- { flag: '--sessions', description: 'Show session breakdown with risk levels' },
90
- { flag: '--weekly', description: '7-day shareable agent-activity recap' },
91
- { flag: '--json', description: 'Output as JSON' },
92
- { flag: '--export <fmt>', description: 'Export raw audit feed (jsonl, json, csv, md)' },
93
- ],
94
- related: ['hook', 'trust', 'verify'],
95
- },
96
- verify: {
97
- name: 'verify',
98
- description: "Verify a session's Final Report against the recorded reality (catches optimistic claims)",
99
- usage: 'codehere verify [session-id] [options]',
100
- examples: ['codehere verify', 'codehere verify a1b2c3d4', 'codehere verify a1b2c3d4 --json'],
101
- options: [{ flag: '--json', description: 'Machine-readable verdict for CI' }],
102
- related: ['status', 'report', 'audit'],
103
- },
104
- audit: {
105
- name: 'audit',
106
- description: 'Inspect the hash-chained audit log · verify integrity or show one entry',
107
- usage: 'codehere audit [verify|show <seq>] [options]',
108
- examples: ['codehere audit', 'codehere audit verify', 'codehere audit verify --json', 'codehere audit show 42'],
109
- options: [{ flag: '--json', description: 'Machine-readable output' }],
110
- related: ['status', 'verify', 'hook'],
111
- },
112
- 'context-source': {
113
- name: 'context-source',
114
- description: 'Connect external tools (Linear, Figma) via OAuth · list status · disconnect',
115
- usage: 'codehere context-source [list|connect <provider>|disconnect <provider>]',
116
- examples: [
117
- 'codehere context-source list',
118
- 'codehere context-source connect linear',
119
- 'codehere context-source connect figma --no-open',
120
- 'codehere context-source disconnect linear',
121
- ],
122
- options: [
123
- { flag: '--json', description: 'Machine-readable output' },
124
- { flag: '--no-open', description: 'For connect: print URL but skip auto-opening the browser' },
125
- ],
126
- related: ['serve', 'start'],
127
- },
128
- thread: {
129
- name: 'thread',
130
- description: 'Share or import a signed session bundle · local-first, no relay',
131
- usage: 'codehere thread <export|import|keys|trust|untrust> [args] [options]',
7
+ check: {
8
+ name: 'check',
9
+ description: 'Re-run your tests and report what actually passed',
10
+ usage: 'codehere check [target] [options]',
132
11
  examples: [
133
- 'codehere thread export <session-id> --out my-task.codehere.json',
134
- 'codehere thread import my-task.codehere.json',
135
- 'codehere thread import my-task.codehere.json --trust',
136
- 'codehere thread keys',
137
- 'codehere thread trust <pubkey-b64> "alice@laptop"',
12
+ 'codehere check',
13
+ 'codehere check --base origin/main',
14
+ 'codehere check --claim "added tests, all pass"',
15
+ 'codehere check --proof',
138
16
  ],
139
17
  options: [
140
- { flag: '--out <file>', description: 'For export: write to file (otherwise stdout)' },
141
- { flag: '--trust', description: 'For import: trust the signer key then proceed' },
142
18
  { flag: '--json', description: 'Machine-readable output' },
19
+ { flag: '--proof', description: 'Paste-ready proof block for a pull request' },
20
+ { flag: '--claim <text>', description: "The AI's summary: test files it names that do not exist are flagged" },
21
+ { flag: '--base <ref>', description: 'Look for weakened tests in everything since this branch left <ref>' },
143
22
  ],
144
- related: ['start', 'verify'],
145
- },
146
- serve: {
147
- name: 'serve',
148
- description: 'Start codehere as an MCP server (Claude Desktop, Cursor, Zed, etc.)',
149
- usage: 'codehere serve [options]',
150
- examples: ['codehere serve', 'codehere serve --show-config', 'codehere serve --port 8080'],
151
- options: [
152
- { flag: '--show-config', description: 'Print MCP config for Claude Desktop or Cursor' },
153
- { flag: '--port <n>', description: 'Port (default: 3773)' },
154
- ],
155
- related: ['hook'],
156
- },
157
- // === Configuration ===
158
- setup: {
159
- name: 'setup',
160
- description: 'Interactive first-run setup wizard',
161
- usage: 'codehere setup [options]',
162
- examples: ['codehere setup', 'codehere setup --force'],
163
- options: [{ flag: '--force, -f', description: 'Force reconfiguration' }],
164
- related: ['config', 'hook'],
165
- },
166
- config: {
167
- name: 'config',
168
- description: 'Manage configuration and preferences',
169
- usage: 'codehere config [action] [key] [value]',
170
- examples: ['codehere config', 'codehere config set temperature 0.5'],
171
- related: ['setup'],
172
23
  },
173
- health: {
174
- name: 'health',
175
- description: 'System health check — filesystem, memory, audit log accessible',
176
- usage: 'codehere health [options]',
177
- examples: ['codehere health', 'codehere health --json'],
178
- options: [{ flag: '--json', description: 'Output as JSON' }],
179
- related: ['status'],
180
- },
181
- completion: {
182
- name: 'completion',
183
- description: 'Generate bash, zsh, or fish completion script',
184
- usage: 'codehere completion <shell>',
185
- examples: [
186
- 'codehere completion bash >> ~/.bashrc',
187
- 'codehere completion zsh > /usr/local/share/zsh/site-functions/_codehere',
188
- 'codehere completion fish > ~/.config/fish/completions/codehere.fish',
189
- ],
190
- related: [],
24
+ help: {
25
+ name: 'help',
26
+ description: 'Show help for commands',
27
+ usage: 'codehere help [command]',
28
+ examples: ['codehere help', 'codehere help check'],
191
29
  },
192
30
  };
193
- const ALL_COMMANDS = Object.keys(COMMAND_INFO);
194
- /**
195
- * Find similar commands (for typo detection)
196
- */
197
- function findSimilarCommands(input, maxResults = 3) {
198
- const lowerInput = input.toLowerCase();
199
- // Exact match
200
- if (COMMAND_INFO[lowerInput]) {
201
- return [lowerInput];
202
- }
203
- // Calculate similarity scores
204
- const scores = ALL_COMMANDS.map((cmd) => {
205
- const lowerCmd = cmd.toLowerCase();
206
- // Exact substring match
207
- if (lowerCmd.includes(lowerInput) || lowerInput.includes(lowerCmd)) {
208
- return { cmd, score: 10 };
209
- }
210
- // Levenshtein distance (simple)
211
- const distance = levenshteinDistance(lowerInput, lowerCmd);
212
- const maxLen = Math.max(lowerInput.length, lowerCmd.length);
213
- const similarity = (maxLen - distance) / maxLen;
214
- return { cmd, score: similarity * 5 };
215
- });
216
- // Sort by score and return top matches
217
- return scores
218
- .filter((s) => s.score > 0.3)
219
- .sort((a, b) => b.score - a.score)
220
- .slice(0, maxResults)
221
- .map((s) => s.cmd);
222
- }
223
- /**
224
- * Simple Levenshtein distance calculation
225
- */
226
- function levenshteinDistance(str1, str2) {
227
- const m = str1.length;
228
- const n = str2.length;
229
- const dp = Array(m + 1)
230
- .fill(null)
231
- .map(() => Array(n + 1).fill(0));
232
- for (let i = 0; i <= m; i++)
233
- dp[i][0] = i;
234
- for (let j = 0; j <= n; j++)
235
- dp[0][j] = j;
236
- for (let i = 1; i <= m; i++) {
237
- for (let j = 1; j <= n; j++) {
238
- if (str1[i - 1] === str2[j - 1]) {
239
- dp[i][j] = dp[i - 1][j - 1];
240
- }
241
- else {
242
- dp[i][j] = Math.min(dp[i - 1][j] + 1, // deletion
243
- dp[i][j - 1] + 1, // insertion
244
- dp[i - 1][j - 1] + 1);
245
- }
246
- }
247
- }
248
- return dp[m][n];
249
- }
250
- /**
251
- * Display help for a specific command
252
- */
253
31
  function displayCommandHelp(commandName) {
254
32
  const command = COMMAND_INFO[commandName.toLowerCase()];
255
33
  if (!command) {
256
- const suggestions = findSimilarCommands(commandName);
257
34
  newline();
258
35
  console.error(colors.red(`Command '${commandName}' not found.`));
259
- if (suggestions.length > 0) {
260
- newline();
261
- console.log(colors.bold('Did you mean:'));
262
- suggestions.forEach((cmd) => {
263
- console.log(` ${colors.cyan(`codehere help ${cmd}`)}`);
264
- });
265
- newline();
266
- }
267
36
  console.log(colors.dim('Run') + ' ' + colors.cyan('codehere --help') + ' ' + colors.dim('to see all commands.'));
268
37
  newline();
269
38
  return;
270
39
  }
271
40
  newline();
272
- console.log(colors.bold(command.name) + colors.dim(' — ' + command.description));
41
+ console.log(colors.bold(command.name) + colors.dim(' · ' + command.description));
273
42
  newline();
274
43
  console.log(colors.bold('Usage'));
275
44
  console.log(' ' + colors.cyan(command.usage));
@@ -286,50 +55,17 @@ function displayCommandHelp(commandName) {
286
55
  });
287
56
  newline();
288
57
  }
289
- if (command.related && command.related.length > 0) {
290
- console.log(colors.bold('Related'));
291
- command.related.forEach((related) => {
292
- console.log(' ' + colors.cyan(`codehere help ${related}`));
293
- });
294
- newline();
295
- }
296
- }
297
- /**
298
- * Display general help (all commands overview)
299
- */
300
- function printCmd(name, desc) {
301
- console.log(' ' + colors.cyan(name.padEnd(14)) + colors.dim(desc));
302
58
  }
303
59
  function displayGeneralHelp() {
304
60
  newline();
305
- console.log(colors.bold('codehere') + colors.dim(' — A PM for your AI coding agents'));
61
+ console.log(colors.bold('codehere') + colors.dim(' · re-run the tests an AI says passed'));
306
62
  newline();
307
- console.log(colors.bold('Delegate'));
308
- for (const cmd of ['start', 'task', 'kill']) {
309
- printCmd(cmd, COMMAND_INFO[cmd].description);
310
- }
311
- newline();
312
- console.log(colors.bold('Safety & Trust') + colors.dim(' (no API key, no agents needed)'));
313
- for (const cmd of ['hook', 'trust', 'report', 'status', 'serve']) {
314
- printCmd(cmd, COMMAND_INFO[cmd].description);
315
- }
316
- newline();
317
- console.log(colors.bold('Configuration'));
318
- for (const cmd of ['setup', 'config', 'health', 'completion']) {
319
- printCmd(cmd, COMMAND_INFO[cmd].description);
320
- }
321
- newline();
322
- console.log(colors.bold('Getting Started'));
323
- console.log(colors.dim(' 1. ') + colors.cyan('codehere start') + colors.dim(' Open the task intake at :3773'));
324
- console.log(colors.dim(' 2. ') + colors.cyan('codehere hook install') + colors.dim(' Audit every Claude Code action'));
325
- console.log(colors.dim(' 3. ') + colors.cyan('codehere trust .') + colors.dim(' Scan your project (no API key)'));
63
+ console.log(colors.bold('Check'));
64
+ console.log(' ' + colors.cyan('check'.padEnd(14)) + colors.dim('Re-run your tests and report what actually passed'));
326
65
  newline();
327
- console.log(colors.dim('Run ') + colors.cyan('codehere help <command>') + colors.dim(' for details on any command.'));
66
+ console.log(colors.dim('Run ') + colors.cyan('codehere help check') + colors.dim(' for its options.'));
328
67
  newline();
329
68
  }
330
- /**
331
- * Execute help command
332
- */
333
69
  export async function executeHelpCommand(commandName) {
334
70
  if (commandName) {
335
71
  displayCommandHelp(commandName);