@vaubaan/harness 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +229 -112
- package/dist/agents/coding.agent.md +1 -2
- package/dist/agents/merge.agent.md +2 -2
- package/dist/agents/planning.agent.md +1 -1
- package/dist/agents/review.agent.md +1 -1
- package/dist/cli/index.js +51 -23
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -9
- package/dist/index.js.map +1 -1
- package/dist/init.js +42 -9
- package/dist/init.js.map +1 -1
- package/dist/linters/index.js +3 -2
- package/dist/linters/index.js.map +1 -1
- package/dist/render.js +41 -8
- package/dist/render.js.map +1 -1
- package/dist/skills/spec-writer.skill.md +1 -1
- package/dist/skills/test-plan-writer.skill.md +1 -1
- package/package.json +9 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "1.3.
|
|
2
|
+
var VERSION = "1.3.2";
|
|
3
3
|
|
|
4
4
|
// src/cli/init.ts
|
|
5
5
|
import { existsSync as existsSync6, mkdirSync, writeFileSync as writeFileSync3 } from "fs";
|
|
@@ -546,18 +546,26 @@ ${body}` });
|
|
|
546
546
|
renderStopHook() {
|
|
547
547
|
const content = `import { spawnSync } from "node:child_process";
|
|
548
548
|
|
|
549
|
-
|
|
549
|
+
// Runs the harness lint and returns the report to inject, or "" when the
|
|
550
|
+
// turn may end.
|
|
551
|
+
const lintReport = (directory, sessionID) => {
|
|
552
|
+
const r = spawnSync(
|
|
553
|
+
"npx",
|
|
554
|
+
["-y", "${STOP_HOOK_PACKAGE}", "stop-hook", "--engine", "opencode", "--cwd", directory],
|
|
555
|
+
{ input: JSON.stringify({ sessionID }), encoding: "utf-8" },
|
|
556
|
+
);
|
|
557
|
+
const report = (r.stderr ?? "").trim();
|
|
558
|
+
return r.status === 2 ? report : "";
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
// OpenCode 1.x entry point, exposed as server() below.
|
|
562
|
+
const HarnessStopHook = async ({ client, directory }) => ({
|
|
550
563
|
event: async ({ event }) => {
|
|
551
564
|
if (event.type !== "session.idle") return;
|
|
552
565
|
const sessionID = event.properties?.sessionID;
|
|
553
566
|
if (!sessionID) return;
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
["-y", "${STOP_HOOK_PACKAGE}", "stop-hook", "--engine", "opencode", "--cwd", directory],
|
|
557
|
-
{ input: JSON.stringify({ sessionID }), encoding: "utf-8" },
|
|
558
|
-
);
|
|
559
|
-
const report = (r.stderr ?? "").trim();
|
|
560
|
-
if (r.status !== 2 || report === "") return;
|
|
567
|
+
const report = lintReport(directory, sessionID);
|
|
568
|
+
if (report === "") return;
|
|
561
569
|
// OpenCode defaults to its build agent when a prompt omits agent.
|
|
562
570
|
// Preserve the last conversation persona, excluding compaction summaries.
|
|
563
571
|
const history = await client.session.messages({ path: { id: sessionID } }).catch(() => undefined);
|
|
@@ -573,6 +581,31 @@ export const HarnessStopHook = async ({ client, directory }) => ({
|
|
|
573
581
|
});
|
|
574
582
|
},
|
|
575
583
|
});
|
|
584
|
+
|
|
585
|
+
// One default export for both majors: OpenCode 1.x calls server(),
|
|
586
|
+
// OpenCode 2.x calls setup(). A V2 session keeps its agent, so the report
|
|
587
|
+
// is sent without naming the persona.
|
|
588
|
+
export default {
|
|
589
|
+
id: "vaubaan-harness-stop-hook",
|
|
590
|
+
server: HarnessStopHook,
|
|
591
|
+
setup(context) {
|
|
592
|
+
const directory = context.location.directory;
|
|
593
|
+
const controller = new AbortController();
|
|
594
|
+
const listen = async () => {
|
|
595
|
+
for await (const event of context.event.subscribe({ signal: controller.signal })) {
|
|
596
|
+
if (event.type !== "session.idle") continue;
|
|
597
|
+
if (event.location?.directory && event.location.directory !== directory) continue;
|
|
598
|
+
const sessionID = event.data?.sessionID;
|
|
599
|
+
if (!sessionID) continue;
|
|
600
|
+
const report = lintReport(directory, sessionID);
|
|
601
|
+
if (report === "") continue;
|
|
602
|
+
await context.session.prompt({ sessionID, text: report }).catch(() => undefined);
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
listen().catch(() => undefined);
|
|
606
|
+
return () => controller.abort();
|
|
607
|
+
},
|
|
608
|
+
};
|
|
576
609
|
`;
|
|
577
610
|
return {
|
|
578
611
|
files: [{ path: `${BASE3}/plugins/harness-stop-hook.ts`, content }],
|