@intentic/agent-cli 1.310.0 → 1.312.0

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.
Files changed (2) hide show
  1. package/README.md +30 -30
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,37 +1,37 @@
1
- # @intentic/agent-cli
1
+ # agent-cli
2
2
 
3
- The promise an agent-facing CLI makes — capsule first, content to a budget, errors you cannot mistake for silence — held in one place for the three tools that make it.
3
+ The process contract, budgeted output and in-process test runner that the agent-facing CLIs `iq`, `fileq` and `webq` share, so a failure never reads as an empty answer.
4
4
 
5
- `iq` (code), `fileq` (workspace files) and `webq` (the web) are three answers to one question: *the thing I need
6
- is in a format I cannot read, give me the part that fits.* They were written months apart, each one's entry file
7
- copied from the last, and the copies had already drifted in the way copies do — three spellings of "read my own
8
- version", two hand-rolled parsers beside the one their shared dependency ships, one inline token estimate beside
9
- the shared one it was supposed to use.
5
+ ```mermaid
6
+ flowchart LR
7
+ agent["Agent shell<br/>pipes into head, drops stderr"] --> bin["iq · fileq · webq"]
8
+ bin --> run(["agent-cli<br/>runAgentCli"])
9
+ run --> app["The tool's stricli app<br/>loaded lazily"]
10
+ app --> out["stdout<br/>capsule, clipped body, errors"]
11
+ out --> agent
12
+ ```
10
13
 
11
- What lives here is only the part all three must answer the same way:
14
+ - The reader is an agent: it pipes into `head`, sends stderr to `/dev/null` and cannot tell a crash from an empty
15
+ answer. So `runAgentCli` treats EPIPE as a clean stop, writes errors to stdout, reports a module graph that will
16
+ not load as a broken install, and clamps the exit code to 0 content, 1 none, 2 anything else.
17
+ - The app is passed as a `load` thunk, never a static import, so an engine or native module that fails to load
18
+ fails inside the contract's catch and gets reported.
19
+ - `capsule` prints the line an agent reads first plus one `note:` per caveat; `clip` cuts markdown to a token budget
20
+ on a line boundary and always names the file that holds the whole answer.
21
+ - `toolHome` gives each tool its own directory: `<NAME>_HOME`, else `$XDG_CACHE_HOME/<name>`, else `~/.cache/<name>`.
22
+ - Each tool's end-to-end suites use `captureCli` from `./testing`, which runs the app in process and returns what
23
+ a shell would see.
12
24
 
13
- - **The process contract** ([src/run.ts](src/run.ts)). EPIPE is a clean stop, not a crash — an agent pipes into
14
- `head`. Errors go to **stdout**, because `<tool> … 2>/dev/null` is a reflex and a failure routed to stderr
15
- reads as an empty answer. The app loads through a thunk so a broken module graph dies as a sentence naming the
16
- install, not as a stack the same reflex swallows. Exit codes are 0 content / 1 none / 2 anything else.
17
- - **The output shape** ([src/output.ts](src/output.ts)). One capsule line, one `note:` per caveat, then content
18
- cut on a line boundary with a trailer naming the budget it hit and the file holding the rest. A body that
19
- stops mid-thought with no trailer is the failure mode this exists to prevent.
20
- - **The rest of the floor**: one XDG home per tool ([src/env.ts](src/env.ts)), one version resolver that finds
21
- the manifest by walking to it ([src/version.ts](src/version.ts)), one non-negative parser for counts and
22
- budgets ([src/flags.ts](src/flags.ts)), one in-process test seam ([src/testing.ts](src/testing.ts)).
25
+ ## Key files
23
26
 
24
- What does **not** live here is everything that makes the three tools different: iq's grep-dialect absorption and
25
- fusion budgets, fileq's sidecars and derivers, webq's cache, pruning and crawls. The shell takes a `name` and a
26
- `noun` and nothing else about what the tool does.
27
+ - [src/run.ts](src/run.ts) — `runAgentCli`: the process contract every rule above lives in.
28
+ - [src/output.ts](src/output.ts) — `capsule` and `clip`, the capsule-then-content shape these CLIs print.
29
+ - [src/env.ts](src/env.ts) — `toolHome` and `toolOutDir`, where a tool's own files go.
30
+ - [src/testing.ts](src/testing.ts) — `captureCli`, the in-process runner the tools' suites drive.
31
+ - [src/flags.ts](src/flags.ts) — `countParser`, which refuses negative, infinite and NaN budgets.
27
32
 
28
- ## Key files
33
+ ## Commands
29
34
 
30
- - [src/run.ts](src/run.ts) — the process contract; the one file a `cli.ts` is allowed to import statically, and
31
- `run.test.ts` fails if it ever grows a runtime import of its own.
32
- - [src/output.ts](src/output.ts) — the capsule line and the budget cut, including the trailer that keeps a
33
- clipped answer from reading as a whole one.
34
- - [src/env.ts](src/env.ts) — `<NAME>_HOME` → `XDG_CACHE_HOME` → `~/.cache/<name>`, and the shared `out` leaf.
35
- - [src/flags.ts](src/flags.ts) — the count parser, and why stricli's own is not it.
36
- - [src/testing.ts](src/testing.ts) — runs an app through the same `run` seam `cli.ts` uses, capturing stdout: no
37
- build artifact, no child process.
35
+ ```sh
36
+ pnpm --filter @intentic/agent-cli test
37
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentic/agent-cli",
3
- "version": "1.310.0",
3
+ "version": "1.312.0",
4
4
  "description": "The process contract, budgeted output and test seam every agent-facing CLI in this repo keeps",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -85,16 +85,16 @@
85
85
  }
86
86
  },
87
87
  "dependencies": {
88
- "@intentic/base": "1.310.0",
89
- "@intentic/constants": "1.310.0",
88
+ "@intentic/base": "1.312.0",
89
+ "@intentic/constants": "1.312.0",
90
90
  "@stricli/core": "1.3.0",
91
91
  "tslib": "2.8.1"
92
92
  },
93
93
  "devDependencies": {
94
94
  "@intentic/testing": "0.0.0",
95
95
  "@intentic/tsconfig": "0.0.0",
96
- "@types/bun": "1.4.0",
97
- "@types/node": "24.13.2",
96
+ "@types/bun": "1.4.2",
97
+ "@types/node": "24.13.6",
98
98
  "@typescript/native-preview": "7.0.0-dev.20260707.2"
99
99
  },
100
100
  "scripts": {