@feedramp/cli 0.0.0-stage → 0.5.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 (3) hide show
  1. package/README.md +265 -2
  2. package/dist/feedramp.js +41877 -0
  3. package/package.json +38 -4
package/README.md CHANGED
@@ -1,3 +1,266 @@
1
- # Temporary Holding Version
1
+ # @feedramp/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Feedramp command-line interface — a thin shell over the public REST API at `/api/v1`.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i -g @feedramp/cli
9
+ feedramp --version
10
+ ```
11
+
12
+ ### Local development inside this repo
13
+
14
+ The repo's root `package.json` exposes a `cli` script that runs the TypeScript
15
+ sources directly via `tsx` — no build step required. **Run it from the repo
16
+ root**, not from `cli/` (the workspace package doesn't define `cli`).
17
+
18
+ **bash / zsh / sh (macOS, Linux, Git Bash, WSL):**
19
+
20
+ ```bash
21
+ npm run cli -- features list --project 1 --jsonl
22
+ ```
23
+
24
+ **Windows CMD (`cmd.exe`):**
25
+
26
+ ```bat
27
+ npm run cli -- features list --project 1 --jsonl
28
+ ```
29
+
30
+ **Windows PowerShell / PowerShell 7+ (`pwsh`):** PowerShell parses bare
31
+ `--long` tokens as its own parameters and silently strips them *before* npm
32
+ sees them, so the bash form ends up running `tsx ... features list 1` with no
33
+ `--project` and no `--jsonl`. Pick one of these workarounds:
34
+
35
+ ```powershell
36
+ # 1. Single-quote each `--flag` so PowerShell treats them as literal strings
37
+ npm run cli '--' features list '--project' 1 '--jsonl'
38
+
39
+ # 2. Use PowerShell's stop-parsing token `--%` — everything after is passed verbatim
40
+ npm run cli -- --% features list --project 1 --jsonl
41
+
42
+ # 3. Skip npm entirely and invoke tsx directly
43
+ npx tsx cli/src/index.ts features list --project 1 --jsonl
44
+ ```
45
+
46
+ Or run the workspace's `start` script from inside `cli/` (same PowerShell
47
+ quoting rules apply):
48
+
49
+ ```powershell
50
+ cd cli
51
+ npm start '--' features list '--project' 1 '--jsonl'
52
+ ```
53
+
54
+ ## Quickstart
55
+
56
+ ```bash
57
+ # 1. Save an API key (uses OS keychain when available, 0600 file fallback otherwise)
58
+ feedramp auth login fdm_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
59
+
60
+ # 2. Verify
61
+ feedramp doctor
62
+
63
+ # 3. List your projects
64
+ feedramp projects list
65
+
66
+ # 4. Stream features as JSONL
67
+ feedramp features list --project 1 --jsonl
68
+
69
+ # 5. Pipe ids through a bulk op
70
+ feedramp features list --project 1 -q --status pending \
71
+ | feedramp features bulk-delete --concurrency 8
72
+ ```
73
+
74
+ ## Output formats
75
+
76
+ | Flag | Behavior |
77
+ | ----------- | ----------------------------------------------------- |
78
+ | (default) | compact text (table for arrays, key:value for objects)|
79
+ | `--json` | minified JSON |
80
+ | `--pretty` | indented JSON |
81
+ | `--jsonl` | one JSON object per line (streams during pagination) |
82
+ | `-q` | print only IDs (one per line) — pipe-friendly |
83
+ | `--fields` | client-side projection, e.g. `--fields displayId,votes`|
84
+
85
+ ## Config layers
86
+
87
+ 1. Built-in defaults (`api_url=https://feedramp.ai`)
88
+ 2. `~/.config/feedramp/config.toml`
89
+ 3. `./.feedramp.toml` (walks up from cwd)
90
+ 4. `FEEDRAMP_*` env vars (`FEEDRAMP_API_URL`, `FEEDRAMP_API_KEY`, `FEEDRAMP_RUN_ID`, `FEEDRAMP_PROFILE`, `FEEDRAMP_NO_COLOR`)
91
+ 5. CLI flags (highest precedence)
92
+
93
+ Anyone who can commit to a repository can write its `.feedramp.toml`, so that
94
+ file may only set `api_url`, `profile`, `run_id` and `no_color`. Its
95
+ `api_url` is used only when it's the server you already use, or one you've
96
+ trusted; otherwise the CLI ignores it, says so, and keeps sending your key to
97
+ your own server:
98
+
99
+ ```bash
100
+ feedramp config set trusted_api_urls https://test.feedramp.ai,http://localhost:5000
101
+ ```
102
+
103
+ Other keys in a project file (`cache_dir`, `api_key`, `trusted_api_urls`) are
104
+ ignored with a warning. `feedramp cache clear` only deletes the files the
105
+ cache wrote, wherever `cache_dir` points.
106
+
107
+ ```bash
108
+ feedramp config get api_url --explain
109
+ # api_url="https://feedramp.ai" [env: FEEDRAMP_API_URL]
110
+ ```
111
+
112
+ ## Autonomous worker (AO-4)
113
+
114
+ `feedramp worker` runs a coding agent that takes work from a project's claim
115
+ queue, builds it on a `feedramp/*` branch, opens a pull request and hands the
116
+ build to Feedramp's verifier. Design: `docs/design/ao-4-worker.md`.
117
+
118
+ Add the worker on Feedramp's Workers page. It shows one line to paste on the
119
+ machine, as the user the worker should run as (PowerShell on Windows):
120
+
121
+ ```sh
122
+ npx -y @feedramp/cli@latest worker setup --enroll 7K3M-Q9TD --name box-2-claude --api-url https://feedramp.ai
123
+ ```
124
+
125
+ `worker setup` needs no admin rights. It:
126
+
127
+ 1. checks git (2.31+) and the agent: Claude Code installed and signed in
128
+ (`claude auth status`). If something's missing it says how to fix it and
129
+ stops **before** using the code, so the same line works again afterwards;
130
+ 2. trades the one-time code for the worker's key;
131
+ 3. copies the CLI to `~/.feedramp/cli/<version>/`, so the service doesn't
132
+ depend on npx's cache;
133
+ 4. runs the worker in the background as you: a systemd user service on Linux
134
+ (with `loginctl enable-linger`, so it keeps running after you sign out and
135
+ starts at boot), a LaunchAgent on macOS and a sign-in scheduled task with
136
+ no window on Windows (both start when you sign in, so turn on automatic
137
+ sign-in on a VM that restarts unattended). It restarts after a crash; a
138
+ clean stop stays stopped until the next boot or sign-in.
139
+
140
+ On Linux and macOS the service reads the key from the 0600 credentials file
141
+ (`~/.config/feedramp/credentials`): a background service can't answer a
142
+ keychain prompt or open a locked keyring. Windows keeps it in the Credential
143
+ Manager.
144
+
145
+ Without a global install (`npm install -g @feedramp/cli`), put
146
+ `npx -y @feedramp/cli@latest` where these say `feedramp`; the CLI's own
147
+ messages already do when it was started that way.
148
+
149
+ ```sh
150
+ feedramp worker doctor # what's missing, in plain words, with the fix
151
+ feedramp worker status
152
+ feedramp worker stop --name box-2-claude # commit, push, release with a hand-off
153
+ feedramp worker setup --name box-2-claude # set the service up again (e.g. after an update)
154
+ feedramp worker uninstall --name box-2-claude # stop cleanly and remove the service (--forget: folder and key too)
155
+ feedramp worker start --name box-2-claude # or run it in the foreground; Ctrl-C stops cleanly
156
+ feedramp worker start --name box-2-claude --once # at most one feature
157
+ ```
158
+
159
+ `worker setup --no-service` only sets the worker up, for machines without a
160
+ service manager (containers): run `feedramp worker start` yourself.
161
+
162
+ **Running as a separate OS user instead.** `worker install` creates a
163
+ dedicated user (`feedramp-<name>`) with a private home and work folder,
164
+ copies the config and key into that user's own 0600 credentials file, and
165
+ registers a system service: systemd on Linux, a LaunchDaemon on macOS, a
166
+ startup scheduled task on Windows. It needs root/administrator, prints the
167
+ plan unless you pass `--apply`, and afterwards you sign the agent in once as
168
+ that user. It's the safer choice on a machine that's also used for anything
169
+ else (see the permission mode below).
170
+
171
+ ```sh
172
+ feedramp worker install --name box-2-claude # show the plan
173
+ sudo feedramp worker install --name box-2-claude --apply
174
+ ```
175
+
176
+ - **Feedramp decides what the worker runs.** Its agent and models are set on
177
+ the Workers page and can be changed there at any time; the worker picks up
178
+ a change before its next feature. Pausing, rotating the key and revoking
179
+ happen there too; the page shows "Pausing…" / "Resuming…" until the worker
180
+ has checked in and seen the change (within about a minute when it's idle). If the chosen agent isn't installed or signed in, the
181
+ worker shows `needs_setup` (here and on the page) and takes no work.
182
+ - **Each worker has its own folder**, `~/.feedramp/workers/<name>/`: its
183
+ config, status, a lock (so it can't run twice), `work/` for checkouts and
184
+ `tmp/` for temporary files. Several workers can run on one machine (say a
185
+ Claude one and a Codex one) without touching each other's files.
186
+ `--own-agent-login` also gives the worker its own agent sign-in there (sign
187
+ in with `feedramp worker agent-login --name <name>`), e.g. for two Claude
188
+ accounts on one machine. Workers set up before 0.3.0 move into this layout
189
+ on first use.
190
+ - The key is in the OS credential store (0600 file fallback), never in the
191
+ config. Worker keys only work on the worker endpoints.
192
+ - Pushes use a one-hour GitHub App token Feedramp issues for the live claim.
193
+ It is passed to git through environment config only. The worker cancels it
194
+ when it finishes the feature, and Feedramp cancels it too whenever the claim
195
+ ends (including when a person revokes the worker's key).
196
+ - **The project's worker rules** come with every feature: machine git logins,
197
+ web access, which agent settings load, allowed MCP servers and blocked
198
+ commands. The worker applies them to whichever agent it runs. Define MCP
199
+ servers (with their secrets) in `~/.feedramp/workers/<name>/mcp.json`,
200
+ `{"mcpServers": {...}}`; only the ones the project allows by name are used.
201
+ - **Claude Code** (`--agent claude-code`) runs as `claude -p --output-format
202
+ stream-json` with the claim's model. The prompt goes in on stdin, only the
203
+ allowed MCP servers load (`--strict-mcp-config --mcp-config`), the rules
204
+ become deny rules in a per-run `--settings` file plus `--setting-sources`,
205
+ and sessions aren't saved.
206
+ Permission mode defaults to `bypassPermissions`: nobody is there to answer
207
+ Claude Code's prompts, so it doesn't ask before running commands. The
208
+ worker rules still apply, but the agent can reach whatever the OS user
209
+ running the worker can. `worker setup` runs it as you, so use a machine
210
+ (or a user) kept for the worker, or `feedramp worker install --name <name>`
211
+ for a separate OS user and service; the worker logs a warning at start when
212
+ an ordinary user runs it this way. `--permission-mode` changes it.
213
+ - **The agent gets a short list of environment variables**, not the worker's
214
+ whole environment: what programs need to run and find their tools (`PATH`,
215
+ home and temp folders, Windows system folders), language, proxies and
216
+ certificates, toolchain folders (`JAVA_HOME`, `NVM_DIR`...), and the
217
+ agent's own sign-in (`ANTHROPIC_*`, `CLAUDE_CODE_*`). Everything else (cloud
218
+ keys, package tokens, database URLs) stays with the worker. Pass more by
219
+ name with `worker setup --pass-env DATABASE_URL,AWS_*`. `FEEDRAMP_*`
220
+ variables never reach the agent, and git/GitHub logins only do when the
221
+ project's rules allow machine logins.
222
+ Usage limits are read from Claude Code's rate-limit events. Extra usage only
223
+ counts as allowed when Feedramp has approved an overage budget.
224
+ - Needs git 2.31 or newer and Node 22.19 or newer (Node 22 or 24 LTS).
225
+ - **Feedramp deploys and outages need nothing on the worker's machine.** If
226
+ Feedramp can't be reached (a deploy, a restart, a network blip), the worker
227
+ keeps asking for work with growing waits (5 s, 10 s, 20 s … up to 5 min),
228
+ logs once that it lost contact and once when it's back, and shows
229
+ `reconnecting` in `worker status`. Submits, releases, push tokens and
230
+ context requests in the middle of a build are retried for up to 15 minutes,
231
+ so finished work isn't lost to a deploy. If Feedramp turns the worker away
232
+ (an outdated CLI, missing permissions) it shows `refused` with the reason and
233
+ asks again every 5 minutes, so fixing the cause is enough.
234
+ - **Revoking the worker's key in Feedramp stops it for good.** At its next
235
+ check-in the worker stops the agent, deletes that feature's checkout, removes
236
+ the stored key, shows `revoked` in `worker status` and exits cleanly (exit
237
+ code 0, so services don't restart it). Add it again on the Workers page and
238
+ run the new setup command to bring it back.
239
+ - Services restart a worker that crashes: systemd and launchd on failure, and
240
+ on Windows the launcher loops after a non-zero exit (30 s pause).
241
+ - The worker checks in every 5 minutes, committing and pushing as it goes,
242
+ follows the feature's usage-limit policy (wait, hand off or pay), and
243
+ stops cleanly or aborts when the project is paused.
244
+
245
+ ## Exit codes
246
+
247
+ | Code | Meaning |
248
+ | ---- | ---------------------- |
249
+ | 0 | success |
250
+ | 1 | general error |
251
+ | 2 | usage error |
252
+ | 3 | validation |
253
+ | 4 | not found |
254
+ | 5 | authentication |
255
+ | 6 | rate-limited |
256
+ | 7 | conflict/unprocessable |
257
+ | 8 | insufficient permissions |
258
+ | 9 | network |
259
+ | 10 | server error |
260
+
261
+ ## More
262
+
263
+ - `feedramp examples` — copy-pasteable recipes (auth, create, bulk, paginate)
264
+ - `feedramp completion bash|zsh|fish|powershell` — shell completion scripts
265
+ - `feedramp openapi` — dump the cached OpenAPI spec (refreshes via ETag)
266
+ - `feedramp doctor` — connectivity, auth, schema cache health-check