alchemy 2.0.0-beta.84 → 2.0.0-beta.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_LICENSES.md +2 -2
- package/bin/cli.js +14 -6
- package/bin/register-oxc.js +16 -12
- package/lib/AdoptPolicy.d.ts +73 -0
- package/lib/AdoptPolicy.d.ts.map +1 -1
- package/lib/AdoptPolicy.js +54 -0
- package/lib/AdoptPolicy.js.map +1 -1
- package/lib/Alchemist/AuthRegistry.d.ts +31 -0
- package/lib/Alchemist/AuthRegistry.d.ts.map +1 -0
- package/lib/Alchemist/AuthRegistry.js +95 -0
- package/lib/Alchemist/AuthRegistry.js.map +1 -0
- package/lib/Alchemist/Drift.d.ts +70 -0
- package/lib/Alchemist/Drift.d.ts.map +1 -0
- package/lib/Alchemist/Drift.js +54 -0
- package/lib/Alchemist/Drift.js.map +1 -0
- package/lib/Alchemist/Entrypoint.d.ts +27 -3
- package/lib/Alchemist/Entrypoint.d.ts.map +1 -1
- package/lib/Alchemist/Entrypoint.js +34 -3
- package/lib/Alchemist/Entrypoint.js.map +1 -1
- package/lib/Alchemist/Errors.d.ts +1 -1
- package/lib/Alchemist/Errors.d.ts.map +1 -1
- package/lib/Alchemist/Errors.js +1 -1
- package/lib/Alchemist/Errors.js.map +1 -1
- package/lib/Alchemist/Logs.d.ts +46 -0
- package/lib/Alchemist/Logs.d.ts.map +1 -0
- package/lib/Alchemist/{routes/logs.js → Logs.js} +21 -26
- package/lib/Alchemist/Logs.js.map +1 -0
- package/lib/Alchemist/Nuke.d.ts +69 -0
- package/lib/Alchemist/Nuke.d.ts.map +1 -0
- package/lib/Alchemist/Nuke.js +35 -0
- package/lib/Alchemist/Nuke.js.map +1 -0
- package/lib/Alchemist/Operations.d.ts +168 -0
- package/lib/Alchemist/Operations.d.ts.map +1 -0
- package/lib/Alchemist/Operations.js +165 -0
- package/lib/Alchemist/Operations.js.map +1 -0
- package/lib/Alchemist/Profile.d.ts +132 -0
- package/lib/Alchemist/Profile.d.ts.map +1 -0
- package/lib/Alchemist/{routes/profile.js → Profile.js} +20 -21
- package/lib/Alchemist/Profile.js.map +1 -0
- package/lib/Alchemist/{routes/provider.d.ts → Provider.d.ts} +4 -4
- package/lib/Alchemist/Provider.d.ts.map +1 -0
- package/lib/Alchemist/{routes/provider.js → Provider.js} +7 -6
- package/lib/Alchemist/Provider.js.map +1 -0
- package/lib/Alchemist/Runtime.d.ts +10 -6
- package/lib/Alchemist/Runtime.d.ts.map +1 -1
- package/lib/Alchemist/Runtime.js +38 -2
- package/lib/Alchemist/Runtime.js.map +1 -1
- package/lib/Alchemist/{routes/state.d.ts → State.d.ts} +36 -16
- package/lib/Alchemist/State.d.ts.map +1 -0
- package/lib/Alchemist/{routes/state.js → State.js} +50 -15
- package/lib/Alchemist/State.js.map +1 -0
- package/lib/Alchemist/index.d.ts +11 -10
- package/lib/Alchemist/index.d.ts.map +1 -1
- package/lib/Alchemist/index.js +10 -9
- package/lib/Alchemist/index.js.map +1 -1
- package/lib/Apply.d.ts +2 -8
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +364 -184
- package/lib/Apply.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts +24 -11
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +28 -12
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/BrowserOAuth.d.ts +6 -8
- package/lib/Auth/BrowserOAuth.d.ts.map +1 -1
- package/lib/Auth/BrowserOAuth.js +25 -41
- package/lib/Auth/BrowserOAuth.js.map +1 -1
- package/lib/Auth/Credentials.d.ts.map +1 -1
- package/lib/Auth/Credentials.js +2 -2
- package/lib/Auth/Credentials.js.map +1 -1
- package/lib/Auth/Demand.d.ts +4 -4
- package/lib/Auth/Demand.d.ts.map +1 -1
- package/lib/Auth/Demand.js +16 -10
- package/lib/Auth/Demand.js.map +1 -1
- package/lib/Auth/Env.d.ts +2 -1
- package/lib/Auth/Env.d.ts.map +1 -1
- package/lib/Auth/Env.js +4 -2
- package/lib/Auth/Env.js.map +1 -1
- package/lib/Auth/Inspect.d.ts +2 -2
- package/lib/Auth/Inspect.d.ts.map +1 -1
- package/lib/Auth/Inspect.js +3 -1
- package/lib/Auth/Inspect.js.map +1 -1
- package/lib/Auth/Lock.d.ts.map +1 -1
- package/lib/Auth/Lock.js +4 -8
- package/lib/Auth/Lock.js.map +1 -1
- package/lib/Auth/OAuthFlow.d.ts +3 -12
- package/lib/Auth/OAuthFlow.d.ts.map +1 -1
- package/lib/Auth/OAuthFlow.js +7 -17
- package/lib/Auth/OAuthFlow.js.map +1 -1
- package/lib/Auth/Paths.d.ts +2 -1
- package/lib/Auth/Paths.d.ts.map +1 -1
- package/lib/Auth/Paths.js +3 -2
- package/lib/Auth/Paths.js.map +1 -1
- package/lib/Auth/Profile.d.ts +10 -0
- package/lib/Auth/Profile.d.ts.map +1 -1
- package/lib/Auth/Profile.js +19 -2
- package/lib/Auth/Profile.js.map +1 -1
- package/lib/Auth/Registry.d.ts +20 -0
- package/lib/Auth/Registry.d.ts.map +1 -0
- package/lib/Auth/Registry.js +17 -0
- package/lib/Auth/Registry.js.map +1 -0
- package/lib/Auth/Resolve.d.ts +34 -2
- package/lib/Auth/Resolve.d.ts.map +1 -1
- package/lib/Auth/Resolve.js +51 -3
- package/lib/Auth/Resolve.js.map +1 -1
- package/lib/Auth/StoredAuthProvider.d.ts +1 -1
- package/lib/Auth/StoredAuthProvider.d.ts.map +1 -1
- package/lib/Auth/StoredAuthProvider.js +1 -2
- package/lib/Auth/StoredAuthProvider.js.map +1 -1
- package/lib/Binding.d.ts.map +1 -1
- package/lib/Binding.js +3 -1
- package/lib/Binding.js.map +1 -1
- package/lib/Bundle/Bundle.d.ts +5 -0
- package/lib/Bundle/Bundle.d.ts.map +1 -1
- package/lib/Bundle/Bundle.js +36 -6
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Bundle/NamespaceImportPlugin.d.ts +55 -0
- package/lib/Bundle/NamespaceImportPlugin.d.ts.map +1 -0
- package/lib/Bundle/NamespaceImportPlugin.js +226 -0
- package/lib/Bundle/NamespaceImportPlugin.js.map +1 -0
- package/lib/Bundle/index.d.ts +1 -0
- package/lib/Bundle/index.d.ts.map +1 -1
- package/lib/Bundle/index.js +1 -0
- package/lib/Bundle/index.js.map +1 -1
- package/lib/Cli/Format.d.ts.map +1 -1
- package/lib/Cli/Format.js +2 -1
- package/lib/Cli/Format.js.map +1 -1
- package/lib/Cli/GlobalLog.d.ts +72 -26
- package/lib/Cli/GlobalLog.d.ts.map +1 -1
- package/lib/Cli/GlobalLog.js +151 -59
- package/lib/Cli/GlobalLog.js.map +1 -1
- package/lib/Cli/LoggingCli.d.ts.map +1 -1
- package/lib/Cli/LoggingCli.js +24 -18
- package/lib/Cli/LoggingCli.js.map +1 -1
- package/lib/Cli/PlainCliFormatter.d.ts.map +1 -1
- package/lib/Cli/PlainCliFormatter.js +4 -1
- package/lib/Cli/PlainCliFormatter.js.map +1 -1
- package/lib/Cli/Present.d.ts +14 -0
- package/lib/Cli/Present.d.ts.map +1 -0
- package/lib/Cli/Present.js +22 -0
- package/lib/Cli/Present.js.map +1 -0
- package/lib/Cli/SigilRenderer.d.ts +58 -0
- package/lib/Cli/SigilRenderer.d.ts.map +1 -0
- package/lib/Cli/SigilRenderer.js +39 -0
- package/lib/Cli/SigilRenderer.js.map +1 -0
- package/lib/Cli/checkVersion.d.ts +11 -14
- package/lib/Cli/checkVersion.d.ts.map +1 -1
- package/lib/Cli/checkVersion.js +19 -77
- package/lib/Cli/checkVersion.js.map +1 -1
- package/lib/Cli/commands/confirm.d.ts +2 -2
- package/lib/Cli/commands/confirm.d.ts.map +1 -1
- package/lib/Cli/commands/confirm.js +3 -3
- package/lib/Cli/commands/confirm.js.map +1 -1
- package/lib/Cli/commands/deploy.d.ts +4 -4
- package/lib/Cli/commands/deploy.d.ts.map +1 -1
- package/lib/Cli/commands/deploy.js +40 -39
- package/lib/Cli/commands/deploy.js.map +1 -1
- package/lib/Cli/commands/dev.d.ts.map +1 -1
- package/lib/Cli/commands/dev.js +41 -3
- package/lib/Cli/commands/dev.js.map +1 -1
- package/lib/Cli/commands/drift.d.ts +2 -2
- package/lib/Cli/commands/drift.d.ts.map +1 -1
- package/lib/Cli/commands/drift.js +14 -13
- package/lib/Cli/commands/drift.js.map +1 -1
- package/lib/Cli/commands/errors.d.ts.map +1 -1
- package/lib/Cli/commands/errors.js +2 -1
- package/lib/Cli/commands/errors.js.map +1 -1
- package/lib/Cli/commands/instrument.d.ts +15 -5
- package/lib/Cli/commands/instrument.d.ts.map +1 -1
- package/lib/Cli/commands/instrument.js +33 -8
- package/lib/Cli/commands/instrument.js.map +1 -1
- package/lib/Cli/commands/logs.d.ts +1 -1
- package/lib/Cli/commands/logs.d.ts.map +1 -1
- package/lib/Cli/commands/logs.js +22 -22
- package/lib/Cli/commands/logs.js.map +1 -1
- package/lib/Cli/commands/nuke.d.ts +3 -2
- package/lib/Cli/commands/nuke.d.ts.map +1 -1
- package/lib/Cli/commands/nuke.js +19 -17
- package/lib/Cli/commands/nuke.js.map +1 -1
- package/lib/Cli/commands/profile/commands.d.ts +3 -2
- package/lib/Cli/commands/profile/commands.d.ts.map +1 -1
- package/lib/Cli/commands/profile/commands.js +26 -27
- package/lib/Cli/commands/profile/commands.js.map +1 -1
- package/lib/Cli/commands/profile/flows.d.ts +6 -5
- package/lib/Cli/commands/profile/flows.d.ts.map +1 -1
- package/lib/Cli/commands/profile/flows.js +19 -17
- package/lib/Cli/commands/profile/flows.js.map +1 -1
- package/lib/Cli/commands/profile/hub.d.ts +1 -2
- package/lib/Cli/commands/profile/hub.d.ts.map +1 -1
- package/lib/Cli/commands/profile/hub.js +15 -17
- package/lib/Cli/commands/profile/hub.js.map +1 -1
- package/lib/Cli/commands/provider.d.ts +3 -1
- package/lib/Cli/commands/provider.d.ts.map +1 -1
- package/lib/Cli/commands/provider.js +4 -4
- package/lib/Cli/commands/provider.js.map +1 -1
- package/lib/Cli/commands/render.d.ts +2 -4
- package/lib/Cli/commands/render.d.ts.map +1 -1
- package/lib/Cli/commands/render.js +33 -56
- package/lib/Cli/commands/render.js.map +1 -1
- package/lib/Cli/commands/state.d.ts +1 -2
- package/lib/Cli/commands/state.d.ts.map +1 -1
- package/lib/Cli/commands/state.js +74 -27
- package/lib/Cli/commands/state.js.map +1 -1
- package/lib/Cli/components/capabilities.d.ts +4 -0
- package/lib/Cli/components/capabilities.d.ts.map +1 -0
- package/lib/Cli/components/capabilities.js +18 -0
- package/lib/Cli/components/capabilities.js.map +1 -0
- package/lib/Cli/components/types.d.ts +2 -81
- package/lib/Cli/components/types.d.ts.map +1 -1
- package/lib/Cli/components/types.js +1 -3
- package/lib/Cli/components/types.js.map +1 -1
- package/lib/Cli/components/ui/Environment.d.ts +3 -3
- package/lib/Cli/components/ui/Environment.d.ts.map +1 -1
- package/lib/Cli/components/ui/Environment.js.map +1 -1
- package/lib/Cli/components/ui/Interactive.d.ts +17 -4
- package/lib/Cli/components/ui/Interactive.d.ts.map +1 -1
- package/lib/Cli/components/ui/Interactive.js +7 -11
- package/lib/Cli/components/ui/Interactive.js.map +1 -1
- package/lib/Cli/components/ui/Layout.d.ts +1 -1
- package/lib/Cli/components/ui/Layout.d.ts.map +1 -1
- package/lib/Cli/components/ui/Layout.js +1 -1
- package/lib/Cli/components/ui/Layout.js.map +1 -1
- package/lib/Cli/components/ui/Typography.d.ts +1 -1
- package/lib/Cli/components/ui/Typography.d.ts.map +1 -1
- package/lib/Cli/components/ui/Typography.js +1 -1
- package/lib/Cli/components/ui/Typography.js.map +1 -1
- package/lib/Cli/components/ui/index.d.ts +2 -2
- package/lib/Cli/components/ui/index.js +2 -2
- package/lib/Cli/components/view/ApprovePlan.d.ts +1 -1
- package/lib/Cli/components/view/ApprovePlan.d.ts.map +1 -1
- package/lib/Cli/components/view/ApprovePlan.js +2 -1
- package/lib/Cli/components/view/ApprovePlan.js.map +1 -1
- package/lib/Cli/components/view/Format.d.ts +5 -0
- package/lib/Cli/components/view/Format.d.ts.map +1 -0
- package/lib/Cli/components/view/Format.js +39 -0
- package/lib/Cli/components/view/Format.js.map +1 -0
- package/lib/Cli/components/view/Help.d.ts +2 -2
- package/lib/Cli/components/view/Help.d.ts.map +1 -1
- package/lib/Cli/components/view/Help.js +7 -5
- package/lib/Cli/components/view/Help.js.map +1 -1
- package/lib/Cli/components/view/Logo.js +1 -1
- package/lib/Cli/components/view/Logo.js.map +1 -1
- package/lib/Cli/components/view/Nuke.d.ts +8 -9
- package/lib/Cli/components/view/Nuke.d.ts.map +1 -1
- package/lib/Cli/components/view/Nuke.js +49 -52
- package/lib/Cli/components/view/Nuke.js.map +1 -1
- package/lib/Cli/components/view/PlanDecision.d.ts +1 -1
- package/lib/Cli/components/view/PlanDecision.d.ts.map +1 -1
- package/lib/Cli/components/view/PlanDecision.js +1 -1
- package/lib/Cli/components/view/PlanDecision.js.map +1 -1
- package/lib/Cli/components/view/PlanRow.js +1 -1
- package/lib/Cli/components/view/PlanRow.js.map +1 -1
- package/lib/Cli/components/view/PlanTree.d.ts +1 -1
- package/lib/Cli/components/view/PlanTree.d.ts.map +1 -1
- package/lib/Cli/components/view/PlanTree.js +1 -1
- package/lib/Cli/components/view/PlanView.js +1 -1
- package/lib/Cli/components/view/PlanView.js.map +1 -1
- package/lib/Cli/components/view/Profile.d.ts +1 -1
- package/lib/Cli/components/view/Profile.js +2 -2
- package/lib/Cli/components/view/Profile.js.map +1 -1
- package/lib/Cli/components/view/ProfileDashboard.d.ts +4 -4
- package/lib/Cli/components/view/ProfileDashboard.d.ts.map +1 -1
- package/lib/Cli/components/view/ProfileDashboard.js +9 -8
- package/lib/Cli/components/view/ProfileDashboard.js.map +1 -1
- package/lib/Cli/components/view/Prompts.d.ts +3 -3
- package/lib/Cli/components/view/Prompts.d.ts.map +1 -1
- package/lib/Cli/components/view/Prompts.js +11 -18
- package/lib/Cli/components/view/Prompts.js.map +1 -1
- package/lib/Cli/components/view/Runtime.d.ts +5 -5
- package/lib/Cli/components/view/Runtime.d.ts.map +1 -1
- package/lib/Cli/components/view/Runtime.js +136 -219
- package/lib/Cli/components/view/Runtime.js.map +1 -1
- package/lib/Cli/components/view/SigilCli.d.ts +2 -2
- package/lib/Cli/components/view/SigilCli.d.ts.map +1 -1
- package/lib/Cli/components/view/SigilCli.js +7 -7
- package/lib/Cli/components/view/SigilCli.js.map +1 -1
- package/lib/Cli/components/view/StateExplorer.d.ts +1 -1
- package/lib/Cli/components/view/StateExplorer.d.ts.map +1 -1
- package/lib/Cli/components/view/StateExplorer.js +2 -1
- package/lib/Cli/components/view/StateExplorer.js.map +1 -1
- package/lib/Cli/components/view/statusStyle.d.ts +2 -2
- package/lib/Cli/components/view/statusStyle.d.ts.map +1 -1
- package/lib/Cli/components/view/statusStyle.js +1 -1
- package/lib/Cli/components/view/statusStyle.js.map +1 -1
- package/lib/Cli/exec.d.ts +6 -1
- package/lib/Cli/exec.d.ts.map +1 -1
- package/lib/Cli/exec.js +29 -34
- package/lib/Cli/exec.js.map +1 -1
- package/lib/Cli/main.d.ts.map +1 -1
- package/lib/Cli/main.js +35 -26
- package/lib/Cli/main.js.map +1 -1
- package/lib/Cli/selectCli.d.ts +2 -2
- package/lib/Cli/selectCli.d.ts.map +1 -1
- package/lib/Cli/selectCli.js +2 -2
- package/lib/Cli/selectCli.js.map +1 -1
- package/lib/Command/Command.js +1 -1
- package/lib/Command/Command.js.map +1 -1
- package/lib/Command/Dev.d.ts +58 -4
- package/lib/Command/Dev.d.ts.map +1 -1
- package/lib/Command/Dev.js +87 -30
- package/lib/Command/Dev.js.map +1 -1
- package/lib/Command/Local.d.ts +1 -1
- package/lib/Command/Memo.js +1 -1
- package/lib/Command/Memo.js.map +1 -1
- package/lib/Command/Providers.d.ts +1 -1
- package/lib/Command/Providers.d.ts.map +1 -1
- package/lib/Contributions.d.ts +2 -3
- package/lib/Contributions.d.ts.map +1 -1
- package/lib/Contributions.js +38 -6
- package/lib/Contributions.js.map +1 -1
- package/lib/DNS/Adapter.d.ts +204 -0
- package/lib/DNS/Adapter.d.ts.map +1 -0
- package/lib/DNS/Adapter.js +112 -0
- package/lib/DNS/Adapter.js.map +1 -0
- package/lib/DNS/index.d.ts +2 -0
- package/lib/DNS/index.d.ts.map +1 -0
- package/lib/DNS/index.js +2 -0
- package/lib/DNS/index.js.map +1 -0
- package/lib/Deploy.d.ts +7 -2
- package/lib/Deploy.d.ts.map +1 -1
- package/lib/Deploy.js +8 -3
- package/lib/Deploy.js.map +1 -1
- package/lib/Destroy.d.ts +5 -8
- package/lib/Destroy.d.ts.map +1 -1
- package/lib/Destroy.js +10 -7
- package/lib/Destroy.js.map +1 -1
- package/lib/Diff.d.ts.map +1 -1
- package/lib/Diff.js +14 -4
- package/lib/Diff.js.map +1 -1
- package/lib/Drift.d.ts +7 -7
- package/lib/Drift.d.ts.map +1 -1
- package/lib/Drift.js +184 -101
- package/lib/Drift.js.map +1 -1
- package/lib/EvalStack.d.ts +23 -0
- package/lib/EvalStack.d.ts.map +1 -0
- package/lib/EvalStack.js +47 -0
- package/lib/EvalStack.js.map +1 -0
- package/lib/Events.d.ts +210 -0
- package/lib/Events.d.ts.map +1 -0
- package/lib/Events.js +244 -0
- package/lib/Events.js.map +1 -0
- package/lib/Interaction.d.ts +159 -48
- package/lib/Interaction.d.ts.map +1 -1
- package/lib/Interaction.js +139 -58
- package/lib/Interaction.js.map +1 -1
- package/lib/Local/LocalProvider.d.ts.map +1 -1
- package/lib/Local/LocalProvider.js +31 -9
- package/lib/Local/LocalProvider.js.map +1 -1
- package/lib/Local/RpcProvider.d.ts.map +1 -1
- package/lib/Local/RpcProvider.js +10 -1
- package/lib/Local/RpcProvider.js.map +1 -1
- package/lib/Local/RpcProviderProxy.d.ts +16 -0
- package/lib/Local/RpcProviderProxy.d.ts.map +1 -1
- package/lib/Local/RpcProviderProxy.js +19 -10
- package/lib/Local/RpcProviderProxy.js.map +1 -1
- package/lib/Local/RpcSerialization.d.ts +3 -2
- package/lib/Local/RpcSerialization.d.ts.map +1 -1
- package/lib/Local/RpcSerialization.js +13 -10
- package/lib/Local/RpcSerialization.js.map +1 -1
- package/lib/Local/RpcServer.d.ts +2 -1
- package/lib/Local/RpcServer.d.ts.map +1 -1
- package/lib/Local/RpcServer.js +19 -14
- package/lib/Local/RpcServer.js.map +1 -1
- package/lib/Local/RpcServerBun.d.ts.map +1 -1
- package/lib/Local/RpcServerBun.js +8 -4
- package/lib/Local/RpcServerBun.js.map +1 -1
- package/lib/Local/RpcServerEnvironment.d.ts +2 -3
- package/lib/Local/RpcServerEnvironment.d.ts.map +1 -1
- package/lib/Local/RpcServerEnvironment.js +2 -2
- package/lib/Local/RpcServerEnvironment.js.map +1 -1
- package/lib/Local/RpcServerNode.d.ts.map +1 -1
- package/lib/Local/RpcServerNode.js +5 -1
- package/lib/Local/RpcServerNode.js.map +1 -1
- package/lib/Local/RpcServerSession.d.ts +1 -1
- package/lib/Local/RpcServerSession.d.ts.map +1 -1
- package/lib/Local/RpcServerSession.js.map +1 -1
- package/lib/Local/RpcSpawner.d.ts +6 -8
- package/lib/Local/RpcSpawner.d.ts.map +1 -1
- package/lib/Local/RpcSpawner.js +45 -36
- package/lib/Local/RpcSpawner.js.map +1 -1
- package/lib/Local/Sidecar.d.ts +23 -0
- package/lib/Local/Sidecar.d.ts.map +1 -1
- package/lib/Local/Sidecar.js +14 -9
- package/lib/Local/Sidecar.js.map +1 -1
- package/lib/Nuke.d.ts +5 -23
- package/lib/Nuke.d.ts.map +1 -1
- package/lib/Nuke.js +48 -13
- package/lib/Nuke.js.map +1 -1
- package/lib/Output.d.ts +19 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +96 -3
- package/lib/Output.js.map +1 -1
- package/lib/Plan.d.ts +5 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +111 -33
- package/lib/Plan.js.map +1 -1
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +31 -7
- package/lib/Platform.js.map +1 -1
- package/lib/Provider.d.ts +45 -0
- package/lib/Provider.d.ts.map +1 -1
- package/lib/Provider.js +2 -2
- package/lib/Provider.js.map +1 -1
- package/lib/Report.d.ts +17 -195
- package/lib/Report.d.ts.map +1 -1
- package/lib/Report.js +39 -12
- package/lib/Report.js.map +1 -1
- package/lib/Runtime/ManagedHttpShutdown.d.ts +17 -0
- package/lib/Runtime/ManagedHttpShutdown.d.ts.map +1 -1
- package/lib/Runtime/ManagedHttpShutdown.js +11 -2
- package/lib/Runtime/ManagedHttpShutdown.js.map +1 -1
- package/lib/RuntimeContext.js +1 -1
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Stack.d.ts +49 -29
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js +25 -31
- package/lib/Stack.js.map +1 -1
- package/lib/State/BucketState.d.ts.map +1 -1
- package/lib/State/BucketState.js +43 -14
- package/lib/State/BucketState.js.map +1 -1
- package/lib/State/LocalState.d.ts.map +1 -1
- package/lib/State/LocalState.js +3 -3
- package/lib/State/LocalState.js.map +1 -1
- package/lib/State/Provisioning.d.ts +5 -0
- package/lib/State/Provisioning.d.ts.map +1 -1
- package/lib/State/Provisioning.js +3 -1
- package/lib/State/Provisioning.js.map +1 -1
- package/lib/State/ResourceState.d.ts +2 -0
- package/lib/State/ResourceState.d.ts.map +1 -1
- package/lib/State/State.d.ts +26 -0
- package/lib/State/State.d.ts.map +1 -1
- package/lib/State/StateEncoding.d.ts +7 -0
- package/lib/State/StateEncoding.d.ts.map +1 -1
- package/lib/State/StateEncoding.js +19 -0
- package/lib/State/StateEncoding.js.map +1 -1
- package/lib/State/index.js +2 -2
- package/lib/State/index.js.map +1 -1
- package/lib/Telemetry/Layer.d.ts +2 -5
- package/lib/Telemetry/Layer.d.ts.map +1 -1
- package/lib/Telemetry/Layer.js +3 -23
- package/lib/Telemetry/Layer.js.map +1 -1
- package/lib/Telemetry/Metrics.d.ts +1 -1
- package/lib/Telemetry/Metrics.d.ts.map +1 -1
- package/lib/TelemetryRelay.js +1 -1
- package/lib/TelemetryRelay.js.map +1 -1
- package/lib/TelemetryRuntime.d.ts +1 -1
- package/lib/TelemetryRuntime.d.ts.map +1 -1
- package/lib/TelemetryRuntime.js +4 -3
- package/lib/TelemetryRuntime.js.map +1 -1
- package/lib/Util/ConsoleSink.d.ts +23 -2
- package/lib/Util/ConsoleSink.d.ts.map +1 -1
- package/lib/Util/ConsoleSink.js +54 -14
- package/lib/Util/ConsoleSink.js.map +1 -1
- package/lib/Util/LogAnnotation.d.ts +19 -0
- package/lib/Util/LogAnnotation.d.ts.map +1 -0
- package/lib/Util/LogAnnotation.js +19 -0
- package/lib/Util/LogAnnotation.js.map +1 -0
- package/lib/Util/LogRecord.d.ts +281 -0
- package/lib/Util/LogRecord.d.ts.map +1 -0
- package/lib/Util/LogRecord.js +267 -0
- package/lib/Util/LogRecord.js.map +1 -0
- package/lib/Util/Node.d.ts +9 -0
- package/lib/Util/Node.d.ts.map +1 -1
- package/lib/Util/Node.js +10 -6
- package/lib/Util/Node.js.map +1 -1
- package/lib/Util/PlatformServices.d.ts +3 -2
- package/lib/Util/PlatformServices.d.ts.map +1 -1
- package/lib/Util/PlatformServices.js +6 -2
- package/lib/Util/PlatformServices.js.map +1 -1
- package/lib/Util/ResourceOutput.d.ts +18 -10
- package/lib/Util/ResourceOutput.d.ts.map +1 -1
- package/lib/Util/ResourceOutput.js +22 -23
- package/lib/Util/ResourceOutput.js.map +1 -1
- package/lib/Util/Shutdown.d.ts +10 -0
- package/lib/Util/Shutdown.d.ts.map +1 -0
- package/lib/Util/Shutdown.js +32 -0
- package/lib/Util/Shutdown.js.map +1 -0
- package/lib/Util/Terminal.d.ts +2 -4
- package/lib/Util/Terminal.d.ts.map +1 -1
- package/lib/Util/Terminal.js +3 -11
- package/lib/Util/Terminal.js.map +1 -1
- package/lib/Util/TraceParent.d.ts +32 -0
- package/lib/Util/TraceParent.d.ts.map +1 -0
- package/lib/Util/TraceParent.js +42 -0
- package/lib/Util/TraceParent.js.map +1 -0
- package/lib/Util/base64.d.ts +7 -0
- package/lib/Util/base64.d.ts.map +1 -0
- package/lib/Util/base64.js +24 -0
- package/lib/Util/base64.js.map +1 -0
- package/lib/Util/cached-function.d.ts +5 -0
- package/lib/Util/cached-function.d.ts.map +1 -1
- package/lib/Util/cached-function.js +13 -8
- package/lib/Util/cached-function.js.map +1 -1
- package/lib/Util/data.d.ts +1 -1
- package/lib/Util/data.d.ts.map +1 -1
- package/lib/Util/data.js +1 -1
- package/lib/Util/data.js.map +1 -1
- package/lib/Util/equal.d.ts.map +1 -1
- package/lib/Util/equal.js +3 -2
- package/lib/Util/equal.js.map +1 -1
- package/lib/Util/extraFiles.d.ts.map +1 -1
- package/lib/Util/extraFiles.js +5 -5
- package/lib/Util/extraFiles.js.map +1 -1
- package/lib/Util/interactive.js +1 -1
- package/lib/Website/AstroOutput.d.ts +42 -0
- package/lib/Website/AstroOutput.d.ts.map +1 -0
- package/lib/Website/AstroOutput.js +34 -0
- package/lib/Website/AstroOutput.js.map +1 -0
- package/lib/Website/FrontendCore.d.ts +1 -1
- package/lib/Workflows.d.ts +9 -0
- package/lib/Workflows.d.ts.map +1 -1
- package/lib/Workflows.js +8 -0
- package/lib/Workflows.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +21 -28
- package/src/AdoptPolicy.ts +76 -0
- package/src/Alchemist/AuthRegistry.ts +164 -0
- package/src/Alchemist/Drift.ts +103 -0
- package/src/Alchemist/Entrypoint.ts +51 -3
- package/src/Alchemist/Errors.ts +1 -1
- package/src/Alchemist/{routes/logs.ts → Logs.ts} +28 -30
- package/src/Alchemist/Nuke.ts +90 -0
- package/src/Alchemist/Operations.ts +309 -0
- package/src/Alchemist/{routes/profile.ts → Profile.ts} +22 -22
- package/src/Alchemist/{routes/provider.ts → Provider.ts} +7 -6
- package/src/Alchemist/Runtime.ts +46 -12
- package/src/Alchemist/{routes/state.ts → State.ts} +78 -21
- package/src/Alchemist/index.ts +32 -15
- package/src/Apply.ts +513 -274
- package/src/Auth/AuthProvider.ts +76 -23
- package/src/Auth/BrowserOAuth.ts +37 -60
- package/src/Auth/Credentials.ts +2 -4
- package/src/Auth/Demand.ts +27 -18
- package/src/Auth/Env.ts +13 -8
- package/src/Auth/Inspect.ts +5 -2
- package/src/Auth/Lock.ts +4 -8
- package/src/Auth/OAuthFlow.ts +12 -26
- package/src/Auth/Paths.ts +3 -2
- package/src/Auth/Profile.ts +30 -2
- package/src/Auth/Registry.ts +27 -0
- package/src/Auth/Resolve.ts +75 -3
- package/src/Auth/StoredAuthProvider.ts +1 -2
- package/src/Binding.ts +3 -4
- package/src/Bundle/Bundle.ts +58 -7
- package/src/Bundle/NamespaceImportPlugin.ts +259 -0
- package/src/Bundle/index.ts +1 -0
- package/src/Cli/Format.ts +2 -1
- package/src/Cli/GlobalLog.ts +206 -68
- package/src/Cli/LoggingCli.ts +33 -20
- package/src/Cli/PlainCliFormatter.ts +4 -1
- package/src/Cli/Present.ts +34 -0
- package/src/Cli/SigilRenderer.ts +75 -0
- package/src/Cli/checkVersion.ts +25 -78
- package/src/Cli/commands/confirm.ts +3 -3
- package/src/Cli/commands/deploy.ts +53 -44
- package/src/Cli/commands/dev.ts +65 -7
- package/src/Cli/commands/drift.ts +20 -16
- package/src/Cli/commands/errors.ts +2 -3
- package/src/Cli/commands/instrument.ts +39 -8
- package/src/Cli/commands/logs.ts +22 -30
- package/src/Cli/commands/nuke.ts +25 -26
- package/src/Cli/commands/profile/commands.ts +34 -34
- package/src/Cli/commands/profile/flows.ts +26 -20
- package/src/Cli/commands/profile/hub.ts +16 -18
- package/src/Cli/commands/provider.ts +4 -4
- package/src/Cli/commands/render.ts +43 -71
- package/src/Cli/commands/state.ts +113 -33
- package/src/Cli/components/capabilities.ts +20 -0
- package/src/Cli/components/types.ts +13 -99
- package/src/Cli/components/ui/Environment.tsx +5 -5
- package/src/Cli/components/ui/Interactive.tsx +24 -15
- package/src/Cli/components/ui/Layout.tsx +1 -1
- package/src/Cli/components/ui/Typography.tsx +1 -1
- package/src/Cli/components/ui/index.ts +2 -2
- package/src/Cli/components/view/ApprovePlan.tsx +2 -1
- package/src/Cli/components/view/Format.tsx +58 -0
- package/src/Cli/components/view/Help.tsx +14 -17
- package/src/Cli/components/view/Logo.tsx +1 -1
- package/src/Cli/components/view/Nuke.tsx +74 -49
- package/src/Cli/components/view/PlanDecision.tsx +1 -1
- package/src/Cli/components/view/PlanRow.tsx +1 -1
- package/src/Cli/components/view/PlanTree.ts +2 -2
- package/src/Cli/components/view/PlanView.tsx +2 -2
- package/src/Cli/components/view/Profile.tsx +2 -2
- package/src/Cli/components/view/ProfileDashboard.tsx +12 -11
- package/src/Cli/components/view/Prompts.tsx +37 -75
- package/src/Cli/components/view/Runtime.tsx +132 -238
- package/src/Cli/components/view/SigilCli.tsx +12 -12
- package/src/Cli/components/view/StateExplorer.tsx +2 -1
- package/src/Cli/components/view/statusStyle.ts +2 -2
- package/src/Cli/exec.ts +48 -41
- package/src/Cli/main.ts +52 -33
- package/src/Cli/selectCli.ts +3 -3
- package/src/Command/Command.ts +1 -1
- package/src/Command/Dev.ts +129 -36
- package/src/Command/Memo.ts +1 -1
- package/src/Contributions.ts +42 -8
- package/src/DNS/Adapter.ts +289 -0
- package/src/DNS/index.ts +1 -0
- package/src/Deploy.ts +11 -3
- package/src/Destroy.ts +19 -13
- package/src/Diff.ts +17 -4
- package/src/Drift.ts +256 -127
- package/src/EvalStack.ts +97 -0
- package/src/Events.ts +296 -0
- package/src/Interaction.ts +332 -97
- package/src/Local/LocalProvider.ts +40 -9
- package/src/Local/RpcProvider.ts +11 -1
- package/src/Local/RpcProviderProxy.ts +29 -21
- package/src/Local/RpcSerialization.ts +32 -17
- package/src/Local/RpcServer.ts +25 -17
- package/src/Local/RpcServerBun.ts +10 -6
- package/src/Local/RpcServerEnvironment.ts +2 -2
- package/src/Local/RpcServerNode.ts +8 -1
- package/src/Local/RpcServerSession.ts +2 -2
- package/src/Local/RpcSpawner.ts +61 -37
- package/src/Local/Sidecar.ts +10 -1
- package/src/Nuke.ts +66 -43
- package/src/Output.ts +120 -7
- package/src/Plan.ts +140 -52
- package/src/Platform.ts +47 -18
- package/src/Provider.ts +48 -3
- package/src/Report.ts +77 -275
- package/src/Runtime/ManagedHttpShutdown.ts +21 -4
- package/src/RuntimeContext.ts +1 -1
- package/src/Stack.ts +113 -135
- package/src/State/BucketState.ts +53 -21
- package/src/State/LocalState.ts +7 -9
- package/src/State/Provisioning.ts +8 -1
- package/src/State/ResourceState.ts +2 -0
- package/src/State/State.ts +30 -0
- package/src/State/StateEncoding.ts +22 -0
- package/src/State/index.ts +2 -2
- package/src/Telemetry/Layer.ts +3 -24
- package/src/Telemetry/Metrics.ts +1 -1
- package/src/TelemetryRelay.ts +1 -1
- package/src/TelemetryRuntime.ts +8 -8
- package/src/Util/ConsoleSink.ts +76 -13
- package/src/Util/LogAnnotation.ts +18 -0
- package/src/Util/LogRecord.ts +386 -0
- package/src/Util/Node.ts +20 -6
- package/src/Util/PlatformServices.ts +17 -4
- package/src/Util/ResourceOutput.ts +26 -25
- package/src/Util/Shutdown.ts +52 -0
- package/src/Util/Terminal.ts +3 -20
- package/src/Util/TraceParent.ts +70 -0
- package/src/Util/base64.ts +22 -0
- package/src/Util/cached-function.ts +30 -19
- package/src/Util/data.ts +2 -2
- package/src/Util/equal.ts +3 -2
- package/src/Util/extraFiles.ts +9 -8
- package/src/Util/interactive.ts +1 -1
- package/src/Website/AstroOutput.ts +83 -0
- package/src/Workflows.ts +11 -0
- package/src/index.ts +1 -0
- package/lib/Alchemist/Progress.d.ts +0 -16
- package/lib/Alchemist/Progress.d.ts.map +0 -1
- package/lib/Alchemist/Progress.js +0 -123
- package/lib/Alchemist/Progress.js.map +0 -1
- package/lib/Alchemist/Session.d.ts +0 -116
- package/lib/Alchemist/Session.d.ts.map +0 -1
- package/lib/Alchemist/Session.js +0 -212
- package/lib/Alchemist/Session.js.map +0 -1
- package/lib/Alchemist/routes/drift.d.ts +0 -55
- package/lib/Alchemist/routes/drift.d.ts.map +0 -1
- package/lib/Alchemist/routes/drift.js +0 -52
- package/lib/Alchemist/routes/drift.js.map +0 -1
- package/lib/Alchemist/routes/logs.d.ts +0 -41
- package/lib/Alchemist/routes/logs.d.ts.map +0 -1
- package/lib/Alchemist/routes/logs.js.map +0 -1
- package/lib/Alchemist/routes/nuke.d.ts +0 -46
- package/lib/Alchemist/routes/nuke.d.ts.map +0 -1
- package/lib/Alchemist/routes/nuke.js +0 -80
- package/lib/Alchemist/routes/nuke.js.map +0 -1
- package/lib/Alchemist/routes/profile.d.ts +0 -133
- package/lib/Alchemist/routes/profile.d.ts.map +0 -1
- package/lib/Alchemist/routes/profile.js.map +0 -1
- package/lib/Alchemist/routes/provider.d.ts.map +0 -1
- package/lib/Alchemist/routes/provider.js.map +0 -1
- package/lib/Alchemist/routes/stack.d.ts +0 -95
- package/lib/Alchemist/routes/stack.d.ts.map +0 -1
- package/lib/Alchemist/routes/stack.js +0 -73
- package/lib/Alchemist/routes/stack.js.map +0 -1
- package/lib/Alchemist/routes/state.d.ts.map +0 -1
- package/lib/Alchemist/routes/state.js.map +0 -1
- package/lib/Cli/CliKit/CliKit.d.ts +0 -92
- package/lib/Cli/CliKit/CliKit.d.ts.map +0 -1
- package/lib/Cli/CliKit/CliKit.js +0 -27
- package/lib/Cli/CliKit/CliKit.js.map +0 -1
- package/lib/Cli/CliKit/index.d.ts +0 -9
- package/lib/Cli/CliKit/index.d.ts.map +0 -1
- package/lib/Cli/CliKit/index.js +0 -9
- package/lib/Cli/CliKit/index.js.map +0 -1
- package/lib/Cli/CliKit/interaction.d.ts +0 -13
- package/lib/Cli/CliKit/interaction.d.ts.map +0 -1
- package/lib/Cli/CliKit/interaction.js +0 -17
- package/lib/Cli/CliKit/interaction.js.map +0 -1
- package/lib/Cli/CliKit/layer.d.ts +0 -7
- package/lib/Cli/CliKit/layer.d.ts.map +0 -1
- package/lib/Cli/CliKit/layer.js +0 -33
- package/lib/Cli/CliKit/layer.js.map +0 -1
- package/lib/Local/DevLog.d.ts +0 -32
- package/lib/Local/DevLog.d.ts.map +0 -1
- package/lib/Local/DevLog.js +0 -112
- package/lib/Local/DevLog.js.map +0 -1
- package/lib/Test/Alchemy.d.ts +0 -79
- package/lib/Test/Alchemy.d.ts.map +0 -1
- package/lib/Test/Alchemy.js +0 -193
- package/lib/Test/Alchemy.js.map +0 -1
- package/lib/Test/Bun.d.ts +0 -69
- package/lib/Test/Bun.d.ts.map +0 -1
- package/lib/Test/Bun.js +0 -126
- package/lib/Test/Bun.js.map +0 -1
- package/lib/Test/Core.d.ts +0 -277
- package/lib/Test/Core.d.ts.map +0 -1
- package/lib/Test/Core.js +0 -362
- package/lib/Test/Core.js.map +0 -1
- package/lib/Test/Http.d.ts +0 -109
- package/lib/Test/Http.d.ts.map +0 -1
- package/lib/Test/Http.js +0 -123
- package/lib/Test/Http.js.map +0 -1
- package/lib/Test/TestState.d.ts +0 -12
- package/lib/Test/TestState.d.ts.map +0 -1
- package/lib/Test/TestState.js +0 -15
- package/lib/Test/TestState.js.map +0 -1
- package/lib/Test/Vitest.d.ts +0 -60
- package/lib/Test/Vitest.d.ts.map +0 -1
- package/lib/Test/Vitest.js +0 -132
- package/lib/Test/Vitest.js.map +0 -1
- package/lib/Test/index.d.ts +0 -3
- package/lib/Test/index.d.ts.map +0 -1
- package/lib/Test/index.js +0 -3
- package/lib/Test/index.js.map +0 -1
- package/lib/Util/FileLogger.d.ts +0 -7
- package/lib/Util/FileLogger.d.ts.map +0 -1
- package/lib/Util/FileLogger.js +0 -16
- package/lib/Util/FileLogger.js.map +0 -1
- package/src/Alchemist/Progress.ts +0 -167
- package/src/Alchemist/Session.ts +0 -415
- package/src/Alchemist/routes/drift.ts +0 -87
- package/src/Alchemist/routes/nuke.ts +0 -131
- package/src/Alchemist/routes/stack.ts +0 -173
- package/src/Cli/CliKit/CliKit.ts +0 -159
- package/src/Cli/CliKit/index.ts +0 -41
- package/src/Cli/CliKit/interaction.ts +0 -19
- package/src/Cli/CliKit/layer.ts +0 -44
- package/src/Local/DevLog.ts +0 -122
- package/src/Test/Alchemy.ts +0 -334
- package/src/Test/Bun.ts +0 -230
- package/src/Test/Core.ts +0 -785
- package/src/Test/Http.ts +0 -201
- package/src/Test/TestState.ts +0 -35
- package/src/Test/Vitest.ts +0 -239
- package/src/Test/index.ts +0 -2
- package/src/Util/FileLogger.ts +0 -20
package/src/Cli/checkVersion.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { AlchemyContext } from "alchemy/AlchemyContext";
|
|
2
2
|
import * as Clock from "effect/Clock";
|
|
3
|
-
import * as
|
|
3
|
+
import * as Data from "effect/Data";
|
|
4
4
|
import * as Duration from "effect/Duration";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Fiber from "effect/Fiber";
|
|
7
7
|
import * as FileSystem from "effect/FileSystem";
|
|
8
8
|
import * as HttpClient from "effect/http/HttpClient";
|
|
9
9
|
import * as Path from "effect/Path";
|
|
10
|
+
import * as Result from "effect/Result";
|
|
11
|
+
import * as SemVer from "effect/SemVer";
|
|
10
12
|
import packageJson from "../../package.json" with { type: "json" };
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from "./CliKit/index.ts";
|
|
13
|
+
|
|
14
|
+
export class CheckVersionUnexpectedResponse extends Data.TaggedError(
|
|
15
|
+
"CheckVersionUnexpectedResponse",
|
|
16
|
+
)<{
|
|
17
|
+
readonly message: string;
|
|
18
|
+
readonly cause?: unknown;
|
|
19
|
+
}> {}
|
|
19
20
|
|
|
20
21
|
const NPM_DIST_TAGS_URL = "https://registry.npmjs.org/-/package/alchemy/dist-tags";
|
|
21
22
|
|
|
@@ -31,61 +32,14 @@ interface VersionCheckCache {
|
|
|
31
32
|
distTags?: Record<string, string>;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
const parseVersion = (v: string) => {
|
|
35
|
-
const [core = "", pre] = v.split("-", 2);
|
|
36
|
-
return {
|
|
37
|
-
core: core.split(".").map(Number),
|
|
38
|
-
pre: pre === undefined ? [] : pre.split(".").map((id) => (/^\d+$/.test(id) ? Number(id) : id)),
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
35
|
/**
|
|
43
|
-
* Semver precedence
|
|
44
|
-
*
|
|
45
|
-
* prerelease identifiers, release > prerelease.
|
|
36
|
+
* Semver precedence: negative when a < b, positive when a > b. Versions that
|
|
37
|
+
* don't parse compare equal, so they never trigger an upgrade notice.
|
|
46
38
|
*/
|
|
47
39
|
const compareVersions = (a: string, b: string): number => {
|
|
48
|
-
const pa =
|
|
49
|
-
const pb =
|
|
50
|
-
|
|
51
|
-
const d = (pa.core[i] ?? 0) - (pb.core[i] ?? 0);
|
|
52
|
-
if (d !== 0) return d;
|
|
53
|
-
}
|
|
54
|
-
// A release outranks any prerelease of the same core.
|
|
55
|
-
if (pa.pre.length === 0 || pb.pre.length === 0) {
|
|
56
|
-
return pb.pre.length - pa.pre.length;
|
|
57
|
-
}
|
|
58
|
-
for (let i = 0; i < Math.max(pa.pre.length, pb.pre.length); i++) {
|
|
59
|
-
const x = pa.pre[i];
|
|
60
|
-
const y = pb.pre[i];
|
|
61
|
-
if (x === undefined) return -1;
|
|
62
|
-
if (y === undefined) return 1;
|
|
63
|
-
if (x === y) continue;
|
|
64
|
-
if (typeof x === "number" && typeof y === "number") return x - y;
|
|
65
|
-
// Numeric identifiers rank below alphanumeric ones.
|
|
66
|
-
if (typeof x === "number") return -1;
|
|
67
|
-
if (typeof y === "number") return 1;
|
|
68
|
-
return x < y ? -1 : 1;
|
|
69
|
-
}
|
|
70
|
-
return 0;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Pick the dist-tag matching the current channel. For pre-release versions
|
|
75
|
-
* like `2.0.0-beta.33`, we match the prerelease identifier (`beta`, `next`,
|
|
76
|
-
* etc.), falling back through `next` → `latest`. Because our releases can
|
|
77
|
-
* force prereleases onto `latest`, it may run ahead of the channel tag —
|
|
78
|
-
* in that case offer `latest` instead of the channel pick.
|
|
79
|
-
*/
|
|
80
|
-
const pickDistTag = (current: string, distTags: Record<string, string>): string | undefined => {
|
|
81
|
-
const pre = current.split("-", 2)[1];
|
|
82
|
-
if (!pre) return distTags.latest;
|
|
83
|
-
const id = pre.split(".")[0];
|
|
84
|
-
const channelPick = (id && distTags[id]) || distTags.next;
|
|
85
|
-
const { latest } = distTags;
|
|
86
|
-
if (channelPick === undefined) return latest;
|
|
87
|
-
if (latest === undefined) return channelPick;
|
|
88
|
-
return compareVersions(latest, channelPick) > 0 ? latest : channelPick;
|
|
40
|
+
const pa = Result.getOrUndefined(SemVer.parse(a));
|
|
41
|
+
const pb = Result.getOrUndefined(SemVer.parse(b));
|
|
42
|
+
return pa === undefined || pb === undefined ? 0 : SemVer.Order(pa, pb);
|
|
89
43
|
};
|
|
90
44
|
|
|
91
45
|
const readCache = Effect.fn(
|
|
@@ -113,7 +67,7 @@ const fetchDistTags = Effect.gen(function* () {
|
|
|
113
67
|
const response = yield* http.get(NPM_DIST_TAGS_URL);
|
|
114
68
|
const distTags = (yield* response.json) as Record<string, string> | null;
|
|
115
69
|
if (typeof distTags !== "object" || distTags === null) {
|
|
116
|
-
return yield*
|
|
70
|
+
return yield* new CheckVersionUnexpectedResponse({ message: "malformed dist-tags response" });
|
|
117
71
|
}
|
|
118
72
|
return distTags;
|
|
119
73
|
});
|
|
@@ -142,8 +96,7 @@ const refreshDistTags = Effect.fn(function* (cachePath: string) {
|
|
|
142
96
|
});
|
|
143
97
|
|
|
144
98
|
/**
|
|
145
|
-
* Warn if a newer `alchemy` version is published on the dist-tag
|
|
146
|
-
* the current channel. Runs to completion before any interactive prompts so
|
|
99
|
+
* Warn if a newer `alchemy` version is published on the `latest` dist-tag. Runs to completion before any interactive prompts so
|
|
147
100
|
* the warning never interleaves with prompt rendering, and is bounded so it
|
|
148
101
|
* can never stall the CLI: dist-tags are cached in
|
|
149
102
|
* `.alchemy/version-check.json` for a day (failed attempts included), so at
|
|
@@ -164,27 +117,21 @@ export const checkLatestVersion = Effect.gen(function* () {
|
|
|
164
117
|
if (distTags === undefined) return;
|
|
165
118
|
|
|
166
119
|
const current = packageJson.version;
|
|
167
|
-
const latest =
|
|
168
|
-
// Strictly newer only:
|
|
169
|
-
//
|
|
170
|
-
// prompt a "downgrade".
|
|
120
|
+
const { latest } = distTags;
|
|
121
|
+
// Strictly newer only: `latest` at (or behind) the installed version must
|
|
122
|
+
// not prompt a "downgrade".
|
|
171
123
|
if (latest === undefined || compareVersions(latest, current) <= 0) return;
|
|
172
124
|
|
|
173
125
|
const installCmd =
|
|
174
126
|
typeof process !== "undefined" && process.versions.bun !== undefined
|
|
175
127
|
? `bun add alchemy@${latest}`
|
|
176
128
|
: `pnpm add alchemy@${latest}`;
|
|
177
|
-
//
|
|
178
|
-
//
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const glyphs = glyphsFor(unicodeEnabled());
|
|
182
|
-
const message =
|
|
183
|
-
`alchemy ${latest} is available (you're on ${current}). ` + `Run \`${installCmd}\` to upgrade.`;
|
|
184
|
-
yield* Console.warn(
|
|
185
|
-
useColor ? `${ansiFg(theme.color.warning)}${glyphs.warning} ${message}${ANSI_RESET}` : message,
|
|
129
|
+
// A warning record: above the default console floor, and a JSON record
|
|
130
|
+
// under --log-format json (commands run this check, after the flags parse).
|
|
131
|
+
yield* Effect.logWarning(
|
|
132
|
+
`alchemy ${latest} is available (you're on ${current}). Run \`${installCmd}\` to upgrade.`,
|
|
186
133
|
);
|
|
187
134
|
}).pipe(Effect.ignore);
|
|
188
135
|
|
|
189
136
|
// Exported for tests.
|
|
190
|
-
export const _internal = {
|
|
137
|
+
export const _internal = { compareVersions };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Data from "effect/Data";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Runtime from "effect/Runtime";
|
|
4
|
-
import * as
|
|
4
|
+
import * as Interaction from "../../Interaction.ts";
|
|
5
5
|
import { exitDeclined } from "./errors.ts";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -31,14 +31,14 @@ export const confirmOrDecline = Effect.fn(function* (options: {
|
|
|
31
31
|
readonly abortMessage?: string;
|
|
32
32
|
}) {
|
|
33
33
|
if (options.yes) return;
|
|
34
|
-
const approved = yield*
|
|
34
|
+
const approved = yield* Interaction.confirm({
|
|
35
35
|
message: options.message,
|
|
36
36
|
initialValue: false,
|
|
37
37
|
confirmLabel: options.confirmLabel,
|
|
38
38
|
cancelLabel: options.cancelLabel,
|
|
39
39
|
});
|
|
40
40
|
if (approved) return;
|
|
41
|
-
yield*
|
|
41
|
+
yield* Interaction.info(options.abortMessage ?? "Aborted.");
|
|
42
42
|
yield* exitDeclined;
|
|
43
43
|
return yield* new ConfirmationDeclined();
|
|
44
44
|
});
|
|
@@ -2,10 +2,10 @@ import * as Command from "effect/cli/Command";
|
|
|
2
2
|
import * as Flag from "effect/cli/Flag";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Option from "effect/Option";
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
5
|
+
import * as Alchemist from "../../Alchemist/index.ts";
|
|
6
|
+
import * as Interaction from "../../Interaction.ts";
|
|
7
7
|
import { Cli } from "../../Report.ts";
|
|
8
|
-
import
|
|
8
|
+
import { renderApply } from "../../Report.ts";
|
|
9
9
|
import { planDecisionScreen } from "../components/view/PlanDecision.tsx";
|
|
10
10
|
import { stackOutputsView } from "../components/view/StackOutputs.tsx";
|
|
11
11
|
import { exitDeclined } from "./errors.ts";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
yes,
|
|
25
25
|
} from "./flags.ts";
|
|
26
26
|
import { instrumentCommand } from "./instrument.ts";
|
|
27
|
-
import {
|
|
27
|
+
import { renderPlanning } from "./render.ts";
|
|
28
28
|
|
|
29
29
|
interface StackCommandOptions {
|
|
30
30
|
readonly main: string;
|
|
@@ -72,41 +72,42 @@ const detectDrift = Flag.Boolean("detect-drift").pipe(
|
|
|
72
72
|
Flag.withDefault(false),
|
|
73
73
|
);
|
|
74
74
|
|
|
75
|
-
const detectAndMaybeRepairDrift = Effect.fn(function* (
|
|
76
|
-
|
|
75
|
+
const detectAndMaybeRepairDrift = Effect.fn(function* <E, R>(
|
|
76
|
+
scanDrift: Effect.Effect<Alchemist.Drift.DriftScan, E, R>,
|
|
77
77
|
options: {
|
|
78
|
+
readonly stage: string;
|
|
78
79
|
readonly yes?: boolean;
|
|
79
80
|
readonly detailed?: boolean;
|
|
80
81
|
readonly dryRun?: boolean;
|
|
81
82
|
},
|
|
82
83
|
) {
|
|
83
84
|
const cli = yield* Cli;
|
|
84
|
-
const snapshot = yield*
|
|
85
|
+
const snapshot = yield* scanDrift.pipe(
|
|
85
86
|
renderPlanning({
|
|
86
87
|
operation: "Drift",
|
|
87
|
-
stage:
|
|
88
|
+
stage: options.stage,
|
|
88
89
|
computingLabel: "Checking drift",
|
|
89
90
|
readyLabel: "Drift check complete",
|
|
90
91
|
}),
|
|
91
92
|
);
|
|
92
|
-
if (!Drift.hasDrift(snapshot)) return true;
|
|
93
|
+
if (!Alchemist.Drift.hasDrift(snapshot)) return true;
|
|
93
94
|
|
|
94
95
|
if (options.dryRun) {
|
|
95
|
-
yield* cli.displayPlan(snapshot.
|
|
96
|
+
yield* cli.displayPlan(snapshot.native, {
|
|
96
97
|
detailed: options.detailed,
|
|
97
|
-
stage:
|
|
98
|
+
stage: options.stage,
|
|
98
99
|
});
|
|
99
100
|
return true;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
let decision: "repair" | "deploy" | "cancel" = options.yes ? "repair" : "cancel";
|
|
103
104
|
if (!options.yes) {
|
|
104
|
-
const terminal = yield*
|
|
105
|
+
const terminal = yield* Interaction.Interaction;
|
|
105
106
|
if (terminal.terminal.input) {
|
|
106
107
|
decision = yield* terminal.prompt
|
|
107
|
-
.
|
|
108
|
+
.screen(
|
|
108
109
|
planDecisionScreen({
|
|
109
|
-
plan: snapshot.
|
|
110
|
+
plan: snapshot.native,
|
|
110
111
|
message: "Drift detected",
|
|
111
112
|
choices: [
|
|
112
113
|
{
|
|
@@ -127,21 +128,21 @@ const detectAndMaybeRepairDrift = Effect.fn(function* (
|
|
|
127
128
|
)
|
|
128
129
|
.pipe(Effect.catchTag("TerminalCancelled", () => Effect.succeed("cancel" as const)));
|
|
129
130
|
} else {
|
|
130
|
-
yield* cli.displayPlan(snapshot.
|
|
131
|
+
yield* cli.displayPlan(snapshot.native, {
|
|
131
132
|
detailed: options.detailed,
|
|
132
|
-
stage:
|
|
133
|
+
stage: options.stage,
|
|
133
134
|
});
|
|
134
|
-
yield*
|
|
135
|
+
yield* Interaction.warning(
|
|
135
136
|
"Drift detected in a non-interactive terminal. Re-run with --yes to repair and deploy.",
|
|
136
137
|
);
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
if (decision === "repair") {
|
|
141
|
-
yield* Drift.
|
|
142
|
-
renderApply(snapshot.
|
|
142
|
+
yield* Alchemist.Drift.execute(snapshot).pipe(
|
|
143
|
+
renderApply(snapshot.native, {
|
|
143
144
|
detailed: options.detailed,
|
|
144
|
-
stage:
|
|
145
|
+
stage: options.stage,
|
|
145
146
|
}),
|
|
146
147
|
);
|
|
147
148
|
}
|
|
@@ -152,12 +153,14 @@ const runStack = Effect.fn(function* (options: StackCommandOptions) {
|
|
|
152
153
|
yield* validateSelectionOptions(options);
|
|
153
154
|
const cli = yield* Cli;
|
|
154
155
|
const display = { detailed: options.detailed, stage: options.stage };
|
|
155
|
-
const
|
|
156
|
-
entrypoint: options.main,
|
|
156
|
+
const buildOptions = {
|
|
157
157
|
stage: options.stage,
|
|
158
158
|
profile: options.profile,
|
|
159
159
|
envFile: Option.getOrUndefined(options.envFile),
|
|
160
|
+
adopt: options.adopt,
|
|
161
|
+
updateStateStore: options.yes,
|
|
160
162
|
};
|
|
163
|
+
const stack = Alchemist.importStack(options.main);
|
|
161
164
|
|
|
162
165
|
const operation = options.destroy ? "Destroy" : options.dryRun ? "Plan" : "Deploy";
|
|
163
166
|
const withPlanningProgress = renderPlanning({
|
|
@@ -166,48 +169,54 @@ const runStack = Effect.fn(function* (options: StackCommandOptions) {
|
|
|
166
169
|
});
|
|
167
170
|
|
|
168
171
|
if (options.detectDrift && !options.destroy) {
|
|
169
|
-
|
|
172
|
+
// The drift check closes its build before the deploy builds again: a
|
|
173
|
+
// remote state store holds one lease per stage per build.
|
|
174
|
+
const proceed = yield* detectAndMaybeRepairDrift(
|
|
175
|
+
Effect.flatMap(stack, (stack) => Alchemist.Drift.scan({ ...buildOptions, stack })),
|
|
176
|
+
options,
|
|
177
|
+
).pipe(Effect.scoped);
|
|
170
178
|
if (!proceed) {
|
|
171
|
-
yield*
|
|
179
|
+
yield* Interaction.info("Deploy aborted: drift was detected and not approved.");
|
|
172
180
|
return yield* exitDeclined;
|
|
173
181
|
}
|
|
174
182
|
}
|
|
175
183
|
|
|
176
|
-
const snapshot = yield*
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
const snapshot = yield* Effect.flatMap(stack, (stack) =>
|
|
185
|
+
Alchemist.plan(
|
|
186
|
+
options.destroy
|
|
187
|
+
? { ...buildOptions, stack, operation: "destroy" }
|
|
188
|
+
: {
|
|
189
|
+
...buildOptions,
|
|
190
|
+
stack,
|
|
191
|
+
operation: "deploy",
|
|
192
|
+
force: options.force,
|
|
193
|
+
include: options.include,
|
|
194
|
+
exclude: options.exclude,
|
|
195
|
+
},
|
|
196
|
+
),
|
|
197
|
+
).pipe(withPlanningProgress);
|
|
185
198
|
|
|
186
199
|
if (options.dryRun) {
|
|
187
200
|
return yield* cli.displayPlan(snapshot.native, display);
|
|
188
201
|
}
|
|
189
202
|
|
|
190
|
-
if (!options.yes &&
|
|
203
|
+
if (!options.yes && Alchemist.hasChanges(snapshot)) {
|
|
191
204
|
const approved = yield* cli.approvePlan(snapshot.native, display).pipe(
|
|
192
205
|
Effect.tap((approved) =>
|
|
193
|
-
approved
|
|
194
|
-
? Effect.void
|
|
195
|
-
: CliKit.accessors.output.info(`${operation} aborted: plan declined.`),
|
|
206
|
+
approved ? Effect.void : Interaction.info(`${operation} aborted: plan declined.`),
|
|
196
207
|
),
|
|
197
208
|
Effect.catchTag("NonInteractiveTerminal", () =>
|
|
198
|
-
|
|
199
|
-
.
|
|
200
|
-
|
|
201
|
-
)
|
|
202
|
-
.pipe(Effect.as(false)),
|
|
209
|
+
Interaction.warning(
|
|
210
|
+
`Cannot prompt for approval in a non-interactive terminal. Nothing was changed — re-run with --yes to ${operation.toLowerCase()}.`,
|
|
211
|
+
).pipe(Effect.as(false)),
|
|
203
212
|
),
|
|
204
213
|
);
|
|
205
214
|
if (!approved) return yield* exitDeclined;
|
|
206
215
|
}
|
|
207
216
|
|
|
208
|
-
const result = yield*
|
|
217
|
+
const result = yield* Alchemist.apply(snapshot).pipe(renderApply(snapshot.native, display));
|
|
209
218
|
if (result !== undefined) {
|
|
210
|
-
const kit = yield*
|
|
219
|
+
const kit = yield* Interaction.Interaction;
|
|
211
220
|
yield* kit.output.print(stackOutputsView(result));
|
|
212
221
|
}
|
|
213
222
|
});
|
package/src/Cli/commands/dev.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import * as Command from "effect/cli/Command";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Fiber from "effect/Fiber";
|
|
5
|
+
import * as Logger from "effect/Logger";
|
|
4
6
|
import * as Option from "effect/Option";
|
|
5
7
|
import * as ChildProcess from "effect/process/ChildProcess";
|
|
6
8
|
import * as Schema from "effect/Schema";
|
|
9
|
+
import * as Stream from "effect/Stream";
|
|
7
10
|
import { resolveStackEntrypoint } from "../../Alchemist/Entrypoint.ts";
|
|
8
11
|
import * as Contributions from "../../Contributions.ts";
|
|
9
12
|
import { SPAWNER_URL_ENV_KEY } from "../../Local/RpcProviderProxy.ts";
|
|
10
13
|
import * as RpcSpawner from "../../Local/RpcSpawner.ts";
|
|
14
|
+
import { LOG_FD_ENV, parseRecord, replayRecord } from "../../Util/LogRecord.ts";
|
|
11
15
|
import { nodeLoaderArgs } from "../../Util/Node.ts";
|
|
16
|
+
import { timedShutdownStep } from "../../Util/Shutdown.ts";
|
|
17
|
+
import { traceParentEnv } from "../../Util/TraceParent.ts";
|
|
12
18
|
import { DEV_RELOAD_EXIT_CODE, DevOptions } from "../DevOptions.ts";
|
|
19
|
+
import { consoleSettingsEnv, currentConsoleSettings, RunLog } from "../GlobalLog.ts";
|
|
13
20
|
import { suppressInterruptMessages } from "./errors.ts";
|
|
14
21
|
import {
|
|
15
22
|
configPath,
|
|
@@ -22,6 +29,7 @@ import {
|
|
|
22
29
|
profile,
|
|
23
30
|
resolveStackArgs,
|
|
24
31
|
} from "./flags.ts";
|
|
32
|
+
import { logCommandFailure, VersionCheck } from "./instrument.ts";
|
|
25
33
|
|
|
26
34
|
/**
|
|
27
35
|
* Trust the Floci emulator CA in `alchemy dev` so cross-cloud data planes
|
|
@@ -96,6 +104,10 @@ export const devCommand = Command.make(
|
|
|
96
104
|
entry,
|
|
97
105
|
];
|
|
98
106
|
}
|
|
107
|
+
const runLog = yield* RunLog;
|
|
108
|
+
const consoleSettings = yield* currentConsoleSettings;
|
|
109
|
+
// The child's records and spans join this command's trace.
|
|
110
|
+
const traceEnv = yield* traceParentEnv;
|
|
99
111
|
const runChild = ChildProcess.make(command[0], command.slice(1), {
|
|
100
112
|
stdin: "inherit",
|
|
101
113
|
stdout: "inherit",
|
|
@@ -103,17 +115,60 @@ export const devCommand = Command.make(
|
|
|
103
115
|
env: {
|
|
104
116
|
ALCHEMY_EXEC_OPTIONS: JSON.stringify(options),
|
|
105
117
|
ALCHEMY_DEV: "true",
|
|
118
|
+
[LOG_FD_ENV]: "3",
|
|
119
|
+
// The exec child renders the run's logs but never sees this argv.
|
|
120
|
+
...consoleSettingsEnv(consoleSettings),
|
|
106
121
|
...(process.env.NODE_EXTRA_CA_CERTS
|
|
107
122
|
? { NODE_EXTRA_CA_CERTS: process.env.NODE_EXTRA_CA_CERTS }
|
|
108
123
|
: {}),
|
|
109
124
|
[SPAWNER_URL_ENV_KEY]: spawner.url,
|
|
125
|
+
...traceEnv,
|
|
110
126
|
},
|
|
111
127
|
extendEnv: true,
|
|
112
128
|
// Same process group as this supervisor: the exec child owns the
|
|
113
129
|
// terminal (TUI stdin), so the tty's Ctrl+C must reach it directly.
|
|
114
130
|
detached: false,
|
|
131
|
+
// The child's log records, for the run log this process writes.
|
|
132
|
+
additionalFds: { fd3: { type: "output" } },
|
|
115
133
|
}).pipe(
|
|
116
|
-
Effect.flatMap((child) =>
|
|
134
|
+
Effect.flatMap((child) =>
|
|
135
|
+
Effect.gen(function* () {
|
|
136
|
+
const records = yield* child.getOutputFd(3).pipe(
|
|
137
|
+
Stream.decodeText(),
|
|
138
|
+
Stream.splitLines,
|
|
139
|
+
// Already rendered by the child: into the run log only. A line
|
|
140
|
+
// that doesn't decode is skipped, never ends the reader.
|
|
141
|
+
Stream.runForEach((line) => {
|
|
142
|
+
const record = parseRecord(line);
|
|
143
|
+
return record === undefined
|
|
144
|
+
? Effect.void
|
|
145
|
+
: replayRecord(record).pipe(
|
|
146
|
+
Effect.provideService(Logger.CurrentLoggers, new Set([runLog])),
|
|
147
|
+
);
|
|
148
|
+
}),
|
|
149
|
+
Effect.ignore,
|
|
150
|
+
Effect.forkScoped,
|
|
151
|
+
);
|
|
152
|
+
// The pipe closes with the child: take its last records before
|
|
153
|
+
// this scope (and the reader with it) closes.
|
|
154
|
+
const drain = Fiber.join(records).pipe(Effect.timeout("2 seconds"), Effect.ignore);
|
|
155
|
+
const code = yield* child.exitCode.pipe(
|
|
156
|
+
// Ctrl+C reaches the child too (same process group): let it
|
|
157
|
+
// finish its own shutdown and report it before this scope
|
|
158
|
+
// kills whatever is left.
|
|
159
|
+
Effect.onInterrupt(() =>
|
|
160
|
+
child.exitCode.pipe(
|
|
161
|
+
Effect.timeout("5 seconds"),
|
|
162
|
+
Effect.ignore,
|
|
163
|
+
Effect.andThen(drain),
|
|
164
|
+
timedShutdownStep("stopped exec child"),
|
|
165
|
+
),
|
|
166
|
+
),
|
|
167
|
+
);
|
|
168
|
+
yield* drain;
|
|
169
|
+
return code;
|
|
170
|
+
}),
|
|
171
|
+
),
|
|
117
172
|
Effect.scoped,
|
|
118
173
|
);
|
|
119
174
|
// Each child gets its own scope so a reload exit releases the old
|
|
@@ -124,11 +179,14 @@ export const devCommand = Command.make(
|
|
|
124
179
|
});
|
|
125
180
|
},
|
|
126
181
|
(effect, args) =>
|
|
127
|
-
Effect.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
182
|
+
Effect.andThen(
|
|
183
|
+
Effect.flatten(VersionCheck),
|
|
184
|
+
Effect.provide(
|
|
185
|
+
RpcSpawner.layerServer({
|
|
186
|
+
profile: args.profile,
|
|
187
|
+
envFile: Option.getOrUndefined(args.envFile),
|
|
188
|
+
}),
|
|
189
|
+
)(effect),
|
|
190
|
+
).pipe(logCommandFailure),
|
|
133
191
|
),
|
|
134
192
|
).pipe(Command.withDescription("Develop a stack with live reload"));
|
|
@@ -2,13 +2,14 @@ import * as Command from "effect/cli/Command";
|
|
|
2
2
|
import * as Flag from "effect/cli/Flag";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Option from "effect/Option";
|
|
5
|
-
import * as
|
|
5
|
+
import * as Alchemist from "../../Alchemist/index.ts";
|
|
6
|
+
import * as Interaction from "../../Interaction.ts";
|
|
6
7
|
import { Cli } from "../../Report.ts";
|
|
7
|
-
import
|
|
8
|
+
import { renderApply } from "../../Report.ts";
|
|
8
9
|
import { planDecisionScreen } from "../components/view/PlanDecision.tsx";
|
|
9
10
|
import { config, envFile, profile, resolveStage, stage } from "./flags.ts";
|
|
10
11
|
import { instrumentCommand } from "./instrument.ts";
|
|
11
|
-
import {
|
|
12
|
+
import { renderPlanning } from "./render.ts";
|
|
12
13
|
|
|
13
14
|
const repairFlag = Flag.Boolean("repair").pipe(
|
|
14
15
|
Flag.withDescription("Repair detected drift without prompting"),
|
|
@@ -31,12 +32,15 @@ const routeDrift = Effect.fn(function* ({
|
|
|
31
32
|
repair = false,
|
|
32
33
|
}: SyncArgs) {
|
|
33
34
|
const cli = yield* Cli;
|
|
34
|
-
const snapshot = yield*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const snapshot = yield* Alchemist.importStack(main).pipe(
|
|
36
|
+
Effect.flatMap((stack) =>
|
|
37
|
+
Alchemist.Drift.scan({
|
|
38
|
+
stack,
|
|
39
|
+
stage,
|
|
40
|
+
profile,
|
|
41
|
+
envFile: Option.getOrUndefined(envFile),
|
|
42
|
+
}),
|
|
43
|
+
),
|
|
40
44
|
renderPlanning({
|
|
41
45
|
operation: "Drift",
|
|
42
46
|
stage,
|
|
@@ -44,19 +48,19 @@ const routeDrift = Effect.fn(function* ({
|
|
|
44
48
|
readyLabel: "Drift check complete",
|
|
45
49
|
}),
|
|
46
50
|
);
|
|
47
|
-
if (!Drift.hasDrift(snapshot)) {
|
|
48
|
-
return yield* cli.displayPlan(snapshot.
|
|
51
|
+
if (!Alchemist.Drift.hasDrift(snapshot)) {
|
|
52
|
+
return yield* cli.displayPlan(snapshot.native);
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
if (!repair) {
|
|
52
|
-
const terminal = yield*
|
|
56
|
+
const terminal = yield* Interaction.Interaction;
|
|
53
57
|
if (!terminal.terminal.input) {
|
|
54
|
-
return yield* cli.displayPlan(snapshot.
|
|
58
|
+
return yield* cli.displayPlan(snapshot.native);
|
|
55
59
|
}
|
|
56
60
|
const decision = yield* terminal.prompt
|
|
57
|
-
.
|
|
61
|
+
.screen(
|
|
58
62
|
planDecisionScreen({
|
|
59
|
-
plan: snapshot.
|
|
63
|
+
plan: snapshot.native,
|
|
60
64
|
message: "Drift detected",
|
|
61
65
|
choices: [
|
|
62
66
|
{
|
|
@@ -75,7 +79,7 @@ const routeDrift = Effect.fn(function* ({
|
|
|
75
79
|
if (decision === "cancel") return;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
|
-
yield* Drift.
|
|
82
|
+
yield* Alchemist.Drift.execute(snapshot).pipe(renderApply(snapshot.native));
|
|
79
83
|
});
|
|
80
84
|
|
|
81
85
|
export const driftCommand = Command.make(
|
|
@@ -11,10 +11,9 @@ import {
|
|
|
11
11
|
ANSI_RESET,
|
|
12
12
|
ansiFg,
|
|
13
13
|
colorsEnabled,
|
|
14
|
-
glyphsFor,
|
|
15
|
-
theme,
|
|
16
14
|
unicodeEnabled,
|
|
17
|
-
} from "
|
|
15
|
+
} from "../../Util/Terminal.ts";
|
|
16
|
+
import { glyphsFor, theme } from "../../Util/Theme.ts";
|
|
18
17
|
|
|
19
18
|
const isTerminalCancelled = Schema.is(
|
|
20
19
|
Schema.Struct({ _tag: Schema.Literals(["TerminalCancelled"]) }),
|
|
@@ -1,13 +1,41 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
1
3
|
import * as Effect from "effect/Effect";
|
|
2
|
-
import {
|
|
4
|
+
import { identity } from "effect/Function";
|
|
5
|
+
import { authRegistryLayer } from "../../Alchemist/AuthRegistry.ts";
|
|
3
6
|
import { recordCli } from "../../Telemetry/Metrics.ts";
|
|
7
|
+
import { globalLogs } from "../../Util/LogRecord.ts";
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
* Commands about the account, not a project: their logs go to the global run
|
|
11
|
+
* log (`~/.alchemy/logs`), so running one outside a project creates nothing
|
|
12
|
+
* there.
|
|
13
|
+
*/
|
|
14
|
+
const isGlobalCommand = (command: string) =>
|
|
15
|
+
/^(profile|provider)(\.|$)/.test(command) ||
|
|
16
|
+
command === "state.bootstrap" ||
|
|
17
|
+
command === "state.teardown";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The terminal shows a failed command's friendly message; this keeps its
|
|
21
|
+
* full cause chain in the command's run log.
|
|
22
|
+
*/
|
|
23
|
+
export const logCommandFailure = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
|
|
24
|
+
Effect.tapCause(effect, (cause) => Effect.logDebug(`command failed:\n${Cause.pretty(cause)}`));
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The pre-command version check. The CLI entrypoint sets it with its
|
|
28
|
+
* services already provided; elsewhere (tests, the API) it does nothing.
|
|
29
|
+
*/
|
|
30
|
+
export const VersionCheck = Context.Reference<Effect.Effect<void>>("alchemy/Cli/VersionCheck", {
|
|
31
|
+
defaultValue: () => Effect.void,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Wraps a command handler as one traced, metered unit. A best-effort check
|
|
36
|
+
* for a newer published version runs first, so its warning prints before
|
|
37
|
+
* any interactive prompt; it is cached for a day and bounded by a short
|
|
38
|
+
* timeout, so this stays fast.
|
|
11
39
|
*/
|
|
12
40
|
export const instrumentCommand =
|
|
13
41
|
<AttrsArgs = unknown>(command: string, attrs?: (args: AttrsArgs) => Record<string, unknown>) =>
|
|
@@ -15,10 +43,13 @@ export const instrumentCommand =
|
|
|
15
43
|
handler: (args: Args) => Effect.Effect<A, E, R>,
|
|
16
44
|
): ((args: Args) => Effect.Effect<A, E, R>) =>
|
|
17
45
|
(args) =>
|
|
18
|
-
handler(args).pipe(
|
|
46
|
+
Effect.andThen(Effect.flatten(VersionCheck), handler(args)).pipe(
|
|
19
47
|
Effect.withSpan(`cli.${command}`, {
|
|
20
48
|
attributes: attrs ? attrs(args) : {},
|
|
21
49
|
}),
|
|
22
50
|
recordCli(command),
|
|
23
|
-
|
|
51
|
+
logCommandFailure,
|
|
52
|
+
isGlobalCommand(command) ? globalLogs : identity,
|
|
53
|
+
// Auth registries are memoized for the command's duration.
|
|
54
|
+
Effect.provide(authRegistryLayer),
|
|
24
55
|
);
|