@ligeti/testing 2.0.8 → 2.1.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 +7 -3
- package/bin/fake-opencode-v2.mjs +49 -0
- package/bin/fake-opencode.mjs +5 -1
- package/dist/agents.d.ts +1 -0
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +3 -0
- package/dist/agents.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,8 +20,9 @@ fakes it ships. (A step package's own test double for a tool only it drives —
|
|
|
20
20
|
- **`createTestDatabase`** (`src/postgres.ts`) — creates a uniquely named, empty Postgres
|
|
21
21
|
database against an admin connection and returns its URL plus a `drop()` that gives connections
|
|
22
22
|
up to 2s to close on their own, terminates the rest and drops it. One database per test file.
|
|
23
|
-
- **`fakeClaudePath`** / **`fakeOpencodePath`** / **`
|
|
24
|
-
|
|
23
|
+
- **`fakeClaudePath`** / **`fakeOpencodePath`** / **`fakeOpencodeV2Path`** / **`fakeHerdrPath`**
|
|
24
|
+
(`src/agents.ts`) — absolute
|
|
25
|
+
paths to the fake `claude`, `opencode` (1.x and 2.x) and `herdr` executables shipped in `bin/`, resolved via `import.meta.url` so they work
|
|
25
26
|
from `src/` or `dist/`.
|
|
26
27
|
- `bin/fake-claude.mjs` parses the same CLI flags the real `claude` binary accepts and fires
|
|
27
28
|
real Stop/StopFailure hooks read from `$CLAUDE_CONFIG_DIR/settings.json`, exactly as the real
|
|
@@ -32,6 +33,9 @@ fakes it ships. (A step package's own test double for a tool only it drives —
|
|
|
32
33
|
- `bin/fake-opencode.mjs` prints the NDJSON event stream `opencode run --format json` prints
|
|
33
34
|
(`step_start`, `text`, a completed `tool_use`, `text`, `step_finish` with a cost), each event
|
|
34
35
|
carrying the session id `ses_fake`.
|
|
36
|
+
- `bin/fake-opencode-v2.mjs` is the same for opencode 2.x: `--version` prints
|
|
37
|
+
`opencode v${FAKE_OPENCODE_VERSION:-2.4.1}`, and the final text event echoes the prompt
|
|
38
|
+
after `--`.
|
|
35
39
|
- `bin/fake-herdr.mjs` implements `workspace`/`pane` subcommands as a real subprocess, with its
|
|
36
40
|
`workspaces`/`panes` state persisted to a JSON file (`FAKE_HERDR_STATE`) so separate
|
|
37
41
|
invocations — as real `herdr` calls are — see consistent state.
|
|
@@ -212,7 +216,7 @@ pane: the pane goes idle while the pane, its tab and its label stay as they are.
|
|
|
212
216
|
|
|
213
217
|
A tab's displayed default label is its live position, so it renumbers after an earlier tab closes.
|
|
214
218
|
`tab focus` is globally exclusive: focusing a tab unfocuses every other tab. `worktree remove`
|
|
215
|
-
prints JSON on success because `@ligeti/
|
|
219
|
+
prints JSON on success because `@ligeti/agent-runtime`'s `runHerdr` rejects empty stdout.
|
|
216
220
|
|
|
217
221
|
`worktree create/list/remove` run a real `git` for the checkout, so the directory exists on disk
|
|
218
222
|
afterwards. `--branch` is tried as a new branch first, then as an existing one. Closing a tab's last
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ABOUTME: Stand-in for the opencode 2.x `opencode` CLI, used by wrapper.sh and workflow tests. Emits the
|
|
3
|
+
// ABOUTME: NDJSON event stream `opencode run --format json` prints; `--version` prints `opencode v${FAKE_OPENCODE_VERSION:-2.4.1}`.
|
|
4
|
+
const argv = process.argv.slice(2);
|
|
5
|
+
if (argv[0] === "--version") {
|
|
6
|
+
process.stdout.write(`opencode v${process.env.FAKE_OPENCODE_VERSION ?? "2.4.1"}\n`);
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
9
|
+
const doubleDashIndex = argv.indexOf("--");
|
|
10
|
+
const prompt = doubleDashIndex === -1 ? "" : argv.slice(doubleDashIndex + 1).join(" ");
|
|
11
|
+
|
|
12
|
+
const sessionID = "ses_fake";
|
|
13
|
+
|
|
14
|
+
let tick = 0;
|
|
15
|
+
function emit(event) {
|
|
16
|
+
tick += 1;
|
|
17
|
+
process.stdout.write(`${JSON.stringify({ ...event, timestamp: tick, sessionID })}\n`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
emit({ type: "step_start", part: { type: "step-start" } });
|
|
21
|
+
emit({
|
|
22
|
+
type: "text",
|
|
23
|
+
part: { id: "prt_fake_text", type: "text", text: "Let me look at the working directory." },
|
|
24
|
+
});
|
|
25
|
+
emit({
|
|
26
|
+
type: "tool_use",
|
|
27
|
+
part: {
|
|
28
|
+
id: "prt_fake_tool",
|
|
29
|
+
type: "tool",
|
|
30
|
+
tool: "bash",
|
|
31
|
+
callID: "call_fake_0001",
|
|
32
|
+
state: {
|
|
33
|
+
status: "completed",
|
|
34
|
+
input: { command: "ls" },
|
|
35
|
+
output: "fake-work.txt\n",
|
|
36
|
+
title: "ls",
|
|
37
|
+
metadata: { exit: 0 },
|
|
38
|
+
time: { start: 1, end: 2 },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
emit({
|
|
43
|
+
type: "text",
|
|
44
|
+
part: { id: "prt_fake_result", type: "text", text: `fake result for: ${prompt.trim()}` },
|
|
45
|
+
});
|
|
46
|
+
emit({
|
|
47
|
+
type: "step_finish",
|
|
48
|
+
part: { id: "prt_fake_finish", type: "step-finish", reason: "stop", cost: 0.01 },
|
|
49
|
+
});
|
package/bin/fake-opencode.mjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// ABOUTME: Stand-in for the real `opencode` CLI, used by wrapper.sh and workflow tests. Emits the
|
|
3
|
-
// ABOUTME: NDJSON event stream `opencode run --format json` prints, with a fixed session id.
|
|
3
|
+
// ABOUTME: NDJSON event stream `opencode run --format json` prints, with a fixed session id; `--version` prints FAKE_OPENCODE_VERSION (default 1.18.30).
|
|
4
4
|
const argv = process.argv.slice(2);
|
|
5
|
+
if (argv[0] === "--version") {
|
|
6
|
+
process.stdout.write(`${process.env.FAKE_OPENCODE_VERSION ?? "1.18.30"}\n`);
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
5
9
|
const doubleDashIndex = argv.indexOf("--");
|
|
6
10
|
const prompt = doubleDashIndex === -1 ? "" : argv.slice(doubleDashIndex + 1).join(" ");
|
|
7
11
|
|
package/dist/agents.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function fakeClaudePath(): string;
|
|
2
2
|
export declare function fakeOpencodePath(): string;
|
|
3
|
+
export declare function fakeOpencodeV2Path(): string;
|
|
3
4
|
export declare function fakeHerdrPath(): string;
|
|
4
5
|
export declare function argvRecorderPath(): string;
|
|
5
6
|
//# sourceMappingURL=agents.d.ts.map
|
package/dist/agents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAUA,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAUA,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
package/dist/agents.js
CHANGED
|
@@ -12,6 +12,9 @@ export function fakeClaudePath() {
|
|
|
12
12
|
export function fakeOpencodePath() {
|
|
13
13
|
return path.join(binDir(), "fake-opencode.mjs");
|
|
14
14
|
}
|
|
15
|
+
export function fakeOpencodeV2Path() {
|
|
16
|
+
return path.join(binDir(), "fake-opencode-v2.mjs");
|
|
17
|
+
}
|
|
15
18
|
export function fakeHerdrPath() {
|
|
16
19
|
return path.join(binDir(), "fake-herdr.mjs");
|
|
17
20
|
}
|
package/dist/agents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,kGAAkG;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,SAAS,MAAM;IACb,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,mBAAmB,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,mBAAmB,CAAC,CAAC;AAClD,CAAC"}
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,kGAAkG;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,SAAS,MAAM;IACb,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,mBAAmB,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,mBAAmB,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createTestDatabase, type TestDatabase } from "./postgres.js";
|
|
2
|
-
export { fakeClaudePath, fakeOpencodePath, fakeHerdrPath, argvRecorderPath } from "./agents.js";
|
|
2
|
+
export { fakeClaudePath, fakeOpencodePath, fakeOpencodeV2Path, fakeHerdrPath, argvRecorderPath, } from "./agents.js";
|
|
3
3
|
export { sanitizedEnv } from "./env.js";
|
|
4
4
|
export { copyClaudeProfile, fixtureClaudeProfileDir } from "./claude-profile.js";
|
|
5
5
|
export { startFakeGitLab, type FakeGitLab, type FakeGitLabRequest, type FakeGitLabResponse, type FakeGitLabHandler, } from "./gitlab.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EACL,eAAe,EACf,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,eAAe,EACf,WAAW,EACX,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,QAAQ,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ABOUTME: Public entry point of @ligeti/testing: the Postgres fixture, the fake executables, fake
|
|
2
2
|
// ABOUTME: HTTP services, the fixture Claude profile and the helpers that run a real ligeti-worker.
|
|
3
3
|
export { createTestDatabase } from "./postgres.js";
|
|
4
|
-
export { fakeClaudePath, fakeOpencodePath, fakeHerdrPath, argvRecorderPath } from "./agents.js";
|
|
4
|
+
export { fakeClaudePath, fakeOpencodePath, fakeOpencodeV2Path, fakeHerdrPath, argvRecorderPath, } from "./agents.js";
|
|
5
5
|
export { sanitizedEnv } from "./env.js";
|
|
6
6
|
export { copyClaudeProfile, fixtureClaudeProfileDir } from "./claude-profile.js";
|
|
7
7
|
export { startFakeGitLab, } from "./gitlab.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,oGAAoG;AACpG,OAAO,EAAE,kBAAkB,EAAqB,MAAM,eAAe,CAAC;AACtE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,oGAAoG;AACpG,OAAO,EAAE,kBAAkB,EAAqB,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EACL,eAAe,GAKhB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,GAsBhB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,GAKnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,GAKd,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,2BAA2B,GAI5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,eAAe,EACf,WAAW,EACX,uBAAuB,GAGxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,mBAAmB,GAIpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAA+C,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA+B,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAqB,MAAM,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ligeti/testing",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Ligeti test kit: real-process test doubles (throwaway Postgres databases, fake claude/opencode/herdr, fake GitLab, Bitbucket, Jira and Telegram) and helpers that run a workflow package under a real ligeti-worker.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|