acpx 0.1.0 → 0.1.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.
Files changed (4) hide show
  1. package/LICENSE +18 -12
  2. package/README.md +123 -61
  3. package/dist/cli.js +1665 -222
  4. package/package.json +33 -5
package/LICENSE CHANGED
@@ -1,15 +1,21 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
1
+ MIT License
4
2
 
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
3
+ Copyright (c) 2026 Janitr AI
8
4
 
9
- http://www.apache.org/licenses/LICENSE-2.0
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
10
11
 
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,102 +1,164 @@
1
1
  # acpx
2
2
 
3
- Headless CLI client for the [Agent Client Protocol (ACP)](https://agentclientprotocol.com) — talk to coding agents from the command line.
3
+ Your agents love acpx! 🤖❤️ They hate having to scrape characters from a PTY session 😤
4
+
5
+ `acpx` is a headless CLI client for the [Agent Client Protocol (ACP)](https://agentclientprotocol.com), so AI agents and orchestrators can talk to coding agents over a structured protocol instead of PTY scraping.
6
+
7
+ One command surface for Codex, Claude, Gemini, OpenCode, Pi, or custom ACP servers. Built for agent-to-agent communication over the command line.
8
+
9
+ - **Persistent sessions**: multi-turn conversations that survive across invocations, scoped per repo
10
+ - **Named sessions**: run parallel workstreams in the same repo (`-s backend`, `-s frontend`)
11
+ - **Prompt queueing**: submit prompts while one is already running, they execute in order
12
+ - **Fire-and-forget**: `--no-wait` queues a prompt and returns immediately
13
+ - **Structured output**: typed ACP messages (thinking, tool calls, diffs) instead of ANSI scraping
14
+ - **Any ACP agent**: built-in registry + `--agent` escape hatch for custom servers
15
+ - **One-shot mode**: `exec` for stateless fire-and-forget tasks
4
16
 
5
17
  ```bash
6
- # One-shot: run a prompt against Codex, stream output, exit when done
7
- acpx run --agent codex-acp --cwd ./my-project "Refactor the auth module"
8
-
9
- # Multi-turn: create a session, send messages
10
- acpx session create --agent codex-acp --cwd ./my-project
11
- acpx session send <id> "Refactor the auth module"
12
- acpx session send <id> "Now add tests"
13
- acpx session close <id>
14
- ```
18
+ $ acpx codex "find the flaky test and fix it"
19
+
20
+ [thinking] Investigating test suite for flaky failures
21
+
22
+ [tool] Run npm test -- --reporter=verbose (running)
23
+ [tool] Run npm test -- --reporter=verbose (completed)
24
+ output:
25
+ auth.login (0.8s)
26
+ ✗ checkout.submit (timed out after 5000ms)
27
+ ✓ cart.add (0.3s)
28
+
29
+ [thinking] Found it — checkout.submit has a race condition in the async setup
15
30
 
16
- ## Why?
31
+ [tool] Edit src/checkout.test.ts (completed)
32
+ output:
33
+ Success. Updated 1 file.
17
34
 
18
- ACP adapters exist for every major coding agent ([Codex](https://github.com/zed-industries/codex-acp), [Claude Code](https://github.com/zed-industries/claude-code-acp), [Gemini CLI](https://github.com/google-gemini/gemini-cli), etc.) but every ACP client is a GUI app or editor plugin.
35
+ [tool] Run npm test -- checkout.submit (completed)
36
+ output:
37
+ ✓ checkout.submit (0.4s)
19
38
 
20
- `acpx` is the missing piece: a simple CLI that lets **agents talk to agents** (or humans script agents) over structured ACP instead of scraping terminal output.
39
+ Fixed: added `await` to the setup hook in checkout.submit. The test was
40
+ reading stale state from the previous run.
41
+
42
+ [done] end_turn
43
+ ```
21
44
 
22
45
  ## Install
23
46
 
24
47
  ```bash
25
- npm install -g acpx
26
- # or
27
- npx acpx run --agent codex-acp "Hello"
48
+ npm i -g acpx
28
49
  ```
29
50
 
30
- ### Prerequisites
51
+ `acpx` manages persistent sessions, so prefer a global install. Avoid `npx acpx ...` for normal use.
31
52
 
32
- You need an ACP-compatible agent installed:
53
+ ## Agent prerequisites
33
54
 
34
- ```bash
35
- # Codex
36
- npm install -g @zed-industries/codex-acp
55
+ `acpx` auto-downloads ACP adapters with `npx` on first use. You do not need to install adapter packages manually.
37
56
 
38
- # Claude Code
39
- npm install -g @zed-industries/claude-code-acp
57
+ The only prerequisite is the underlying coding agent you want to use:
40
58
 
41
- # Gemini CLI (native ACP support)
42
- npm install -g @google/gemini-cli
43
- ```
59
+ - `acpx codex` -> Codex CLI: https://codex.openai.com
60
+ - `acpx claude` -> Claude Code: https://claude.ai/code
61
+ - `acpx gemini` -> Gemini CLI: https://github.com/google/gemini-cli
62
+ - `acpx opencode` -> OpenCode: https://opencode.ai
63
+ - `acpx pi` -> Pi Coding Agent: https://github.com/mariozechner/pi
44
64
 
45
- ## Usage
46
-
47
- ### One-shot (`run`)
65
+ ## Usage examples
48
66
 
49
67
  ```bash
50
- # Simple prompt
51
- acpx run --agent codex-acp --cwd /repo "Fix the failing tests"
68
+ acpx codex 'fix the tests' # implicit prompt (persistent session)
69
+ acpx codex prompt 'fix the tests' # explicit prompt subcommand
70
+ acpx codex --no-wait 'draft test migration plan' # enqueue without waiting if session is busy
71
+ acpx exec 'summarize this repo' # default agent shortcut (codex)
72
+ acpx codex exec 'what does this repo do?' # one-shot, no saved session
73
+
74
+ acpx codex -s api 'implement cursor pagination' # named session
75
+ acpx codex -s docs 'rewrite API docs' # parallel work in another named session
52
76
 
53
- # Auto-approve all tool calls
54
- acpx run --agent codex-acp --cwd /repo --approve-all "Build a REST API"
77
+ acpx codex sessions # list sessions for codex command
78
+ acpx codex sessions list # explicit list
79
+ acpx codex sessions close # close cwd-scoped default session
80
+ acpx codex sessions close api # close cwd-scoped named session
55
81
 
56
- # JSON output for programmatic use
57
- acpx run --agent codex-acp --cwd /repo --format json "Add logging"
82
+ acpx claude 'refactor auth middleware' # built-in claude agent
83
+ acpx gemini 'add startup logging' # built-in gemini agent
58
84
 
59
- # Pipe prompt from stdin
60
- echo "Refactor to async/await" | acpx run --agent codex-acp --cwd /repo
85
+ acpx my-agent 'review this patch' # unknown name -> raw command
86
+ acpx --agent './bin/dev-acp --profile ci' 'run checks' # --agent escape hatch
61
87
  ```
62
88
 
63
- ### Multi-turn sessions
89
+ ## Practical scenarios
64
90
 
65
91
  ```bash
66
- # Create session
67
- acpx session create --agent codex-acp --cwd /repo
68
- # abc123
92
+ # Review a PR in a dedicated session and auto-approve permissions
93
+ acpx --cwd ~/repos/shop --approve-all codex -s pr-842 \
94
+ 'Review PR #842 for regressions and propose a minimal fix'
69
95
 
70
- # Send messages (streams results, exits on completion)
71
- acpx session send abc123 "Refactor the auth module"
72
- acpx session send abc123 "Now add tests for it"
96
+ # Keep parallel streams for the same repo
97
+ acpx codex -s bugfix 'isolate flaky checkout test'
98
+ acpx codex -s release 'draft release notes from recent commits'
99
+ ```
73
100
 
74
- # List sessions
75
- acpx session list
101
+ ## Global options in practice
76
102
 
77
- # Close when done
78
- acpx session close abc123
103
+ ```bash
104
+ acpx --approve-all codex 'apply the patch and run tests'
105
+ acpx --approve-reads codex 'inspect repo structure and suggest plan' # default mode
106
+ acpx --deny-all codex 'explain what you can do without tool access'
107
+
108
+ acpx --cwd ~/repos/backend codex 'review recent auth changes'
109
+ acpx --format text codex 'summarize your findings'
110
+ acpx --format json codex exec 'review changed files'
111
+ acpx --format quiet codex 'final recommendation only'
112
+
113
+ acpx --timeout 90 codex 'investigate intermittent test timeout'
114
+ acpx --verbose codex 'debug why adapter startup is failing'
79
115
  ```
80
116
 
81
- ### Output formats
117
+ ## Output formats
82
118
 
83
- | Format | Flag | Description |
84
- |--------|------|-------------|
85
- | text | `--format text` | Human-readable streaming (default) |
86
- | json | `--format json` | Structured ndjson for machines |
87
- | quiet | `--format quiet` | Final text output only |
119
+ ```bash
120
+ # text (default): human-readable stream with tool updates
121
+ acpx codex 'review this PR'
88
122
 
89
- ## How it works
123
+ # json: NDJSON events, useful for automation
124
+ acpx --format json codex exec 'review this PR' \
125
+ | jq -r 'select(.type=="tool_call") | [.status, .title] | @tsv'
90
126
 
127
+ # quiet: final assistant text only
128
+ acpx --format quiet codex 'give me a 3-line summary'
91
129
  ```
92
- ┌─────────┐ stdio/ndjson ┌──────────────┐ wraps ┌─────────┐
93
- │ acpx │ ◄──────────────────► │ ACP adapter │ ◄───────────► │ Agent │
94
- │ (client) │ ACP protocol │ (codex-acp) │ │ (Codex) │
95
- └─────────┘ └──────────────┘ └─────────┘
130
+
131
+ ## Built-in agents and custom servers
132
+
133
+ Built-ins:
134
+
135
+ | Agent | Adapter | Wraps |
136
+ | ---------- | ---------------------------------------------------------------------- | ----------------------------------------------------- |
137
+ | `codex` | [codex-acp](https://github.com/zed-industries/codex-acp) | [Codex CLI](https://codex.openai.com) |
138
+ | `claude` | [claude-agent-acp](https://github.com/zed-industries/claude-agent-acp) | [Claude Code](https://claude.ai/code) |
139
+ | `gemini` | native | [Gemini CLI](https://github.com/google/gemini-cli) |
140
+ | `opencode` | native | [OpenCode](https://opencode.ai) |
141
+ | `pi` | [pi-acp](https://github.com/svkozak/pi-acp) | [Pi Coding Agent](https://github.com/mariozechner/pi) |
142
+
143
+ Use `--agent` as an escape hatch for custom ACP servers:
144
+
145
+ ```bash
146
+ acpx --agent ./my-custom-acp-server 'do something'
96
147
  ```
97
148
 
98
- acpx spawns the ACP adapter as a child process, communicates over the ACP protocol (JSON-RPC over stdio), and translates structured events (tool calls, text, permissions) into CLI output.
149
+ ## Session behavior
150
+
151
+ - Prompt commands use saved sessions scoped to `(agent command, cwd, optional name)`.
152
+ - `-s <name>` creates/selects a parallel named session in the same repo.
153
+ - Prompt submissions are queue-aware per session. If a prompt is already running, new prompts are queued and drained by the running `acpx` process.
154
+ - `--no-wait` submits to that queue and returns immediately.
155
+ - `exec` is always one-shot and does not reuse saved sessions.
156
+ - Session metadata is stored under `~/.acpx/sessions/`.
157
+
158
+ ## Full CLI reference
159
+
160
+ See `docs/CLI.md`.
99
161
 
100
162
  ## License
101
163
 
102
- Apache-2.0
164
+ MIT