@answerlayer/cli 0.2.5 → 0.2.7

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,15 +99,47 @@ 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:
105
119
 
106
120
  ```bash
107
121
  answerlayer pipelines revisions validate <pipeline-id> <revision-id> --wait --json
122
+ answerlayer pipelines revisions connection-test <pipeline-id> <revision-id> --wait --json
123
+ answerlayer pipelines revisions probe <pipeline-id> <revision-id> \
124
+ --request-limit 2 --row-limit 100 --byte-limit 1048576 \
125
+ --runtime-limit 60 --wait --json
108
126
  answerlayer pipelines revisions promote <pipeline-id> <revision-id> --json
109
127
  ```
110
128
 
129
+ Revision history is immutable and inspectable. Compare the candidate revision
130
+ against the current or previous revision before promotion:
131
+
132
+ ```bash
133
+ answerlayer pipelines revisions list <pipeline-id> --json
134
+ answerlayer pipelines revisions get <pipeline-id> <revision-id> --json
135
+ answerlayer pipelines revisions diff <pipeline-id> <candidate-revision-id> \
136
+ --against <base-revision-id> --json
137
+ ```
138
+
139
+ The diff contains artifact hashes and a secret-safe, JSON-pointer-addressed
140
+ configuration diff. Configuration descriptors are digest-verified before they
141
+ are returned.
142
+
111
143
  Run and operate the promoted revision:
112
144
 
113
145
  ```bash
@@ -118,6 +150,14 @@ answerlayer pipelines runs cancel <pipeline-id> <run-id> --json
118
150
  answerlayer pipelines archive <pipeline-id> --json
119
151
  ```
120
152
 
153
+ Roll back by selecting a revision that was previously promoted. This moves the
154
+ active pointer back to the existing immutable revision; it does not copy or
155
+ re-upload the package:
156
+
157
+ ```bash
158
+ answerlayer pipelines revisions rollback <pipeline-id> <revision-id> --json
159
+ ```
160
+
121
161
  Use `--include-archived` with `pipelines list`. Package ZIPs are built from the
122
162
  customer-owned package repository; credentials and CA material must not be
123
163
  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.7",
4
4
  "description": "Open-source command line client for the AnswerLayer API.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -180,9 +180,12 @@ 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, validate, connection-test, probe,
184
+ promote, enable, disable, and archive pipelines;
185
+ upload immutable packages; list, inspect, diff, validate, promote, and roll
186
+ back revisions; and run/retry/cancel exact revisions. Use `--wait --json` for
187
+ automation. Never put credentials or CA material in package configuration;
188
+ rollback selects a previously promoted revision instead of uploading a copy
186
189
  - `metadata`, `api-keys`, `users`, `org`, `billing`, `stats`
187
190
 
188
191
  ## Conventions
@@ -194,6 +197,9 @@ to see exact flags before using one:
194
197
  - **Read freely, but confirm before writes.** `create`, `update`, `delete`,
195
198
  `revoke`, `approve`, `deploy`, and `assign`/`unassign` change state — show the
196
199
  user what you're about to run and get a yes first.
200
+ - Pipeline `connection-test` and `probe` commands access live customer systems
201
+ and data. Show the exact revision and probe limits and get confirmation before
202
+ running either command, even though they cannot publish production tables.
197
203
  - If a command fails with a `403` / missing-scope error, the API key lacks a
198
204
  scope (e.g. `inquiry:execute`, `query:execute`, `connection:read`). Tell the
199
205
  user which scope to add to their key.
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,
@@ -262,9 +333,39 @@ async function handlePipelineRevisions(client, base, positionals, parsed, io) {
262
333
  pipelinePath,
263
334
  );
264
335
  }
336
+ if (action === "connection-test" || action === "test-connection") {
337
+ return requestWaitAndPrint(
338
+ client,
339
+ "POST",
340
+ `${revisionPath}/connection-test`,
341
+ parsed,
342
+ io,
343
+ pipelinePath,
344
+ );
345
+ }
346
+ if (action === "probe" || action === "dry-run") {
347
+ const body = {
348
+ request_limit: requiredBoundedFlag(parsed.flags.requestLimit, "request-limit", 1, 100),
349
+ row_limit: requiredBoundedFlag(parsed.flags.rowLimit, "row-limit", 1, 100000),
350
+ byte_limit: requiredBoundedFlag(parsed.flags.byteLimit, "byte-limit", 1024, 100 * 1024 * 1024),
351
+ runtime_limit_seconds: requiredBoundedFlag(parsed.flags.runtimeLimit, "runtime-limit", 1, 900),
352
+ };
353
+ return requestWaitAndPrint(
354
+ client,
355
+ "POST",
356
+ `${revisionPath}/probe`,
357
+ parsed,
358
+ io,
359
+ pipelinePath,
360
+ { body },
361
+ );
362
+ }
265
363
  if (action === "promote") {
266
364
  return requestAndPrint(client, "POST", `${revisionPath}/promote`, parsed, io);
267
365
  }
366
+ if (action === "rollback") {
367
+ return requestAndPrint(client, "POST", `${revisionPath}/rollback`, parsed, io);
368
+ }
268
369
 
269
370
  throw usage(`Unknown pipelines revisions command: ${action}`);
270
371
  }
@@ -1653,8 +1754,9 @@ async function requestWaitAndPrint(
1653
1754
  parsed,
1654
1755
  io,
1655
1756
  pipelinePath,
1757
+ options = {},
1656
1758
  ) {
1657
- let result = await client.rawRequest(method, pathName);
1759
+ let result = await client.rawRequest(method, pathName, { body: options.body });
1658
1760
  if (parsed.flags.wait) {
1659
1761
  result = await waitForPipelineRun(client, result, parsed.flags, io, pipelinePath);
1660
1762
  }
@@ -1811,12 +1913,14 @@ function normalizeFlagName(rawName) {
1811
1913
  "--name": "name",
1812
1914
  "--title": "title",
1813
1915
  "--description": "description",
1916
+ "--clear-description": "clearDescription",
1814
1917
  "--visibility": "visibility",
1815
1918
  "--connection": "connection",
1816
1919
  "--type": "type",
1817
1920
  "--db-type": "dbType",
1818
1921
  "--config": "config",
1819
1922
  "--config-file": "configFile",
1923
+ "--against": "against",
1820
1924
  "--package": "package",
1821
1925
  "--include-archived": "includeArchived",
1822
1926
  "--wait": "wait",
@@ -1933,7 +2037,7 @@ function normalizeFlagName(rawName) {
1933
2037
  }
1934
2038
 
1935
2039
  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);
2040
+ 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
2041
  }
1938
2042
 
1939
2043
  function setFlag(flags, name, value) {
@@ -1996,6 +2100,14 @@ function parseBoundedInteger(value, name, minimum, maximum) {
1996
2100
  return parsed;
1997
2101
  }
1998
2102
 
2103
+ function requiredBoundedFlag(value, name, minimum, maximum) {
2104
+ const first = firstValue(value);
2105
+ if (first === undefined || first === "") {
2106
+ throw usage(`pipelines revisions probe requires --${name}`);
2107
+ }
2108
+ return parseBoundedInteger(first, name, minimum, maximum);
2109
+ }
2110
+
1999
2111
  function requirePositional(positionals, index, label) {
2000
2112
  const value = positionals[index];
2001
2113
  if (!value) throw usage(`Missing ${label}`);
@@ -2113,8 +2225,8 @@ Usage:
2113
2225
 
2114
2226
  Core:
2115
2227
  answerlayer api-keys list|create|revoke
2116
- answerlayer pipelines list|create|archive
2117
- answerlayer pipelines revisions push|validate|promote <pipeline-id> [revision-id]
2228
+ answerlayer pipelines list|create|get|update|enable|disable|archive
2229
+ answerlayer pipelines revisions list|get|push|validate|connection-test|probe|promote|diff|rollback <pipeline-id> [revision-id]
2118
2230
  answerlayer pipelines runs start|get|retry|cancel <pipeline-id> [run-id]
2119
2231
  answerlayer connections supported|list|get|create|update|delete|schema|test
2120
2232
  answerlayer metadata structure|tables|columns|pii-summary|pii-settings|detect-pii
@@ -2184,10 +2296,16 @@ Pipeline options:
2184
2296
  --package <path> Package ZIP for pipelines revisions push.
2185
2297
  --config-file <path> Non-secret revision configuration JSON file.
2186
2298
  --config <json> Inline non-secret revision configuration.
2299
+ --against <id> Base revision for pipelines revisions diff.
2300
+ --clear-description Clear a pipeline description during update.
2187
2301
  --include-archived Include archived pipelines when listing.
2188
2302
  --wait Poll validation or execution to a terminal state.
2189
2303
  --wait-timeout <sec> Maximum wait time. Default: 600.
2190
2304
  --poll-interval <sec> Poll interval. Default: 2.
2305
+ --request-limit <n> Probe dataset/request ceiling (1-100; required).
2306
+ --row-limit <n> Probe row ceiling (1-100000; required).
2307
+ --byte-limit <n> Probe decoded-byte ceiling (1024-104857600; required).
2308
+ --runtime-limit <sec> Probe runtime ceiling (1-900; required).
2191
2309
 
2192
2310
  SQL options:
2193
2311
  --sql, -q <sql> SQL text.