@cluesmith/codev 2.0.0-rc.1 → 2.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/porch.js +9 -4
- package/dist/agent-farm/cli.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +2 -14
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/kickoff.d.ts +1 -0
- package/dist/agent-farm/commands/kickoff.d.ts.map +1 -1
- package/dist/agent-farm/commands/kickoff.js +82 -78
- package/dist/agent-farm/commands/kickoff.js.map +1 -1
- package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn.js +30 -54
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/commands/start.d.ts.map +1 -1
- package/dist/agent-farm/commands/start.js +8 -50
- package/dist/agent-farm/commands/start.js.map +1 -1
- package/dist/agent-farm/servers/dashboard-server.js +0 -14
- package/dist/agent-farm/servers/dashboard-server.js.map +1 -1
- package/dist/agent-farm/state.d.ts +0 -10
- package/dist/agent-farm/state.d.ts.map +1 -1
- package/dist/agent-farm/state.js +0 -24
- package/dist/agent-farm/state.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -17
- package/dist/cli.js.map +1 -1
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +17 -1
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/consult/index.d.ts.map +1 -1
- package/dist/commands/consult/index.js +2 -1
- package/dist/commands/consult/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +17 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/porch/checks.d.ts +16 -29
- package/dist/commands/porch/checks.d.ts.map +1 -1
- package/dist/commands/porch/checks.js +90 -144
- package/dist/commands/porch/checks.js.map +1 -1
- package/dist/commands/porch/claude.d.ts +29 -0
- package/dist/commands/porch/claude.d.ts.map +1 -0
- package/dist/commands/porch/claude.js +80 -0
- package/dist/commands/porch/claude.js.map +1 -0
- package/dist/commands/porch/index.d.ts +21 -43
- package/dist/commands/porch/index.d.ts.map +1 -1
- package/dist/commands/porch/index.js +449 -753
- package/dist/commands/porch/index.js.map +1 -1
- package/dist/commands/porch/plan.d.ts +60 -0
- package/dist/commands/porch/plan.d.ts.map +1 -0
- package/dist/commands/porch/plan.js +162 -0
- package/dist/commands/porch/plan.js.map +1 -0
- package/dist/commands/porch/prompts.d.ts +19 -0
- package/dist/commands/porch/prompts.d.ts.map +1 -0
- package/dist/commands/porch/prompts.js +270 -0
- package/dist/commands/porch/prompts.js.map +1 -0
- package/dist/commands/porch/protocol.d.ts +59 -0
- package/dist/commands/porch/protocol.d.ts.map +1 -0
- package/dist/commands/porch/protocol.js +252 -0
- package/dist/commands/porch/protocol.js.map +1 -0
- package/dist/commands/porch/repl.d.ts +33 -0
- package/dist/commands/porch/repl.d.ts.map +1 -0
- package/dist/commands/porch/repl.js +206 -0
- package/dist/commands/porch/repl.js.map +1 -0
- package/dist/commands/porch/run.d.ts +15 -0
- package/dist/commands/porch/run.d.ts.map +1 -0
- package/dist/commands/porch/run.js +718 -0
- package/dist/commands/porch/run.js.map +1 -0
- package/dist/commands/porch/signals.d.ts +38 -0
- package/dist/commands/porch/signals.d.ts.map +1 -0
- package/dist/commands/porch/signals.js +81 -0
- package/dist/commands/porch/signals.js.map +1 -0
- package/dist/commands/porch/state.d.ts +19 -112
- package/dist/commands/porch/state.d.ts.map +1 -1
- package/dist/commands/porch/state.js +78 -685
- package/dist/commands/porch/state.js.map +1 -1
- package/dist/commands/porch/types.d.ts +69 -173
- package/dist/commands/porch/types.d.ts.map +1 -1
- package/dist/commands/porch/types.js +2 -1
- package/dist/commands/porch/types.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +19 -0
- package/dist/commands/update.js.map +1 -1
- package/dist/lib/scaffold.d.ts +24 -0
- package/dist/lib/scaffold.d.ts.map +1 -1
- package/dist/lib/scaffold.js +78 -0
- package/dist/lib/scaffold.js.map +1 -1
- package/package.json +7 -2
- package/skeleton/protocols/bugfix/protocol.json +1 -1
- package/skeleton/protocols/spider/prompts/implement.md +201 -0
- package/skeleton/protocols/spider/prompts/plan.md +214 -0
- package/skeleton/protocols/spider/prompts/review.md +217 -0
- package/skeleton/protocols/spider/prompts/specify.md +174 -0
- package/skeleton/protocols/spider/protocol.json +81 -147
- package/skeleton/protocols/spider/protocol.md +26 -16
- package/skeleton/protocols/spider/templates/plan.md +14 -0
- package/skeleton/protocols/tick/protocol.json +1 -1
- package/skeleton/roles/architect.md +40 -48
- package/skeleton/roles/builder.md +135 -213
- package/templates/dashboard/index.html +0 -27
- package/templates/dashboard/js/utils.js +0 -86
- package/dist/agent-farm/commands/rename.d.ts +0 -13
- package/dist/agent-farm/commands/rename.d.ts.map +0 -1
- package/dist/agent-farm/commands/rename.js +0 -33
- package/dist/agent-farm/commands/rename.js.map +0 -1
- package/dist/commands/pcheck/cache.d.ts +0 -48
- package/dist/commands/pcheck/cache.d.ts.map +0 -1
- package/dist/commands/pcheck/cache.js +0 -170
- package/dist/commands/pcheck/cache.js.map +0 -1
- package/dist/commands/pcheck/evaluator.d.ts +0 -15
- package/dist/commands/pcheck/evaluator.d.ts.map +0 -1
- package/dist/commands/pcheck/evaluator.js +0 -246
- package/dist/commands/pcheck/evaluator.js.map +0 -1
- package/dist/commands/pcheck/index.d.ts +0 -12
- package/dist/commands/pcheck/index.d.ts.map +0 -1
- package/dist/commands/pcheck/index.js +0 -249
- package/dist/commands/pcheck/index.js.map +0 -1
- package/dist/commands/pcheck/parser.d.ts +0 -39
- package/dist/commands/pcheck/parser.d.ts.map +0 -1
- package/dist/commands/pcheck/parser.js +0 -155
- package/dist/commands/pcheck/parser.js.map +0 -1
- package/dist/commands/pcheck/types.d.ts +0 -82
- package/dist/commands/pcheck/types.d.ts.map +0 -1
- package/dist/commands/pcheck/types.js +0 -5
- package/dist/commands/pcheck/types.js.map +0 -1
- package/dist/commands/porch/consultation.d.ts +0 -56
- package/dist/commands/porch/consultation.d.ts.map +0 -1
- package/dist/commands/porch/consultation.js +0 -330
- package/dist/commands/porch/consultation.js.map +0 -1
- package/dist/commands/porch/notifications.d.ts +0 -99
- package/dist/commands/porch/notifications.d.ts.map +0 -1
- package/dist/commands/porch/notifications.js +0 -223
- package/dist/commands/porch/notifications.js.map +0 -1
- package/dist/commands/porch/plan-parser.d.ts +0 -38
- package/dist/commands/porch/plan-parser.d.ts.map +0 -1
- package/dist/commands/porch/plan-parser.js +0 -166
- package/dist/commands/porch/plan-parser.js.map +0 -1
- package/dist/commands/porch/protocol-loader.d.ts +0 -46
- package/dist/commands/porch/protocol-loader.d.ts.map +0 -1
- package/dist/commands/porch/protocol-loader.js +0 -249
- package/dist/commands/porch/protocol-loader.js.map +0 -1
- package/dist/commands/porch/signal-parser.d.ts +0 -88
- package/dist/commands/porch/signal-parser.d.ts.map +0 -1
- package/dist/commands/porch/signal-parser.js +0 -148
- package/dist/commands/porch/signal-parser.js.map +0 -1
- package/skeleton/porch/protocols/bugfix.json +0 -85
- package/skeleton/porch/protocols/spider.json +0 -135
- package/skeleton/porch/protocols/tick.json +0 -76
- package/templates/dashboard/css/activity.css +0 -151
- package/templates/dashboard/js/activity.js +0 -112
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
<link rel="stylesheet" href="/dashboard/css/tabs.css">
|
|
11
11
|
<link rel="stylesheet" href="/dashboard/css/statusbar.css">
|
|
12
12
|
<link rel="stylesheet" href="/dashboard/css/dialogs.css">
|
|
13
|
-
<link rel="stylesheet" href="/dashboard/css/activity.css">
|
|
14
13
|
<link rel="stylesheet" href="/dashboard/css/projects.css">
|
|
15
14
|
<link rel="stylesheet" href="/dashboard/css/files.css">
|
|
16
15
|
<link rel="stylesheet" href="/dashboard/css/utilities.css">
|
|
@@ -18,11 +17,6 @@
|
|
|
18
17
|
<body>
|
|
19
18
|
<header class="header">
|
|
20
19
|
<h1>Agent Farm - {{PROJECT_NAME}}</h1>
|
|
21
|
-
<div class="header-actions">
|
|
22
|
-
<button class="btn activity-summary-btn" onclick="showActivitySummary()" title="What did I do today?">
|
|
23
|
-
🕐 Today
|
|
24
|
-
</button>
|
|
25
|
-
</div>
|
|
26
20
|
</header>
|
|
27
21
|
|
|
28
22
|
<main class="main">
|
|
@@ -123,26 +117,6 @@
|
|
|
123
117
|
<!-- Toast container -->
|
|
124
118
|
<div class="toast-container" id="toast-container"></div>
|
|
125
119
|
|
|
126
|
-
<!-- Activity Summary Modal (Spec 0059) -->
|
|
127
|
-
<div class="dialog-overlay hidden" id="activity-modal">
|
|
128
|
-
<div class="dialog activity-dialog">
|
|
129
|
-
<div class="activity-dialog-header">
|
|
130
|
-
<h3>Today's Summary</h3>
|
|
131
|
-
<button class="activity-close-btn" onclick="closeActivityModal()" title="Close (Esc)">×</button>
|
|
132
|
-
</div>
|
|
133
|
-
<div class="activity-dialog-content" id="activity-content">
|
|
134
|
-
<div class="activity-loading">
|
|
135
|
-
<span class="activity-spinner"></span>
|
|
136
|
-
Loading activity...
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
<div class="activity-dialog-footer">
|
|
140
|
-
<button class="btn" onclick="copyActivitySummary()">📋 Copy to Clipboard</button>
|
|
141
|
-
<button class="btn" onclick="closeActivityModal()">Close</button>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
120
|
<!-- File search palette (Cmd+P) - Spec 0058 -->
|
|
147
121
|
<div id="file-palette" class="file-palette hidden">
|
|
148
122
|
<div class="file-palette-backdrop" onclick="closePalette()"></div>
|
|
@@ -169,7 +143,6 @@
|
|
|
169
143
|
<script src="/dashboard/js/dialogs.js"></script>
|
|
170
144
|
<script src="/dashboard/js/projects.js"></script>
|
|
171
145
|
<script src="/dashboard/js/files.js"></script>
|
|
172
|
-
<script src="/dashboard/js/activity.js"></script>
|
|
173
146
|
<script src="/dashboard/js/main.js"></script>
|
|
174
147
|
</body>
|
|
175
148
|
</html>
|
|
@@ -168,89 +168,3 @@ function handleMenuKeydown(event, menuId, itemClass, hideFunction, options = {})
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
/**
|
|
172
|
-
* Format ISO time string for display
|
|
173
|
-
* Used by activity rendering
|
|
174
|
-
*/
|
|
175
|
-
function formatActivityTime(isoString) {
|
|
176
|
-
if (!isoString) return '--';
|
|
177
|
-
const date = new Date(isoString);
|
|
178
|
-
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Render activity summary content
|
|
183
|
-
* Consolidates duplicate code from renderActivityTabContent and renderActivitySummary
|
|
184
|
-
*
|
|
185
|
-
* @param {Object} data - Activity data
|
|
186
|
-
* @param {Object} options - Render options
|
|
187
|
-
* @param {boolean} options.isTab - Whether rendering for tab (includes wrapper and copy button)
|
|
188
|
-
* @returns {string} HTML content
|
|
189
|
-
*/
|
|
190
|
-
function renderActivityContentHtml(data, options = {}) {
|
|
191
|
-
const { isTab = false } = options;
|
|
192
|
-
|
|
193
|
-
if (data.commits.length === 0 && data.prs.length === 0 && data.builders.length === 0) {
|
|
194
|
-
return `
|
|
195
|
-
<div class="activity-empty">
|
|
196
|
-
<p>No activity recorded today</p>
|
|
197
|
-
<p style="font-size: 12px; margin-top: 8px;">Make some commits or create PRs to see your daily summary!</p>
|
|
198
|
-
</div>
|
|
199
|
-
`;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const hours = Math.floor(data.timeTracking.activeMinutes / 60);
|
|
203
|
-
const mins = data.timeTracking.activeMinutes % 60;
|
|
204
|
-
const uniqueBranches = new Set(data.commits.map(c => c.branch)).size;
|
|
205
|
-
const mergedPrs = data.prs.filter(p => p.state === 'MERGED').length;
|
|
206
|
-
|
|
207
|
-
let html = isTab ? '<div class="activity-tab-container"><div class="activity-summary">' : '<div class="activity-summary">';
|
|
208
|
-
|
|
209
|
-
if (data.aiSummary) {
|
|
210
|
-
html += `<div class="activity-ai-summary">${escapeHtml(data.aiSummary)}</div>`;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
html += `
|
|
214
|
-
<div class="activity-section">
|
|
215
|
-
<h4>Activity</h4>
|
|
216
|
-
<ul>
|
|
217
|
-
<li>${data.commits.length} commits across ${uniqueBranches} branch${uniqueBranches !== 1 ? 'es' : ''}</li>
|
|
218
|
-
<li>${data.files.length} files modified</li>
|
|
219
|
-
<li>${data.prs.length} PR${data.prs.length !== 1 ? 's' : ''} created${mergedPrs > 0 ? `, ${mergedPrs} merged` : ''}</li>
|
|
220
|
-
</ul>
|
|
221
|
-
</div>
|
|
222
|
-
`;
|
|
223
|
-
|
|
224
|
-
if (data.projectChanges && data.projectChanges.length > 0) {
|
|
225
|
-
html += `
|
|
226
|
-
<div class="activity-section">
|
|
227
|
-
<h4>Projects Touched</h4>
|
|
228
|
-
<ul>
|
|
229
|
-
${data.projectChanges.map(p => `<li>${escapeHtml(p.id)}: ${escapeHtml(p.title)} (${escapeHtml(p.oldStatus)} → ${escapeHtml(p.newStatus)})</li>`).join('')}
|
|
230
|
-
</ul>
|
|
231
|
-
</div>
|
|
232
|
-
`;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
html += `
|
|
236
|
-
<div class="activity-section">
|
|
237
|
-
<h4>Time</h4>
|
|
238
|
-
<p><span class="activity-time-value">~${hours}h ${mins}m</span> active time</p>
|
|
239
|
-
<p>First activity: ${formatActivityTime(data.timeTracking.firstActivity)}</p>
|
|
240
|
-
<p>Last activity: ${formatActivityTime(data.timeTracking.lastActivity)}</p>
|
|
241
|
-
</div>
|
|
242
|
-
`;
|
|
243
|
-
|
|
244
|
-
if (isTab) {
|
|
245
|
-
html += `
|
|
246
|
-
<div class="activity-actions">
|
|
247
|
-
<button class="btn" onclick="copyActivityToClipboard()">Copy to Clipboard</button>
|
|
248
|
-
</div>
|
|
249
|
-
`;
|
|
250
|
-
html += '</div></div>';
|
|
251
|
-
} else {
|
|
252
|
-
html += '</div>';
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return html;
|
|
256
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rename command - rename a builder or utility terminal
|
|
3
|
-
*/
|
|
4
|
-
interface RenameOptions {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Rename a builder or utility terminal
|
|
10
|
-
*/
|
|
11
|
-
export declare function rename(options: RenameOptions): void;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=rename.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rename.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/commands/rename.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CA2BnD"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rename command - rename a builder or utility terminal
|
|
3
|
-
*/
|
|
4
|
-
import { renameBuilder, renameUtil } from '../state.js';
|
|
5
|
-
import { logger, fatal } from '../utils/logger.js';
|
|
6
|
-
/**
|
|
7
|
-
* Rename a builder or utility terminal
|
|
8
|
-
*/
|
|
9
|
-
export function rename(options) {
|
|
10
|
-
const { id, name } = options;
|
|
11
|
-
if (!name.trim()) {
|
|
12
|
-
fatal('Name cannot be empty');
|
|
13
|
-
}
|
|
14
|
-
// Try to rename as builder first
|
|
15
|
-
const oldBuilderName = renameBuilder(id, name);
|
|
16
|
-
if (oldBuilderName !== null) {
|
|
17
|
-
logger.success(`Renamed builder "${id}"`);
|
|
18
|
-
logger.kv('Old name', oldBuilderName);
|
|
19
|
-
logger.kv('New name', name);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
// Try to rename as util
|
|
23
|
-
const oldUtilName = renameUtil(id, name);
|
|
24
|
-
if (oldUtilName !== null) {
|
|
25
|
-
logger.success(`Renamed utility "${id}"`);
|
|
26
|
-
logger.kv('Old name', oldUtilName);
|
|
27
|
-
logger.kv('New name', name);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Not found
|
|
31
|
-
fatal(`No builder or utility found with ID: ${id}`);
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=rename.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rename.js","sourceRoot":"","sources":["../../../src/agent-farm/commands/rename.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAOnD;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,OAAsB;IAC3C,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACjB,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAChC,CAAC;IAED,iCAAiC;IACjC,MAAM,cAAc,GAAG,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC/C,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;QAC5B,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;QAC1C,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACtC,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,wBAAwB;IACxB,MAAM,WAAW,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACzC,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;QAC1C,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QACnC,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,YAAY;IACZ,KAAK,CAAC,wCAAwC,EAAE,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Caching layer for pcheck LLM results
|
|
3
|
-
*
|
|
4
|
-
* Caches LLM check results based on file content hashes
|
|
5
|
-
* to avoid expensive re-evaluations when files haven't changed.
|
|
6
|
-
*/
|
|
7
|
-
import type { CacheFile, CacheEntry } from './types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Load the cache file
|
|
10
|
-
*/
|
|
11
|
-
export declare function loadCache(): CacheFile;
|
|
12
|
-
/**
|
|
13
|
-
* Save the cache file
|
|
14
|
-
*/
|
|
15
|
-
export declare function saveCache(cache: CacheFile): void;
|
|
16
|
-
/**
|
|
17
|
-
* Compute a hash of file contents
|
|
18
|
-
* For multiple files, concatenates and hashes together
|
|
19
|
-
*/
|
|
20
|
-
export declare function computeContentHash(filePaths: string[]): string;
|
|
21
|
-
/**
|
|
22
|
-
* Generate a cache key for a check
|
|
23
|
-
*/
|
|
24
|
-
export declare function getCacheKey(checkId: string, contentHash: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* Get a cached result if available and valid
|
|
27
|
-
*/
|
|
28
|
-
export declare function getCachedResult(checkId: string, filePaths: string[]): CacheEntry | null;
|
|
29
|
-
/**
|
|
30
|
-
* Store a result in the cache
|
|
31
|
-
*/
|
|
32
|
-
export declare function setCachedResult(checkId: string, filePaths: string[], pass: boolean, reasoning?: string): void;
|
|
33
|
-
/**
|
|
34
|
-
* Invalidate cache entries for a specific check
|
|
35
|
-
*/
|
|
36
|
-
export declare function invalidateCheck(checkId: string): void;
|
|
37
|
-
/**
|
|
38
|
-
* Clear all cache entries
|
|
39
|
-
*/
|
|
40
|
-
export declare function clearCache(): void;
|
|
41
|
-
/**
|
|
42
|
-
* Get cache statistics
|
|
43
|
-
*/
|
|
44
|
-
export declare function getCacheStats(): {
|
|
45
|
-
entries: number;
|
|
46
|
-
size: string;
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/commands/pcheck/cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA8BxD;;GAEG;AACH,wBAAgB,SAAS,IAAI,SAAS,CAmBrC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAahD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAa9D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EAAE,GAClB,UAAU,GAAG,IAAI,CAgBnB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,IAAI,EAAE,OAAO,EACb,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAcN;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAWrD;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAKjC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAoBjE"}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Caching layer for pcheck LLM results
|
|
3
|
-
*
|
|
4
|
-
* Caches LLM check results based on file content hashes
|
|
5
|
-
* to avoid expensive re-evaluations when files haven't changed.
|
|
6
|
-
*/
|
|
7
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
8
|
-
import { join, dirname } from 'node:path';
|
|
9
|
-
import { createHash } from 'node:crypto';
|
|
10
|
-
const CACHE_VERSION = 1;
|
|
11
|
-
const CACHE_FILENAME = '.codev/pcheck-cache.json';
|
|
12
|
-
/**
|
|
13
|
-
* Find the project root directory (containing codev/)
|
|
14
|
-
*/
|
|
15
|
-
function findProjectRoot() {
|
|
16
|
-
let dir = process.cwd();
|
|
17
|
-
while (dir !== '/') {
|
|
18
|
-
if (existsSync(join(dir, 'codev'))) {
|
|
19
|
-
return dir;
|
|
20
|
-
}
|
|
21
|
-
dir = dirname(dir);
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get the cache file path
|
|
27
|
-
*/
|
|
28
|
-
function getCachePath() {
|
|
29
|
-
const root = findProjectRoot();
|
|
30
|
-
if (!root) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return join(root, CACHE_FILENAME);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Load the cache file
|
|
37
|
-
*/
|
|
38
|
-
export function loadCache() {
|
|
39
|
-
const cachePath = getCachePath();
|
|
40
|
-
if (!cachePath || !existsSync(cachePath)) {
|
|
41
|
-
return { version: CACHE_VERSION, entries: {} };
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
const content = readFileSync(cachePath, 'utf-8');
|
|
45
|
-
const cache = JSON.parse(content);
|
|
46
|
-
// Validate version
|
|
47
|
-
if (cache.version !== CACHE_VERSION) {
|
|
48
|
-
return { version: CACHE_VERSION, entries: {} };
|
|
49
|
-
}
|
|
50
|
-
return cache;
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
return { version: CACHE_VERSION, entries: {} };
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Save the cache file
|
|
58
|
-
*/
|
|
59
|
-
export function saveCache(cache) {
|
|
60
|
-
const cachePath = getCachePath();
|
|
61
|
-
if (!cachePath) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
// Ensure .codev directory exists
|
|
65
|
-
const dir = dirname(cachePath);
|
|
66
|
-
if (!existsSync(dir)) {
|
|
67
|
-
mkdirSync(dir, { recursive: true });
|
|
68
|
-
}
|
|
69
|
-
writeFileSync(cachePath, JSON.stringify(cache, null, 2));
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Compute a hash of file contents
|
|
73
|
-
* For multiple files, concatenates and hashes together
|
|
74
|
-
*/
|
|
75
|
-
export function computeContentHash(filePaths) {
|
|
76
|
-
const hash = createHash('sha256');
|
|
77
|
-
for (const filePath of filePaths) {
|
|
78
|
-
if (existsSync(filePath)) {
|
|
79
|
-
const content = readFileSync(filePath, 'utf-8');
|
|
80
|
-
hash.update(`${filePath}:${content}`);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
hash.update(`${filePath}:NOT_FOUND`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return hash.digest('hex').substring(0, 16); // Truncate for readability
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Generate a cache key for a check
|
|
90
|
-
*/
|
|
91
|
-
export function getCacheKey(checkId, contentHash) {
|
|
92
|
-
return `${checkId}:${contentHash}`;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Get a cached result if available and valid
|
|
96
|
-
*/
|
|
97
|
-
export function getCachedResult(checkId, filePaths) {
|
|
98
|
-
const cache = loadCache();
|
|
99
|
-
const contentHash = computeContentHash(filePaths);
|
|
100
|
-
const key = getCacheKey(checkId, contentHash);
|
|
101
|
-
const entry = cache.entries[key];
|
|
102
|
-
if (!entry) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
// Verify the hash still matches
|
|
106
|
-
if (entry.contentHash !== contentHash) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
return entry;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Store a result in the cache
|
|
113
|
-
*/
|
|
114
|
-
export function setCachedResult(checkId, filePaths, pass, reasoning) {
|
|
115
|
-
const cache = loadCache();
|
|
116
|
-
const contentHash = computeContentHash(filePaths);
|
|
117
|
-
const key = getCacheKey(checkId, contentHash);
|
|
118
|
-
cache.entries[key] = {
|
|
119
|
-
checkId,
|
|
120
|
-
contentHash,
|
|
121
|
-
pass,
|
|
122
|
-
reasoning,
|
|
123
|
-
timestamp: Date.now(),
|
|
124
|
-
};
|
|
125
|
-
saveCache(cache);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Invalidate cache entries for a specific check
|
|
129
|
-
*/
|
|
130
|
-
export function invalidateCheck(checkId) {
|
|
131
|
-
const cache = loadCache();
|
|
132
|
-
// Remove all entries for this check
|
|
133
|
-
for (const key of Object.keys(cache.entries)) {
|
|
134
|
-
if (key.startsWith(`${checkId}:`)) {
|
|
135
|
-
delete cache.entries[key];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
saveCache(cache);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Clear all cache entries
|
|
142
|
-
*/
|
|
143
|
-
export function clearCache() {
|
|
144
|
-
const cachePath = getCachePath();
|
|
145
|
-
if (cachePath && existsSync(cachePath)) {
|
|
146
|
-
writeFileSync(cachePath, JSON.stringify({ version: CACHE_VERSION, entries: {} }, null, 2));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Get cache statistics
|
|
151
|
-
*/
|
|
152
|
-
export function getCacheStats() {
|
|
153
|
-
const cachePath = getCachePath();
|
|
154
|
-
if (!cachePath || !existsSync(cachePath)) {
|
|
155
|
-
return { entries: 0, size: '0 B' };
|
|
156
|
-
}
|
|
157
|
-
const cache = loadCache();
|
|
158
|
-
const content = readFileSync(cachePath, 'utf-8');
|
|
159
|
-
const size = content.length;
|
|
160
|
-
const sizeStr = size < 1024
|
|
161
|
-
? `${size} B`
|
|
162
|
-
: size < 1024 * 1024
|
|
163
|
-
? `${(size / 1024).toFixed(1)} KB`
|
|
164
|
-
: `${(size / 1024 / 1024).toFixed(1)} MB`;
|
|
165
|
-
return {
|
|
166
|
-
entries: Object.keys(cache.entries).length,
|
|
167
|
-
size: sizeStr,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/commands/pcheck/cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAElD;;GAEG;AACH,SAAS,eAAe;IACtB,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACxB,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC;QACnB,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;YACnC,OAAO,GAAG,CAAC;QACb,CAAC;QAC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aAAa,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACzC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAG,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAE5B,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI;QACzB,CAAC,CAAC,GAAG,IAAI,IAAI;QACb,CAAC,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI;YAClB,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;YAClC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAE9C,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM;QAC1C,IAAI,EAAE,OAAO;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check evaluator for pcheck command
|
|
3
|
-
*
|
|
4
|
-
* Evaluates different types of checks:
|
|
5
|
-
* - file_exists: Check if a file matches a glob pattern
|
|
6
|
-
* - file_not_exists: Inverse of above
|
|
7
|
-
* - llm_check: Semantic check using Claude Haiku
|
|
8
|
-
* - command: Execute a shell command and check result
|
|
9
|
-
*/
|
|
10
|
-
import type { Check, CheckResult, EvaluationContext } from './types.js';
|
|
11
|
-
/**
|
|
12
|
-
* Evaluate a single check
|
|
13
|
-
*/
|
|
14
|
-
export declare function evaluateCheck(checkId: string, check: Check, context: EvaluationContext, useCache?: boolean): Promise<CheckResult>;
|
|
15
|
-
//# sourceMappingURL=evaluator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../src/commands/pcheck/evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,iBAAiB,EAKlB,MAAM,YAAY,CAAC;AAsPpB;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,GAAE,OAAc,GACvB,OAAO,CAAC,WAAW,CAAC,CA2BtB"}
|