@dual-os/cli 0.0.0-stage → 0.11.0-next.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 (254) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +15 -2
  3. package/dist/_virtual/_rolldown/runtime.js +13 -0
  4. package/dist/auth/credentials.d.ts +17 -0
  5. package/dist/auth/credentials.d.ts.map +1 -0
  6. package/dist/auth/credentials.js +57 -0
  7. package/dist/auth/credentials.js.map +1 -0
  8. package/dist/auth/destination.d.ts +22 -0
  9. package/dist/auth/destination.d.ts.map +1 -0
  10. package/dist/auth/destination.js +49 -0
  11. package/dist/auth/destination.js.map +1 -0
  12. package/dist/auth/http.d.ts +12 -0
  13. package/dist/auth/http.d.ts.map +1 -0
  14. package/dist/auth/http.js +34 -0
  15. package/dist/auth/http.js.map +1 -0
  16. package/dist/auth/login.d.ts +22 -0
  17. package/dist/auth/login.d.ts.map +1 -0
  18. package/dist/auth/login.js +98 -0
  19. package/dist/auth/login.js.map +1 -0
  20. package/dist/auth/protocol.d.ts +26 -0
  21. package/dist/auth/protocol.d.ts.map +1 -0
  22. package/dist/auth/protocol.js +31 -0
  23. package/dist/auth/protocol.js.map +1 -0
  24. package/dist/baseline.d.ts +18 -0
  25. package/dist/baseline.d.ts.map +1 -0
  26. package/dist/baseline.js +22 -0
  27. package/dist/baseline.js.map +1 -0
  28. package/dist/bin.d.ts +1 -0
  29. package/dist/bin.js +7 -0
  30. package/dist/bin.js.map +1 -0
  31. package/dist/cli.d.ts +19 -0
  32. package/dist/cli.d.ts.map +1 -0
  33. package/dist/cli.js +492 -0
  34. package/dist/cli.js.map +1 -0
  35. package/dist/create/choices.d.ts +58 -0
  36. package/dist/create/choices.d.ts.map +1 -0
  37. package/dist/create/choices.js +121 -0
  38. package/dist/create/choices.js.map +1 -0
  39. package/dist/create/deployment.d.ts +48 -0
  40. package/dist/create/deployment.d.ts.map +1 -0
  41. package/dist/create/deployment.js +66 -0
  42. package/dist/create/deployment.js.map +1 -0
  43. package/dist/create/scaffold.d.ts +57 -0
  44. package/dist/create/scaffold.d.ts.map +1 -0
  45. package/dist/create/scaffold.js +198 -0
  46. package/dist/create/scaffold.js.map +1 -0
  47. package/dist/create/source-reference.d.ts +39 -0
  48. package/dist/create/source-reference.d.ts.map +1 -0
  49. package/dist/create/source-reference.js +185 -0
  50. package/dist/create/source-reference.js.map +1 -0
  51. package/dist/create/template.d.ts +116 -0
  52. package/dist/create/template.d.ts.map +1 -0
  53. package/dist/create/template.js +211 -0
  54. package/dist/create/template.js.map +1 -0
  55. package/dist/diagnostics.d.ts +6 -0
  56. package/dist/diagnostics.d.ts.map +1 -0
  57. package/dist/diagnostics.js +18 -0
  58. package/dist/diagnostics.js.map +1 -0
  59. package/dist/help.d.ts +16 -0
  60. package/dist/help.d.ts.map +1 -0
  61. package/dist/help.js +73 -0
  62. package/dist/help.js.map +1 -0
  63. package/dist/openapi/bundle.d.ts +18 -0
  64. package/dist/openapi/bundle.d.ts.map +1 -0
  65. package/dist/openapi/bundle.js +201 -0
  66. package/dist/openapi/bundle.js.map +1 -0
  67. package/dist/openapi/discovery.d.ts +30 -0
  68. package/dist/openapi/discovery.d.ts.map +1 -0
  69. package/dist/openapi/discovery.js +325 -0
  70. package/dist/openapi/discovery.js.map +1 -0
  71. package/dist/openapi/emit.d.ts +52 -0
  72. package/dist/openapi/emit.d.ts.map +1 -0
  73. package/dist/openapi/emit.js +596 -0
  74. package/dist/openapi/emit.js.map +1 -0
  75. package/dist/openapi/graphql.d.ts +102 -0
  76. package/dist/openapi/graphql.d.ts.map +1 -0
  77. package/dist/openapi/graphql.js +294 -0
  78. package/dist/openapi/graphql.js.map +1 -0
  79. package/dist/openapi/identity.d.ts +88 -0
  80. package/dist/openapi/identity.d.ts.map +1 -0
  81. package/dist/openapi/identity.js +98 -0
  82. package/dist/openapi/identity.js.map +1 -0
  83. package/dist/openapi/mcp.d.ts +21 -0
  84. package/dist/openapi/mcp.d.ts.map +1 -0
  85. package/dist/openapi/mcp.js +133 -0
  86. package/dist/openapi/mcp.js.map +1 -0
  87. package/dist/openapi/operations.d.ts +165 -0
  88. package/dist/openapi/operations.d.ts.map +1 -0
  89. package/dist/openapi/operations.js +361 -0
  90. package/dist/openapi/operations.js.map +1 -0
  91. package/dist/openapi/overlay.d.ts +23 -0
  92. package/dist/openapi/overlay.d.ts.map +1 -0
  93. package/dist/openapi/overlay.js +115 -0
  94. package/dist/openapi/overlay.js.map +1 -0
  95. package/dist/openapi/plugin.d.ts +83 -0
  96. package/dist/openapi/plugin.d.ts.map +1 -0
  97. package/dist/openapi/plugin.js +468 -0
  98. package/dist/openapi/plugin.js.map +1 -0
  99. package/dist/openapi/polymorphism.d.ts +21 -0
  100. package/dist/openapi/polymorphism.d.ts.map +1 -0
  101. package/dist/openapi/polymorphism.js +96 -0
  102. package/dist/openapi/polymorphism.js.map +1 -0
  103. package/dist/openapi/postman.d.ts +21 -0
  104. package/dist/openapi/postman.d.ts.map +1 -0
  105. package/dist/openapi/postman.js +286 -0
  106. package/dist/openapi/postman.js.map +1 -0
  107. package/dist/openapi/schema.d.ts +178 -0
  108. package/dist/openapi/schema.d.ts.map +1 -0
  109. package/dist/openapi/schema.js +1234 -0
  110. package/dist/openapi/schema.js.map +1 -0
  111. package/dist/openapi/select.d.ts +22 -0
  112. package/dist/openapi/select.d.ts.map +1 -0
  113. package/dist/openapi/select.js +79 -0
  114. package/dist/openapi/select.js.map +1 -0
  115. package/dist/openapi/spec.d.ts +147 -0
  116. package/dist/openapi/spec.d.ts.map +1 -0
  117. package/dist/openapi/spec.js +263 -0
  118. package/dist/openapi/spec.js.map +1 -0
  119. package/dist/openapi/swagger.d.ts +166 -0
  120. package/dist/openapi/swagger.d.ts.map +1 -0
  121. package/dist/openapi/swagger.js +298 -0
  122. package/dist/openapi/swagger.js.map +1 -0
  123. package/dist/openapi/versions.d.ts +52 -0
  124. package/dist/openapi/versions.d.ts.map +1 -0
  125. package/dist/openapi/versions.js +120 -0
  126. package/dist/openapi/versions.js.map +1 -0
  127. package/dist/plugin/archive.d.ts +27 -0
  128. package/dist/plugin/archive.d.ts.map +1 -0
  129. package/dist/plugin/archive.js +170 -0
  130. package/dist/plugin/archive.js.map +1 -0
  131. package/dist/plugin/bundle.d.ts +27 -0
  132. package/dist/plugin/bundle.d.ts.map +1 -0
  133. package/dist/plugin/bundle.js +328 -0
  134. package/dist/plugin/bundle.js.map +1 -0
  135. package/dist/plugin/init.d.ts +18 -0
  136. package/dist/plugin/init.d.ts.map +1 -0
  137. package/dist/plugin/init.js +121 -0
  138. package/dist/plugin/init.js.map +1 -0
  139. package/dist/plugin/inspection.d.ts +24 -0
  140. package/dist/plugin/inspection.d.ts.map +1 -0
  141. package/dist/plugin/inspection.js +24 -0
  142. package/dist/plugin/inspection.js.map +1 -0
  143. package/dist/plugin/package.d.ts +26 -0
  144. package/dist/plugin/package.d.ts.map +1 -0
  145. package/dist/plugin/package.js +73 -0
  146. package/dist/plugin/package.js.map +1 -0
  147. package/dist/plugin/publication.d.ts +29 -0
  148. package/dist/plugin/publication.d.ts.map +1 -0
  149. package/dist/plugin/publication.js +65 -0
  150. package/dist/plugin/publication.js.map +1 -0
  151. package/dist/plugin/validation.d.ts +15 -0
  152. package/dist/plugin/validation.d.ts.map +1 -0
  153. package/dist/plugin/validation.js +119 -0
  154. package/dist/plugin/validation.js.map +1 -0
  155. package/dist/release/archives.d.ts +33 -0
  156. package/dist/release/archives.d.ts.map +1 -0
  157. package/dist/release/archives.js +81 -0
  158. package/dist/release/archives.js.map +1 -0
  159. package/dist/release/release-manifest.d.ts +182 -0
  160. package/dist/release/release-manifest.d.ts.map +1 -0
  161. package/dist/release/release-manifest.js +79 -0
  162. package/dist/release/release-manifest.js.map +1 -0
  163. package/dist/release/releases.d.ts +36 -0
  164. package/dist/release/releases.d.ts.map +1 -0
  165. package/dist/release/releases.js +122 -0
  166. package/dist/release/releases.js.map +1 -0
  167. package/dist/skills.d.ts +35 -0
  168. package/dist/skills.d.ts.map +1 -0
  169. package/dist/skills.js +257 -0
  170. package/dist/skills.js.map +1 -0
  171. package/package.json +73 -4
  172. package/skills/dual-fde/SKILL.md +38 -0
  173. package/skills/dual-fde/references/access.md +62 -0
  174. package/skills/dual-fde/references/author-plugins.md +54 -0
  175. package/skills/dual-fde/references/cli.md +97 -0
  176. package/skills/dual-fde/references/manage-plugins.md +78 -0
  177. package/skills/dual-fde/references/migrations-deployment.md +84 -0
  178. package/skills/dual-fde/references/openapi-plugins.md +47 -0
  179. package/skills/dual-fde/references/sdk-docs.md +56 -0
  180. package/skills/dual-fde/references/upgrades.md +115 -0
  181. package/skills/dual-fde/references/working-context.md +69 -0
  182. package/src/auth/credentials.ts +84 -0
  183. package/src/auth/destination.ts +83 -0
  184. package/src/auth/http.ts +39 -0
  185. package/src/auth/login.ts +177 -0
  186. package/src/auth/protocol.ts +37 -0
  187. package/src/baseline.ts +15 -0
  188. package/src/bin.ts +4 -0
  189. package/src/cli.ts +969 -0
  190. package/src/create/choices.ts +177 -0
  191. package/src/create/deployment.ts +96 -0
  192. package/src/create/scaffold.ts +334 -0
  193. package/src/create/source-reference.ts +212 -0
  194. package/src/create/template.ts +300 -0
  195. package/src/diagnostics.ts +8 -0
  196. package/src/help.ts +142 -0
  197. package/src/openapi/bundle.ts +290 -0
  198. package/src/openapi/discovery.ts +438 -0
  199. package/src/openapi/emit.ts +1031 -0
  200. package/src/openapi/graphql.ts +375 -0
  201. package/src/openapi/identity.ts +153 -0
  202. package/src/openapi/mcp.ts +165 -0
  203. package/src/openapi/operations.ts +781 -0
  204. package/src/openapi/overlay.ts +195 -0
  205. package/src/openapi/plugin.ts +856 -0
  206. package/src/openapi/polymorphism.ts +207 -0
  207. package/src/openapi/postman.ts +403 -0
  208. package/src/openapi/schema.ts +2138 -0
  209. package/src/openapi/select.ts +113 -0
  210. package/src/openapi/spec.ts +401 -0
  211. package/src/openapi/swagger.ts +422 -0
  212. package/src/openapi/versions.ts +174 -0
  213. package/src/plugin/archive.ts +244 -0
  214. package/src/plugin/bundle.ts +572 -0
  215. package/src/plugin/init.ts +178 -0
  216. package/src/plugin/inspection.ts +19 -0
  217. package/src/plugin/package.ts +140 -0
  218. package/src/plugin/publication.ts +128 -0
  219. package/src/plugin/validation.ts +213 -0
  220. package/src/release/archives.ts +133 -0
  221. package/src/release/release-manifest.ts +79 -0
  222. package/src/release/releases.ts +210 -0
  223. package/src/skills.ts +434 -0
  224. package/templates/compose/.env.compose.example.hbs +3 -0
  225. package/templates/compose/.env.host.example.hbs +4 -0
  226. package/templates/compose/Dockerfile.hbs +12 -0
  227. package/templates/compose/OPERATIONS.md.hbs +159 -0
  228. package/templates/compose/_dockerignore +14 -0
  229. package/templates/compose/compose.external.yaml +7 -0
  230. package/templates/compose/compose.host-linux.yaml +5 -0
  231. package/templates/compose/compose.host.yaml.hbs +15 -0
  232. package/templates/compose/compose.yaml.hbs +85 -0
  233. package/templates/compose/release.env.hbs +2 -0
  234. package/templates/default/.env.example.hbs +79 -0
  235. package/templates/default/README.md.hbs +150 -0
  236. package/templates/default/_gitignore +11 -0
  237. package/templates/default/packages/customer-plugin/src/Customer.ts.hbs +17 -0
  238. package/templates/default/packages/customer-plugin/tsconfig.json +15 -0
  239. package/templates/default/packages/execution-layer/src/App.ts.hbs +7 -0
  240. package/templates/default/packages/execution-layer/src/Host.ts.hbs +31 -0
  241. package/templates/default/packages/execution-layer/src/Telemetry.ts.hbs +23 -0
  242. package/templates/default/packages/execution-layer/src/api.ts.hbs +21 -0
  243. package/templates/default/packages/execution-layer/src/bootstrap.ts +22 -0
  244. package/templates/default/packages/execution-layer/src/migrate.ts +11 -0
  245. package/templates/default/packages/execution-layer/src/registry-check.ts +29 -0
  246. package/templates/default/packages/execution-layer/src/registry-sync.ts +14 -0
  247. package/templates/default/packages/execution-layer/src/worker.ts.hbs +16 -0
  248. package/templates/default/packages/execution-layer/test/app.host-test.ts.hbs +58 -0
  249. package/templates/default/packages/execution-layer/test/app.test.ts.hbs +16 -0
  250. package/templates/default/tsconfig.json +5 -0
  251. package/templates/default/vitest.config.ts +5 -0
  252. package/templates/default/vitest.host.config.ts +6 -0
  253. package/templates/opensandbox/OPEN-SANDBOX.md +25 -0
  254. package/templates/opensandbox/docker/agent-sandbox.Dockerfile +41 -0
package/dist/cli.js ADDED
@@ -0,0 +1,492 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import { AuthError, DeploymentUrl } from "./auth/protocol.js";
3
+ import { layer as layer$1 } from "./auth/credentials.js";
4
+ import { Service, layer as layer$2 } from "./auth/destination.js";
5
+ import { Service as Service$1, layer as layer$3 } from "./auth/login.js";
6
+ import { DisplayName, Host, Hostname, PackageName, PackageScope, Port, Slug, defaults, forPreset, identity as identity$1, ports, suggestSlug } from "./create/choices.js";
7
+ import { Image } from "./create/deployment.js";
8
+ import { layer as layer$4 } from "./release/archives.js";
9
+ import { ReleaseError, Selector, Service as Service$2, Version, layer as layer$5 } from "./release/releases.js";
10
+ import { Request, ScaffoldError, Service as Service$3, layer as layer$6 } from "./create/scaffold.js";
11
+ import { colors, formatter } from "./help.js";
12
+ import { OpenApiPluginError, PackageScope as PackageScope$1, Request as Request$1, Service as Service$4, defaultLayer } from "./openapi/plugin.js";
13
+ import { PackageError, layer as layer$7 } from "./plugin/package.js";
14
+ import { Output } from "./plugin/inspection.js";
15
+ import { Service as Service$5, layer as layer$8 } from "./plugin/validation.js";
16
+ import { Artifact, Service as Service$6, layer as layer$9 } from "./plugin/archive.js";
17
+ import { InitError, Service as Service$7, layer as layer$10 } from "./plugin/init.js";
18
+ import { Receipt, Service as Service$8, layer as layer$11 } from "./plugin/publication.js";
19
+ import { SkillsError, command, layer as layer$12 } from "./skills.js";
20
+ import "./cli.js";
21
+ import { readFileSync } from "node:fs";
22
+ import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
23
+ import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
24
+ import * as NodeServices from "@effect/platform-node/NodeServices";
25
+ import { Array, Console, Effect, Layer, Option, Ref, Schema, Stdio, String, pipe } from "effect";
26
+ import { Argument, CliConfig, CliOutput, Command, Flag, GlobalFlag, Prompt } from "effect/cli";
27
+ import { FetchHttpClient } from "effect/http";
28
+ // src/cli.ts
29
+ var cli_exports = /* @__PURE__ */ __exportAll({
30
+ Cli: () => cli_exports,
31
+ execute: () => execute,
32
+ layer: () => layer,
33
+ run: () => run
34
+ });
35
+ const manifest = Schema.decodeUnknownSync(Schema.fromJsonString(Schema.Struct({ version: Schema.NonEmptyString })))(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
36
+ const options = {
37
+ apiPort: Flag.Int("api-port").pipe(Flag.withSchema(Port), Flag.optional, Flag.withDescription("Default: 3000. API listener, Compose probes and upstreams")),
38
+ appId: Flag.String("app-id").pipe(Flag.withSchema(Slug), Flag.optional, Flag.withDescription("Runtime application identifier; default: slug")),
39
+ bare: Flag.Boolean("bare").pipe(Flag.withDefault(false), Flag.withDescription("Offline inspection baseline with --skip-install; no release lookup")),
40
+ database: Flag.Literals("database", ["postgresql"]).pipe(Flag.optional, Flag.withDescription("Database; no provisioning")),
41
+ destination: Argument.String("destination").pipe(Argument.withSchema(Request.fields.destination), Argument.withDescription("Absent or empty directory; never overwrites existing work"), Argument.optional),
42
+ email: Flag.Literals("email", ["logging-only-no-delivery", "smtp"]).pipe(Flag.optional, Flag.withDescription("Default: logging only, NO DELIVERY. SMTP needs an existing relay")),
43
+ fileStorage: Flag.Literals("file-storage", ["local", "s3"]).pipe(Flag.optional, Flag.withDescription("Default: local. S3 needs an existing bucket and external credentials")),
44
+ hostname: Flag.String("hostname").pipe(Flag.withSchema(Hostname), Flag.optional, Flag.withDescription("Default: localhost. Local HTTP hostname/origins; no DNS or TLS provisioning")),
45
+ httpPort: Flag.Int("http-port").pipe(Flag.withSchema(Port), Flag.optional, Flag.withDescription("HTTP proxy host port; default: first free choice from 3001")),
46
+ interactive: Flag.Boolean("interactive").pipe(Flag.withDefault(false), Flag.withDescription("Prompt for host choices")),
47
+ manifest: Flag.String("manifest").pipe(Flag.withSchema(Version), Flag.optional, Flag.withDescription("Exact release manifest 0.0.<pipeline-id>; no substitutions")),
48
+ name: Flag.String("name").pipe(Flag.withSchema(DisplayName), Flag.optional, Flag.withDescription("Friendly project/customer name; default: Customer")),
49
+ packageName: Flag.String("package-name").pipe(Flag.withSchema(PackageName), Flag.optional, Flag.withDescription("Root package name; default: dual-<slug>")),
50
+ packageScope: Flag.String("package-scope").pipe(Flag.withSchema(PackageScope), Flag.optional, Flag.withDescription("npm scope including @; default: @<slug>")),
51
+ pluginId: Flag.String("plugin-id").pipe(Flag.withSchema(Slug), Flag.optional, Flag.withDescription("Owned plugin/provider identifier; default: slug")),
52
+ postgresPort: Flag.Int("postgres-port").pipe(Flag.withSchema(Port), Flag.optional, Flag.withDescription("PostgreSQL forwarded host port; default: first free choice from 55432")),
53
+ preset: Flag.Literals("preset", ["customer", "playground"]).pipe(Flag.optional, Flag.withDescription("Default: customer. playground defaults to OpenSandbox, NOT a hosted clone; no extra email/support/telemetry or provisioning")),
54
+ release: Flag.String("release").pipe(Flag.withSchema(Selector), Flag.optional, Flag.withDescription("Core version: latest compatible release (online default) or exact core semver")),
55
+ releasePair: Flag.String("release-pair").pipe(Flag.optional, Flag.withDescription("Legacy fixed-baseline core/web mapping JSON; requires --web-image")),
56
+ replay: Flag.String("replay").pipe(Flag.optional, Flag.withDescription("Exact dual.scaffold.json replay; checks artifact availability even with --skip-install")),
57
+ skipInstall: Flag.Boolean("skip-install").pipe(Flag.withDefault(false), Flag.withDescription("No installation or lockfile; only --bare generation is offline")),
58
+ slug: Flag.String("slug").pipe(Flag.withSchema(Slug), Flag.optional, Flag.withDescription("Project slug; suggested from name")),
59
+ telemetry: Flag.Literals("telemetry", ["opt-in", "disabled"]).pipe(Flag.optional, Flag.withDescription("Default: opt-in. OTLP needs an external collector URL")),
60
+ webImage: Flag.String("web-image").pipe(Flag.withSchema(Image), Flag.optional, Flag.withDescription("Exact repository@sha256 web digest (local sha256 ID for isolated validation only)")),
61
+ workspace: Flag.Literals("workspace", ["just-bash", "opensandbox"]).pipe(Flag.optional, Flag.withDescription("Overrides preset; OpenSandbox needs an existing external server and accessible sandbox image"))
62
+ };
63
+ /** Node services for executing commands, including real scaffold and skill adapters. */
64
+ const layer = Layer.mergeAll(layer$6.pipe(Layer.provide(layer$5), Layer.provide(layer$4), Layer.provideMerge(NodeServices.layer)), layer$5.pipe(Layer.provide(NodeServices.layer)), layer$12.pipe(Layer.provide(NodeServices.layer)));
65
+ const messages = {
66
+ access: "Registry preflight failed. Check Bun/npm, VPN and external read-only registry configuration, and availability of the exact template artifacts. No scaffold was written. Credentials must remain external.",
67
+ destination: "Destination must be absent or an empty writable directory, not a symlink. Nothing was overwritten.",
68
+ install: "Installation failed; the complete scaffold is preserved. After checking Bun and external registry access, retry from inside the generated repository: bun install",
69
+ options: "Invalid identity, ports or flags. Package identities must not collide; ports must be distinct. Offline generation requires --bare --skip-install. See --help.",
70
+ pair: "Release manifest unavailable, invalid, or incompatible with this CLI/template. Check external npm registry access and release activation; use dual release resolve to inspect the candidate. No fallback or substitutions were made.",
71
+ replay: "Exact replay failed. Use the recorded CLI/bootstrap version and template; verify availability of every exact artifact. No substitution or upgrade is performed.",
72
+ write: "Could not write the scaffold. Ensure Git is installed; check destination permissions and concurrent changes. Existing files were not overwritten."
73
+ };
74
+ /** Execute CLI arguments (without the executable), returning the diagnostic exit code.
75
+ * Interruption and defects still propagate; only run() owns the Node process exit status.
76
+ */
77
+ const execute = Effect.fn("Cli.execute")(function* (args) {
78
+ const stdio = yield* Stdio.Stdio;
79
+ const stdinIsTerminal = yield* stdio.stdinIsTerminal;
80
+ const stdoutIsTerminal = yield* stdio.stdoutIsTerminal;
81
+ const interactiveTerminal = stdinIsTerminal && stdoutIsTerminal;
82
+ const exitCode = yield* Ref.make(0);
83
+ const create = Command.make("create", options, Effect.fn(function* (input) {
84
+ const { bare, skipInstall, replay } = input;
85
+ const explicitHostChoices = Array.some([
86
+ input.name,
87
+ input.slug,
88
+ input.packageScope,
89
+ input.packageName,
90
+ input.appId,
91
+ input.pluginId,
92
+ input.httpPort,
93
+ input.postgresPort,
94
+ input.preset,
95
+ input.database,
96
+ input.workspace,
97
+ input.hostname,
98
+ input.apiPort,
99
+ input.fileStorage,
100
+ input.email,
101
+ input.telemetry
102
+ ], (choice) => Option.isSome(choice));
103
+ const missingDestination = Option.isNone(input.destination);
104
+ const interactive = input.interactive || missingDestination;
105
+ if (missingDestination && !interactiveTerminal) {
106
+ yield* Console.error("Missing destination. Use dual create ./project; destination prompts require an interactive terminal (stdin and stdout TTY).");
107
+ yield* Ref.set(exitCode, 1);
108
+ return;
109
+ }
110
+ if (missingDestination && (Option.isSome(replay) || explicitHostChoices)) {
111
+ yield* Console.error("Supply an explicit destination with --replay or host-choice flags: dual create ./project [options]. Omitting it starts the wizard; explicit choices are never discarded.");
112
+ yield* Ref.set(exitCode, 1);
113
+ return;
114
+ }
115
+ if (Option.isSome(replay) && (interactive || bare || Option.isSome(input.release) || Option.isSome(input.manifest) || Option.isSome(input.releasePair) || Option.isSome(input.webImage) || explicitHostChoices)) {
116
+ yield* Console.error("--replay cannot be combined with generation choices or --interactive.");
117
+ yield* Ref.set(exitCode, 1);
118
+ return;
119
+ }
120
+ if (Option.isSome(input.release) && Option.isSome(input.manifest) || (Option.isSome(input.release) || Option.isSome(input.manifest)) && (Option.isSome(input.releasePair) || Option.isSome(input.webImage))) {
121
+ yield* Console.error("--release and --manifest are mutually exclusive and cannot be combined with --release-pair or --web-image.");
122
+ yield* Ref.set(exitCode, 1);
123
+ return;
124
+ }
125
+ if (interactive && !interactiveTerminal) {
126
+ yield* Console.error("--interactive requires an interactive terminal (stdin and stdout TTY). Use an explicit destination and flags for noninteractive generation.");
127
+ yield* Ref.set(exitCode, 1);
128
+ return;
129
+ }
130
+ const destination = yield* Option.match(input.destination, {
131
+ onNone: () => Prompt.String({
132
+ message: "Project destination/name",
133
+ validate: (value) => Schema.decodeUnknownEffect(Request.fields.destination)(value).pipe(Effect.mapError(() => "Enter a nonblank destination without control characters."))
134
+ }),
135
+ onSome: Effect.succeed
136
+ });
137
+ const name = yield* Option.match(input.name, {
138
+ onNone: () => interactive ? Prompt.String({
139
+ default: defaults.name,
140
+ message: "Project/customer name",
141
+ validate: (value) => Schema.decodeUnknownEffect(DisplayName)(value).pipe(Effect.mapError(() => "Enter a nonblank name without control characters."))
142
+ }) : Effect.succeed(defaults.name),
143
+ onSome: Effect.succeed
144
+ });
145
+ const slug = yield* Option.match(input.slug, {
146
+ onNone: () => interactive ? Prompt.String({
147
+ default: suggestSlug(name),
148
+ message: "Project slug (editable suggestion)",
149
+ validate: (value) => Schema.decodeUnknownEffect(Slug)(value).pipe(Effect.mapError(() => "Use lowercase letters, digits and single hyphens; start with a letter."))
150
+ }) : Effect.succeed(suggestSlug(name)),
151
+ onSome: Effect.succeed
152
+ });
153
+ const packageScope = yield* Option.match(input.packageScope, {
154
+ onNone: () => interactive ? Prompt.String({
155
+ default: `@${slug}`,
156
+ message: "npm package scope (editable suggestion)",
157
+ validate: (value) => Schema.decodeUnknownEffect(PackageScope)(value).pipe(Effect.mapError(() => "Use @ followed by a project slug; @dual, @effect and @types are reserved."))
158
+ }) : Effect.succeed(`@${slug}`),
159
+ onSome: Effect.succeed
160
+ });
161
+ const identity = identity$1({
162
+ appId: Option.getOrUndefined(input.appId),
163
+ name,
164
+ packageName: Option.getOrUndefined(input.packageName),
165
+ packageScope,
166
+ pluginId: Option.getOrUndefined(input.pluginId),
167
+ slug
168
+ });
169
+ const ports$1 = ports({
170
+ apiPort: Option.getOrUndefined(input.apiPort),
171
+ httpPort: Option.getOrUndefined(input.httpPort),
172
+ postgresPort: Option.getOrUndefined(input.postgresPort)
173
+ });
174
+ const preset = interactive && Option.isNone(input.preset) ? yield* Prompt.Select({
175
+ choices: [{
176
+ title: "Customer — just-bash",
177
+ value: "customer"
178
+ }, {
179
+ title: "Playground-style — external OpenSandbox, NOT a hosted clone",
180
+ value: "playground"
181
+ }],
182
+ message: "Host preset (no provisioning or extra integrations)"
183
+ }) : Option.getOrElse(input.preset, () => defaults.preset);
184
+ const defaults$1 = forPreset(preset);
185
+ const host = {
186
+ ...defaults$1,
187
+ ...identity,
188
+ ...ports$1,
189
+ email: Option.getOrElse(input.email, () => defaults.email),
190
+ fileStorage: Option.getOrElse(input.fileStorage, () => defaults.fileStorage),
191
+ hostname: Option.getOrElse(input.hostname, () => defaults$1.hostname),
192
+ telemetry: Option.getOrElse(input.telemetry, () => defaults.telemetry),
193
+ workspace: Option.getOrElse(input.workspace, () => defaults$1.workspace)
194
+ };
195
+ const workspace = interactive ? yield* Option.match(input.workspace, {
196
+ onNone: () => Prompt.Select({
197
+ choices: Array.map([host.workspace, host.workspace === "opensandbox" ? "just-bash" : "opensandbox"], (value) => ({
198
+ title: value,
199
+ value
200
+ })),
201
+ message: "Execution workspace (OpenSandbox needs an external server/image; no socket or provisioning)"
202
+ }),
203
+ onSome: Effect.succeed
204
+ }) : host.workspace;
205
+ const fileStorage = interactive ? yield* Option.match(input.fileStorage, {
206
+ onNone: () => Prompt.Select({
207
+ choices: [{
208
+ title: "Local persistent files (shared API/worker volume)",
209
+ value: "local"
210
+ }, {
211
+ title: "S3-compatible storage",
212
+ value: "s3"
213
+ }],
214
+ message: "File storage (S3 requires an existing bucket and external credentials)"
215
+ }),
216
+ onSome: Effect.succeed
217
+ }) : host.fileStorage;
218
+ const email = interactive ? yield* Option.match(input.email, {
219
+ onNone: () => Prompt.Select({
220
+ choices: [{
221
+ title: "Logging only — NO DELIVERY",
222
+ value: "logging-only-no-delivery"
223
+ }, {
224
+ title: "SMTP — existing relay, external credentials, real delivery",
225
+ value: "smtp"
226
+ }],
227
+ message: "Email"
228
+ }),
229
+ onSome: Effect.succeed
230
+ }) : host.email;
231
+ const telemetry = interactive ? yield* Option.match(input.telemetry, {
232
+ onNone: () => Prompt.Select({
233
+ choices: [{
234
+ title: "Opt-in OTLP traces — requires an externally configured collector URL",
235
+ value: "opt-in"
236
+ }, {
237
+ title: "Disabled",
238
+ value: "disabled"
239
+ }],
240
+ message: "Telemetry"
241
+ }),
242
+ onSome: Effect.succeed
243
+ }) : host.telemetry;
244
+ const selected = {
245
+ ...host,
246
+ email,
247
+ fileStorage,
248
+ telemetry,
249
+ workspace
250
+ };
251
+ const result = yield* (yield* Service$3).create({
252
+ destination,
253
+ bare,
254
+ skipInstall,
255
+ host: yield* Schema.decodeUnknownEffect(Host)(selected),
256
+ ...Option.match(input.manifest, {
257
+ onNone: () => Option.match(input.release, {
258
+ onNone: () => ({}),
259
+ onSome: (value) => ({ release: value })
260
+ }),
261
+ onSome: (value) => ({ manifest: value })
262
+ }),
263
+ ...Option.match(input.releasePair, {
264
+ onNone: () => ({}),
265
+ onSome: (value) => ({ releasePair: value })
266
+ }),
267
+ ...Option.match(input.webImage, {
268
+ onNone: () => ({}),
269
+ onSome: (value) => ({ webImage: value })
270
+ }),
271
+ cliVersion: manifest.version,
272
+ ...Option.match(replay, {
273
+ onNone: () => ({}),
274
+ onSome: (value) => ({ replay: value })
275
+ })
276
+ });
277
+ yield* Console.log(Array.join([
278
+ `Created the customer-owned Bun workspace at: ${result.destination}`,
279
+ ...result.deployment === null ? [] : [`Selected core: ${result.deployment.pair.coreVersion}`, `Selected image: ${result.deployment.webImage}`],
280
+ result.installed ? "Dependencies installed." : "No installation or lockfile.",
281
+ "Next (POSIX shell):",
282
+ ` cd '${String.replaceAll("'", "'\\''")(result.destination)}'`,
283
+ result.installed ? " bun run check-types && bun run test" : " bun install",
284
+ "Reference-only Dual and FDE docs submodules registered; run bun run source:init to fetch them explicitly.",
285
+ "No services or database initialization were started."
286
+ ], "\n"));
287
+ })).pipe(Command.withDescription("Create a customer-owned Bun execution layer from a compatible release manifest. Bare skip-install uses an offline inspection baseline. Installs by default; never provisions or starts services. Replay never substitutes or upgrades versions."), Command.withShortDescription("Create a Bun workspace; installs by default"), Command.withExamples([
288
+ {
289
+ command: "dual create customer --bare --skip-install",
290
+ description: "Offline inspection; no install or lockfile"
291
+ },
292
+ {
293
+ command: "dual create customer --interactive --bare --skip-install",
294
+ description: "Choose host options interactively, still offline"
295
+ },
296
+ {
297
+ command: "dual create customer-copy --replay customer/dual.scaffold.json --skip-install",
298
+ description: "Exact replay; recorded CLI/template and available registry artifacts required"
299
+ }
300
+ ]));
301
+ const release = Command.make("release").pipe(Command.withDescription("Discover completed release manifests"), Command.withSubcommands([Command.make("resolve", {
302
+ manifest: options.manifest,
303
+ selector: Argument.String("selector").pipe(Argument.withSchema(Selector), Argument.withDescription("Exact core semver or latest (default); never a manifest ID"), Argument.optional)
304
+ }, Effect.fn(function* ({ selector, manifest: manifestId }) {
305
+ if (Option.isSome(selector) && Option.isSome(manifestId)) {
306
+ yield* Console.error("--manifest cannot be combined with a positional selector (including latest).");
307
+ yield* Ref.set(exitCode, 1);
308
+ return;
309
+ }
310
+ const releases = yield* Service$2;
311
+ const request = Option.match(manifestId, {
312
+ onNone: () => ({ core: Option.getOrElse(selector, () => "latest") }),
313
+ onSome: (value) => ({ manifest: value })
314
+ });
315
+ yield* Console.log(JSON.stringify(yield* releases.resolve(request), null, 2));
316
+ })).pipe(Command.withDescription("Print newest completed release for latest or an exact core version; --manifest selects an exact snapshot. Includes archive integrity (not CLI/template-filtered); no writes or deployment"))]));
317
+ const openApiPlugin = pipe(Command.make("openapi-plugin", {
318
+ source: pipe(Argument.String("source"), Argument.withSchema(Request$1.fields.spec), Argument.withDescription("With a destination: local path or HTTP(S) URL of an OpenAPI 3.0/3.1, Swagger 2.0, Google Discovery or Postman collection document (--source-kind document), the URL of a GraphQL endpoint (--source-kind graphql) or a Model Context Protocol server (--source-kind mcp). Alone: a package directory to regenerate from its plugin.json")),
319
+ destination: pipe(Argument.String("destination"), Argument.withSchema(Request$1.fields.destination), Argument.optional, Argument.withDescription("Directory of a new package, without a plugin.json; created if absent. Its name is the plugin id. src/generated is owned by the CLI; auth.ts, triggers.ts and the package scaffold are kept once written")),
320
+ packageScope: pipe(Flag.String("package-scope"), Flag.withSchema(PackageScope$1), Flag.optional, Flag.withDescription("Customer npm scope including @; default: @customer")),
321
+ sourceKind: pipe(Flag.Literals("source-kind", [
322
+ "document",
323
+ "graphql",
324
+ "mcp"
325
+ ]), Flag.optional, Flag.withDescription("Required with a destination. document: a description document; graphql: a GraphQL endpoint to introspect; mcp: a Model Context Protocol server whose tools to list")),
326
+ target: pipe(Flag.Literals("target", ["internal", "customer"]), Flag.optional, Flag.withDescription("Required with a destination. internal: public @dual package; customer: private package for a customer workspace"))
327
+ }, Effect.fn(function* (input) {
328
+ const service = yield* Service$4;
329
+ const creation = Option.all({
330
+ destination: input.destination,
331
+ kind: input.sourceKind,
332
+ target: input.target
333
+ });
334
+ if (Option.isSome(input.destination) && Option.isNone(creation)) return yield* OpenApiPluginError.make({ message: "--target and --source-kind are required with a destination." });
335
+ if (Option.isNone(input.destination) && (Option.isSome(input.target) || Option.isSome(input.packageScope) || Option.isSome(input.sourceKind))) return yield* OpenApiPluginError.make({ message: "--target, --package-scope and --source-kind need a destination; to change a package, edit its plugin.json and run dual openapi-plugin <package>." });
336
+ const result = yield* Option.match(creation, {
337
+ onNone: () => service.generate(input.source),
338
+ onSome: (required) => service.create({
339
+ ...required,
340
+ packageScope: Option.getOrUndefined(input.packageScope),
341
+ spec: input.source
342
+ })
343
+ });
344
+ const directory = Option.getOrElse(input.destination, () => input.source);
345
+ yield* Console.log(Array.join([
346
+ `Generated ${directory} with ${result.generated} current action(s).`,
347
+ ...Array.flatMap([
348
+ ["New actions", result.added],
349
+ ["Changed actions", result.changed],
350
+ ["Removed from this package; published releases remain unchanged", result.vanished],
351
+ ["Excluded until the CLI supports them", result.excluded],
352
+ ["Schemas widened to unknown, as the CLI cannot represent them", result.widened]
353
+ ], (entry) => Array.isReadonlyArrayEmpty(entry[1]) ? [] : [`${entry[0]}:\n ${Array.join(entry[1], "\n ")}`]),
354
+ ...Array.isReadonlyArrayEmpty(result.kept) ? [] : [`Kept ${Array.join(result.kept, ", ")}; delete a file to have it written again.`],
355
+ `Next: complete auth and the important webhook and polling triggers, then test through DualRuntime and set the release version in package.json. Regenerate with dual openapi-plugin ${directory}.`
356
+ ], "\n"));
357
+ })), Command.withDescription("Generate a Dual plugin package from OpenAPI 3.0/3.1 or Swagger 2.0 JSON or YAML, Google Discovery and Postman collection (v2.x) documents, GraphQL endpoints and schemas and Model Context Protocol servers. The package directory name is the plugin and provider id. With a destination, writes a new package and records its inputs in plugin.json under openapi; alone, regenerates a package from that section: target, optional packageScope, optional metadata (the plugin's description and name), identityMappings, and provider, with name, optional metadata (categories, description, docsUrl, homepageUrl, iconUrl) and specs, plus optional oauth (authorizationUrl, tokenUrl and optional scopes, authentication, pkce and resource) for a source that declares no OAuth scheme. Each spec has a kind (document, graphql or mcp), a source (a URL or a path relative to the package; relative file and absolute URL references inside a document are bundled), optionally sourceUrl, the URL a file source is served from, which resolves its relative server and OAuth URLs, optionally endpoint, which marks the source as a GraphQL introspection result or SDL schema and names the endpoint its actions call, and optionally a kebab-case name that prefixes its groups and action names, an OpenAPI Overlay file fixing the source, include and exclude patterns ([METHOD ]/path with * within a segment and ** across segments; include may name sets of patterns, which prefix groups and action names, and the first set matching an operation owns it), aliases such as {\"/users/{user-id}\": \"/me\"} that fold the alias path into an optional parameter. A GraphQL endpoint is introspected: each root query and mutation field becomes an action at /query/<field> or /mutation/<field> whose payload is its arguments and whose output is a fixed selection. The tools of a Model Context Protocol server become actions at /tools/<name>. Operations marked deprecated are skipped unless already published; a schema the CLI cannot represent is widened to unknown and reported, and operations it cannot call are excluded and reported. Each run replaces src/generated/operations.ts and plugin.ts with current contracts and handlers. src/generated/lock.json preserves stable action identities and current hashes. Maintained auth, triggers, overlays and package metadata remain unchanged. The release version comes only from package.json. Published archives preserve earlier code; the generator writes no source version registry or compatibility adapters. Writes files only; reads the sources but never installs, type-checks or runs generated actions."), Command.withShortDescription("Generate a plugin package from OpenAPI"), Command.withExamples([
358
+ {
359
+ command: "dual openapi-plugin ./api.yaml api --target internal --source-kind document",
360
+ description: "Internal @dual/api package in this monorepo"
361
+ },
362
+ {
363
+ command: "dual openapi-plugin ./api.json api --target customer --source-kind document",
364
+ description: "Private @customer/api package in a customer workspace"
365
+ },
366
+ {
367
+ command: "dual openapi-plugin api",
368
+ description: "Regenerate a package from its plugin.json"
369
+ }
370
+ ]), Command.provide(pipe(defaultLayer, Layer.provide([NodeServices.layer, FetchHttpClient.layer]))));
371
+ const plugin = Command.make("plugin").pipe(Command.withDescription("Build, inspect or publish an organization integration plugin. A validated stable push becomes available for execution automatically."), Command.withSubcommands([
372
+ pipe(Command.make("init", { directory: pipe(Argument.String("directory"), Argument.withSchema(Request.fields.destination)) }, Effect.fn("Cli.pluginInit")(function* (input) {
373
+ const destination = yield* (yield* Service$7).create(input.directory);
374
+ yield* Console.log(`Created a Dual SDK plugin in ${destination}.\nRun bun install and bun run build there, then dual plugin validate and dual plugin build.`);
375
+ })), Command.withDescription("Create a minimal TypeScript Dual SDK plugin in an absent or empty directory. Does not install, publish or activate it."), Command.provide(pipe(layer$10, Layer.provide(NodeServices.layer)))),
376
+ Command.make("build", {
377
+ directory: Argument.String("directory").pipe(Argument.withDefault(".")),
378
+ output: Flag.String("output").pipe(Flag.withSchema(Schema.String.check(Schema.isPattern(/\.tgz$/u))), Flag.withDefault(".dual/plugin.tgz"))
379
+ }, Effect.fn(function* (input) {
380
+ yield* Console.log(yield* Schema.encodeEffect(Schema.fromJsonString(Artifact))(yield* (yield* Service$6).build(input.directory, input.output)));
381
+ })).pipe(Command.withDescription("Build and verify a self-contained npm tarball with its runner, dependencies, licenses and SHA-512 digest."), Command.provide(layer$9.pipe(Layer.provide(layer$8), Layer.provide(layer$7), Layer.provide([NodeServices.layer, NodeCrypto.layerDigest])))),
382
+ Command.make("push", {
383
+ directory: Argument.String("directory").pipe(Argument.withDefault(".")),
384
+ org: Flag.String("org").pipe(Flag.optional),
385
+ url: Flag.String("url").pipe(Flag.withSchema(DeploymentUrl), Flag.optional)
386
+ }, Effect.fn(function* (input) {
387
+ const destination = yield* Service;
388
+ const previous = Option.getOrUndefined(yield* destination.read(input.directory));
389
+ const deployment = Option.getOrUndefined(input.url) ?? previous?.deployment ?? Option.getOrUndefined(yield* destination.defaultDeployment);
390
+ if (deployment === void 0) return yield* AuthError.make({ message: "Choose a deployment with dual login --web --url before publishing." });
391
+ const normalized = new URL(deployment).origin;
392
+ const publication = yield* Service$8;
393
+ const savedOrganization = previous?.deployment === normalized ? previous.organizationId : void 0;
394
+ const explicitOrganization = Option.getOrUndefined(input.org) ?? savedOrganization;
395
+ const organizations = (yield* publication.organizations(normalized)).organizations;
396
+ if (Array.isReadonlyArrayEmpty(organizations)) return yield* AuthError.make({ message: "No administered organization is available for plugin publication." });
397
+ if (explicitOrganization === void 0 && !interactiveTerminal) return yield* AuthError.make({ message: "Select the publication organization with --org in a noninteractive terminal." });
398
+ const organizationId = explicitOrganization ?? (yield* Prompt.Select({
399
+ choices: Array.map(organizations, (organization) => ({
400
+ title: organization.name,
401
+ value: organization.id
402
+ })),
403
+ message: "Publish to organization"
404
+ }));
405
+ if (!Array.some(organizations, (organization) => organization.id === organizationId)) return yield* AuthError.make({ message: "You must administer the selected organization to publish plugins." });
406
+ yield* Console.log(yield* Schema.encodeEffect(Schema.fromJsonString(Receipt))(yield* publication.push(input.directory, {
407
+ deployment: normalized,
408
+ organizationId
409
+ })));
410
+ })).pipe(Command.withDescription("Build and upload a plugin; success requires authoritative server validation."), Command.provide(layer$11.pipe(Layer.provideMerge(layer$9), Layer.provide(layer$8), Layer.provide(layer$7), Layer.provideMerge(layer$2), Layer.provide(layer$1), Layer.provide([
411
+ NodeServices.layer,
412
+ NodeCrypto.layer,
413
+ FetchHttpClient.layer
414
+ ])))),
415
+ Command.make("validate", { directory: Argument.String("directory").pipe(Argument.withDefault(".")) }, Effect.fn(function* (input) {
416
+ const result = yield* (yield* Service$5).validate(input.directory);
417
+ yield* Console.log(yield* Schema.encodeEffect(Schema.fromJsonString(Output))({
418
+ ...result,
419
+ activated: false,
420
+ published: false,
421
+ status: "local-only"
422
+ }));
423
+ })).pipe(Command.withDescription("Check package paths and declared assets, then import compiled JavaScript in a child process to extract SDK contracts. Does not build, package dependencies or certify compatibility."), Command.provide(layer$8.pipe(Layer.provide(layer$7), Layer.provide(NodeServices.layer))))
424
+ ]));
425
+ const program = Command.make("dual").pipe(Command.withDescription("Bootstrap a customer-owned Dual workspace."), Command.withSubcommands([
426
+ create,
427
+ release,
428
+ openApiPlugin,
429
+ plugin,
430
+ Command.make("login", {
431
+ url: Flag.String("url").pipe(Flag.withSchema(DeploymentUrl)),
432
+ web: Flag.Boolean("web")
433
+ }, Effect.fn(function* (input) {
434
+ if (!input.web) return yield* AuthError.make({ message: "Only browser login is supported. Use dual login --web --url." });
435
+ const result = yield* (yield* Service$1).login(input.url);
436
+ yield* (yield* Service).saveDefault(result.deployment);
437
+ yield* Console.log(yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Struct({
438
+ deployment: Schema.String,
439
+ expiresAt: Schema.String
440
+ })))(result));
441
+ })).pipe(Command.withDescription("Authorize through the browser and save a revocable credential in your home directory."), Command.provide(layer$3.pipe(Layer.provideMerge(layer$2), Layer.provide(layer$1), Layer.provide([
442
+ NodeServices.layer,
443
+ NodeCrypto.layer,
444
+ FetchHttpClient.layer
445
+ ])))),
446
+ Command.make("logout", { url: Flag.String("url").pipe(Flag.withSchema(DeploymentUrl), Flag.optional) }, Effect.fn(function* (input) {
447
+ const deployment = Option.getOrUndefined(input.url) ?? Option.getOrUndefined(yield* (yield* Service).defaultDeployment);
448
+ if (deployment === void 0) return yield* AuthError.make({ message: "Specify the deployment with dual logout --url." });
449
+ yield* (yield* Service$1).logout(deployment);
450
+ yield* Console.log("CLI credential revoked and its local file removed.");
451
+ })).pipe(Command.withDescription("Revoke the CLI credential on Dual, then remove its local file."), Command.provide(layer$3.pipe(Layer.provideMerge(layer$2), Layer.provide(layer$1), Layer.provide([
452
+ NodeServices.layer,
453
+ NodeCrypto.layer,
454
+ FetchHttpClient.layer
455
+ ])))),
456
+ command
457
+ ]), Command.withExamples([{
458
+ command: "dual create customer --bare --skip-install",
459
+ description: "Start offline; no install or lockfile"
460
+ }, {
461
+ command: "dual create --help",
462
+ description: "All creation options and exact replay"
463
+ }]));
464
+ yield* Command.runWith(program, {
465
+ renderErrors: false,
466
+ version: manifest.version
467
+ })(args).pipe(Effect.provideService(CliConfig.CliConfig, CliConfig.make({ builtIns: Array.map(GlobalFlag.BuiltIns, (flag) => flag === GlobalFlag.Wizard && !interactiveTerminal ? GlobalFlag.Action({
468
+ flag: GlobalFlag.Wizard.flag,
469
+ run: Effect.fn(function* () {
470
+ yield* Console.error("--wizard requires an interactive terminal (stdin and stdout TTY). Use dual create ./project with explicit flags for noninteractive generation.");
471
+ yield* Ref.set(exitCode, 1);
472
+ })
473
+ }) : flag) })), Effect.catch((error) => Effect.gen(function* () {
474
+ yield* Console.error(error instanceof ScaffoldError ? messages[error.operation] : error instanceof ReleaseError ? "Release discovery failed. Check npm registry access, release activation and selector. Invalid records never fall back to other versions." : error instanceof SkillsError ? error.message : error instanceof OpenApiPluginError ? error.message : Schema.is(AuthError)(error) ? error.message : Schema.is(InitError)(error) ? error.message : Schema.is(PackageError)(error) ? error.message : "Invalid command. See --help. No credentials are accepted as CLI arguments.");
475
+ yield* Ref.set(exitCode, 1);
476
+ })));
477
+ return yield* Ref.get(exitCode);
478
+ });
479
+ /** Node-compatible entrypoint with the production adapters and help formatter. */
480
+ const run = () => {
481
+ Effect.gen(function* () {
482
+ const stdio = yield* Stdio.Stdio;
483
+ const code = yield* execute(yield* stdio.args);
484
+ process.exitCode = code;
485
+ }).pipe(Effect.provide([layer, CliOutput.layer(formatter({
486
+ colors: colors(process.stdout, process.env),
487
+ columns: process.stdout.columns ?? 80
488
+ }))]), NodeRuntime.runMain({ disableErrorReporting: true }));
489
+ };
490
+ export { cli_exports as Cli, execute, layer, run };
491
+
492
+ //# sourceMappingURL=cli.js.map