run402 3.6.0 → 3.7.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.
Files changed (39) hide show
  1. package/README.md +6 -2
  2. package/lib/deploy-v2.mjs +129 -29
  3. package/lib/up.mjs +77 -7
  4. package/package.json +2 -1
  5. package/sdk/dist/actions.d.ts +17 -2
  6. package/sdk/dist/actions.d.ts.map +1 -1
  7. package/sdk/dist/actions.js.map +1 -1
  8. package/sdk/dist/config.d.ts +61 -0
  9. package/sdk/dist/config.d.ts.map +1 -0
  10. package/sdk/dist/config.js +52 -0
  11. package/sdk/dist/config.js.map +1 -0
  12. package/sdk/dist/index.d.ts +2 -0
  13. package/sdk/dist/index.d.ts.map +1 -1
  14. package/sdk/dist/index.js +1 -0
  15. package/sdk/dist/index.js.map +1 -1
  16. package/sdk/dist/namespaces/deploy.d.ts +9 -0
  17. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  18. package/sdk/dist/namespaces/deploy.js +46 -17
  19. package/sdk/dist/namespaces/deploy.js.map +1 -1
  20. package/sdk/dist/namespaces/deploy.types.d.ts +23 -2
  21. package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
  22. package/sdk/dist/node/actions-node.d.ts.map +1 -1
  23. package/sdk/dist/node/actions-node.js +110 -6
  24. package/sdk/dist/node/actions-node.js.map +1 -1
  25. package/sdk/dist/node/config.d.ts +5 -0
  26. package/sdk/dist/node/config.d.ts.map +1 -0
  27. package/sdk/dist/node/config.js +3 -0
  28. package/sdk/dist/node/config.js.map +1 -0
  29. package/sdk/dist/node/deploy-manifest.d.ts +20 -1
  30. package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
  31. package/sdk/dist/node/deploy-manifest.js +265 -10
  32. package/sdk/dist/node/deploy-manifest.js.map +1 -1
  33. package/sdk/dist/node/index.d.ts +3 -1
  34. package/sdk/dist/node/index.d.ts.map +1 -1
  35. package/sdk/dist/node/index.js +2 -1
  36. package/sdk/dist/node/index.js.map +1 -1
  37. package/sdk/dist/scoped.d.ts +5 -0
  38. package/sdk/dist/scoped.d.ts.map +1 -1
  39. package/sdk/dist/scoped.js.map +1 -1
package/README.md CHANGED
@@ -35,11 +35,15 @@ Every command prints **JSON to stdout**, **JSON errors to stderr**, and exits **
35
35
 
36
36
  ```bash
37
37
  run402 up --name my-app -y
38
- run402 up --dry-run
38
+ run402 up --manifest run402.deploy.ts --check
39
+ run402 up --manifest run402.deploy.ts --plan
40
+ run402 up --manifest run402.deploy.ts --require-plan plan_...
39
41
  run402 up --manifest run402.deploy.json --project prj_...
40
42
  ```
41
43
 
42
- `up` is a thin CLI shim over the Node SDK action runner. It discovers `run402.deploy.json` then `app.json`, validates the deploy input before any mutation, resolves the project as `--project` → `.run402/project.json` → manifest `project_id` → approved creation from `--name` → approved active-project fallback, then applies the manifest. `--name` is creation/link metadata only; it is not a manifest field and never renames an existing project. When everything is already configured, plain `run402 up` deploys. Non-interactive recursive prerequisites/local writes require `-y/--yes`; `--dry-run` prints planned `steps[]` without gateway mutations, uploads, or local writes. Use repeatable `--allow-warning <code>` for reviewed deploy warnings and reserve broad `--allow-warnings` for exceptional reviewed cases. Run402 Core skips Cloud allowance/tier prerequisites and fails closed when no Core project is selected.
44
+ `up` is a thin CLI shim over the Node SDK action runner. It discovers `run402.deploy.json` then `app.json`, validates the deploy input before any mutation, resolves the project as `--project` → `.run402/project.json` → manifest `project_id` → approved creation from `--name` → approved active-project fallback, then applies the manifest. `--name` is creation/link metadata only; it is not a manifest field and never renames an existing project. When everything is already configured, plain `run402 up` deploys. Non-interactive recursive prerequisites/local writes require `-y/--yes`.
45
+
46
+ For typed `run402.deploy.ts` configs, pass `--manifest` explicitly because TypeScript/JavaScript configs execute local code. Use `--check` for local-only import/normalize/file validation, `--print-spec` to inspect the normalized `ReleaseSpec`, `--plan` for a gateway-reviewed non-deploying plan, and `--require-plan <plan_id>` to apply only that reviewed intent. Warning flags are not used with `--require-plan`; the reviewed plan binds the exact warning/destructive set. Run402 Core skips Cloud allowance/tier prerequisites and fails closed when no Core project is selected.
43
47
 
44
48
  ### Allowance
45
49
 
package/lib/deploy-v2.mjs CHANGED
@@ -23,10 +23,11 @@
23
23
  */
24
24
 
25
25
  import { existsSync, fstatSync, readFileSync } from "node:fs";
26
- import { resolve, dirname, isAbsolute } from "node:path";
26
+ import { resolve, dirname, extname, isAbsolute } from "node:path";
27
27
  import {
28
28
  buildDeployResolveSummary,
29
29
  githubActionsCredentials,
30
+ loadDeployManifest,
30
31
  normalizeDeployManifest,
31
32
  normalizeDeployResolveRequest,
32
33
  } from "#sdk/node";
@@ -41,8 +42,8 @@ import { editRequestAction, nextAction, retryAction } from "./next-actions.mjs";
41
42
  const APPLY_HELP = `run402 deploy apply — Unified deploy primitive (v1.34+)
42
43
 
43
44
  Usage:
44
- run402 deploy apply --manifest <path> [--project <id>] [--quiet|--final-only] [--allow-warning <code>] [--allow-warnings]
45
- run402 deploy apply --spec '<json>' [--project <id>] [--quiet|--final-only] [--allow-warning <code>] [--allow-warnings]
45
+ run402 deploy apply --manifest <path> [--project <id>] [--check|--print-spec|--plan|--require-plan <id>] [--quiet|--final-only]
46
+ run402 deploy apply --spec '<json>' [--project <id>] [--check|--print-spec|--plan|--require-plan <id>] [--quiet|--final-only]
46
47
  run402 deploy apply --dir <build-output> [--manifest <path>] [--project <id>]
47
48
  cat spec.json | run402 deploy apply [--project <id>]
48
49
 
@@ -90,6 +91,10 @@ Options:
90
91
  the slice carries the build output. Requires
91
92
  @run402/astro installed in the project.
92
93
  --project <id> Override project_id from the manifest
94
+ --check Validate and normalize locally. No gateway calls or uploads.
95
+ --print-spec Print the normalized ReleaseSpec JSON. No gateway calls or uploads.
96
+ --plan Ask the gateway for a reviewed plan. No upload or commit.
97
+ --require-plan <id> Apply only if this reviewed plan still matches.
93
98
  --quiet Suppress per-event JSON-line stderr (final result still on stdout)
94
99
  --final-only Alias for --quiet; final success/error envelope is still preserved
95
100
  --allow-warning <code> Continue past this reviewed warning code (repeatable)
@@ -138,6 +143,8 @@ Internationalization (routed functions):
138
143
  Static-route hits do NOT receive locale negotiation; only routed HTTP function invocations do. Run402 does NOT inject Vary headers.
139
144
  `;
140
145
 
146
+ const EXECUTABLE_MANIFEST_EXTENSIONS = new Set([".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"]);
147
+
141
148
  const RESUME_HELP = `run402 deploy resume — Resume a stuck deploy operation
142
149
 
143
150
  Usage:
@@ -494,8 +501,18 @@ function makeStderrEventWriter(quiet) {
494
501
  }
495
502
 
496
503
  function parseApplyArgs(args) {
497
- const opts = { manifest: null, spec: null, dir: null, project: null, quiet: false, allowWarnings: false, allowWarningCodes: [] };
498
- const allowedFlags = ["--manifest", "--spec", "--dir", "--project", "--quiet", "--final-only", "--allow-warning", "--allow-warnings", "--help", "-h"];
504
+ const opts = {
505
+ manifest: null,
506
+ spec: null,
507
+ dir: null,
508
+ project: null,
509
+ quiet: false,
510
+ allowWarnings: false,
511
+ allowWarningCodes: [],
512
+ mode: null,
513
+ planFingerprint: null,
514
+ };
515
+ const allowedFlags = ["--manifest", "--spec", "--dir", "--project", "--quiet", "--final-only", "--allow-warning", "--allow-warnings", "--check", "--print-spec", "--plan", "--require-plan", "--plan-fingerprint", "--help", "-h"];
499
516
 
500
517
  for (let i = 0; i < args.length; i++) {
501
518
  const arg = args[i];
@@ -503,7 +520,7 @@ function parseApplyArgs(args) {
503
520
  console.log(APPLY_HELP);
504
521
  process.exit(0);
505
522
  }
506
- if (arg === "--manifest" || arg === "--spec" || arg === "--dir" || arg === "--project" || arg === "--allow-warning") {
523
+ if (arg === "--manifest" || arg === "--spec" || arg === "--dir" || arg === "--project" || arg === "--allow-warning" || arg === "--require-plan" || arg === "--plan-fingerprint") {
507
524
  const value = args[i + 1];
508
525
  if (value === undefined || (typeof value === "string" && value.startsWith("--"))) {
509
526
  fail({
@@ -541,14 +558,21 @@ function parseApplyArgs(args) {
541
558
  opts.dir = value;
542
559
  } else if (arg === "--project") {
543
560
  opts.project = value;
544
- } else {
561
+ } else if (arg === "--allow-warning") {
545
562
  opts.allowWarningCodes.push(value);
563
+ } else if (arg === "--require-plan") {
564
+ setApplyMode(opts, { kind: "applyReviewed", planId: value }, "--require-plan");
565
+ } else {
566
+ opts.planFingerprint = value;
546
567
  }
547
568
  i += 1;
548
569
  continue;
549
570
  }
550
571
  if (arg === "--quiet" || arg === "--final-only") { opts.quiet = true; continue; }
551
572
  if (arg === "--allow-warnings") { opts.allowWarnings = true; continue; }
573
+ if (arg === "--check") { setApplyMode(opts, "check", "--check"); continue; }
574
+ if (arg === "--print-spec") { setApplyMode(opts, "printSpec", "--print-spec"); continue; }
575
+ if (arg === "--plan") { setApplyMode(opts, "plan", "--plan"); continue; }
552
576
  if (typeof arg === "string" && arg.startsWith("-")) {
553
577
  fail({
554
578
  code: "BAD_USAGE",
@@ -562,10 +586,38 @@ function parseApplyArgs(args) {
562
586
  details: { argument: arg },
563
587
  });
564
588
  }
589
+ if (opts.planFingerprint && (!opts.mode || opts.mode.kind !== "applyReviewed")) {
590
+ fail({
591
+ code: "BAD_USAGE",
592
+ message: "--plan-fingerprint can only be used with --require-plan.",
593
+ details: { flag: "--plan-fingerprint" },
594
+ });
595
+ }
596
+ if (opts.mode && opts.mode.kind === "applyReviewed") {
597
+ if (opts.planFingerprint) opts.mode.planFingerprint = opts.planFingerprint;
598
+ if (opts.allowWarnings || opts.allowWarningCodes.length > 0) {
599
+ fail({
600
+ code: "BAD_USAGE",
601
+ message: "--allow-warning/--allow-warnings are not used with --require-plan; the reviewed plan already binds the warning set.",
602
+ details: { flag: "--require-plan" },
603
+ });
604
+ }
605
+ }
565
606
 
566
607
  return opts;
567
608
  }
568
609
 
610
+ function setApplyMode(opts, mode, flag) {
611
+ if (opts.mode !== null) {
612
+ fail({
613
+ code: "BAD_USAGE",
614
+ message: "Choose only one execution mode for deploy apply.",
615
+ details: { existing_mode: opts.mode, flag },
616
+ });
617
+ }
618
+ opts.mode = mode;
619
+ }
620
+
569
621
  // Resolve the single manifest source from parsed opts + whether stdin actually
570
622
  // has data (a pipe/file on fd 0). Explicit --manifest/--spec/--dir take
571
623
  // precedence over incidental stdin: a CI runner (e.g. GitHub Actions) hands the
@@ -738,12 +790,14 @@ async function applyCmd(args) {
738
790
 
739
791
  let raw;
740
792
  let manifestPath = null;
793
+ let executableManifest = false;
741
794
  if (source === "spec") {
742
795
  raw = opts.spec;
743
796
  } else if (source === "manifest") {
744
797
  try {
745
798
  manifestPath = isAbsolute(opts.manifest) ? opts.manifest : resolve(process.cwd(), opts.manifest);
746
- raw = readFileSync(manifestPath, "utf-8");
799
+ executableManifest = EXECUTABLE_MANIFEST_EXTENSIONS.has(extname(manifestPath).toLowerCase());
800
+ raw = executableManifest ? null : readFileSync(manifestPath, "utf-8");
747
801
  } catch (err) {
748
802
  fail({
749
803
  code: "BAD_USAGE",
@@ -760,21 +814,30 @@ async function applyCmd(args) {
760
814
  raw = await readStdin();
761
815
  }
762
816
 
763
- let spec;
764
- try {
765
- spec = JSON.parse(raw);
766
- } catch (err) {
817
+ let spec = null;
818
+ if (!executableManifest) {
819
+ try {
820
+ spec = JSON.parse(raw);
821
+ } catch (err) {
822
+ fail({
823
+ code: "BAD_USAGE",
824
+ message: `Manifest is not valid JSON: ${err.message}`,
825
+ details: { source, parse_error: err.message },
826
+ });
827
+ }
828
+ rejectLegacySecretManifest(spec, {
829
+ source,
830
+ ...(manifestPath ? { path: manifestPath } : {}),
831
+ });
832
+ }
833
+
834
+ if (opts.dir !== null && executableManifest) {
767
835
  fail({
768
836
  code: "BAD_USAGE",
769
- message: `Manifest is not valid JSON: ${err.message}`,
770
- details: { source, parse_error: err.message },
837
+ message: "--dir cannot be merged into an executable deploy config. Put the site/function helper in the config file instead.",
838
+ details: { flag: "--dir", manifest: manifestPath },
771
839
  });
772
840
  }
773
- rejectLegacySecretManifest(spec, {
774
- source,
775
- ...(manifestPath ? { path: manifestPath } : {}),
776
- });
777
-
778
841
  if (opts.dir !== null) {
779
842
  await mergeAstroReleaseSlice(spec, opts.dir);
780
843
  }
@@ -810,8 +873,10 @@ async function applyCmd(args) {
810
873
  if (key === "i18n" && value === null) return true;
811
874
  return hasContent(value);
812
875
  }
813
- const hasMeaningfulContent = spec && typeof spec === "object" && !Array.isArray(spec) &&
814
- meaningful.some((key) => hasDeployableSection(key, spec[key]));
876
+ const hasMeaningfulContent = executableManifest || (
877
+ spec && typeof spec === "object" && !Array.isArray(spec) &&
878
+ meaningful.some((key) => hasDeployableSection(key, spec[key]))
879
+ );
815
880
  if (!hasMeaningfulContent) {
816
881
  fail({
817
882
  code: "MANIFEST_EMPTY",
@@ -825,7 +890,7 @@ async function applyCmd(args) {
825
890
  });
826
891
  }
827
892
 
828
- const manifestProject = spec.project ?? spec.project_id;
893
+ const manifestProject = spec?.project ?? spec?.project_id;
829
894
  if (opts.project && manifestProject && manifestProject !== opts.project) {
830
895
  fail({
831
896
  code: "BAD_USAGE",
@@ -841,11 +906,16 @@ async function applyCmd(args) {
841
906
 
842
907
  let normalizedManifest;
843
908
  try {
844
- normalizedManifest = await normalizeDeployManifest(spec, {
845
- baseDir: manifestPath ? dirname(manifestPath) : process.cwd(),
846
- ...(opts.project ? { project: opts.project } : {}),
847
- ...(defaultProject ? { defaultProject } : {}),
848
- });
909
+ normalizedManifest = executableManifest
910
+ ? await loadDeployManifest(manifestPath, {
911
+ ...(opts.project ? { project: opts.project } : {}),
912
+ ...(defaultProject ? { defaultProject } : {}),
913
+ })
914
+ : await normalizeDeployManifest(spec, {
915
+ baseDir: manifestPath ? dirname(manifestPath) : process.cwd(),
916
+ ...(opts.project ? { project: opts.project } : {}),
917
+ ...(defaultProject ? { defaultProject } : {}),
918
+ });
849
919
  } catch (err) {
850
920
  reportSdkError(err);
851
921
  }
@@ -853,6 +923,20 @@ async function applyCmd(args) {
853
923
  const releaseSpec = normalizedManifest.spec;
854
924
  const idempotencyKey = normalizedManifest.idempotencyKey;
855
925
 
926
+ if (opts.mode === "check") {
927
+ console.log(JSON.stringify({
928
+ ok: true,
929
+ mode: "check",
930
+ project_id: releaseSpec.project,
931
+ manifest_path: manifestPath,
932
+ }, null, 2));
933
+ return;
934
+ }
935
+ if (opts.mode === "printSpec") {
936
+ console.log(JSON.stringify(releaseSpec, null, 2));
937
+ return;
938
+ }
939
+
856
940
  // Pre-flight source scan (auth-aware-ssr Section 9). Bypass via
857
941
  // RUN402_DEPLOY_SKIP_SCAN=1 — useful for forcing a deploy when
858
942
  // the scanner has a false positive that the operator has confirmed
@@ -865,7 +949,7 @@ async function applyCmd(args) {
865
949
  // manifest deploy: running from inside an unrelated source tree (e.g.
866
950
  // the gateway monorepo, which legitimately has dozens of `getUser`
867
951
  // references) would otherwise block a deploy of one unrelated HTML file.
868
- if (process.env.RUN402_DEPLOY_SKIP_SCAN !== "1") {
952
+ if (!isNonApplyingMode(opts.mode) && process.env.RUN402_DEPLOY_SKIP_SCAN !== "1") {
869
953
  try {
870
954
  const { scanSourceTree, scanSourceFiles, SCAN_SEVERITY } = await import(
871
955
  "./doctor-source-scan.mjs"
@@ -879,7 +963,7 @@ async function applyCmd(args) {
879
963
  findings = scanSourceTree(scanRoot, { cwd: process.cwd() });
880
964
  } else {
881
965
  const baseDir = manifestPath ? dirname(manifestPath) : process.cwd();
882
- const files = collectManifestSourceFiles(spec, baseDir).filter(
966
+ const files = collectManifestSourceFiles(spec ?? normalizedManifest.manifest, baseDir).filter(
883
967
  (p) => scannableExt.test(p) && existsSync(p),
884
968
  );
885
969
  findings = files.length > 0
@@ -925,12 +1009,24 @@ async function applyCmd(args) {
925
1009
  }
926
1010
 
927
1011
  try {
1012
+ if (opts.mode === "plan") {
1013
+ const result = await getSdk(sdkOpts)._applyEngine.plan(releaseSpec, {
1014
+ idempotencyKey,
1015
+ mode: "reviewedPlan",
1016
+ });
1017
+ console.log(JSON.stringify(result.plan, null, 2));
1018
+ return;
1019
+ }
1020
+ const requiredPlan = opts.mode && opts.mode.kind === "applyReviewed"
1021
+ ? { planId: opts.mode.planId, ...(opts.mode.planFingerprint ? { planFingerprint: opts.mode.planFingerprint } : {}) }
1022
+ : undefined;
928
1023
  const result = await withAutoApprove(() =>
929
1024
  getSdk(sdkOpts)._applyEngine.apply(releaseSpec, {
930
1025
  onEvent: makeStderrEventWriter(opts.quiet),
931
1026
  idempotencyKey,
932
1027
  allowWarnings: opts.allowWarnings,
933
1028
  allowWarningCodes: opts.allowWarningCodes,
1029
+ ...(requiredPlan ? { requiredPlan } : {}),
934
1030
  target: isCoreApiTarget() ? "core" : "cloud",
935
1031
  }),
936
1032
  );
@@ -940,6 +1036,10 @@ async function applyCmd(args) {
940
1036
  }
941
1037
  }
942
1038
 
1039
+ function isNonApplyingMode(mode) {
1040
+ return mode === "check" || mode === "printSpec" || mode === "plan";
1041
+ }
1042
+
943
1043
  function hasGithubActionsOidcEnv(env = process.env) {
944
1044
  return env.GITHUB_ACTIONS === "true" &&
945
1045
  Boolean(env.ACTIONS_ID_TOKEN_REQUEST_URL) &&
package/lib/up.mjs CHANGED
@@ -7,7 +7,7 @@ import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs } from "./ar
7
7
  const HELP = `run402 up — Provision/link/deploy the current app
8
8
 
9
9
  Usage:
10
- run402 up [--name <name>] [--project <id>] [--manifest <path>] [--dir <path>] [--tier <tier>] [-y|--yes] [--dry-run] [--quiet]
10
+ run402 up [--name <name>] [--project <id>] [--manifest <path>] [--dir <path>] [--tier <tier>] [-y|--yes] [--check|--print-spec|--plan|--require-plan <id>] [--quiet]
11
11
 
12
12
  Options:
13
13
  --name <name> Project display name when up needs to create a project.
@@ -20,8 +20,16 @@ Options:
20
20
  (prototype, hobby, team; default prototype).
21
21
  -y, --yes Approve recursive prerequisites/local writes (allowance,
22
22
  tier, project creation, workspace link) for non-interactive runs.
23
- --dry-run Plan the recursive action graph without gateway mutations,
23
+ --check Validate the manifest/config locally. No gateway calls,
24
24
  uploads, or local writes.
25
+ --print-spec Print the normalized ReleaseSpec JSON. No gateway calls,
26
+ uploads, or local writes.
27
+ --plan Ask the gateway for a reviewed deploy plan. No upload,
28
+ commit, project provisioning, or workspace link write.
29
+ --require-plan <id> Apply only if this reviewed plan still matches.
30
+ --plan-fingerprint <fingerprint>
31
+ Optional fingerprint returned by --plan. Only valid
32
+ with --require-plan.
25
33
  --allow-warning <code>
26
34
  Acknowledge a reviewed deploy warning code (repeatable).
27
35
  --allow-warnings Acknowledge all reviewed deploy warnings.
@@ -33,8 +41,9 @@ Project resolution:
33
41
 
34
42
  Examples:
35
43
  run402 up --name my-app -y
36
- run402 up --dry-run
37
- run402 up --manifest run402.deploy.json --project prj_...
44
+ run402 up --manifest run402.deploy.ts --check
45
+ run402 up --manifest run402.deploy.ts --plan
46
+ run402 up --manifest run402.deploy.ts --require-plan pln_...
38
47
  `;
39
48
 
40
49
  const TIERS = new Set(["prototype", "hobby", "team"]);
@@ -47,8 +56,8 @@ export async function run(args = []) {
47
56
  }
48
57
  assertKnownFlags(
49
58
  parsed,
50
- ["--help", "-h", "-y", "--yes", "--dry-run", "--quiet", "--final-only", "--allow-warnings"],
51
- ["--name", "--project", "--manifest", "--dir", "--tier", "--idempotency-key", "--allow-warning"],
59
+ ["--help", "-h", "-y", "--yes", "--dry-run", "--check", "--print-spec", "--plan", "--quiet", "--final-only", "--allow-warnings"],
60
+ ["--name", "--project", "--manifest", "--dir", "--tier", "--idempotency-key", "--allow-warning", "--require-plan", "--plan-fingerprint"],
52
61
  );
53
62
  const extras = positionalArgs(parsed, [
54
63
  "--name",
@@ -58,6 +67,8 @@ export async function run(args = []) {
58
67
  "--tier",
59
68
  "--idempotency-key",
60
69
  "--allow-warning",
70
+ "--require-plan",
71
+ "--plan-fingerprint",
61
72
  ]);
62
73
  if (extras.length > 0) {
63
74
  fail({
@@ -78,7 +89,22 @@ export async function run(args = []) {
78
89
 
79
90
  const yes = parsed.includes("-y") || parsed.includes("--yes");
80
91
  const quiet = parsed.includes("--quiet") || parsed.includes("--final-only");
92
+ const mode = parseExecutionMode(parsed);
81
93
  const dryRun = parsed.includes("--dry-run");
94
+ if (dryRun && mode !== undefined) {
95
+ fail({
96
+ code: "BAD_USAGE",
97
+ message: "--dry-run cannot be combined with --check, --print-spec, --plan, or --require-plan.",
98
+ details: { flag: "--dry-run" },
99
+ });
100
+ }
101
+ if (isApplyReviewedMode(mode) && (parsed.includes("--allow-warnings") || parsed.includes("--allow-warning"))) {
102
+ fail({
103
+ code: "BAD_USAGE",
104
+ message: "--allow-warning/--allow-warnings are not used with --require-plan; the reviewed plan already binds the warning set.",
105
+ details: { flag: "--require-plan" },
106
+ });
107
+ }
82
108
  const allowWarningCodes = collectRepeatedValues(parsed, "--allow-warning");
83
109
 
84
110
  try {
@@ -93,18 +119,62 @@ export async function run(args = []) {
93
119
  allowWarnings: parsed.includes("--allow-warnings") ? true : undefined,
94
120
  allowWarningCodes,
95
121
  }, {
122
+ ...(mode !== undefined ? { mode } : {}),
96
123
  dryRun,
97
124
  approval: makeApproval(yes),
98
125
  onEvent: quiet ? undefined : (event) => {
99
126
  console.error(JSON.stringify(event));
100
127
  },
101
128
  });
102
- console.log(JSON.stringify(result, null, 2));
129
+ if (mode === "printSpec") {
130
+ console.log(JSON.stringify(result.result?.spec ?? null, null, 2));
131
+ } else {
132
+ console.log(JSON.stringify(result, null, 2));
133
+ }
103
134
  } catch (err) {
104
135
  reportSdkError(err);
105
136
  }
106
137
  }
107
138
 
139
+ function parseExecutionMode(args) {
140
+ const modes = [];
141
+ if (args.includes("--check")) modes.push("--check");
142
+ if (args.includes("--print-spec")) modes.push("--print-spec");
143
+ if (args.includes("--plan")) modes.push("--plan");
144
+ const requiredPlan = flagValue(args, "--require-plan");
145
+ if (requiredPlan) modes.push("--require-plan");
146
+ const fingerprint = flagValue(args, "--plan-fingerprint");
147
+ if (fingerprint && !requiredPlan) {
148
+ fail({
149
+ code: "BAD_USAGE",
150
+ message: "--plan-fingerprint can only be used with --require-plan.",
151
+ details: { flag: "--plan-fingerprint" },
152
+ });
153
+ }
154
+ if (modes.length > 1) {
155
+ fail({
156
+ code: "BAD_USAGE",
157
+ message: `Choose only one execution mode: ${modes.join(", ")}`,
158
+ details: { modes },
159
+ });
160
+ }
161
+ if (args.includes("--check")) return "check";
162
+ if (args.includes("--print-spec")) return "printSpec";
163
+ if (args.includes("--plan")) return "plan";
164
+ if (requiredPlan) {
165
+ return {
166
+ kind: "applyReviewed",
167
+ planId: requiredPlan,
168
+ ...(fingerprint ? { planFingerprint: fingerprint } : {}),
169
+ };
170
+ }
171
+ return undefined;
172
+ }
173
+
174
+ function isApplyReviewedMode(mode) {
175
+ return mode && typeof mode === "object" && mode.kind === "applyReviewed";
176
+ }
177
+
108
178
  function collectRepeatedValues(args, flag) {
109
179
  const values = [];
110
180
  for (let i = 0; i < args.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "CLI for Run402 — provision Postgres databases, deploy static sites, generate images, and manage wallets via x402 and MPP micropayments.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,6 +24,7 @@
24
24
  "@x402/evm": "^2.6.0",
25
25
  "@x402/fetch": "^2.6.0",
26
26
  "mppx": "^0.4.7",
27
+ "tsx": "^4.21.0",
27
28
  "viem": "^2.47.1"
28
29
  },
29
30
  "engines": {
@@ -1,6 +1,7 @@
1
- import type { DeployResult } from "./namespaces/deploy.types.js";
1
+ import type { DeployResult, PlanResponse, ReleaseSpec } from "./namespaces/deploy.types.js";
2
2
  import type { ProvisionResult } from "./namespaces/projects.types.js";
3
3
  import type { TierName, TierSetResult } from "./namespaces/tier.js";
4
+ import type { Run402ExecutionMode } from "./config.js";
4
5
  /**
5
6
  * Stable action identifiers for the SDK action runner. Use these constants
6
7
  * instead of hand-typed strings so TypeScript narrows action inputs cleanly.
@@ -63,7 +64,18 @@ export interface Run402ActionApprovalRequest {
63
64
  export type Run402ActionMutation = "allowance.create" | "allowance.faucet" | "tier.set" | "projects.provision" | "workspace.link.write" | "deploy.apply";
64
65
  export interface Run402ActionRunOptions {
65
66
  /**
66
- * Plan only. No gateway mutations, uploads, or local writes are performed.
67
+ * Canonical execution mode for typed-config workflows.
68
+ *
69
+ * - `check`: local manifest/config validation only
70
+ * - `printSpec`: local validation plus normalized ReleaseSpec output
71
+ * - `plan`: gateway-reviewed plan, no upload or commit
72
+ * - `{ kind: "applyReviewed" }`: apply only if a reviewed plan still matches
73
+ * - `apply`: default mutation path
74
+ */
75
+ mode?: Run402ExecutionMode;
76
+ /**
77
+ * Legacy action-graph dry run. Prefer `mode: "check"` for local-only
78
+ * typed-config validation or `mode: "plan"` for gateway-reviewed plans.
67
79
  */
68
80
  dryRun?: boolean;
69
81
  /**
@@ -98,6 +110,7 @@ export interface Run402ActionEvent {
98
110
  }
99
111
  export interface Run402ActionResult<T = unknown> {
100
112
  action: Run402ActionType;
113
+ mode: Run402ExecutionMode | "legacyDryRun";
101
114
  dry_run: boolean;
102
115
  target: "cloud" | "core" | "unknown";
103
116
  steps: Run402ActionStep[];
@@ -107,6 +120,8 @@ export interface Run402UpResult {
107
120
  project_id: string;
108
121
  manifest_path: string;
109
122
  workspace_link_path?: string;
123
+ spec?: ReleaseSpec;
124
+ plan?: PlanResponse;
110
125
  deploy?: DeployResult;
111
126
  }
112
127
  export type Run402ProjectsProvisionActionResult = Run402ActionResult<ProvisionResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAC1B,OAAO,YAAY,CAAC,MAAM,OAA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,wBAAwB,EAC/B,IAAI,CAAC,EAAE,sBAAsB,GAC5B,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtC,GAAG,CACD,KAAK,EAAE,mBAAmB,EAC1B,IAAI,CAAC,EAAE,sBAAsB,GAC5B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,iBAAiB,EAAE,oBAAoB;IACvC,OAAO,EAAE,UAAU;IACnB,EAAE,EAAE,IAAI;CACA,CAAC"}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,iBAAiB,EAAE,oBAAoB;IACvC,OAAO,EAAE,UAAU;IACnB,EAAE,EAAE,IAAI;CACA,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { FsFileSource, FunctionSpec, LocalDirRef, ReleaseSpec } from "./namespaces/deploy.types.js";
2
+ export type Run402ExecutionMode = "apply" | "check" | "printSpec" | "plan" | {
3
+ kind: "applyReviewed";
4
+ planId: string;
5
+ planFingerprint?: string;
6
+ };
7
+ export interface Run402ReviewedPlanRequirement {
8
+ planId: string;
9
+ planFingerprint?: string;
10
+ }
11
+ export interface Run402FileConfigOptions {
12
+ contentType?: string;
13
+ content_type?: string;
14
+ }
15
+ export interface Run402DirConfigOptions {
16
+ prefix?: string;
17
+ ignore?: ReadonlyArray<string>;
18
+ includeSensitive?: boolean;
19
+ }
20
+ export interface Run402SqlFileConfigOptions {
21
+ id?: string;
22
+ checksum?: string;
23
+ transaction?: "required" | "none";
24
+ }
25
+ export interface Run402NodeFunctionConfigOptions extends Omit<FunctionSpec, "source" | "files" | "runtime"> {
26
+ runtime?: "node22";
27
+ source?: never;
28
+ files?: never;
29
+ }
30
+ export interface Run402FileConfigSource extends FsFileSource {
31
+ readonly content_type?: string;
32
+ }
33
+ export interface Run402SqlFileConfigMigration {
34
+ id: string;
35
+ sql_file: string;
36
+ checksum?: string;
37
+ transaction?: "required" | "none";
38
+ }
39
+ export type Run402ReleaseConfig = Omit<ReleaseSpec, "project"> & {
40
+ project?: string;
41
+ project_id?: string;
42
+ idempotency_key?: string;
43
+ };
44
+ export interface Run402ConfigEnv {
45
+ readonly accessed: readonly string[];
46
+ get(name: string): string | undefined;
47
+ required(name: string): string;
48
+ readonly [name: `RUN402_${string}`]: string | undefined;
49
+ }
50
+ export interface Run402ConfigContext {
51
+ manifestPath: string;
52
+ rootDir: string;
53
+ env: Run402ConfigEnv;
54
+ }
55
+ export type Run402ExecutableConfigExport = Run402ReleaseConfig | ((context: Run402ConfigContext) => Run402ReleaseConfig | Promise<Run402ReleaseConfig>);
56
+ export declare function defineConfig<const T extends Run402ExecutableConfigExport>(config: T): T;
57
+ export declare function dir(path: string, options?: Run402DirConfigOptions): LocalDirRef;
58
+ export declare function file(path: string, options?: Run402FileConfigOptions): Run402FileConfigSource;
59
+ export declare function sqlFile(path: string, options?: Run402SqlFileConfigOptions): Run402SqlFileConfigMigration;
60
+ export declare function nodeFunction(path: string, options?: Run402NodeFunctionConfigOptions): FunctionSpec;
61
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,mBAAmB,GAC3B,OAAO,GACP,OAAO,GACP,WAAW,GACX,MAAM,GACN;IAAE,IAAI,EAAE,eAAe,CAAC;IAA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