@codeworksh/cli 0.0.1-canary.10.1.g65d5c167
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/LICENSE +21 -0
- package/README.md +226 -0
- package/acp-P_1Wqd-Z.mjs +494 -0
- package/acp-P_1Wqd-Z.mjs.map +1 -0
- package/add-DjJjtu0E.mjs +82 -0
- package/add-DjJjtu0E.mjs.map +1 -0
- package/catalog-BeNHJEEM.mjs +17 -0
- package/catalog-BeNHJEEM.mjs.map +1 -0
- package/check-CJtU790x.mjs +54 -0
- package/check-CJtU790x.mjs.map +1 -0
- package/entries-BXBULTVt.mjs +90 -0
- package/entries-BXBULTVt.mjs.map +1 -0
- package/error-CxoEKg-4.mjs +610 -0
- package/error-CxoEKg-4.mjs.map +1 -0
- package/harness-6d8TlAVk.mjs +19 -0
- package/harness-6d8TlAVk.mjs.map +1 -0
- package/index.mjs +39 -0
- package/index.mjs.map +1 -0
- package/install-CRsM-5h3.mjs +54 -0
- package/install-CRsM-5h3.mjs.map +1 -0
- package/link-orVe7_W5.mjs +41 -0
- package/link-orVe7_W5.mjs.map +1 -0
- package/list-B9t_qFIQ.mjs +77 -0
- package/list-B9t_qFIQ.mjs.map +1 -0
- package/list-C7YdESnc.mjs +30 -0
- package/list-C7YdESnc.mjs.map +1 -0
- package/login-zuKhmbS5.mjs +45 -0
- package/login-zuKhmbS5.mjs.map +1 -0
- package/logout-B0lXwmvv.mjs +29 -0
- package/logout-B0lXwmvv.mjs.map +1 -0
- package/package-KrQWL_Rw.mjs +6 -0
- package/package-KrQWL_Rw.mjs.map +1 -0
- package/package.json +54 -0
- package/providers-PNt4dpfv.mjs +17 -0
- package/providers-PNt4dpfv.mjs.map +1 -0
- package/refresh-FjH0oHND.mjs +17 -0
- package/refresh-FjH0oHND.mjs.map +1 -0
- package/refresh-xxKXjcRX.mjs +35 -0
- package/refresh-xxKXjcRX.mjs.map +1 -0
- package/reload-B2PxpO2s.mjs +26 -0
- package/reload-B2PxpO2s.mjs.map +1 -0
- package/remove-Deowzmc7.mjs +37 -0
- package/remove-Deowzmc7.mjs.map +1 -0
- package/run-DNRnGHYa.mjs +146 -0
- package/run-DNRnGHYa.mjs.map +1 -0
- package/runtime-BuFe9cOc.mjs +358 -0
- package/runtime-BuFe9cOc.mjs.map +1 -0
- package/serve-DfW0O2tr.mjs +300 -0
- package/serve-DfW0O2tr.mjs.map +1 -0
- package/settings-aqM_b9UE.mjs +221 -0
- package/settings-aqM_b9UE.mjs.map +1 -0
- package/shared-DN18qxOE.mjs +116 -0
- package/shared-DN18qxOE.mjs.map +1 -0
- package/status-Br21KEeh.mjs +31 -0
- package/status-Br21KEeh.mjs.map +1 -0
- package/update-qrQr-mJT.mjs +51 -0
- package/update-qrQr-mJT.mjs.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sanchit Kudari <0xsanchit@gmail.com> & Contributors
|
|
4
|
+
|
|
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:
|
|
11
|
+
|
|
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
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# @codeworksh/cli
|
|
2
|
+
|
|
3
|
+
Run coding-agent sessions in your repo or a sandbox.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -g @codeworksh/cli
|
|
9
|
+
# or run directly
|
|
10
|
+
pnpm dlx @codeworksh/cli <command>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After install, every command is `codework <command>`.
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
|
|
17
|
+
From `packages/codework`, or `pnpm cli` at the repo root:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm start -- --help
|
|
21
|
+
pnpm start -- models
|
|
22
|
+
pnpm start -- run "Inspect the failing tests"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`start` runs `src/index.ts` with `--conditions=development` so workspace packages resolve to source. The published `codework` binary is the packed `dist` build.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### `codework run`
|
|
32
|
+
|
|
33
|
+
Run an agent session with a prompt.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Start a new session
|
|
37
|
+
codework run "Inspect and fix the failing tests"
|
|
38
|
+
|
|
39
|
+
# Create a session with explicit provider and model
|
|
40
|
+
codework run --provider openai --model gpt-5.5 --thinking high "Plan database migration"
|
|
41
|
+
|
|
42
|
+
# Continue an existing session
|
|
43
|
+
codework run --session ses_01a070f0 "Now implement the migration script"
|
|
44
|
+
|
|
45
|
+
# Run in an isolated sandbox (local, daytona, vercel, memory, sqldb)
|
|
46
|
+
codework run --sandbox-driver daytona "Inspect repository"
|
|
47
|
+
codework run --sandbox-driver daytona --sandbox-provider-id <remote-id> "Continue in sandbox"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Flags:
|
|
51
|
+
|
|
52
|
+
- `--server <url>` — Connect to a running RPC server, e.g. `ws://127.0.0.1:7433/rpc`.
|
|
53
|
+
- `-s, --session <id>` — Continue an existing session.
|
|
54
|
+
- `-C, --cwd <path>` — Working directory for a new session.
|
|
55
|
+
- `--sandbox-driver <driver>` — Sandbox driver (`local`, `daytona`, `vercel`, `memory`, `sqldb`). Default: `local`.
|
|
56
|
+
- `--sandbox-id <id>` — Reuse an existing sandbox instance; mutually exclusive with driver/provider coordinates.
|
|
57
|
+
- `--sandbox-provider-id <id>` — Provider ID of an existing remote sandbox.
|
|
58
|
+
- `--provider <id>` — Model catalog provider ID.
|
|
59
|
+
- `--model <id>` — Model ID.
|
|
60
|
+
- `--thinking <level>` — Reasoning effort the model uses before answering (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`).
|
|
61
|
+
|
|
62
|
+
Global flags: `--user-config-dir`, `--home`, `--database`.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### `codework serve`
|
|
67
|
+
|
|
68
|
+
Start a persistent server that owns sessions and sandboxes:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
codework serve --host 127.0.0.1 --port 7433
|
|
72
|
+
codework run --server ws://127.0.0.1:7433/rpc "Inspect the failing tests"
|
|
73
|
+
codework run --server ws://127.0.0.1:7433/rpc --session <id> "Now fix them"
|
|
74
|
+
codework run --server ws://127.0.0.1:7433/rpc --sandbox-id <sandbox-id> "Start another session in this sandbox"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The default address is `127.0.0.1:7433`; `--port 0` picks an available port and prints the actual URL. Set `--home`, `--database`, and `--user-config-dir` on the server. Model credentials, plugins, and working directories are resolved by the server. A remote run does not boot a local harness.
|
|
78
|
+
|
|
79
|
+
Events are live and not replayed. The client subscribes before admitting its prompt and waits for execution completion after rendering. Lost connections and overflow fail the command; disconnecting leaves server work running. Ctrl-C sends `session.interrupt`, which interrupts the shared session. Remote runs print the sandbox ID for reuse. `session.interrupt` returns `{ interrupted }` as soon as the stop is accepted; `session.wait` is the separate cleanup barrier. A busy period reports itself as `session.execution.started` followed by exactly one of `succeeded`, `failed`, or `interrupted` -- a failure carries a category (`provider-authentication-error`, `model-not-found-error`, `sandbox-mount-error`, ...) that the client renders, and an interruption carries whether it was the user or a server shutdown. Managed sandboxes remain available until explicitly stopped or server shutdown; external sandboxes are not stopped.
|
|
80
|
+
|
|
81
|
+
The v0 endpoint has no authentication; its default binding is loopback. Plugins publish their own event types by declaring them (`Plugin.define({ events: [...] })`, namespaced `plugin.<plugin-id>.*`); the feed carries those and skips types nothing declared. Invalid payloads for declared types fail with a typed encoding error.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### `codework auth login|status|refresh|logout`
|
|
86
|
+
|
|
87
|
+
Sign in to OpenAI Codex with your ChatGPT account, or to GitHub Copilot with your GitHub account. Credentials are
|
|
88
|
+
stored under the selected Codework home and are loaded automatically when a run uses an `openai-codex` or
|
|
89
|
+
`github-copilot` model.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Sign in
|
|
93
|
+
codework auth login --openai-codex
|
|
94
|
+
codework auth login --github-copilot
|
|
95
|
+
|
|
96
|
+
# Codex without a local callback port (SSH, containers, port 1455 in use)
|
|
97
|
+
codework auth login --openai-codex --device
|
|
98
|
+
|
|
99
|
+
# Inspect credential metadata without printing tokens
|
|
100
|
+
codework auth status --openai-codex
|
|
101
|
+
codework auth status --github-copilot
|
|
102
|
+
|
|
103
|
+
# Renew an expired login, or clear one
|
|
104
|
+
codework auth refresh --openai-codex
|
|
105
|
+
codework auth logout --github-copilot
|
|
106
|
+
|
|
107
|
+
# Authenticate the home owned by a running RPC server
|
|
108
|
+
codework auth login --openai-codex --server ws://127.0.0.1:7433/rpc
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`--home` keeps authentication alongside the rest of that Codework installation; `--auth-file` overrides the credential
|
|
112
|
+
file directly. Both providers share one `auth.json`, keyed by provider, so signing out of one leaves the other alone.
|
|
113
|
+
With `--server`, the CLI runs the interactive login locally -- a browser callback and a device prompt both need this
|
|
114
|
+
terminal -- and sends only the resulting credentials to the RPC server for storage.
|
|
115
|
+
|
|
116
|
+
**OpenAI Codex** has two flows. The default keeps Aikit's registered `http://localhost:1455/auth/callback` redirect,
|
|
117
|
+
and falls back to asking for the redirect URL if the callback never arrives. `--device` instead prints a code to enter
|
|
118
|
+
at `auth.openai.com/codex/device` and needs no local port at all — use it over SSH, inside a container, or when another
|
|
119
|
+
sign-in already holds 1455. That port is fixed by the redirect registered against the OAuth client, so it cannot move.
|
|
120
|
+
|
|
121
|
+
**GitHub Copilot** uses the GitHub device flow: the CLI prints a user code, opens `github.com/login/device`, and waits.
|
|
122
|
+
The token does not expire, so there is no `--refresh` -- sign in again on persistent 401s. `--enterprise <domain>`
|
|
123
|
+
logs into a GitHub Enterprise host, and `--enable-models` turns on catalog models the account has left unconfigured.
|
|
124
|
+
Login records the plan-specific Copilot API host, which later runs use in place of the catalog default.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### `codework models`
|
|
129
|
+
|
|
130
|
+
List catalog models as `provider/model`, one per line.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# List all models across all providers
|
|
134
|
+
codework models
|
|
135
|
+
|
|
136
|
+
# List models for a specific provider
|
|
137
|
+
codework models --provider openai
|
|
138
|
+
|
|
139
|
+
# List all supported provider IDs
|
|
140
|
+
codework models providers
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### `codework models refresh`
|
|
146
|
+
|
|
147
|
+
The model catalog lives at `<home>/models.gen.json` (`~/.codework` unless `--home` says otherwise). Every local command checks it before use and downloads a new one once it is older than 15 minutes (`CODEWORK_MODELS_TTL`, e.g. `"1 hour"`); `codework serve` also re-checks every minute and reloads the file whenever it changes. A failed download keeps the previous catalog.
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Download the catalog if it is missing or stale; no network call otherwise
|
|
151
|
+
codework models refresh
|
|
152
|
+
|
|
153
|
+
# Download it now
|
|
154
|
+
codework models refresh --force
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### `codework plugin add` / `codework plugin remove`
|
|
160
|
+
|
|
161
|
+
Install a plugin and record it in a settings file, or take it back out. Scoping follows npm: the
|
|
162
|
+
project is the default, `-g` is user-wide.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# This project: edits .codework/settings.jsonc, creating .codework/ here if no ancestor has one
|
|
166
|
+
codework plugin add @acme/codework-tool-proc@1.2.0
|
|
167
|
+
|
|
168
|
+
# Every project this user runs: writes ~/.codework/settings.jsonc
|
|
169
|
+
codework plugin add @acme/codework-tool-proc@1.2.0 -g
|
|
170
|
+
|
|
171
|
+
# Remove it, along with any configuration written against it
|
|
172
|
+
codework plugin remove @acme/codework-tool-proc
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The project is found the way the harness finds it, and the way git finds a repository: the
|
|
176
|
+
nearest ancestor holding a `.codework` directory. Run from `packages/app`, the command edits the
|
|
177
|
+
repository's own `.codework/settings.jsonc` rather than starting a second project beside it. An
|
|
178
|
+
empty `.codework/` is enough — the marker is the directory, so creating it is how you say a
|
|
179
|
+
project begins here. When no ancestor has one, `add` creates `.codework/` in the directory you are
|
|
180
|
+
in and prints the path, because that decides where every later plugin entry lands.
|
|
181
|
+
|
|
182
|
+
`add` installs and imports the module before writing anything, so a spec that is not a plugin
|
|
183
|
+
fails with its own error and leaves the file untouched; the line it prints names the plugin ID the
|
|
184
|
+
module actually declared. Adding a plugin that is already configured under another spelling — a
|
|
185
|
+
different version, or the path instead of the package — rewrites that entry in place rather than
|
|
186
|
+
leaving a second loader behind, the way `npm install pkg@2` updates the spec already recorded.
|
|
187
|
+
Configuration written against the plugin is left where it is. Edits preserve comments, key order and formatting, and are written
|
|
188
|
+
through a temp file so an interrupted run cannot truncate your settings.
|
|
189
|
+
|
|
190
|
+
`remove` drops the module entry and any configuration object naming the same plugin, whichever
|
|
191
|
+
spelling each was written with: the version it was added with is not part of its identity, and the
|
|
192
|
+
ID a module declares removes the entry that loads it. Resolving an ID reads what is installed and
|
|
193
|
+
never fetches anything. A plugin can also be kept but switched off without removing it, with
|
|
194
|
+
`{ "plugin": "acme.tool.proc", "enabled": false }`.
|
|
195
|
+
|
|
196
|
+
#### Flags:
|
|
197
|
+
|
|
198
|
+
| Flag | Description |
|
|
199
|
+
| :------------------ | :--------------------------------------------------------------------------------- |
|
|
200
|
+
| `-g`, `--global` | Edit the user-wide settings file instead of this project's |
|
|
201
|
+
| `--home` | Where that user-wide file lives (default: `CODEWORK_HOME_DIR`, else `~/.codework`) |
|
|
202
|
+
| `--user-config-dir` | Edit `<dir>/settings.jsonc`; outranks both of the above |
|
|
203
|
+
|
|
204
|
+
Plugin entries accumulate across settings layers, so a user-wide plugin still applies inside a
|
|
205
|
+
project that declares its own. A project that wants an inherited plugin gone says so in its own
|
|
206
|
+
file, with `{ "plugin": "<id>", "enabled": false }`.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Environment Variables
|
|
211
|
+
|
|
212
|
+
| Variable | Description |
|
|
213
|
+
| :----------------------------- | :------------------------------------------------------------------ |
|
|
214
|
+
| `CODEWORK_MODELS_FILE` | Pin the catalog to a file you manage; never refreshed automatically |
|
|
215
|
+
| `CODEWORK_MODELS_TTL` | How old the catalog may get before a refresh (default `15 minutes`) |
|
|
216
|
+
| `OPENAI_API_KEY` | API key for OpenAI models |
|
|
217
|
+
| `ANTHROPIC_API_KEY` | API key for Anthropic models |
|
|
218
|
+
| `OPENROUTER_API_KEY` | API key for OpenRouter models |
|
|
219
|
+
| `GOOGLE_GENERATIVE_AI_API_KEY` | API key for Google models |
|
|
220
|
+
| `XAI_API_KEY` | API key for xAI models |
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
MIT
|