@solidactions/cli 3.21.0 → 3.22.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 +3 -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-push.js +5 -2
- package/dist/commands/crew-env-set.js +2 -2
- package/dist/commands/deploy.js +41 -26
- package/dist/commands/doc-pull.js +432 -88
- 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 +8 -7
- 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/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 +3 -3
- package/dist/commands/workspaces.js +53 -2
- package/dist/utils/api.js +35 -2
- package/dist/utils/crew.js +6 -1
- package/dist/utils/project-ref.js +91 -0
- package/package.json +2 -2
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Prints a report distinguishing fully-published docs from "properties pending"
|
|
10
10
|
* ones (docs whose frontmatter properties couldn't be validated yet).
|
|
11
|
+
*
|
|
12
|
+
* Docs the push creates from untracked files are recorded in the directory's
|
|
13
|
+
* manifest (cli#157), so pushing again updates them by id instead of skipping
|
|
14
|
+
* them — but only when they landed in the manifest's own folder tree.
|
|
11
15
|
*/
|
|
12
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -123,7 +127,7 @@ function fileToItem(absPath, rootDir) {
|
|
|
123
127
|
const relDir = path_1.default.relative(rootDir, path_1.default.dirname(absPath));
|
|
124
128
|
// Use POSIX separators; omit if file is in the root dir
|
|
125
129
|
const relative_folder_path = relDir === '' ? undefined : relDir.split(path_1.default.sep).join('/');
|
|
126
|
-
const item = { title, body, _filePath: absPath };
|
|
130
|
+
const item = { title, body, _filePath: absPath, _hash: (0, docs_manifest_1.sha256Hex)(body) };
|
|
127
131
|
if (relative_folder_path !== undefined) {
|
|
128
132
|
item.relative_folder_path = relative_folder_path;
|
|
129
133
|
}
|
|
@@ -521,6 +525,15 @@ async function docPushWithConfig(dir, options, config) {
|
|
|
521
525
|
const onConflict = options.onConflict ?? 'skip';
|
|
522
526
|
const allResultRows = [];
|
|
523
527
|
let mergedSummary = {};
|
|
528
|
+
// cli#157: record what this push creates, so the next push updates it instead of skipping it.
|
|
529
|
+
// Only when the docs landed in the manifest's own folder tree.
|
|
530
|
+
// PM ruling 5: a single-file push records only into a manifest its directory already has.
|
|
531
|
+
const recordable = !options.dryRun
|
|
532
|
+
&& (manifest !== null || !singleFile)
|
|
533
|
+
&& (manifest === null || options.folder === undefined || options.folder === manifest.folder_path);
|
|
534
|
+
const recordTarget = recordable
|
|
535
|
+
? (manifest ?? { folder_path: options.folder ?? '', docs: {} })
|
|
536
|
+
: null;
|
|
524
537
|
for (const chunk of chunks) {
|
|
525
538
|
const callArgs = {
|
|
526
539
|
action: 'bulk_create',
|
|
@@ -566,14 +579,52 @@ async function docPushWithConfig(dir, options, config) {
|
|
|
566
579
|
const rows = data?.results ?? [];
|
|
567
580
|
const summary = data?.summary ?? {};
|
|
568
581
|
// Correlate rows back to source files using chunk index
|
|
582
|
+
const chunkResultRows = [];
|
|
569
583
|
for (const row of rows) {
|
|
570
584
|
const sourceFile = chunk[row.index]?._filePath ?? '(unknown)';
|
|
571
|
-
|
|
585
|
+
const resultRow = {
|
|
572
586
|
...row,
|
|
573
587
|
file: path_1.default.relative(absDir, sourceFile),
|
|
574
|
-
}
|
|
588
|
+
};
|
|
589
|
+
chunkResultRows.push(resultRow);
|
|
590
|
+
allResultRows.push(resultRow);
|
|
575
591
|
}
|
|
576
592
|
mergedSummary = mergeSummaries(mergedSummary, summary);
|
|
593
|
+
// Record and persist this chunk's successes before the next chunk is
|
|
594
|
+
// sent: a later chunk's failure exits first, and docs already created
|
|
595
|
+
// must still be updatable by id on the next push. The folder /
|
|
596
|
+
// dry-run / single-file guards and existing manifest entries are kept
|
|
597
|
+
// (recordTarget is null unless recording applies).
|
|
598
|
+
if (recordTarget !== null) {
|
|
599
|
+
let changed = false;
|
|
600
|
+
for (const row of chunkResultRows) {
|
|
601
|
+
if (!['created', 'renamed', 'overwritten'].includes(row.status) || row.id === undefined)
|
|
602
|
+
continue;
|
|
603
|
+
const snapshotHash = chunk[row.index]?._hash;
|
|
604
|
+
if (snapshotHash === undefined)
|
|
605
|
+
continue;
|
|
606
|
+
const relPath = row.file.split(path_1.default.sep).join('/');
|
|
607
|
+
if (row.status === 'renamed' && row.title) {
|
|
608
|
+
process.stderr.write(chalk_1.default.yellow(`${relPath}: created as "${row.title}" (the original title was taken); the next doc pull will name the local file after "${row.title}"\n`));
|
|
609
|
+
}
|
|
610
|
+
recordTarget.docs[relPath] = {
|
|
611
|
+
id: Number(row.id),
|
|
612
|
+
title: row.title ?? path_1.default.basename(relPath),
|
|
613
|
+
current_revision_id: row.current_revision_id ?? null,
|
|
614
|
+
media: false,
|
|
615
|
+
body_sha256: snapshotHash,
|
|
616
|
+
};
|
|
617
|
+
changed = true;
|
|
618
|
+
}
|
|
619
|
+
if (changed)
|
|
620
|
+
(0, docs_manifest_1.writeManifest)(absDir, recordTarget);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
// PM ruling 8: never dereference a missing manifest. The "went elsewhere" note is only for an
|
|
624
|
+
// existing manifest with a different --folder; a single-file push with no manifest stays quiet.
|
|
625
|
+
if (!options.dryRun && manifest !== null && options.folder !== undefined && options.folder !== manifest.folder_path
|
|
626
|
+
&& allResultRows.some((r) => ['created', 'renamed', 'overwritten'].includes(r.status))) {
|
|
627
|
+
process.stderr.write(chalk_1.default.yellow(`created docs were not recorded in ${docs_manifest_1.DOCS_MANIFEST}: they went to "${options.folder}", not "${manifest.folder_path}"\n`));
|
|
577
628
|
}
|
|
578
629
|
// Collect pending items (results that have property_validation)
|
|
579
630
|
const pendingItems = allResultRows
|
|
@@ -78,7 +78,10 @@ async function resolveReplaceTarget(config, replace) {
|
|
|
78
78
|
catch (error) {
|
|
79
79
|
const status = error.response?.status;
|
|
80
80
|
const code = error.response?.data?.code;
|
|
81
|
-
if (status ===
|
|
81
|
+
if (status === 401) {
|
|
82
|
+
console.error(chalk_1.default.red(`✗ ${(0, api_1.authFailedLine)(config.host)}`));
|
|
83
|
+
}
|
|
84
|
+
else if (status === 422 && code === 'folder_path_not_found') {
|
|
82
85
|
console.error(chalk_1.default.red(`✗ no folder "${folderPath}" in this workspace`));
|
|
83
86
|
}
|
|
84
87
|
else if (status === 404) {
|
|
@@ -159,7 +162,7 @@ async function docUpload(files, options = {}) {
|
|
|
159
162
|
console.error(chalk_1.default.red(`✗ ${displayName} — ${data?.message || 'File exceeds the maximum upload size (20MB).'}`));
|
|
160
163
|
}
|
|
161
164
|
else if (status === 401) {
|
|
162
|
-
console.error(chalk_1.default.red(`✗ ${displayName} —
|
|
165
|
+
console.error(chalk_1.default.red(`✗ ${displayName} — ${(0, api_1.authFailedLine)(config.host)}`));
|
|
163
166
|
}
|
|
164
167
|
else if (status === 404 && data?.code === 'media_not_found') {
|
|
165
168
|
console.error(chalk_1.default.red(`✗ ${displayName} — doc ${replaceDocId} is not a media doc`));
|
|
@@ -8,6 +8,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const prompts_1 = __importDefault(require("prompts"));
|
|
10
10
|
const api_1 = require("../utils/api");
|
|
11
|
+
const project_ref_1 = require("../utils/project-ref");
|
|
11
12
|
async function envDelete(keyOrProject, keyIfProject, options = {}) {
|
|
12
13
|
const config = await (0, api_1.requireConfigWithWorkspace)();
|
|
13
14
|
// Determine mode: if keyIfProject is provided, it's project mapping delete
|
|
@@ -15,11 +16,11 @@ async function envDelete(keyOrProject, keyIfProject, options = {}) {
|
|
|
15
16
|
const projectName = isProjectMode ? keyOrProject : undefined;
|
|
16
17
|
const key = isProjectMode ? keyIfProject : keyOrProject;
|
|
17
18
|
const environment = options.env ?? 'dev';
|
|
18
|
-
const projectSlug = projectName && environment === 'production' ? projectName : `${projectName}-${environment}`;
|
|
19
19
|
try {
|
|
20
20
|
if (isProjectMode) {
|
|
21
21
|
// Delete project variable
|
|
22
22
|
console.log(chalk_1.default.blue(`Deleting variable "${key}" from project "${projectName}" (${environment})...`));
|
|
23
|
+
const projectSlug = await (0, project_ref_1.resolveProjectSlug)(config, projectName, environment);
|
|
23
24
|
// First, get the variable to find its ID
|
|
24
25
|
const listResponse = await axios_1.default.get(`${config.host}/api/v1/projects/${projectSlug}/variable-mappings`, {
|
|
25
26
|
headers: (0, api_1.getApiHeaders)(config),
|
|
@@ -92,19 +93,25 @@ async function envDelete(keyOrProject, keyIfProject, options = {}) {
|
|
|
92
93
|
catch (error) {
|
|
93
94
|
if (error.response) {
|
|
94
95
|
if (error.response.status === 401) {
|
|
95
|
-
console.error(chalk_1.default.red(
|
|
96
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
96
97
|
}
|
|
97
98
|
else if (error.response.status === 404) {
|
|
98
99
|
if (isProjectMode) {
|
|
99
|
-
const
|
|
100
|
-
|
|
100
|
+
const family = await (0, api_1.lookupProjectFamilyEnvironments)(config, projectName);
|
|
101
|
+
const envs = family?.environments ?? [];
|
|
102
|
+
if (envs.length > 0 && !envs.includes(environment)) {
|
|
103
|
+
console.error(chalk_1.default.red(`Project "${projectName}" has no ${environment} environment (exists in: ${envs.join(', ')}).`));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(404, error.response.data)));
|
|
107
|
+
}
|
|
101
108
|
}
|
|
102
109
|
else {
|
|
103
110
|
console.error(chalk_1.default.red(`Variable "${key}" not found.`));
|
|
104
111
|
}
|
|
105
112
|
}
|
|
106
113
|
else {
|
|
107
|
-
console.error(chalk_1.default.red(
|
|
114
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
108
115
|
}
|
|
109
116
|
}
|
|
110
117
|
else {
|
|
@@ -7,6 +7,7 @@ exports.envList = envList;
|
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const api_1 = require("../utils/api");
|
|
10
|
+
const project_ref_1 = require("../utils/project-ref");
|
|
10
11
|
const table_1 = require("../utils/table");
|
|
11
12
|
/**
|
|
12
13
|
* Format a value for display, with inherited badge if applicable.
|
|
@@ -33,9 +34,7 @@ async function envList(projectName, options = {}) {
|
|
|
33
34
|
try {
|
|
34
35
|
if (projectName) {
|
|
35
36
|
// List project variable mappings
|
|
36
|
-
const projectSlug =
|
|
37
|
-
? projectName
|
|
38
|
-
: `${projectName}-${environment}`;
|
|
37
|
+
const projectSlug = await (0, project_ref_1.resolveProjectSlug)(config, projectName, environment);
|
|
39
38
|
const response = await axios_1.default.get(`${config.host}/api/v1/projects/${projectSlug}/variable-mappings`, {
|
|
40
39
|
headers: (0, api_1.getApiHeaders)(config),
|
|
41
40
|
});
|
|
@@ -207,15 +206,21 @@ async function envList(projectName, options = {}) {
|
|
|
207
206
|
catch (error) {
|
|
208
207
|
if (error.response) {
|
|
209
208
|
if (error.response.status === 401) {
|
|
210
|
-
console.error(chalk_1.default.red(
|
|
209
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
211
210
|
}
|
|
212
211
|
else if (error.response.status === 404) {
|
|
213
212
|
if (projectName) {
|
|
214
|
-
const
|
|
215
|
-
|
|
213
|
+
const family = await (0, api_1.lookupProjectFamilyEnvironments)(config, projectName);
|
|
214
|
+
const envs = family?.environments ?? [];
|
|
215
|
+
if (envs.length > 0 && !envs.includes(environment)) {
|
|
216
|
+
console.error(chalk_1.default.red(`Project "${projectName}" has no ${environment} environment (exists in: ${envs.join(', ')}).`));
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(404, error.response.data)));
|
|
220
|
+
}
|
|
216
221
|
}
|
|
217
222
|
else {
|
|
218
|
-
console.error(chalk_1.default.red(
|
|
223
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(404, error.response.data)));
|
|
219
224
|
}
|
|
220
225
|
}
|
|
221
226
|
else {
|
package/dist/commands/env-map.js
CHANGED
|
@@ -8,6 +8,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const prompts_1 = __importDefault(require("prompts"));
|
|
10
10
|
const api_1 = require("../utils/api");
|
|
11
|
+
const project_ref_1 = require("../utils/project-ref");
|
|
11
12
|
const env_1 = require("../utils/env");
|
|
12
13
|
async function envMap(projectName, projectKey, globalKey, options = {}) {
|
|
13
14
|
const config = await (0, api_1.requireConfigWithWorkspace)();
|
|
@@ -17,6 +18,7 @@ async function envMap(projectName, projectKey, globalKey, options = {}) {
|
|
|
17
18
|
}
|
|
18
19
|
console.log(chalk_1.default.blue(`Mapping global variable "${globalKey}" to project key "${projectKey}" in "${projectName}"...`));
|
|
19
20
|
try {
|
|
21
|
+
const projectSlug = await (0, project_ref_1.resolveProjectSlug)(config, projectName);
|
|
20
22
|
// First, get the global variable ID by key
|
|
21
23
|
const varsResponse = await axios_1.default.get(`${config.host}/api/v1/variables`, {
|
|
22
24
|
headers: (0, api_1.getApiHeaders)(config),
|
|
@@ -30,7 +32,7 @@ async function envMap(projectName, projectKey, globalKey, options = {}) {
|
|
|
30
32
|
}
|
|
31
33
|
// Check if project key already has a mapping
|
|
32
34
|
if (!options.yes) {
|
|
33
|
-
const mappingsResponse = await axios_1.default.get(`${config.host}/api/v1/projects/${
|
|
35
|
+
const mappingsResponse = await axios_1.default.get(`${config.host}/api/v1/projects/${projectSlug}/variable-mappings`, { headers: (0, api_1.getApiHeaders)(config) });
|
|
34
36
|
const mappings = mappingsResponse.data || [];
|
|
35
37
|
const existing = mappings.find((m) => m.env_name === projectKey);
|
|
36
38
|
if (existing && (existing.has_value || existing.global_variable_id)) {
|
|
@@ -51,7 +53,7 @@ async function envMap(projectName, projectKey, globalKey, options = {}) {
|
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
// Create the mapping
|
|
54
|
-
await axios_1.default.post(`${config.host}/api/v1/projects/${
|
|
56
|
+
await axios_1.default.post(`${config.host}/api/v1/projects/${projectSlug}/variable-mappings`, {
|
|
55
57
|
project_key: projectKey,
|
|
56
58
|
global_variable_id: globalVar.id,
|
|
57
59
|
}, {
|
|
@@ -63,16 +65,16 @@ async function envMap(projectName, projectKey, globalKey, options = {}) {
|
|
|
63
65
|
catch (error) {
|
|
64
66
|
if (error.response) {
|
|
65
67
|
if (error.response.status === 401) {
|
|
66
|
-
console.error(chalk_1.default.red(
|
|
68
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
67
69
|
}
|
|
68
70
|
else if (error.response.status === 404) {
|
|
69
71
|
console.error(chalk_1.default.red(`Project "${projectName}" not found.`));
|
|
70
72
|
}
|
|
71
73
|
else if (error.response.status === 422) {
|
|
72
|
-
console.error(chalk_1.default.red('Validation error:'),
|
|
74
|
+
console.error(chalk_1.default.red('Validation error:'), (0, api_1.formatValidationError)(error.response.data));
|
|
73
75
|
}
|
|
74
76
|
else {
|
|
75
|
-
console.error(chalk_1.default.red(
|
|
77
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
else {
|
|
@@ -11,6 +11,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
11
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
12
12
|
const readline_1 = __importDefault(require("readline"));
|
|
13
13
|
const api_1 = require("../utils/api");
|
|
14
|
+
const project_ref_1 = require("../utils/project-ref");
|
|
14
15
|
const secure_write_1 = require("../utils/secure-write");
|
|
15
16
|
/**
|
|
16
17
|
* Prompt the user for confirmation (unless --yes flag is set).
|
|
@@ -75,15 +76,13 @@ function databaseDisplayName(variable) {
|
|
|
75
76
|
async function envPull(projectName, options = {}) {
|
|
76
77
|
const config = await (0, api_1.requireConfigWithWorkspace)();
|
|
77
78
|
const environment = options.env || 'dev';
|
|
78
|
-
// Build the project slug for lookup
|
|
79
|
-
const projectSlug = environment === 'production'
|
|
80
|
-
? projectName
|
|
81
|
-
: `${projectName}-${environment}`;
|
|
82
79
|
// Determine output file
|
|
83
80
|
const outputFile = options.output || (environment === 'production' ? '.env' : `.env.${environment}`);
|
|
84
81
|
const outputPath = path_1.default.resolve(outputFile);
|
|
85
82
|
console.log(chalk_1.default.blue(`Pulling variables from "${projectName}" (${environment})...`));
|
|
83
|
+
let projectSlug = '';
|
|
86
84
|
try {
|
|
85
|
+
projectSlug = await (0, project_ref_1.resolveProjectSlug)(config, projectName, environment);
|
|
87
86
|
// First, check if there are any secrets
|
|
88
87
|
const checkResponse = await axios_1.default.get(`${config.host}/api/v1/projects/${projectSlug}/variable-mappings?resolve_oauth=true`, {
|
|
89
88
|
headers: (0, api_1.getApiHeaders)(config),
|
|
@@ -299,7 +298,7 @@ async function envPull(projectName, options = {}) {
|
|
|
299
298
|
catch (error) {
|
|
300
299
|
if (error.response) {
|
|
301
300
|
if (error.response.status === 401) {
|
|
302
|
-
console.error(chalk_1.default.red(
|
|
301
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
303
302
|
}
|
|
304
303
|
else if (error.response.status === 404) {
|
|
305
304
|
console.error(chalk_1.default.red(`Project "${projectSlug}" not found.`));
|
|
@@ -319,7 +318,7 @@ async function envPull(projectName, options = {}) {
|
|
|
319
318
|
console.error(chalk_1.default.red(detail ? `${lead}\n\n${detail}` : lead));
|
|
320
319
|
}
|
|
321
320
|
else {
|
|
322
|
-
console.error(chalk_1.default.red(
|
|
321
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
323
322
|
}
|
|
324
323
|
}
|
|
325
324
|
else if (!axios_1.default.isAxiosError(error) && error.code) {
|
|
@@ -10,6 +10,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
const prompts_1 = __importDefault(require("prompts"));
|
|
12
12
|
const api_1 = require("../utils/api");
|
|
13
|
+
const project_ref_1 = require("../utils/project-ref");
|
|
13
14
|
const env_1 = require("../utils/env");
|
|
14
15
|
async function envPush(projectName, sourcePath, options = {}) {
|
|
15
16
|
const config = await (0, api_1.requireConfigWithWorkspace)();
|
|
@@ -81,14 +82,12 @@ async function envPush(projectName, sourcePath, options = {}) {
|
|
|
81
82
|
`Rename them (e.g. "${reservedKeys[0].replace(/^SOLIDACTIONS_/, 'MY_')}") and retry. Nothing was pushed.`));
|
|
82
83
|
process.exit(1);
|
|
83
84
|
}
|
|
84
|
-
// Build project slug
|
|
85
|
-
const projectSlug = environment === 'production'
|
|
86
|
-
? projectName
|
|
87
|
-
: `${projectName}-${environment}`;
|
|
88
85
|
console.log(chalk_1.default.blue(`Pushing variables to "${projectName}" (${environment})...`));
|
|
89
86
|
// Fetch current server state
|
|
90
87
|
let serverMappings = [];
|
|
88
|
+
let projectSlug = '';
|
|
91
89
|
try {
|
|
90
|
+
projectSlug = await (0, project_ref_1.resolveProjectSlug)(config, projectName, environment);
|
|
92
91
|
const response = await axios_1.default.get(`${config.host}/api/v1/projects/${projectSlug}/variable-mappings`, {
|
|
93
92
|
headers: (0, api_1.getApiHeaders)(config),
|
|
94
93
|
});
|
|
@@ -96,7 +95,7 @@ async function envPush(projectName, sourcePath, options = {}) {
|
|
|
96
95
|
}
|
|
97
96
|
catch (error) {
|
|
98
97
|
if (error.response?.status === 401) {
|
|
99
|
-
console.error(chalk_1.default.red(
|
|
98
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
100
99
|
process.exit(1);
|
|
101
100
|
}
|
|
102
101
|
else if (error.response?.status === 404) {
|
|
@@ -200,7 +199,12 @@ async function envPush(projectName, sourcePath, options = {}) {
|
|
|
200
199
|
console.log(chalk_1.default.gray(` ${created} created, ${updated} updated` + (toSkip.length > 0 ? `, ${toSkip.length} skipped` : '')));
|
|
201
200
|
}
|
|
202
201
|
catch (error) {
|
|
203
|
-
|
|
202
|
+
if (error.response?.status === 401) {
|
|
203
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
console.error(chalk_1.default.red('Failed to push variables:'), error.response?.data?.message || error.message);
|
|
207
|
+
}
|
|
204
208
|
process.exit(1);
|
|
205
209
|
}
|
|
206
210
|
}
|
|
@@ -7,6 +7,7 @@ exports.envReset = envReset;
|
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const api_1 = require("../utils/api");
|
|
10
|
+
const project_ref_1 = require("../utils/project-ref");
|
|
10
11
|
function describeRestoredSource(mapping) {
|
|
11
12
|
const sourceType = mapping.source_type || mapping.source || 'unknown';
|
|
12
13
|
if (sourceType === 'oauth_connection') {
|
|
@@ -22,10 +23,8 @@ function describeRestoredSource(mapping) {
|
|
|
22
23
|
async function envReset(projectName, key, options = {}) {
|
|
23
24
|
const config = await (0, api_1.requireConfigWithWorkspace)();
|
|
24
25
|
const environment = options.env || 'dev';
|
|
25
|
-
const projectSlug = environment === 'production'
|
|
26
|
-
? projectName
|
|
27
|
-
: `${projectName}-${environment}`;
|
|
28
26
|
try {
|
|
27
|
+
const projectSlug = await (0, project_ref_1.resolveProjectSlug)(config, projectName, environment);
|
|
29
28
|
const listResponse = await axios_1.default.get(`${config.host}/api/v1/projects/${projectSlug}/variable-mappings`, { headers: (0, api_1.getApiHeaders)(config) });
|
|
30
29
|
const mappings = listResponse.data || [];
|
|
31
30
|
const mapping = mappings.find((candidate) => candidate.env_name === key);
|
|
@@ -41,15 +40,20 @@ async function envReset(projectName, key, options = {}) {
|
|
|
41
40
|
catch (error) {
|
|
42
41
|
if (error.response) {
|
|
43
42
|
if (error.response.status === 401) {
|
|
44
|
-
console.error(chalk_1.default.red(
|
|
43
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
45
44
|
}
|
|
46
45
|
else if (error.response.status === 404) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const family = await (0, api_1.lookupProjectFamilyEnvironments)(config, projectName);
|
|
47
|
+
const envs = family?.environments ?? [];
|
|
48
|
+
if (envs.length > 0 && !envs.includes(environment)) {
|
|
49
|
+
console.error(chalk_1.default.red(`Project "${projectName}" has no ${environment} environment (exists in: ${envs.join(', ')}).`));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(404, error.response.data)));
|
|
53
|
+
}
|
|
50
54
|
}
|
|
51
55
|
else {
|
|
52
|
-
console.error(chalk_1.default.red(
|
|
56
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
else {
|
package/dist/commands/env-set.js
CHANGED
|
@@ -10,6 +10,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
const prompts_1 = __importDefault(require("prompts"));
|
|
12
12
|
const api_1 = require("../utils/api");
|
|
13
|
+
const project_ref_1 = require("../utils/project-ref");
|
|
13
14
|
const env_1 = require("../utils/env");
|
|
14
15
|
/** Returns true when stdin is not an interactive terminal (CI, pipes, scripts). */
|
|
15
16
|
function isNonTty() {
|
|
@@ -63,13 +64,10 @@ async function envSet(keyOrProject, valueOrKey, valueIfProject, options = {}) {
|
|
|
63
64
|
process.exit(1);
|
|
64
65
|
}
|
|
65
66
|
const environment = options.env || 'dev';
|
|
66
|
-
// Build project slug
|
|
67
|
-
const projectSlug = environment === 'production'
|
|
68
|
-
? projectName
|
|
69
|
-
: `${projectName}-${environment}`;
|
|
70
67
|
// Auto-detect secrets
|
|
71
68
|
const isSecret = options.secret || /secret|key|token|password|credential/i.test(key);
|
|
72
69
|
try {
|
|
70
|
+
const projectSlug = await (0, project_ref_1.resolveProjectSlug)(config, projectName, environment);
|
|
73
71
|
if (isOauthConnectionMode) {
|
|
74
72
|
await axios_1.default.post(`${config.host}/api/v1/projects/${projectSlug}/variable-mappings`, {
|
|
75
73
|
project_key: key,
|
|
@@ -126,18 +124,24 @@ async function envSet(keyOrProject, valueOrKey, valueIfProject, options = {}) {
|
|
|
126
124
|
catch (error) {
|
|
127
125
|
if (error.response) {
|
|
128
126
|
if (error.response.status === 401) {
|
|
129
|
-
console.error(chalk_1.default.red(
|
|
127
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
130
128
|
}
|
|
131
129
|
else if (error.response.status === 404) {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
const family = await (0, api_1.lookupProjectFamilyEnvironments)(config, projectName);
|
|
131
|
+
const envs = family?.environments ?? [];
|
|
132
|
+
if (envs.length > 0 && !envs.includes(environment)) {
|
|
133
|
+
console.error(chalk_1.default.red(`Project "${projectName}" has no ${environment} environment (exists in: ${envs.join(', ')}).`
|
|
134
|
+
+ `\nRun 'solidactions project deploy ${projectName} -e ${environment} --create' first.`));
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(404, error.response.data)));
|
|
138
|
+
}
|
|
135
139
|
}
|
|
136
140
|
else if (error.response.status === 422) {
|
|
137
141
|
console.error(chalk_1.default.red((0, api_1.formatValidationError)(error.response.data)));
|
|
138
142
|
}
|
|
139
143
|
else {
|
|
140
|
-
console.error(chalk_1.default.red(
|
|
144
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
else {
|
|
@@ -249,13 +253,13 @@ async function envSet(keyOrProject, valueOrKey, valueIfProject, options = {}) {
|
|
|
249
253
|
catch (error) {
|
|
250
254
|
if (error.response) {
|
|
251
255
|
if (error.response.status === 401) {
|
|
252
|
-
console.error(chalk_1.default.red(
|
|
256
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
253
257
|
}
|
|
254
258
|
else if (error.response.status === 422) {
|
|
255
259
|
console.error(chalk_1.default.red((0, api_1.formatValidationError)(error.response.data)));
|
|
256
260
|
}
|
|
257
261
|
else {
|
|
258
|
-
console.error(chalk_1.default.red(
|
|
262
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
259
263
|
}
|
|
260
264
|
}
|
|
261
265
|
else {
|
package/dist/commands/login.js
CHANGED
|
@@ -451,15 +451,16 @@ function whoami() {
|
|
|
451
451
|
return chalk_1.default.gray('(unset)');
|
|
452
452
|
return chalk_1.default.gray(`(from ${src})`);
|
|
453
453
|
};
|
|
454
|
-
const
|
|
455
|
-
|
|
456
|
-
|
|
454
|
+
const workspaceName = config.workspace ?? config.workspaceId;
|
|
455
|
+
const workspaceLabel = !config.workspaceId && !config.workspace
|
|
456
|
+
? ''
|
|
457
|
+
: !config.workspace
|
|
457
458
|
? `${config.workspaceId} (slug unknown — run 'workspace set <slug>' to populate)`
|
|
458
|
-
:
|
|
459
|
-
|
|
460
|
-
|
|
459
|
+
: config.workspaceOrg
|
|
460
|
+
? `${workspaceName} — organization ${config.workspaceOrg}${config.workspaceId ? ` (${config.workspaceId})` : ''}`
|
|
461
|
+
: `${workspaceName}${config.workspaceId ? ` (${config.workspaceId})` : ''}`;
|
|
461
462
|
console.log(chalk_1.default.blue('Current configuration:'));
|
|
462
463
|
console.log(` Host: ${config.host.padEnd(50)} ${fmt(sources.host)}`);
|
|
463
464
|
console.log(` API Key: ${maskedKey.padEnd(50)} ${fmt(sources.apiKey)}`);
|
|
464
|
-
console.log(` Workspace: ${workspaceLabel.padEnd(50)} ${fmt(sources.workspaceId)}
|
|
465
|
+
console.log(` Workspace: ${workspaceLabel.padEnd(50)} ${fmt(sources.workspaceId)}`);
|
|
465
466
|
}
|
|
@@ -38,10 +38,10 @@ async function oauthActionList(platform, options) {
|
|
|
38
38
|
console.error(chalk_1.default.red(`Unknown platform "${platform}". Run \`solidactions oauth-action platforms\` to see available platforms.`));
|
|
39
39
|
}
|
|
40
40
|
else if (error.response?.status === 401) {
|
|
41
|
-
console.error(chalk_1.default.red(
|
|
41
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
42
42
|
}
|
|
43
43
|
else if (error.response) {
|
|
44
|
-
console.error(chalk_1.default.red(
|
|
44
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
47
|
console.error(chalk_1.default.red('Connection failed:'), error.message);
|
|
@@ -28,10 +28,10 @@ async function oauthActionPlatforms(options) {
|
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
30
30
|
if (error.response?.status === 401) {
|
|
31
|
-
console.error(chalk_1.default.red(
|
|
31
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
32
32
|
}
|
|
33
33
|
else if (error.response) {
|
|
34
|
-
console.error(chalk_1.default.red(
|
|
34
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
console.error(chalk_1.default.red('Connection failed:'), error.message);
|
|
@@ -49,10 +49,10 @@ async function oauthActionSearch(platform, query, options) {
|
|
|
49
49
|
console.error(chalk_1.default.red(`Unknown platform "${platform}". Run \`solidactions oauth-action platforms\` to see available platforms.`));
|
|
50
50
|
}
|
|
51
51
|
else if (error.response?.status === 401) {
|
|
52
|
-
console.error(chalk_1.default.red(
|
|
52
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
53
53
|
}
|
|
54
54
|
else if (error.response) {
|
|
55
|
-
console.error(chalk_1.default.red(
|
|
55
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
58
|
console.error(chalk_1.default.red('Connection failed:'), error.message);
|
|
@@ -26,10 +26,10 @@ async function oauthActionView(platform, actionId, options) {
|
|
|
26
26
|
console.error(chalk_1.default.red(`Action not found: ${platform}/${actionId}`));
|
|
27
27
|
}
|
|
28
28
|
else if (error.response?.status === 401) {
|
|
29
|
-
console.error(chalk_1.default.red(
|
|
29
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
30
30
|
}
|
|
31
31
|
else if (error.response) {
|
|
32
|
-
console.error(chalk_1.default.red(
|
|
32
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
console.error(chalk_1.default.red('Connection failed:'), error.message);
|
|
@@ -45,7 +45,7 @@ async function projectCreateWithConfig(name, options, config) {
|
|
|
45
45
|
catch (error) {
|
|
46
46
|
if (error.response) {
|
|
47
47
|
if (error.response.status === 401) {
|
|
48
|
-
console.error(chalk_1.default.red(
|
|
48
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
console.error(chalk_1.default.red('Failed to create project:'), error.response.data?.message || error.message);
|
|
@@ -68,10 +68,10 @@ async function projectList(options = {}) {
|
|
|
68
68
|
catch (error) {
|
|
69
69
|
if (error.response) {
|
|
70
70
|
if (error.response.status === 401) {
|
|
71
|
-
console.error(chalk_1.default.red(
|
|
71
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
|
-
console.error(chalk_1.default.red(
|
|
74
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
@@ -9,6 +9,7 @@ exports.logsBuild = logsBuild;
|
|
|
9
9
|
const axios_1 = __importDefault(require("axios"));
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
const api_1 = require("../utils/api");
|
|
12
|
+
const project_ref_1 = require("../utils/project-ref");
|
|
12
13
|
function buildBuildLogUrl(host, projectName, environment) {
|
|
13
14
|
if (environment) {
|
|
14
15
|
return `${host}/api/v1/projects/resolve/build-log`;
|
|
@@ -27,8 +28,11 @@ function buildBuildLogRequest(host, projectName, environment) {
|
|
|
27
28
|
async function logsBuild(projectName, environment) {
|
|
28
29
|
const config = await (0, api_1.requireConfigWithWorkspace)();
|
|
29
30
|
console.log(chalk_1.default.blue(`Fetching build logs for project "${projectName}"...`));
|
|
30
|
-
const { url, params } = buildBuildLogRequest(config.host, projectName, environment);
|
|
31
31
|
try {
|
|
32
|
+
// Only the path without -e resolves here; the -e path already asks
|
|
33
|
+
// the server to resolve the name.
|
|
34
|
+
const name = environment === undefined ? await (0, project_ref_1.resolveProjectSlug)(config, projectName) : projectName;
|
|
35
|
+
const { url, params } = buildBuildLogRequest(config.host, name, environment);
|
|
32
36
|
const response = await axios_1.default.get(url, {
|
|
33
37
|
headers: (0, api_1.getApiHeaders)(config),
|
|
34
38
|
params,
|
|
@@ -45,7 +49,7 @@ async function logsBuild(projectName, environment) {
|
|
|
45
49
|
catch (error) {
|
|
46
50
|
if (error.response) {
|
|
47
51
|
if (error.response.status === 401) {
|
|
48
|
-
console.error(chalk_1.default.red(
|
|
52
|
+
console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
|
|
49
53
|
}
|
|
50
54
|
else if (error.response.status === 404) {
|
|
51
55
|
console.error(chalk_1.default.red(error.response.data?.message ?? `Project "${projectName}" not found.`));
|
|
@@ -55,7 +59,7 @@ async function logsBuild(projectName, environment) {
|
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
else {
|
|
58
|
-
console.error(chalk_1.default.red(
|
|
62
|
+
console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
else {
|