@ancha-labs/cli 0.4.41 → 0.4.43

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.
@@ -43,6 +43,7 @@ Add `--json` to every command. Runs print NDJSON events that end with `run_finis
43
43
  ```
44
44
  - The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
45
45
  6. **Without production traces.** For an agent that calls NetSuite directly, `ancha init` writes a NetSuite world of a private-equity portfolio company (four subsidiaries, two currencies, thousands of transactions) and 25 tests: 10 read tasks and 15 write workflows. For an agent that uses QuickBooks, it writes Pellmont Building Services' 2025 books and two tests: `pellmont-duplicates` reports the duplicate vendors, the invoices and bills entered twice and the money at stake without changing the books, and `pellmont-approved-merge` merges the three duplicate vendor pairs as approved and changes nothing else.
46
+ - Variants: once `pellmont-duplicates` passes, `ancha test vary ancha/tests/pellmont-duplicates.yaml` writes ten variants of it, each changing one thing in the books with the expected findings recalculated; run them with the command it prints.
46
47
  - Your data: `ancha world import netsuite <your exports> --id <id>` reads REST record JSON, SuiteQL results and saved search CSV into `ancha/worlds/<id>.yaml`; check it with `ancha world validate`. To write the seed yourself, `ancha twins seed netsuite` lists its fields.
47
48
  - Your evals: `ancha test import <file>` (JSONL, JSON, CSV or YAML with a question and an expected answer) writes tests for the only world in `ancha/worlds/`, or the one `--world <id>` names; with none, `ancha init --on local --template starter` adds one.
48
49
  - One test from a sentence: `ancha test new "<sentence>" --world <id>`.
@@ -28,6 +28,7 @@
28
28
  ```
29
29
  - The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
30
30
  6. **Without production traces.** For an agent that calls NetSuite directly, `ancha init` writes a NetSuite world of a private-equity portfolio company (four subsidiaries, two currencies, thousands of transactions) and 25 tests: 10 read tasks and 15 write workflows. For an agent that uses QuickBooks, it writes Pellmont Building Services' 2025 books and two tests: `pellmont-duplicates` reports the duplicate vendors, the invoices and bills entered twice and the money at stake without changing the books, and `pellmont-approved-merge` merges the three duplicate vendor pairs as approved and changes nothing else.
31
+ - Variants: once `pellmont-duplicates` passes, `ancha test vary ancha/tests/pellmont-duplicates.yaml` writes ten variants of it, each changing one thing in the books with the expected findings recalculated; run them with the command it prints.
31
32
  - Your data: `ancha world import netsuite <your exports> --id <id>` reads REST record JSON, SuiteQL results and saved search CSV into `ancha/worlds/<id>.yaml`; check it with `ancha world validate`. To write the seed yourself, `ancha twins seed netsuite` lists its fields.
32
33
  - Your evals: `ancha test import <file>` (JSONL, JSON, CSV or YAML with a question and an expected answer) writes tests for the only world in `ancha/worlds/`, or the one `--world <id>` names; with none, `ancha init --on local --template starter` adds one.
33
34
  - One test from a sentence: `ancha test new "<sentence>" --world <id>`.
@@ -36,6 +36,7 @@ Without `--on`, a project with `ancha.yaml` (or `--config`) runs in the workspac
36
36
  ```
37
37
  - The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
38
38
  6. **Without production traces.** For an agent that calls NetSuite directly, `ancha init` writes a NetSuite world of a private-equity portfolio company (four subsidiaries, two currencies, thousands of transactions) and 25 tests: 10 read tasks and 15 write workflows. For an agent that uses QuickBooks, it writes Pellmont Building Services' 2025 books and two tests: `pellmont-duplicates` reports the duplicate vendors, the invoices and bills entered twice and the money at stake without changing the books, and `pellmont-approved-merge` merges the three duplicate vendor pairs as approved and changes nothing else.
39
+ - Variants: once `pellmont-duplicates` passes, `ancha test vary ancha/tests/pellmont-duplicates.yaml` writes ten variants of it, each changing one thing in the books with the expected findings recalculated; run them with the command it prints.
39
40
  - Your data: `ancha world import netsuite <your exports> --id <id>` reads REST record JSON, SuiteQL results and saved search CSV into `ancha/worlds/<id>.yaml`; check it with `ancha world validate`. To write the seed yourself, `ancha twins seed netsuite` lists its fields.
40
41
  - Your evals: `ancha test import <file>` (JSONL, JSON, CSV or YAML with a question and an expected answer) writes tests for the only world in `ancha/worlds/`, or the one `--world <id>` names; with none, `ancha init --on local --template starter` adds one.
41
42
  - One test from a sentence: `ancha test new "<sentence>" --world <id>`.
@@ -73,7 +74,7 @@ Without `--on`, a project with `ancha.yaml` (or `--config`) runs in the workspac
73
74
 
74
75
  `ancha login` prints a link and a code and opens the browser; the engineer approves this computer once (`--no-browser` only prints the link). With `--json` the first line is `{"event": "login_pending", "verificationUrl", "userCode", "expiresIn"}`, for a coding agent to show its user, and the last is the saved login. The CLI saves an API key for the workspace in `~/.config/ancha/credentials.json` (mode 0600; `ANCHA_CREDENTIALS_FILE` moves it). A process started without `HOME` (or `XDG_CONFIG_HOME`) has no saved login. After it signs in, `ancha login` prints the workspace's first steps, done or not (below).
75
76
 
76
- `ancha whoami --json` shows the workspace and where that choice came from (`--server-url`, `server.url` in `ancha.yaml`, `ANCHA_SERVER_URL`, or the saved login). `ancha whoami --verify` also asks the server whether it accepts the key. `ancha logout` forgets the saved login.
77
+ `ancha whoami --json` shows the workspace and where that choice came from (`--server-url`, `server.url` in `ancha.yaml`, `ANCHA_SERVER_URL`, or the saved login). `ancha whoami --verify` also asks the server whether it accepts the key. `ancha logout` revokes the key that `ancha login` created and removes the saved login; `--url <server>` selects a saved server. Other keys and `ANCHA_API_KEY` stay as they are. The result confirms revocation or gives the Settings link to revoke the key. With `--json`, `revoked` is true or false; a failed request adds `revokeError` with the error code (`AUTH_INVALID` for a key already revoked or not valid). Sign-out removes the local entry even when the request fails, and exits 0 once it is removed. For a login saved by an older CLI, use the Settings link in the result to revoke its key.
77
78
 
78
79
  ## Upload the agent
79
80
 
@@ -177,7 +178,7 @@ ancha secrets set COMPOSIO_API_KEY
177
178
  ancha run --on cloud
178
179
  ```
179
180
 
180
- - Declare either route or both. Each test's world decides which routed tools it answers. QuickBooks-only and NetSuite-only tests can use the same agent configuration. A call to a declared tool that the world lacks returns `403 COMPOSIO_ROUTE_REFUSED` with reason `NO_WORLD` and a fix to add the tool to the world or run the call in a test whose world has it. The agent gets that answer and the attempt is graded as usual, as it is when a SuiteQL call's arguments are invalid.
181
+ - Declare either route or both. Each test's world decides which routed tools it answers. QuickBooks-only and NetSuite-only tests can use the same agent configuration. A call to a declared tool that the world lacks returns `403 COMPOSIO_ROUTE_REFUSED` with reason `NO_WORLD` and a fix to add the tool to the world or run the call in a test whose world has it. The agent gets that answer and the attempt is graded as usual, as it is when a SuiteQL call's arguments are invalid. A call to a QuickBooks or NetSuite tool whose toolkit is not under `agent.routes` returns reason `NOT_ROUTED` with the line to add, such as `quickbooks: composio`; the attempt is invalid until the route is declared.
181
182
  - The agent keeps its Composio code. Each attempt sets `COMPOSIO_BASE_URL` to Composio's API through the attempt's gateway (the Composio SDKs read it; a client built with an explicit base URL takes this value) and `COMPOSIO_API_KEY` to a key for this attempt; the gateway sends the project's key to Composio for QuickBooks calls. `QUICKBOOKS_PUBLIC_URL` is this world's QuickBooks at an address Composio reaches for this attempt only; `QUICKBOOKS_ACCESS_TOKEN` and `QUICKBOOKS_REALM_ID` are the world's, as in any test with QuickBooks.
182
183
  - QuickBooks direct executions (`tools.execute`) reach the world whatever user ID or connected account the agent names: the gateway supplies the world's address and credentials on each call. An agent that already passes `custom_auth_params` keeps them: `base_url` is `QUICKBOOKS_PUBLIC_URL` with the world's `Authorization` and `x-quickbooks-realm-id` headers.
183
184
  - When the world has routed QuickBooks, Tool Router sessions reach the world through a QuickBooks connection the attempt creates in the project for its own user (`ancha-…`). Sessions are pinned to it, and the session's MCP URL points at the gateway, so an MCP client in the agent's process reaches the same session. When the attempt ends it deletes the sessions, the connection and its auth config.
@@ -18,6 +18,8 @@ A clean process exit doesn't mean the task passed, and an invalid trial isn't an
18
18
 
19
19
  Fix the agent after reading the evidence, then prove the fix with `ancha run --compare before` against a saved reference: `ancha docs compare`.
20
20
 
21
+ For a variant family, the next run command uses a pattern such as `ancha/tests/pellmont-duplicates-v-*.yaml` when Ancha verifies that it selects exactly the variant files in the run. The parent test and other tests keep their places in the command. Ancha checks the project directory; a cloud run also uses this folder's submission record to confirm the project. Otherwise, the command lists each test file.
22
+
21
23
  ## Replay an attempt
22
24
 
23
25
  `ancha replay latest/trial-<test>-1` runs one attempt again: its world with the same seed, its people answering from what they said in it, and the agent as it is now (or `--agent "<command>"`). Name the attempt as `<run id or latest>/<trial directory>`, as it appears under the runs directory. The replay is saved as a new run, so `ancha explain` and `ancha report` read it.
@@ -23,6 +23,25 @@ A version 2 test names a world (`ancha/worlds/<id>.yaml`: the company, its peopl
23
23
  - `ancha test new "<the test in one sentence>" --json` drafts a test for the project's world (`--world <id>` when there are several) into `ancha/tests/<id>.yaml`, with a `.gen.json` record of the prompt. The draft is validated against the world (every ref exists, every check can be evaluated) before it is written. On a world with NetSuite, the drafter reads the records the world starts with, the open items and sample records by id, and checks records (`netsuite.record` on records that exist, with fields their type has, `netsuite.count`, `netsuite.unchanged`) and the agent's final answer (`answer`). Read its checks before you run it: each should pass for an agent that does the job and fail for one that doesn't.
24
24
  - Run it like any test: `ancha run ancha/tests/<id>.yaml`. Both commands use a model: your `OPENROUTER_API_KEY`, or your workspace's credit when you're logged in.
25
25
 
26
+ ## Vary a duplicate-report test
27
+
28
+ `ancha test vary` creates a family of tests from a version 2 QuickBooks duplicate-report test, such as Pellmont's example. Each changes one thing about the books: amounts, extra copies, pagination or names. Ancha recalculates the expected findings from each changed world. Generation is deterministic and uses zero model calls.
29
+
30
+ ```sh
31
+ ancha test vary ancha/tests/pellmont-duplicates.yaml --count 10
32
+ ancha run ancha/tests/pellmont-duplicates-v-*.yaml
33
+ ```
34
+
35
+ When signed in, `ancha run` runs the tests in the cloud, in parallel. Use `--on local` on the run command to run them on this computer. The vary command prints a run command selecting the files it generated.
36
+
37
+ - `--count <n>` requests an exact count, from 1 to 32 (default 10). The Pellmont suite has ten recipes; selecting fewer takes them in their established order.
38
+ - `--kinds amounts,copies,pages,names` selects the kinds (default all four). `--seed <value>` repeats the same choices; its default is `0`.
39
+ - `--dry-run --json` validates and prints the plan without creating files. `--json` returns the parent, suite, seed, requested/written/reused counts, each change and the next command.
40
+ - Files go beside the parent, or to `--out <dir>`. Each YAML test contains its frozen world, rewritten checks and parent provenance. A `<parent-id>-vary-<suite-prefix>.json` manifest records the changes, expected values and file hashes; it stays out of the agent's cloud bundle.
41
+ - Repeating the request reuses identical files. An edited destination is a conflict; choose another output directory to keep both. `--idempotency-key <key>` binds a request to its inputs and options.
42
+
43
+ Results group variants by parent and show each change with its passed/requested attempts. A variant whose attempts never started says `not run`; a variant with two of three attempts still unrun says `1/3 · 2 not run` when its completed attempt passed. The family headline totals these counts, and summary JSON includes `families[].rows[].notRun`.
44
+
26
45
  ## Tests from your evals
27
46
 
28
47
  `ancha test import <file> --world <id> --json` turns evals, questions with expected answers, into tests on a world in `ancha/tests/` (`--out <dir>` for another folder; `--world` defaults to the only world file). It reads JSON lines, a JSON array, CSV with a header row, or a YAML list:
@@ -34,6 +34,7 @@ Requirements: Node 24 or newer. Install once with `npm install -g @ancha-labs/cl
34
34
  ```
35
35
  - The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
36
36
  6. **Without production traces.** For an agent that calls NetSuite directly, `ancha init` writes a NetSuite world of a private-equity portfolio company (four subsidiaries, two currencies, thousands of transactions) and 25 tests: 10 read tasks and 15 write workflows. For an agent that uses QuickBooks, it writes Pellmont Building Services' 2025 books and two tests: `pellmont-duplicates` reports the duplicate vendors, the invoices and bills entered twice and the money at stake without changing the books, and `pellmont-approved-merge` merges the three duplicate vendor pairs as approved and changes nothing else.
37
+ - Variants: once `pellmont-duplicates` passes, `ancha test vary ancha/tests/pellmont-duplicates.yaml` writes ten variants of it, each changing one thing in the books with the expected findings recalculated; run them with the command it prints.
37
38
  - Your data: `ancha world import netsuite <your exports> --id <id>` reads REST record JSON, SuiteQL results and saved search CSV into `ancha/worlds/<id>.yaml`; check it with `ancha world validate`. To write the seed yourself, `ancha twins seed netsuite` lists its fields.
38
39
  - Your evals: `ancha test import <file>` (JSONL, JSON, CSV or YAML with a question and an expected answer) writes tests for the only world in `ancha/worlds/`, or the one `--world <id>` names; with none, `ancha init --on local --template starter` adds one.
39
40
  - One test from a sentence: `ancha test new "<sentence>" --world <id>`.