acpx 0.1.0 → 0.1.3

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/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "acpx",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "Headless CLI client for the Agent Client Protocol (ACP) — talk to coding agents from the command line",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
8
+ "skills",
8
9
  "README.md",
9
10
  "LICENSE"
10
11
  ],
@@ -13,9 +14,18 @@
13
14
  },
14
15
  "scripts": {
15
16
  "build": "tsup src/cli.ts --format esm --dts --clean",
17
+ "build:test": "tsc -p tsconfig.test.json",
18
+ "test": "npm run build:test && node --test dist-test/test/*.test.js",
19
+ "prepare": "husky",
20
+ "precommit": "npm exec -- lint-staged && npm run -s build",
16
21
  "prepack": "npm run build",
17
22
  "dev": "tsx src/cli.ts",
18
- "typecheck": "tsc --noEmit"
23
+ "typecheck": "tsc --noEmit",
24
+ "lint": "eslint src --max-warnings=0",
25
+ "format": "prettier --write .",
26
+ "format:check": "prettier --check .",
27
+ "release": "release-it",
28
+ "release:ci": "release-it --ci"
19
29
  },
20
30
  "keywords": [
21
31
  "acp",
@@ -27,7 +37,7 @@
27
37
  "ai"
28
38
  ],
29
39
  "author": "Janitr AI",
30
- "license": "Apache-2.0",
40
+ "license": "MIT",
31
41
  "repository": {
32
42
  "type": "git",
33
43
  "url": "git+https://github.com/janitrai/acpx.git"
@@ -37,12 +47,30 @@
37
47
  },
38
48
  "dependencies": {
39
49
  "@agentclientprotocol/sdk": "^0.14.1",
40
- "commander": "^13.0.0"
50
+ "commander": "^13.0.0",
51
+ "skillflag": "^0.1.3"
41
52
  },
42
53
  "devDependencies": {
54
+ "@eslint/js": "^10.0.1",
55
+ "@types/node": "^22.0.0",
56
+ "eslint": "^10.0.0",
57
+ "globals": "^17.3.0",
58
+ "husky": "^9.1.7",
59
+ "lint-staged": "^16.2.7",
60
+ "prettier": "^3.8.1",
61
+ "release-it": "^19.2.4",
43
62
  "tsup": "^8.0.0",
44
63
  "tsx": "^4.0.0",
45
64
  "typescript": "^5.7.0",
46
- "@types/node": "^22.0.0"
65
+ "typescript-eslint": "^8.56.0"
66
+ },
67
+ "lint-staged": {
68
+ "*.{js,ts}": [
69
+ "prettier --write --ignore-unknown",
70
+ "eslint --fix"
71
+ ],
72
+ "*.{json,md}": [
73
+ "prettier --write --ignore-unknown"
74
+ ]
47
75
  }
48
76
  }
@@ -0,0 +1,254 @@
1
+ ---
2
+ name: acpx
3
+ description: Use acpx as a headless ACP CLI for agent-to-agent communication, including prompt/exec/sessions workflows, session scoping, queueing, permissions, and output formats.
4
+ ---
5
+
6
+ # acpx
7
+
8
+ ## When to use this skill
9
+
10
+ Use this skill when you need to run coding agents through `acpx`, manage persistent ACP sessions, queue prompts, or consume structured agent output from scripts.
11
+
12
+ ## What acpx is
13
+
14
+ `acpx` is a headless, scriptable CLI client for the Agent Client Protocol (ACP). It is built for agent-to-agent communication over the command line and avoids PTY scraping.
15
+
16
+ Core capabilities:
17
+
18
+ - Persistent multi-turn sessions per repo/cwd
19
+ - One-shot execution mode (`exec`)
20
+ - Named parallel sessions (`-s/--session`)
21
+ - Queue-aware prompt submission with optional fire-and-forget (`--no-wait`)
22
+ - Structured streaming output (`text`, `json`, `quiet`)
23
+ - Built-in agent registry plus raw `--agent` escape hatch
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ npm i -g acpx
29
+ ```
30
+
31
+ For normal session reuse, prefer a global install over `npx`.
32
+
33
+ ## Command model
34
+
35
+ `prompt` is the default verb.
36
+
37
+ ```bash
38
+ acpx [global_options] [prompt_text...]
39
+ acpx [global_options] prompt [prompt_options] [prompt_text...]
40
+ acpx [global_options] exec [prompt_text...]
41
+ acpx [global_options] sessions [list | new [--name <name>] | close [name]]
42
+
43
+ acpx [global_options] <agent> [prompt_options] [prompt_text...]
44
+ acpx [global_options] <agent> prompt [prompt_options] [prompt_text...]
45
+ acpx [global_options] <agent> exec [prompt_text...]
46
+ acpx [global_options] <agent> sessions [list | new [--name <name>] | close [name]]
47
+ ```
48
+
49
+ If prompt text is omitted and stdin is piped, `acpx` reads prompt text from stdin.
50
+
51
+ ## Built-in agent registry
52
+
53
+ Friendly agent names resolve to commands:
54
+
55
+ - `codex` -> `npx @zed-industries/codex-acp`
56
+ - `claude` -> `npx @zed-industries/claude-agent-acp`
57
+ - `gemini` -> `gemini`
58
+ - `opencode` -> `npx opencode-ai`
59
+ - `pi` -> `npx pi-acp`
60
+
61
+ Rules:
62
+
63
+ - Default agent is `codex` for top-level `prompt`, `exec`, and `sessions`.
64
+ - Unknown positional agent tokens are treated as raw agent commands.
65
+ - `--agent <command>` explicitly sets a raw ACP adapter command.
66
+ - Do not combine a positional agent and `--agent` in the same command.
67
+
68
+ ## Commands
69
+
70
+ ### Prompt (default, persistent session)
71
+
72
+ Implicit:
73
+
74
+ ```bash
75
+ acpx codex 'fix flaky tests'
76
+ ```
77
+
78
+ Explicit:
79
+
80
+ ```bash
81
+ acpx codex prompt 'fix flaky tests'
82
+ acpx prompt 'fix flaky tests' # defaults to codex
83
+ ```
84
+
85
+ Behavior:
86
+
87
+ - Uses a saved session for the session scope key
88
+ - Auto-resumes prior session when one exists for that scope
89
+ - Creates a new session record when none exists
90
+ - Is queue-aware when another prompt is already running for the same session
91
+
92
+ Prompt options:
93
+
94
+ - `-s, --session <name>`: use a named session within the same cwd
95
+ - `--no-wait`: enqueue and return immediately when session is already busy
96
+
97
+ ### Exec (one-shot)
98
+
99
+ ```bash
100
+ acpx exec 'summarize this repo'
101
+ acpx codex exec 'summarize this repo'
102
+ ```
103
+
104
+ Behavior:
105
+
106
+ - Runs a single prompt in a temporary ACP session
107
+ - Does not reuse or save persistent session state
108
+
109
+ ### Sessions
110
+
111
+ ```bash
112
+ acpx sessions
113
+ acpx sessions list
114
+ acpx sessions new
115
+ acpx sessions new --name backend
116
+ acpx sessions close
117
+ acpx sessions close backend
118
+
119
+ acpx codex sessions
120
+ acpx codex sessions new --name backend
121
+ acpx codex sessions close backend
122
+ ```
123
+
124
+ Behavior:
125
+
126
+ - `sessions` and `sessions list` are equivalent
127
+ - `new` creates a fresh session for the current `(agentCommand, cwd, optional name)` scope
128
+ - `new --name <name>` targets a named session scope
129
+ - when `new` replaces an existing open session in that scope, the old one is soft-closed
130
+ - `close` targets current cwd default session
131
+ - `close <name>` targets current cwd named session
132
+
133
+ ## Global options
134
+
135
+ - `--agent <command>`: raw ACP agent command (escape hatch)
136
+ - `--cwd <dir>`: working directory for session scope (default: current directory)
137
+ - `--approve-all`: auto-approve all permission requests
138
+ - `--approve-reads`: auto-approve reads/searches, prompt for writes (default mode)
139
+ - `--deny-all`: deny all permission requests
140
+ - `--format <fmt>`: output format (`text`, `json`, `quiet`)
141
+ - `--timeout <seconds>`: max wait time (positive number)
142
+ - `--ttl <seconds>`: queue owner idle TTL before shutdown (default `300`, `0` disables TTL)
143
+ - `--verbose`: verbose ACP/debug logs to stderr
144
+
145
+ Permission flags are mutually exclusive.
146
+
147
+ ## Session behavior
148
+
149
+ Persistent prompt sessions are scoped by:
150
+
151
+ - `agentCommand`
152
+ - absolute `cwd`
153
+ - optional session `name`
154
+
155
+ Persistence:
156
+
157
+ - Session records are stored in `~/.acpx/sessions/*.json`.
158
+ - `-s/--session` creates parallel named conversations in the same repo.
159
+ - Changing `--cwd` changes scope and therefore session lookup.
160
+ - closed sessions are retained on disk with `closed: true` and `closedAt`.
161
+ - auto-resume by scope skips closed sessions.
162
+
163
+ Resume behavior:
164
+
165
+ - Prompt mode attempts to reconnect to saved session.
166
+ - If adapter-side session is invalid/not found, `acpx` creates a fresh session and updates the saved record.
167
+ - explicitly selected session records can still be resumed via `loadSession` even if previously closed.
168
+
169
+ ## Prompt queueing and `--no-wait`
170
+
171
+ Queueing is per persistent session.
172
+
173
+ - The active `acpx` process for a running prompt becomes the queue owner.
174
+ - Other invocations submit prompts over local IPC.
175
+ - On Unix-like systems, queue IPC uses a Unix socket under `~/.acpx/queues/<hash>.sock`.
176
+ - Ownership is coordinated with a lock file under `~/.acpx/queues/<hash>.lock`.
177
+ - On Windows, named pipes are used instead of Unix sockets.
178
+ - after the queue drains, owner shutdown is governed by TTL (default 300s, configurable with `--ttl`).
179
+
180
+ Submission behavior:
181
+
182
+ - Default: enqueue and wait for queued prompt completion, streaming updates back.
183
+ - `--no-wait`: enqueue and return after queue acknowledgement.
184
+
185
+ ## Output formats
186
+
187
+ Use `--format <fmt>`:
188
+
189
+ - `text` (default): human-readable stream with updates/tool status and done line
190
+ - `json`: NDJSON event stream (good for automation)
191
+ - `quiet`: final assistant text only
192
+
193
+ Example automation:
194
+
195
+ ```bash
196
+ acpx --format json codex exec 'review changed files' \
197
+ | jq -r 'select(.type=="tool_call") | [.status, .title] | @tsv'
198
+ ```
199
+
200
+ ## Permission modes
201
+
202
+ - `--approve-all`: no interactive permission prompts
203
+ - `--approve-reads` (default): approve reads/searches, prompt for writes
204
+ - `--deny-all`: deny all permission requests
205
+
206
+ If every permission request is denied/cancelled and none approved, `acpx` exits with permission-denied status.
207
+
208
+ ## Practical workflows
209
+
210
+ Persistent repo assistant:
211
+
212
+ ```bash
213
+ acpx codex 'inspect failing tests and propose a fix plan'
214
+ acpx codex 'apply the smallest safe fix and run tests'
215
+ ```
216
+
217
+ Parallel named streams:
218
+
219
+ ```bash
220
+ acpx codex -s backend 'fix API pagination bug'
221
+ acpx codex -s docs 'draft changelog entry for release'
222
+ ```
223
+
224
+ Queue follow-up without waiting:
225
+
226
+ ```bash
227
+ acpx codex 'run full test suite and investigate failures'
228
+ acpx codex --no-wait 'after tests, summarize root causes and next steps'
229
+ ```
230
+
231
+ One-shot script step:
232
+
233
+ ```bash
234
+ acpx --format quiet exec 'summarize repo purpose in 3 lines'
235
+ ```
236
+
237
+ Machine-readable output for orchestration:
238
+
239
+ ```bash
240
+ acpx --format json codex 'review current branch changes' > events.ndjson
241
+ ```
242
+
243
+ Raw custom adapter command:
244
+
245
+ ```bash
246
+ acpx --agent './bin/custom-acp-server --profile ci' 'run validation checks'
247
+ ```
248
+
249
+ Repo-scoped review with permissive mode:
250
+
251
+ ```bash
252
+ acpx --cwd ~/repos/shop --approve-all codex -s pr-842 \
253
+ 'review PR #842 for regressions and propose minimal patch'
254
+ ```