@deepdockai/cli 1.0.21 → 1.0.23
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 +9 -0
- package/dist/deepdock.js +28 -9
- package/package.json +1 -1
- package/skill/SKILL.md +2 -2
- package/skill/references/auth-and-keys.md +3 -2
- package/skill/references/concepts.md +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.23
|
|
4
|
+
|
|
5
|
+
- An incident's program version is named `programVersion` instead of `version`, in `GET /v1/incidents`, in `incidents list --json` and in the skill's concepts. Read the new name where you read the old one; the value is unchanged.
|
|
6
|
+
|
|
7
|
+
## 1.0.22
|
|
8
|
+
|
|
9
|
+
- `keys create --write-env` writes `DEEPDOCK_BASE_URL=<url>` beside the key when `DEEPDOCK_BASE_URL` points the CLI at another API than production, since a key works only on the API it was created on and the bundled clients default to production. A production key points such a line, left by an earlier key, at production. `meta.written.baseUrl` names the URL when the line was written. Revoking a key removes only the key line.
|
|
10
|
+
- The help of `keys create` names the temporary file the CLI writes beside the env file (`<file>.deepdock-tmp-*`), which git must ignore too; a pattern such as `.env*` covers both.
|
|
11
|
+
|
|
3
12
|
## 1.0.21
|
|
4
13
|
|
|
5
14
|
- A bad action input is refused before it reaches the device, with `400 invalid_request`, and the answer lists every input that failed in `error.fields`: `{ field, message }` items, sorted by name, at most 32, never the value you sent. An unknown or missing input used to come back as `422 invalid_input`; it is now this 400. `invalid_input` stays for the rules only the device can judge, such as a pattern or a calendar date. The skill's error reference describes `fields`.
|
package/dist/deepdock.js
CHANGED
|
@@ -11429,7 +11429,7 @@ import { spawn } from "node:child_process";
|
|
|
11429
11429
|
import { homedir, hostname } from "node:os";
|
|
11430
11430
|
|
|
11431
11431
|
// src/version.ts
|
|
11432
|
-
var VERSION = "1.0.
|
|
11432
|
+
var VERSION = "1.0.23";
|
|
11433
11433
|
|
|
11434
11434
|
// src/runtime.ts
|
|
11435
11435
|
var DEFAULT_BASE_URL = "https://api.deepdock.ai";
|
|
@@ -12138,9 +12138,13 @@ Arguments
|
|
|
12138
12138
|
|
|
12139
12139
|
Flags
|
|
12140
12140
|
--expires <duration> 7d, 30d or 90d (required; 90 days is the maximum from the CLI)
|
|
12141
|
-
--write-env <file> Write DEEPDOCK_API_KEY=<key> into this file (required)
|
|
12142
|
-
|
|
12143
|
-
|
|
12141
|
+
--write-env <file> Write DEEPDOCK_API_KEY=<key> into this file (required), and
|
|
12142
|
+
DEEPDOCK_BASE_URL=<url> beside it when DEEPDOCK_BASE_URL points the
|
|
12143
|
+
CLI at another API than production (a production key points such a
|
|
12144
|
+
line, left by an earlier key, at production). Inside a git repository the file
|
|
12145
|
+
must be ignored and not tracked, and so must the temporary file the
|
|
12146
|
+
CLI writes next to it (<file>.deepdock-tmp-*): a pattern such as
|
|
12147
|
+
.env* covers both. Outside a repository the CLI warns
|
|
12144
12148
|
--no-wait Print the request and exit; finish it with --wait
|
|
12145
12149
|
--wait <request> Finish a request started with --no-wait
|
|
12146
12150
|
--no-browser Do not open the link in a browser (also DEEPDOCK_NO_BROWSER=1)
|
|
@@ -12266,6 +12270,7 @@ import { randomBytes as randomBytes2 } from "node:crypto";
|
|
|
12266
12270
|
import { promises as fs4 } from "node:fs";
|
|
12267
12271
|
import { basename, dirname as dirname2, join as join2, resolve } from "node:path";
|
|
12268
12272
|
var API_KEY_VARIABLE = "DEEPDOCK_API_KEY";
|
|
12273
|
+
var BASE_URL_VARIABLE = "DEEPDOCK_BASE_URL";
|
|
12269
12274
|
var windowsFileWarning = (platform, envFile, settingsFile) => platform === "win32" ? `On Windows these files keep the permissions of their folder: ${envFile} and the settings file ${settingsFile} hold secrets; under C:\\Users\\<you> only you can read them, in other folders other users of this PC may be able to.` : undefined;
|
|
12270
12275
|
var git = (rt, dir, args) => new Promise((done) => {
|
|
12271
12276
|
const env = { ...rt.env ?? process.env, LC_ALL: "C" };
|
|
@@ -12420,7 +12425,7 @@ var atomicWrite = async (path, content) => {
|
|
|
12420
12425
|
}
|
|
12421
12426
|
};
|
|
12422
12427
|
var KEY_SHAPE = /^[A-Za-z0-9_-]{16,}$/;
|
|
12423
|
-
var writeEnvValue = async (path, variable, value) => {
|
|
12428
|
+
var writeEnvValue = async (path, variable, value, baseUrl) => {
|
|
12424
12429
|
if (!KEY_SHAPE.test(value)) {
|
|
12425
12430
|
throw internal("The API answered a key in a shape this CLI will not write.", "Nothing was written.");
|
|
12426
12431
|
}
|
|
@@ -12431,7 +12436,11 @@ var writeEnvValue = async (path, variable, value) => {
|
|
|
12431
12436
|
if (!(error instanceof Error && ("code" in error) && error.code === "ENOENT"))
|
|
12432
12437
|
throw error;
|
|
12433
12438
|
}
|
|
12434
|
-
|
|
12439
|
+
const withKey = upsertLine(existing, variable, value);
|
|
12440
|
+
const matcher = lineStart(BASE_URL_VARIABLE);
|
|
12441
|
+
const writeBase = baseUrl !== undefined && (baseUrl.always || withKey.split(/\r?\n/).some((line) => matcher.test(line)));
|
|
12442
|
+
await atomicWrite(path, writeBase ? upsertLine(withKey, BASE_URL_VARIABLE, baseUrl.url) : withKey);
|
|
12443
|
+
return writeBase;
|
|
12435
12444
|
};
|
|
12436
12445
|
var removeEnvValue = async (path, variable, prefix) => {
|
|
12437
12446
|
let existing;
|
|
@@ -12994,6 +13003,8 @@ var finishKey = async (ctx, pending, warned) => {
|
|
|
12994
13003
|
org: org.slug
|
|
12995
13004
|
});
|
|
12996
13005
|
const created = answer.key;
|
|
13006
|
+
const baseUrlLine = { url: ctx.baseUrl, always: ctx.baseUrl !== DEFAULT_BASE_URL };
|
|
13007
|
+
let baseUrlWritten = false;
|
|
12997
13008
|
const entry = {
|
|
12998
13009
|
org: org.slug,
|
|
12999
13010
|
id: created.id,
|
|
@@ -13014,7 +13025,7 @@ var finishKey = async (ctx, pending, warned) => {
|
|
|
13014
13025
|
const windows = windowsFileWarning(ctx.rt.platform, pending.file, configPath(ctx.rt));
|
|
13015
13026
|
if (windows)
|
|
13016
13027
|
ctx.note(windows);
|
|
13017
|
-
await writeEnvValue(pending.file, pending.variable, created.key);
|
|
13028
|
+
baseUrlWritten = await writeEnvValue(pending.file, pending.variable, created.key, baseUrlLine);
|
|
13018
13029
|
} catch (error) {
|
|
13019
13030
|
let revoked = true;
|
|
13020
13031
|
try {
|
|
@@ -13035,13 +13046,14 @@ var finishKey = async (ctx, pending, warned) => {
|
|
|
13035
13046
|
});
|
|
13036
13047
|
}
|
|
13037
13048
|
const file = displayPath(ctx.rt, pending.file);
|
|
13049
|
+
const written = baseUrlWritten ? `${pending.variable}, ${BASE_URL_VARIABLE}` : pending.variable;
|
|
13038
13050
|
const days = Math.round((Date.parse(created.expiresAt) - ctx.rt.now().getTime()) / DAY_MS);
|
|
13039
13051
|
const text = [
|
|
13040
13052
|
`${paint(ctx.out, "success", "Created")} API key "${stripControl(created.name)}".`,
|
|
13041
13053
|
` ID: ${created.id}`,
|
|
13042
13054
|
` Prefix: ${created.keyPrefix}`,
|
|
13043
13055
|
` Expires: ${created.expiresAt.slice(0, 10)} (${days} days)`,
|
|
13044
|
-
` Written: ${file} (${
|
|
13056
|
+
` Written: ${file} (${written})`,
|
|
13045
13057
|
`The key value was shown to nobody and this CLI keeps no copy; your code reads it from ${file}.`,
|
|
13046
13058
|
`To revoke it: ${paint(ctx.out, "emphasis", `deepdock keys revoke ${created.id}`)}`,
|
|
13047
13059
|
`${paint(ctx.out, "emphasis", "`deepdock auth logout`")} revokes this key; use ${paint(ctx.out, "emphasis", "`auth logout --keep-keys`")} to keep it.`
|
|
@@ -13055,7 +13067,14 @@ var finishKey = async (ctx, pending, warned) => {
|
|
|
13055
13067
|
createdAt: created.createdAt,
|
|
13056
13068
|
expiresAt: created.expiresAt
|
|
13057
13069
|
},
|
|
13058
|
-
meta: {
|
|
13070
|
+
meta: {
|
|
13071
|
+
requestId,
|
|
13072
|
+
written: {
|
|
13073
|
+
file,
|
|
13074
|
+
name: pending.variable,
|
|
13075
|
+
...baseUrlWritten ? { baseUrl: ctx.baseUrl } : {}
|
|
13076
|
+
}
|
|
13077
|
+
},
|
|
13059
13078
|
text
|
|
13060
13079
|
};
|
|
13061
13080
|
};
|
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -58,8 +58,8 @@ and what your code does with the result.
|
|
|
58
58
|
dashboard. The CLI receives the key once, writes `DEEPDOCK_API_KEY=<key>` into that file (it
|
|
59
59
|
must be ignored by git) and keeps no copy. It is displayed to you or to the human by nobody.
|
|
60
60
|
You work only with the key's id, prefix and the file name. Never ask for, read, print or paste
|
|
61
|
-
a key value. If the CLI runs with `DEEPDOCK_BASE_URL` set (a non-production API),
|
|
62
|
-
`DEEPDOCK_BASE_URL=<url>` line
|
|
61
|
+
a key value. If the CLI runs with `DEEPDOCK_BASE_URL` set (a non-production API), it writes the
|
|
62
|
+
same `DEEPDOCK_BASE_URL=<url>` line into that file too ([auth-and-keys.md](references/auth-and-keys.md)).
|
|
63
63
|
6. **Test it.** Run your own code against the demo device the human named, with the key from
|
|
64
64
|
`.env.local`, and read back with the read action. The CLI runs no action. Read
|
|
65
65
|
[references/testing.md](references/testing.md) before any write.
|
|
@@ -35,8 +35,9 @@ in the dashboard" and stop retrying.
|
|
|
35
35
|
dashboard's examples use). Never a literal in source, a test fixture, a log or a URL.
|
|
36
36
|
- One key per deployment is enough; there is no per-device key.
|
|
37
37
|
- A key works only against the API it was created on. The CLI uses production unless
|
|
38
|
-
`DEEPDOCK_BASE_URL` is set; when it is (`deepdock auth status --json` shows it as `baseUrl`),
|
|
39
|
-
the same `DEEPDOCK_BASE_URL=<url>` line next to the key
|
|
38
|
+
`DEEPDOCK_BASE_URL` is set; when it is (`deepdock auth status --json` shows it as `baseUrl`),
|
|
39
|
+
`keys create --write-env` writes the same `DEEPDOCK_BASE_URL=<url>` line next to the key, and a
|
|
40
|
+
production key points such a line at production. The bundled clients read it too.
|
|
40
41
|
- Getting a key into the app is the CLI's job: `deepdock keys create <name> --expires <d>
|
|
41
42
|
--write-env <file>` opens a link to the dashboard; a human clicks Approve (or Deny); the CLI
|
|
42
43
|
receives the key once and writes `DEEPDOCK_API_KEY=<key>` into the file, which must be ignored
|
|
@@ -95,7 +95,8 @@ Each pause opens an **incident** (`GET /v1/incidents`). Only Deepdock lifts a pa
|
|
|
95
95
|
customer's site see that an action is paused but cannot resume it; there is no partner call to
|
|
96
96
|
resume. A stopped or missing system needs no resume: its incident closes once the system is back.
|
|
97
97
|
|
|
98
|
-
An incident has `id`, `system`, `
|
|
98
|
+
An incident has `id`, `system`, `programVersion` (the version of the vendor's program its devices
|
|
99
|
+
run, `null` when they reported none), `action` (`null` for a system-level incident), `reason`,
|
|
99
100
|
`openedAt`, `closedAt`, and `devices` with `deviceId`, `pausedAt`, `resumedAt` and `inactiveAt`. It
|
|
100
101
|
closes once none of its devices is still paused. `GET /v1/incidents` lists incidents that are open
|
|
101
102
|
or closed within the last 30 days, newest first, at most 100.
|