@solidactions/cli 3.10.2 → 3.11.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 +2 -2
- package/dist/command-manifest.json +13 -1
- package/dist/commands/project-view.js +51 -6
- package/dist/commands/run-list.js +5 -23
- package/dist/commands/run-view.js +7 -0
- package/dist/index.js +1 -0
- package/dist/utils/source-provenance.js +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -237,7 +237,7 @@ Use `solidactions <command> --help` for full flag details on any command.
|
|
|
237
237
|
| `project deploy <name> [path]` | `-e`, `--create`, `--config-only`, `--paused`, `--no-git-metadata` | Deploy or sync config only; optionally land YAML schedules paused |
|
|
238
238
|
| `project enable <project>` | `-e` (default `dev`) | Allow new starts through this project gate |
|
|
239
239
|
| `project disable <project>` | `-e` (default `dev`) | Block new root starts without cancelling existing roots |
|
|
240
|
-
| `project view <project>` | `-e` (default `dev`) | View status, `Enabled: on|off`, and client-reported deployed revision |
|
|
240
|
+
| `project view <project>` | `-e` (default `dev`), `--json` | View status, `Enabled: on|off`, and client-reported deployed revision, incl. an `N behind origin/<branch> at deploy` drift clause when the deployment is behind the default branch |
|
|
241
241
|
| `project pull <name> [path]` | `-y` | Pull source (warns before overwriting) |
|
|
242
242
|
| `project logs <name>` | | View build logs |
|
|
243
243
|
| `project list` | `--json` | List project families; environments render as `environment:on/off` |
|
|
@@ -277,7 +277,7 @@ its project or schedule.
|
|
|
277
277
|
|---------|-----------|-------------|
|
|
278
278
|
| `run start <project> <workflow>` | `-e`, `-i`, `--wait` | Trigger a workflow run |
|
|
279
279
|
| `run list [project]` | `--json`, `--detailed`, `--status`, `--since`, `--workflow`, `--limit`, `--offset` | List and filter runs |
|
|
280
|
-
| `run view <run-id>` | `--json`, `--timeline`, `--steps`, `--logs` | Inspect a run |
|
|
280
|
+
| `run view <run-id>` | `--json`, `--timeline`, `--steps`, `--logs` | Inspect a run, incl. the deployed revision (`Revision (latest session): ...`, or `deployed_revision` under `--json`) |
|
|
281
281
|
|
|
282
282
|
### env
|
|
283
283
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
3
|
"cli_name": "solidactions",
|
|
4
|
-
"cli_version": "3.
|
|
4
|
+
"cli_version": "3.11.0",
|
|
5
5
|
"global_options": [
|
|
6
6
|
{
|
|
7
7
|
"flags": "-V, --version",
|
|
@@ -985,6 +985,18 @@
|
|
|
985
985
|
"hidden": false,
|
|
986
986
|
"default": "dev"
|
|
987
987
|
},
|
|
988
|
+
{
|
|
989
|
+
"flags": "--json",
|
|
990
|
+
"long": "--json",
|
|
991
|
+
"short": null,
|
|
992
|
+
"description": "Output as JSON",
|
|
993
|
+
"required": false,
|
|
994
|
+
"value_required": false,
|
|
995
|
+
"value_optional": false,
|
|
996
|
+
"variadic": false,
|
|
997
|
+
"negated": false,
|
|
998
|
+
"hidden": false
|
|
999
|
+
},
|
|
988
1000
|
{
|
|
989
1001
|
"flags": "-h, --help",
|
|
990
1002
|
"long": "--help",
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.projectViewJsonProjection = projectViewJsonProjection;
|
|
6
7
|
exports.projectSlugForView = projectSlugForView;
|
|
7
8
|
exports.formatDeploymentRevision = formatDeploymentRevision;
|
|
8
9
|
exports.formatProjectView = formatProjectView;
|
|
@@ -13,6 +14,47 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
13
14
|
const api_1 = require("../utils/api");
|
|
14
15
|
const slug_1 = require("../utils/slug");
|
|
15
16
|
const source_provenance_1 = require("../utils/source-provenance");
|
|
17
|
+
/**
|
|
18
|
+
* Projects exactly the fields `DeploymentDetail` declares.
|
|
19
|
+
*
|
|
20
|
+
* The server's DeploymentResource serializes more than this — `failure_reason`
|
|
21
|
+
* today, more tomorrow — and that field is always null for a *successful*
|
|
22
|
+
* deployment, which is the only kind this endpoint returns here. Listing the
|
|
23
|
+
* fields explicitly keeps `--json` a documented contract instead of a mirror of
|
|
24
|
+
* whatever the API happens to add next.
|
|
25
|
+
*/
|
|
26
|
+
function deploymentJsonProjection(deployment) {
|
|
27
|
+
return {
|
|
28
|
+
id: deployment.id,
|
|
29
|
+
status: deployment.status,
|
|
30
|
+
source_hash: deployment.source_hash,
|
|
31
|
+
metadata_source: deployment.metadata_source ?? null,
|
|
32
|
+
commit_sha: deployment.commit_sha ?? null,
|
|
33
|
+
short_sha: deployment.short_sha ?? null,
|
|
34
|
+
branch: deployment.branch ?? null,
|
|
35
|
+
tag: deployment.tag ?? null,
|
|
36
|
+
commit_subject: deployment.commit_subject ?? null,
|
|
37
|
+
commit_author_date: deployment.commit_author_date ?? null,
|
|
38
|
+
remote_url: deployment.remote_url ?? null,
|
|
39
|
+
dirty: deployment.dirty ?? null,
|
|
40
|
+
default_branch: deployment.default_branch ?? null,
|
|
41
|
+
default_branch_sha: deployment.default_branch_sha ?? null,
|
|
42
|
+
commits_behind: deployment.commits_behind ?? null,
|
|
43
|
+
completed_at: deployment.completed_at ?? null,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function projectViewJsonProjection(project) {
|
|
47
|
+
const deployment = project.latest_successful_deployment ?? null;
|
|
48
|
+
return {
|
|
49
|
+
slug: project.slug ?? null,
|
|
50
|
+
name: project.name ?? null,
|
|
51
|
+
status: project.status ?? null,
|
|
52
|
+
enabled: project.enabled ?? null,
|
|
53
|
+
deployed_hash: project.deployed_hash ?? null,
|
|
54
|
+
deployment_matches_deployed_hash: project.deployment_matches_deployed_hash ?? false,
|
|
55
|
+
latest_successful_deployment: deployment === null ? null : deploymentJsonProjection(deployment),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
16
58
|
function projectSlugForView(project, environment) {
|
|
17
59
|
if (environment === undefined) {
|
|
18
60
|
return project;
|
|
@@ -39,9 +81,7 @@ function metadataSourceLabel(source) {
|
|
|
39
81
|
return safe ? labels[safe] ?? safe : null;
|
|
40
82
|
}
|
|
41
83
|
function formatDeploymentRevision(deployment) {
|
|
42
|
-
|
|
43
|
-
?? (0, source_provenance_1.sanitizeDisplayText)(deployment.commit_sha, 64);
|
|
44
|
-
if (!sha) {
|
|
84
|
+
if ((0, source_provenance_1.revisionSha)(deployment) === null) {
|
|
45
85
|
const archiveHash = (0, source_provenance_1.sanitizeDisplayText)(deployment.source_hash, 64);
|
|
46
86
|
return [
|
|
47
87
|
'No source revision was reported.',
|
|
@@ -49,7 +89,7 @@ function formatDeploymentRevision(deployment) {
|
|
|
49
89
|
];
|
|
50
90
|
}
|
|
51
91
|
const lines = [
|
|
52
|
-
`Revision (Client-reported): ${(0, source_provenance_1.
|
|
92
|
+
`Revision (Client-reported): ${(0, source_provenance_1.formatDetailedRevision)(deployment)}`,
|
|
53
93
|
];
|
|
54
94
|
const source = metadataSourceLabel(deployment.metadata_source);
|
|
55
95
|
if (source) {
|
|
@@ -112,8 +152,13 @@ async function projectViewWithConfig(project, options, config, writeLine = conso
|
|
|
112
152
|
}
|
|
113
153
|
try {
|
|
114
154
|
const response = await axios_1.default.get(`${config.host}/api/v1/projects/${encodeURIComponent(slug)}?include=deployment`, { headers: (0, api_1.getApiHeaders)(config) });
|
|
115
|
-
|
|
116
|
-
writeLine(
|
|
155
|
+
if (options.json) {
|
|
156
|
+
writeLine(JSON.stringify(projectViewJsonProjection(response.data), null, 2));
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
for (const line of formatProjectView(response.data)) {
|
|
160
|
+
writeLine(line);
|
|
161
|
+
}
|
|
117
162
|
}
|
|
118
163
|
}
|
|
119
164
|
catch (error) {
|
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatDetailedRevision = void 0;
|
|
6
7
|
exports.buildRunListParams = buildRunListParams;
|
|
7
8
|
exports.runs = runs;
|
|
8
9
|
exports.summaryStatusLabel = summaryStatusLabel;
|
|
9
10
|
exports.detailedOutcomeTag = detailedOutcomeTag;
|
|
10
11
|
exports.formatRevisionCell = formatRevisionCell;
|
|
11
|
-
exports.formatDetailedRevision = formatDetailedRevision;
|
|
12
12
|
exports.displaySummaryTable = displaySummaryTable;
|
|
13
13
|
exports.displayDetailedList = displayDetailedList;
|
|
14
14
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -16,6 +16,8 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
16
16
|
const api_1 = require("../utils/api");
|
|
17
17
|
const table_1 = require("../utils/table");
|
|
18
18
|
const source_provenance_1 = require("../utils/source-provenance");
|
|
19
|
+
var source_provenance_2 = require("../utils/source-provenance");
|
|
20
|
+
Object.defineProperty(exports, "formatDetailedRevision", { enumerable: true, get: function () { return source_provenance_2.formatDetailedRevision; } });
|
|
19
21
|
/**
|
|
20
22
|
* Build the params object for GET /api/v1/runs.
|
|
21
23
|
* Extracted as a pure function so it can be unit-tested without mocking axios.
|
|
@@ -126,14 +128,8 @@ function detailedOutcomeTag(run) {
|
|
|
126
128
|
return ' [DEGRADED]';
|
|
127
129
|
return '';
|
|
128
130
|
}
|
|
129
|
-
function revisionSha(revision) {
|
|
130
|
-
if (!revision)
|
|
131
|
-
return null;
|
|
132
|
-
return (0, source_provenance_1.sanitizeDisplayText)(revision.short_sha, 16)
|
|
133
|
-
?? (0, source_provenance_1.sanitizeDisplayText)(revision.commit_sha, 64);
|
|
134
|
-
}
|
|
135
131
|
function formatRevisionCell(revision) {
|
|
136
|
-
const sha = revisionSha(revision);
|
|
132
|
+
const sha = (0, source_provenance_1.revisionSha)(revision);
|
|
137
133
|
if (!sha)
|
|
138
134
|
return '-';
|
|
139
135
|
const dirty = revision?.dirty === true ? '*' : revision?.dirty === false ? '' : '?';
|
|
@@ -144,20 +140,6 @@ function formatRevisionCell(revision) {
|
|
|
144
140
|
: '';
|
|
145
141
|
return (0, table_1.sanitizeCell)(`${sha}${dirty}${behind}`);
|
|
146
142
|
}
|
|
147
|
-
function formatDetailedRevision(revision) {
|
|
148
|
-
const sha = revisionSha(revision);
|
|
149
|
-
if (!sha)
|
|
150
|
-
return 'unknown';
|
|
151
|
-
const states = [revision?.dirty === true
|
|
152
|
-
? 'DIRTY'
|
|
153
|
-
: revision?.dirty === false ? 'clean' : 'dirty state unknown'];
|
|
154
|
-
const branch = (0, source_provenance_1.sanitizeDisplayText)(revision?.default_branch, 255);
|
|
155
|
-
if (branch && typeof revision?.commits_behind === 'number'
|
|
156
|
-
&& Number.isSafeInteger(revision.commits_behind) && revision.commits_behind > 0) {
|
|
157
|
-
states.push(`${revision.commits_behind} behind origin/${branch} at deploy`);
|
|
158
|
-
}
|
|
159
|
-
return (0, table_1.sanitizeCell)(`${sha} (${states.join(', ')})`);
|
|
160
|
-
}
|
|
161
143
|
function displaySummaryTable(runsList, projectName) {
|
|
162
144
|
const header = projectName ? `Recent runs for "${projectName}":` : 'Recent runs:';
|
|
163
145
|
console.log(chalk_1.default.blue(header));
|
|
@@ -208,7 +190,7 @@ function displayDetailedList(runsList, projectName) {
|
|
|
208
190
|
console.log(` Status: ${statusColor(status)}${chalk_1.default.gray(exitStr)}`);
|
|
209
191
|
console.log(` Trigger: ${chalk_1.default.gray(run.triggered_by || '-')}`);
|
|
210
192
|
if (Object.prototype.hasOwnProperty.call(run, 'deployed_revision')) {
|
|
211
|
-
console.log(` Revision (latest session): ${chalk_1.default.gray(formatDetailedRevision(run.deployed_revision))}`);
|
|
193
|
+
console.log(` Revision (latest session): ${chalk_1.default.gray((0, source_provenance_1.formatDetailedRevision)(run.deployed_revision))}`);
|
|
212
194
|
}
|
|
213
195
|
// Timeline
|
|
214
196
|
if (run.timeline) {
|
|
@@ -11,6 +11,7 @@ exports.errorMessage = errorMessage;
|
|
|
11
11
|
const axios_1 = __importDefault(require("axios"));
|
|
12
12
|
const chalk_1 = __importDefault(require("chalk"));
|
|
13
13
|
const api_1 = require("../utils/api");
|
|
14
|
+
const source_provenance_1 = require("../utils/source-provenance");
|
|
14
15
|
async function runView(runId, options) {
|
|
15
16
|
if (!/^\d+$/.test(runId)) {
|
|
16
17
|
console.error(chalk_1.default.red(`Invalid run id: "${runId}" (run ids are numeric — see \`solidactions run list\`).`));
|
|
@@ -96,6 +97,9 @@ async function runView(runId, options) {
|
|
|
96
97
|
steps: flatSteps,
|
|
97
98
|
logs: logsResponse.data.logs || '',
|
|
98
99
|
};
|
|
100
|
+
if (Object.prototype.hasOwnProperty.call(runData, 'deployed_revision')) {
|
|
101
|
+
output.deployed_revision = runData.deployed_revision;
|
|
102
|
+
}
|
|
99
103
|
if (runData.output)
|
|
100
104
|
output.output = runData.output;
|
|
101
105
|
if (runData.error)
|
|
@@ -137,6 +141,9 @@ function displayFullView(runData, timeline, steps, logsData) {
|
|
|
137
141
|
const exitStr = exitCode !== null && exitCode !== undefined ? ` (exit ${exitCode})` : '';
|
|
138
142
|
console.log(` Status: ${statusColor(status)}${chalk_1.default.gray(exitStr)}`);
|
|
139
143
|
console.log(` Trigger: ${chalk_1.default.gray(runData.triggered_by || '-')}`);
|
|
144
|
+
if (Object.prototype.hasOwnProperty.call(runData, 'deployed_revision')) {
|
|
145
|
+
console.log(` Revision (latest session): ${chalk_1.default.gray((0, source_provenance_1.formatDetailedRevision)(runData.deployed_revision))}`);
|
|
146
|
+
}
|
|
140
147
|
// Timeline
|
|
141
148
|
displayTimeline(runData, timeline, steps);
|
|
142
149
|
// Steps
|
package/dist/index.js
CHANGED
|
@@ -314,6 +314,7 @@ project
|
|
|
314
314
|
.description('View project status and the client-reported deployed revision')
|
|
315
315
|
.argument('<project>', 'Project family slug or name')
|
|
316
316
|
.option('-e, --env <environment>', 'Target environment (production/staging/dev). Defaults to dev.', 'dev')
|
|
317
|
+
.option('--json', 'Output as JSON')
|
|
317
318
|
.addHelpText('after', `
|
|
318
319
|
Defaults to dev: <project> is normalized as a project family and "-dev" is
|
|
319
320
|
appended. Use --env staging for the "-staging" target. Use --env production to
|
|
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.sanitizeDisplayText = sanitizeDisplayText;
|
|
7
7
|
exports.formatRevisionSummary = formatRevisionSummary;
|
|
8
|
+
exports.revisionSha = revisionSha;
|
|
9
|
+
exports.formatDetailedRevision = formatDetailedRevision;
|
|
8
10
|
exports.sanitizeRemoteUrl = sanitizeRemoteUrl;
|
|
9
11
|
exports.collectSourceMetadata = collectSourceMetadata;
|
|
10
12
|
exports.shouldCollectGitMetadata = shouldCollectGitMetadata;
|
|
@@ -16,6 +18,7 @@ const os_1 = __importDefault(require("os"));
|
|
|
16
18
|
const path_1 = __importDefault(require("path"));
|
|
17
19
|
const child_process_1 = require("child_process");
|
|
18
20
|
const form_data_1 = __importDefault(require("form-data"));
|
|
21
|
+
const table_1 = require("./table");
|
|
19
22
|
const DISPLAY_FORMATTING = /[\x00-\x1f\x7f\u061c\u200b-\u200f\u202a-\u202e\u2060\u2066-\u2069\ufeff]/g;
|
|
20
23
|
const SHA_PATTERN = /^[0-9a-f]{7,64}$/i;
|
|
21
24
|
const STRICT_ISO_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
@@ -46,6 +49,26 @@ function formatRevisionSummary(metadata) {
|
|
|
46
49
|
}
|
|
47
50
|
return `${sha} (${dirtyLabel(typeof metadata.dirty === 'boolean' ? metadata.dirty : null)})`;
|
|
48
51
|
}
|
|
52
|
+
function revisionSha(revision) {
|
|
53
|
+
if (!revision)
|
|
54
|
+
return null;
|
|
55
|
+
return sanitizeDisplayText(revision.short_sha, 16)
|
|
56
|
+
?? sanitizeDisplayText(revision.commit_sha, 64);
|
|
57
|
+
}
|
|
58
|
+
function formatDetailedRevision(revision) {
|
|
59
|
+
const sha = revisionSha(revision);
|
|
60
|
+
if (!sha)
|
|
61
|
+
return 'unknown';
|
|
62
|
+
const states = [revision?.dirty === true
|
|
63
|
+
? 'DIRTY'
|
|
64
|
+
: revision?.dirty === false ? 'clean' : 'dirty state unknown'];
|
|
65
|
+
const branch = sanitizeDisplayText(revision?.default_branch, 255);
|
|
66
|
+
if (branch && typeof revision?.commits_behind === 'number'
|
|
67
|
+
&& Number.isSafeInteger(revision.commits_behind) && revision.commits_behind > 0) {
|
|
68
|
+
states.push(`${revision.commits_behind} behind origin/${branch} at deploy`);
|
|
69
|
+
}
|
|
70
|
+
return (0, table_1.sanitizeCell)(`${sha} (${states.join(', ')})`);
|
|
71
|
+
}
|
|
49
72
|
function shaValue(value) {
|
|
50
73
|
const sanitized = displayValue(value, 64);
|
|
51
74
|
return sanitized && SHA_PATTERN.test(sanitized) ? sanitized : null;
|