@solidactions/cli 3.21.0 → 3.23.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 +7 -3
- package/dist/command-manifest.json +1 -1
- package/dist/commands/connection-list.js +1 -1
- package/dist/commands/crew-env-delete.js +2 -2
- package/dist/commands/crew-env-list.js +2 -2
- package/dist/commands/crew-env-map-database.js +4 -1
- package/dist/commands/crew-env-push.js +5 -2
- package/dist/commands/crew-env-set.js +2 -2
- package/dist/commands/database-push.js +2 -1
- package/dist/commands/deploy.js +44 -28
- package/dist/commands/device-login.js +3 -2
- package/dist/commands/doc-pull.js +628 -90
- package/dist/commands/doc-push.js +54 -3
- package/dist/commands/doc-upload.js +5 -2
- package/dist/commands/env-delete.js +12 -5
- package/dist/commands/env-list.js +12 -7
- package/dist/commands/env-map.js +7 -5
- package/dist/commands/env-pull.js +5 -6
- package/dist/commands/env-push.js +10 -6
- package/dist/commands/env-reset.js +12 -8
- package/dist/commands/env-set.js +15 -11
- package/dist/commands/login.js +84 -20
- package/dist/commands/oauth-action-list.js +2 -2
- package/dist/commands/oauth-action-platforms.js +2 -2
- package/dist/commands/oauth-action-search.js +2 -2
- package/dist/commands/oauth-action-view.js +2 -2
- package/dist/commands/project-create.js +1 -1
- package/dist/commands/project-list.js +2 -2
- package/dist/commands/project-logs.js +7 -3
- package/dist/commands/project-view.js +26 -9
- package/dist/commands/pull.js +4 -2
- package/dist/commands/run-list.js +24 -3
- package/dist/commands/run-start.js +12 -9
- package/dist/commands/run-view.js +2 -2
- package/dist/commands/schedule-delete.js +5 -10
- package/dist/commands/schedule-list.js +5 -10
- package/dist/commands/schedule-set.js +39 -44
- package/dist/commands/schedule-state.js +12 -16
- package/dist/commands/skill-exec.js +4 -1
- package/dist/commands/skill-run.js +4 -1
- package/dist/commands/state.js +3 -3
- package/dist/commands/webhook-list.js +12 -4
- package/dist/commands/webhook-secret.js +12 -4
- package/dist/commands/workflow-view.js +20 -4
- package/dist/commands/workspaces.js +53 -2
- package/dist/index.js +2 -1
- package/dist/utils/api.js +18 -4
- package/dist/utils/config.js +5 -4
- package/dist/utils/crew.js +6 -1
- package/dist/utils/host-display.js +47 -0
- package/dist/utils/project-ref.js +91 -0
- package/dist/utils/workspace-lookup.js +11 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -280,6 +280,8 @@ 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
|
+
- 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
285
|
|
|
284
286
|
In interactive shells, `login` without `--local`/`--global` prompts for a location. In non-interactive contexts, one of the flags is required.
|
|
285
287
|
|
|
@@ -499,8 +501,8 @@ Manage docs in SA-Docs (the app's built-in documentation vault). `push` is drift
|
|
|
499
501
|
|
|
500
502
|
| Command | Key Flags | Description |
|
|
501
503
|
|---------|-----------|-------------|
|
|
502
|
-
| `doc pull <folder> [dest]` | `-y`, `--overwrite`, `--json` | Download a Docs folder tree (markdown + media) to `dest` (defaults to `./<last-segment>/`);
|
|
503
|
-
| `doc push <path>` | `--on-conflict`, `--type`, `--folder`, `--replace`, `--dry-run`, `--force`, `--json` | Upload a directory of docs (walked recursively) or one file: `<title>.md` becomes a markdown doc, `<title>.html` a visual doc, `<title>.canvas.json` or `<title>.canvas` a canvas. Each file must be at most 1 MiB. Manifest-tracked files (from a prior `pull`) are written with a `base_revision` guard and reported separately as written/drifted/unchanged; files whose content hash still matches the last pull are skipped as unchanged (no write, no revision bump). Tracked media files whose bytes changed are replaced the same way, under the same guard; a tracked media file missing locally is left alone — `push` never deletes. An untracked binary in the tree is warned about, never uploaded (use `doc upload`). `--force` skips the drift guard (unchanged files are still skipped). `--dry-run` previews without writing. Untracked files are created under the manifest's `folder_path` when `<dir>` came from a `doc pull` (pass `--folder` to override); an untracked file whose title already exists in the target folder is skipped per `--on-conflict` (default `skip`, reported as `duplicate_title`) |
|
|
504
|
+
| `doc pull <folder> [dest]` | `-y`, `--overwrite`, `--json` | Download a Docs folder tree (markdown + media) to `dest` (defaults to `./<last-segment>/`); visual docs arrive as `<title>.html`, canvases as `<title>.canvas.json`, other docs as `<title>.md`. Writes a `.solidactions-docs.json` revision manifest (including a `body_sha256` content hash per file) used by `push`'s drift guard. Falls back to fetching a single doc if `folder` is a doc path, not a folder |
|
|
505
|
+
| `doc push <path>` | `--on-conflict`, `--type`, `--folder`, `--replace`, `--dry-run`, `--force`, `--json` | Upload a directory of docs (walked recursively) or one file: `<title>.md` becomes a markdown doc, `<title>.html` a visual doc, `<title>.canvas.json` or `<title>.canvas` a canvas. Each file must be at most 1 MiB. Manifest-tracked files (from a prior `pull`) are written with a `base_revision` guard and reported separately as written/drifted/unchanged; files whose content hash still matches the last pull are skipped as unchanged (no write, no revision bump). Tracked media files whose bytes changed are replaced the same way, under the same guard; a tracked media file missing locally is left alone — `push` never deletes. An untracked binary in the tree is warned about, never uploaded (use `doc upload`). `--force` skips the drift guard (unchanged files are still skipped). `--dry-run` previews without writing. Untracked files are created under the manifest's `folder_path` when `<dir>` came from a `doc pull` (pass `--folder` to override); docs the push creates are recorded in the directory's manifest (a directory push with no manifest starts one with the pushed folder), so pushing again updates them — unless `--folder` points outside the manifest's folder, in which case nothing is recorded and the push says so; an untracked file whose title already exists in the target folder is skipped per `--on-conflict` (default `skip`, reported as `duplicate_title`) |
|
|
504
506
|
| `doc upload <files...>` | `--folder`, `--title`, `--replace <doc-id-or-path>` | Upload one or more media files to SA-Docs (requires a token with the "docs" ability); `--title` only valid for a single file. `--replace` swaps the bytes behind an existing media doc instead of creating a new one — see below |
|
|
505
507
|
|
|
506
508
|
`doc upload <file> --replace <doc-id-or-path>` swaps the bytes behind an existing media doc, keeping its id, title, and folder, so embeds and references keep resolving — the old image stays in the doc's version history. Single file only; cannot be combined with `--title` or `--folder`. A purely numeric argument is a doc id; anything else is a docs path (`marketing/hero.png`), resolved against the doc's **title** — which `doc pull` may have sanitized, so for path-based work on a pulled folder prefer `doc push` instead:
|
|
@@ -512,12 +514,14 @@ solidactions doc upload logo-v2.png --replace marketing/logo.png
|
|
|
512
514
|
|
|
513
515
|
`doc push <file> --replace <doc-id>` replaces the body of an existing doc by its numeric id. It first reads the doc and refuses unless the kinds match: an `.html` file replaces only a visual doc, a `.canvas.json` / `.canvas` file only a canvas, and a `.md` file any doc that is not visual, canvas or media. There is no drift guard (you named the doc). It takes one file and cannot be combined with `--folder`, `--type` or `--on-conflict`. Like `doc upload --replace`, it does not update a pulled directory's manifest.
|
|
514
516
|
|
|
515
|
-
**Visual docs and canvases
|
|
517
|
+
**Visual docs and canvases round-trip through `doc pull` and `doc push`.** `doc pull` writes visual docs as `<title>.html` and canvases as `<title>.canvas.json`; every other non-media doc stays `<title>.md`. `doc push` records the docs it creates in the directory's manifest (when they land in the directory's tracked folder), so pushing the same directory again updates them by id instead of skipping them — a second push of an unchanged file sends nothing. When a pulled doc's local path changes (e.g. `page.md` becomes `page.html`), an unmodified old file is removed after the new one is written; if the old file was edited, the pull refuses before any write even with `--overwrite` — push the edited file first or move it aside and pull again. If the renamed doc's download fails, the pull refuses when another doc would take its old name or any filesystem alias of its old file, or when the old file holds unpublished edits (pull again once the download succeeds). Two planned writes involving a rename also refuse when their target names refer to the same file or physical path, including absent targets under aliased directories. A rename whose new name already holds an untracked local file (or one tracked without a recorded hash) refuses unless `--overwrite`; a file that already holds exactly the pulled bytes is simply adopted. These checks apply even when the old file is gone (or is no longer a regular file): there is then nothing to remove, and a failed download keeps the doc tracked under its old name. A symbolic link at a rename target also makes the pull refuse even with `--overwrite`. Filename allocation compares names case-insensitively, so `Page` and `page` receive distinct names (`Page.md` and `page-2.md`); an unchanged tracked doc keeps its exact filename, including a prior collision suffix. A legacy tracked pair differing only by case that already shares one file refuses before any write. Alias checks follow dangling links to their prospective targets.
|
|
516
518
|
|
|
517
519
|
**`doc pull` propagates deletions, within limits.** A file is removed locally only when its doc was deleted on the server *and* the file's bytes still match what the last pull gave it (the manifest's `body_sha256`) — anything you've edited locally is kept, with a warning that it's now untracked (re-create a markdown doc with `doc push`, a media doc with `doc upload`). Deletions only propagate when the destination's existing manifest `folder_path` matches the folder you're pulling (so pulling a different folder into a directory holding an old manifest deletes nothing), and never on the single-doc pull path; a single-doc pull (`doc pull <folder>/<doc>`) records the doc's folder as the manifest's `folder_path` and, in a directory that already tracks that folder, adds or updates just that one entry; when propagation is skipped for either reason, `pull` says so. Nothing outside the destination directory is removed: every candidate path is resolved physically (so a symlinked subdirectory cannot lead the delete outside), and a file the same pull just wrote is never deleted, even if a case-only rename makes it look orphaned on a case-insensitive filesystem.
|
|
518
520
|
|
|
519
521
|
**`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
522
|
|
|
523
|
+
**`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.
|
|
524
|
+
|
|
521
525
|
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
526
|
|
|
523
527
|
**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.
|
|
@@ -48,7 +48,7 @@ async function connectionList() {
|
|
|
48
48
|
}
|
|
49
49
|
catch (error) {
|
|
50
50
|
if (error.response?.status === 401) {
|
|
51
|
-
console.error(chalk_1.default.red(
|
|
51
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
52
52
|
}
|
|
53
53
|
else if (error.response) {
|
|
54
54
|
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
@@ -33,13 +33,13 @@ async function crewEnvDelete(crewArg, key, options = {}) {
|
|
|
33
33
|
catch (error) {
|
|
34
34
|
if (error.response) {
|
|
35
35
|
if (error.response.status === 401) {
|
|
36
|
-
console.error(chalk_1.default.red(
|
|
36
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
37
37
|
}
|
|
38
38
|
else if (error.response.status === 404) {
|
|
39
39
|
console.error(chalk_1.default.red(error.response.data?.message || `Variable "${key}" not found for crew "${crew.name}".`));
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
console.error(chalk_1.default.red(
|
|
42
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
@@ -73,13 +73,13 @@ async function crewEnvList(crewArg, options = {}) {
|
|
|
73
73
|
catch (error) {
|
|
74
74
|
if (error.response) {
|
|
75
75
|
if (error.response.status === 401) {
|
|
76
|
-
console.error(chalk_1.default.red(
|
|
76
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
77
77
|
}
|
|
78
78
|
else if (error.response.status === 404) {
|
|
79
79
|
console.error(chalk_1.default.red(error.response.data?.message || `Crew "${crewArg}" not found.`));
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
-
console.error(chalk_1.default.red(
|
|
82
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
@@ -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') {
|
|
@@ -72,7 +72,7 @@ async function crewEnvPush(crewArg, filePath = '.env', options = {}) {
|
|
|
72
72
|
}
|
|
73
73
|
catch (error) {
|
|
74
74
|
if (error.response?.status === 401) {
|
|
75
|
-
console.error(chalk_1.default.red(
|
|
75
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
76
76
|
}
|
|
77
77
|
else if (error.response?.status === 404) {
|
|
78
78
|
console.error(chalk_1.default.red(error.response.data?.message || `Crew "${crewArg}" not found.`));
|
|
@@ -148,7 +148,10 @@ async function crewEnvPush(crewArg, filePath = '.env', options = {}) {
|
|
|
148
148
|
await axios_1.default.put(`${config.host}/api/v1/crews/${crew.id}/variables/${entry.key}`, entry.body, { headers: (0, api_1.getApiHeaders)(config, 'application/json') });
|
|
149
149
|
}
|
|
150
150
|
catch (error) {
|
|
151
|
-
if (error.response?.status ===
|
|
151
|
+
if (error.response?.status === 401) {
|
|
152
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
153
|
+
}
|
|
154
|
+
else if (error.response?.status === 422) {
|
|
152
155
|
console.error(chalk_1.default.red(`Failed to push "${entry.key}":`), (0, api_1.formatValidationError)(error.response.data));
|
|
153
156
|
}
|
|
154
157
|
else {
|
|
@@ -58,7 +58,7 @@ async function crewEnvSet(crewArg, key, value, options = {}) {
|
|
|
58
58
|
catch (error) {
|
|
59
59
|
if (error.response) {
|
|
60
60
|
if (error.response.status === 401) {
|
|
61
|
-
console.error(chalk_1.default.red(
|
|
61
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
62
62
|
}
|
|
63
63
|
else if (error.response.status === 404) {
|
|
64
64
|
console.error(chalk_1.default.red(error.response.data?.message || `Crew "${crewArg}" not found.`));
|
|
@@ -67,7 +67,7 @@ async function crewEnvSet(crewArg, key, value, options = {}) {
|
|
|
67
67
|
console.error(chalk_1.default.red((0, api_1.formatValidationError)(error.response.data)));
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
70
|
-
console.error(chalk_1.default.red(
|
|
70
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
@@ -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,
|
package/dist/commands/deploy.js
CHANGED
|
@@ -16,7 +16,6 @@ exports.pushYamlDeclarations = pushYamlDeclarations;
|
|
|
16
16
|
exports.shouldPrintWorkspaceMismatch = shouldPrintWorkspaceMismatch;
|
|
17
17
|
exports.isPlanLimitReachedError = isPlanLimitReachedError;
|
|
18
18
|
exports.handlePlanLimitReached = handlePlanLimitReached;
|
|
19
|
-
exports.getProjectBySlugOrCanonical = getProjectBySlugOrCanonical;
|
|
20
19
|
exports.deploy = deploy;
|
|
21
20
|
exports.shouldPrintWebhookSecretNotice = shouldPrintWebhookSecretNotice;
|
|
22
21
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -28,8 +27,10 @@ const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
|
28
27
|
const prompts_1 = __importDefault(require("prompts"));
|
|
29
28
|
const env_1 = require("../utils/env");
|
|
30
29
|
const api_1 = require("../utils/api");
|
|
30
|
+
const host_display_1 = require("../utils/host-display");
|
|
31
31
|
const deploy_ignore_1 = require("../utils/deploy-ignore");
|
|
32
32
|
const slug_1 = require("../utils/slug");
|
|
33
|
+
const project_ref_1 = require("../utils/project-ref");
|
|
33
34
|
const skills_1 = require("../utils/skills");
|
|
34
35
|
const tar_archive_1 = require("../utils/tar-archive");
|
|
35
36
|
const source_provenance_1 = require("../utils/source-provenance");
|
|
@@ -373,25 +374,13 @@ async function handlePlanLimitReached(config, projectName, error, productionExis
|
|
|
373
374
|
return await createEnvironmentProject(config, projectName, 'production');
|
|
374
375
|
}
|
|
375
376
|
catch (prodError) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* GET a project by the name as typed, then — on a 404 only — by its canonical slug when
|
|
382
|
-
* that differs (cli#102). The server stores `Issue970-QX` as `issue970-qx`; without the
|
|
383
|
-
* retry a redeploy 404s, tries to create, and collides with the slug that already exists.
|
|
384
|
-
* The typed spelling goes first so a legacy slug the slugifier would rewrite still resolves.
|
|
385
|
-
*/
|
|
386
|
-
async function getProjectBySlugOrCanonical(config, typed, canonical) {
|
|
387
|
-
try {
|
|
388
|
-
return await axios_1.default.get(`${config.host}/api/v1/projects/${typed}`, { headers: (0, api_1.getApiHeaders)(config) });
|
|
389
|
-
}
|
|
390
|
-
catch (error) {
|
|
391
|
-
if (error.response?.status !== 404 || canonical === '' || canonical === typed) {
|
|
392
|
-
throw error;
|
|
377
|
+
if (prodError.response?.status === 401) {
|
|
378
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
393
379
|
}
|
|
394
|
-
|
|
380
|
+
else {
|
|
381
|
+
console.error(chalk_1.default.red('Failed to create project:'), prodError.response?.data?.message || prodError.message);
|
|
382
|
+
}
|
|
383
|
+
process.exit(1);
|
|
395
384
|
}
|
|
396
385
|
}
|
|
397
386
|
async function deploy(projectName, sourcePath, options = {}) {
|
|
@@ -431,7 +420,7 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
431
420
|
let productionExists = null; // null = unknown (error path)
|
|
432
421
|
let productionSlug = null;
|
|
433
422
|
try {
|
|
434
|
-
const prodResponse = await getProjectBySlugOrCanonical(config, projectName, (0, slug_1.slugifyName)(projectName) === '' ? '' : (0, slug_1.buildProjectSlug)(projectName, 'production'));
|
|
423
|
+
const prodResponse = await (0, project_ref_1.getProjectBySlugOrCanonical)(config, projectName, (0, slug_1.slugifyName)(projectName) === '' ? '' : (0, slug_1.buildProjectSlug)(projectName, 'production'));
|
|
435
424
|
productionExists = true;
|
|
436
425
|
productionSlug = prodResponse.data.slug || prodResponse.data.name;
|
|
437
426
|
}
|
|
@@ -441,8 +430,14 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
441
430
|
// Project doesn't exist yet — this is the normal first-deploy path.
|
|
442
431
|
// Do NOT print a warning here; the deploy proceeds to create/deploy successfully.
|
|
443
432
|
}
|
|
433
|
+
else if (error.response?.status === 401) {
|
|
434
|
+
// The key is rejected before the deploy even starts: name the host
|
|
435
|
+
// that refused it like every other command's 401.
|
|
436
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
437
|
+
process.exit(1);
|
|
438
|
+
}
|
|
444
439
|
else {
|
|
445
|
-
// 5xx, network error,
|
|
440
|
+
// 5xx, network error, etc. — fail conservatively rather
|
|
446
441
|
// than treating the project as non-existent and potentially creating it.
|
|
447
442
|
console.error(chalk_1.default.red('Failed to check project existence:'), error.response?.data?.message || error.message);
|
|
448
443
|
process.exit(1);
|
|
@@ -508,7 +503,7 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
508
503
|
const lookupSlug = environment === 'production'
|
|
509
504
|
? projectName
|
|
510
505
|
: `${projectName}-${environment}`;
|
|
511
|
-
const checkResponse = await getProjectBySlugOrCanonical(config, lookupSlug, (0, slug_1.slugifyName)(projectName) === '' ? '' : (0, slug_1.buildProjectSlug)(projectName, environment));
|
|
506
|
+
const checkResponse = await (0, project_ref_1.getProjectBySlugOrCanonical)(config, lookupSlug, (0, slug_1.slugifyName)(projectName) === '' ? '' : (0, slug_1.buildProjectSlug)(projectName, environment));
|
|
512
507
|
projectSlug = checkResponse.data.slug || checkResponse.data.name;
|
|
513
508
|
}
|
|
514
509
|
}
|
|
@@ -541,12 +536,20 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
541
536
|
envLabel = '';
|
|
542
537
|
console.log(chalk_1.default.blue(`Deploying to project "${projectName}" (production) instead.`));
|
|
543
538
|
}
|
|
539
|
+
else if (createError.response?.status === 401) {
|
|
540
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
541
|
+
process.exit(1);
|
|
542
|
+
}
|
|
544
543
|
else {
|
|
545
544
|
console.error(chalk_1.default.red('Failed to create project:'), createError.response?.data?.message || createError.message);
|
|
546
545
|
process.exit(1);
|
|
547
546
|
}
|
|
548
547
|
}
|
|
549
548
|
}
|
|
549
|
+
else if (error.response?.status === 401) {
|
|
550
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
551
|
+
process.exit(1);
|
|
552
|
+
}
|
|
550
553
|
else {
|
|
551
554
|
console.error(chalk_1.default.red('Failed to check project:'), error.response?.data?.message || error.message);
|
|
552
555
|
process.exit(1);
|
|
@@ -562,7 +565,12 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
562
565
|
await pushYamlDeclarations(config, projectSlug, yamlConfig);
|
|
563
566
|
}
|
|
564
567
|
catch (error) {
|
|
565
|
-
|
|
568
|
+
if (error.response?.status === 401) {
|
|
569
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
console.error(chalk_1.default.red(`Config sync FAILED: ${error.response?.data?.message || error.message}`));
|
|
573
|
+
}
|
|
566
574
|
process.exit(1);
|
|
567
575
|
}
|
|
568
576
|
console.log(chalk_1.default.green(`✓ Config synced for ${projectSlug}${envLabel}`));
|
|
@@ -619,7 +627,7 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
619
627
|
}
|
|
620
628
|
console.log(chalk_1.default.yellow('Uploading...'));
|
|
621
629
|
if (process.env.SOLIDACTIONS_DEPLOY_DEBUG === '1') {
|
|
622
|
-
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`);
|
|
623
631
|
}
|
|
624
632
|
const deployResponse = await axios_1.default.post(`${config.host}/api/v1/projects/${projectSlug}/deploy`, form, {
|
|
625
633
|
headers: {
|
|
@@ -639,7 +647,7 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
639
647
|
console.log(chalk_1.default.green('Deployment successfully queued!'));
|
|
640
648
|
console.log(chalk_1.default.yellow('Waiting for build to complete...\n'));
|
|
641
649
|
if (process.env.SOLIDACTIONS_DEPLOY_DEBUG === '1') {
|
|
642
|
-
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`);
|
|
643
651
|
}
|
|
644
652
|
// Poll for completion
|
|
645
653
|
let attempts = 0;
|
|
@@ -684,7 +692,12 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
684
692
|
await pushYamlDeclarations(config, projectSlug, yamlConfig);
|
|
685
693
|
}
|
|
686
694
|
catch (error) {
|
|
687
|
-
|
|
695
|
+
if (error.response?.status === 401) {
|
|
696
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
console.error(chalk_1.default.red(`Config sync FAILED: ${error.response?.data?.message || error.message}`));
|
|
700
|
+
}
|
|
688
701
|
cleanupArchive();
|
|
689
702
|
process.exit(1);
|
|
690
703
|
}
|
|
@@ -692,7 +705,7 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
692
705
|
if (yamlConfig && shouldPrintWebhookSecretNotice(yamlConfig.workflows ?? [])) {
|
|
693
706
|
const envFlag = environment !== 'dev' ? ` -e ${environment}` : '';
|
|
694
707
|
console.log('');
|
|
695
|
-
console.log(chalk_1.default.blue(`ℹ Webhook secret: run \`solidactions webhook secret ${projectName}${envFlag}\` to retrieve the generated secret.`));
|
|
708
|
+
console.log(chalk_1.default.blue(`ℹ Webhook secret: run \`solidactions webhook secret ${(0, slug_1.slugifyName)(projectName) || projectName}${envFlag}\` to retrieve the generated secret.`));
|
|
696
709
|
console.log(chalk_1.default.gray(` Set the same value in your sender (e.g. Telegram setWebhook secret_token).`));
|
|
697
710
|
}
|
|
698
711
|
if (options.paused) {
|
|
@@ -737,8 +750,11 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
737
750
|
if (error.response.status === 404) {
|
|
738
751
|
console.error("Project not found.");
|
|
739
752
|
}
|
|
753
|
+
else if (error.response.status === 401) {
|
|
754
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
755
|
+
}
|
|
740
756
|
else {
|
|
741
|
-
console.error(error.response.status,
|
|
757
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
742
758
|
}
|
|
743
759
|
}
|
|
744
760
|
else {
|
|
@@ -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}`));
|