@solidactions/cli 2.0.2 → 3.1.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 CHANGED
@@ -142,6 +142,14 @@ deploy:
142
142
 
143
143
  The CLI prints a one-line summary of what it bundled, e.g. `Bundling 312 files (.env excluded; .gitignore applied; 2 exclude rules)`, and warns about any symlinks it skipped.
144
144
 
145
+ Deploys also transmit client-reported Git provenance when it can be collected:
146
+ commit, branch/tag, subject/date, sanitized remote repository URL (with
147
+ credentials stripped), and whether the deployed subtree was dirty. The CLI
148
+ prints the local revision before upload and confirms the server-recorded
149
+ revision after the build. Use `--no-git-metadata` or
150
+ `SOLIDACTIONS_NO_GIT_METADATA=1` to opt out. Deploying a non-Git directory
151
+ continues normally without revision metadata.
152
+
145
153
  ## Commands
146
154
 
147
155
  Use `solidactions <command> --help` for full flag details on any command.
@@ -161,11 +169,18 @@ Use `solidactions <command> --help` for full flag details on any command.
161
169
  | Command | Key Flags | Description |
162
170
  |---------|-----------|-------------|
163
171
  | `project create <name>` | `-e` | Create an empty project (no source/build); `-e` defaults to `production` |
164
- | `project deploy <name> [path]` | `-e`, `--create`, `--config-only` | Deploy or sync config only |
172
+ | `project deploy <name> [path]` | `-e`, `--create`, `--config-only`, `--no-git-metadata` | Deploy or sync config only |
173
+ | `project view <project>` | `-e` | View status and client-reported deployed revision |
165
174
  | `project pull <name> [path]` | `-y` | Pull source (warns before overwriting) |
166
175
  | `project logs <name>` | | View build logs |
167
176
  | `project list` | | List all projects |
168
177
 
178
+ For `project view`, omitting `--env` treats `<project>` as an exact slug.
179
+ Passing `--env production` uses the supplied production name/slug unchanged;
180
+ `--env staging` and `--env dev` derive the same suffixed slug as deploy. This
181
+ is deliberately different from historical commands such as `run start`,
182
+ which default to dev.
183
+
169
184
  ### run
170
185
 
171
186
  | Command | Key Flags | Description |
@@ -307,7 +322,7 @@ first three in one command.
307
322
 
308
323
  1. **Build** — `npm run build` (must be clean; `tsc` errors block the release).
309
324
  2. **Unit tests** — `npm test`. Covers config resolution, command wiring, and
310
- the `oauth-actions show` snippet renderer (the highest-risk regression
325
+ the `oauth-action view` snippet renderer (the highest-risk regression
311
326
  surface — array query-param serialization and the proxy-managed header
312
327
  filter both have fixture-backed tests under `tests/fixtures/`).
313
328
  3. **Init smoke** — `npm run smoke:init` scaffolds a project end to end.
@@ -330,8 +345,8 @@ first three in one command.
330
345
  ```bash
331
346
  SOLIDACTIONS_SMOKE_REQUIRE_SOURCES=1 npm run check:release
332
347
  ```
333
- 4. **oauth-actions smoke** — `bash scripts/smoke.sh` exercises
334
- `oauth-actions list|search|show` (plus the 404 path) against a real local
348
+ 4. **oauth-action smoke** — `bash scripts/smoke.sh` exercises
349
+ `oauth-action list|search|view` (plus the 404 path) against a real local
335
350
  stub server, so it needs no credentials:
336
351
 
337
352
  ```bash
@@ -365,9 +380,26 @@ first three in one command.
365
380
  check:release`, which serves content at exactly that ref and so fails on a
366
381
  bad or unreachable pin. `tests/examples-ref.test.ts` fails if any call site
367
382
  stops passing the ref.
368
- 7. **Version bump** — update `package.json`, then publish. Once the publish
369
- flow from PR #78 lands, the GitHub release **tag** drives the published npm
370
- version (semver-guarded); the bump commit stays conventional.
383
+ 7. **Version** — the GitHub release **tag** is the single source of truth for
384
+ the published npm version. The publish flow from #78 has landed:
385
+ `.github/workflows/publish.yml` asserts the tag is a literal semver, then
386
+ derives the version from it with `npm version --no-git-tag-version`
387
+ immediately before publishing — deliberately *not* relying on a
388
+ `package.json` bump commit, so a release whose `package.json` was never
389
+ bumped can no longer collide with the registry and fail `npm publish`
390
+ silently (#77).
391
+
392
+ Consequences worth knowing before you cut a release:
393
+
394
+ - **`package.json`'s version is not the source of truth** and has drifted
395
+ from the published one. Read the registry (`npm view @solidactions/cli
396
+ version`) or the tag list, not the file.
397
+ - **Feature PRs do not bump it** — see PR #81, the `docs` → `doc` breaking
398
+ rename, which shipped without touching `package.json`.
399
+ - **A breaking change ships as a major tag.** Nothing in `check:release`
400
+ enforces this — the release destination is recorded in the PR and its
401
+ issue, and the releaser applies it when tagging. There is no changelog
402
+ file in this repo.
371
403
 
372
404
  ## License
373
405
 
@@ -5,6 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PLAN_LIMIT_NON_INTERACTIVE_HINT = exports.SKILLS_TIP_LINES = void 0;
7
7
  exports.cacheBusterEntry = cacheBusterEntry;
8
+ exports.projectStatusUrl = projectStatusUrl;
9
+ exports.fetchDeploymentConfirmation = fetchDeploymentConfirmation;
10
+ exports.isConfirmationMatch = isConfirmationMatch;
11
+ exports.confirmDeploymentWithRetry = confirmDeploymentWithRetry;
12
+ exports.formatDeploymentConfirmation = formatDeploymentConfirmation;
13
+ exports.safeCollectSourceMetadata = safeCollectSourceMetadata;
8
14
  exports.shouldPrintWorkspaceMismatch = shouldPrintWorkspaceMismatch;
9
15
  exports.isPlanLimitReachedError = isPlanLimitReachedError;
10
16
  exports.handlePlanLimitReached = handlePlanLimitReached;
@@ -13,9 +19,7 @@ exports.shouldPrintWebhookSecretNotice = shouldPrintWebhookSecretNotice;
13
19
  const fs_1 = __importDefault(require("fs"));
14
20
  const path_1 = __importDefault(require("path"));
15
21
  const crypto_1 = require("crypto");
16
- const archiver_1 = __importDefault(require("archiver"));
17
22
  const axios_1 = __importDefault(require("axios"));
18
- const form_data_1 = __importDefault(require("form-data"));
19
23
  const chalk_1 = __importDefault(require("chalk"));
20
24
  const js_yaml_1 = __importDefault(require("js-yaml"));
21
25
  const prompts_1 = __importDefault(require("prompts"));
@@ -24,6 +28,9 @@ const api_1 = require("../utils/api");
24
28
  const deploy_ignore_1 = require("../utils/deploy-ignore");
25
29
  const slug_1 = require("../utils/slug");
26
30
  const skills_1 = require("../utils/skills");
31
+ const tar_archive_1 = require("../utils/tar-archive");
32
+ const source_provenance_1 = require("../utils/source-provenance");
33
+ const project_view_1 = require("./project-view");
27
34
  /** Printed when a deploy target has no SolidActions skill files installed. */
28
35
  exports.SKILLS_TIP_LINES = [
29
36
  'Tip: no SolidActions skill files found (.claude/skills/solidactions-*). Your AI assistant',
@@ -117,6 +124,93 @@ function cacheBusterEntry(noCache) {
117
124
  content: `force-rebuild ${uuid} ${Date.now()}`,
118
125
  };
119
126
  }
127
+ function projectStatusUrl(host, projectSlug) {
128
+ return `${host}/api/v1/projects/${encodeURIComponent(projectSlug)}`;
129
+ }
130
+ async function fetchDeploymentConfirmation(config, projectSlug) {
131
+ const response = await axios_1.default.get(`${projectStatusUrl(config.host, projectSlug)}?include=deployment`, { headers: (0, api_1.getApiHeaders)(config) });
132
+ return response.data;
133
+ }
134
+ /**
135
+ * True when the fetched project's recorded latest successful deployment is
136
+ * the one this deploy produced. A null `acceptedDeploymentId` (legacy server
137
+ * response) has nothing to confirm against, so it counts as a match.
138
+ */
139
+ function isConfirmationMatch(project, acceptedDeploymentId) {
140
+ if (!acceptedDeploymentId) {
141
+ return true;
142
+ }
143
+ const deployment = project.latest_successful_deployment ?? null;
144
+ return project.deployment_matches_deployed_hash === true
145
+ && deployment !== null
146
+ && deployment.id === acceptedDeploymentId;
147
+ }
148
+ /**
149
+ * Rebuild provenance can lag server-side (app #972): the instant status
150
+ * flips to "deployed", the confirmation record may not have caught up yet,
151
+ * so a healthy deploy can transiently look like a mismatch. Retries a short,
152
+ * bounded number of times before accepting whatever the last fetch reported.
153
+ * Exit code is unaffected either way — this only changes which message prints.
154
+ */
155
+ async function confirmDeploymentWithRetry(acceptedDeploymentId, fetcher, options = {}) {
156
+ const attempts = options.attempts ?? 3;
157
+ const delayMs = options.delayMs ?? 500;
158
+ const wait = options.wait ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
159
+ let result;
160
+ for (let attempt = 1; attempt <= attempts; attempt++) {
161
+ result = await fetcher();
162
+ if (isConfirmationMatch(result, acceptedDeploymentId) || attempt === attempts) {
163
+ return result;
164
+ }
165
+ await wait(delayMs);
166
+ }
167
+ // Unreachable: the loop always returns on its final iteration.
168
+ return result;
169
+ }
170
+ function formatDeploymentConfirmation(project, acceptedDeploymentId, sourceMetadataRejected) {
171
+ if (!acceptedDeploymentId) {
172
+ return ['Build finished; revision confirmation unavailable (legacy server response).'];
173
+ }
174
+ const deployment = project.latest_successful_deployment ?? null;
175
+ if (!deployment) {
176
+ return ['Build finished, but the server has no successful deployment recorded yet for this project.'];
177
+ }
178
+ if (project.deployment_matches_deployed_hash !== true) {
179
+ return ["Build finished, but the running revision hash does not match the server's recorded successful deployment."];
180
+ }
181
+ if (deployment.id !== acceptedDeploymentId) {
182
+ return ['Build finished, but this deployment was not recorded as the latest successful deployment.'];
183
+ }
184
+ const revisionLines = (0, project_view_1.formatDeploymentRevision)(deployment);
185
+ const noRevisionReported = revisionLines[0] === 'No source revision was reported.';
186
+ const lines = [
187
+ noRevisionReported
188
+ ? 'Deployment confirmed, but no source revision was reported for it.'
189
+ : 'Deployment revision confirmed.',
190
+ ];
191
+ if (sourceMetadataRejected) {
192
+ const safeReason = (0, source_provenance_1.sanitizeDisplayText)(sourceMetadataRejected, 100) ?? 'invalid_metadata';
193
+ lines.push(`Optional source metadata was rejected by the server (${safeReason}).`);
194
+ }
195
+ lines.push(...(noRevisionReported ? revisionLines.slice(1) : revisionLines));
196
+ return lines;
197
+ }
198
+ /**
199
+ * Provenance collection is optional, best effort — a failure here must never
200
+ * fail the deploy. Wraps collectSourceMetadata() (or an injected collector,
201
+ * for testing) in a try/catch and degrades to null on throw.
202
+ */
203
+ function safeCollectSourceMetadata(sourceDir, options, collector = source_provenance_1.collectSourceMetadata) {
204
+ if (!(0, source_provenance_1.shouldCollectGitMetadata)(options)) {
205
+ return null;
206
+ }
207
+ try {
208
+ return collector(sourceDir);
209
+ }
210
+ catch {
211
+ return null;
212
+ }
213
+ }
120
214
  /**
121
215
  * Push YAML env declarations to the project.
122
216
  * This registers all YAML-declared vars and their mappings.
@@ -402,7 +496,12 @@ async function deploy(projectName, sourcePath, options = {}) {
402
496
  console.log(chalk_1.default.green(`✓ Config synced for ${projectSlug}${envLabel}`));
403
497
  return;
404
498
  }
405
- const archivePath = path_1.default.join(sourceDir, '.steps-deploy.tar.gz');
499
+ // Provenance is optional, best effort, and collected before archiving so
500
+ // the deploy artifact itself can never make the source look dirty.
501
+ const sourceMetadata = safeCollectSourceMetadata(sourceDir, options);
502
+ if (sourceMetadata) {
503
+ console.log(chalk_1.default.gray(`Revision to upload (client-reported): ${(0, source_provenance_1.formatRevisionSummary)(sourceMetadata)}`));
504
+ }
406
505
  // Plan the file list BEFORE creating the archive write stream so a walk error
407
506
  // (permission error, unreadable dir) aborts cleanly with no orphan tarball.
408
507
  let plan;
@@ -414,6 +513,15 @@ async function deploy(projectName, sourcePath, options = {}) {
414
513
  console.error(error.message);
415
514
  process.exit(1);
416
515
  }
516
+ const archiveLocation = (0, source_provenance_1.createDeployArchiveLocation)();
517
+ const archivePath = archiveLocation.archivePath;
518
+ let archiveCleaned = false;
519
+ const cleanupArchive = () => {
520
+ if (!archiveCleaned) {
521
+ archiveCleaned = true;
522
+ archiveLocation.cleanup();
523
+ }
524
+ };
417
525
  // Summary line so silent truncation never reads as "shipped everything".
418
526
  const parts = ['.env excluded'];
419
527
  if (plan.summary.gitignoreApplied) {
@@ -426,18 +534,17 @@ async function deploy(projectName, sourcePath, options = {}) {
426
534
  if (plan.summary.symlinksSkipped.length > 0) {
427
535
  console.log(chalk_1.default.yellow(`⚠ Skipped ${plan.summary.symlinksSkipped.length} symlink(s) (not followed): ${plan.summary.symlinksSkipped.join(', ')}`));
428
536
  }
537
+ const archive = await (0, tar_archive_1.createTarArchive)({ gzip: true, gzipOptions: { level: 9 } });
429
538
  const output = fs_1.default.createWriteStream(archivePath);
430
- const archive = (0, archiver_1.default)('tar', { gzip: true, gzipOptions: { level: 9 } });
431
539
  output.on('close', async () => {
432
540
  console.log(chalk_1.default.gray(`Archived ${archive.pointer()} total bytes`));
433
541
  try {
434
- const form = new form_data_1.default();
435
- form.append('source', fs_1.default.createReadStream(archivePath));
542
+ const form = (0, source_provenance_1.buildDeployForm)(archivePath, sourceMetadata);
436
543
  console.log(chalk_1.default.yellow('Uploading...'));
437
544
  if (process.env.SOLIDACTIONS_DEPLOY_DEBUG === '1') {
438
545
  process.stderr.write(`[deploy-debug] POST ${config.host}/api/v1/projects/${projectSlug}/deploy (workspace=${config.workspaceId ?? '(none)'})\n`);
439
546
  }
440
- await axios_1.default.post(`${config.host}/api/v1/projects/${projectSlug}/deploy`, form, {
547
+ const deployResponse = await axios_1.default.post(`${config.host}/api/v1/projects/${projectSlug}/deploy`, form, {
441
548
  headers: {
442
549
  ...form.getHeaders(),
443
550
  ...(0, api_1.getApiHeaders)(config),
@@ -445,6 +552,13 @@ async function deploy(projectName, sourcePath, options = {}) {
445
552
  maxContentLength: Infinity,
446
553
  maxBodyLength: Infinity
447
554
  });
555
+ const acceptedDeployment = (0, source_provenance_1.parseDeployAcceptance)(deployResponse.data);
556
+ if (acceptedDeployment.sourceMetadataRejected) {
557
+ console.log(chalk_1.default.yellow(`Warning: optional source metadata was not accepted (${acceptedDeployment.sourceMetadataRejected}); deployment continues.`));
558
+ }
559
+ if (process.env.SOLIDACTIONS_DEPLOY_DEBUG === '1') {
560
+ process.stderr.write(`[deploy-debug] accepted deployment=${acceptedDeployment.deploymentId ?? '(legacy response)'} metadata=${acceptedDeployment.sourceMetadata ? 'normalized' : 'none'}\n`);
561
+ }
448
562
  console.log(chalk_1.default.green('Deployment successfully queued!'));
449
563
  console.log(chalk_1.default.yellow('Waiting for build to complete...\n'));
450
564
  if (process.env.SOLIDACTIONS_DEPLOY_DEBUG === '1') {
@@ -457,7 +571,7 @@ async function deploy(projectName, sourcePath, options = {}) {
457
571
  const poll = setInterval(async () => {
458
572
  try {
459
573
  attempts++;
460
- const statusRes = await axios_1.default.get(`${config.host}/api/v1/projects/${projectSlug}`, {
574
+ const statusRes = await axios_1.default.get(projectStatusUrl(config.host, projectSlug), {
461
575
  headers: (0, api_1.getApiHeaders)(config),
462
576
  });
463
577
  const { status, build_log } = statusRes.data;
@@ -478,6 +592,15 @@ async function deploy(projectName, sourcePath, options = {}) {
478
592
  if (status === 'deployed') {
479
593
  clearInterval(poll);
480
594
  console.log(chalk_1.default.green(`\n✓ Deployed to ${projectSlug}${envLabel}!`));
595
+ try {
596
+ const confirmedProject = await confirmDeploymentWithRetry(acceptedDeployment.deploymentId, () => fetchDeploymentConfirmation(config, projectSlug));
597
+ for (const line of formatDeploymentConfirmation(confirmedProject, acceptedDeployment.deploymentId, acceptedDeployment.sourceMetadataRejected)) {
598
+ console.log(line);
599
+ }
600
+ }
601
+ catch {
602
+ console.log(chalk_1.default.yellow('Build finished; server revision confirmation was unavailable.'));
603
+ }
481
604
  // Always sync YAML declarations (registers variables and their mappings)
482
605
  if (yamlConfig) {
483
606
  await pushYamlDeclarations(config, projectSlug, yamlConfig);
@@ -488,7 +611,7 @@ async function deploy(projectName, sourcePath, options = {}) {
488
611
  console.log(chalk_1.default.blue(`ℹ Webhook secret: run \`solidactions webhook secret ${projectName}${envFlag}\` to retrieve the generated secret.`));
489
612
  console.log(chalk_1.default.gray(` Set the same value in your sender (e.g. Telegram setWebhook secret_token).`));
490
613
  }
491
- fs_1.default.unlinkSync(archivePath);
614
+ cleanupArchive();
492
615
  process.exit(0);
493
616
  }
494
617
  else if (status === 'error') {
@@ -499,13 +622,13 @@ async function deploy(projectName, sourcePath, options = {}) {
499
622
  console.log(chalk_1.default.gray(build_log));
500
623
  console.log(chalk_1.default.yellow('--- End Build Log ---\n'));
501
624
  }
502
- fs_1.default.unlinkSync(archivePath);
625
+ cleanupArchive();
503
626
  process.exit(1);
504
627
  }
505
628
  else if (attempts >= maxAttempts) {
506
629
  clearInterval(poll);
507
630
  console.error(chalk_1.default.red('\nTimeout waiting for build. It might still finish.'));
508
- fs_1.default.unlinkSync(archivePath);
631
+ cleanupArchive();
509
632
  process.exit(1);
510
633
  }
511
634
  }
@@ -527,13 +650,21 @@ async function deploy(projectName, sourcePath, options = {}) {
527
650
  else {
528
651
  console.error(error.message);
529
652
  }
530
- if (fs_1.default.existsSync(archivePath))
531
- fs_1.default.unlinkSync(archivePath);
653
+ cleanupArchive();
532
654
  process.exit(1);
533
655
  }
534
656
  });
535
657
  archive.on('error', (err) => {
536
- throw err;
658
+ cleanupArchive();
659
+ console.error(chalk_1.default.red('Deployment failed:'));
660
+ console.error(err.message);
661
+ process.exit(1);
662
+ });
663
+ output.on('error', (err) => {
664
+ cleanupArchive();
665
+ console.error(chalk_1.default.red('Deployment failed:'));
666
+ console.error(err.message);
667
+ process.exit(1);
537
668
  });
538
669
  archive.pipe(output);
539
670
  // User code goes under tenantcode/ so it never conflicts with our Dockerfile.
@@ -3,11 +3,11 @@ 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.oauthActionsList = oauthActionsList;
6
+ exports.oauthActionList = oauthActionList;
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
- async function oauthActionsList(platform, options) {
10
+ async function oauthActionList(platform, options) {
11
11
  const config = await (0, api_1.requireConfigWithWorkspace)();
12
12
  try {
13
13
  const params = { platform };
@@ -31,11 +31,11 @@ async function oauthActionsList(platform, options) {
31
31
  console.log(`${chalk_1.default.cyan(method)} ${chalk_1.default.white(a.path.padEnd(50))} ${chalk_1.default.gray('— ' + (a.title || ''))}`);
32
32
  }
33
33
  console.log('');
34
- console.log(chalk_1.default.gray(`${actions.length} action(s) — use "solidactions oauth-actions search ${platform} <query>" to narrow, or "oauth-actions show ${platform} <action_id>" for detail.`));
34
+ console.log(chalk_1.default.gray(`${actions.length} action(s) — use "solidactions oauth-action search ${platform} <query>" to narrow, or "oauth-action view ${platform} <action_id>" for detail.`));
35
35
  }
36
36
  catch (error) {
37
37
  if (error.response?.status === 404 && error.response.data?.code === 'platform_unknown') {
38
- console.error(chalk_1.default.red(`Unknown platform "${platform}". Run \`solidactions oauth-actions platforms\` to see available platforms.`));
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
41
  console.error(chalk_1.default.red('Authentication failed. Run "solidactions login --global".'));
@@ -3,11 +3,11 @@ 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.oauthActionsPlatforms = oauthActionsPlatforms;
6
+ exports.oauthActionPlatforms = oauthActionPlatforms;
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
- async function oauthActionsPlatforms(options) {
10
+ async function oauthActionPlatforms(options) {
11
11
  const config = await (0, api_1.requireConfigWithWorkspace)();
12
12
  try {
13
13
  const response = await axios_1.default.get(`${config.host}/api/v1/oauth-actions/platforms`, {
@@ -3,11 +3,11 @@ 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.oauthActionsSearch = oauthActionsSearch;
6
+ exports.oauthActionSearch = oauthActionSearch;
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
- async function oauthActionsSearch(platform, query, options) {
10
+ async function oauthActionSearch(platform, query, options) {
11
11
  const config = await (0, api_1.requireConfigWithWorkspace)();
12
12
  try {
13
13
  const params = { platform };
@@ -42,11 +42,11 @@ async function oauthActionsSearch(platform, query, options) {
42
42
  console.log('');
43
43
  }
44
44
  console.log(chalk_1.default.gray(`${actions.length} action(s) found.`));
45
- console.log(chalk_1.default.gray(`Run 'solidactions oauth-actions show ${platform} <action_id>' for full schema + paste-ready snippet.`));
45
+ console.log(chalk_1.default.gray(`Run 'solidactions oauth-action view ${platform} <action_id>' for full schema + paste-ready snippet.`));
46
46
  }
47
47
  catch (error) {
48
48
  if (error.response?.status === 404 && error.response.data?.code === 'platform_unknown') {
49
- console.error(chalk_1.default.red(`Unknown platform "${platform}". Run \`solidactions oauth-actions platforms\` to see available platforms.`));
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
52
  console.error(chalk_1.default.red('Authentication failed. Run "solidactions login --global" to re-configure.'));
@@ -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.oauthActionsShow = oauthActionsShow;
6
+ exports.oauthActionView = oauthActionView;
7
7
  exports.buildSnippet = buildSnippet;
8
8
  const axios_1 = __importDefault(require("axios"));
9
9
  const chalk_1 = __importDefault(require("chalk"));
10
10
  const api_1 = require("../utils/api");
11
- async function oauthActionsShow(platform, actionId, options) {
11
+ async function oauthActionView(platform, actionId, options) {
12
12
  const config = await (0, api_1.requireConfigWithWorkspace)();
13
13
  try {
14
14
  const response = await axios_1.default.get(`${config.host}/api/v1/oauth-actions/${platform}/${encodeURIComponent(actionId)}`, {
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.projectSlugForView = projectSlugForView;
7
+ exports.formatDeploymentRevision = formatDeploymentRevision;
8
+ exports.formatProjectView = formatProjectView;
9
+ exports.projectViewWithConfig = projectViewWithConfig;
10
+ exports.projectView = projectView;
11
+ const axios_1 = __importDefault(require("axios"));
12
+ const chalk_1 = __importDefault(require("chalk"));
13
+ const api_1 = require("../utils/api");
14
+ const slug_1 = require("../utils/slug");
15
+ const source_provenance_1 = require("../utils/source-provenance");
16
+ function projectSlugForView(project, environment) {
17
+ if (environment === undefined) {
18
+ return project;
19
+ }
20
+ if (!['production', 'staging', 'dev'].includes(environment)) {
21
+ throw new Error('Environment must be production, staging, or dev.');
22
+ }
23
+ return environment === 'production'
24
+ ? project
25
+ : (0, slug_1.buildProjectSlug)(project, environment);
26
+ }
27
+ function metadataSourceLabel(source) {
28
+ const labels = {
29
+ git: 'Git',
30
+ github_actions: 'GitHub Actions',
31
+ gitlab_ci: 'GitLab CI',
32
+ circleci: 'CircleCI',
33
+ bitbucket_pipelines: 'Bitbucket Pipelines',
34
+ };
35
+ const safe = (0, source_provenance_1.sanitizeDisplayText)(source, 32);
36
+ return safe ? labels[safe] ?? safe : null;
37
+ }
38
+ function formatDeploymentRevision(deployment) {
39
+ const sha = (0, source_provenance_1.sanitizeDisplayText)(deployment.short_sha, 16)
40
+ ?? (0, source_provenance_1.sanitizeDisplayText)(deployment.commit_sha, 64);
41
+ if (!sha) {
42
+ const archiveHash = (0, source_provenance_1.sanitizeDisplayText)(deployment.source_hash, 64);
43
+ return [
44
+ 'No source revision was reported.',
45
+ ...(archiveHash ? [`Archive: ${archiveHash}`] : []),
46
+ ];
47
+ }
48
+ const lines = [
49
+ `Revision (Client-reported): ${(0, source_provenance_1.formatRevisionSummary)(deployment)}`,
50
+ ];
51
+ const source = metadataSourceLabel(deployment.metadata_source);
52
+ if (source) {
53
+ lines.push(`Source: ${source}`);
54
+ }
55
+ const branch = (0, source_provenance_1.sanitizeDisplayText)(deployment.branch, 255);
56
+ const tag = (0, source_provenance_1.sanitizeDisplayText)(deployment.tag, 255);
57
+ if (branch) {
58
+ lines.push(`Branch: ${branch}`);
59
+ }
60
+ if (tag) {
61
+ lines.push(`Tag: ${tag}`);
62
+ }
63
+ const subject = (0, source_provenance_1.sanitizeDisplayText)(deployment.commit_subject, 500);
64
+ const authorDate = (0, source_provenance_1.sanitizeDisplayText)(deployment.commit_author_date, 40);
65
+ // Defense in depth: sanitizeRemoteUrl already strips credentials at
66
+ // collection time (source-provenance.ts), but a legacy or unnormalized
67
+ // server response could still carry them, so re-sanitize at this display
68
+ // boundary too — remote_url must never reach the terminal with a token.
69
+ const remote = (0, source_provenance_1.sanitizeRemoteUrl)((0, source_provenance_1.sanitizeDisplayText)(deployment.remote_url, 2048) ?? undefined);
70
+ if (subject) {
71
+ lines.push(`Subject: ${subject}`);
72
+ }
73
+ if (authorDate) {
74
+ lines.push(`Author date: ${authorDate}`);
75
+ }
76
+ if (remote) {
77
+ lines.push(`Remote: ${remote}`);
78
+ }
79
+ return lines;
80
+ }
81
+ function formatProjectView(project) {
82
+ const slug = (0, source_provenance_1.sanitizeDisplayText)(project.slug ?? project.name, 255) ?? 'unknown';
83
+ const status = (0, source_provenance_1.sanitizeDisplayText)(project.status, 64) ?? 'unknown';
84
+ const lines = [`Project: ${slug}`, `Status: ${status}`];
85
+ const deployment = project.latest_successful_deployment ?? null;
86
+ if (!project.deployed_hash && !deployment) {
87
+ lines.push('No deployment provenance recorded (deployed before tracking).');
88
+ return lines;
89
+ }
90
+ if (project.deployment_matches_deployed_hash !== true || !deployment) {
91
+ lines.push('Revision unknown for the running build.');
92
+ return lines;
93
+ }
94
+ lines.push(...formatDeploymentRevision(deployment));
95
+ return lines;
96
+ }
97
+ async function projectViewWithConfig(project, options, config, writeLine = console.log) {
98
+ let slug;
99
+ try {
100
+ slug = projectSlugForView(project, options.env);
101
+ }
102
+ catch (error) {
103
+ console.error(chalk_1.default.red(error.message));
104
+ process.exit(1);
105
+ return;
106
+ }
107
+ try {
108
+ const response = await axios_1.default.get(`${config.host}/api/v1/projects/${encodeURIComponent(slug)}?include=deployment`, { headers: (0, api_1.getApiHeaders)(config) });
109
+ for (const line of formatProjectView(response.data)) {
110
+ writeLine(line);
111
+ }
112
+ }
113
+ catch (error) {
114
+ if (error.response?.status === 401) {
115
+ console.error(chalk_1.default.red('Authentication failed. Run "solidactions login --global" to re-configure.'));
116
+ }
117
+ else if (error.response?.status === 404) {
118
+ const message = (0, source_provenance_1.sanitizeDisplayText)(error.response.data?.message, 500)
119
+ ?? `Project "${slug}" not found.`;
120
+ console.error(chalk_1.default.red(message));
121
+ }
122
+ else if (error.response) {
123
+ console.error(chalk_1.default.red(`Failed to view project: ${error.response.status}`));
124
+ }
125
+ else {
126
+ console.error(chalk_1.default.red('Connection failed:'), error.message);
127
+ }
128
+ process.exit(1);
129
+ }
130
+ }
131
+ async function projectView(project, options) {
132
+ const config = await (0, api_1.requireConfigWithWorkspace)();
133
+ await projectViewWithConfig(project, options, config);
134
+ }
package/dist/index.js CHANGED
@@ -45,6 +45,7 @@ const init_1 = require("./commands/init");
45
45
  const pull_1 = require("./commands/pull");
46
46
  const project_list_1 = require("./commands/project-list");
47
47
  const project_create_1 = require("./commands/project-create");
48
+ const project_view_1 = require("./commands/project-view");
48
49
  const project_logs_1 = require("./commands/project-logs");
49
50
  const run_start_1 = require("./commands/run-start");
50
51
  const run_list_1 = require("./commands/run-list");
@@ -63,10 +64,10 @@ const webhook_secret_1 = require("./commands/webhook-secret");
63
64
  const dev_1 = require("./commands/dev");
64
65
  const ai_init_1 = require("./commands/ai-init");
65
66
  const ai_examples_1 = require("./commands/ai-examples");
66
- const oauth_actions_search_1 = require("./commands/oauth-actions-search");
67
- const oauth_actions_list_1 = require("./commands/oauth-actions-list");
68
- const oauth_actions_show_1 = require("./commands/oauth-actions-show");
69
- const oauth_actions_platforms_1 = require("./commands/oauth-actions-platforms");
67
+ const oauth_action_search_1 = require("./commands/oauth-action-search");
68
+ const oauth_action_list_1 = require("./commands/oauth-action-list");
69
+ const oauth_action_view_1 = require("./commands/oauth-action-view");
70
+ const oauth_action_platforms_1 = require("./commands/oauth-action-platforms");
70
71
  const workspaces_1 = require("./commands/workspaces");
71
72
  const skill_push_1 = require("./commands/skill-push");
72
73
  const skill_publish_1 = require("./commands/skill-publish");
@@ -205,6 +206,19 @@ program
205
206
  // project <subcommand>
206
207
  // =============================================================================
207
208
  const project = program.command('project').description('Manage projects');
209
+ project
210
+ .command('view')
211
+ .description('View project status and the client-reported deployed revision')
212
+ .argument('<project>', 'Exact project slug (or project family/name when --env is explicit)')
213
+ .option('-e, --env <environment>', 'Resolve an explicit environment (production/staging/dev)')
214
+ .addHelpText('after', `
215
+ Without --env, <project> is used as an exact slug. With --env production it is
216
+ used unchanged; staging/dev use the same "-<env>" suffix rule as deploy.
217
+ Unlike historical commands such as \`run start\`, project view has no implicit
218
+ dev environment default.`)
219
+ .action(async (projectName, options) => {
220
+ await (0, project_view_1.projectView)(projectName, options);
221
+ });
208
222
  project
209
223
  .command('create')
210
224
  .description('Create an empty project (and environment) without deploying source')
@@ -223,6 +237,7 @@ project
223
237
  .option('--config-only', 'Sync YAML env declarations without building/deploying')
224
238
  .option('--no-cache', 'Force a fresh build, bypassing all build caches')
225
239
  .option('--force-rebuild', 'Force a fresh build, bypassing all build caches (alias for --no-cache)')
240
+ .option('--no-git-metadata', 'Do not transmit Git provenance (branch, commit subject, and sanitized remote repository URL; credentials are stripped); also available as SOLIDACTIONS_NO_GIT_METADATA=1')
226
241
  .action((projectName, path, options) => {
227
242
  // Commander's negation convention maps --no-cache to options.cache === false
228
243
  // (NOT options.noCache). Normalize both flags to a single boolean.
@@ -499,41 +514,41 @@ Where the pin is saved (--local / --global):
499
514
  await (0, workspaces_1.workspaceSet)(input, opts);
500
515
  });
501
516
  // =============================================================================
502
- // oauth-actions <subcommand>
517
+ // oauth-action <subcommand>
503
518
  // =============================================================================
504
- const oauthActionsCmd = program.command('oauth-actions').description('Discover OAuth-backed API operations callable via the SA proxy');
505
- oauthActionsCmd
519
+ const oauthActionCmd = program.command('oauth-action').description('Discover OAuth-backed API operations callable via the SA proxy');
520
+ oauthActionCmd
506
521
  .command('search <platform> [query]')
507
522
  .description('Search available actions for a connected platform')
508
523
  .option('--method <method>', 'Filter by HTTP method (GET, POST, etc.)')
509
524
  .option('--limit <n>', 'Maximum results to return', (v) => parseInt(v, 10))
510
525
  .option('--json', 'Emit raw JSON for AI/script consumption')
511
526
  .action((platform, query, options) => {
512
- (0, oauth_actions_search_1.oauthActionsSearch)(platform, query, options);
527
+ (0, oauth_action_search_1.oauthActionSearch)(platform, query, options);
513
528
  });
514
- oauthActionsCmd
529
+ oauthActionCmd
515
530
  .command('list <platform>')
516
531
  .description('List actions for a connected platform')
517
532
  .option('--limit <n>', 'Maximum results to return', (v) => parseInt(v, 10))
518
533
  .option('--json', 'Emit raw JSON for AI/script consumption')
519
534
  .action((platform, options) => {
520
- (0, oauth_actions_list_1.oauthActionsList)(platform, options);
535
+ (0, oauth_action_list_1.oauthActionList)(platform, options);
521
536
  });
522
- oauthActionsCmd
523
- .command('show <platform> <action-id>')
537
+ oauthActionCmd
538
+ .command('view <platform> <action-id>')
524
539
  .description('Show full schema, example body, and a paste-ready fetch snippet for one action')
525
540
  .option('--json', 'Emit raw JSON for AI/script consumption')
526
541
  .option('--var <NAME>', 'ctx.vars variable name for the connection (default: YOUR_CONNECTION)')
527
542
  .option('--legacy-env', 'Emit the deprecated process.env-based snippet (will be removed in a future release)')
528
543
  .action((platform, actionId, options) => {
529
- (0, oauth_actions_show_1.oauthActionsShow)(platform, actionId, options);
544
+ (0, oauth_action_view_1.oauthActionView)(platform, actionId, options);
530
545
  });
531
- oauthActionsCmd
546
+ oauthActionCmd
532
547
  .command('platforms')
533
548
  .description('List available OAuth-backed platforms')
534
549
  .option('--json', 'Emit raw JSON for AI/script consumption')
535
550
  .action((options) => {
536
- (0, oauth_actions_platforms_1.oauthActionsPlatforms)(options);
551
+ (0, oauth_action_platforms_1.oauthActionPlatforms)(options);
537
552
  });
538
553
  // =============================================================================
539
554
  // ai <subcommand>
@@ -0,0 +1 @@
1
+ module.exports = () => import('archiver');
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sanitizeDisplayText = sanitizeDisplayText;
7
+ exports.formatRevisionSummary = formatRevisionSummary;
8
+ exports.sanitizeRemoteUrl = sanitizeRemoteUrl;
9
+ exports.collectSourceMetadata = collectSourceMetadata;
10
+ exports.shouldCollectGitMetadata = shouldCollectGitMetadata;
11
+ exports.buildDeployForm = buildDeployForm;
12
+ exports.createDeployArchiveLocation = createDeployArchiveLocation;
13
+ exports.parseDeployAcceptance = parseDeployAcceptance;
14
+ const fs_1 = __importDefault(require("fs"));
15
+ const os_1 = __importDefault(require("os"));
16
+ const path_1 = __importDefault(require("path"));
17
+ const child_process_1 = require("child_process");
18
+ const form_data_1 = __importDefault(require("form-data"));
19
+ const DISPLAY_FORMATTING = /[\x00-\x1f\x7f\u061c\u200b-\u200f\u202a-\u202e\u2060\u2066-\u2069\ufeff]/g;
20
+ const SHA_PATTERN = /^[0-9a-f]{7,64}$/i;
21
+ const STRICT_ISO_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
22
+ function displayValue(value, maxLength) {
23
+ if (!value) {
24
+ return null;
25
+ }
26
+ const sanitized = value.replace(DISPLAY_FORMATTING, '').trim().slice(0, maxLength);
27
+ return sanitized === '' ? null : sanitized;
28
+ }
29
+ function sanitizeDisplayText(value, maxLength = 2048) {
30
+ return typeof value === 'string' ? displayValue(value, maxLength) : null;
31
+ }
32
+ function dirtyLabel(dirty) {
33
+ if (dirty === true) {
34
+ return 'DIRTY';
35
+ }
36
+ if (dirty === false) {
37
+ return 'clean';
38
+ }
39
+ return 'dirty state unknown';
40
+ }
41
+ function formatRevisionSummary(metadata) {
42
+ const sha = sanitizeDisplayText(metadata.short_sha, 16)
43
+ ?? sanitizeDisplayText(metadata.commit_sha, 64);
44
+ if (!sha) {
45
+ return 'No source revision was reported.';
46
+ }
47
+ return `${sha} (${dirtyLabel(typeof metadata.dirty === 'boolean' ? metadata.dirty : null)})`;
48
+ }
49
+ function shaValue(value) {
50
+ const sanitized = displayValue(value, 64);
51
+ return sanitized && SHA_PATTERN.test(sanitized) ? sanitized : null;
52
+ }
53
+ function authorDateValue(value) {
54
+ const sanitized = displayValue(value, 40);
55
+ return sanitized && STRICT_ISO_PATTERN.test(sanitized) ? sanitized : null;
56
+ }
57
+ const SCP_STYLE_PATTERN = /^[^@\s/]+@([^\s/:]+):(.+)$/;
58
+ // Git remote helper syntax: `<helper>::<address>`, e.g. `hg::https://host/repo`.
59
+ // https://git-scm.com/docs/gitremote-helpers
60
+ const HELPER_PREFIX_PATTERN = /^([a-zA-Z0-9-]+::)(.*)$/;
61
+ function sanitizeRemoteUrl(value) {
62
+ const sanitized = displayValue(value, 2048);
63
+ if (!sanitized) {
64
+ return null;
65
+ }
66
+ const helperMatch = HELPER_PREFIX_PATTERN.exec(sanitized);
67
+ if (helperMatch) {
68
+ const [, prefix, remainder] = helperMatch;
69
+ const sanitizedRemainder = sanitizeRemoteUrl(remainder);
70
+ return sanitizedRemainder === null ? null : `${prefix}${sanitizedRemainder}`;
71
+ }
72
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(sanitized)) {
73
+ try {
74
+ const remote = new URL(sanitized);
75
+ remote.username = '';
76
+ remote.password = '';
77
+ remote.search = '';
78
+ remote.hash = '';
79
+ return remote.toString();
80
+ }
81
+ catch {
82
+ return null;
83
+ }
84
+ }
85
+ if (/^\/\//.test(sanitized)) {
86
+ // Protocol-relative: //[user[:pass]@]host[:port]/path[?query][#fragment]
87
+ return sanitized
88
+ .split('#')[0]
89
+ .split('?')[0]
90
+ .replace(/^\/\/[^/@]*@/, '//');
91
+ }
92
+ const scpMatch = SCP_STYLE_PATTERN.exec(sanitized);
93
+ if (scpMatch) {
94
+ const [, host, path] = scpMatch;
95
+ return `${host}:${path}`;
96
+ }
97
+ return sanitized;
98
+ }
99
+ function git(sourceDir, args) {
100
+ const result = (0, child_process_1.spawnSync)('git', ['-C', sourceDir, ...args], {
101
+ encoding: 'utf8',
102
+ timeout: 2_000,
103
+ maxBuffer: 1024 * 1024,
104
+ windowsHide: true,
105
+ stdio: ['ignore', 'pipe', 'ignore'],
106
+ });
107
+ if (result.status !== 0 || result.error) {
108
+ return null;
109
+ }
110
+ return result.stdout.trim();
111
+ }
112
+ function localGitMetadata(sourceDir) {
113
+ if (git(sourceDir, ['rev-parse', '--is-inside-work-tree']) !== 'true') {
114
+ return null;
115
+ }
116
+ const commitSha = shaValue(git(sourceDir, ['rev-parse', 'HEAD']) ?? undefined);
117
+ if (!commitSha) {
118
+ return null;
119
+ }
120
+ const status = git(sourceDir, ['status', '--porcelain=v1', '--untracked-files=all', '--', '.']);
121
+ const shortSha = shaValue(git(sourceDir, ['rev-parse', '--short=12', 'HEAD']) ?? undefined);
122
+ return {
123
+ metadata_source: 'git',
124
+ commit_sha: commitSha,
125
+ short_sha: shortSha,
126
+ branch: displayValue(git(sourceDir, ['symbolic-ref', '--short', '-q', 'HEAD']) ?? undefined, 255),
127
+ tag: displayValue(git(sourceDir, ['describe', '--tags', '--exact-match', 'HEAD']) ?? undefined, 255),
128
+ commit_subject: displayValue(git(sourceDir, ['show', '-s', '--format=%s', 'HEAD']) ?? undefined, 500),
129
+ commit_author_date: authorDateValue(git(sourceDir, ['show', '-s', '--format=%aI', 'HEAD']) ?? undefined),
130
+ remote_url: sanitizeRemoteUrl(git(sourceDir, ['config', '--get', 'remote.origin.url']) ?? undefined),
131
+ dirty: status === null ? null : status !== '',
132
+ };
133
+ }
134
+ function baseCiMetadata(source, sha) {
135
+ return {
136
+ metadata_source: source,
137
+ commit_sha: sha,
138
+ short_sha: sha.slice(0, 12),
139
+ branch: null,
140
+ tag: null,
141
+ commit_subject: null,
142
+ commit_author_date: null,
143
+ remote_url: null,
144
+ dirty: null,
145
+ };
146
+ }
147
+ function githubMetadata(environment) {
148
+ const sha = shaValue(environment.GITHUB_SHA);
149
+ if (!sha) {
150
+ return null;
151
+ }
152
+ const metadata = baseCiMetadata('github_actions', sha);
153
+ metadata.branch = displayValue(environment.GITHUB_HEAD_REF
154
+ || (environment.GITHUB_REF_TYPE === 'branch' ? environment.GITHUB_REF_NAME : undefined), 255);
155
+ metadata.tag = displayValue(environment.GITHUB_REF_TYPE === 'tag' ? environment.GITHUB_REF_NAME : undefined, 255);
156
+ const server = displayValue(environment.GITHUB_SERVER_URL, 1024);
157
+ const repository = displayValue(environment.GITHUB_REPOSITORY, 1024);
158
+ metadata.remote_url = sanitizeRemoteUrl(server && repository ? `${server.replace(/\/$/, '')}/${repository}` : undefined);
159
+ return metadata;
160
+ }
161
+ function gitlabMetadata(environment) {
162
+ const sha = shaValue(environment.CI_COMMIT_SHA);
163
+ if (!sha) {
164
+ return null;
165
+ }
166
+ return {
167
+ ...baseCiMetadata('gitlab_ci', sha),
168
+ branch: displayValue(environment.CI_COMMIT_REF_NAME, 255),
169
+ tag: displayValue(environment.CI_COMMIT_TAG, 255),
170
+ commit_subject: displayValue(environment.CI_COMMIT_TITLE, 500),
171
+ commit_author_date: authorDateValue(environment.CI_COMMIT_TIMESTAMP),
172
+ remote_url: sanitizeRemoteUrl(environment.CI_REPOSITORY_URL),
173
+ };
174
+ }
175
+ function circleMetadata(environment) {
176
+ const sha = shaValue(environment.CIRCLE_SHA1);
177
+ if (!sha) {
178
+ return null;
179
+ }
180
+ return {
181
+ ...baseCiMetadata('circleci', sha),
182
+ branch: displayValue(environment.CIRCLE_BRANCH, 255),
183
+ tag: displayValue(environment.CIRCLE_TAG, 255),
184
+ remote_url: sanitizeRemoteUrl(environment.CIRCLE_REPOSITORY_URL),
185
+ };
186
+ }
187
+ function bitbucketMetadata(environment) {
188
+ const sha = shaValue(environment.BITBUCKET_COMMIT);
189
+ if (!sha) {
190
+ return null;
191
+ }
192
+ return {
193
+ ...baseCiMetadata('bitbucket_pipelines', sha),
194
+ branch: displayValue(environment.BITBUCKET_BRANCH, 255),
195
+ tag: displayValue(environment.BITBUCKET_TAG, 255),
196
+ remote_url: sanitizeRemoteUrl(environment.BITBUCKET_GIT_HTTP_ORIGIN || environment.BITBUCKET_GIT_SSH_ORIGIN),
197
+ };
198
+ }
199
+ function collectSourceMetadata(sourceDir, environment = process.env) {
200
+ return localGitMetadata(path_1.default.resolve(sourceDir))
201
+ ?? githubMetadata(environment)
202
+ ?? gitlabMetadata(environment)
203
+ ?? circleMetadata(environment)
204
+ ?? bitbucketMetadata(environment);
205
+ }
206
+ function shouldCollectGitMetadata(options, environment = process.env) {
207
+ return options.gitMetadata !== false && environment.SOLIDACTIONS_NO_GIT_METADATA !== '1';
208
+ }
209
+ function appendSourceMetadata(form, metadata) {
210
+ if (metadata) {
211
+ form.append('source_metadata', JSON.stringify(metadata));
212
+ }
213
+ }
214
+ function buildDeployForm(archivePath, metadata) {
215
+ const form = new form_data_1.default();
216
+ form.append('source', fs_1.default.createReadStream(archivePath));
217
+ appendSourceMetadata(form, metadata);
218
+ return form;
219
+ }
220
+ function createDeployArchiveLocation() {
221
+ const directory = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'solidactions-deploy-'));
222
+ return {
223
+ directory,
224
+ archivePath: path_1.default.join(directory, 'source.tar.gz'),
225
+ cleanup: () => fs_1.default.rmSync(directory, { recursive: true, force: true }),
226
+ };
227
+ }
228
+ function nullableString(value) {
229
+ return typeof value === 'string' && value !== '' ? value : null;
230
+ }
231
+ function parseDeployAcceptance(data) {
232
+ const body = data && typeof data === 'object' ? data : {};
233
+ const sourceMetadata = body.source_metadata && typeof body.source_metadata === 'object'
234
+ ? body.source_metadata
235
+ : null;
236
+ return {
237
+ deploymentId: nullableString(body.deployment_id),
238
+ sourceMetadata,
239
+ sourceMetadataRejected: nullableString(body.source_metadata_rejected),
240
+ };
241
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTarArchive = createTarArchive;
4
+ // Kept in an untransformed CommonJS bridge because TypeScript rewrites
5
+ // import() to require() for this project, and require() cannot load archiver
6
+ // v8's ESM-only entry point on Node 18.
7
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
8
+ const importArchiver = require('./archiver-loader.cjs');
9
+ async function createTarArchive(options) {
10
+ const { TarArchive } = await importArchiver();
11
+ return new TarArchive(options);
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidactions/cli",
3
- "version": "2.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "SolidActions CLI - Deploy and manage workflow automation",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "license": "MIT",
24
24
  "engines": {
25
- "node": ">=18.0.0"
25
+ "node": ">=20.0.0"
26
26
  },
27
27
  "keywords": [
28
28
  "solidactions",
@@ -32,7 +32,7 @@
32
32
  "deploy"
33
33
  ],
34
34
  "scripts": {
35
- "build": "tsc && cp src/commands/dev-shim.mjs dist/commands/dev-shim.mjs",
35
+ "build": "tsc && cp src/commands/dev-shim.mjs dist/commands/dev-shim.mjs && cp src/utils/archiver-loader.cjs dist/utils/archiver-loader.cjs",
36
36
  "check:release": "npm run build && npm run test && npm run smoke:init",
37
37
  "prepublishOnly": "npm run build",
38
38
  "smoke:init": "node scripts/smoke-init.mjs",
@@ -40,7 +40,7 @@
40
40
  "test:watch": "vitest"
41
41
  },
42
42
  "dependencies": {
43
- "archiver": "^7.0.0",
43
+ "archiver": "^8.0.0",
44
44
  "axios": "^1.18.1",
45
45
  "chalk": "^4.1.2",
46
46
  "commander": "^11.0.0",
@@ -50,11 +50,11 @@
50
50
  "ignore": "^7.0.5",
51
51
  "js-yaml": "^4.3.0",
52
52
  "prompts": "^2.4.2",
53
- "tar": "^7.5.20"
53
+ "tar": "^7.5.22"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@solidactions/sdk": "^0.7.3",
57
- "@types/archiver": "^6.0.0",
57
+ "@types/archiver": "^8.0.0",
58
58
  "@types/fs-extra": "^11.0.0",
59
59
  "@types/js-yaml": "^4.0.9",
60
60
  "@types/node": "^20.0.0",