@cardor/agent-harness-kit 1.10.0 → 1.10.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/README.md +8 -4
- package/dist/cli.js +23 -59
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -142,7 +142,7 @@ Then run the interactive setup inside your project:
|
|
|
142
142
|
npx ahk init
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
> **Local install
|
|
145
|
+
> **Local install recommended.** The generated `agent-harness-kit.config.ts` uses `import type`, which is erased at compile time, so `ahk` no longer needs to resolve the package from your project's `node_modules` at runtime. If it detects a **global-only** install (`npm install -g @cardor/agent-harness-kit`), it prints a non-blocking warning recommending `npm install --save-dev @cardor/agent-harness-kit` (or the `pnpm`/`yarn`/`bun` equivalent) — the command still runs and exits normally either way. This is only about keeping the CLI version pinned and reproducible across your team and CI, not a functional requirement.
|
|
146
146
|
>
|
|
147
147
|
> This check also works with **Yarn Berry (PnP)** projects, which never create a `node_modules` folder — `ahk` detects `.pnp.cjs`/`.pnp.loader.mjs` and falls back to checking that the package is declared in `package.json` instead of requiring a `node_modules` entry.
|
|
148
148
|
|
|
@@ -522,9 +522,9 @@ The `tasks` table includes an `updated_at` timestamp column, set on creation and
|
|
|
522
522
|
Everything in the config file is yours to change:
|
|
523
523
|
|
|
524
524
|
```ts
|
|
525
|
-
import {
|
|
525
|
+
import type { HarnessConfig } from '@cardor/agent-harness-kit'
|
|
526
526
|
|
|
527
|
-
|
|
527
|
+
const config: HarnessConfig = {
|
|
528
528
|
project: {
|
|
529
529
|
name: 'My App',
|
|
530
530
|
description: 'What this project does',
|
|
@@ -578,9 +578,13 @@ export default defineHarness({
|
|
|
578
578
|
mcp: { enabled: true, port: 3742 },
|
|
579
579
|
scripts: { enabled: true, outputDir: './.harness/scripts' },
|
|
580
580
|
},
|
|
581
|
-
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export default config
|
|
582
584
|
```
|
|
583
585
|
|
|
586
|
+
> `defineHarness()` is still exported for anyone who prefers the value-import form (`import { defineHarness } from '@cardor/agent-harness-kit'` + `export default defineHarness({ ... })`) — it's an identity function kept for backward compatibility, and `loadConfig()` supports both shapes.
|
|
587
|
+
|
|
584
588
|
### `health.sh`
|
|
585
589
|
|
|
586
590
|
This is the most important file to implement. Agents will not start or close tasks until this script exits 0. Examples:
|
package/dist/cli.js
CHANGED
|
@@ -530,12 +530,9 @@ If orchestrating: Agent definition files in .claude/agents/
|
|
|
530
530
|
function modelField(model) {
|
|
531
531
|
return model ? `, model: ${JSON.stringify(model)}` : "";
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function configObjectBody(params) {
|
|
534
534
|
const models = params.models ?? {};
|
|
535
|
-
return `
|
|
536
|
-
|
|
537
|
-
export default defineHarness({
|
|
538
|
-
project: {
|
|
535
|
+
return ` project: {
|
|
539
536
|
name: ${JSON.stringify(params.name)},
|
|
540
537
|
description: ${JSON.stringify(params.description)},
|
|
541
538
|
docsPath: '${params.docsPath}',
|
|
@@ -583,64 +580,29 @@ export default defineHarness({
|
|
|
583
580
|
mcp: { enabled: true, port: ${params.port} },
|
|
584
581
|
scripts: { enabled: true, outputDir: './.harness/scripts' },
|
|
585
582
|
},
|
|
586
|
-
})
|
|
587
583
|
`;
|
|
588
584
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
const models = params.models ?? {};
|
|
592
|
-
return `const { defineHarness } = require('@cardor/agent-harness-kit')
|
|
593
|
-
|
|
594
|
-
module.exports = defineHarness({
|
|
595
|
-
project: {
|
|
596
|
-
name: ${JSON.stringify(params.name)},
|
|
597
|
-
description: ${JSON.stringify(params.description)},
|
|
598
|
-
docsPath: '${params.docsPath}',
|
|
599
|
-
},
|
|
600
|
-
|
|
601
|
-
provider: '${params.provider}',
|
|
602
|
-
|
|
603
|
-
agents: {
|
|
604
|
-
lead: { instructionsPath: null${modelField(models.lead)} },
|
|
605
|
-
explorer: { instructionsPath: null, allowedPaths: ['${params.docsPath}', './src']${modelField(models.explorer)} },
|
|
606
|
-
builder: { instructionsPath: null, writablePaths: ['./src', './tests']${modelField(models.builder)} },
|
|
607
|
-
reviewer: { instructionsPath: null${modelField(models.reviewer)} },
|
|
608
|
-
${models.consultant ? `consultant: { instructionsPath: null${modelField(models.consultant)} },
|
|
609
|
-
` : ""}custom: [],
|
|
610
|
-
},
|
|
585
|
+
function configTs(params) {
|
|
586
|
+
return `import type { HarnessConfig } from '@cardor/agent-harness-kit'
|
|
611
587
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
// database: { type: 'mysql', connectionString: process.env.DATABASE_URL },
|
|
615
|
-
database: { type: 'sqlite', path: '.harness/harness.db' },
|
|
588
|
+
const config: HarnessConfig = {
|
|
589
|
+
${configObjectBody(params)}}
|
|
616
590
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
result: true,
|
|
624
|
-
blockers: true,
|
|
625
|
-
nextSteps: false,
|
|
626
|
-
},
|
|
627
|
-
markdownFallback: { enabled: true, path: '.harness/current.md' },
|
|
628
|
-
// 'local' \u2014 DB lives in .harness/ (project-relative). 'global' \u2014 DB lives
|
|
629
|
-
// under ~/.harness/dbs/<projectId>/, outside the project tree.
|
|
630
|
-
scope: '${params.scope}',
|
|
631
|
-
projectId: '${params.projectId}',
|
|
632
|
-
},
|
|
591
|
+
export default config
|
|
592
|
+
`;
|
|
593
|
+
}
|
|
594
|
+
function configMjs(params) {
|
|
595
|
+
return `const config = {
|
|
596
|
+
${configObjectBody(params)}}
|
|
633
597
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
598
|
+
export default config
|
|
599
|
+
`;
|
|
600
|
+
}
|
|
601
|
+
function configCjs(params) {
|
|
602
|
+
return `const config = {
|
|
603
|
+
${configObjectBody(params)}}
|
|
638
604
|
|
|
639
|
-
|
|
640
|
-
mcp: { enabled: true, port: ${params.port} },
|
|
641
|
-
scripts: { enabled: true, outputDir: './.harness/scripts' },
|
|
642
|
-
},
|
|
643
|
-
})
|
|
605
|
+
module.exports = config
|
|
644
606
|
`;
|
|
645
607
|
}
|
|
646
608
|
function agentLead(vars) {
|
|
@@ -3750,7 +3712,10 @@ function isLocalInstallSatisfied(cwd2) {
|
|
|
3750
3712
|
return false;
|
|
3751
3713
|
}
|
|
3752
3714
|
function printLocalInstallWarning() {
|
|
3753
|
-
console.error(pc17.
|
|
3715
|
+
console.error(pc17.yellow(`\u26A0 ${pkg.name} is not installed locally in this project.`));
|
|
3716
|
+
console.error(pc17.dim(" This is only a recommendation for reproducibility: pinning a local"));
|
|
3717
|
+
console.error(pc17.dim(" version keeps behavior consistent across your team and CI, instead of"));
|
|
3718
|
+
console.error(pc17.dim(" drifting with whatever version is installed globally on each machine."));
|
|
3754
3719
|
console.error(pc17.dim(` Run: npm install --save-dev ${pkg.name}`));
|
|
3755
3720
|
console.error(pc17.dim(" (or the equivalent for your package manager: pnpm add -D, yarn add --dev, bun add -d)"));
|
|
3756
3721
|
}
|
|
@@ -3853,7 +3818,6 @@ program.command("doctor").description("Check lib version, agent files, and harne
|
|
|
3853
3818
|
program.hook("preAction", () => {
|
|
3854
3819
|
if (!isLocalInstallSatisfied(cwd)) {
|
|
3855
3820
|
printLocalInstallWarning();
|
|
3856
|
-
process.exit(1);
|
|
3857
3821
|
}
|
|
3858
3822
|
});
|
|
3859
3823
|
program.hook("postAction", async () => {
|