@cluesmith/codev 2.0.0-rc.58 → 2.0.0-rc.59

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 (46) hide show
  1. package/dashboard/dist/assets/index-CXloFYpB.css +32 -0
  2. package/dashboard/dist/assets/{index-BEs2fHhy.js → index-Ca2fjOJf.js} +24 -24
  3. package/dashboard/dist/assets/{index-BEs2fHhy.js.map → index-Ca2fjOJf.js.map} +1 -1
  4. package/dashboard/dist/index.html +2 -2
  5. package/dist/agent-farm/commands/spawn.js +1 -1
  6. package/dist/agent-farm/commands/spawn.js.map +1 -1
  7. package/dist/agent-farm/servers/tower-server.js +56 -9
  8. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +2 -0
  11. package/dist/cli.js.map +1 -1
  12. package/dist/commands/consult/index.d.ts +1 -0
  13. package/dist/commands/consult/index.d.ts.map +1 -1
  14. package/dist/commands/consult/index.js +23 -4
  15. package/dist/commands/consult/index.js.map +1 -1
  16. package/dist/commands/porch/checks.d.ts +3 -2
  17. package/dist/commands/porch/checks.d.ts.map +1 -1
  18. package/dist/commands/porch/checks.js +8 -2
  19. package/dist/commands/porch/checks.js.map +1 -1
  20. package/dist/commands/porch/index.d.ts.map +1 -1
  21. package/dist/commands/porch/index.js +21 -23
  22. package/dist/commands/porch/index.js.map +1 -1
  23. package/dist/commands/porch/next.d.ts +22 -0
  24. package/dist/commands/porch/next.d.ts.map +1 -0
  25. package/dist/commands/porch/next.js +475 -0
  26. package/dist/commands/porch/next.js.map +1 -0
  27. package/dist/commands/porch/protocol.d.ts +3 -3
  28. package/dist/commands/porch/protocol.d.ts.map +1 -1
  29. package/dist/commands/porch/protocol.js +14 -5
  30. package/dist/commands/porch/protocol.js.map +1 -1
  31. package/dist/commands/porch/types.d.ts +36 -1
  32. package/dist/commands/porch/types.d.ts.map +1 -1
  33. package/dist/commands/porch/verdict.d.ts +31 -0
  34. package/dist/commands/porch/verdict.d.ts.map +1 -0
  35. package/dist/commands/porch/verdict.js +59 -0
  36. package/dist/commands/porch/verdict.js.map +1 -0
  37. package/package.json +3 -3
  38. package/dashboard/dist/assets/index-BV7KQvFU.css +0 -32
  39. package/dist/commands/porch/claude.d.ts +0 -27
  40. package/dist/commands/porch/claude.d.ts.map +0 -1
  41. package/dist/commands/porch/claude.js +0 -107
  42. package/dist/commands/porch/claude.js.map +0 -1
  43. package/dist/commands/porch/run.d.ts +0 -40
  44. package/dist/commands/porch/run.d.ts.map +0 -1
  45. package/dist/commands/porch/run.js +0 -893
  46. package/dist/commands/porch/run.js.map +0 -1
@@ -41,6 +41,13 @@ export interface ProtocolPhase {
41
41
  checks?: string[];
42
42
  next?: string | null;
43
43
  }
44
+ /**
45
+ * Check definition with optional working directory
46
+ */
47
+ export interface CheckDef {
48
+ command: string;
49
+ cwd?: string;
50
+ }
44
51
  /**
45
52
  * Protocol definition (loaded from protocol.json)
46
53
  */
@@ -49,7 +56,7 @@ export interface Protocol {
49
56
  version?: string;
50
57
  description?: string;
51
58
  phases: ProtocolPhase[];
52
- checks?: Record<string, string>;
59
+ checks?: Record<string, CheckDef>;
53
60
  phase_completion?: Record<string, string>;
54
61
  }
55
62
  /**
@@ -117,6 +124,34 @@ export interface ProjectState {
117
124
  started_at: string;
118
125
  updated_at: string;
119
126
  }
127
+ /**
128
+ * Response from `porch next <id>`.
129
+ * Tells the builder what to do next.
130
+ */
131
+ export interface PorchNextResponse {
132
+ status: 'tasks' | 'gate_pending' | 'complete' | 'error';
133
+ phase: string;
134
+ iteration: number;
135
+ plan_phase?: string;
136
+ /** Present when status === 'tasks' or 'gate_pending' (gate tasks are actionable) */
137
+ tasks?: PorchTask[];
138
+ /** Present when status === 'gate_pending' */
139
+ gate?: string;
140
+ /** Present when status === 'error' */
141
+ error?: string;
142
+ /** Present when status === 'complete' */
143
+ summary?: string;
144
+ }
145
+ /**
146
+ * A task for the builder to execute.
147
+ * Claude Code creates these via TaskCreate.
148
+ */
149
+ export interface PorchTask {
150
+ subject: string;
151
+ activeForm: string;
152
+ description: string;
153
+ sequential?: boolean;
154
+ }
120
155
  /**
121
156
  * Result of running a check
122
157
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/porch/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,cAAc,CAAC;IAClD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,MAAM,CAA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AAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAMD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Verdict parsing for porch consultation reviews.
3
+ *
4
+ * Extracted from run.ts so it can be shared by next.ts.
5
+ */
6
+ import type { Verdict, ReviewResult } from './types.js';
7
+ /**
8
+ * Parse verdict from consultation output.
9
+ *
10
+ * Looks for the verdict line in format:
11
+ * VERDICT: APPROVE
12
+ * VERDICT: REQUEST_CHANGES
13
+ * VERDICT: COMMENT
14
+ *
15
+ * Also handles markdown formatting like:
16
+ * **VERDICT: APPROVE**
17
+ * *VERDICT: APPROVE*
18
+ *
19
+ * Safety: If no explicit verdict found (empty output, crash, malformed),
20
+ * defaults to REQUEST_CHANGES to prevent proceeding with unverified code.
21
+ */
22
+ export declare function parseVerdict(output: string): Verdict;
23
+ /**
24
+ * Check if all reviewers approved (unanimity required).
25
+ *
26
+ * Returns true only if ALL reviewers explicitly APPROVE.
27
+ * COMMENT counts as approve (non-blocking feedback).
28
+ * CONSULT_ERROR and REQUEST_CHANGES block approval.
29
+ */
30
+ export declare function allApprove(reviews: ReviewResult[]): boolean;
31
+ //# sourceMappingURL=verdict.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../../../src/commands/porch/verdict.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAwBpD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAG3D"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Verdict parsing for porch consultation reviews.
3
+ *
4
+ * Extracted from run.ts so it can be shared by next.ts.
5
+ */
6
+ /**
7
+ * Parse verdict from consultation output.
8
+ *
9
+ * Looks for the verdict line in format:
10
+ * VERDICT: APPROVE
11
+ * VERDICT: REQUEST_CHANGES
12
+ * VERDICT: COMMENT
13
+ *
14
+ * Also handles markdown formatting like:
15
+ * **VERDICT: APPROVE**
16
+ * *VERDICT: APPROVE*
17
+ *
18
+ * Safety: If no explicit verdict found (empty output, crash, malformed),
19
+ * defaults to REQUEST_CHANGES to prevent proceeding with unverified code.
20
+ */
21
+ export function parseVerdict(output) {
22
+ // Empty or very short output = something went wrong
23
+ if (!output || output.trim().length < 50) {
24
+ return 'REQUEST_CHANGES';
25
+ }
26
+ // Scan lines LAST→FIRST so the actual verdict (at the end) takes priority
27
+ // over template text echoed by codex CLI at the start of output.
28
+ // Skip template lines containing "[" (e.g., "VERDICT: [APPROVE | REQUEST_CHANGES | COMMENT]")
29
+ const lines = output.split('\n');
30
+ for (let i = lines.length - 1; i >= 0; i--) {
31
+ // Strip markdown formatting (**, *, __, _, `) and trim
32
+ const stripped = lines[i].trim().replace(/^[\*_`-]+|[\*_`-]+$/g, '').trim().toUpperCase();
33
+ // Match "VERDICT: <value>" but NOT template "VERDICT: [APPROVE | ...]"
34
+ if (stripped.startsWith('VERDICT:') && !stripped.includes('[')) {
35
+ const value = stripped.substring('VERDICT:'.length).trim();
36
+ if (value.startsWith('REQUEST_CHANGES'))
37
+ return 'REQUEST_CHANGES';
38
+ if (value.startsWith('APPROVE'))
39
+ return 'APPROVE';
40
+ if (value.startsWith('COMMENT'))
41
+ return 'COMMENT';
42
+ }
43
+ }
44
+ // No valid VERDICT: line found — default to REQUEST_CHANGES for safety
45
+ return 'REQUEST_CHANGES';
46
+ }
47
+ /**
48
+ * Check if all reviewers approved (unanimity required).
49
+ *
50
+ * Returns true only if ALL reviewers explicitly APPROVE.
51
+ * COMMENT counts as approve (non-blocking feedback).
52
+ * CONSULT_ERROR and REQUEST_CHANGES block approval.
53
+ */
54
+ export function allApprove(reviews) {
55
+ if (reviews.length === 0)
56
+ return true; // No verification = auto-approve
57
+ return reviews.every(r => r.verdict === 'APPROVE' || r.verdict === 'COMMENT');
58
+ }
59
+ //# sourceMappingURL=verdict.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verdict.js","sourceRoot":"","sources":["../../../src/commands/porch/verdict.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,oDAAoD;IACpD,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACzC,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,0EAA0E;IAC1E,iEAAiE;IACjE,8FAA8F;IAC9F,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,uDAAuD;QACvD,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC1F,uEAAuE;QACvE,IAAI,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/D,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;YAC3D,IAAI,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC;gBAAE,OAAO,iBAAiB,CAAC;YAClE,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;gBAAE,OAAO,SAAS,CAAC;YAClD,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;gBAAE,OAAO,SAAS,CAAC;QACpD,CAAC;IACH,CAAC;IAED,uEAAuE;IACvE,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAAuB;IAChD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,iCAAiC;IACxE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;AAChF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cluesmith/codev",
3
- "version": "2.0.0-rc.58",
3
+ "version": "2.0.0-rc.59",
4
4
  "description": "Codev CLI - AI-assisted software development framework",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,12 +29,11 @@
29
29
  "test:e2e": "npm run build && vitest run --config vitest.e2e.config.ts",
30
30
  "test:e2e:watch": "vitest --config vitest.e2e.config.ts",
31
31
  "test:e2e:playwright": "npx playwright test",
32
- "test:e2e:bats": "npm run build && npm pack && E2E_TARBALL=$(ls cluesmith-codev-*.tgz | tail -1) ../../tests/lib/bats-core/bin/bats ../../tests/e2e/",
32
+ "test:e2e:cli": "npm run build && vitest run --config vitest.cli.config.ts",
33
33
  "postinstall": "node -e \"try{require('fs').chmodSync(require('path').join(require.resolve('node-pty'),'..','..','prebuilds',process.platform+'-'+process.arch,'spawn-helper'),0o755)}catch{}\"",
34
34
  "prepublishOnly": "npm run build"
35
35
  },
36
36
  "dependencies": {
37
- "@anthropic-ai/claude-agent-sdk": "^0.2.25",
38
37
  "@google/genai": "^1.0.0",
39
38
  "better-sqlite3": "^12.5.0",
40
39
  "chalk": "^5.3.0",
@@ -52,6 +51,7 @@
52
51
  "@types/js-yaml": "^4.0.9",
53
52
  "@types/node": "^22.10.1",
54
53
  "@types/ws": "^8.18.1",
54
+ "@vitest/coverage-v8": "^4.0.18",
55
55
  "playwright": "^1.58.0",
56
56
  "tsx": "^4.19.2",
57
57
  "typescript": "^5.7.2",
@@ -1,32 +0,0 @@
1
- /**
2
- * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
- * https://github.com/chjj/term.js
5
- * @license MIT
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in
15
- * all copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- *
25
- * Originally forked from (with the author's permission):
26
- * Fabrice Bellard's javascript vt100 for jslinux:
27
- * http://bellard.org/jslinux/
28
- * Copyright (c) 2011 Fabrice Bellard
29
- * The original design remains. The terminal itself
30
- * has been extended to include xterm CSI codes, among
31
- * other features.
32
- */.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}:root{--bg-primary: #1a1a1a;--bg-secondary: #252525;--bg-tertiary: #2a2a2a;--bg-hover: #333333;--text-primary: #e0e0e0;--text-secondary: #a0a0a0;--text-muted: #666666;--border-color: #333333;--accent: #3b82f6;--accent-hover: #2563eb;--status-active: #22c55e;--status-waiting: #eab308;--status-error: #ef4444;--status-implementing: #f97316}*{margin:0;padding:0;box-sizing:border-box}html,body,#root{height:100%;width:100%;overflow:hidden}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,monospace;background:var(--bg-primary);color:var(--text-primary);font-size:13px}.fullscreen-terminal{height:100vh;width:100vw;overflow:hidden}.fullscreen-terminal>div{height:100%;width:100%}.app{display:flex;flex-direction:column;height:100vh}.app-header{display:flex;align-items:center;justify-content:space-between;padding:8px 16px;background:var(--bg-secondary);border-bottom:1px solid var(--border-color);height:40px;flex-shrink:0}.app-title{font-size:14px;font-weight:600;color:var(--text-primary)}.header-meta{font-size:12px;color:var(--text-secondary)}.app-body{flex:1;overflow:hidden}.split-pane{display:flex;height:100%;width:100%}.split-left,.split-right{height:100%;overflow:hidden}.split-handle{width:4px;cursor:col-resize;background:var(--border-color);flex-shrink:0}.split-handle:hover{background:var(--accent)}.right-panel{display:flex;flex-direction:column;height:100%}.tab-bar{display:flex;background:var(--bg-secondary);border-bottom:1px solid var(--border-color);overflow-x:auto;flex-shrink:0;height:34px}.tab{display:flex;align-items:center;gap:6px;padding:6px 12px;background:none;border:none;border-bottom:2px solid transparent;color:var(--text-secondary);font-size:12px;cursor:pointer;white-space:nowrap;font-family:inherit}.tab:hover{background:var(--bg-hover);color:var(--text-primary)}.tab-active{color:var(--text-primary);border-bottom-color:var(--accent)}.tab-label{max-width:120px;overflow:hidden;text-overflow:ellipsis}.tab-close{font-size:14px;line-height:1;opacity:.5;padding:0 2px;border-radius:3px}.tab-close:hover{opacity:1;background:var(--bg-hover)}.tab-content{flex:1;overflow:hidden}.terminal-iframe{display:block}.dashboard-container{flex:1;overflow-y:auto;display:flex;flex-direction:column;height:100%}.projects-info{padding:16px;background:var(--bg-secondary);border-bottom:1px solid var(--border-color);font-size:13px;line-height:1.5;color:var(--text-secondary);flex-shrink:0}.projects-info h1{color:var(--text-primary)}.projects-info a{color:var(--accent);text-decoration:none}.projects-info a:hover{text-decoration:underline}.dashboard-header{display:flex;gap:16px;padding:16px;flex:1;min-height:0}@media(max-width:900px){.dashboard-header{flex-direction:column}}.dashboard-section{background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:8px;overflow:hidden;display:flex;flex-direction:column}.dashboard-section.section-tabs,.dashboard-section.section-files{flex:1}.dashboard-section.section-projects{flex:0 0 auto;margin:0 16px 16px;max-height:50%;overflow-y:auto}.dashboard-section-header{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;cursor:pointer;-webkit-user-select:none;user-select:none;flex-shrink:0;border-bottom:1px solid var(--border-color)}.dashboard-section-header:hover{background:var(--bg-tertiary)}.dashboard-section-header h3{font-size:12px;text-transform:uppercase;color:var(--text-muted);letter-spacing:.5px;margin:0;display:flex;align-items:center;gap:6px;font-weight:600}.collapse-icon{font-size:10px;transition:transform .2s}.dashboard-section.collapsed .collapse-icon{transform:rotate(-90deg)}.dashboard-section.collapsed .dashboard-section-header{border-bottom:none}.header-actions{display:flex;gap:4px}.header-actions button{padding:4px 8px;border-radius:4px;border:1px solid var(--border-color);background:var(--bg-tertiary);color:var(--text-secondary);cursor:pointer;font-size:11px;font-family:inherit}.header-actions button:hover{background:var(--bg-hover);color:var(--text-primary)}.dashboard-section-content{flex:1;overflow-y:auto;padding:8px 12px}.dashboard-tabs-list{flex:1;overflow-y:auto}.dashboard-tab-item{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:4px;cursor:pointer;font-size:13px;color:var(--text-secondary)}.dashboard-tab-item:hover{background:var(--bg-tertiary)}.dashboard-tab-item .tab-icon{font-size:14px;flex-shrink:0}.dashboard-tab-item .tab-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dashboard-section-content .file-tree{height:auto;max-height:none}.project-table{width:100%;border-collapse:collapse;font-size:12px}.project-table th{text-align:center;padding:6px 8px;font-size:10px;text-transform:uppercase;color:var(--text-muted);letter-spacing:.5px;border-bottom:1px solid var(--border-color);font-weight:600}.project-table th:nth-child(1),.project-table th:nth-child(2){text-align:left}.project-table td{padding:6px 8px;border-bottom:1px solid var(--border-color)}.project-id{color:var(--text-muted);font-family:monospace;font-size:11px}.project-name{color:var(--text-primary)}.project-stage{text-align:center}.project-cell{display:flex;align-items:center;gap:8px}.project-id{color:var(--text-muted);font-family:monospace;font-size:11px;flex-shrink:0}.project-title{color:var(--text-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.project-terminal-status{color:var(--text-muted);font-size:11px;font-style:italic}.checkmark{color:var(--status-active);font-weight:700;font-size:12px}.current-indicator{display:inline-block;width:10px;height:10px;border-radius:50%;border:2px solid var(--status-implementing);background:transparent}.celebration{font-size:14px}.project-stage a{color:var(--accent);text-decoration:none;font-size:10px}.project-stage a:hover{text-decoration:underline}.project-section{margin-bottom:8px}.project-section summary{cursor:pointer;font-size:12px;font-weight:600;color:var(--text-secondary);padding:6px 0;-webkit-user-select:none;user-select:none}.section-count{color:var(--text-muted);font-weight:400}.projects-welcome{padding:16px;color:var(--text-muted);font-size:13px}.projects-error{padding:12px;color:var(--status-error);display:flex;align-items:center;gap:8px}.projects-error button{padding:4px 8px;border-radius:4px;border:1px solid var(--border-color);background:var(--bg-tertiary);color:var(--text-secondary);cursor:pointer;font-size:11px}.builder-card{padding:8px 12px;background:var(--bg-tertiary);border:1px solid var(--border-color);border-radius:6px;margin-bottom:8px}.builder-header{display:flex;align-items:center;gap:8px}.status-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;display:inline-block;margin-left:6px;background:var(--text-muted)}.status-active,.status-running{background:var(--status-active)}.status-waiting,.status-idle{background:var(--status-waiting)}.status-error,.status-failed{background:var(--status-error)}.status-implementing{background:var(--status-implementing)}.builder-name{font-size:13px;font-weight:500}.builder-meta{margin-top:4px;display:flex;gap:8px;font-size:11px;color:var(--text-secondary)}.file-tree{padding:8px;overflow-y:auto;height:100%}.file-node{display:flex;align-items:center;gap:6px;padding:3px 0;cursor:pointer;font-size:12px;border-radius:4px}.file-node:hover{background:var(--bg-hover)}.file-icon{font-size:14px;flex-shrink:0}.file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-tree-error,.file-tree-loading{padding:16px;color:var(--text-muted);font-size:12px}.status-bar{display:flex;gap:16px;padding:4px 16px;background:var(--bg-secondary);border-top:1px solid var(--border-color);font-size:11px;color:var(--text-secondary);flex-shrink:0;height:24px;align-items:center}.no-architect{display:flex;align-items:center;justify-content:center;height:100%;color:var(--text-muted);font-size:14px}.mobile-layout{display:flex;flex-direction:column;height:100vh}.mobile-content{flex:1;overflow:hidden}@media(max-width:768px){.app-header{padding:6px 12px}.tab{padding:4px 8px;font-size:11px}}.file-viewer{display:flex;flex-direction:column;height:100%;background:var(--bg-primary)}.file-loading,.file-error{display:flex;align-items:center;justify-content:center;height:100%;color:var(--text-secondary)}.file-error{color:var(--status-error)}.file-header{display:flex;align-items:center;gap:12px;padding:8px 12px;background:var(--bg-secondary);border-bottom:1px solid var(--border-color);flex-shrink:0}.file-path{font-family:monospace;font-size:12px;color:var(--text-primary);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-language{font-size:11px;color:var(--text-muted);text-transform:uppercase}.file-save-btn{padding:4px 12px;font-size:11px;background:var(--accent);color:#fff;border:none;border-radius:4px;cursor:pointer}.file-save-btn:hover{background:var(--accent-hover)}.file-save-btn:disabled{opacity:.5;cursor:not-allowed}.file-content{display:flex;flex:1;overflow:auto;background:var(--bg-primary)}.line-numbers{display:flex;flex-direction:column;padding:12px 8px;background:var(--bg-secondary);color:var(--text-muted);font-family:Menlo,Monaco,Courier New,monospace;font-size:13px;line-height:1.5;text-align:right;-webkit-user-select:none;user-select:none;flex-shrink:0;min-width:40px}.line-number{padding-right:8px}.line-number.highlighted-line{background:#3b82f64d}.file-text{flex:1;padding:12px;font-family:Menlo,Monaco,Courier New,monospace;font-size:13px;line-height:1.5;background:var(--bg-primary);color:var(--text-primary);border:none;outline:none;resize:none;white-space:pre;overflow:auto}.file-image-container,.file-video-container{flex:1;display:flex;align-items:center;justify-content:center;overflow:auto;padding:20px}.file-image{max-width:100%;max-height:100%;object-fit:contain}.file-video{max-width:100%;max-height:100%}.file-tree-container{display:flex;flex-direction:column;height:100%;overflow:hidden}.file-search{position:relative;padding:8px;border-bottom:1px solid var(--border-color);flex-shrink:0}.file-search-input{width:100%;padding:6px 10px;font-size:12px;font-family:inherit;background:var(--bg-primary);border:1px solid var(--border-color);border-radius:4px;color:var(--text-primary);outline:none}.file-search-input:focus{border-color:var(--accent)}.file-search-input::placeholder{color:var(--text-muted)}.file-search-suggestions{position:absolute;top:100%;left:8px;right:8px;background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:4px;box-shadow:0 4px 12px #0000004d;z-index:100;max-height:240px;overflow-y:auto}.file-search-suggestion{display:flex;flex-direction:column;padding:8px 10px;cursor:pointer;border-bottom:1px solid var(--border-color)}.file-search-suggestion:last-child{border-bottom:none}.file-search-suggestion:hover{background:var(--bg-hover)}.suggestion-name{font-size:12px;color:var(--text-primary);font-weight:500}.suggestion-path{font-size:10px;color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-tree-section{display:flex;flex-direction:column;overflow:hidden}.file-tree-section:first-of-type{flex-shrink:0}.file-tree-section:last-of-type{flex:1;overflow:hidden}.file-tree-section-header{padding:8px 12px;font-size:11px;font-weight:600;text-transform:uppercase;color:var(--text-muted);letter-spacing:.5px;border-bottom:1px solid var(--border-color);flex-shrink:0}.recent-file{color:var(--text-secondary)}.recent-file:hover{color:var(--text-primary)}.file-path-hint{font-size:10px;color:var(--text-muted);margin-left:auto;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.git-indicator{font-family:monospace;font-size:10px;font-weight:700;padding:1px 4px;border-radius:3px;margin-left:auto;flex-shrink:0}.git-modified{color:var(--status-implementing);background:#f9731626}.git-staged{color:var(--status-active);background:#22c55e26}.git-untracked{color:var(--text-muted);background:#66666626}
@@ -1,27 +0,0 @@
1
- /**
2
- * Claude Worker for Porch (Agent SDK)
3
- *
4
- * Invokes Claude programmatically via the Anthropic Agent SDK.
5
- * Replaces the old `claude --print` subprocess approach.
6
- *
7
- * The Worker has full tool access (Read, Edit, Bash, Glob, Grep)
8
- * and runs inside porch's process — no subprocess, no nested CLI.
9
- */
10
- export interface BuildResult {
11
- /** Whether the build completed successfully */
12
- success: boolean;
13
- /** Claude's output text */
14
- output: string;
15
- /** Total cost in USD (if available) */
16
- cost?: number;
17
- /** Duration in milliseconds (if available) */
18
- duration?: number;
19
- }
20
- /**
21
- * Run a build phase with a timeout.
22
- *
23
- * Wraps buildWithSDK with Promise.race against a timeout.
24
- * On timeout, returns a failure result (does not throw).
25
- */
26
- export declare function buildWithTimeout(prompt: string, outputPath: string, cwd: string, timeoutMs: number): Promise<BuildResult>;
27
- //# sourceMappingURL=claude.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/commands/porch/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC,CAetB"}
@@ -1,107 +0,0 @@
1
- /**
2
- * Claude Worker for Porch (Agent SDK)
3
- *
4
- * Invokes Claude programmatically via the Anthropic Agent SDK.
5
- * Replaces the old `claude --print` subprocess approach.
6
- *
7
- * The Worker has full tool access (Read, Edit, Bash, Glob, Grep)
8
- * and runs inside porch's process — no subprocess, no nested CLI.
9
- */
10
- import * as fs from 'node:fs';
11
- /**
12
- * Run a build phase with a timeout.
13
- *
14
- * Wraps buildWithSDK with Promise.race against a timeout.
15
- * On timeout, returns a failure result (does not throw).
16
- */
17
- export async function buildWithTimeout(prompt, outputPath, cwd, timeoutMs) {
18
- let timer;
19
- const timeoutPromise = new Promise((resolve) => {
20
- timer = setTimeout(() => {
21
- resolve({
22
- success: false,
23
- output: '[TIMEOUT] Build exceeded deadline',
24
- duration: timeoutMs,
25
- });
26
- }, timeoutMs);
27
- });
28
- const result = await Promise.race([buildWithSDK(prompt, outputPath, cwd), timeoutPromise]);
29
- clearTimeout(timer);
30
- return result;
31
- }
32
- /**
33
- * Run a build phase using the Agent SDK (internal — use buildWithTimeout).
34
- */
35
- async function buildWithSDK(prompt, outputPath, cwd) {
36
- // Save prompt to file for reference
37
- const promptFile = outputPath.replace(/\.txt$/, '-prompt.txt');
38
- fs.writeFileSync(promptFile, prompt);
39
- // Create output file
40
- fs.writeFileSync(outputPath, '');
41
- // Dynamically import Agent SDK (it's ESM)
42
- const { query } = await import('@anthropic-ai/claude-agent-sdk');
43
- let output = '';
44
- let cost;
45
- let duration;
46
- let success = false;
47
- try {
48
- for await (const message of query({
49
- prompt,
50
- options: {
51
- allowedTools: ['Read', 'Edit', 'Write', 'Bash', 'Glob', 'Grep'],
52
- permissionMode: 'bypassPermissions',
53
- allowDangerouslySkipPermissions: true,
54
- cwd,
55
- maxTurns: 200,
56
- },
57
- })) {
58
- // Stream assistant messages to output file
59
- if (message.type === 'assistant' && message.message?.content) {
60
- for (const block of message.message.content) {
61
- if (block.type === 'text') {
62
- output += block.text + '\n';
63
- fs.appendFileSync(outputPath, block.text + '\n');
64
- }
65
- else if (block.type === 'tool_use') {
66
- const toolLine = `\n[tool: ${block.name}](${JSON.stringify(block.input).substring(0, 200)})\n`;
67
- output += toolLine;
68
- fs.appendFileSync(outputPath, toolLine);
69
- }
70
- }
71
- }
72
- // Capture tool progress for observability
73
- if (message.type === 'tool_progress') {
74
- const progressLine = `[tool_progress] ${JSON.stringify(message).substring(0, 500)}\n`;
75
- fs.appendFileSync(outputPath, progressLine);
76
- }
77
- // Capture result
78
- if (message.type === 'result') {
79
- if (message.subtype === 'success') {
80
- success = true;
81
- if (message.result) {
82
- output += message.result;
83
- fs.appendFileSync(outputPath, message.result);
84
- }
85
- cost = message.total_cost_usd;
86
- duration = message.duration_ms;
87
- }
88
- else {
89
- // Error result
90
- success = false;
91
- const errorMsg = `\n[Agent SDK error: ${message.subtype}]\n`;
92
- output += errorMsg;
93
- fs.appendFileSync(outputPath, errorMsg);
94
- duration = message.duration_ms;
95
- }
96
- }
97
- }
98
- }
99
- catch (err) {
100
- const errorMsg = `\n[Agent SDK exception: ${err.message}]\n`;
101
- output += errorMsg;
102
- fs.appendFileSync(outputPath, errorMsg);
103
- success = false;
104
- }
105
- return { success, output, cost, duration };
106
- }
107
- //# sourceMappingURL=claude.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/commands/porch/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAa9B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,UAAkB,EAClB,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I,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;oBAClC,OAAO,GAAG,IAAI,CAAC;oBACf,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;wBACnB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;wBACzB,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;oBAChD,CAAC;oBACD,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC;oBAC9B,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;gBACjC,CAAC;qBAAM,CAAC;oBACN,eAAe;oBACf,OAAO,GAAG,KAAK,CAAC;oBAChB,MAAM,QAAQ,GAAG,uBAAuB,OAAO,CAAC,OAAO,KAAK,CAAC;oBAC7D,MAAM,IAAI,QAAQ,CAAC;oBACnB,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;oBACxC,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;gBACjC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,QAAQ,GAAG,2BAA4B,GAAa,CAAC,OAAO,KAAK,CAAC;QACxE,MAAM,IAAI,QAAQ,CAAC;QACnB,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACxC,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC7C,CAAC"}
@@ -1,40 +0,0 @@
1
- /**
2
- * porch run - Main run loop (Build-Verify design)
3
- *
4
- * Porch orchestrates build-verify cycles:
5
- * 1. BUILD: Spawn Claude to create artifact
6
- * 2. VERIFY: Run 3-way consultation (Gemini, Codex, Claude)
7
- * 3. ITERATE: If any REQUEST_CHANGES, feed back to Claude
8
- * 4. COMPLETE: When all APPROVE (or max iterations), commit + push + gate
9
- */
10
- import type { Verdict } from './types.js';
11
- export interface RunOptions {
12
- /** Run a single build-verify iteration then exit (for step-by-step debugging) */
13
- singleIteration?: boolean;
14
- /** Run a single phase (build-verify + gate) then exit. Used by Builder (outer Claude) to stay in the loop. */
15
- singlePhase?: boolean;
16
- }
17
- /** Exit code when AWAITING_INPUT is detected in non-interactive mode */
18
- export declare const EXIT_AWAITING_INPUT = 3;
19
- /**
20
- * Main run loop for porch.
21
- * Spawns Claude for each phase and monitors until protocol complete.
22
- */
23
- export declare function run(projectRoot: string, projectId: string, options?: RunOptions): Promise<void>;
24
- /**
25
- * Parse verdict from consultation output.
26
- *
27
- * Looks for the verdict line in format:
28
- * VERDICT: APPROVE
29
- * VERDICT: REQUEST_CHANGES
30
- * VERDICT: COMMENT
31
- *
32
- * Also handles markdown formatting like:
33
- * **VERDICT: APPROVE**
34
- * *VERDICT: APPROVE*
35
- *
36
- * Safety: If no explicit verdict found (empty output, crash, malformed),
37
- * defaults to REQUEST_CHANGES to prevent proceeding with unverified code.
38
- */
39
- export declare function parseVerdict(output: string): Verdict;
40
- //# sourceMappingURL=run.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/commands/porch/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,OAAO,KAAK,EAAyD,OAAO,EAAE,MAAM,YAAY,CAAC;AA4DjG,MAAM,WAAW,UAAU;IACzB,iFAAiF;IACjF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8GAA8G;IAC9G,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAQrC;;;GAGG;AACH,wBAAsB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAqezG;AAkMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAwBpD"}