@deepdockai/cli 1.0.3 → 1.0.4

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.4
4
+
5
+ - `DEEPDOCK_CONFIG_DIR` moves the settings file (and only it) to a directory of your choice, on every platform; it must be an absolute path. Useful for keeping separate sign-ins apart, for example one per project or account.
6
+
3
7
  ## 1.0.3
4
8
 
5
9
  - `auth logout --keep-keys` revokes only the sign-in. On a terminal, plain `auth logout` lists the API keys and asks before revoking them (default: keep); with `--json`, `--yes` or no terminal it still revokes them. `keys create` says so.
package/README.md CHANGED
@@ -236,12 +236,13 @@ macOS and Linux need nothing special. On Windows:
236
236
  revoked, and `data.alreadyRevoked` says so). `auth logout` reports the failure in
237
237
  `apiKeysRevoked[].removed` and in `meta.hint`, and clears its local records either way.
238
238
  - **Local state** lives in `$XDG_CONFIG_HOME/deepdock/config.json`, else
239
- `~/.config/deepdock/config.json` (`%APPDATA%\deepdock\config.json` on Windows), mode 600 in a
240
- mode 700 directory. It holds the sign-in, the default organisation, the ids of the keys this
239
+ `~/.config/deepdock/config.json` (`%APPDATA%\deepdock\config.json` on Windows), or in
240
+ `$DEEPDOCK_CONFIG_DIR/config.json` when that absolute path is set; mode 600, in a directory the
241
+ CLI creates mode 700 when it does not exist. It holds the sign-in, the default organisation, the ids of the keys this
241
242
  CLI created (never their values) and a pending approval request. A file other users can read
242
243
  is refused with the `chmod` to run.
243
244
  - **Environment:** `DEEPDOCK_ORG`, `DEEPDOCK_BASE_URL` (https, or http for localhost only),
244
- `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
245
+ `DEEPDOCK_CONFIG_DIR`, `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
245
246
  was made against.
246
247
 
247
248
  Report a vulnerability by email to torben@deepdock.ai, not in a public issue: [SECURITY.md](SECURITY.md).
@@ -256,11 +257,33 @@ bun run test:node # the same tests under Node (needs dist/ from the build)
256
257
  bun run format && bun run lint && bun run typecheck && bun run check:public
257
258
  ```
258
259
 
259
- `tests/fakeApi.ts` is a local HTTP server answering the routes the CLI uses:
260
+ ### Trying a change locally
261
+
262
+ `bun run dev` runs the CLI from source. Each API gets a settings directory of its own under
263
+ `<config dir>/deepdock-dev/<api host>/`, so a sign-in made against one API never sits next to
264
+ another's; only the CLI's own settings move (`DEEPDOCK_CONFIG_DIR`), nothing else on the machine:
265
+
266
+ ```bash
267
+ bun run dev -- auth status # the production API
268
+ DEEPDOCK_BASE_URL=http://localhost:8787 bun run dev -- auth login --no-wait
269
+ ```
270
+
271
+ The script does not depend on the current directory: from elsewhere, call it by its path
272
+ (`bun /path/to/devkit/scripts/dev.ts ...`), or put the `DEEPDOCK_BASE_URL=... bun .../dev.ts` line
273
+ in a shell alias per API. To run the exact tarball npm would publish, from any directory:
274
+
275
+ ```bash
276
+ bun run pack:try -- auth status # builds, packs, prints the one-line command to run it
277
+ ```
278
+
279
+ It prints `DEEPDOCK_BASE_URL=... DEEPDOCK_CONFIG_DIR=... npx -y --package=/path/to/deepdockai-cli-<version>.tgz deepdock auth status`,
280
+ for the same API and settings directory `bun run dev` would use (`npx <tarball>` alone would try
281
+ to execute the archive). `tests/fakeApi.ts` is a local stand-in that approves every request at
282
+ once:
260
283
 
261
284
  ```bash
262
285
  bun scripts/fakeServer.ts & # prints its URL
263
- DEEPDOCK_BASE_URL=http://127.0.0.1:<port> node dist/deepdock.js auth login
286
+ DEEPDOCK_BASE_URL=http://127.0.0.1:<port> bun run dev -- auth login
264
287
  ```
265
288
 
266
289
  ## Licence
package/dist/deepdock.js CHANGED
@@ -11424,7 +11424,7 @@ import { spawn } from "node:child_process";
11424
11424
  import { homedir, hostname } from "node:os";
11425
11425
 
11426
11426
  // src/version.ts
11427
- var VERSION = "1.0.3";
11427
+ var VERSION = "1.0.4";
11428
11428
 
11429
11429
  // src/runtime.ts
11430
11430
  var DEFAULT_BASE_URL = "https://api.deepdock.ai";
@@ -11714,17 +11714,21 @@ var renameWithRetry = async (from, to) => {
11714
11714
  // src/config/store.ts
11715
11715
  var PENDING_KEPT_MS = 60 * 60 * 1000;
11716
11716
  var emptyConfig = () => ({ keys: [], pending: [] });
11717
- var configPath = (rt) => {
11718
- if (rt.platform === "win32") {
11719
- const base = rt.env.APPDATA ?? join(rt.homedir, "AppData", "Roaming");
11720
- return join(base, "deepdock", "config.json");
11721
- }
11722
- const xdg = rt.env.XDG_CONFIG_HOME;
11723
- if (xdg && !isAbsolute(xdg)) {
11724
- throw usageError("XDG_CONFIG_HOME must be an absolute path.", "Unset it or give a full path.");
11717
+ var absoluteDir = (env, name) => {
11718
+ const value = env[name];
11719
+ if (value && !isAbsolute(value)) {
11720
+ throw usageError(`${name} must be an absolute path.`, "Unset it or give a full path.");
11725
11721
  }
11726
- const base = xdg || join(rt.homedir, ".config");
11727
- return join(base, "deepdock", "config.json");
11722
+ return value || undefined;
11723
+ };
11724
+ var configBaseDir = (rt) => {
11725
+ if (rt.platform === "win32")
11726
+ return rt.env.APPDATA || join(rt.homedir, "AppData", "Roaming");
11727
+ return absoluteDir(rt.env, "XDG_CONFIG_HOME") ?? join(rt.homedir, ".config");
11728
+ };
11729
+ var configPath = (rt) => {
11730
+ const own = absoluteDir(rt.env, "DEEPDOCK_CONFIG_DIR");
11731
+ return own ? join(own, "config.json") : join(configBaseDir(rt), "deepdock", "config.json");
11728
11732
  };
11729
11733
  var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
11730
11734
  var text = (value) => typeof value === "string" ? value : undefined;
@@ -12079,7 +12083,7 @@ Examples
12079
12083
 
12080
12084
  More
12081
12085
  Exit codes: \`deepdock help exit-codes\`. API reference per system: \`deepdock systems openapi <system>\`.
12082
- Environment: DEEPDOCK_ORG, DEEPDOCK_BASE_URL, NO_COLOR, FORCE_COLOR.
12086
+ Environment: DEEPDOCK_ORG, DEEPDOCK_BASE_URL, DEEPDOCK_CONFIG_DIR, NO_COLOR, FORCE_COLOR.
12083
12087
  Actions run with an API key from your own code, never from this CLI: \`deepdock keys create --help\`.
12084
12088
  `;
12085
12089
  var AUTH_LOGIN_HELP = `Sign in to Deepdock as yourself.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepdockai/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Deepdock partner CLI: pair devices, see systems and actions, create the API key your code runs them with.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,6 +23,8 @@
23
23
  },
24
24
  "scripts": {
25
25
  "build": "bun scripts/build.ts",
26
+ "dev": "bun scripts/dev.ts",
27
+ "pack:try": "bun scripts/packTry.ts",
26
28
  "format": "biome format .",
27
29
  "format:fix": "biome format --write .",
28
30
  "lint": "biome lint .",