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,36 +0,0 @@
1
- /**
2
- * Detect whether a given host:port is already serving a codehere instance.
3
- *
4
- * Used by `codehere start` when the listen() fails with EADDRINUSE: we'd
5
- * rather give the user a friendly "codehere already running, opening browser"
6
- * than a Node stack trace. If something ELSE holds the port we tell them to
7
- * pick a different one.
8
- *
9
- * Approach: hit the existing server's /health endpoint. The codehere MCP
10
- * server returns a JSON body with `server: 'codehere-mcp'` — no other tool
11
- * uses that exact identifier. Generous 1.5-second timeout so a slow loopback
12
- * doesn't false-negative.
13
- */
14
- export async function isCodehereOnPort(host, port, timeoutMs = 1500) {
15
- const ac = new AbortController();
16
- const timer = setTimeout(() => ac.abort(), timeoutMs);
17
- try {
18
- const res = await fetch(`http://${host}:${port}/health`, { signal: ac.signal });
19
- if (!res.ok)
20
- return { isCodehere: false };
21
- const body = (await res.json());
22
- if (body?.server === 'codehere-mcp') {
23
- return { isCodehere: true, version: body.version };
24
- }
25
- return { isCodehere: false };
26
- }
27
- catch {
28
- // Connection refused, timeout, malformed response — anything that's not
29
- // a positive codehere identification. Treat as "not codehere."
30
- return { isCodehere: false };
31
- }
32
- finally {
33
- clearTimeout(timer);
34
- }
35
- }
36
- //# sourceMappingURL=probe-port.js.map
@@ -1,105 +0,0 @@
1
- /**
2
- * Thread phase classifier · the demo v12 lifecycle spine.
3
- *
4
- * A thread reads as a phased narrative (research → build → ship → audit → live).
5
- * Steps don't carry phase labels, so classify by the dominant signal in the
6
- * step LABEL (the output is noisy — agent names like "claude-code", file lists —
7
- * and misfires the keywords).
8
- *
9
- * This logic used to live inline in the ui-page-v2 template string, where it was
10
- * untestable — and a `\bcode\b` regex matched "claude-code" and mislabeled read
11
- * steps as BUILD (caught by eye, not a test). Extracted here so it's unit-tested,
12
- * and its SOURCE is injected back into the browser template via
13
- * PHASE_CLASSIFIER_SRC — one source of truth, not a duplicated twin.
14
- */
15
- export const PHASE_ORDER = ['research', 'build', 'ship', 'audit', 'live'];
16
- export const PHASE_META = {
17
- research: { n: 1, label: 'research', done: 'research locked', verb: 'explored' },
18
- build: { n: 2, label: 'build', done: 'build done', verb: 'built' },
19
- ship: { n: 3, label: 'ship', done: 'shipped', verb: 'tested & shipped' },
20
- audit: { n: 4, label: 'audit', done: 'audited', verb: 'reviewed' },
21
- live: { n: 5, label: 'live', done: 'live', verb: 'recovered' },
22
- };
23
- // Classify on the LABEL only · keep keywords action-specific, NOT domain words.
24
- // "rate-limit" is a FEATURE many tasks build — it must NOT signal LIVE, or every
25
- // rate-limit task mislabels its build steps as live. "claude-code" must NOT
26
- // match \bcode\b → that was the original bug.
27
- export function stepPhase(step) {
28
- const s = (step.label || '').toLowerCase();
29
- if (/failover|crashed|recover|orphan|hydrat|checkpoint|fell back|failed over/.test(s))
30
- return 'live';
31
- if (/verif|audit|final report|trust grade|claim vs|w-?pass|write-pass|chain entry/.test(s))
32
- return 'audit';
33
- if (/\btest\b|\btests\b|\bpush\b|commit|deploy|benchmark|\bship\b|\bmerge\b/.test(s))
34
- return 'ship';
35
- if (/\bedit\b|\bwrite\b|writes |writing|implement|refactor|patch|\bbuild\b|dispatch/.test(s))
36
- return 'build';
37
- if (/pre-prompt|scan|\bread\b|grep|search|analyz|research|context|\broute|explor|\bmap\b/.test(s))
38
- return 'research';
39
- return null;
40
- }
41
- // Assign every step a phase · unknown steps inherit the running phase so the
42
- // timeline never fragments. Phases only ADVANCE, never regress — once a task has
43
- // shipped, a stray "read" stays in ship rather than yanking the narrative back.
44
- // The regress check is against the OLD running phase, THEN advance.
45
- export function classifySteps(steps) {
46
- const out = [];
47
- let cur = 'research';
48
- for (let i = 0; i < steps.length; i++) {
49
- let p = stepPhase(steps[i]);
50
- if (!p)
51
- p = cur;
52
- if (PHASE_META[p].n < PHASE_META[cur].n)
53
- p = cur;
54
- cur = p;
55
- out.push(p);
56
- }
57
- return out;
58
- }
59
- /**
60
- * EMERGENT grouping for the unified thread timeline. A segment is a run of
61
- * CONSECUTIVE steps that share a phase — so the sections are however many the
62
- * actual activity produced, not a fixed pipeline. No monotonic advance, no
63
- * "phase N of 5", no forced final stage: a one-read task yields one segment, a
64
- * sprawling task yields several. Unknown steps inherit the running phase so a
65
- * stray unclassified step doesn't fragment a run; leading unknowns (before any
66
- * classified step) produce no segment.
67
- *
68
- * This replaces classifySteps' fixed-5 framing for the timeline. stepPhase (the
69
- * per-step activity classifier) is reused unchanged.
70
- */
71
- export function segmentSteps(steps) {
72
- const segs = [];
73
- let cur = null;
74
- for (let i = 0; i < steps.length; i++) {
75
- let p = stepPhase(steps[i]);
76
- if (!p)
77
- p = cur;
78
- if (!p)
79
- continue;
80
- if (p !== cur) {
81
- segs.push({ phase: p, verb: PHASE_META[p].verb, from: i, count: 1 });
82
- cur = p;
83
- }
84
- else {
85
- segs[segs.length - 1].count++;
86
- }
87
- }
88
- return segs;
89
- }
90
- /**
91
- * Browser-JS source for injection into the ui-page-v2 template literal. Emits
92
- * the same PHASE_META / stepPhase / segmentSteps the tests cover, so the
93
- * rendered thread uses the EXACT logic that's unit-tested. PHASE_ORDER +
94
- * classifySteps are still emitted during the timeline-restructure transition
95
- * (renderD's old phase-position line uses them); they go once renderD switches
96
- * to segmentSteps.
97
- */
98
- export const PHASE_CLASSIFIER_SRC = [
99
- 'var PHASE_ORDER=' + JSON.stringify(PHASE_ORDER) + ';',
100
- 'var PHASE_META=' + JSON.stringify(PHASE_META) + ';',
101
- stepPhase.toString(),
102
- classifySteps.toString(),
103
- segmentSteps.toString(),
104
- ].join('\n');
105
- //# sourceMappingURL=thread-phase.js.map