harnery 0.6.0 → 0.7.1
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 +16 -6
- package/dist/commander.d.ts +19 -0
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +2 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +51 -4
- package/dist/commands/deinit.d.ts.map +1 -1
- package/dist/commands/deinit.js +4 -0
- package/dist/commands/devtools.d.ts +4 -0
- package/dist/commands/devtools.d.ts.map +1 -0
- package/dist/commands/devtools.js +239 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +69 -1
- package/dist/commands/doctor.js +12 -4
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +3 -63
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +54 -14
- package/dist/commands/scratch.js +1 -1
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +273 -62
- package/dist/commands/web-fetch.js +1 -1
- package/dist/core/agents/cli.js +48 -0
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +32 -8
- package/dist/core/agents/events/emit.d.ts.map +1 -1
- package/dist/core/agents/events/emit.js +4 -0
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/claim-conflict.js +16 -5
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-projector.js +10 -3
- package/dist/core/config.d.ts +10 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +13 -0
- package/dist/core/hooks/cli.js +3 -3
- package/dist/core/hooks/effects/index.d.ts +11 -7
- package/dist/core/hooks/effects/index.d.ts.map +1 -1
- package/dist/core/hooks/effects/index.js +15 -18
- package/dist/core/hooks/events/emit.d.ts.map +1 -1
- package/dist/core/hooks/events/emit.js +4 -0
- package/dist/core/hooks/events/rotate.d.ts +43 -0
- package/dist/core/hooks/events/rotate.d.ts.map +1 -0
- package/dist/core/hooks/events/rotate.js +142 -0
- package/dist/core/hooks/harness/events.d.ts +11 -1
- package/dist/core/hooks/harness/events.d.ts.map +1 -1
- package/dist/core/hooks/harness/events.js +22 -3
- package/dist/core/hooks/harness/wiring.d.ts +8 -0
- package/dist/core/hooks/harness/wiring.d.ts.map +1 -1
- package/dist/core/hooks/harness/wiring.js +34 -5
- package/dist/core/scratch/index.d.ts.map +1 -0
- package/dist/{lib → core}/scratch/index.js +2 -2
- package/dist/lib/devtools.d.ts +178 -0
- package/dist/lib/devtools.d.ts.map +1 -0
- package/dist/lib/devtools.js +1328 -0
- package/dist/lib/docs-frontmatter-migrate.d.ts +33 -0
- package/dist/lib/docs-frontmatter-migrate.d.ts.map +1 -0
- package/dist/lib/docs-frontmatter-migrate.js +364 -0
- package/dist/lib/docs-frontmatter.d.ts +33 -0
- package/dist/lib/docs-frontmatter.d.ts.map +1 -0
- package/dist/lib/docs-frontmatter.js +130 -0
- package/dist/lib/docs-index.d.ts +1 -0
- package/dist/lib/docs-index.d.ts.map +1 -1
- package/dist/lib/docs-index.js +4 -5
- package/dist/lib/docs-lint.d.ts +2 -0
- package/dist/lib/docs-lint.d.ts.map +1 -1
- package/dist/lib/docs-lint.js +18 -12
- package/dist/lib/docs-meta.d.ts +14 -0
- package/dist/lib/docs-meta.d.ts.map +1 -0
- package/dist/lib/docs-meta.js +34 -0
- package/dist/lib/docs-sweep.d.ts +12 -0
- package/dist/lib/docs-sweep.d.ts.map +1 -1
- package/dist/lib/docs-sweep.js +98 -103
- package/dist/lib/format.js +2 -2
- package/dist/lib/http/index.d.ts +1 -0
- package/dist/lib/http/index.d.ts.map +1 -1
- package/dist/lib/http/index.js +1 -0
- package/dist/lib/http/request.d.ts +77 -0
- package/dist/lib/http/request.d.ts.map +1 -0
- package/dist/lib/http/request.js +105 -0
- package/dist/lib/instructions/apply.d.ts +63 -0
- package/dist/lib/instructions/apply.d.ts.map +1 -0
- package/dist/lib/instructions/apply.js +255 -0
- package/dist/lib/instructions/splice.d.ts +73 -0
- package/dist/lib/instructions/splice.d.ts.map +1 -0
- package/dist/lib/instructions/splice.js +118 -0
- package/dist/lib/instructions/templates.d.ts +45 -0
- package/dist/lib/instructions/templates.d.ts.map +1 -0
- package/dist/lib/instructions/templates.js +258 -0
- package/dist/lib/tunnel/gate.d.ts +1 -0
- package/dist/lib/tunnel/gate.d.ts.map +1 -1
- package/dist/lib/tunnel/gate.js +14 -9
- package/dist/lib/tunnel/state.d.ts +11 -1
- package/dist/lib/tunnel/state.d.ts.map +1 -1
- package/dist/lib/tunnel/state.js +8 -3
- package/package.json +7 -6
- package/src/commander.ts +23 -0
- package/src/commands/agents.ts +50 -3
- package/src/commands/deinit.ts +5 -0
- package/src/commands/devtools.ts +284 -0
- package/src/commands/docs.ts +81 -1
- package/src/commands/doctor.ts +13 -4
- package/src/commands/env.ts +11 -77
- package/src/commands/init.ts +66 -15
- package/src/commands/scratch.ts +1 -1
- package/src/commands/tunnel.ts +316 -65
- package/src/commands/web-fetch.ts +1 -1
- package/src/core/agents/cli.ts +55 -0
- package/src/core/agents/coord-client.ts +34 -7
- package/src/core/agents/events/emit.ts +5 -0
- package/src/core/agents/rules/claim-conflict.ts +17 -6
- package/src/core/agents/state/heartbeat-projector.ts +11 -3
- package/src/core/config.ts +14 -0
- package/src/core/hooks/cli.ts +3 -3
- package/src/core/hooks/effects/index.ts +23 -17
- package/src/core/hooks/events/emit.ts +5 -0
- package/src/core/hooks/events/rotate.ts +151 -0
- package/src/core/hooks/harness/events.ts +30 -3
- package/src/core/hooks/harness/wiring.ts +46 -5
- package/src/{lib → core}/scratch/index.ts +2 -2
- package/src/lib/devtools.ts +1653 -0
- package/src/lib/docs-frontmatter-migrate.ts +427 -0
- package/src/lib/docs-frontmatter.ts +151 -0
- package/src/lib/docs-index.ts +4 -5
- package/src/lib/docs-lint.ts +17 -11
- package/src/lib/docs-meta.ts +44 -0
- package/src/lib/docs-sweep.ts +104 -102
- package/src/lib/format.ts +2 -2
- package/src/lib/http/index.ts +1 -0
- package/src/lib/http/request.ts +154 -0
- package/src/lib/instructions/apply.ts +318 -0
- package/src/lib/instructions/splice.ts +148 -0
- package/src/lib/instructions/templates.ts +295 -0
- package/src/lib/tunnel/gate.ts +14 -9
- package/src/lib/tunnel/state.ts +19 -4
- package/dist/lib/scratch/index.d.ts.map +0 -1
- /package/dist/{lib → core}/scratch/index.d.ts +0 -0
|
@@ -37,6 +37,7 @@ export type HookGroup = ClaudeHookGroup | CursorHookGroup;
|
|
|
37
37
|
|
|
38
38
|
export interface SettingsFile {
|
|
39
39
|
version?: number;
|
|
40
|
+
description?: string;
|
|
40
41
|
hooks?: Record<string, HookGroup[]>;
|
|
41
42
|
[k: string]: unknown;
|
|
42
43
|
}
|
|
@@ -80,6 +81,10 @@ export interface WiringDiff {
|
|
|
80
81
|
* these — they need explicit removal — so they're surfaced separately.
|
|
81
82
|
*/
|
|
82
83
|
orphans: string[];
|
|
84
|
+
/** Settings fields rejected by a harness with a strict top-level schema. */
|
|
85
|
+
invalidTopLevelKeys: string[];
|
|
86
|
+
/** Hook event names rejected by a harness with a strict event schema. */
|
|
87
|
+
invalidEventKeys: string[];
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
/**
|
|
@@ -111,7 +116,24 @@ export function diffWiring(settings: SettingsFile, spec: HarnessSpec): WiringDif
|
|
|
111
116
|
}
|
|
112
117
|
}
|
|
113
118
|
|
|
114
|
-
|
|
119
|
+
const invalidTopLevelKeys = spec.allowedTopLevelKeys
|
|
120
|
+
? Object.keys(settings)
|
|
121
|
+
.filter((key) => !spec.allowedTopLevelKeys!.includes(key))
|
|
122
|
+
.sort()
|
|
123
|
+
: [];
|
|
124
|
+
const invalidEventKeys = spec.allowedEventKeys
|
|
125
|
+
? Object.keys(hooks)
|
|
126
|
+
.filter((key) => !spec.allowedEventKeys!.includes(key))
|
|
127
|
+
.sort()
|
|
128
|
+
: [];
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
missing,
|
|
132
|
+
present,
|
|
133
|
+
orphans: [...orphans].sort(),
|
|
134
|
+
invalidTopLevelKeys,
|
|
135
|
+
invalidEventKeys,
|
|
136
|
+
};
|
|
115
137
|
}
|
|
116
138
|
|
|
117
139
|
export interface HarnessWiringStatus {
|
|
@@ -120,6 +142,9 @@ export interface HarnessWiringStatus {
|
|
|
120
142
|
settingsFile: string;
|
|
121
143
|
missing: HookEvent[];
|
|
122
144
|
orphans: string[];
|
|
145
|
+
invalidTopLevelKeys: string[];
|
|
146
|
+
invalidEventKeys: string[];
|
|
147
|
+
parseError?: string;
|
|
123
148
|
}
|
|
124
149
|
|
|
125
150
|
/**
|
|
@@ -141,19 +166,35 @@ export function loadHarnessWiring(projectRoot: string): HarnessWiringStatus[] {
|
|
|
141
166
|
let settings: SettingsFile;
|
|
142
167
|
try {
|
|
143
168
|
settings = JSON.parse(readFileSync(settingsPath, "utf8")) as SettingsFile;
|
|
144
|
-
} catch {
|
|
145
|
-
|
|
146
|
-
|
|
169
|
+
} catch (error) {
|
|
170
|
+
out.push({
|
|
171
|
+
harness: id,
|
|
172
|
+
settingsFile: spec.settingsFile,
|
|
173
|
+
missing: [],
|
|
174
|
+
orphans: [],
|
|
175
|
+
invalidTopLevelKeys: [],
|
|
176
|
+
invalidEventKeys: [],
|
|
177
|
+
parseError: (error as Error).message,
|
|
178
|
+
});
|
|
147
179
|
continue;
|
|
148
180
|
}
|
|
149
181
|
const diff = diffWiring(settings, spec);
|
|
150
182
|
if (diff.present.length === 0) continue; // not opted in → not drift
|
|
151
|
-
if (
|
|
183
|
+
if (
|
|
184
|
+
diff.missing.length === 0 &&
|
|
185
|
+
diff.orphans.length === 0 &&
|
|
186
|
+
diff.invalidTopLevelKeys.length === 0 &&
|
|
187
|
+
diff.invalidEventKeys.length === 0
|
|
188
|
+
) {
|
|
189
|
+
continue; // current
|
|
190
|
+
}
|
|
152
191
|
out.push({
|
|
153
192
|
harness: id,
|
|
154
193
|
settingsFile: spec.settingsFile,
|
|
155
194
|
missing: diff.missing,
|
|
156
195
|
orphans: diff.orphans,
|
|
196
|
+
invalidTopLevelKeys: diff.invalidTopLevelKeys,
|
|
197
|
+
invalidEventKeys: diff.invalidEventKeys,
|
|
157
198
|
});
|
|
158
199
|
}
|
|
159
200
|
return out;
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
writeFileSync,
|
|
10
10
|
} from "node:fs";
|
|
11
11
|
import { dirname, resolve } from "node:path";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { resolveMachineLabel } from "../../lib/machine.ts";
|
|
13
|
+
import { monorepoRoot, readHeartbeat, resolveOwner } from "../agents/index.ts";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Agent scratchpad: per-agent markdown journal at `.harnery/scratch/<instance_id>.md`.
|