@hsuite/smart-engines-cli 1.2.1 → 1.4.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 (109) hide show
  1. package/README.md +272 -58
  2. package/dist/_lib/attestation.d.ts +45 -0
  3. package/dist/_lib/attestation.d.ts.map +1 -0
  4. package/dist/_lib/attestation.js +76 -0
  5. package/dist/_lib/attestation.js.map +1 -0
  6. package/dist/_lib/baas.d.ts +147 -0
  7. package/dist/_lib/baas.d.ts.map +1 -0
  8. package/dist/_lib/baas.js +260 -0
  9. package/dist/_lib/baas.js.map +1 -0
  10. package/dist/_lib/cluster.d.ts +6 -6
  11. package/dist/_lib/cluster.js +6 -6
  12. package/dist/_lib/deploy-manifest.d.ts +69 -0
  13. package/dist/_lib/deploy-manifest.d.ts.map +1 -0
  14. package/dist/_lib/deploy-manifest.js +87 -0
  15. package/dist/_lib/deploy-manifest.js.map +1 -0
  16. package/dist/_lib/docker.d.ts +82 -0
  17. package/dist/_lib/docker.d.ts.map +1 -0
  18. package/dist/_lib/docker.js +164 -0
  19. package/dist/_lib/docker.js.map +1 -0
  20. package/dist/_lib/faucet-client.d.ts +64 -0
  21. package/dist/_lib/faucet-client.d.ts.map +1 -0
  22. package/dist/_lib/faucet-client.js +92 -0
  23. package/dist/_lib/faucet-client.js.map +1 -0
  24. package/dist/_lib/framework.d.ts +59 -0
  25. package/dist/_lib/framework.d.ts.map +1 -0
  26. package/dist/_lib/framework.js +149 -0
  27. package/dist/_lib/framework.js.map +1 -0
  28. package/dist/_lib/frontend-guard.d.ts +13 -0
  29. package/dist/_lib/frontend-guard.d.ts.map +1 -0
  30. package/dist/_lib/frontend-guard.js +41 -0
  31. package/dist/_lib/frontend-guard.js.map +1 -0
  32. package/dist/_lib/registry-fanout.d.ts +114 -0
  33. package/dist/_lib/registry-fanout.d.ts.map +1 -0
  34. package/dist/_lib/registry-fanout.js +435 -0
  35. package/dist/_lib/registry-fanout.js.map +1 -0
  36. package/dist/_lib/runtime-env.d.ts +126 -0
  37. package/dist/_lib/runtime-env.d.ts.map +1 -0
  38. package/dist/_lib/runtime-env.js +172 -0
  39. package/dist/_lib/runtime-env.js.map +1 -0
  40. package/dist/_lib/subscription-client.d.ts +129 -18
  41. package/dist/_lib/subscription-client.d.ts.map +1 -1
  42. package/dist/_lib/subscription-client.js +268 -40
  43. package/dist/_lib/subscription-client.js.map +1 -1
  44. package/dist/_lib/subscription-env.d.ts +35 -0
  45. package/dist/_lib/subscription-env.d.ts.map +1 -1
  46. package/dist/_lib/subscription-env.js +46 -2
  47. package/dist/_lib/subscription-env.js.map +1 -1
  48. package/dist/commands/app-lifecycle.d.ts +36 -0
  49. package/dist/commands/app-lifecycle.d.ts.map +1 -0
  50. package/dist/commands/app-lifecycle.js +145 -0
  51. package/dist/commands/app-lifecycle.js.map +1 -0
  52. package/dist/commands/ci.d.ts +45 -0
  53. package/dist/commands/ci.d.ts.map +1 -0
  54. package/dist/commands/ci.js +174 -0
  55. package/dist/commands/ci.js.map +1 -0
  56. package/dist/commands/deploy-manifest.d.ts +11 -0
  57. package/dist/commands/deploy-manifest.d.ts.map +1 -0
  58. package/dist/commands/deploy-manifest.js +17 -0
  59. package/dist/commands/deploy-manifest.js.map +1 -0
  60. package/dist/commands/deploy.d.ts +70 -11
  61. package/dist/commands/deploy.d.ts.map +1 -1
  62. package/dist/commands/deploy.js +263 -150
  63. package/dist/commands/deploy.js.map +1 -1
  64. package/dist/commands/downgrade.js +1 -1
  65. package/dist/commands/downgrade.js.map +1 -1
  66. package/dist/commands/faucet.d.ts +78 -0
  67. package/dist/commands/faucet.d.ts.map +1 -0
  68. package/dist/commands/faucet.js +184 -0
  69. package/dist/commands/faucet.js.map +1 -0
  70. package/dist/commands/governance.js +1 -1
  71. package/dist/commands/governance.js.map +1 -1
  72. package/dist/commands/hist-balance.d.ts +1 -1
  73. package/dist/commands/hist-balance.js +1 -1
  74. package/dist/commands/init.js +1 -1
  75. package/dist/commands/list.d.ts +22 -0
  76. package/dist/commands/list.d.ts.map +1 -0
  77. package/dist/commands/list.js +81 -0
  78. package/dist/commands/list.js.map +1 -0
  79. package/dist/commands/personhood.js +2 -2
  80. package/dist/commands/personhood.js.map +1 -1
  81. package/dist/commands/redeploy.d.ts +62 -0
  82. package/dist/commands/redeploy.d.ts.map +1 -0
  83. package/dist/commands/redeploy.js +310 -0
  84. package/dist/commands/redeploy.js.map +1 -0
  85. package/dist/commands/status.d.ts +51 -0
  86. package/dist/commands/status.d.ts.map +1 -0
  87. package/dist/commands/status.js +138 -0
  88. package/dist/commands/status.js.map +1 -0
  89. package/dist/commands/subscribe.d.ts +94 -17
  90. package/dist/commands/subscribe.d.ts.map +1 -1
  91. package/dist/commands/subscribe.js +450 -81
  92. package/dist/commands/subscribe.js.map +1 -1
  93. package/dist/commands/transactions.d.ts +60 -0
  94. package/dist/commands/transactions.d.ts.map +1 -0
  95. package/dist/commands/transactions.js +101 -0
  96. package/dist/commands/transactions.js.map +1 -0
  97. package/dist/commands/update.d.ts +40 -0
  98. package/dist/commands/update.d.ts.map +1 -0
  99. package/dist/commands/update.js +114 -0
  100. package/dist/commands/update.js.map +1 -0
  101. package/dist/commands/verify.d.ts +10 -19
  102. package/dist/commands/verify.d.ts.map +1 -1
  103. package/dist/commands/verify.js +14 -23
  104. package/dist/commands/verify.js.map +1 -1
  105. package/dist/index.d.ts +12 -3
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +32 -3
  108. package/dist/index.js.map +1 -1
  109. package/package.json +11 -4
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.deleteCommand = exports.resumeCommand = exports.suspendCommand = void 0;
40
+ exports.runLifecycle = runLifecycle;
41
+ /**
42
+ * `hsuite suspend` / `resume` / `delete` — runtime lifecycle controls for a
43
+ * deployed app.
44
+ *
45
+ * - suspend → scale the runtime to zero (`deployment.suspend`).
46
+ * - resume → scale it back up (`deployment.resume`).
47
+ * - delete → tear the namespace down (`deployment.delete`). Destructive, so
48
+ * it confirms first UNLESS `--yes` is passed or stdin is not a TTY
49
+ * (non-interactive contexts must opt in explicitly via `--yes`).
50
+ */
51
+ const commander_1 = require("commander");
52
+ const chalk_1 = __importDefault(require("chalk"));
53
+ const readline = __importStar(require("readline"));
54
+ const env_1 = require("../_lib/env");
55
+ const subscription_env_1 = require("../_lib/subscription-env");
56
+ const cluster_1 = require("../_lib/cluster");
57
+ const baas_1 = require("../_lib/baas");
58
+ /** Default y/N confirmation over stdin. Returns false on EOF / non-`y`. */
59
+ async function defaultConfirm(message) {
60
+ // Non-TTY: never auto-confirm a destructive op — require --yes.
61
+ if (!process.stdin.isTTY)
62
+ return false;
63
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
64
+ try {
65
+ const answer = await new Promise((res) => rl.question(`${message} [y/N] `, res));
66
+ return /^y(es)?$/i.test(answer.trim());
67
+ }
68
+ finally {
69
+ rl.close();
70
+ }
71
+ }
72
+ /** Pure orchestration body — exported for unit tests. */
73
+ async function runLifecycle(opts) {
74
+ const env = (0, env_1.readEnv)(opts.envPath);
75
+ // Auth IDENTITY (subscription) ≠ management TARGET (deployed app). See status.ts.
76
+ // Resolve the subscription appId up front so a missing-subscription error
77
+ // fails fast — BEFORE the destructive confirmation prompt.
78
+ const appId = (0, subscription_env_1.requireAppId)(env, { appId: opts.appId });
79
+ const subscriptionAppId = (0, subscription_env_1.requireSubscriptionAppId)(env, {
80
+ subscriptionAppId: opts.subscriptionAppId,
81
+ });
82
+ if (opts.action === 'delete' && !opts.yes) {
83
+ const confirm = opts.confirmFn ?? defaultConfirm;
84
+ const ok = await confirm(`Delete app ${appId}? This tears down its namespace.`);
85
+ if (!ok) {
86
+ return { appId, performed: false };
87
+ }
88
+ }
89
+ const client = await (0, baas_1.connectAndAuth)({
90
+ gateway: opts.gateway,
91
+ env,
92
+ appId: subscriptionAppId,
93
+ clientFactory: opts.clientFactory,
94
+ });
95
+ if (opts.action === 'suspend')
96
+ await client.deployment.suspend(appId);
97
+ else if (opts.action === 'resume')
98
+ await client.deployment.resume(appId);
99
+ else
100
+ await client.deployment.delete(appId);
101
+ return { appId, performed: true };
102
+ }
103
+ /** Build a lifecycle command (suspend/resume share a shape; delete adds --yes). */
104
+ function lifecycleCommand(action) {
105
+ const cmd = new commander_1.Command(action)
106
+ .description(action === 'suspend'
107
+ ? 'Suspend a deployed app (scale to zero)'
108
+ : action === 'resume'
109
+ ? 'Resume a suspended app (scale back up)'
110
+ : 'Delete a deployed app (tear down its namespace)')
111
+ .option('--env <file>', 'Env file with auth creds', '.env.local')
112
+ .option('--gateway <url>', 'Smart-engines gateway URL', cluster_1.DEFAULT_GATEWAY)
113
+ .option('--app-id <id>', 'App to act on (else DEPLOYED_APP_ID / SUBSCRIPTION_APP_ID)')
114
+ .option('--subscription-app-id <id>', 'Subscription appId to authenticate as (else SUBSCRIPTION_APP_ID)');
115
+ if (action === 'delete') {
116
+ cmd.option('--yes', 'Skip the confirmation prompt', false);
117
+ }
118
+ cmd.action(async (opts) => {
119
+ console.log(chalk_1.default.bold.cyan(`\n hsuite ${action}\n`));
120
+ try {
121
+ const { appId, performed } = await runLifecycle({
122
+ action,
123
+ envPath: opts.env,
124
+ gateway: opts.gateway,
125
+ appId: opts.appId,
126
+ subscriptionAppId: opts.subscriptionAppId,
127
+ yes: opts.yes,
128
+ });
129
+ if (!performed) {
130
+ console.log(chalk_1.default.yellow(' aborted (not confirmed)\n'));
131
+ return;
132
+ }
133
+ console.log(chalk_1.default.bold.green(`\n ✓ ${action}: ${appId}\n`));
134
+ }
135
+ catch (err) {
136
+ console.error(chalk_1.default.red(`\n ✗ ${err.message}\n`));
137
+ process.exit(1);
138
+ }
139
+ });
140
+ return cmd;
141
+ }
142
+ exports.suspendCommand = lifecycleCommand('suspend');
143
+ exports.resumeCommand = lifecycleCommand('resume');
144
+ exports.deleteCommand = lifecycleCommand('delete');
145
+ //# sourceMappingURL=app-lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-lifecycle.js","sourceRoot":"","sources":["../../src/commands/app-lifecycle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,oCAgCC;AAlFD;;;;;;;;;GASG;AACH,yCAAoC;AACpC,kDAA0B;AAC1B,mDAAqC;AAErC,qCAAsC;AACtC,+DAAkF;AAClF,6CAAkD;AAClD,uCAA8C;AAmB9C,2EAA2E;AAC3E,KAAK,UAAU,cAAc,CAAC,O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pipelines want the
5
+ * steps as separable, non-interactive units that pass artifacts between jobs:
6
+ *
7
+ * hsuite build --project <dir> # detect framework + SDK gate, run build
8
+ * hsuite push --server .. --repository .. --tag .. # wrap docker push, print digest
9
+ * hsuite sign --project <dir> --app-id .. --image-digest .. [--bundle-sha256 ..] --out att.json
10
+ * hsuite deploy --manifest m.json --attestation att.json # deploy with the pre-made attestation
11
+ *
12
+ * Each command is non-interactive and exits non-zero on failure so a CI runner
13
+ * can gate on it.
14
+ */
15
+ import { Command } from 'commander';
16
+ /**
17
+ * `hsuite build` — run the project's build, gated on the SDK/framework check.
18
+ *
19
+ * The SDK gate runs FIRST: a project with no HSUITE SDK dependency aborts
20
+ * before any build work, mirroring the deploy-time gate. Then the project's own
21
+ * `build` script runs (yarn by default; `--npm` to use npm), so CI gets one
22
+ * command that both validates and builds.
23
+ */
24
+ export declare const buildCommand: Command;
25
+ /**
26
+ * `hsuite push` — wrap `docker push` and print the recorded manifest digest.
27
+ *
28
+ * Registry coords come from `hsuite deploy`'s `init` step (or a prior
29
+ * `hsuite deploy --no-push` dry-run that printed them). The push password is
30
+ * read from `$HARBOR_PUSH_PASSWORD` (never an argv flag) so it doesn't leak
31
+ * into CI logs or the process table.
32
+ */
33
+ export declare const pushCommand: Command;
34
+ /**
35
+ * `hsuite sign` — assemble + sign a {@link BuildAttestation} and emit the
36
+ * `{ payload, signature }` JSON.
37
+ *
38
+ * Framework + sdkVersion are detected from `--project`; the artifact references
39
+ * (`--image-digest`, `--bundle-sha256`) come from the `push` / `uploadFrontend`
40
+ * steps. The developer identity + seed come from the env file. Writes to
41
+ * `--out` (or stdout when `--out` is omitted) so a later `deploy --attestation`
42
+ * consumes it.
43
+ */
44
+ export declare const signCommand: Command;
45
+ //# sourceMappingURL=ci.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../../src/commands/ci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,SA+BrB,CAAC;AAEL;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,SA6BpB,CAAC;AAEL;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,SAoDpB,CAAC"}
@@ -0,0 +1,174 @@
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.signCommand = exports.pushCommand = exports.buildCommand = void 0;
7
+ /**
8
+ * Granular CI subcommands for the trusted-deploy flow.
9
+ *
10
+ * `hsuite deploy` runs the whole pipeline interactively. CI pipelines want the
11
+ * steps as separable, non-interactive units that pass artifacts between jobs:
12
+ *
13
+ * hsuite build --project <dir> # detect framework + SDK gate, run build
14
+ * hsuite push --server .. --repository .. --tag .. # wrap docker push, print digest
15
+ * hsuite sign --project <dir> --app-id .. --image-digest .. [--bundle-sha256 ..] --out att.json
16
+ * hsuite deploy --manifest m.json --attestation att.json # deploy with the pre-made attestation
17
+ *
18
+ * Each command is non-interactive and exits non-zero on failure so a CI runner
19
+ * can gate on it.
20
+ */
21
+ const commander_1 = require("commander");
22
+ const chalk_1 = __importDefault(require("chalk"));
23
+ const child_process_1 = require("child_process");
24
+ const fs_1 = require("fs");
25
+ const path_1 = require("path");
26
+ const env_1 = require("../_lib/env");
27
+ const framework_1 = require("../_lib/framework");
28
+ const docker_1 = require("../_lib/docker");
29
+ const attestation_1 = require("../_lib/attestation");
30
+ /**
31
+ * `hsuite build` — run the project's build, gated on the SDK/framework check.
32
+ *
33
+ * The SDK gate runs FIRST: a project with no HSUITE SDK dependency aborts
34
+ * before any build work, mirroring the deploy-time gate. Then the project's own
35
+ * `build` script runs (yarn by default; `--npm` to use npm), so CI gets one
36
+ * command that both validates and builds.
37
+ */
38
+ exports.buildCommand = new commander_1.Command('build')
39
+ .description('Detect framework + SDK (abort if absent), then run the project build')
40
+ .option('--project <dir>', 'Smart-app project root', '.')
41
+ .option('--npm', 'Use `npm run build` instead of `yarn build`', false)
42
+ .option('--skip-build', 'Only run the framework/SDK detection gate, do not build', false)
43
+ .action(async (opts) => {
44
+ let detection;
45
+ try {
46
+ detection = (0, framework_1.detectFramework)(opts.project);
47
+ }
48
+ catch (err) {
49
+ if (err instanceof framework_1.NoSdkError) {
50
+ console.error(chalk_1.default.red(`\n ✗ ${err.message}\n`));
51
+ }
52
+ else {
53
+ console.error(chalk_1.default.red(`\n ✗ ${err.message}\n`));
54
+ }
55
+ process.exit(1);
56
+ }
57
+ const sdkVersion = (0, framework_1.resolveSdkVersion)(opts.project, detection);
58
+ console.log(chalk_1.default.green(` ✓ ${detection.framework} smart-app (sdk ${sdkVersion}, via ${detection.sdkPackage})`));
59
+ if (opts.skipBuild)
60
+ return;
61
+ const [cmd, args] = opts.npm ? ['npm', ['run', 'build']] : ['yarn', ['build']];
62
+ const code = await runTo(cmd, args, (0, path_1.resolve)(opts.project));
63
+ if (code !== 0) {
64
+ console.error(chalk_1.default.red(` build failed (exit ${code})`));
65
+ process.exit(1);
66
+ }
67
+ console.log(chalk_1.default.bold.green('\n ✓ build complete\n'));
68
+ });
69
+ /**
70
+ * `hsuite push` — wrap `docker push` and print the recorded manifest digest.
71
+ *
72
+ * Registry coords come from `hsuite deploy`'s `init` step (or a prior
73
+ * `hsuite deploy --no-push` dry-run that printed them). The push password is
74
+ * read from `$HARBOR_PUSH_PASSWORD` (never an argv flag) so it doesn't leak
75
+ * into CI logs or the process table.
76
+ */
77
+ exports.pushCommand = new commander_1.Command('push')
78
+ .description('docker login + push the backend image; print its manifest digest')
79
+ .requiredOption('--server <host>', 'Registry host (init.registry.server)')
80
+ .requiredOption('--username <user>', 'Push robot user (init.registry.username)')
81
+ .requiredOption('--repository <repo>', 'Per-app repository (init.registry.repository)')
82
+ .requiredOption('--tag <tag>', 'Image tag to push')
83
+ .action(async (opts) => {
84
+ const password = process.env.HARBOR_PUSH_PASSWORD;
85
+ if (!password) {
86
+ console.error(chalk_1.default.red(' set $HARBOR_PUSH_PASSWORD (the init-issued one-time push secret)'));
87
+ process.exit(1);
88
+ }
89
+ const registry = {
90
+ server: opts.server,
91
+ username: opts.username,
92
+ password,
93
+ repository: opts.repository,
94
+ };
95
+ try {
96
+ await (0, docker_1.dockerLogin)(registry);
97
+ const digest = await (0, docker_1.dockerPush)(registry, opts.tag);
98
+ // Print the bare digest on stdout so CI can capture it: DIGEST=$(hsuite push ...)
99
+ console.log(digest);
100
+ }
101
+ catch (err) {
102
+ console.error(chalk_1.default.red(` ${err.message}`));
103
+ process.exit(1);
104
+ }
105
+ });
106
+ /**
107
+ * `hsuite sign` — assemble + sign a {@link BuildAttestation} and emit the
108
+ * `{ payload, signature }` JSON.
109
+ *
110
+ * Framework + sdkVersion are detected from `--project`; the artifact references
111
+ * (`--image-digest`, `--bundle-sha256`) come from the `push` / `uploadFrontend`
112
+ * steps. The developer identity + seed come from the env file. Writes to
113
+ * `--out` (or stdout when `--out` is omitted) so a later `deploy --attestation`
114
+ * consumes it.
115
+ */
116
+ exports.signCommand = new commander_1.Command('sign')
117
+ .description('Assemble + sign a BuildAttestation; emit { payload, signature } JSON')
118
+ .requiredOption('--app-id <id>', 'The appId the artifact deploys under')
119
+ .requiredOption('--image-digest <digest>', 'Pushed backend manifest digest (sha256:...)')
120
+ .option('--bundle-sha256 <hash>', "Frontend bundle SHA-256 (uploadFrontend's value); '' for backend-only", '')
121
+ .option('--project <dir>', 'Smart-app project root (for framework + SDK version)', '.')
122
+ .option('--env <file>', 'Env file with the XRPL identity + seed', '.env.local')
123
+ .option('--out <file>', 'Write the signed attestation here (default: stdout)')
124
+ .action((opts) => {
125
+ let detection;
126
+ try {
127
+ detection = (0, framework_1.detectFramework)(opts.project);
128
+ }
129
+ catch (err) {
130
+ if (err instanceof framework_1.NoSdkError) {
131
+ console.error(chalk_1.default.red(`\n ✗ ${err.message}\n`));
132
+ }
133
+ else {
134
+ console.error(chalk_1.default.red(`\n ✗ ${err.message}\n`));
135
+ }
136
+ process.exit(1);
137
+ }
138
+ const sdkVersion = (0, framework_1.resolveSdkVersion)(opts.project, detection);
139
+ const env = (0, env_1.readEnv)(opts.env);
140
+ const signer = (0, env_1.buildSignerFromEnv)(env);
141
+ const seed = env.get('XRPL_SEED');
142
+ if (!seed) {
143
+ console.error(chalk_1.default.red(' XRPL_SEED required to sign the attestation'));
144
+ process.exit(1);
145
+ }
146
+ const signed = (0, attestation_1.assembleAndSign)({
147
+ appId: opts.appId,
148
+ developerWallet: signer.walletAddress,
149
+ developerChain: signer.chain,
150
+ framework: detection.framework,
151
+ sdkVersion,
152
+ imageDigest: opts.imageDigest,
153
+ bundleSha256: opts.bundleSha256,
154
+ cliVersion: (0, attestation_1.readCliVersion)(),
155
+ }, seed);
156
+ const json = JSON.stringify(signed, null, 2);
157
+ if (opts.out) {
158
+ (0, fs_1.writeFileSync)((0, path_1.resolve)(opts.out), json + '\n');
159
+ console.error(chalk_1.default.green(` ✓ wrote ${(0, path_1.resolve)(opts.out)}`));
160
+ }
161
+ else {
162
+ // Emit on stdout so it can be redirected/piped.
163
+ process.stdout.write(json + '\n');
164
+ }
165
+ });
166
+ /** Run a command to completion in `cwd`, inheriting stdio. Resolves its code. */
167
+ function runTo(cmd, args, cwd) {
168
+ return new Promise((resolvePromise, reject) => {
169
+ const child = (0, child_process_1.spawn)(cmd, args, { cwd, stdio: 'inherit' });
170
+ child.on('error', reject);
171
+ child.on('close', (code) => resolvePromise(code ?? 0));
172
+ });
173
+ }
174
+ //# sourceMappingURL=ci.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci.js","sourceRoot":"","sources":["../../src/commands/ci.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,yCAAoC;AACpC,kDAA0B;AAC1B,iDAAsC;AACtC,2BAAmC;AACnC,+BAA+B;AAE/B,qCAA0D;A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AAE,IAAI,GAAG,IAAI,CAAC,CAAC;QAC9C,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,KAAK,CAAC,aAAa,IAAA,cAAO,EAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/D,CAAC;SAAM,CAAC;QACN,gDAAgD;QAChD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,iFAAiF;AACjF,SAAS,KAAK,CAAC,GAAW,EAAE,IAAc,EAAE,GAAW;IACrD,OAAO,IAAI,OAAO,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE;QAC5C,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC1D,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Back-compat re-export shim.
3
+ *
4
+ * The canonical deploy-manifest schema + loader live in `../_lib/deploy-manifest`
5
+ * (the single-shape manifest: a required `backend` + an optional `frontend`).
6
+ * This module re-exports it so any importer that still references
7
+ * `./deploy-manifest` keeps working. `loadManifest` is retained as an alias of
8
+ * the new `parseManifest`.
9
+ */
10
+ export { parseManifest, parseManifest as loadManifest, validateManifest, type Manifest, type ManifestBackend, type ManifestFrontend, } from '../_lib/deploy-manifest';
11
+ //# sourceMappingURL=deploy-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-manifest.d.ts","sourceRoot":"","sources":["../../src/commands/deploy-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,aAAa,EACb,aAAa,IAAI,YAAY,EAC7B,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateManifest = exports.loadManifest = exports.parseManifest = void 0;
4
+ /**
5
+ * Back-compat re-export shim.
6
+ *
7
+ * The canonical deploy-manifest schema + loader live in `../_lib/deploy-manifest`
8
+ * (the single-shape manifest: a required `backend` + an optional `frontend`).
9
+ * This module re-exports it so any importer that still references
10
+ * `./deploy-manifest` keeps working. `loadManifest` is retained as an alias of
11
+ * the new `parseManifest`.
12
+ */
13
+ var deploy_manifest_1 = require("../_lib/deploy-manifest");
14
+ Object.defineProperty(exports, "parseManifest", { enumerable: true, get: function () { return deploy_manifest_1.parseManifest; } });
15
+ Object.defineProperty(exports, "loadManifest", { enumerable: true, get: function () { return deploy_manifest_1.parseManifest; } });
16
+ Object.defineProperty(exports, "validateManifest", { enumerable: true, get: function () { return deploy_manifest_1.validateManifest; } });
17
+ //# sourceMappingURL=deploy-manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-manifest.js","sourceRoot":"","sources":["../../src/commands/deploy-manifest.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,2DAOiC;AAN/B,gHAAA,aAAa,OAAA;AACb,+GAAA,aAAa,OAAgB;AAC7B,mHAAA,gBAAgB,OAAA"}
@@ -1,19 +1,78 @@
1
1
  /**
2
- * `hsuite deploy` — Deploy a smart-app from a JSON manifest.
2
+ * `hsuite deploy` — clean, manifest-driven deploy of a smart-app.
3
3
  *
4
- * Implements the four-step runtime-deploy flow defined in
5
- * `docs/superpowers/specs/2026-05-14-smart-app-runtime-orchestration-design.md` §6.1:
4
+ * Order of operations (the canonical flow, plus the trusted-deploy attestation
5
+ * the host requires by default):
6
6
  *
7
- * 1. `init` server allocates appId + ephemeral DOCR creds
8
- * 2. (out-of-band, manual) customer `docker push <repo>:<tag>`
9
- * 3. `uploadFrontend` (opt.) → tarball with the SPA bundle
10
- * 4. `deploy` → server reconciles to k8s
7
+ * 1. parse manifest ONE canonical shape (backend required)
8
+ * 2. detect framework + SDK ABORT if the project has no HSUITE SDK
9
+ * 3. connectAndAuth → the ONE `new BaasClient` (no discovery factory)
10
+ * 4. init → server allocates appId + ephemeral registry creds
11
+ * 5. docker build + push → backend image
12
+ * 6. tar + uploadFrontend → SPA bundle (when a `frontend` block is present)
13
+ * 7. assemble + sign → BuildAttestation signed with the dev's XRPL key
14
+ * 8. deploy → reconcile to k8s ({ tag, port, replicas, degree,
15
+ * env, resources, strategy, attestation })
11
16
  *
12
- * The manifest schema widens to include `image`, `port`, `tag`, `replicas`,
13
- * `env`, and an optional `frontend.bundlePath`. Between init and deploy the
14
- * CLI prints the docker push command and waits for Enter (skipped in CI /
15
- * with `--non-interactive`).
17
+ * Every smart-app has a NestJS backend; the optional SPA (`frontend`) is served
18
+ * by that backend out of its own `public/`. There is no SPA-only path.
19
+ *
20
+ * All docker/tar shell-outs go through the injectable seams in `_lib/baas.ts`
21
+ * so unit tests never invoke docker for real.
16
22
  */
17
23
  import { Command } from 'commander';
24
+ import { connectAndAuth, type RunFn } from '../_lib/baas';
25
+ export type DeployOpts = {
26
+ manifestPath: string;
27
+ envPath: string;
28
+ gateway: string;
29
+ projectDir: string;
30
+ strategy?: 'rolling' | 'recreate';
31
+ dockerHost?: string;
32
+ skipBuild?: boolean;
33
+ skipPush?: boolean;
34
+ /** Skip the multi-cluster image fan-out (single-cluster / dev registry). */
35
+ skipDistribute?: boolean;
36
+ /**
37
+ * The developer's subscription appId — under mint-first/deploy-last this is
38
+ * BOTH the auth identity AND the deploy target (`SUBSCRIPTION_APP_ID ==
39
+ * DEPLOYED_APP_ID == DKG entityId`, minted by `hsuite subscribe`). `deploy`
40
+ * allocates nothing; it authenticates as this id and fetches push creds for
41
+ * it via `pushCredentials`.
42
+ */
43
+ subscriptionAppId?: string;
44
+ /**
45
+ * Opt-in escape hatch for an intentional zero-cred / open-mode deploy (e.g. a
46
+ * fork demo with no subscription). When false (default), a deploy whose
47
+ * resolved container env carries no `XRPL_SEED` FAILS LOUD rather than
48
+ * silently shipping an open-mode app (issue #1564). `--allow-open-mode` sets it.
49
+ */
50
+ allowOpenMode?: boolean;
51
+ /**
52
+ * Block until the runtime settles (RUNNING / FAILED) after `deploy()` instead
53
+ * of exiting on the returned URL — which is not live until the pods converge.
54
+ * Default true; `--no-wait` opts out. Exits non-zero on a FAILED runtime.
55
+ */
56
+ wait?: boolean;
57
+ waitIntervalMs?: number;
58
+ waitMaxPolls?: number;
59
+ clientFactory?: Parameters<typeof connectAndAuth>[0]['clientFactory'];
60
+ runFn?: RunFn;
61
+ /** Injectable sleep for the await-RUNNING poll (tests). */
62
+ sleep?: (ms: number) => Promise<void>;
63
+ };
64
+ export type DeployResult = {
65
+ appId: string;
66
+ /** Deploy URL returned by `deploy()`. */
67
+ url: string;
68
+ };
69
+ /**
70
+ * Pure orchestration body — exported for unit tests. Throws on every error
71
+ * path; the command-level action wraps this and exits the process.
72
+ */
73
+ export declare function runDeploy(opts: DeployOpts): Promise<DeployResult>;
74
+ /**
75
+ * `hsuite deploy` commander command — thin action over {@link runDeploy}.
76
+ */
18
77
  export declare const deployCommand: Command;
19
78
  //# sourceMappingURL=deploy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgEpC,eAAO,MAAM,aAAa,SAiJtB,CAAC"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;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