codex-harness-kit 0.1.0
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/LICENSE +201 -0
- package/README.md +279 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +84 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/check-state.d.ts +4 -0
- package/dist/src/commands/check-state.js +15 -0
- package/dist/src/commands/check-state.js.map +1 -0
- package/dist/src/commands/init.d.ts +7 -0
- package/dist/src/commands/init.js +138 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/validate-harness.d.ts +4 -0
- package/dist/src/commands/validate-harness.js +9 -0
- package/dist/src/commands/validate-harness.js.map +1 -0
- package/dist/src/harness.d.ts +13 -0
- package/dist/src/harness.js +572 -0
- package/dist/src/harness.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/templates.d.ts +16 -0
- package/dist/src/templates.js +208 -0
- package/dist/src/templates.js.map +1 -0
- package/dist/src/types.d.ts +54 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
import { mkdir, readFile, stat } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { DEFAULT_CONFIG_PATH, HARNESS_BRIDGE_MARKER_END, HARNESS_BRIDGE_MARKER_START, HARNESS_MARKER_END, HARNESS_MARKER_START } from "./templates.js";
|
|
4
|
+
export { DEFAULT_CONFIG_PATH, HARNESS_BRIDGE_MARKER_END, HARNESS_BRIDGE_MARKER_START, HARNESS_MARKER_END, HARNESS_MARKER_START };
|
|
5
|
+
export async function pathExists(targetPath) {
|
|
6
|
+
try {
|
|
7
|
+
await stat(targetPath);
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export async function ensureParentDirectory(filePath) {
|
|
15
|
+
await mkdir(path.dirname(filePath), { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
export function relativeToRepo(repoRoot, targetPath) {
|
|
18
|
+
const relativePath = path.relative(repoRoot, targetPath);
|
|
19
|
+
return relativePath === "" ? "." : relativePath;
|
|
20
|
+
}
|
|
21
|
+
export function resolveFromRepo(repoRoot, configuredPath) {
|
|
22
|
+
return path.resolve(repoRoot, configuredPath);
|
|
23
|
+
}
|
|
24
|
+
export function hasMarkedBlock(content, startMarker, endMarker) {
|
|
25
|
+
const startIndex = content.indexOf(startMarker);
|
|
26
|
+
if (startIndex === -1) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const endIndex = content.indexOf(endMarker, startIndex + startMarker.length);
|
|
30
|
+
return endIndex !== -1;
|
|
31
|
+
}
|
|
32
|
+
export function getMarkedBlockContent(content, startMarker, endMarker) {
|
|
33
|
+
const startIndex = content.indexOf(startMarker);
|
|
34
|
+
if (startIndex === -1) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const blockStartIndex = startIndex + startMarker.length;
|
|
38
|
+
const endIndex = content.indexOf(endMarker, blockStartIndex);
|
|
39
|
+
if (endIndex === -1) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return content.slice(blockStartIndex, endIndex);
|
|
43
|
+
}
|
|
44
|
+
export function upsertMarkedBlock(existingContent, blockContent, startMarker, endMarker) {
|
|
45
|
+
const normalizedBlock = blockContent.trimEnd();
|
|
46
|
+
if (hasMarkedBlock(existingContent, startMarker, endMarker)) {
|
|
47
|
+
const pattern = new RegExp(`${escapeRegExp(startMarker)}[\\s\\S]*?${escapeRegExp(endMarker)}`, "u");
|
|
48
|
+
return `${existingContent.replace(pattern, normalizedBlock).trimEnd()}\n`;
|
|
49
|
+
}
|
|
50
|
+
const trimmedExisting = existingContent.trimEnd();
|
|
51
|
+
if (trimmedExisting === "") {
|
|
52
|
+
return `${normalizedBlock}\n`;
|
|
53
|
+
}
|
|
54
|
+
return `${trimmedExisting}\n\n${normalizedBlock}\n`;
|
|
55
|
+
}
|
|
56
|
+
async function readJson(filePath) {
|
|
57
|
+
try {
|
|
58
|
+
const content = await readFile(filePath, "utf8");
|
|
59
|
+
return {
|
|
60
|
+
value: JSON.parse(content)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
65
|
+
return { error: message };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function isRecord(value) {
|
|
69
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
70
|
+
}
|
|
71
|
+
function isStringArray(value) {
|
|
72
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
73
|
+
}
|
|
74
|
+
function validateConfigShape(config, configPath) {
|
|
75
|
+
const issues = [];
|
|
76
|
+
if (!isRecord(config)) {
|
|
77
|
+
return [
|
|
78
|
+
{
|
|
79
|
+
level: "error",
|
|
80
|
+
path: configPath,
|
|
81
|
+
message: "Expected a JSON object.",
|
|
82
|
+
suggestion: "Re-run `codex-harness-kit init --force` to restore the default file."
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
if (typeof config.version !== "number") {
|
|
87
|
+
issues.push({
|
|
88
|
+
level: "error",
|
|
89
|
+
path: configPath,
|
|
90
|
+
message: "Missing numeric `version` field."
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (!isRecord(config.paths)) {
|
|
94
|
+
issues.push({
|
|
95
|
+
level: "error",
|
|
96
|
+
path: configPath,
|
|
97
|
+
message: "Missing object `paths` field."
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const requiredPaths = ["stateFile", "memoryFile", "decisionsFile", "contractsDir"];
|
|
102
|
+
for (const key of requiredPaths) {
|
|
103
|
+
if (typeof config.paths[key] !== "string" || config.paths[key].trim() === "") {
|
|
104
|
+
issues.push({
|
|
105
|
+
level: "error",
|
|
106
|
+
path: configPath,
|
|
107
|
+
message: `Missing non-empty \`paths.${key}\` string.`
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (!isRecord(config.commands)) {
|
|
113
|
+
issues.push({
|
|
114
|
+
level: "error",
|
|
115
|
+
path: configPath,
|
|
116
|
+
message: "Missing object `commands` field."
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const requiredCommands = ["verifyQuick", "verifyFull", "docsGenerate"];
|
|
121
|
+
for (const key of requiredCommands) {
|
|
122
|
+
if (typeof config.commands[key] !== "string") {
|
|
123
|
+
issues.push({
|
|
124
|
+
level: "error",
|
|
125
|
+
path: configPath,
|
|
126
|
+
message: `Missing string \`commands.${key}\` field.`
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (typeof config.commands.verifyQuick === "string" &&
|
|
131
|
+
typeof config.commands.verifyFull === "string" &&
|
|
132
|
+
config.commands.verifyQuick.trim() === "" &&
|
|
133
|
+
config.commands.verifyFull.trim() === "") {
|
|
134
|
+
issues.push({
|
|
135
|
+
level: "warning",
|
|
136
|
+
path: configPath,
|
|
137
|
+
message: "Verification commands are still blank.",
|
|
138
|
+
suggestion: "Set `commands.verifyQuick` and optionally `commands.verifyFull` after initialization."
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (!isRecord(config.rules)) {
|
|
143
|
+
issues.push({
|
|
144
|
+
level: "error",
|
|
145
|
+
path: configPath,
|
|
146
|
+
message: "Missing object `rules` field."
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
else if (typeof config.rules.maxRepeatedFailures !== "number" ||
|
|
150
|
+
config.rules.maxRepeatedFailures < 1) {
|
|
151
|
+
issues.push({
|
|
152
|
+
level: "error",
|
|
153
|
+
path: configPath,
|
|
154
|
+
message: "`rules.maxRepeatedFailures` must be a number greater than or equal to 1."
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return issues;
|
|
158
|
+
}
|
|
159
|
+
function validateStateShape(state, statePath) {
|
|
160
|
+
const issues = [];
|
|
161
|
+
if (!isRecord(state)) {
|
|
162
|
+
return [
|
|
163
|
+
{
|
|
164
|
+
level: "error",
|
|
165
|
+
path: statePath,
|
|
166
|
+
message: "Expected a JSON object.",
|
|
167
|
+
suggestion: "Re-run `codex-harness-kit init --force` to restore the default state."
|
|
168
|
+
}
|
|
169
|
+
];
|
|
170
|
+
}
|
|
171
|
+
const requiredStrings = [
|
|
172
|
+
"currentGoal",
|
|
173
|
+
"status",
|
|
174
|
+
"currentContract",
|
|
175
|
+
"nextStep",
|
|
176
|
+
"lastUpdated"
|
|
177
|
+
];
|
|
178
|
+
for (const key of requiredStrings) {
|
|
179
|
+
if (typeof state[key] !== "string") {
|
|
180
|
+
issues.push({
|
|
181
|
+
level: "error",
|
|
182
|
+
path: statePath,
|
|
183
|
+
message: `Missing string \`${key}\` field.`
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (!isStringArray(state.blockers)) {
|
|
188
|
+
issues.push({
|
|
189
|
+
level: "error",
|
|
190
|
+
path: statePath,
|
|
191
|
+
message: "`blockers` must be an array of strings."
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
if (!isRecord(state.verification)) {
|
|
195
|
+
issues.push({
|
|
196
|
+
level: "error",
|
|
197
|
+
path: statePath,
|
|
198
|
+
message: "Missing object `verification` field."
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
const verificationKeys = ["lastCommand", "lastResult", "notes"];
|
|
203
|
+
for (const key of verificationKeys) {
|
|
204
|
+
if (typeof state.verification[key] !== "string") {
|
|
205
|
+
issues.push({
|
|
206
|
+
level: "error",
|
|
207
|
+
path: statePath,
|
|
208
|
+
message: `Missing string \`verification.${key}\` field.`
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (typeof state.lastUpdated === "string" && Number.isNaN(Date.parse(state.lastUpdated))) {
|
|
214
|
+
issues.push({
|
|
215
|
+
level: "warning",
|
|
216
|
+
path: statePath,
|
|
217
|
+
message: "`lastUpdated` is not a valid ISO timestamp."
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return issues;
|
|
221
|
+
}
|
|
222
|
+
export async function validateHarness(repoRootInput) {
|
|
223
|
+
const repoRoot = path.resolve(repoRootInput);
|
|
224
|
+
const issues = [];
|
|
225
|
+
const agentsPath = path.join(repoRoot, "AGENTS.md");
|
|
226
|
+
const harnessAgentsPath = path.join(repoRoot, "AGENTS.harness.md");
|
|
227
|
+
const hasAgents = await pathExists(agentsPath);
|
|
228
|
+
const hasHarnessAgents = await pathExists(harnessAgentsPath);
|
|
229
|
+
if (!hasAgents && !hasHarnessAgents) {
|
|
230
|
+
issues.push({
|
|
231
|
+
level: "error",
|
|
232
|
+
path: "AGENTS.md",
|
|
233
|
+
message: "Missing `AGENTS.md`.",
|
|
234
|
+
suggestion: "Run `codex-harness-kit init` in this repository."
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
else if (!hasAgents && hasHarnessAgents) {
|
|
238
|
+
issues.push({
|
|
239
|
+
level: "error",
|
|
240
|
+
path: "AGENTS.md",
|
|
241
|
+
message: "`AGENTS.harness.md` exists, but `AGENTS.md` is missing so the harness is not activated.",
|
|
242
|
+
suggestion: "Create `AGENTS.md` or rerun `codex-harness-kit init` so the activation bridge can be added."
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
issues.push(...(await validateHarnessActivation(agentsPath, harnessAgentsPath, hasHarnessAgents)));
|
|
247
|
+
}
|
|
248
|
+
const configPath = path.join(repoRoot, DEFAULT_CONFIG_PATH);
|
|
249
|
+
if (!(await pathExists(configPath))) {
|
|
250
|
+
issues.push({
|
|
251
|
+
level: "error",
|
|
252
|
+
path: DEFAULT_CONFIG_PATH,
|
|
253
|
+
message: "Missing harness config file.",
|
|
254
|
+
suggestion: "Run `codex-harness-kit init` to generate the default harness files."
|
|
255
|
+
});
|
|
256
|
+
return {
|
|
257
|
+
ok: false,
|
|
258
|
+
repoRoot,
|
|
259
|
+
agentsFile: hasAgents ? "AGENTS.md" : hasHarnessAgents ? "AGENTS.harness.md" : null,
|
|
260
|
+
issues
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
const configLoad = await readJson(configPath);
|
|
264
|
+
if (configLoad.error) {
|
|
265
|
+
issues.push({
|
|
266
|
+
level: "error",
|
|
267
|
+
path: DEFAULT_CONFIG_PATH,
|
|
268
|
+
message: `Invalid JSON: ${configLoad.error}`,
|
|
269
|
+
suggestion: "Fix the JSON syntax or restore the file with `codex-harness-kit init --force`."
|
|
270
|
+
});
|
|
271
|
+
return {
|
|
272
|
+
ok: false,
|
|
273
|
+
repoRoot,
|
|
274
|
+
agentsFile: hasAgents ? "AGENTS.md" : hasHarnessAgents ? "AGENTS.harness.md" : null,
|
|
275
|
+
issues
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
const config = configLoad.value;
|
|
279
|
+
issues.push(...validateConfigShape(config, DEFAULT_CONFIG_PATH));
|
|
280
|
+
if (!config || issues.some((issue) => issue.level === "error")) {
|
|
281
|
+
return {
|
|
282
|
+
ok: false,
|
|
283
|
+
repoRoot,
|
|
284
|
+
agentsFile: hasAgents ? "AGENTS.md" : hasHarnessAgents ? "AGENTS.harness.md" : null,
|
|
285
|
+
issues,
|
|
286
|
+
config
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
const statePath = resolveFromRepo(repoRoot, config.paths.stateFile);
|
|
290
|
+
const memoryPath = resolveFromRepo(repoRoot, config.paths.memoryFile);
|
|
291
|
+
const decisionsPath = resolveFromRepo(repoRoot, config.paths.decisionsFile);
|
|
292
|
+
const contractsDirPath = resolveFromRepo(repoRoot, config.paths.contractsDir);
|
|
293
|
+
const contractsReadmePath = path.join(contractsDirPath, "README.md");
|
|
294
|
+
if (!(await pathExists(statePath))) {
|
|
295
|
+
issues.push({
|
|
296
|
+
level: "error",
|
|
297
|
+
path: config.paths.stateFile,
|
|
298
|
+
message: "Missing state file."
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (!(await pathExists(memoryPath))) {
|
|
302
|
+
issues.push({
|
|
303
|
+
level: "error",
|
|
304
|
+
path: config.paths.memoryFile,
|
|
305
|
+
message: "Missing project memory file."
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
if (!(await pathExists(decisionsPath))) {
|
|
309
|
+
issues.push({
|
|
310
|
+
level: "error",
|
|
311
|
+
path: config.paths.decisionsFile,
|
|
312
|
+
message: "Missing decisions file."
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
if (!(await pathExists(contractsDirPath))) {
|
|
316
|
+
issues.push({
|
|
317
|
+
level: "error",
|
|
318
|
+
path: config.paths.contractsDir,
|
|
319
|
+
message: "Missing contracts directory."
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
else if (!(await pathExists(contractsReadmePath))) {
|
|
323
|
+
issues.push({
|
|
324
|
+
level: "error",
|
|
325
|
+
path: path.join(config.paths.contractsDir, "README.md"),
|
|
326
|
+
message: "Missing contracts README."
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
let state;
|
|
330
|
+
if (await pathExists(statePath)) {
|
|
331
|
+
const stateLoad = await readJson(statePath);
|
|
332
|
+
if (stateLoad.error) {
|
|
333
|
+
issues.push({
|
|
334
|
+
level: "error",
|
|
335
|
+
path: config.paths.stateFile,
|
|
336
|
+
message: `Invalid JSON: ${stateLoad.error}`,
|
|
337
|
+
suggestion: "Fix the JSON syntax or restore the file with `codex-harness-kit init --force`."
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
const loadedState = stateLoad.value;
|
|
342
|
+
if (loadedState === undefined) {
|
|
343
|
+
issues.push({
|
|
344
|
+
level: "error",
|
|
345
|
+
path: config.paths.stateFile,
|
|
346
|
+
message: "State file parsed but no data was returned."
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
state = loadedState;
|
|
351
|
+
issues.push(...validateStateShape(state, config.paths.stateFile));
|
|
352
|
+
if (state.currentContract.trim() !== "") {
|
|
353
|
+
const contractPath = resolveFromRepo(repoRoot, state.currentContract);
|
|
354
|
+
if (!(await pathExists(contractPath))) {
|
|
355
|
+
issues.push({
|
|
356
|
+
level: "error",
|
|
357
|
+
path: state.currentContract,
|
|
358
|
+
message: "The active contract file does not exist."
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
issues.push({
|
|
364
|
+
level: "warning",
|
|
365
|
+
path: config.paths.stateFile,
|
|
366
|
+
message: "No active contract is set in `currentContract`."
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const ok = !issues.some((issue) => issue.level === "error");
|
|
373
|
+
return {
|
|
374
|
+
ok,
|
|
375
|
+
repoRoot,
|
|
376
|
+
agentsFile: hasAgents ? "AGENTS.md" : hasHarnessAgents ? "AGENTS.harness.md" : null,
|
|
377
|
+
issues,
|
|
378
|
+
config,
|
|
379
|
+
state
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
export function renderValidationReport(report) {
|
|
383
|
+
const lines = [];
|
|
384
|
+
lines.push(`Harness validation for ${report.repoRoot}`);
|
|
385
|
+
lines.push(report.ok ? "PASS" : "FAIL");
|
|
386
|
+
if (report.issues.length === 0) {
|
|
387
|
+
lines.push("- No issues found.");
|
|
388
|
+
return lines.join("\n");
|
|
389
|
+
}
|
|
390
|
+
const errors = report.issues.filter((issue) => issue.level === "error");
|
|
391
|
+
const warnings = report.issues.filter((issue) => issue.level === "warning");
|
|
392
|
+
if (errors.length > 0) {
|
|
393
|
+
lines.push("");
|
|
394
|
+
lines.push("Errors:");
|
|
395
|
+
for (const issue of errors) {
|
|
396
|
+
lines.push(formatIssue(issue));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (warnings.length > 0) {
|
|
400
|
+
lines.push("");
|
|
401
|
+
lines.push("Warnings:");
|
|
402
|
+
for (const issue of warnings) {
|
|
403
|
+
lines.push(formatIssue(issue));
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return lines.join("\n");
|
|
407
|
+
}
|
|
408
|
+
function formatIssue(issue) {
|
|
409
|
+
const parts = [`- ${issue.path ? `${issue.path}: ` : ""}${issue.message}`];
|
|
410
|
+
if (issue.suggestion) {
|
|
411
|
+
parts.push(` Suggestion: ${issue.suggestion}`);
|
|
412
|
+
}
|
|
413
|
+
return parts.join("\n");
|
|
414
|
+
}
|
|
415
|
+
export async function buildStateSummary(repoRootInput) {
|
|
416
|
+
const report = await validateHarness(repoRootInput);
|
|
417
|
+
if (!report.ok || !report.config || !report.state) {
|
|
418
|
+
throw new Error(renderValidationReport(report));
|
|
419
|
+
}
|
|
420
|
+
const repoRoot = report.repoRoot;
|
|
421
|
+
const { config, state } = report;
|
|
422
|
+
const contractLabel = await describeContract(repoRoot, state.currentContract);
|
|
423
|
+
const blockers = state.blockers.length > 0 ? state.blockers.map((item) => ` - ${item}`) : [" - none"];
|
|
424
|
+
const verificationCommand = state.verification.lastCommand.trim() === "" ? "(not recorded)" : state.verification.lastCommand;
|
|
425
|
+
const verificationNotes = state.verification.notes.trim() === "" ? "(no notes)" : state.verification.notes;
|
|
426
|
+
const lines = [
|
|
427
|
+
`Harness state for ${repoRoot}`,
|
|
428
|
+
`- Current goal: ${fallbackValue(state.currentGoal)}`,
|
|
429
|
+
`- Current status: ${fallbackValue(state.status)}`,
|
|
430
|
+
`- Current contract: ${contractLabel}`,
|
|
431
|
+
"- Blockers:",
|
|
432
|
+
...blockers,
|
|
433
|
+
`- Recent verification result: ${fallbackValue(state.verification.lastResult)}`,
|
|
434
|
+
`- Recent verification command: ${verificationCommand}`,
|
|
435
|
+
`- Recent verification notes: ${verificationNotes}`,
|
|
436
|
+
`- Next step suggestion: ${buildNextStepSuggestion(config, state)}`,
|
|
437
|
+
`- Last updated: ${fallbackValue(state.lastUpdated)}`
|
|
438
|
+
];
|
|
439
|
+
return lines.join("\n");
|
|
440
|
+
}
|
|
441
|
+
async function describeContract(repoRoot, currentContract) {
|
|
442
|
+
const contractPath = currentContract.trim();
|
|
443
|
+
if (contractPath === "") {
|
|
444
|
+
return "(not set)";
|
|
445
|
+
}
|
|
446
|
+
const absolutePath = resolveFromRepo(repoRoot, contractPath);
|
|
447
|
+
if (!(await pathExists(absolutePath))) {
|
|
448
|
+
return `${contractPath} (missing)`;
|
|
449
|
+
}
|
|
450
|
+
const content = await readFile(absolutePath, "utf8");
|
|
451
|
+
const title = extractMarkdownTitle(content);
|
|
452
|
+
return title ? `${contractPath} (${title})` : contractPath;
|
|
453
|
+
}
|
|
454
|
+
function extractMarkdownTitle(content) {
|
|
455
|
+
for (const line of content.split(/\r?\n/u)) {
|
|
456
|
+
if (line.startsWith("# ")) {
|
|
457
|
+
return line.slice(2).trim();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
function fallbackValue(value) {
|
|
463
|
+
return value.trim() === "" ? "(not set)" : value;
|
|
464
|
+
}
|
|
465
|
+
function buildNextStepSuggestion(config, state) {
|
|
466
|
+
if (state.blockers.length > 0) {
|
|
467
|
+
return "Resolve the blockers or explicitly re-plan before more implementation work.";
|
|
468
|
+
}
|
|
469
|
+
if (state.currentGoal.trim() === "") {
|
|
470
|
+
return `Set \`currentGoal\` in ${config.paths.stateFile} before continuing.`;
|
|
471
|
+
}
|
|
472
|
+
if (state.currentContract.trim() === "") {
|
|
473
|
+
return "Point `currentContract` at the active contract before editing code.";
|
|
474
|
+
}
|
|
475
|
+
if (state.verification.lastResult.toLowerCase() === "failed") {
|
|
476
|
+
return "Review the last failing verification before retrying more changes.";
|
|
477
|
+
}
|
|
478
|
+
if (config.commands.verifyQuick.trim() === "") {
|
|
479
|
+
return "Configure `commands.verifyQuick` in docs/harness-config.json so minimal verification is explicit.";
|
|
480
|
+
}
|
|
481
|
+
if (state.nextStep.trim() !== "") {
|
|
482
|
+
return state.nextStep;
|
|
483
|
+
}
|
|
484
|
+
return "Read the active contract, make the next scoped change, then record validation results.";
|
|
485
|
+
}
|
|
486
|
+
async function validateHarnessActivation(agentsPath, harnessAgentsPath, hasHarnessAgents) {
|
|
487
|
+
const issues = [];
|
|
488
|
+
const agentsContent = await readFile(agentsPath, "utf8");
|
|
489
|
+
const hasFullHarnessBlock = hasMarkedBlock(agentsContent, HARNESS_MARKER_START, HARNESS_MARKER_END);
|
|
490
|
+
const hasBridgeBlock = hasMarkedBlock(agentsContent, HARNESS_BRIDGE_MARKER_START, HARNESS_BRIDGE_MARKER_END);
|
|
491
|
+
if (hasFullHarnessBlock) {
|
|
492
|
+
if (!hasValidFullHarnessContent(agentsContent)) {
|
|
493
|
+
issues.push({
|
|
494
|
+
level: "error",
|
|
495
|
+
path: "AGENTS.md",
|
|
496
|
+
message: "`AGENTS.md` contains codex-harness-kit markers, but the harness block is empty or missing required workflow instructions.",
|
|
497
|
+
suggestion: "Re-run `codex-harness-kit init --force` or restore the harness-managed instructions inside the codex-harness-kit block."
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
return issues;
|
|
501
|
+
}
|
|
502
|
+
if (!hasBridgeBlock) {
|
|
503
|
+
issues.push({
|
|
504
|
+
level: "error",
|
|
505
|
+
path: "AGENTS.md",
|
|
506
|
+
message: hasHarnessAgents
|
|
507
|
+
? "`AGENTS.harness.md` exists, but `AGENTS.md` does not activate it with a codex-harness-kit bridge or merged harness block."
|
|
508
|
+
: "`AGENTS.md` exists, but codex-harness-kit is not activated in it.",
|
|
509
|
+
suggestion: "Run `codex-harness-kit init` again, or merge the codex-harness-kit harness block into `AGENTS.md`."
|
|
510
|
+
});
|
|
511
|
+
return issues;
|
|
512
|
+
}
|
|
513
|
+
if (!hasValidBridgeContent(agentsContent)) {
|
|
514
|
+
issues.push({
|
|
515
|
+
level: "error",
|
|
516
|
+
path: "AGENTS.md",
|
|
517
|
+
message: "`AGENTS.md` contains codex-harness-kit bridge markers, but the bridge block is empty or missing the activation instructions.",
|
|
518
|
+
suggestion: "Re-run `codex-harness-kit init` or restore the bridge text that points `AGENTS.md` to `AGENTS.harness.md`."
|
|
519
|
+
});
|
|
520
|
+
return issues;
|
|
521
|
+
}
|
|
522
|
+
if (!hasHarnessAgents) {
|
|
523
|
+
issues.push({
|
|
524
|
+
level: "error",
|
|
525
|
+
path: "AGENTS.harness.md",
|
|
526
|
+
message: "`AGENTS.md` contains the codex-harness-kit bridge, but the harness supplement file is missing.",
|
|
527
|
+
suggestion: "Run `codex-harness-kit init` again to recreate `AGENTS.harness.md`."
|
|
528
|
+
});
|
|
529
|
+
return issues;
|
|
530
|
+
}
|
|
531
|
+
const harnessAgentsContent = await readFile(harnessAgentsPath, "utf8");
|
|
532
|
+
if (!hasMarkedBlock(harnessAgentsContent, HARNESS_MARKER_START, HARNESS_MARKER_END)) {
|
|
533
|
+
issues.push({
|
|
534
|
+
level: "error",
|
|
535
|
+
path: "AGENTS.harness.md",
|
|
536
|
+
message: "`AGENTS.harness.md` exists, but it does not contain the codex-harness-kit harness block.",
|
|
537
|
+
suggestion: "Re-run `codex-harness-kit init --force` or restore the harness-managed block in `AGENTS.harness.md`."
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
else if (!hasValidHarnessSupplementContent(harnessAgentsContent)) {
|
|
541
|
+
issues.push({
|
|
542
|
+
level: "error",
|
|
543
|
+
path: "AGENTS.harness.md",
|
|
544
|
+
message: "`AGENTS.harness.md` contains codex-harness-kit markers, but the harness block is empty or missing required workflow instructions.",
|
|
545
|
+
suggestion: "Re-run `codex-harness-kit init --force` or restore the harness-managed instructions inside `AGENTS.harness.md`."
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
return issues;
|
|
549
|
+
}
|
|
550
|
+
function hasValidBridgeContent(agentsContent) {
|
|
551
|
+
return hasRequiredSnippets(getMarkedBlockContent(agentsContent, HARNESS_BRIDGE_MARKER_START, HARNESS_BRIDGE_MARKER_END), ["codex-harness-kit", "AGENTS.harness.md", "paths"]);
|
|
552
|
+
}
|
|
553
|
+
function hasValidFullHarnessContent(agentsContent) {
|
|
554
|
+
return hasRequiredSnippets(getMarkedBlockContent(agentsContent, HARNESS_MARKER_START, HARNESS_MARKER_END), ["currentContract", "paths.stateFile", "Final responses"]);
|
|
555
|
+
}
|
|
556
|
+
function hasValidHarnessSupplementContent(harnessAgentsContent) {
|
|
557
|
+
return hasRequiredSnippets(getMarkedBlockContent(harnessAgentsContent, HARNESS_MARKER_START, HARNESS_MARKER_END), ["currentContract", "paths.stateFile", "Final responses"]);
|
|
558
|
+
}
|
|
559
|
+
function hasRequiredSnippets(content, requiredSnippets) {
|
|
560
|
+
if (content === null) {
|
|
561
|
+
return false;
|
|
562
|
+
}
|
|
563
|
+
const normalizedContent = content.trim();
|
|
564
|
+
if (normalizedContent === "") {
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
return requiredSnippets.every((snippet) => normalizedContent.includes(snippet));
|
|
568
|
+
}
|
|
569
|
+
function escapeRegExp(value) {
|
|
570
|
+
return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
571
|
+
}
|
|
572
|
+
//# sourceMappingURL=harness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.js","sourceRoot":"","sources":["../../src/harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,E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AAE,oBAAoB,EAAE,kBAAkB,CAAC,EAC9E,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAC1D,CAAC;AACJ,CAAC;AAED,SAAS,gCAAgC,CAAC,oBAA4B;IACpE,OAAO,mBAAmB,CACxB,qBAAqB,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,kBAAkB,CAAC,EACrF,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAC1D,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAsB,EAAE,gBAA0B;IAC7E,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,iBAAiB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACzC,IAAI,iBAAiB,KAAK,EAAE,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { initializeHarness, renderInitResult } from "./commands/init.js";
|
|
2
|
+
export { runCheckState } from "./commands/check-state.js";
|
|
3
|
+
export { runValidateHarness } from "./commands/validate-harness.js";
|
|
4
|
+
export { buildStateSummary, renderValidationReport, validateHarness } from "./harness.js";
|
|
5
|
+
export type { FileAction, HarnessConfig, HarnessState, InitResult, ValidationIssue, ValidationReport } from "./types.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { initializeHarness, renderInitResult } from "./commands/init.js";
|
|
2
|
+
export { runCheckState } from "./commands/check-state.js";
|
|
3
|
+
export { runValidateHarness } from "./commands/validate-harness.js";
|
|
4
|
+
export { buildStateSummary, renderValidationReport, validateHarness } from "./harness.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HarnessConfig, HarnessState } from "./types.js";
|
|
2
|
+
export declare const DEFAULT_CONFIG_PATH = "docs/harness-config.json";
|
|
3
|
+
export declare const HARNESS_MARKER_START = "<!-- codex-harness-kit:start -->";
|
|
4
|
+
export declare const HARNESS_MARKER_END = "<!-- codex-harness-kit:end -->";
|
|
5
|
+
export declare const HARNESS_BRIDGE_MARKER_START = "<!-- codex-harness-kit:bridge:start -->";
|
|
6
|
+
export declare const HARNESS_BRIDGE_MARKER_END = "<!-- codex-harness-kit:bridge:end -->";
|
|
7
|
+
export declare function createDefaultConfig(): HarnessConfig;
|
|
8
|
+
export declare function createDefaultState(now?: Date): HarnessState;
|
|
9
|
+
export declare function renderJsonFile(value: unknown): string;
|
|
10
|
+
export declare function renderAgentsTemplate(configPath?: string): string;
|
|
11
|
+
export declare function renderAgentsHarnessSupplement(configPath?: string): string;
|
|
12
|
+
export declare function renderAgentsActivationBridge(configPath?: string): string;
|
|
13
|
+
export declare function renderProjectMemoryTemplate(): string;
|
|
14
|
+
export declare function renderDecisionsTemplate(): string;
|
|
15
|
+
export declare function renderContractsReadmeTemplate(): string;
|
|
16
|
+
export declare function renderExampleContractTemplate(): string;
|