@solidactions/cli 3.22.0 → 3.24.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 +6 -1
- package/dist/command-manifest.json +1 -1
- package/dist/commands/crew-env-map-database.js +4 -1
- package/dist/commands/database-export.js +14 -0
- package/dist/commands/database-push.js +7 -4
- package/dist/commands/database.js +4 -0
- package/dist/commands/deploy.js +3 -2
- package/dist/commands/dev.js +20 -0
- package/dist/commands/device-login.js +3 -2
- package/dist/commands/doc-pull.js +274 -46
- package/dist/commands/doc-push.js +4 -0
- package/dist/commands/login.js +101 -13
- package/dist/commands/skill-exec.js +4 -1
- package/dist/commands/skill-run.js +4 -1
- package/dist/commands/workflow-view.js +20 -4
- package/dist/index.js +4 -1
- package/dist/utils/api.js +10 -25
- package/dist/utils/config.js +10 -4
- package/dist/utils/database-data-plane.js +22 -3
- package/dist/utils/debug-guard.js +60 -0
- package/dist/utils/host-display.js +66 -0
- package/dist/utils/mcp.js +10 -0
- package/dist/utils/source-provenance.js +12 -1
- package/dist/utils/workspace-lookup.js +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -280,6 +280,9 @@ Workspace: <name> — organization <org> (<workspaceId>)
|
|
|
280
280
|
- `--local` — write config to `./.solidactions/config.json` in the current folder.
|
|
281
281
|
- `--global` — write config to `~/.solidactions/config.json` (today's default).
|
|
282
282
|
- `--gitignore` — with `--local`, auto-add `.solidactions/` to `.gitignore` without prompting.
|
|
283
|
+
- `login` uses `SOLIDACTIONS_HOST` when it is set.
|
|
284
|
+
- A host with a username and password in it (`http://user:pass@host`) is refused: the CLI authenticates with your API key.
|
|
285
|
+
- An agent that should be credited as itself in SolidActions (for example, docs it pushes are recorded as Agent) logs the CLI in with its own agent token, not a person's key.
|
|
283
286
|
|
|
284
287
|
In interactive shells, `login` without `--local`/`--global` prompts for a location. In non-interactive contexts, one of the flags is required.
|
|
285
288
|
|
|
@@ -293,7 +296,7 @@ If the target config file already exists and its contents would change, `login`
|
|
|
293
296
|
|
|
294
297
|
### Debugging resolution
|
|
295
298
|
|
|
296
|
-
Set `SOLIDACTIONS_DEBUG=1` on any command to print the resolved configuration and per-field sources to stderr before the command runs. `solidactions whoami` also shows this information.
|
|
299
|
+
Set `SOLIDACTIONS_DEBUG=1` on any command to print the resolved configuration and per-field sources to stderr before the command runs. `solidactions whoami` also shows this information. Node's generic `DEBUG` variable never prints your API key: the CLI turns off the HTTP library's `follow-redirects` debug output, which would dump request headers. The CLI refuses to run when `NODE_DEBUG` turns on Node's network debug output (`http`, `https`, `http2`, `net`, `tls`), which would print them too.
|
|
297
300
|
|
|
298
301
|
### Use case: multiple AI agents in parallel
|
|
299
302
|
|
|
@@ -518,6 +521,8 @@ solidactions doc upload logo-v2.png --replace marketing/logo.png
|
|
|
518
521
|
|
|
519
522
|
**`doc pull --overwrite` is destructive.** If a manifest-tracked file still exists on the server *and* your local copy no longer matches the `body_sha256` recorded at the last pull (i.e. you've edited it and haven't pushed yet), a plain `doc pull` — even with `-y`/`--yes` — refuses with exit 1, naming every modified file, rather than silently discarding your edits. Nothing is written before that refusal. `-y`/`--yes` only bypasses the generic "destination is not empty" prompt; it does not cover locally-modified tracked files. Pass `--overwrite` to discard those local changes and re-pull server content anyway (it also implies `--yes`).
|
|
520
523
|
|
|
524
|
+
**`doc pull` never writes through a link or over bytes it does not own.** It refuses before writing anything when a target is a symbolic link, sits under a linked folder inside the destination, or resolves outside it, with or without `--overwrite`. A local file the destination does not track (or tracks without a recorded hash) is replaced only with `--overwrite`; `-y` only answers the confirmation. A file that already holds exactly the server's bytes is simply adopted. A media doc whose download fails is not tracked over a local file.
|
|
525
|
+
|
|
521
526
|
You do **not** need `--overwrite` to keep an edited file whose doc was deleted on the server — that case is handled by deletion propagation above, on the default path, and the file is kept with a warning.
|
|
522
527
|
|
|
523
528
|
**Getting a doc id.** `doc upload --replace` accepts a docs path (`marketing/hero.png`), so you rarely need an id. If you want one, `doc pull` records it per file in the destination's `.solidactions-docs.json` sidecar, and `import_outputs` returns the ids it created. Note that `--replace` does not update a pulled directory's manifest. If you replace a tracked image out-of-band and leave the local file untouched, the next `doc push` reports it as **unchanged** and does nothing — the content hash matches, so `push` never asks the server. (Edit the local file too, and the drift guard fires as expected.) Re-pull to resync the manifest.
|
|
@@ -44,7 +44,10 @@ async function crewEnvMapDatabase(crewArg, key, databaseArg) {
|
|
|
44
44
|
console.log(chalk_1.default.yellow(exports.CREW_DATABASE_SCOPE_WARNING));
|
|
45
45
|
}
|
|
46
46
|
catch (error) {
|
|
47
|
-
if (error.response?.status ===
|
|
47
|
+
if ((error.response?.status ?? error.status) === 401) {
|
|
48
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
49
|
+
}
|
|
50
|
+
else if (error.response?.status === 422) {
|
|
48
51
|
console.error(chalk_1.default.red((0, api_1.formatValidationError)(error.response.data)));
|
|
49
52
|
}
|
|
50
53
|
else if (typeof error.message === 'string') {
|
|
@@ -169,6 +169,18 @@ function teachingError(error) {
|
|
|
169
169
|
}
|
|
170
170
|
throw error;
|
|
171
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Throw the host-naming 401 for a 401 response, in either export call
|
|
174
|
+
* (cli#186). A non-string, blank or whitespace-only server code becomes
|
|
175
|
+
* 'unauthenticated', the way safeDatabaseRequestError trims it.
|
|
176
|
+
*/
|
|
177
|
+
function throwIfUnauthenticated(error, config) {
|
|
178
|
+
if (error?.response?.status !== 401) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const candidate = typeof error.response.data?.code === 'string' ? error.response.data.code.trim() : '';
|
|
182
|
+
throw new ExportCommandError(candidate.length > 0 ? candidate : 'unauthenticated', (0, api_1.authFailedLine)(config.host), 401);
|
|
183
|
+
}
|
|
172
184
|
async function operation(config, body) {
|
|
173
185
|
try {
|
|
174
186
|
const response = await axios_1.default.post(`${config.host}/api/v1/databases`, body, {
|
|
@@ -178,6 +190,7 @@ async function operation(config, body) {
|
|
|
178
190
|
return applyRetryAfter(response.data, response.headers['retry-after']);
|
|
179
191
|
}
|
|
180
192
|
catch (error) {
|
|
193
|
+
throwIfUnauthenticated(error, config);
|
|
181
194
|
const response = error?.response;
|
|
182
195
|
const code = typeof response?.data?.code === 'string' ? response.data.code : 'upstream_unavailable';
|
|
183
196
|
const message = typeof response?.data?.message === 'string' ? response.data.message : 'Database request failed.';
|
|
@@ -196,6 +209,7 @@ async function startExport(config, name, tables, replace, requestId) {
|
|
|
196
209
|
return stableMetadata(applyRetryAfter(response.data, response.headers['retry-after']));
|
|
197
210
|
}
|
|
198
211
|
catch (error) {
|
|
212
|
+
throwIfUnauthenticated(error, config);
|
|
199
213
|
const data = error?.response?.data;
|
|
200
214
|
const code = typeof data?.code === 'string' ? data.code : 'upstream_unavailable';
|
|
201
215
|
const message = typeof data?.message === 'string' ? data.message : 'Database request failed.';
|
|
@@ -47,6 +47,7 @@ const os_1 = __importDefault(require("os"));
|
|
|
47
47
|
const path_1 = __importDefault(require("path"));
|
|
48
48
|
const url_1 = require("url");
|
|
49
49
|
const client_1 = require("@libsql/client");
|
|
50
|
+
const host_display_1 = require("../utils/host-display");
|
|
50
51
|
const database_data_plane_1 = require("../utils/database-data-plane");
|
|
51
52
|
const database_1 = require("./database");
|
|
52
53
|
const MAX_BYTES = 20_000_000_000;
|
|
@@ -281,7 +282,7 @@ async function databasePushWithConfig(name, file, options, config, dependencies
|
|
|
281
282
|
return value;
|
|
282
283
|
};
|
|
283
284
|
const controlRemaining = () => Math.min(database_data_plane_1.DEFAULT_DATABASE_CONTROL_PLANE_TIMEOUT_MS, remaining());
|
|
284
|
-
stdout(`WARNING: This destructively replaces database "${name}" in workspace ${config.workspaceId ?? '(none)'} on ${config.host}. Quiesce all writers; old URLs and credentials will become invalid. A private snapshot is normalized to WAL, 4096-byte pages, and auto-vacuum NONE; the source file is unchanged.`);
|
|
285
|
+
stdout(`WARNING: This destructively replaces database "${name}" in workspace ${config.workspaceId ?? '(none)'} on ${(0, host_display_1.displayHost)(config.host)}. Quiesce all writers; old URLs and credentials will become invalid. A private snapshot is normalized to WAL, 4096-byte pages, and auto-vacuum NONE; the source file is unchanged.`);
|
|
285
286
|
stdout(`Hard deadline: ${Math.ceil(deadlineMs / 60_000)} minutes for ${normalized.inputBytes} bytes. Idempotency key: ${key}`);
|
|
286
287
|
const prepareBody = {
|
|
287
288
|
operation: 'bulk_load_prepare', name, bulk_mode: 'replace', input_bytes: normalized.inputBytes,
|
|
@@ -324,8 +325,9 @@ async function databasePushWithConfig(name, file, options, config, dependencies
|
|
|
324
325
|
clearInterval(renewalTimer);
|
|
325
326
|
await renewing;
|
|
326
327
|
}
|
|
327
|
-
if (renewalFailure)
|
|
328
|
-
throw
|
|
328
|
+
if (renewalFailure) {
|
|
329
|
+
throw (0, database_data_plane_1.preserveAuthFailure)(renewalFailure, 'The database upload lease could not be renewed; the source database was not changed.', 'upstream_unavailable', 'The database upload lease could not be renewed; the source database was not changed.');
|
|
330
|
+
}
|
|
329
331
|
if (uploaded.status < 200 || uploaded.status > 299) {
|
|
330
332
|
if (uploaded.status === 413)
|
|
331
333
|
throw new database_data_plane_1.DatabaseOperationError('bulk_load_too_large', 'The upstream database service rejected the upload size; the source database was not changed.');
|
|
@@ -367,7 +369,8 @@ async function databasePushWithConfig(name, file, options, config, dependencies
|
|
|
367
369
|
}
|
|
368
370
|
}
|
|
369
371
|
if (operationId && promoteAccepted && !terminalObserved) {
|
|
370
|
-
|
|
372
|
+
const stateLine = `Promotion was accepted, but status could not be confirmed. Operation ${operationId} remains active; retry with idempotency key ${key}.`;
|
|
373
|
+
throw (0, database_data_plane_1.preserveAuthFailure)(error, stateLine, 'upstream_unavailable', stateLine);
|
|
371
374
|
}
|
|
372
375
|
throw error;
|
|
373
376
|
}
|
|
@@ -895,6 +895,10 @@ async function databaseCreateWithConfig(name, options, config, dependencies = {}
|
|
|
895
895
|
}
|
|
896
896
|
}
|
|
897
897
|
catch (error) {
|
|
898
|
+
if (error instanceof database_data_plane_1.DatabaseOperationError && error.status === 401) {
|
|
899
|
+
const stateLine = `Database "${data.database.name}" was created, but its SQL import failed. The database remains in place.`;
|
|
900
|
+
throw (0, database_data_plane_1.preserveAuthFailure)(error, stateLine, 'import_failed', stateLine);
|
|
901
|
+
}
|
|
898
902
|
const safeGuidance = error instanceof database_data_plane_1.DatabaseOperationError
|
|
899
903
|
&& error.code === 'import_failed'
|
|
900
904
|
&& error.message.includes('Resume with:')
|
package/dist/commands/deploy.js
CHANGED
|
@@ -27,6 +27,7 @@ const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
|
27
27
|
const prompts_1 = __importDefault(require("prompts"));
|
|
28
28
|
const env_1 = require("../utils/env");
|
|
29
29
|
const api_1 = require("../utils/api");
|
|
30
|
+
const host_display_1 = require("../utils/host-display");
|
|
30
31
|
const deploy_ignore_1 = require("../utils/deploy-ignore");
|
|
31
32
|
const slug_1 = require("../utils/slug");
|
|
32
33
|
const project_ref_1 = require("../utils/project-ref");
|
|
@@ -626,7 +627,7 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
626
627
|
}
|
|
627
628
|
console.log(chalk_1.default.yellow('Uploading...'));
|
|
628
629
|
if (process.env.SOLIDACTIONS_DEPLOY_DEBUG === '1') {
|
|
629
|
-
process.stderr.write(`[deploy-debug] POST ${config.host}/api/v1/projects/${projectSlug}/deploy (workspace=${config.workspaceId ?? '(none)'})\n`);
|
|
630
|
+
process.stderr.write(`[deploy-debug] POST ${(0, host_display_1.displayHost)(config.host)}/api/v1/projects/${projectSlug}/deploy (workspace=${config.workspaceId ?? '(none)'})\n`);
|
|
630
631
|
}
|
|
631
632
|
const deployResponse = await axios_1.default.post(`${config.host}/api/v1/projects/${projectSlug}/deploy`, form, {
|
|
632
633
|
headers: {
|
|
@@ -646,7 +647,7 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
646
647
|
console.log(chalk_1.default.green('Deployment successfully queued!'));
|
|
647
648
|
console.log(chalk_1.default.yellow('Waiting for build to complete...\n'));
|
|
648
649
|
if (process.env.SOLIDACTIONS_DEPLOY_DEBUG === '1') {
|
|
649
|
-
process.stderr.write(`[deploy-debug] poll URL = ${config.host}/api/v1/projects/${projectSlug} (workspace=${config.workspaceId ?? '(none)'})\n`);
|
|
650
|
+
process.stderr.write(`[deploy-debug] poll URL = ${(0, host_display_1.displayHost)(config.host)}/api/v1/projects/${projectSlug} (workspace=${config.workspaceId ?? '(none)'})\n`);
|
|
650
651
|
}
|
|
651
652
|
// Poll for completion
|
|
652
653
|
let attempts = 0;
|
package/dist/commands/dev.js
CHANGED
|
@@ -51,6 +51,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
51
51
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
52
52
|
const crypto_1 = require("crypto");
|
|
53
53
|
const module_1 = require("module");
|
|
54
|
+
const api_1 = require("../utils/api");
|
|
54
55
|
const config_1 = require("../utils/config");
|
|
55
56
|
/**
|
|
56
57
|
* Does this mapping declare a database in `solidactions.yaml` that the platform
|
|
@@ -94,6 +95,7 @@ const WRITE_AUTHORITY_REFUSAL_CODES = new Set([
|
|
|
94
95
|
function buildSaApiClient(config, projectSlug) {
|
|
95
96
|
const client = {
|
|
96
97
|
projectSlug,
|
|
98
|
+
host: config.host,
|
|
97
99
|
revealDenied: false,
|
|
98
100
|
async fetchVarsAndConnections(_env) {
|
|
99
101
|
const axios = (await Promise.resolve().then(() => __importStar(require('axios')))).default;
|
|
@@ -431,6 +433,16 @@ async function runDev(opts) {
|
|
|
431
433
|
function err(msg) {
|
|
432
434
|
stderrLines.push(msg);
|
|
433
435
|
}
|
|
436
|
+
const isUnauthenticated = (e) => e?.response?.status === 401 || e?.status === 401;
|
|
437
|
+
const authFailed = () => ({
|
|
438
|
+
stdout: stdoutLines.join('\n'),
|
|
439
|
+
stderr: stderrLines.join('\n'),
|
|
440
|
+
result: {
|
|
441
|
+
status: 'failed',
|
|
442
|
+
phase: 'auth',
|
|
443
|
+
error: { name: 'AuthenticationError', message: (0, api_1.authFailedLine)(apiClient?.host ?? 'the configured host') },
|
|
444
|
+
},
|
|
445
|
+
});
|
|
434
446
|
// 1. Determine the API client (only when an env was requested). With no
|
|
435
447
|
// --env, we run fully locally: NO platform fetch, ctx.vars starts empty.
|
|
436
448
|
let apiClient;
|
|
@@ -459,6 +471,8 @@ async function runDev(opts) {
|
|
|
459
471
|
platformVars = await apiClient.fetchVarsAndConnections(opts.env);
|
|
460
472
|
}
|
|
461
473
|
catch (e) {
|
|
474
|
+
if (isUnauthenticated(e))
|
|
475
|
+
return authFailed();
|
|
462
476
|
let msg = `failed to fetch platform vars: ${e?.message ?? e}`;
|
|
463
477
|
if (e?.response?.status === 404 && opts.env !== 'production') {
|
|
464
478
|
msg += `\nThe '${opts.env}' environment project doesn't exist — staging/dev environments require a paid plan. On the free plan, use --env production.`;
|
|
@@ -553,6 +567,8 @@ async function runDev(opts) {
|
|
|
553
567
|
}
|
|
554
568
|
}
|
|
555
569
|
catch (e) {
|
|
570
|
+
if (isUnauthenticated(e))
|
|
571
|
+
return authFailed();
|
|
556
572
|
err(`${pv.env_name}: failed to resolve database '${dbName}': ${e?.message ?? e}`);
|
|
557
573
|
}
|
|
558
574
|
}
|
|
@@ -894,6 +910,10 @@ async function dev(file, options) {
|
|
|
894
910
|
console.log(chalk_1.default.yellow('Workflow cancelled'));
|
|
895
911
|
process.exit(1);
|
|
896
912
|
}
|
|
913
|
+
if (r.status === 'failed' && r.phase === 'auth') {
|
|
914
|
+
console.error(chalk_1.default.red(r.error.message));
|
|
915
|
+
process.exit(1);
|
|
916
|
+
}
|
|
897
917
|
// failed
|
|
898
918
|
console.error(chalk_1.default.red(`✗ failed (${r.phase ?? 'run'}):`), r.error?.message ?? String(r.error));
|
|
899
919
|
process.exit(1);
|
|
@@ -9,6 +9,7 @@ exports.deviceLogin = deviceLogin;
|
|
|
9
9
|
const axios_1 = __importDefault(require("axios"));
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
require("../utils/api");
|
|
12
|
+
const host_display_1 = require("../utils/host-display");
|
|
12
13
|
const workspace_lookup_1 = require("../utils/workspace-lookup");
|
|
13
14
|
const login_1 = require("./login");
|
|
14
15
|
// Public device-flow client id — not a secret; matches the server-seeded
|
|
@@ -106,7 +107,7 @@ async function pollForToken(host, clientId, deviceCode, intervalSeconds, expires
|
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
async function deviceLogin(options) {
|
|
109
|
-
const resolved = (0, login_1.
|
|
110
|
+
const resolved = (0, login_1.resolveLoginHostOrExit)(options);
|
|
110
111
|
const host = resolved.host;
|
|
111
112
|
const preflight = await (0, login_1.preflightDeviceLoginWrite)(options);
|
|
112
113
|
console.log(chalk_1.default.blue('Requesting device authorization...'));
|
|
@@ -138,7 +139,7 @@ async function deviceLogin(options) {
|
|
|
138
139
|
}
|
|
139
140
|
catch (e) {
|
|
140
141
|
if (e.response?.status === 401) {
|
|
141
|
-
console.error(chalk_1.default.red(`Authentication was saved to ${preflight.targetPath}, but
|
|
142
|
+
console.error(chalk_1.default.red(`Authentication was saved to ${preflight.targetPath}, but ${(0, host_display_1.displayHost)(host)} rejected it during workspace discovery.`));
|
|
142
143
|
}
|
|
143
144
|
else {
|
|
144
145
|
console.error(chalk_1.default.red(`Authentication was saved to ${preflight.targetPath}, but workspace discovery failed: ${e.message}`));
|