harnery 0.31.1 → 0.31.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.
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Adapter } from "../events/schema.js";
|
|
2
2
|
/**
|
|
3
3
|
* Resolve the adapter firing the hook. The dispatcher binary is always
|
|
4
|
-
* invoked with `--adapter <name>` per the wiring in each adapter's
|
|
5
|
-
* file
|
|
4
|
+
* invoked with `--adapter <name>` per the current wiring in each adapter's
|
|
5
|
+
* settings file. `--harness` remains an accepted alias because settings files
|
|
6
|
+
* written by older releases survive a package upgrade until the consumer
|
|
7
|
+
* re-runs `harn init`. Returns null when neither flag is present; caller falls
|
|
6
8
|
* through to the env-based fallback or skips emission.
|
|
7
9
|
*/
|
|
8
10
|
export declare function detectAdapter(argv: readonly string[]): Adapter | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/adapter/detect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/adapter/detect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,GAAG,IAAI,CAcrE"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { coordEnv } from "../../../lib/env.js";
|
|
2
2
|
/**
|
|
3
3
|
* Resolve the adapter firing the hook. The dispatcher binary is always
|
|
4
|
-
* invoked with `--adapter <name>` per the wiring in each adapter's
|
|
5
|
-
* file
|
|
4
|
+
* invoked with `--adapter <name>` per the current wiring in each adapter's
|
|
5
|
+
* settings file. `--harness` remains an accepted alias because settings files
|
|
6
|
+
* written by older releases survive a package upgrade until the consumer
|
|
7
|
+
* re-runs `harn init`. Returns null when neither flag is present; caller falls
|
|
6
8
|
* through to the env-based fallback or skips emission.
|
|
7
9
|
*/
|
|
8
10
|
export function detectAdapter(argv) {
|
|
9
11
|
for (let i = 0; i < argv.length; i++) {
|
|
10
12
|
const a = argv[i];
|
|
11
|
-
if (a === "--adapter") {
|
|
13
|
+
if (a === "--adapter" || a === "--harness") {
|
|
12
14
|
return validate(argv[i + 1]);
|
|
13
15
|
}
|
|
14
16
|
if (a.startsWith("--adapter=")) {
|
|
15
17
|
return validate(a.slice("--adapter=".length));
|
|
16
18
|
}
|
|
19
|
+
if (a.startsWith("--harness=")) {
|
|
20
|
+
return validate(a.slice("--harness=".length));
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
|
-
return validate(coordEnv("AGENT_COORD_ADAPTER"));
|
|
23
|
+
return validate(coordEnv("AGENT_COORD_ADAPTER") ?? coordEnv("AGENT_COORD_HARNESS"));
|
|
19
24
|
}
|
|
20
25
|
function validate(v) {
|
|
21
26
|
if (v === "claude-code" || v === "cursor" || v === "codex")
|
package/dist/core/hooks/cli.js
CHANGED
|
@@ -44,11 +44,11 @@ function parseArgv(argv) {
|
|
|
44
44
|
const out = { eventName: null, extra: [] };
|
|
45
45
|
for (let i = 0; i < argv.length; i++) {
|
|
46
46
|
const arg = argv[i];
|
|
47
|
-
if (arg === "--adapter") {
|
|
47
|
+
if (arg === "--adapter" || arg === "--harness") {
|
|
48
48
|
i++; // detectAdapter will re-parse; just consume the value here.
|
|
49
49
|
continue;
|
|
50
50
|
}
|
|
51
|
-
if (arg.startsWith("--adapter="))
|
|
51
|
+
if (arg.startsWith("--adapter=") || arg.startsWith("--harness="))
|
|
52
52
|
continue;
|
|
53
53
|
if (!out.eventName && !arg.startsWith("--")) {
|
|
54
54
|
out.eventName = arg;
|
package/package.json
CHANGED
|
@@ -3,21 +3,26 @@ import type { Adapter } from "../events/schema.ts";
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Resolve the adapter firing the hook. The dispatcher binary is always
|
|
6
|
-
* invoked with `--adapter <name>` per the wiring in each adapter's
|
|
7
|
-
* file
|
|
6
|
+
* invoked with `--adapter <name>` per the current wiring in each adapter's
|
|
7
|
+
* settings file. `--harness` remains an accepted alias because settings files
|
|
8
|
+
* written by older releases survive a package upgrade until the consumer
|
|
9
|
+
* re-runs `harn init`. Returns null when neither flag is present; caller falls
|
|
8
10
|
* through to the env-based fallback or skips emission.
|
|
9
11
|
*/
|
|
10
12
|
export function detectAdapter(argv: readonly string[]): Adapter | null {
|
|
11
13
|
for (let i = 0; i < argv.length; i++) {
|
|
12
14
|
const a = argv[i]!;
|
|
13
|
-
if (a === "--adapter") {
|
|
15
|
+
if (a === "--adapter" || a === "--harness") {
|
|
14
16
|
return validate(argv[i + 1]);
|
|
15
17
|
}
|
|
16
18
|
if (a.startsWith("--adapter=")) {
|
|
17
19
|
return validate(a.slice("--adapter=".length));
|
|
18
20
|
}
|
|
21
|
+
if (a.startsWith("--harness=")) {
|
|
22
|
+
return validate(a.slice("--harness=".length));
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
|
-
return validate(coordEnv("AGENT_COORD_ADAPTER"));
|
|
25
|
+
return validate(coordEnv("AGENT_COORD_ADAPTER") ?? coordEnv("AGENT_COORD_HARNESS"));
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
function validate(v: string | undefined): Adapter | null {
|
package/src/core/hooks/cli.ts
CHANGED
|
@@ -80,11 +80,11 @@ function parseArgv(argv: string[]): Argv {
|
|
|
80
80
|
const out: Argv = { eventName: null, extra: [] };
|
|
81
81
|
for (let i = 0; i < argv.length; i++) {
|
|
82
82
|
const arg = argv[i]!;
|
|
83
|
-
if (arg === "--adapter") {
|
|
83
|
+
if (arg === "--adapter" || arg === "--harness") {
|
|
84
84
|
i++; // detectAdapter will re-parse; just consume the value here.
|
|
85
85
|
continue;
|
|
86
86
|
}
|
|
87
|
-
if (arg.startsWith("--adapter=")) continue;
|
|
87
|
+
if (arg.startsWith("--adapter=") || arg.startsWith("--harness=")) continue;
|
|
88
88
|
if (!out.eventName && !arg.startsWith("--")) {
|
|
89
89
|
out.eventName = arg;
|
|
90
90
|
} else {
|