@answerlayer/cli 0.2.5 → 0.2.6

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 CHANGED
@@ -99,6 +99,20 @@ answerlayer pipelines revisions push <pipeline-id> \
99
99
  --json
100
100
  ```
101
101
 
102
+ Inspect and update pipeline metadata, or explicitly pause and resume new
103
+ production executions without losing the active revision:
104
+
105
+ ```bash
106
+ answerlayer pipelines get <pipeline-id> --json
107
+ answerlayer pipelines update <pipeline-id> --description "National census" --json
108
+ answerlayer pipelines disable <pipeline-id> --json
109
+ answerlayer pipelines enable <pipeline-id> --json
110
+ ```
111
+
112
+ Use `--clear-description` to remove the description. Disabling a pipeline does
113
+ not prevent administrators from uploading and validating a replacement
114
+ revision; it prevents production execution until the pipeline is enabled.
115
+
102
116
  Validate and promote the returned revision ID. `--wait` polls the exact run to
103
117
  a terminal state and exits unsuccessfully when validation fails or is
104
118
  cancelled:
@@ -108,6 +122,20 @@ answerlayer pipelines revisions validate <pipeline-id> <revision-id> --wait --js
108
122
  answerlayer pipelines revisions promote <pipeline-id> <revision-id> --json
109
123
  ```
110
124
 
125
+ Revision history is immutable and inspectable. Compare the candidate revision
126
+ against the current or previous revision before promotion:
127
+
128
+ ```bash
129
+ answerlayer pipelines revisions list <pipeline-id> --json
130
+ answerlayer pipelines revisions get <pipeline-id> <revision-id> --json
131
+ answerlayer pipelines revisions diff <pipeline-id> <candidate-revision-id> \
132
+ --against <base-revision-id> --json
133
+ ```
134
+
135
+ The diff contains artifact hashes and a secret-safe, JSON-pointer-addressed
136
+ configuration diff. Configuration descriptors are digest-verified before they
137
+ are returned.
138
+
111
139
  Run and operate the promoted revision:
112
140
 
113
141
  ```bash
@@ -118,6 +146,14 @@ answerlayer pipelines runs cancel <pipeline-id> <run-id> --json
118
146
  answerlayer pipelines archive <pipeline-id> --json
119
147
  ```
120
148
 
149
+ Roll back by selecting a revision that was previously promoted. This moves the
150
+ active pointer back to the existing immutable revision; it does not copy or
151
+ re-upload the package:
152
+
153
+ ```bash
154
+ answerlayer pipelines revisions rollback <pipeline-id> <revision-id> --json
155
+ ```
156
+
121
157
  Use `--include-archived` with `pipelines list`. Package ZIPs are built from the
122
158
  customer-owned package repository; credentials and CA material must not be
123
159
  included in the ZIP or revision configuration. They remain in the install's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@answerlayer/cli",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Open-source command line client for the AnswerLayer API.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -180,9 +180,11 @@ to see exact flags before using one:
180
180
  - `dashboards`, `tiles` — build and read dashboards
181
181
  - `documents` — upload business-context docs and link them to connections
182
182
  - `connections` — create / test / inspect schema
183
- - `pipelines` — upload immutable package revisions, validate and promote them,
184
- run/retry/cancel exact revisions, inspect runs, and archive pipelines; use
185
- `--wait --json` for automation and never put credentials in package config
183
+ - `pipelines` — create, inspect, update, enable, disable, and archive pipelines;
184
+ upload immutable packages; list, inspect, diff, validate, promote, and roll
185
+ back revisions; and run/retry/cancel exact revisions. Use `--wait --json` for
186
+ automation. Never put credentials or CA material in package configuration;
187
+ rollback selects a previously promoted revision instead of uploading a copy
186
188
  - `metadata`, `api-keys`, `users`, `org`, `billing`, `stats`
187
189
 
188
190
  ## Conventions
package/src/cli.js CHANGED
@@ -211,6 +211,55 @@ async function handlePipelines(client, command, positionals, parsed, io) {
211
211
  return requestAndPrint(client, "POST", base, parsed, io, { body: payload });
212
212
  }
213
213
 
214
+ if (command === "get") {
215
+ const pipelineId = requirePositional(positionals, 0, "pipeline id");
216
+ return requestAndPrint(
217
+ client,
218
+ "GET",
219
+ `${base}/${encodeURIComponent(pipelineId)}`,
220
+ parsed,
221
+ io,
222
+ );
223
+ }
224
+
225
+ if (command === "update") {
226
+ const pipelineId = requirePositional(positionals, 0, "pipeline id");
227
+ if (parsed.flags.clearDescription && parsed.flags.description !== undefined) {
228
+ throw usage("pipelines update accepts either --description or --clear-description, not both");
229
+ }
230
+ const payload = await readData(parsed.flags, io, {
231
+ name: firstValue(parsed.flags.name),
232
+ description: parsed.flags.clearDescription
233
+ ? null
234
+ : firstValue(parsed.flags.description),
235
+ });
236
+ if (parsed.flags.clearDescription && payload.description !== null) {
237
+ throw usage("pipelines update cannot combine --clear-description with input data containing description");
238
+ }
239
+ if (Object.keys(payload).length === 0) {
240
+ throw usage("pipelines update requires --name, --description, --clear-description, or --data");
241
+ }
242
+ return requestAndPrint(
243
+ client,
244
+ "PATCH",
245
+ `${base}/${encodeURIComponent(pipelineId)}`,
246
+ parsed,
247
+ io,
248
+ { body: payload },
249
+ );
250
+ }
251
+
252
+ if (command === "enable" || command === "disable") {
253
+ const pipelineId = requirePositional(positionals, 0, "pipeline id");
254
+ return requestAndPrint(
255
+ client,
256
+ "POST",
257
+ `${base}/${encodeURIComponent(pipelineId)}/${command}`,
258
+ parsed,
259
+ io,
260
+ );
261
+ }
262
+
214
263
  if (command === "archive") {
215
264
  const pipelineId = requirePositional(positionals, 0, "pipeline id");
216
265
  return requestAndPrint(
@@ -238,6 +287,18 @@ async function handlePipelineRevisions(client, base, positionals, parsed, io) {
238
287
  const pipelineId = requirePositional(positionals, 1, "pipeline id");
239
288
  const pipelinePath = `${base}/${encodeURIComponent(pipelineId)}`;
240
289
 
290
+ if (action === "list") {
291
+ return requestAndPrint(client, "GET", `${pipelinePath}/revisions`, parsed, io, {
292
+ table: [
293
+ { key: "id", label: "ID" },
294
+ { key: "revision_number", label: "Revision" },
295
+ { key: "status", label: "Status" },
296
+ { key: "artifact_sha256", label: "Artifact SHA-256" },
297
+ { key: "created_at", label: "Created" },
298
+ ],
299
+ });
300
+ }
301
+
241
302
  if (action === "push" || action === "upload") {
242
303
  const packagePath = firstValue(parsed.flags.package)
243
304
  || requirePositional(positionals, 2, "pipeline package ZIP");
@@ -252,6 +313,16 @@ async function handlePipelineRevisions(client, base, positionals, parsed, io) {
252
313
 
253
314
  const revisionId = requirePositional(positionals, 2, "pipeline revision id");
254
315
  const revisionPath = `${pipelinePath}/revisions/${encodeURIComponent(revisionId)}`;
316
+ if (action === "get") {
317
+ return requestAndPrint(client, "GET", revisionPath, parsed, io);
318
+ }
319
+ if (action === "diff") {
320
+ const against = firstValue(parsed.flags.against);
321
+ if (!against) throw usage("pipelines revisions diff requires --against <revision-id>");
322
+ return requestAndPrint(client, "GET", `${revisionPath}/diff`, parsed, io, {
323
+ query: { against },
324
+ });
325
+ }
255
326
  if (action === "validate") {
256
327
  return requestWaitAndPrint(
257
328
  client,
@@ -265,6 +336,9 @@ async function handlePipelineRevisions(client, base, positionals, parsed, io) {
265
336
  if (action === "promote") {
266
337
  return requestAndPrint(client, "POST", `${revisionPath}/promote`, parsed, io);
267
338
  }
339
+ if (action === "rollback") {
340
+ return requestAndPrint(client, "POST", `${revisionPath}/rollback`, parsed, io);
341
+ }
268
342
 
269
343
  throw usage(`Unknown pipelines revisions command: ${action}`);
270
344
  }
@@ -1811,12 +1885,14 @@ function normalizeFlagName(rawName) {
1811
1885
  "--name": "name",
1812
1886
  "--title": "title",
1813
1887
  "--description": "description",
1888
+ "--clear-description": "clearDescription",
1814
1889
  "--visibility": "visibility",
1815
1890
  "--connection": "connection",
1816
1891
  "--type": "type",
1817
1892
  "--db-type": "dbType",
1818
1893
  "--config": "config",
1819
1894
  "--config-file": "configFile",
1895
+ "--against": "against",
1820
1896
  "--package": "package",
1821
1897
  "--include-archived": "includeArchived",
1822
1898
  "--wait": "wait",
@@ -1933,7 +2009,7 @@ function normalizeFlagName(rawName) {
1933
2009
  }
1934
2010
 
1935
2011
  function isBooleanFlag(rawName) {
1936
- return ["--json", "--help", "-h", "--include", "-i", "--raw", "--admin", "--force", "--follow", "--active", "--inactive", "--include-inactive", "--include-semantic-snapshot", "--include-archived", "--use-semantic-layer", "--no-semantic-layer", "--no-demo", "--yes", "-y", "--wait"].includes(rawName);
2012
+ return ["--json", "--help", "-h", "--include", "-i", "--raw", "--admin", "--force", "--follow", "--active", "--inactive", "--include-inactive", "--include-semantic-snapshot", "--include-archived", "--clear-description", "--use-semantic-layer", "--no-semantic-layer", "--no-demo", "--yes", "-y", "--wait"].includes(rawName);
1937
2013
  }
1938
2014
 
1939
2015
  function setFlag(flags, name, value) {
@@ -2113,8 +2189,8 @@ Usage:
2113
2189
 
2114
2190
  Core:
2115
2191
  answerlayer api-keys list|create|revoke
2116
- answerlayer pipelines list|create|archive
2117
- answerlayer pipelines revisions push|validate|promote <pipeline-id> [revision-id]
2192
+ answerlayer pipelines list|create|get|update|enable|disable|archive
2193
+ answerlayer pipelines revisions list|get|push|validate|promote|diff|rollback <pipeline-id> [revision-id]
2118
2194
  answerlayer pipelines runs start|get|retry|cancel <pipeline-id> [run-id]
2119
2195
  answerlayer connections supported|list|get|create|update|delete|schema|test
2120
2196
  answerlayer metadata structure|tables|columns|pii-summary|pii-settings|detect-pii
@@ -2184,6 +2260,8 @@ Pipeline options:
2184
2260
  --package <path> Package ZIP for pipelines revisions push.
2185
2261
  --config-file <path> Non-secret revision configuration JSON file.
2186
2262
  --config <json> Inline non-secret revision configuration.
2263
+ --against <id> Base revision for pipelines revisions diff.
2264
+ --clear-description Clear a pipeline description during update.
2187
2265
  --include-archived Include archived pipelines when listing.
2188
2266
  --wait Poll validation or execution to a terminal state.
2189
2267
  --wait-timeout <sec> Maximum wait time. Default: 600.