@deepdockai/cli 0.0.0-stage → 1.0.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ ## 1.0.2
4
+
5
+ - The install commands no longer pin a major version: `npx @deepdockai/cli auth login`, `npm install -g @deepdockai/cli`.
6
+
7
+ ## 1.0.1
8
+
9
+ - The agent skill: page with `nextCursor` until it is `null` (a short page can carry a cursor), and cover the codes `access_outdated`, `access_missing`, `record_locked`, `record_not_editable`, `unknown_provider`, `payload_too_large` and the system status `unknown`, in the skill and the CLI's exit-code table.
10
+ - The agent skill: one statement on how to fetch the OpenAPI document, and a MEDICAL OFFICE recipe with its action names.
11
+ - The agent skill states the id rule in full: reads and creates answer ids as integers, a create's new id included; every id you send is a string of digits without a leading zero, at most 10 characters, in a query string and a write body alike.
12
+
13
+ ## 1.0.0
14
+
15
+ First release of `@deepdockai/cli`, the `deepdock` command.
16
+ - Sign in from the terminal with approval in the browser: `deepdock auth login`, `auth status`, `auth logout`.
17
+ - Organisations: `org list`, `org select`, and `--org` or `DEEPDOCK_ORG` on every command that acts in one.
18
+ - Devices, systems, actions and incidents: `devices list|pair|rename|release|systems`, `systems list|openapi`, `actions list`, `incidents list`.
19
+ - API keys that never pass through the terminal: `keys create` (approved in the browser, written straight to your env file), `keys list`, `keys revoke`.
20
+ - The agent skill for Claude Code, Codex and Cursor: `deepdock skill`.
21
+ - Output built for scripts and coding agents: JSON when stdout is not a terminal, stable exit codes 0 to 5.
22
+ - Runs on Linux, macOS and Windows with Node 22.13 or newer.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Deepdock
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 CHANGED
@@ -1,3 +1,272 @@
1
- # Temporary Holding Version
1
+ # Deepdock 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
+ [Deepdock](https://deepdock.ai) makes your customers' business systems reachable as
4
+ an API. A small Deepdock client runs on the customer's PC next to their system; your code calls
5
+ Deepdock's REST API, and Deepdock runs the action on the device. Nothing in the customer's
6
+ network is opened to the internet, and every action is built and verified by Deepdock before it
7
+ is offered to you.
8
+
9
+ This repository holds the partner CLI, published as [`@deepdockai/cli`](https://www.npmjs.com/package/@deepdockai/cli)
10
+ with the command `deepdock`, and the skill it installs for coding agents.
11
+
12
+ ```bash
13
+ npx @deepdockai/cli auth login
14
+ ```
15
+
16
+ The CLI manages: your organisations, the devices paired to them, and your API keys, and it lists
17
+ the systems and actions a device offers. It never runs an action and never keeps or uses an API
18
+ key. Actions run from your own code with a key the CLI wrote into your env file.
19
+
20
+ Node 22.13 or newer. Installed globally (`npm install -g @deepdockai/cli`) the command is
21
+ `deepdock`; the examples below use that form.
22
+
23
+ ## Before you start
24
+
25
+ You need a Deepdock partner organisation and a member account in it; Deepdock sets the
26
+ organisation up with you (get in touch at [deepdock.ai](https://deepdock.ai)). To try things out
27
+ you need a demo device: a Windows machine of your own running the same system as your customers,
28
+ with the Deepdock client installed from `https://api.deepdock.ai/public/client/download` and
29
+ holding only invented, marked data. While unpaired, the client shows a pairing code on its screen.
30
+
31
+ ## Quick start
32
+
33
+ Sign in. The CLI prints a link; open it, check that the page names your computer and CLI version,
34
+ and click Approve. No password is typed into the terminal.
35
+
36
+ ```
37
+ $ deepdock auth login
38
+ Open this link to approve the sign-in (it expires in 10 minutes):
39
+ https://dash.deepdock.ai/cli?request=rq_...
40
+ The page shows this computer's name and the CLI version: check them before you approve.
41
+ Waiting for approval in the browser.
42
+
43
+ Signed in as anna.mueller@muster-it.example.
44
+ ```
45
+
46
+ Choose the organisation to work in, then look around:
47
+
48
+ ```bash
49
+ deepdock org select muster-it # the default for every later command
50
+ deepdock devices list # paired devices, their status and systems
51
+ deepdock systems list # the systems and actions assigned to you
52
+ deepdock systems openapi example-erp > example-erp.openapi.json
53
+ ```
54
+
55
+ Pair your demo device with the code on its screen:
56
+
57
+ ```bash
58
+ deepdock devices pair K7Q-4MX --label "Demo PC"
59
+ ```
60
+
61
+ Create the API key your code runs actions with. You need the admin role in the organisation; a
62
+ human approves the key in the browser, and the CLI writes it straight into the env file, keeps
63
+ no copy and shows the value to nobody. The file must be ignored by git, together with the CLI's
64
+ temporary file: a `.gitignore` line `.env*` covers both, and where git can tell, the CLI refuses otherwise.
65
+
66
+ ```bash
67
+ deepdock keys create "myapp dev" --expires 30d --write-env .env.local
68
+ ```
69
+
70
+ From here your code reads `DEEPDOCK_API_KEY` from `.env.local`, sends it as
71
+ `Authorization: Bearer` on every request to `https://api.deepdock.ai/v1` and calls the
72
+ actions described in the OpenAPI document. The API itself (pairing, writes with
73
+ `Idempotency-Key`, every error code, pauses and incidents) is described per system by
74
+ `deepdock systems openapi <system>` and shown in the dashboard; the skill below carries the same
75
+ knowledge into your coding agent.
76
+
77
+ ## Commands
78
+
79
+ ```
80
+ deepdock auth login | status | logout
81
+ deepdock org list | select [slug]
82
+ deepdock systems list | openapi <system>
83
+ deepdock devices list | pair <code> | rename <id> <label> | release <id> | systems <id>
84
+ deepdock actions list <device> <system>
85
+ deepdock keys list | create <name> | revoke <id>
86
+ deepdock incidents list
87
+ deepdock skill
88
+ ```
89
+
90
+ | Command | What it does |
91
+ | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
92
+ | `auth login` | sign in as yourself, approved in the browser; the sign-in lasts 90 days |
93
+ | `auth status` | who is signed in, the organisations, and the keys this CLI created (id, name, prefix, expiry, file; never the value); exits 5 when not signed in, like `gh auth status` |
94
+ | `auth logout` | revoke the sign-in and every key this CLI created |
95
+ | `org list`, `org select [slug]` | your organisations; set the default one |
96
+ | `systems list` | the systems and actions assigned to your organisation |
97
+ | `systems openapi <system>` | a system's OpenAPI document on stdout, bare when redirected; save it to a file |
98
+ | `devices list` | paired devices with id, label, status, systems and last seen |
99
+ | `devices pair <code> [--label <text>]` | claim a device by the code on its screen |
100
+ | `devices rename <id> <label>`, `devices release <id>` | rename a device; unpair it from the organisation (admin) |
101
+ | `devices systems <id>` | a device's live systems and action state, paused reasons included |
102
+ | `actions list <device> <system>` | every action a device offers, with its method and fields |
103
+ | `keys list`, `keys create <name>`, `keys revoke <id>` | the organisation's API keys (create and revoke: admin) |
104
+ | `incidents list` | open incidents, and those closed within the last 30 days |
105
+ | `skill [--agent claude\|codex\|cursor\|all]` | install the agent skill into the current directory |
106
+
107
+ Global flags: `--org <slug>` and `--json` on every command, `--yes` to confirm `devices release`
108
+ and `keys revoke` without a question, `-h, --help` everywhere and `-v, --version` at the root.
109
+ `deepdock <command> --help` has the details, `deepdock help exit-codes` the exit codes.
110
+
111
+ Two things are never guessed. A device is always named by its full id: no default device, no
112
+ lookup by label. The organisation comes from `--org`, then `DEEPDOCK_ORG`, then the default
113
+ chosen with `deepdock org select`; with none the command stops and lists your organisations.
114
+
115
+ ## The approval flow
116
+
117
+ `auth login` and `keys create` never ask for a password or a key. They print a link, a human
118
+ opens it and clicks Approve in the Deepdock dashboard, and the CLI collects the result. The page
119
+ shows the requesting computer's name and the CLI version, so you can tell the request is yours.
120
+ Approving gives the approver nothing: only the CLI that started the request can collect the
121
+ result. A request lives 10 minutes.
122
+
123
+ Without a terminal (a coding agent's shell, a script) both commands print the request and exit;
124
+ a human approves, and the request is finished later:
125
+
126
+ ```bash
127
+ deepdock auth login --no-wait --json # data.pending.request and data.pending.url
128
+ deepdock auth login --wait <request>
129
+ deepdock keys create "myapp dev" --expires 30d --write-env .env.local --no-wait --json
130
+ deepdock keys create --wait <request>
131
+ ```
132
+
133
+ Ctrl-C during a wait leaves the request pending; `--wait <request>` resumes it.
134
+
135
+ ## JSON mode for agents and scripts
136
+
137
+ On a terminal you get tables and plain sentences. When stdout is not a terminal, or with
138
+ `--json`, every command prints one document on stdout:
139
+
140
+ ```json
141
+ {
142
+ "data": { "...": "the API's data, unchanged" },
143
+ "meta": { "org": { "slug": "muster-it", "name": "Muster IT" }, "requestId": "..." }
144
+ }
145
+ ```
146
+
147
+ `systems openapi` is the one exception off a terminal: it prints the OpenAPI document itself, so
148
+ `deepdock systems openapi <system> > openapi.json` saves a document a generator can read (`--json`
149
+ gives the envelope). For list and show commands `data` is the API's answer unchanged, so what the CLI shows is what
150
+ your code will receive; `auth`, `org select` and `keys create` build it from named fields. A
151
+ failure is one document on stderr, `{ "error": { "code", "message" }, "meta": { "hint" } }`,
152
+ with the API's error object unchanged. Switch on `code` or on the exit code, never on `message`.
153
+
154
+ | Exit | Meaning |
155
+ | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
156
+ | 0 | done |
157
+ | 1 | something on the command line to fix (`invalid_usage`, `org_required`) |
158
+ | 2 | the API refused the request; do not repeat it unchanged (`invalid_request`, `not_found`, `forbidden`, `rate_limited` and the other refusals) |
159
+ | 3 | retry later (`device_offline`, `action_paused`, `system_unavailable`, `target_busy`, `temporarily_unavailable`, `internal_error`, `connection_lost`) |
160
+ | 4 | the CLI is too old for the API (`client_outdated`): run `npx @deepdockai/cli@latest` |
161
+ | 5 | sign-in needed (`sign_in_needed`, `approval_denied`, `approval_expired`); `auth status` when nobody is signed in |
162
+
163
+ The CLI never retries on its own: exit 3 says retry, you decide when. `deepdock commands --json`
164
+ prints the whole command tree.
165
+
166
+ ## The skill for coding agents
167
+
168
+ [`skill/`](skill/) is a skill for Claude Code, Codex and Cursor. It teaches an agent the
169
+ Deepdock model (organisation, API key, device, system, action), the recipe from sign-in to a
170
+ tested integration, how to read the OpenAPI document instead of guessing field names, writes
171
+ with `Idempotency-Key`, every error code and whether to retry it, and the rule that it never
172
+ asks for, reads or prints an API key value. It ships with reference clients in TypeScript and
173
+ Python.
174
+
175
+ ```bash
176
+ deepdock skill # all three agents
177
+ deepdock skill --agent claude # .claude/skills/deepdock/
178
+ deepdock skill --agent codex # a marked section in AGENTS.md
179
+ deepdock skill --agent cursor # .cursor/rules/deepdock.mdc
180
+ ```
181
+
182
+ Codex and Cursor share the reference files under `.deepdock/references/`. Commit what it writes,
183
+ so every clone and agent sees the same skill. Run the command again after updating the CLI; it
184
+ rewrites the files it installs.
185
+
186
+ The skill insists on testing against a demo device with invented, marked data: your code puts a
187
+ `TEST-DEEPDOCK-<6 random characters>` marker in every record it creates, and no real customer data reaches a fixture, a log or a prompt.
188
+
189
+ ## Windows
190
+
191
+ macOS and Linux need nothing special. On Windows:
192
+ - `npx @deepdockai/cli` needs Node 22.13 or newer.
193
+ - Git for Windows must be installed for the ignore checks on `--write-env`. Without it the key is
194
+ still written, with a warning on stderr that the CLI could not check with git.
195
+ - The settings file lives under `%APPDATA%\deepdock\config.json` and the env file wherever you
196
+ point `--write-env`. Windows has no POSIX file modes: both files keep the permissions of their
197
+ folder. Under `C:\Users\<you>` only you can read them; in other folders other users of the PC
198
+ may be able to. For that reason every run that writes the env file prints a line saying so. The
199
+ settings file holds your sign-in and lives under `%APPDATA%`, which only you can read by
200
+ default.
201
+ - In PowerShell, quote a path with spaces and use the same quotes for the whole argument:
202
+ `deepdock keys create "myapp dev" --expires 30d --write-env ".\my app\.env.local"`. Backslashes
203
+ and forward slashes both work.
204
+
205
+ ## Security
206
+
207
+ - **No key is ever shown.** The CLI prints neither the CLI sign-in nor an API key value, under
208
+ any flag, in any stream. `auth status` and `keys list` show ids, prefixes and expiries. A report
209
+ that a key value reached stdout, stderr, the settings file or a log is a security report.
210
+ - **A key goes straight to your env file.** `keys create` writes `DEEPDOCK_API_KEY=<key>` into the
211
+ file named by `--write-env` and keeps no copy. Inside a git repository the file must be ignored
212
+ by git and not tracked; a symbolic link is refused. Outside a repository the key is written with
213
+ a warning; if git cannot answer (not installed, a permission or ownership error, any other
214
+ failure) the key is still written, with a warning on stderr naming the file and the reason, and
215
+ you make sure it is not committed. An existing `DEEPDOCK_API_KEY=` line is replaced in place and the file is set to mode
216
+ 600. While the key is written it sits in a mode 600 temporary file next to the target (for
217
+ `.env.local`, `.env.local.deepdock-tmp-<random>`); a `.gitignore` line `.env*` or
218
+ `*.deepdock-tmp*` covers it; where git answers and the name is not ignored, the CLI refuses before anything is
219
+ created.
220
+ - **The approval link is not a credential.** It names the request; the result is collected with
221
+ a secret the CLI generated and keeps.
222
+ - **Keys expire and can be revoked.** A key reaches every device of the organisation until it
223
+ expires (at most 90 days from the CLI) or is revoked. `deepdock keys revoke <id>` revokes it and
224
+ removes the line the CLI wrote; `deepdock auth logout` revokes the sign-in and every key this
225
+ CLI created. In `--json`, `data.removed` says what happened to the line: `null` for a key this
226
+ CLI never wrote, otherwise `{ file, name, removal }` with `removal` `done`, `absent` (the line
227
+ was already gone or holds another value) or `failed` (with a `reason`). If the file is held open
228
+ by another program (a dev server watching it, on Windows), the key is still revoked and the
229
+ command exits 0, with a warning that the line is still in the file and must be deleted by hand.
230
+ `keys revoke` then keeps its ledger entry, so running `keys revoke <id>` again once the file is
231
+ free removes the line (the API's "not found" for that key's own organisation counts as already
232
+ revoked, and `data.alreadyRevoked` says so). `auth logout` reports the failure in
233
+ `apiKeysRevoked[].removed` and in `meta.hint`, and clears its local records either way.
234
+ - **Local state** lives in `$XDG_CONFIG_HOME/deepdock/config.json`, else
235
+ `~/.config/deepdock/config.json` (`%APPDATA%\deepdock\config.json` on Windows), mode 600 in a
236
+ mode 700 directory. It holds the sign-in, the default organisation, the ids of the keys this
237
+ CLI created (never their values) and a pending approval request. A file other users can read
238
+ is refused with the `chmod` to run.
239
+ - **Environment:** `DEEPDOCK_ORG`, `DEEPDOCK_BASE_URL` (https, or http for localhost only),
240
+ `NO_COLOR`, `FORCE_COLOR` (colours messages on a stream that is not a terminal; `NO_COLOR` wins). A sign-in or pending request is never sent to a different base URL than the one it
241
+ was made against.
242
+
243
+ Report a vulnerability by email to torben@deepdock.ai, not in a public issue: [SECURITY.md](SECURITY.md).
244
+
245
+ ## Development
246
+
247
+ ```bash
248
+ bun install
249
+ bun run build # dist/deepdock.js, one ESM file with no runtime dependencies
250
+ bun run test # builds, then runs vitest under Bun
251
+ bun run test:node # the same tests under Node (needs dist/ from the build)
252
+ bun run format && bun run lint && bun run typecheck && bun run check:public
253
+ ```
254
+
255
+ `tests/fakeApi.ts` is a local HTTP server answering the routes the CLI uses:
256
+
257
+ ```bash
258
+ bun scripts/fakeServer.ts & # prints its URL
259
+ DEEPDOCK_BASE_URL=http://127.0.0.1:<port> node dist/deepdock.js auth login
260
+ ```
261
+
262
+ ## Licence
263
+
264
+ [MIT](LICENSE).
265
+
266
+ ## Releases
267
+
268
+ Publishing is automatic once a change is merged; nobody runs `npm publish`. To ship a change, bump `version` in `package.json` and add a matching
269
+ `## <version>` entry to `CHANGELOG.md` in your pull request. A check on the pull request requires
270
+ the bump whenever a published file changes. When the pull request merges to `main`, the release
271
+ workflow tests the code, scans the exact tarball, publishes it to npm with provenance, then tags
272
+ `v<version>` and creates a GitHub Release with the changelog entry as notes.
package/SECURITY.md ADDED
@@ -0,0 +1,7 @@
1
+ # Security
2
+
3
+ Report a vulnerability by email to torben@deepdock.ai. Please do not open a public issue for it.
4
+ We answer within three working days.
5
+
6
+ The CLI never prints, logs or stores an API key value. A report that shows a key value reaching
7
+ stdout, stderr, the settings file or a log is a security report.