zephyr-cli 0.0.0-canary.65 → 0.0.0-canary.67

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 (88) hide show
  1. package/README.md +66 -1
  2. package/dist/cli.d.mts +33 -0
  3. package/dist/cli.d.ts +10 -2
  4. package/dist/cli.js +89 -61
  5. package/dist/cli.mjs +131 -0
  6. package/dist/commands/deploy.d.mts +16 -0
  7. package/dist/commands/deploy.d.ts +5 -1
  8. package/dist/commands/deploy.js +75 -43
  9. package/dist/commands/deploy.mjs +54 -0
  10. package/dist/commands/run.d.mts +13 -0
  11. package/dist/commands/run.d.ts +5 -1
  12. package/dist/commands/run.js +99 -101
  13. package/dist/commands/run.mjs +121 -0
  14. package/dist/commands/watch.d.mts +20 -0
  15. package/dist/commands/watch.d.ts +20 -0
  16. package/dist/commands/watch.js +148 -0
  17. package/dist/commands/watch.mjs +110 -0
  18. package/dist/index.d.mts +3 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +41 -34
  21. package/dist/index.mjs +57 -0
  22. package/{src/lib/build-stats.ts → dist/lib/build-stats.d.mts} +2 -7
  23. package/dist/lib/build-stats.d.ts +1 -0
  24. package/dist/lib/build-stats.js +41 -8
  25. package/dist/lib/build-stats.mjs +7 -0
  26. package/dist/lib/command-detector.d.mts +39 -0
  27. package/dist/lib/command-detector.d.ts +1 -0
  28. package/dist/lib/command-detector.js +203 -300
  29. package/dist/lib/command-detector.mjs +312 -0
  30. package/dist/lib/config-readers.d.mts +38 -0
  31. package/dist/lib/config-readers.d.ts +1 -0
  32. package/dist/lib/config-readers.js +150 -148
  33. package/dist/lib/config-readers.mjs +182 -0
  34. package/dist/lib/extract-assets.d.mts +12 -0
  35. package/dist/lib/extract-assets.d.ts +7 -1
  36. package/dist/lib/extract-assets.js +67 -34
  37. package/dist/lib/extract-assets.mjs +71 -0
  38. package/dist/lib/publication-metadata.d.mts +31 -0
  39. package/dist/lib/publication-metadata.d.ts +31 -0
  40. package/dist/lib/publication-metadata.js +258 -0
  41. package/dist/lib/publication-metadata.mjs +217 -0
  42. package/dist/lib/sequential-publisher.d.mts +16 -0
  43. package/dist/lib/sequential-publisher.d.ts +16 -0
  44. package/dist/lib/sequential-publisher.js +70 -0
  45. package/dist/lib/sequential-publisher.mjs +32 -0
  46. package/dist/lib/shell-parser.d.mts +41 -0
  47. package/dist/lib/shell-parser.d.ts +1 -0
  48. package/dist/lib/shell-parser.js +76 -95
  49. package/dist/lib/shell-parser.mjs +130 -0
  50. package/dist/lib/spawn-helper.d.mts +15 -0
  51. package/dist/lib/spawn-helper.d.ts +1 -0
  52. package/dist/lib/spawn-helper.js +52 -22
  53. package/dist/lib/spawn-helper.mjs +28 -0
  54. package/dist/lib/upload.d.mts +18 -0
  55. package/dist/lib/upload.d.ts +4 -0
  56. package/dist/lib/upload.js +61 -20
  57. package/dist/lib/upload.mjs +35 -0
  58. package/package.json +49 -25
  59. package/.eslintignore +0 -3
  60. package/.eslintrc.json +0 -22
  61. package/dist/cli.js.map +0 -1
  62. package/dist/commands/deploy.js.map +0 -1
  63. package/dist/commands/run.js.map +0 -1
  64. package/dist/index.js.map +0 -1
  65. package/dist/lib/build-stats.js.map +0 -1
  66. package/dist/lib/command-detector.js.map +0 -1
  67. package/dist/lib/config-readers.js.map +0 -1
  68. package/dist/lib/extract-assets.js.map +0 -1
  69. package/dist/lib/shell-parser.js.map +0 -1
  70. package/dist/lib/spawn-helper.js.map +0 -1
  71. package/dist/lib/upload.js.map +0 -1
  72. package/dist/package.json +0 -48
  73. package/dist/tsconfig.tsbuildinfo +0 -1
  74. package/jest.config.ts +0 -10
  75. package/project.json +0 -34
  76. package/src/cli.ts +0 -150
  77. package/src/commands/deploy.ts +0 -74
  78. package/src/commands/run.ts +0 -196
  79. package/src/index.ts +0 -58
  80. package/src/lib/command-detector.ts +0 -600
  81. package/src/lib/config-readers.ts +0 -269
  82. package/src/lib/extract-assets.ts +0 -96
  83. package/src/lib/shell-parser.ts +0 -229
  84. package/src/lib/spawn-helper.ts +0 -49
  85. package/src/lib/upload.ts +0 -39
  86. package/tsconfig.json +0 -22
  87. package/tsconfig.lib.json +0 -10
  88. package/tsconfig.spec.json +0 -14
package/README.md CHANGED
@@ -40,6 +40,9 @@ ze-cli NODE_ENV=production webpack
40
40
 
41
41
  # Mark as SSR build
42
42
  ze-cli --ssr pnpm build
43
+
44
+ # Build and publish a TAP package. CLI options for run appear before the build command.
45
+ ze-cli --target tap-app --metadata ./dist/zephyr-publication.json pnpm build
43
46
  ```
44
47
 
45
48
  ### Deploy Command
@@ -59,17 +62,79 @@ ze-cli deploy ./dist
59
62
  # Upload with specific target
60
63
  ze-cli deploy ./dist --target ios
61
64
 
65
+ # Publish a TAP mini-app artifact
66
+ ze-cli deploy ./dist --target tap-app --metadata ./dist/zephyr-publication.json
67
+
62
68
  # Mark as SSR
63
69
  ze-cli deploy ./dist --ssr
64
70
  ```
65
71
 
72
+ ### Watch Command
73
+
74
+ Publish the initial output and then publish each settled output change without
75
+ rebuilding the TAP host. This command deliberately requires `--target tap-app`:
76
+
77
+ ```bash
78
+ # The Zephyr control plane authorizes the development tag; the CLI never creates one locally.
79
+ ze-cli watch ./dist --target tap-app --metadata ./dist/zephyr-publication.json
80
+ ```
81
+
66
82
  ## Options
67
83
 
68
84
  - `--ssr` - Mark this snapshot as server-side rendered
69
- - `--target, -t <target>` - Build target: `web`, `ios`, or `android` (default: `web`)
85
+ - `--target, -t <target>` - Build target: `web`, `ios`, `android`, or `tap-app` (default: `web`)
86
+ - `--metadata <path>` - JSON Module Federation sidecar. Required with `--target tap-app`.
87
+ - `--debounce <milliseconds>` - Delay a `watch` publication until output changes settle (default: `250`)
70
88
  - `--verbose, -v` - Enable verbose output
71
89
  - `--help, -h` - Show help message
72
90
 
91
+ ### TAP metadata sidecar
92
+
93
+ TAP SDK builds must pass `--metadata <path>` for `run`, `deploy`, and `watch`.
94
+ The file is JSON emitted by the SDK; it keeps each independently addressable
95
+ container in both the snapshot (`mfConfigs`) and build statistics (`federation`).
96
+ The CLI rejects a TAP upload if the sidecar is missing, malformed, empty, or if
97
+ an entry's `federation.remote` does not match its `mfConfigs.filename`.
98
+
99
+ ```json
100
+ {
101
+ "mfConfigs": [
102
+ {
103
+ "name": "desktop",
104
+ "filename": "targets/desktop/remoteEntry.mjs",
105
+ "library": { "type": "module" },
106
+ "exposes": { "./ui": "./src/desktop.ts" }
107
+ },
108
+ {
109
+ "name": "quickjs",
110
+ "filename": "targets/quickjs/remoteEntry.mjs",
111
+ "library": { "type": "module" },
112
+ "exposes": { "./background": "./src/quickjs.ts" }
113
+ }
114
+ ],
115
+ "federation": [
116
+ {
117
+ "name": "desktop",
118
+ "remote": "targets/desktop/remoteEntry.mjs",
119
+ "mf_manifest": "targets/desktop/mf-manifest.json",
120
+ "library_type": "module"
121
+ },
122
+ {
123
+ "name": "quickjs",
124
+ "remote": "targets/quickjs/remoteEntry.mjs",
125
+ "library_type": "module"
126
+ }
127
+ ]
128
+ }
129
+ ```
130
+
131
+ Both arrays must be non-empty and represent the same containers. A single
132
+ container also gets the legacy `mfConfig` snapshot field; multi-container
133
+ sidecars intentionally do not choose an arbitrary first entry. The CLI accepts
134
+ an explicit `mfConfig` only for a TAP sidecar containing that same one container.
135
+ For `run`, place the options before the build command because the SDK creates the
136
+ sidecar during the build. For `watch`, the sidecar is reread for every snapshot.
137
+
73
138
  ## How It Works
74
139
 
75
140
  ### Run Command
package/dist/cli.d.mts ADDED
@@ -0,0 +1,33 @@
1
+ import { type ZephyrBuildTarget } from 'zephyr-edge-contract';
2
+ export interface CliOptions {
3
+ command: 'run' | 'deploy' | 'watch';
4
+ commandLine?: string;
5
+ directory?: string;
6
+ target?: ZephyrBuildTarget;
7
+ verbose?: boolean;
8
+ ssr?: boolean;
9
+ debounceMs?: number;
10
+ /** JSON sidecar containing Module Federation publication metadata. */
11
+ metadataPath?: string;
12
+ }
13
+ /**
14
+ * Parse command line arguments.
15
+ *
16
+ * Syntax:
17
+ *
18
+ * - Ze-cli [options] <command> [args...] - run command (default)
19
+ * - Ze-cli deploy <directory> [options] - deploy command
20
+ * - Ze-cli watch <directory> [options] - watch and publish command
21
+ *
22
+ * Examples:
23
+ *
24
+ * - Ze-cli --ssr pnpm build
25
+ * - Ze-cli tsc
26
+ * - Ze-cli NODE_ENV=production webpack
27
+ * - Ze-cli deploy ./dist
28
+ * - Ze-cli deploy ./dist --target tap-app --metadata ./dist/zephyr-publication.json
29
+ * - Ze-cli watch ./dist --target tap-app
30
+ * - Ze-cli deploy ./dist --ssr
31
+ */
32
+ export declare function parseArgs(args: string[]): CliOptions;
33
+ //# sourceMappingURL=cli.d.mts.map
package/dist/cli.d.ts CHANGED
@@ -1,10 +1,14 @@
1
+ import { type ZephyrBuildTarget } from 'zephyr-edge-contract';
1
2
  export interface CliOptions {
2
- command: 'run' | 'deploy';
3
+ command: 'run' | 'deploy' | 'watch';
3
4
  commandLine?: string;
4
5
  directory?: string;
5
- target?: 'web' | 'ios' | 'android';
6
+ target?: ZephyrBuildTarget;
6
7
  verbose?: boolean;
7
8
  ssr?: boolean;
9
+ debounceMs?: number;
10
+ /** JSON sidecar containing Module Federation publication metadata. */
11
+ metadataPath?: string;
8
12
  }
9
13
  /**
10
14
  * Parse command line arguments.
@@ -13,6 +17,7 @@ export interface CliOptions {
13
17
  *
14
18
  * - Ze-cli [options] <command> [args...] - run command (default)
15
19
  * - Ze-cli deploy <directory> [options] - deploy command
20
+ * - Ze-cli watch <directory> [options] - watch and publish command
16
21
  *
17
22
  * Examples:
18
23
  *
@@ -20,6 +25,9 @@ export interface CliOptions {
20
25
  * - Ze-cli tsc
21
26
  * - Ze-cli NODE_ENV=production webpack
22
27
  * - Ze-cli deploy ./dist
28
+ * - Ze-cli deploy ./dist --target tap-app --metadata ./dist/zephyr-publication.json
29
+ * - Ze-cli watch ./dist --target tap-app
23
30
  * - Ze-cli deploy ./dist --ssr
24
31
  */
25
32
  export declare function parseArgs(args: string[]): CliOptions;
33
+ //# sourceMappingURL=cli.d.ts.map
package/dist/cli.js CHANGED
@@ -1,94 +1,106 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseArgs = parseArgs;
4
- /**
5
- * Parse command line arguments.
6
- *
7
- * Syntax:
8
- *
9
- * - Ze-cli [options] <command> [args...] - run command (default)
10
- * - Ze-cli deploy <directory> [options] - deploy command
11
- *
12
- * Examples:
13
- *
14
- * - Ze-cli --ssr pnpm build
15
- * - Ze-cli tsc
16
- * - Ze-cli NODE_ENV=production webpack
17
- * - Ze-cli deploy ./dist
18
- * - Ze-cli deploy ./dist --ssr
19
- */
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ parseArgs: ()=>parseArgs
32
+ });
33
+ const external_zephyr_edge_contract_namespaceObject = require("zephyr-edge-contract");
20
34
  function parseArgs(args) {
21
35
  const options = {
22
- command: 'run', // Default to 'run'
36
+ command: 'run'
23
37
  };
24
- // Find where flags end and the command/subcommand begins
25
38
  let commandStartIndex = -1;
26
39
  const flags = [];
27
- for (let i = 0; i < args.length; i++) {
40
+ for(let i = 0; i < args.length; i++){
28
41
  const arg = args[i];
29
- if (arg === '--help' || arg === '-h') {
42
+ if ('--help' === arg || '-h' === arg) {
30
43
  printHelp();
31
44
  process.exit(0);
32
- }
33
- else if (arg === '--version' || arg === '-v') {
34
- // Version is handled by the caller
35
- options.verbose = true;
36
- }
37
- else if (arg === '--ssr') {
45
+ } else if ('--version' === arg || '-v' === arg) options.verbose = true;
46
+ else if ('--ssr' === arg) {
38
47
  options.ssr = true;
39
48
  flags.push(arg);
40
- }
41
- else if (arg === '--target' || arg === '-t') {
49
+ } else if ('--target' === arg || '-t' === arg) {
42
50
  const value = args[++i];
43
- if (value && ['web', 'ios', 'android'].includes(value)) {
44
- options.target = value;
45
- }
51
+ if ((0, external_zephyr_edge_contract_namespaceObject.isZephyrBuildTarget)(value)) options.target = value;
52
+ else throw new Error(`Unsupported Zephyr build target: ${String(value)}`);
46
53
  flags.push(arg, value);
47
- }
48
- else if (arg === '--verbose') {
54
+ } else if ('--metadata' === arg) {
55
+ const value = args[++i];
56
+ if (!value || value.startsWith('-')) throw new Error('--metadata requires a JSON sidecar path.');
57
+ options.metadataPath = value;
58
+ flags.push(arg, value);
59
+ } else if ('--debounce' === arg) {
60
+ const value = Number(args[++i]);
61
+ if (!Number.isSafeInteger(value) || value < 0) throw new Error(`--debounce must be a non-negative integer, received ${String(value)}`);
62
+ options.debounceMs = value;
63
+ flags.push(arg, value.toString());
64
+ } else if ('--verbose' === arg) {
49
65
  options.verbose = true;
50
66
  flags.push(arg);
51
- }
52
- else if (!arg.startsWith('-')) {
53
- // First non-flag argument
67
+ } else if (!arg.startsWith('-')) {
54
68
  commandStartIndex = i;
55
69
  break;
56
70
  }
57
71
  }
58
- if (commandStartIndex === -1) {
72
+ if (-1 === commandStartIndex) {
59
73
  printHelp();
60
74
  process.exit(1);
61
75
  }
62
76
  const firstArg = args[commandStartIndex];
63
- // Check if it's a subcommand
64
- if (firstArg === 'deploy') {
65
- options.command = 'deploy';
77
+ if ('deploy' === firstArg || 'watch' === firstArg) {
78
+ options.command = firstArg;
66
79
  const directory = args[commandStartIndex + 1];
67
80
  if (!directory) {
68
- console.error('Error: deploy command requires a directory argument');
69
- console.error('Usage: ze-cli deploy <directory> [options]');
81
+ console.error(`Error: ${firstArg} command requires a directory argument`);
82
+ console.error(`Usage: ze-cli ${firstArg} <directory> [options]`);
70
83
  process.exit(1);
71
84
  }
72
85
  options.directory = directory;
73
- // Parse any additional flags after the directory
74
- for (let i = commandStartIndex + 2; i < args.length; i++) {
86
+ for(let i = commandStartIndex + 2; i < args.length; i++){
75
87
  const arg = args[i];
76
- if (arg === '--ssr') {
77
- options.ssr = true;
78
- }
79
- else if (arg === '--target' || arg === '-t') {
88
+ if ('--ssr' === arg) options.ssr = true;
89
+ else if ('--target' === arg || '-t' === arg) {
80
90
  const value = args[++i];
81
- if (value && ['web', 'ios', 'android'].includes(value)) {
82
- options.target = value;
83
- }
84
- }
85
- else if (arg === '--verbose') {
86
- options.verbose = true;
87
- }
91
+ if ((0, external_zephyr_edge_contract_namespaceObject.isZephyrBuildTarget)(value)) options.target = value;
92
+ else throw new Error(`Unsupported Zephyr build target: ${String(value)}`);
93
+ } else if ('--metadata' === arg) {
94
+ const value = args[++i];
95
+ if (!value || value.startsWith('-')) throw new Error('--metadata requires a JSON sidecar path.');
96
+ options.metadataPath = value;
97
+ } else if ('--debounce' === arg) {
98
+ const value = Number(args[++i]);
99
+ if (!Number.isSafeInteger(value) || value < 0) throw new Error(`--debounce must be a non-negative integer, received ${String(value)}`);
100
+ options.debounceMs = value;
101
+ } else if ('--verbose' === arg) options.verbose = true;
88
102
  }
89
- }
90
- else {
91
- // It's a run command - everything from commandStartIndex onwards is the command
103
+ } else {
92
104
  options.command = 'run';
93
105
  options.commandLine = args.slice(commandStartIndex).join(' ');
94
106
  }
@@ -105,10 +117,13 @@ pre-built assets from a directory.
105
117
  Commands:
106
118
  <command> [args...] Run a build command and upload (default)
107
119
  deploy <directory> Upload pre-built assets from a directory
120
+ watch <directory> Watch pre-built output and publish each settled change
108
121
 
109
122
  Options:
110
123
  --ssr Mark this snapshot as server-side rendered
111
- --target, -t <target> Build target: web, ios, or android (default: web)
124
+ --target, -t <target> Build target: web, ios, android, or tap-app (default: web)
125
+ --metadata <path> JSON sidecar for Module Federation publication metadata
126
+ --debounce <milliseconds> Delay output-watch publications after changes (default: 250)
112
127
  --verbose Enable verbose output
113
128
  --help, -h Show this help message
114
129
 
@@ -119,16 +134,21 @@ Examples:
119
134
  ze-cli tsc
120
135
  ze-cli NODE_ENV=production webpack
121
136
  ze-cli --ssr pnpm build
137
+ ze-cli --target tap-app --metadata ./dist/zephyr-publication.json pnpm build
122
138
 
123
139
  # Deploy pre-built assets
124
140
  ze-cli deploy ./dist
125
141
  ze-cli deploy ./dist --ssr
126
142
  ze-cli deploy ./build --target ios
143
+ ze-cli deploy ./dist --target tap-app --metadata ./dist/zephyr-publication.json
144
+ ze-cli watch ./dist --target tap-app
127
145
 
128
146
  How it works:
129
147
  - For run commands, ze-cli executes your build command and automatically
130
148
  detects the output directory to upload assets.
131
149
  - For deploy commands, ze-cli uploads assets from the specified directory.
150
+ - For watch commands, ze-cli publishes each settled output change as a new immutable
151
+ snapshot. The Zephyr control plane authorizes and advances any development tag.
132
152
  - All stdout/stderr from build commands are passed through.
133
153
  - ze-cli logs are written to stderr only.
134
154
 
@@ -138,4 +158,12 @@ application information from your package.json and git repository.
138
158
  For more information: https://docs.zephyr-cloud.io/cli
139
159
  `);
140
160
  }
161
+ exports.parseArgs = __webpack_exports__.parseArgs;
162
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
163
+ "parseArgs"
164
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
165
+ Object.defineProperty(exports, '__esModule', {
166
+ value: true
167
+ });
168
+
141
169
  //# sourceMappingURL=cli.js.map
package/dist/cli.mjs ADDED
@@ -0,0 +1,131 @@
1
+ import { isZephyrBuildTarget } from "zephyr-edge-contract";
2
+ function parseArgs(args) {
3
+ const options = {
4
+ command: 'run'
5
+ };
6
+ let commandStartIndex = -1;
7
+ const flags = [];
8
+ for(let i = 0; i < args.length; i++){
9
+ const arg = args[i];
10
+ if ('--help' === arg || '-h' === arg) {
11
+ printHelp();
12
+ process.exit(0);
13
+ } else if ('--version' === arg || '-v' === arg) options.verbose = true;
14
+ else if ('--ssr' === arg) {
15
+ options.ssr = true;
16
+ flags.push(arg);
17
+ } else if ('--target' === arg || '-t' === arg) {
18
+ const value = args[++i];
19
+ if (isZephyrBuildTarget(value)) options.target = value;
20
+ else throw new Error(`Unsupported Zephyr build target: ${String(value)}`);
21
+ flags.push(arg, value);
22
+ } else if ('--metadata' === arg) {
23
+ const value = args[++i];
24
+ if (!value || value.startsWith('-')) throw new Error('--metadata requires a JSON sidecar path.');
25
+ options.metadataPath = value;
26
+ flags.push(arg, value);
27
+ } else if ('--debounce' === arg) {
28
+ const value = Number(args[++i]);
29
+ if (!Number.isSafeInteger(value) || value < 0) throw new Error(`--debounce must be a non-negative integer, received ${String(value)}`);
30
+ options.debounceMs = value;
31
+ flags.push(arg, value.toString());
32
+ } else if ('--verbose' === arg) {
33
+ options.verbose = true;
34
+ flags.push(arg);
35
+ } else if (!arg.startsWith('-')) {
36
+ commandStartIndex = i;
37
+ break;
38
+ }
39
+ }
40
+ if (-1 === commandStartIndex) {
41
+ printHelp();
42
+ process.exit(1);
43
+ }
44
+ const firstArg = args[commandStartIndex];
45
+ if ('deploy' === firstArg || 'watch' === firstArg) {
46
+ options.command = firstArg;
47
+ const directory = args[commandStartIndex + 1];
48
+ if (!directory) {
49
+ console.error(`Error: ${firstArg} command requires a directory argument`);
50
+ console.error(`Usage: ze-cli ${firstArg} <directory> [options]`);
51
+ process.exit(1);
52
+ }
53
+ options.directory = directory;
54
+ for(let i = commandStartIndex + 2; i < args.length; i++){
55
+ const arg = args[i];
56
+ if ('--ssr' === arg) options.ssr = true;
57
+ else if ('--target' === arg || '-t' === arg) {
58
+ const value = args[++i];
59
+ if (isZephyrBuildTarget(value)) options.target = value;
60
+ else throw new Error(`Unsupported Zephyr build target: ${String(value)}`);
61
+ } else if ('--metadata' === arg) {
62
+ const value = args[++i];
63
+ if (!value || value.startsWith('-')) throw new Error('--metadata requires a JSON sidecar path.');
64
+ options.metadataPath = value;
65
+ } else if ('--debounce' === arg) {
66
+ const value = Number(args[++i]);
67
+ if (!Number.isSafeInteger(value) || value < 0) throw new Error(`--debounce must be a non-negative integer, received ${String(value)}`);
68
+ options.debounceMs = value;
69
+ } else if ('--verbose' === arg) options.verbose = true;
70
+ }
71
+ } else {
72
+ options.command = 'run';
73
+ options.commandLine = args.slice(commandStartIndex).join(' ');
74
+ }
75
+ return options;
76
+ }
77
+ function printHelp() {
78
+ console.log(`
79
+ Usage: ze-cli [options] <command> [args...]
80
+ ze-cli deploy <directory> [options]
81
+
82
+ Run a build command and automatically upload assets to Zephyr, or deploy
83
+ pre-built assets from a directory.
84
+
85
+ Commands:
86
+ <command> [args...] Run a build command and upload (default)
87
+ deploy <directory> Upload pre-built assets from a directory
88
+ watch <directory> Watch pre-built output and publish each settled change
89
+
90
+ Options:
91
+ --ssr Mark this snapshot as server-side rendered
92
+ --target, -t <target> Build target: web, ios, android, or tap-app (default: web)
93
+ --metadata <path> JSON sidecar for Module Federation publication metadata
94
+ --debounce <milliseconds> Delay output-watch publications after changes (default: 250)
95
+ --verbose Enable verbose output
96
+ --help, -h Show this help message
97
+
98
+ Examples:
99
+ # Run build commands
100
+ ze-cli pnpm build
101
+ ze-cli yarn build
102
+ ze-cli tsc
103
+ ze-cli NODE_ENV=production webpack
104
+ ze-cli --ssr pnpm build
105
+ ze-cli --target tap-app --metadata ./dist/zephyr-publication.json pnpm build
106
+
107
+ # Deploy pre-built assets
108
+ ze-cli deploy ./dist
109
+ ze-cli deploy ./dist --ssr
110
+ ze-cli deploy ./build --target ios
111
+ ze-cli deploy ./dist --target tap-app --metadata ./dist/zephyr-publication.json
112
+ ze-cli watch ./dist --target tap-app
113
+
114
+ How it works:
115
+ - For run commands, ze-cli executes your build command and automatically
116
+ detects the output directory to upload assets.
117
+ - For deploy commands, ze-cli uploads assets from the specified directory.
118
+ - For watch commands, ze-cli publishes each settled output change as a new immutable
119
+ snapshot. The Zephyr control plane authorizes and advances any development tag.
120
+ - All stdout/stderr from build commands are passed through.
121
+ - ze-cli logs are written to stderr only.
122
+
123
+ Note: No configuration file is needed. Zephyr will automatically detect
124
+ application information from your package.json and git repository.
125
+
126
+ For more information: https://docs.zephyr-cloud.io/cli
127
+ `);
128
+ }
129
+ export { parseArgs };
130
+
131
+ //# sourceMappingURL=cli.mjs.map
@@ -0,0 +1,16 @@
1
+ import type { ZephyrBuildTarget } from 'zephyr-edge-contract';
2
+ export interface DeployOptions {
3
+ directory: string;
4
+ target?: ZephyrBuildTarget;
5
+ verbose?: boolean;
6
+ ssr?: boolean;
7
+ /** JSON sidecar emitted by a TAP SDK or compatible bundler. */
8
+ metadataPath?: string;
9
+ cwd: string;
10
+ }
11
+ /**
12
+ * Deploy command: Upload pre-built assets from a directory to Zephyr. This is similar to
13
+ * the standalone zephyr-cli tool.
14
+ */
15
+ export declare function deployCommand(options: DeployOptions): Promise<void>;
16
+ //# sourceMappingURL=deploy.d.mts.map
@@ -1,8 +1,11 @@
1
+ import type { ZephyrBuildTarget } from 'zephyr-edge-contract';
1
2
  export interface DeployOptions {
2
3
  directory: string;
3
- target?: 'web' | 'ios' | 'android';
4
+ target?: ZephyrBuildTarget;
4
5
  verbose?: boolean;
5
6
  ssr?: boolean;
7
+ /** JSON sidecar emitted by a TAP SDK or compatible bundler. */
8
+ metadataPath?: string;
6
9
  cwd: string;
7
10
  }
8
11
  /**
@@ -10,3 +13,4 @@ export interface DeployOptions {
10
13
  * the standalone zephyr-cli tool.
11
14
  */
12
15
  export declare function deployCommand(options: DeployOptions): Promise<void>;
16
+ //# sourceMappingURL=deploy.d.ts.map