@agency-tbd/cli 0.4.0 → 0.5.0
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/README.md +48 -2
- package/dist/agent.js +2 -0
- package/dist/catalog.js +1 -0
- package/dist/help.js +6 -2
- package/dist/main.js +1 -1
- package/dist/support-conversation.js +46 -12
- package/dist/support.js +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ influmode support list
|
|
|
77
77
|
|
|
78
78
|
The draft adds only CLI version, Node.js version, OS identifier and CPU architecture. The server associates the report with your authenticated account and tenant IDs. **No files, logs, environment variables, tokens or cookies are collected automatically.** Remove credentials and unnecessary personal/customer data from the text yourself. Recognizable credentials and extra diagnostics are rejected; this check cannot detect every possible secret. The draft contains your report text: keep it private, and delete it when you no longer need its recovery key. POSIX files are created with mode 0600; on Windows, use a directory private to your OS account.
|
|
79
79
|
|
|
80
|
-
Submission returns `receipt.reference`, `receipt.submitted`, `receipt.state` and recovery instructions. Only `submitted:true` confirms that GitHub accepted an issue. Unconfirmed or failed submission returns `ok:false` and a nonzero exit status while preserving the receipt. `pending` is uncertain delivery; keep the original draft and check status. `failed` means screenshot storage failed before contacting GitHub or GitHub definitively rejected the send; the receipt explains what to do. A closed issue indicates closure, not necessarily that a fix was released or a request accepted. `status` retains its delivery/open/closed compatibility contract. CLI 0.4.0 adds `get`, chronological `history`, paginated `list`, replies, explicit read receipts and incremental changes. Only your reports, your own replies and explicitly published team replies are visible; internal staff notes, repository URLs, code and other accounts stay private.
|
|
80
|
+
Submission returns `receipt.shortReference` (for example `INF-123`), the original UUID `receipt.reference`, `receipt.priority` (nullable), `receipt.submitted`, `receipt.state` and recovery instructions. Only `submitted:true` confirms that GitHub accepted an issue. Unconfirmed or failed submission returns `ok:false` and a nonzero exit status while preserving the receipt. `pending` is uncertain delivery; keep the original draft and check status. `failed` means screenshot storage failed before contacting GitHub or GitHub definitively rejected the send; the receipt explains what to do. A closed issue indicates closure, not necessarily that a fix was released or a request accepted. `status` retains its delivery/open/closed compatibility contract. CLI 0.4.0 adds `get`, chronological `history`, paginated `list`, replies, explicit read receipts and incremental changes. Only your reports, your own replies and explicitly published team replies are visible; internal staff notes, repository URLs, code and other accounts stay private.
|
|
81
81
|
|
|
82
82
|
After any interrupted send, use `support status --input @support-draft.json`. A missing receipt means no reservation exists yet; retry only the **exact same saved draft**, after correcting any reported login/configuration/input issue. Concurrent or repeated submissions of the same draft create at most one issue; changed content under the same request ID is a conflict. Never create a new draft to retry an uncertain send. If delivery remains pending, give the support reference to your InfluMode administrator for reconciliation. The CLI never automatically repeats an issue creation.
|
|
83
83
|
|
|
@@ -173,7 +173,7 @@ For repository development, install dependencies with `pnpm install --frozen-loc
|
|
|
173
173
|
|
|
174
174
|
Before publishing, run `pnpm --filter @agency-tbd/cli release:check` on a supported Node.js release. It runs type checks, CLI tests, catalog validation and an isolated npm installation of the actual packed archive. Package contents are limited to compiled JavaScript, the README and package metadata; repository source, tests, source maps and local configuration are excluded. `pnpm pack` replaces workspace catalog references with installable dependency versions.
|
|
175
175
|
|
|
176
|
-
Publish reviewed, merged releases with the manually dispatched [Publish CLI workflow](../../.github/workflows/publish-cli.yml). Select `main` and supply the full reviewed commit SHA, the CLI version and confirmation that required backend migrations/deployment have been verified. The workflow requires passing main CI for that exact source, repeats package qualification, and publishes the same archived bytes using npm's short-lived GitHub identity. A separate job with no publishing permission verifies registry integrity, the `latest` tag and an anonymous installation. Only readback requests may be retried
|
|
176
|
+
Publish reviewed, merged releases with the manually dispatched [Publish CLI workflow](../../.github/workflows/publish-cli.yml). Select `main` and supply the full reviewed commit SHA, the CLI version and confirmation that required backend migrations/deployment have been verified. The workflow requires passing main CI for that exact source, repeats package qualification, and publishes the same archived bytes using npm's short-lived GitHub identity. A separate job with no publishing permission verifies registry integrity, the `latest` tag and an anonymous installation. Readback waits up to ten minutes for the version, latest tag and npm installation metadata to agree, then installs with a fresh anonymous cache. Only readback requests may be retried; the publish command is never retried automatically. It has no npm token and requires no per-release security-key challenge. A failed or timed-out publication must be reconciled against the registry before another dispatch; an existing version is rejected rather than republished.
|
|
177
177
|
|
|
178
178
|
One-time setup by a package maintainer:
|
|
179
179
|
|
|
@@ -243,3 +243,49 @@ influmode support operation --input @read-draft.json
|
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
Use the observed `revision` as `through` after reviewing the desired history; do not guess it. `read` advances the read position monotonically and returns `acknowledgedThrough`; later arrivals remain unread. `changes` uses a per-request import cursor, while `history` sorts by authorship date. They are different cursors. Only `relevant:true` events (team replies and issue state changes) should trigger an alert; the reporter's own replies and read receipts do not. Incremental queries do not install monitoring. Background notices require a separately configured and authorized scheduler and the user's chosen channel/preferences. CLI use alone never promises background follow-up.
|
|
246
|
+
|
|
247
|
+
## Short references and requester priority
|
|
248
|
+
|
|
249
|
+
CLI **0.5.0** requires the matching backend and support reference/priority migration.
|
|
250
|
+
Receipts, status, detail and list include a permanent `shortReference` such as
|
|
251
|
+
`INF-123` alongside the original UUID and title. Existing reports gain a number
|
|
252
|
+
without changing identity/history. Status/get/history/changes/reply/read/priority
|
|
253
|
+
and list reference filters accept either format; existing UUID drafts still work.
|
|
254
|
+
Numbers are global, but every query remains private to the authenticated tenant
|
|
255
|
+
**and reporter**. Neither reference reveals the private repository issue number.
|
|
256
|
+
|
|
257
|
+
`support info` advertises `short-references`, `requester-priority`, allowed priorities
|
|
258
|
+
and their authority. Priority is **requester-indicated impact**, not internal team
|
|
259
|
+
triage or a response/resolution SLA. Values are `low`, `normal`, `high`, `urgent`,
|
|
260
|
+
or `null` (undefined); old reports stay undefined. The report JSON may optionally
|
|
261
|
+
include priority. Never infer urgency from text or change it without authorization.
|
|
262
|
+
|
|
263
|
+
Read `support info` and `support get INF-123` first. Use the observed value as
|
|
264
|
+
`expectedPriority`; concurrent edits return a conflict rather than overwriting it:
|
|
265
|
+
|
|
266
|
+
```sh
|
|
267
|
+
influmode support draft-priority INF-123 --input '{"expectedPriority":null,"priority":"high","reason":"Approved workflow impact"}' --output priority-draft.json
|
|
268
|
+
influmode support preview --input @priority-draft.json
|
|
269
|
+
# Show the exact change and obtain approval first.
|
|
270
|
+
influmode support priority --input @priority-draft.json --confirm
|
|
271
|
+
influmode support get INF-123
|
|
272
|
+
influmode support history INF-123
|
|
273
|
+
# Recover an uncertain response using the same file/requestId.
|
|
274
|
+
influmode support operation --input @priority-draft.json
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Changes preserve the report and record previous/new values, author, date and optional
|
|
278
|
+
reason atomically. Only the same reporter with support permission can edit this
|
|
279
|
+
field; it cannot impose internal team priority. Replaying the same saved operation
|
|
280
|
+
returns its receipt without duplicating history. No GitHub comment or label changes.
|
|
281
|
+
|
|
282
|
+
```sh
|
|
283
|
+
influmode support list --input '{"priority":"high","order":"priority","limit":25}'
|
|
284
|
+
influmode support list --input '{"priority":null,"limit":25}'
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Priority order is urgent/high/normal/low/undefined; ties use updated time descending,
|
|
288
|
+
then UUID descending. Activity remains the default order. Follow `nextCursor` with
|
|
289
|
+
the same filters/order; restart when those change. Pagination is over a changing
|
|
290
|
+
list, so restart for a current inventory if reports change while paging. Deploy the
|
|
291
|
+
backend/migration before publishing the CLI; publishing is a separate action.
|
package/dist/agent.js
CHANGED
|
@@ -41,6 +41,8 @@ export const agentGuide = {
|
|
|
41
41
|
reply: "support draft-reply <reference> --input @reply.json --output reply-draft.json; preview, show destination/text, obtain approval, then support reply --input @reply-draft.json --confirm",
|
|
42
42
|
resolution: "kind:resolved confirms verification; kind:persists requests review/reopening without applying administrative reopening. get shows communicated outcome/releaseVersion, never infers delivered from closed.",
|
|
43
43
|
changes: "support changes <reference> --input with after/limit or since; persist nextCursor with the same reference/account and exhaust hasMore. Notify only for relevant:true events.",
|
|
44
|
+
references: "Use receipt.shortReference (INF-N) and title in confirmations. UUID remains valid. Every operation accepts INF-N; scope remains the current tenant and reporter.",
|
|
45
|
+
priority: "Read support info and get first. Priority is requester-indicated impact only, never team triage/SLA. Do not infer urgency. With explicit authorization, prepare draft-priority with expectedPriority, priority and optional reason; preview and confirm, recover via operation using the same saved draft. Null is undefined; old reports stay undefined. List accepts priority and order:priority.",
|
|
44
46
|
read: "Reads do not acknowledge. Prepare support draft-read with through:observedRevision, then support read --confirm. Receipt acknowledgedThrough is idempotent; later updates remain unread.",
|
|
45
47
|
operationRecovery: "support operation --input @original-reply-or-read-draft.json; reuse exact requestId/payload only",
|
|
46
48
|
notification: "Incremental queries are active reads. Background alerts need separately configured and authorized scheduling, channel and user preferences. Do not promise background monitoring.",
|
package/dist/catalog.js
CHANGED
package/dist/help.js
CHANGED
|
@@ -14,15 +14,19 @@ influmode support preview --input @reply-draft.json
|
|
|
14
14
|
influmode support reply --input @reply-draft.json --confirm [--dry-run]
|
|
15
15
|
influmode support draft-read <reference> --input '{"through":25}' --output read-draft.json
|
|
16
16
|
influmode support read --input @read-draft.json --confirm
|
|
17
|
+
influmode support draft-priority INF-123 --input '{"expectedPriority":null,"priority":"high","reason":"Blocked workflow"}' --output priority-draft.json
|
|
18
|
+
influmode support priority --input @priority-draft.json --confirm [--dry-run]
|
|
17
19
|
influmode support operation --input @reply-draft.json
|
|
18
20
|
Reply JSON: {"text":"Your exact reply","kind":"reply|resolved|persists"}.
|
|
19
|
-
|
|
21
|
+
References accept INF-N or the original UUID for status/get/history/changes/reply/read/priority/list. shortReference is stable globally; access remains restricted to your authenticated tenant and reporter. Older drafts and UUIDs remain valid.
|
|
22
|
+
Priority is optional requester-indicated impact: low, normal, high, urgent or null (undefined). Old requests stay undefined. Read support info for allowed options and support get for the current value before preparing a change; expectedPriority prevents overwriting another change. Never infer urgency or change it without authorization. This does not change internal triage or promise a deadline/SLA. History records previous/new priority, reason, author and date; recover uncertain changes with the exact saved requestId.
|
|
23
|
+
List filters: cursor, reference, search, category, state, priority (including null), order (activity|priority), limit. Priority order is urgent/high/normal/low/undefined, ties by activity descending then UUID descending. Cursors belong to the same filters/order; restart when those change. Follow nextCursor until null.
|
|
20
24
|
History is chronological; pass its nextCursor as cursor. Changes are incremental in import order; persist nextCursor as after with the same reference/account. since accepts an ISO date. hasMore means another page remains.
|
|
21
25
|
Only explicitly published team responses appear; internal GitHub discussion stays private. Reading never clears unread updates. Explicit read acknowledges through the observed revision; its receipt includes acknowledgedThrough. operation recovers either a reply or read receipt by the saved requestId. After a timeout retain and reconcile the same draft; no automatic mutation retries.
|
|
22
26
|
resolved confirms the requester verified the result; persists asks the team to review/reopen. Neither changes administrative issue state. Closure alone does not prove a fix; get shows only communicated progress, reason, outcome, resolution, nextStep and releaseVersion.
|
|
23
27
|
Changes is a bounded incremental query, not background monitoring. Notify only when returned events have relevant:true. Background notices need a separately configured, authorized schedule and user-chosen channel/preferences.
|
|
24
28
|
Conversation commands require backend conversationVersion:1 (matching migration/deployment). No repository access is needed.
|
|
25
|
-
Report JSON: {"category":"bug|compatibility|feature|question","title":"Short summary","description":"Steps, expected and actual behavior; at least 20 characters"}.
|
|
29
|
+
Report JSON accepts optional priority (low|normal|high|urgent|null): {"category":"bug|compatibility|feature|question","title":"Short summary","description":"Steps, expected and actual behavior; at least 20 characters"}.
|
|
26
30
|
Draft/preview are offline. Draft adds only CLI/Node/OS/architecture diagnostics and saves a private file. Review the exact report and destination, remove secrets/private customer data, obtain approval, then submit. Login uses your InfluMode account; no GitHub account or repository access is needed. Keep the same draft/requestId for recovery: an uncertain send must never be repeated with a new draft. Status and list show only your reports; private repository links, code and internal staff notes stay private. Repeat --attach for up to 5 PNG/JPEG/WebP screenshots (4 MiB each, 10 MiB total). Draft snapshots the exact bytes offline; preview shows names, sizes and SHA-256 hashes, never image bytes. Only confirmed submit uploads them. Screenshots stay private; the team must sign in to the reporting tenant to open them. No other files, logs or environment variables are automatically attached. Run help support <operation> for live API schemas; use call support <operation> for generic API access.`,
|
|
27
31
|
auth: "influmode auth login --url <HTTPS_ORIGIN> [--no-browser]\ninflumode auth status\ninflumode auth logout\nBrowser approval is required for login. Status confirms identity, not effective operation permissions. Logout revokes the session.\nFor the auth API group, inspect help auth <operation> and execute with call auth <operation>.",
|
|
28
32
|
resources: "influmode resources [--search text]\nOffline API group and HTTP route inventory. HTTP routes can require browser, provider or internal-service credentials; listing is not execution permission.",
|
package/dist/main.js
CHANGED
|
@@ -49,7 +49,7 @@ async function offlineCommand(parsed) {
|
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
51
|
if (command === "support" &&
|
|
52
|
-
["draft", "draft-reply", "draft-read", "preview"].includes(subcommand ?? ""))
|
|
52
|
+
["draft", "draft-reply", "draft-read", "draft-priority", "preview"].includes(subcommand ?? ""))
|
|
53
53
|
return { handled: true, result: await offlineSupport(parsed) };
|
|
54
54
|
return { handled: false };
|
|
55
55
|
}
|
|
@@ -6,21 +6,48 @@ import { saveOutput } from "./output.js";
|
|
|
6
6
|
import { snapshotAttachments, validateAttachments, attachmentPreview, } from "./support-attachments.js";
|
|
7
7
|
import { rpc } from "./transport.js";
|
|
8
8
|
const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
9
|
+
function reference(value) {
|
|
10
|
+
return (uuid.test(value) ||
|
|
11
|
+
(/^INF-[1-9][0-9]{0,9}$/.test(value) && Number(value.slice(4)) <= 2147483647));
|
|
12
|
+
}
|
|
13
|
+
function priority(value) {
|
|
14
|
+
return (value === null ||
|
|
15
|
+
(typeof value === "string" && ["low", "normal", "high", "urgent"].includes(value)));
|
|
16
|
+
}
|
|
9
17
|
function object(value) {
|
|
10
18
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
11
19
|
}
|
|
12
20
|
function invalid() {
|
|
13
|
-
throw new CliError("SUPPORT_INPUT", 'Use support draft-reply <reference> --input with {"text":"Approved reply","kind":"reply|resolved|persists"}, or draft-read <reference> --input with {"through":25}. Save with --output and keep the same draft for recovery.', 2);
|
|
21
|
+
throw new CliError("SUPPORT_INPUT", 'Use support draft-reply <reference> --input with {"text":"Approved reply","kind":"reply|resolved|persists"}, or draft-read <reference> --input with {"through":25}. For priority, use draft-priority <reference> with {"expectedPriority":null,"priority":"high","reason":"Approved impact"}. Read support info and get first. Save with --output and keep the same draft for recovery.', 2);
|
|
22
|
+
}
|
|
23
|
+
function priorityDraft(raw, base) {
|
|
24
|
+
if (!priority(raw["priority"]) ||
|
|
25
|
+
!priority(raw["expectedPriority"]) ||
|
|
26
|
+
raw["attachments"] !== undefined ||
|
|
27
|
+
(raw["reason"] !== undefined &&
|
|
28
|
+
(typeof raw["reason"] !== "string" ||
|
|
29
|
+
!raw["reason"].trim() ||
|
|
30
|
+
raw["reason"].trim().length > 2000)))
|
|
31
|
+
return invalid();
|
|
32
|
+
return {
|
|
33
|
+
operation: "priority",
|
|
34
|
+
...base,
|
|
35
|
+
priority: raw["priority"],
|
|
36
|
+
expectedPriority: raw["expectedPriority"],
|
|
37
|
+
...(typeof raw["reason"] === "string" ? { reason: raw["reason"].trim() } : {}),
|
|
38
|
+
};
|
|
14
39
|
}
|
|
15
40
|
function conversationDraft(raw) {
|
|
16
41
|
if (!object(raw) ||
|
|
17
|
-
!["reply", "read"].includes(String(raw["operation"])) ||
|
|
42
|
+
!["reply", "read", "priority"].includes(String(raw["operation"])) ||
|
|
18
43
|
typeof raw["requestId"] !== "string" ||
|
|
19
44
|
!uuid.test(raw["requestId"]) ||
|
|
20
45
|
typeof raw["reference"] !== "string" ||
|
|
21
|
-
!
|
|
46
|
+
!reference(raw["reference"]))
|
|
22
47
|
return invalid();
|
|
23
48
|
const base = { requestId: raw["requestId"], reference: raw["reference"] };
|
|
49
|
+
if (raw["operation"] === "priority")
|
|
50
|
+
return priorityDraft(raw, base);
|
|
24
51
|
if (raw["operation"] === "read") {
|
|
25
52
|
if (!Number.isSafeInteger(raw["through"]) ||
|
|
26
53
|
Number(raw["through"]) < 0 ||
|
|
@@ -57,21 +84,21 @@ export function conversationPreview(raw) {
|
|
|
57
84
|
};
|
|
58
85
|
}
|
|
59
86
|
export async function offlineConversation({ values, positionals }) {
|
|
60
|
-
const [, action,
|
|
87
|
+
const [, action, target] = positionals;
|
|
61
88
|
const raw = await readJson(values.input);
|
|
62
89
|
if (action === "preview" && object(raw) && raw["operation"] !== undefined)
|
|
63
90
|
return conversationPreview(raw);
|
|
64
|
-
if (!["draft-reply", "draft-read"].includes(action ?? ""))
|
|
91
|
+
if (!["draft-reply", "draft-read", "draft-priority"].includes(action ?? ""))
|
|
65
92
|
return undefined;
|
|
66
|
-
if (!
|
|
93
|
+
if (!target || !reference(target) || !object(raw) || !values.output)
|
|
67
94
|
return invalid();
|
|
68
95
|
if (values.attach?.length && action !== "draft-reply")
|
|
69
96
|
return invalid();
|
|
70
97
|
const value = conversationDraft({
|
|
71
98
|
...raw,
|
|
72
|
-
reference,
|
|
99
|
+
reference: target,
|
|
73
100
|
requestId: randomUUID(),
|
|
74
|
-
operation: action === "draft-reply" ? "reply" : "read",
|
|
101
|
+
operation: action === "draft-reply" ? "reply" : action === "draft-priority" ? "priority" : "read",
|
|
75
102
|
...(values.attach?.length ? { attachments: await snapshotAttachments(values.attach) } : {}),
|
|
76
103
|
});
|
|
77
104
|
const saved = await saveOutput(values.output, () => Promise.resolve(value));
|
|
@@ -83,19 +110,26 @@ async function compatible(connection) {
|
|
|
83
110
|
throw new CliError("SUPPORT_BACKEND_INCOMPATIBLE", "This backend does not support support conversations. Ask the team to deploy the matching backend/migration. No operation was sent.", 5);
|
|
84
111
|
}
|
|
85
112
|
export async function conversationCommand(connection, { values, positionals }) {
|
|
86
|
-
const [, action,
|
|
87
|
-
if (!["get", "history", "changes", "list", "reply", "read", "operation"].includes(action ?? ""))
|
|
113
|
+
const [, action, target] = positionals;
|
|
114
|
+
if (!["get", "history", "changes", "list", "reply", "read", "priority", "operation"].includes(action ?? ""))
|
|
88
115
|
return { handled: false };
|
|
89
116
|
if (values.attach?.length)
|
|
90
117
|
return invalid();
|
|
91
118
|
const raw = await readJson(values.input);
|
|
92
|
-
if (action === "reply" || action === "read") {
|
|
119
|
+
if (action === "reply" || action === "read" || action === "priority") {
|
|
93
120
|
const draft = conversationDraft(raw);
|
|
94
121
|
if (draft.operation !== action)
|
|
95
122
|
return invalid();
|
|
96
123
|
if (!values.confirm && !values["dry-run"])
|
|
97
124
|
throw new CliError("SUPPORT_CONFIRM_REQUIRED", "Show the saved operation, destination and attachment preview; obtain approval, then pass --confirm.", 2);
|
|
98
125
|
await compatible(connection);
|
|
126
|
+
if (action === "priority") {
|
|
127
|
+
const info = await rpc(connection, "support", ["info"], {}, "GET");
|
|
128
|
+
if (!object(info) ||
|
|
129
|
+
!Array.isArray(info["features"]) ||
|
|
130
|
+
!info["features"].includes("requester-priority"))
|
|
131
|
+
throw new CliError("SUPPORT_BACKEND_INCOMPATIBLE", "Deploy the matching priority backend and migration first. No change was sent.", 5);
|
|
132
|
+
}
|
|
99
133
|
const { operation: _operation, ...input } = draft;
|
|
100
134
|
if (values["dry-run"]) {
|
|
101
135
|
const textInput = "attachments" in input ? { ...input, attachments: undefined } : input;
|
|
@@ -132,7 +166,7 @@ export async function conversationCommand(connection, { values, positionals }) {
|
|
|
132
166
|
? { requestId: conversationDraft(raw).requestId }
|
|
133
167
|
: action === "list"
|
|
134
168
|
? (raw ?? {})
|
|
135
|
-
: { ...(object(raw) ? raw : {}), reference };
|
|
169
|
+
: { ...(object(raw) ? raw : {}), reference: target };
|
|
136
170
|
return { handled: true, result: await rpc(connection, "support", [action], input, "GET") };
|
|
137
171
|
}
|
|
138
172
|
//# sourceMappingURL=support-conversation.js.map
|
package/dist/support.js
CHANGED
|
@@ -7,11 +7,17 @@ import { snapshotAttachments, validateAttachments, attachmentPreview, } from "./
|
|
|
7
7
|
import { conversationCommand, conversationPreview, offlineConversation, } from "./support-conversation.js";
|
|
8
8
|
import { rpc } from "./transport.js";
|
|
9
9
|
import { cliVersion } from "./version.js";
|
|
10
|
+
const priorities = new Set(["low", "normal", "high", "urgent"]);
|
|
10
11
|
const categories = new Set(["bug", "compatibility", "feature", "question"]);
|
|
11
12
|
const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
12
13
|
function object(value) {
|
|
13
14
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
14
15
|
}
|
|
16
|
+
function priority(value) {
|
|
17
|
+
if (value === null || (typeof value === "string" && priorities.has(value)))
|
|
18
|
+
return value;
|
|
19
|
+
throw new CliError("SUPPORT_INPUT", "Priority must be low, normal, high, urgent or null (undefined). Read support info; never infer urgency from text.", 2);
|
|
20
|
+
}
|
|
15
21
|
function report(value) {
|
|
16
22
|
if (!object(value) ||
|
|
17
23
|
typeof value["category"] !== "string" ||
|
|
@@ -25,6 +31,7 @@ function report(value) {
|
|
|
25
31
|
value["description"].trim().length > 12000)
|
|
26
32
|
throw new CliError("SUPPORT_INPUT", 'Use --input with {"category":"bug|compatibility|feature|question","title":"Short summary","description":"Steps, expected and actual behavior; at least 20 characters"}. Remove passwords, tokens, cookies and private customer data.', 2);
|
|
27
33
|
return {
|
|
34
|
+
...(value["priority"] === undefined ? {} : { priority: priority(value["priority"]) }),
|
|
28
35
|
category: value["category"],
|
|
29
36
|
title: value["title"].trim(),
|
|
30
37
|
description: value["description"].trim(),
|
|
@@ -57,7 +64,7 @@ function preview(value) {
|
|
|
57
64
|
/** Draft and preview are offline and never need login or network access. */
|
|
58
65
|
export async function offlineSupport({ values, positionals }) {
|
|
59
66
|
const action = positionals[1];
|
|
60
|
-
if (["draft-reply", "draft-read"].includes(action ?? "")) {
|
|
67
|
+
if (["draft-reply", "draft-read", "draft-priority"].includes(action ?? "")) {
|
|
61
68
|
const result = await offlineConversation({ values, positionals });
|
|
62
69
|
if (result !== undefined)
|
|
63
70
|
return result;
|
package/package.json
CHANGED