@answerlayer/cli 0.2.7 → 0.3.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 +33 -1
- package/package.json +1 -1
- package/skills/answerlayer/SKILL.md +3 -1
- package/src/cli.js +68 -1
package/README.md
CHANGED
|
@@ -144,12 +144,44 @@ Run and operate the promoted revision:
|
|
|
144
144
|
|
|
145
145
|
```bash
|
|
146
146
|
answerlayer pipelines runs start <pipeline-id> --wait --json
|
|
147
|
+
answerlayer pipelines runs start <pipeline-id> \
|
|
148
|
+
--dataset agep --dataset agepxbplp \
|
|
149
|
+
--idempotency-key census-2021-backfill --wait --json
|
|
147
150
|
answerlayer pipelines runs get <pipeline-id> <run-id> --json
|
|
148
|
-
answerlayer pipelines runs retry <pipeline-id> <run-id>
|
|
151
|
+
answerlayer pipelines runs retry <pipeline-id> <run-id> \
|
|
152
|
+
--idempotency-key census-2021-retry-1 --wait --json
|
|
149
153
|
answerlayer pipelines runs cancel <pipeline-id> <run-id> --json
|
|
150
154
|
answerlayer pipelines archive <pipeline-id> --json
|
|
151
155
|
```
|
|
152
156
|
|
|
157
|
+
Dataset scope is explicit and fail-closed: every requested dataset must be in
|
|
158
|
+
the promoted package's resolved catalog. Retrying a publish run reuses the
|
|
159
|
+
previous run's durable dataset checkpoint, so completed datasets are not
|
|
160
|
+
republished. Reusing an idempotency key returns the original matching run
|
|
161
|
+
instead of launching a duplicate.
|
|
162
|
+
|
|
163
|
+
Create and operate the pipeline's install-local EventBridge schedule:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
answerlayer pipelines schedule set <pipeline-id> \
|
|
167
|
+
--expression 'cron(0 2 * * ? *)' --json
|
|
168
|
+
answerlayer pipelines schedule get <pipeline-id> --json
|
|
169
|
+
answerlayer pipelines schedule resume <pipeline-id> --json
|
|
170
|
+
answerlayer pipelines schedule update <pipeline-id> \
|
|
171
|
+
--expression 'rate(12 hours)' --json
|
|
172
|
+
answerlayer pipelines schedule pause <pipeline-id> --json
|
|
173
|
+
answerlayer pipelines schedule delete <pipeline-id>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Creating a schedule only defines it; new schedules are unarmed by default.
|
|
177
|
+
Run `schedule resume` after review, or pass `--armed` to `schedule set` when
|
|
178
|
+
immediate activation is intentional. `--paused` remains an explicit spelling
|
|
179
|
+
for creating the schedule unarmed.
|
|
180
|
+
|
|
181
|
+
Scheduled tasks invoke the isolated extractor directly and continue when the
|
|
182
|
+
AnswerLayer web process is unavailable. Disabling or archiving a pipeline also
|
|
183
|
+
stops its schedule from launching new work.
|
|
184
|
+
|
|
153
185
|
Roll back by selecting a revision that was previously promoted. This moves the
|
|
154
186
|
active pointer back to the existing immutable revision; it does not copy or
|
|
155
187
|
re-upload the package:
|
package/package.json
CHANGED
|
@@ -181,7 +181,9 @@ to see exact flags before using one:
|
|
|
181
181
|
- `documents` — upload business-context docs and link them to connections
|
|
182
182
|
- `connections` — create / test / inspect schema
|
|
183
183
|
- `pipelines` — create, inspect, update, validate, connection-test, probe,
|
|
184
|
-
promote,
|
|
184
|
+
promote, run with explicit dataset scope and idempotency, retry from durable
|
|
185
|
+
checkpoints, define unarmed install-local schedules, explicitly arm or pause
|
|
186
|
+
schedules, enable, disable, and archive;
|
|
185
187
|
upload immutable packages; list, inspect, diff, validate, promote, and roll
|
|
186
188
|
back revisions; and run/retry/cancel exact revisions. Use `--wait --json` for
|
|
187
189
|
automation. Never put credentials or CA material in package configuration;
|
package/src/cli.js
CHANGED
|
@@ -279,6 +279,10 @@ async function handlePipelines(client, command, positionals, parsed, io) {
|
|
|
279
279
|
return handlePipelineRuns(client, base, positionals, parsed, io);
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
if (command === "schedule" || command === "schedules") {
|
|
283
|
+
return handlePipelineSchedule(client, base, positionals, parsed, io);
|
|
284
|
+
}
|
|
285
|
+
|
|
282
286
|
throw usage(`Unknown pipelines command: ${command}`);
|
|
283
287
|
}
|
|
284
288
|
|
|
@@ -376,6 +380,10 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
|
|
|
376
380
|
const pipelinePath = `${base}/${encodeURIComponent(pipelineId)}`;
|
|
377
381
|
|
|
378
382
|
if (action === "start" || action === "run") {
|
|
383
|
+
const body = await readData(parsed.flags, io, {
|
|
384
|
+
datasets: optionalCsvOrRepeated(parsed.flags.dataset),
|
|
385
|
+
idempotency_key: firstValue(parsed.flags.idempotencyKey),
|
|
386
|
+
});
|
|
379
387
|
return requestWaitAndPrint(
|
|
380
388
|
client,
|
|
381
389
|
"POST",
|
|
@@ -383,6 +391,7 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
|
|
|
383
391
|
parsed,
|
|
384
392
|
io,
|
|
385
393
|
pipelinePath,
|
|
394
|
+
{ body },
|
|
386
395
|
);
|
|
387
396
|
}
|
|
388
397
|
|
|
@@ -392,6 +401,9 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
|
|
|
392
401
|
return requestAndPrint(client, "GET", runPath, parsed, io);
|
|
393
402
|
}
|
|
394
403
|
if (action === "retry") {
|
|
404
|
+
const body = await readData(parsed.flags, io, {
|
|
405
|
+
idempotency_key: firstValue(parsed.flags.idempotencyKey),
|
|
406
|
+
});
|
|
395
407
|
return requestWaitAndPrint(
|
|
396
408
|
client,
|
|
397
409
|
"POST",
|
|
@@ -399,6 +411,7 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
|
|
|
399
411
|
parsed,
|
|
400
412
|
io,
|
|
401
413
|
pipelinePath,
|
|
414
|
+
{ body },
|
|
402
415
|
);
|
|
403
416
|
}
|
|
404
417
|
if (action === "cancel") {
|
|
@@ -408,6 +421,50 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
|
|
|
408
421
|
throw usage(`Unknown pipelines runs command: ${action}`);
|
|
409
422
|
}
|
|
410
423
|
|
|
424
|
+
async function handlePipelineSchedule(client, base, positionals, parsed, io) {
|
|
425
|
+
const action = requirePositional(positionals, 0, "pipeline schedule action");
|
|
426
|
+
const pipelineId = requirePositional(positionals, 1, "pipeline id");
|
|
427
|
+
const schedulePath = `${base}/${encodeURIComponent(pipelineId)}/schedule`;
|
|
428
|
+
|
|
429
|
+
if (action === "get") {
|
|
430
|
+
return requestAndPrint(client, "GET", schedulePath, parsed, io);
|
|
431
|
+
}
|
|
432
|
+
if (action === "set" || action === "create") {
|
|
433
|
+
if (parsed.flags.armed && parsed.flags.paused) {
|
|
434
|
+
throw usage("pipelines schedule set accepts either --armed or --paused, not both");
|
|
435
|
+
}
|
|
436
|
+
const body = await readData(parsed.flags, io, {
|
|
437
|
+
schedule_expression: firstValue(parsed.flags.expression),
|
|
438
|
+
enabled: Boolean(parsed.flags.armed),
|
|
439
|
+
});
|
|
440
|
+
requirePayloadValue(
|
|
441
|
+
body,
|
|
442
|
+
"schedule_expression",
|
|
443
|
+
"pipelines schedule set requires --expression",
|
|
444
|
+
);
|
|
445
|
+
return requestAndPrint(client, "PUT", schedulePath, parsed, io, { body });
|
|
446
|
+
}
|
|
447
|
+
if (action === "update") {
|
|
448
|
+
const body = await readData(parsed.flags, io, {
|
|
449
|
+
schedule_expression: firstValue(parsed.flags.expression),
|
|
450
|
+
});
|
|
451
|
+
requirePayloadValue(
|
|
452
|
+
body,
|
|
453
|
+
"schedule_expression",
|
|
454
|
+
"pipelines schedule update requires --expression",
|
|
455
|
+
);
|
|
456
|
+
return requestAndPrint(client, "PATCH", schedulePath, parsed, io, { body });
|
|
457
|
+
}
|
|
458
|
+
if (action === "pause" || action === "resume") {
|
|
459
|
+
return requestAndPrint(client, "POST", `${schedulePath}/${action}`, parsed, io);
|
|
460
|
+
}
|
|
461
|
+
if (action === "delete" || action === "remove") {
|
|
462
|
+
return requestAndPrint(client, "DELETE", schedulePath, parsed, io);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
throw usage(`Unknown pipelines schedule command: ${action}`);
|
|
466
|
+
}
|
|
467
|
+
|
|
411
468
|
async function handleConnections(client, command, positionals, parsed, io) {
|
|
412
469
|
if (command === "supported" || command === "supported-types") {
|
|
413
470
|
return requestAndPrint(client, "GET", "/api/v1/connections/supported_types", parsed, io, {
|
|
@@ -1923,6 +1980,10 @@ function normalizeFlagName(rawName) {
|
|
|
1923
1980
|
"--against": "against",
|
|
1924
1981
|
"--package": "package",
|
|
1925
1982
|
"--include-archived": "includeArchived",
|
|
1983
|
+
"--dataset": "dataset",
|
|
1984
|
+
"--idempotency-key": "idempotencyKey",
|
|
1985
|
+
"--armed": "armed",
|
|
1986
|
+
"--paused": "paused",
|
|
1926
1987
|
"--wait": "wait",
|
|
1927
1988
|
"--wait-timeout": "waitTimeout",
|
|
1928
1989
|
"--poll-interval": "pollInterval",
|
|
@@ -2037,7 +2098,7 @@ function normalizeFlagName(rawName) {
|
|
|
2037
2098
|
}
|
|
2038
2099
|
|
|
2039
2100
|
function isBooleanFlag(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);
|
|
2101
|
+
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", "--armed", "--paused"].includes(rawName);
|
|
2041
2102
|
}
|
|
2042
2103
|
|
|
2043
2104
|
function setFlag(flags, name, value) {
|
|
@@ -2228,6 +2289,7 @@ Core:
|
|
|
2228
2289
|
answerlayer pipelines list|create|get|update|enable|disable|archive
|
|
2229
2290
|
answerlayer pipelines revisions list|get|push|validate|connection-test|probe|promote|diff|rollback <pipeline-id> [revision-id]
|
|
2230
2291
|
answerlayer pipelines runs start|get|retry|cancel <pipeline-id> [run-id]
|
|
2292
|
+
answerlayer pipelines schedule get|set|update|pause|resume|delete <pipeline-id>
|
|
2231
2293
|
answerlayer connections supported|list|get|create|update|delete|schema|test
|
|
2232
2294
|
answerlayer metadata structure|tables|columns|pii-summary|pii-settings|detect-pii
|
|
2233
2295
|
answerlayer query run|validate|export <connection-id> --sql <sql>
|
|
@@ -2306,6 +2368,11 @@ Pipeline options:
|
|
|
2306
2368
|
--row-limit <n> Probe row ceiling (1-100000; required).
|
|
2307
2369
|
--byte-limit <n> Probe decoded-byte ceiling (1024-104857600; required).
|
|
2308
2370
|
--runtime-limit <sec> Probe runtime ceiling (1-900; required).
|
|
2371
|
+
--dataset <name> Limit a run to a dataset (repeat or comma-separate).
|
|
2372
|
+
--idempotency-key <k> Safely retry a run-creation request.
|
|
2373
|
+
--expression <expr> EventBridge rate(...) or cron(...) schedule.
|
|
2374
|
+
--armed Arm a new schedule immediately (default: unarmed).
|
|
2375
|
+
--paused Explicitly create a schedule in the unarmed state.
|
|
2309
2376
|
|
|
2310
2377
|
SQL options:
|
|
2311
2378
|
--sql, -q <sql> SQL text.
|