@lunora/config 1.0.0-alpha.37 → 1.0.0-alpha.370
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/LICENSE.md +135 -0
- package/README.md +3 -3
- package/dist/cli/index.d.mts +2 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.mjs +1 -0
- package/dist/cloudflare/index.d.mts +1253 -0
- package/dist/cloudflare/index.d.ts +1253 -0
- package/dist/cloudflare/index.mjs +1 -0
- package/dist/index.d.mts +845 -974
- package/dist/index.d.ts +845 -974
- package/dist/index.mjs +1 -23
- package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
- package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
- package/dist/packem_shared/AGENT_RULES_DIR-HrrbNZPy.mjs +1 -0
- package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-CfXEYG8e.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-BKMrOuXV.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_DRIVER-CULavrYO.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs +1 -0
- package/dist/packem_shared/CODEGEN_ENV-CkUo3_GU.mjs +1 -0
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs +1 -0
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-rR7buNQw.mjs +1 -0
- package/dist/packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs +1 -0
- package/dist/packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs +4 -0
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs +6 -0
- package/dist/packem_shared/DEV_WORKER_ENV_VALUE-2XFXmRrP.mjs +1 -0
- package/dist/packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs +1 -0
- package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs +1 -0
- package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
- package/dist/packem_shared/LUNORA_TAG-DQTGPqcJ.mjs +1 -0
- package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-38Plje8b.mjs +1 -0
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-BlERq9JI.mjs +1 -0
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-PLeh_74E.mjs +1 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-OLQlG0oj.mjs +1 -0
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-DXjL7k72.mjs +1 -0
- package/dist/packem_shared/SEED_ENDPOINT-2B56PN_H.mjs +1 -0
- package/dist/packem_shared/STUDIO_PATH-D9K31aOy.mjs +1 -0
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-DwJCN8fX.mjs +1 -0
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
- package/dist/packem_shared/WRANGLER_FILES-UNW-xY5u.mjs +1 -0
- package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
- package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
- package/dist/packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs +6 -0
- package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
- package/dist/packem_shared/applyStudioAssetCache-DHQEJuuv.mjs +1 -0
- package/dist/packem_shared/assertWranglerSatisfiesSchema-D4FA4jKB.mjs +3 -0
- package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
- package/dist/packem_shared/blockingFindingsMessage-BVbijPdn.mjs +1 -0
- package/dist/packem_shared/buildPackageSecretsBlock-BWV_VxqV.mjs +19 -0
- package/dist/packem_shared/celld-config-D-L6uskI.mjs +3 -0
- package/dist/packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs +24 -0
- package/dist/packem_shared/collectExportGaps-BPuhGH2J.mjs +2 -0
- package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
- package/dist/packem_shared/createDiscoveryCache-npJI4uej.mjs +1 -0
- package/dist/packem_shared/deploy-driver.d-Cl96-c1l.d.mts +184 -0
- package/dist/packem_shared/deploy-driver.d-Cl96-c1l.d.ts +184 -0
- package/dist/packem_shared/describePreservedCrons-C5KPuPy3.mjs +1 -0
- package/dist/packem_shared/describeWithheldWorkersAi-IIxe3TuI.mjs +1 -0
- package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
- package/dist/packem_shared/discover-info-DC2MrAIM.mjs +1 -0
- package/dist/packem_shared/discoverAgentInfo-pqFMJBtJ.mjs +1 -0
- package/dist/packem_shared/discoverContainerInfo-DzXr7Vm3.mjs +1 -0
- package/dist/packem_shared/discoverSchemaInfo-BBRlXZop.mjs +1 -0
- package/dist/packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs +1 -0
- package/dist/packem_shared/guards-Buu_E7mP.mjs +1 -0
- package/dist/packem_shared/hasCloudflareCredentials-byvHpEiD.mjs +1 -0
- package/dist/packem_shared/index.d-Cmx4jMFV.d.ts +270 -0
- package/dist/packem_shared/index.d-DkNi7r6E.d.mts +270 -0
- package/dist/packem_shared/infer-bindings-C1NFOdMi.mjs +1 -0
- package/dist/packem_shared/infer-bindings.d-eFzcOnRh.d.mts +297 -0
- package/dist/packem_shared/infer-bindings.d-eFzcOnRh.d.ts +297 -0
- package/dist/packem_shared/inferLunoraBindings-Gp_7yyIo.mjs +1 -0
- package/dist/packem_shared/interpretRemote-CcmGeGZ_.mjs +1 -0
- package/dist/packem_shared/lunora-manifest-DuH_Cmyu.mjs +6 -0
- package/dist/packem_shared/materializeServiceDevConfigs-DLUHefD-.mjs +1 -0
- package/dist/packem_shared/mergeWranglerEnvironment-DXiB-HcS.mjs +1 -0
- package/dist/packem_shared/package-secrets-registry-BeheNwsP.mjs +1 -0
- package/dist/packem_shared/parseDevVariable-teAAahVD.mjs +1 -0
- package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
- package/dist/packem_shared/process-tree-once-Ou4SfxKM.mjs +1 -0
- package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
- package/dist/packem_shared/reconcile-services-DFqH4eMQ.mjs +1 -0
- package/dist/packem_shared/reconcileBindingsSafely-BEwmwy0q.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs +1 -0
- package/dist/packem_shared/renderStudioHtml-ByowDtMl.mjs +15 -0
- package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
- package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
- package/dist/packem_shared/scanWranglerVariablesForSecrets-BFTVje1q.mjs +1 -0
- package/dist/packem_shared/serveJsonHandler-Dv0EdCb9.mjs +1 -0
- package/dist/packem_shared/startCelldDevSession-BLFsd6jG.mjs +1 -0
- package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
- package/dist/packem_shared/validate-bindings-CvNBF3U4.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-DngzpJMK.mjs +1 -0
- package/dist/packem_shared/worker-entry-checks-AIASCYl7.mjs +1 -0
- package/dist/packem_shared/wranglerCodegenInputs-CbisphsH.mjs +1 -0
- package/dist/packem_shared/wranglerToAlchemy-CBO2ucRm.mjs +6 -0
- package/dist/packem_shared/write-atomic-CY97nWi1.mjs +1 -0
- package/dist/studio-host/index.d.mts +320 -110
- package/dist/studio-host/index.d.ts +320 -110
- package/dist/studio-host/index.mjs +1 -7
- package/package.json +20 -7
- package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
- package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
- package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
- package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
- package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-CiC2IGKx.mjs +0 -103
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
- package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
- package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
- package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
- package/dist/packem_shared/buildPackageSecretsBlock-BCHtfQ2A.mjs +0 -280
- package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
- package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
- package/dist/packem_shared/detectFramework-Br-BcPBq.mjs +0 -41
- package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
- package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
- package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
- package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
- package/dist/packem_shared/loadStudioAssets-Csk5RS4E.mjs +0 -28
- package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
- package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
- package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
- package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
- package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
- package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `DeployDriver` — the provider-neutral seam between a Lunora command and the
|
|
3
|
+
* host CLI that carries it out (plan 114, §5.3).
|
|
4
|
+
*
|
|
5
|
+
* The seam is the **toolchain surface**: which command a host runs to deploy,
|
|
6
|
+
* serve, tail, or set a secret. A driver only *describes* that command
|
|
7
|
+
* ({@link ToolchainCommand}); it never spawns. The CLI keeps ownership of
|
|
8
|
+
* running it — package-manager resolution (`pnpm exec` / `npx --` / `bun x`)
|
|
9
|
+
* and the injected spawner its tests substitute — so the driver stays free of
|
|
10
|
+
* process concerns and remains trivially testable as a pure function.
|
|
11
|
+
*
|
|
12
|
+
* Each request type below is deliberately neutral: `preview`, `environment`,
|
|
13
|
+
* `temporary` are concepts, not wrangler flags. A second host maps the same
|
|
14
|
+
* request onto its own CLI without the caller changing.
|
|
15
|
+
*
|
|
16
|
+
* Three drivers are registered: Cloudflare (`cloudflare/cloudflare-driver.ts`)
|
|
17
|
+
* and celld (`celld/celld-driver.ts`), which ship toolchains, and Node
|
|
18
|
+
* (`node/node-driver.ts`), which has none — it is a codegen target, and
|
|
19
|
+
* `lunora deploy` / `lunora dev` refuse it at selection.
|
|
20
|
+
*
|
|
21
|
+
* **What this seam deliberately does NOT carry: configuration inference.** It
|
|
22
|
+
* used to, through an `infer`/`provision` pair over a provider-neutral
|
|
23
|
+
* `ResourceGraph`. Nothing ever called either one — every consumer reads
|
|
24
|
+
* `.toolchain` or just validates the target — and the arm rotted in place: the
|
|
25
|
+
* Node driver was *only* `infer` + `provision`, so its report of what that
|
|
26
|
+
* target cannot serve (containers, undispatched crons) could not reach an
|
|
27
|
+
* operator however wrong the app was. The reason it never got wired is worth
|
|
28
|
+
* keeping: writing real host configuration needs the host's own encodings —
|
|
29
|
+
* binding names, DO class wiring, migration tags — which a neutral graph
|
|
30
|
+
* necessarily discards, so `provision` re-derived them anyway and the graph was
|
|
31
|
+
* decorative. A second target that needs to share inference should grow the
|
|
32
|
+
* seam back with a caller attached, and with an encoding escape hatch.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* A host CLI invocation, described but not run.
|
|
36
|
+
*
|
|
37
|
+
* `tool` is the binary name only (`"wrangler"`); the caller resolves how to
|
|
38
|
+
* execute it through the project's package manager (see `toolchainExecArgs`).
|
|
39
|
+
* Keeping that split means a driver never has to know whether the project uses
|
|
40
|
+
* pnpm, npm, yarn, or bun.
|
|
41
|
+
*/
|
|
42
|
+
interface ToolchainCommand {
|
|
43
|
+
/** Arguments for {@link ToolchainCommand.tool}. */
|
|
44
|
+
args: ReadonlyArray<string>;
|
|
45
|
+
/**
|
|
46
|
+
* The tool is a standalone binary installed on `PATH`, not a project
|
|
47
|
+
* dependency: run it directly. Going through the package manager would be
|
|
48
|
+
* wrong for it — `npx --` / `bun x` fetch an npm package of the same name
|
|
49
|
+
* when none is installed locally, which for a non-npm binary is somebody
|
|
50
|
+
* else's code.
|
|
51
|
+
*/
|
|
52
|
+
onPath?: boolean;
|
|
53
|
+
/** The host CLI binary, e.g. `"wrangler"`. */
|
|
54
|
+
tool: string;
|
|
55
|
+
}
|
|
56
|
+
/** Neutral options for a deploy. */
|
|
57
|
+
interface DeployRequest {
|
|
58
|
+
/** Host config file to deploy, when the flow uses a projected one (see {@link DeployDriver.projectConfig}). */
|
|
59
|
+
configPath?: string;
|
|
60
|
+
/** Validate and bundle without publishing — nothing ships. */
|
|
61
|
+
dryRun?: boolean;
|
|
62
|
+
/** Deploy this entry file instead of the host config's default (framework composition). */
|
|
63
|
+
entry?: string;
|
|
64
|
+
/** Named deployment environment, when the host supports them. */
|
|
65
|
+
environment?: string;
|
|
66
|
+
/** Write the built bundle (and any build metadata) to this directory. */
|
|
67
|
+
outDir?: string;
|
|
68
|
+
/** Upload a preview/versioned artifact instead of taking production traffic. */
|
|
69
|
+
preview?: boolean;
|
|
70
|
+
/** Deploy to a short-lived, unauthenticated account where the host offers one. */
|
|
71
|
+
temporary?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/** Neutral options for a local dev server. */
|
|
74
|
+
interface DevRequest {
|
|
75
|
+
/** Host config file to run against, when the flow uses a generated one. */
|
|
76
|
+
configPath?: string;
|
|
77
|
+
/** Named environment. */
|
|
78
|
+
environment?: string;
|
|
79
|
+
/** Extra host-specific flags the caller has already resolved. */
|
|
80
|
+
extraArgs?: ReadonlyArray<string>;
|
|
81
|
+
}
|
|
82
|
+
/** Neutral options for tailing live logs. */
|
|
83
|
+
interface TailRequest {
|
|
84
|
+
/** Named environment. */
|
|
85
|
+
environment?: string;
|
|
86
|
+
/** Output format the host tail supports (`"json"`, `"pretty"`, …). */
|
|
87
|
+
format?: string;
|
|
88
|
+
/** Free-text filter. */
|
|
89
|
+
search?: string;
|
|
90
|
+
/** Status filter (`"error"`, `"ok"`, …). */
|
|
91
|
+
status?: string;
|
|
92
|
+
/** Tail a short-lived account's deployment. */
|
|
93
|
+
temporary?: boolean;
|
|
94
|
+
/** Tail a specific deployed worker/service by name, when the host addresses them individually. */
|
|
95
|
+
worker?: string;
|
|
96
|
+
}
|
|
97
|
+
/** Neutral options for reading or writing deployment secrets. */
|
|
98
|
+
interface SecretRequest {
|
|
99
|
+
/** Named environment. */
|
|
100
|
+
environment?: string;
|
|
101
|
+
/** The secret's name — required for `put`, unused for `list`. */
|
|
102
|
+
key?: string;
|
|
103
|
+
/** Operate against a short-lived account. */
|
|
104
|
+
temporary?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The host's command-line surface. Optional as a whole: a host with no vendor
|
|
108
|
+
* CLI (the Node target; a hypothetical API-driven one) declares none, and
|
|
109
|
+
* `isRunnableTarget` refuses it for the commands that would have to shell out.
|
|
110
|
+
*
|
|
111
|
+
* `deploy` and `dev` are what make a target runnable. The secret and tail
|
|
112
|
+
* commands are optional on their own, because a runnable host can simply not
|
|
113
|
+
* have them — celld keeps configuration in plain `vars` and has no log tail —
|
|
114
|
+
* and the commands that need one say so rather than guessing a substitute.
|
|
115
|
+
*/
|
|
116
|
+
interface DriverToolchain {
|
|
117
|
+
/** The command that deploys the app. */
|
|
118
|
+
deploy: (request: DeployRequest) => ToolchainCommand;
|
|
119
|
+
/** The command that runs a local dev server. */
|
|
120
|
+
dev: (request: DevRequest) => ToolchainCommand;
|
|
121
|
+
/**
|
|
122
|
+
* Where `lunora dev` runs the worker. `"workerd"`: `wrangler dev`, or the
|
|
123
|
+
* Vite plugin's `@cloudflare/vite-plugin`, whichever flavor the project
|
|
124
|
+
* picks. `"own"`: the host's dev server ({@link DriverToolchain.dev}) on
|
|
125
|
+
* the projected config, always the standalone flavor — neither Vite nor a
|
|
126
|
+
* framework sidecar can serve the worker on that runtime.
|
|
127
|
+
*/
|
|
128
|
+
readonly devServer: "own" | "workerd";
|
|
129
|
+
/**
|
|
130
|
+
* Whether `lunora deploy` builds and pushes container images itself
|
|
131
|
+
* (railpack, into the host's registry) before `deploy`. `false` when the
|
|
132
|
+
* host CLI builds each image from its Dockerfile during the deploy.
|
|
133
|
+
*/
|
|
134
|
+
readonly prebuildsContainerImages: boolean;
|
|
135
|
+
/** The command that writes many secrets in one call, as a JSON object of name to value on stdin. Optional: hosts without it get one `secretPut` per key. */
|
|
136
|
+
secretBulk?: (request: SecretRequest) => ToolchainCommand;
|
|
137
|
+
/** The command that lists remote secret names, when the host has a secret store. */
|
|
138
|
+
secretList?: (request: SecretRequest) => ToolchainCommand;
|
|
139
|
+
/** The command that writes one secret, when the host has a secret store. Its value is passed on stdin, never argv. */
|
|
140
|
+
secretPut?: (request: SecretRequest) => ToolchainCommand;
|
|
141
|
+
/** The command that tails live logs, when the host has one. */
|
|
142
|
+
tail?: (request: TailRequest) => ToolchainCommand;
|
|
143
|
+
}
|
|
144
|
+
/** What a {@link DeployDriver.projectConfig} projection is for — a dev server may need a different source than a deploy. */
|
|
145
|
+
type ProjectionPurpose = "deploy" | "dev";
|
|
146
|
+
/**
|
|
147
|
+
* The result of {@link DeployDriver.projectConfig}: a plan, not yet on disk.
|
|
148
|
+
* The caller validates the request it is for (the toolchain's argv builder
|
|
149
|
+
* refuses unsupported options), then calls `write` — so a refused command
|
|
150
|
+
* changes nothing.
|
|
151
|
+
*/
|
|
152
|
+
interface ProjectedConfig {
|
|
153
|
+
/** Where the projection goes, to pass as the request's `configPath`. */
|
|
154
|
+
configPath: string;
|
|
155
|
+
/** Every key removed, as a dotted path (`observability`, `containers[0].rollout_step_percentage`). */
|
|
156
|
+
dropped: ReadonlyArray<string>;
|
|
157
|
+
/** Write the projection (and any build-artifact cleanup it planned). */
|
|
158
|
+
write: () => void;
|
|
159
|
+
}
|
|
160
|
+
/** A deploy target's implementation: an identity the registry resolves, and the host CLI surface (if any) behind it. */
|
|
161
|
+
interface DeployDriver {
|
|
162
|
+
/** The target id this driver serves (`"cloudflare"`, …) — matches codegen's `target`. */
|
|
163
|
+
readonly id: string;
|
|
164
|
+
/** Human-readable target name, for logs. */
|
|
165
|
+
readonly name: string;
|
|
166
|
+
/**
|
|
167
|
+
* Rewrite the project's wrangler config into the form this host's CLI
|
|
168
|
+
* accepts, and return the file to hand `deploy`/`dev` as `configPath`.
|
|
169
|
+
* Absent when the host reads the project's config as-is (Cloudflare).
|
|
170
|
+
*
|
|
171
|
+
* Needed because Lunora's reconcilers and templates write Cloudflare-only
|
|
172
|
+
* keys (`observability`, `limits`, …) that a Workers-compatible host with a
|
|
173
|
+
* strict config reader refuses outright. `dropped` names what was removed,
|
|
174
|
+
* so the caller can say so instead of silently deploying less than the
|
|
175
|
+
* config describes.
|
|
176
|
+
*/
|
|
177
|
+
readonly projectConfig?: (projectRoot: string, purpose: ProjectionPurpose) => ProjectedConfig;
|
|
178
|
+
/**
|
|
179
|
+
* The host's command-line surface, or `undefined` for a host that has none.
|
|
180
|
+
* Pure: these build argv, they never spawn.
|
|
181
|
+
*/
|
|
182
|
+
readonly toolchain?: DriverToolchain;
|
|
183
|
+
}
|
|
184
|
+
export { DeployDriver as D, ProjectedConfig as P, SecretRequest as S, TailRequest as T, DeployRequest as a, DevRequest as b, DriverToolchain as c, ProjectionPurpose as d, ToolchainCommand as e };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `DeployDriver` — the provider-neutral seam between a Lunora command and the
|
|
3
|
+
* host CLI that carries it out (plan 114, §5.3).
|
|
4
|
+
*
|
|
5
|
+
* The seam is the **toolchain surface**: which command a host runs to deploy,
|
|
6
|
+
* serve, tail, or set a secret. A driver only *describes* that command
|
|
7
|
+
* ({@link ToolchainCommand}); it never spawns. The CLI keeps ownership of
|
|
8
|
+
* running it — package-manager resolution (`pnpm exec` / `npx --` / `bun x`)
|
|
9
|
+
* and the injected spawner its tests substitute — so the driver stays free of
|
|
10
|
+
* process concerns and remains trivially testable as a pure function.
|
|
11
|
+
*
|
|
12
|
+
* Each request type below is deliberately neutral: `preview`, `environment`,
|
|
13
|
+
* `temporary` are concepts, not wrangler flags. A second host maps the same
|
|
14
|
+
* request onto its own CLI without the caller changing.
|
|
15
|
+
*
|
|
16
|
+
* Three drivers are registered: Cloudflare (`cloudflare/cloudflare-driver.ts`)
|
|
17
|
+
* and celld (`celld/celld-driver.ts`), which ship toolchains, and Node
|
|
18
|
+
* (`node/node-driver.ts`), which has none — it is a codegen target, and
|
|
19
|
+
* `lunora deploy` / `lunora dev` refuse it at selection.
|
|
20
|
+
*
|
|
21
|
+
* **What this seam deliberately does NOT carry: configuration inference.** It
|
|
22
|
+
* used to, through an `infer`/`provision` pair over a provider-neutral
|
|
23
|
+
* `ResourceGraph`. Nothing ever called either one — every consumer reads
|
|
24
|
+
* `.toolchain` or just validates the target — and the arm rotted in place: the
|
|
25
|
+
* Node driver was *only* `infer` + `provision`, so its report of what that
|
|
26
|
+
* target cannot serve (containers, undispatched crons) could not reach an
|
|
27
|
+
* operator however wrong the app was. The reason it never got wired is worth
|
|
28
|
+
* keeping: writing real host configuration needs the host's own encodings —
|
|
29
|
+
* binding names, DO class wiring, migration tags — which a neutral graph
|
|
30
|
+
* necessarily discards, so `provision` re-derived them anyway and the graph was
|
|
31
|
+
* decorative. A second target that needs to share inference should grow the
|
|
32
|
+
* seam back with a caller attached, and with an encoding escape hatch.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* A host CLI invocation, described but not run.
|
|
36
|
+
*
|
|
37
|
+
* `tool` is the binary name only (`"wrangler"`); the caller resolves how to
|
|
38
|
+
* execute it through the project's package manager (see `toolchainExecArgs`).
|
|
39
|
+
* Keeping that split means a driver never has to know whether the project uses
|
|
40
|
+
* pnpm, npm, yarn, or bun.
|
|
41
|
+
*/
|
|
42
|
+
interface ToolchainCommand {
|
|
43
|
+
/** Arguments for {@link ToolchainCommand.tool}. */
|
|
44
|
+
args: ReadonlyArray<string>;
|
|
45
|
+
/**
|
|
46
|
+
* The tool is a standalone binary installed on `PATH`, not a project
|
|
47
|
+
* dependency: run it directly. Going through the package manager would be
|
|
48
|
+
* wrong for it — `npx --` / `bun x` fetch an npm package of the same name
|
|
49
|
+
* when none is installed locally, which for a non-npm binary is somebody
|
|
50
|
+
* else's code.
|
|
51
|
+
*/
|
|
52
|
+
onPath?: boolean;
|
|
53
|
+
/** The host CLI binary, e.g. `"wrangler"`. */
|
|
54
|
+
tool: string;
|
|
55
|
+
}
|
|
56
|
+
/** Neutral options for a deploy. */
|
|
57
|
+
interface DeployRequest {
|
|
58
|
+
/** Host config file to deploy, when the flow uses a projected one (see {@link DeployDriver.projectConfig}). */
|
|
59
|
+
configPath?: string;
|
|
60
|
+
/** Validate and bundle without publishing — nothing ships. */
|
|
61
|
+
dryRun?: boolean;
|
|
62
|
+
/** Deploy this entry file instead of the host config's default (framework composition). */
|
|
63
|
+
entry?: string;
|
|
64
|
+
/** Named deployment environment, when the host supports them. */
|
|
65
|
+
environment?: string;
|
|
66
|
+
/** Write the built bundle (and any build metadata) to this directory. */
|
|
67
|
+
outDir?: string;
|
|
68
|
+
/** Upload a preview/versioned artifact instead of taking production traffic. */
|
|
69
|
+
preview?: boolean;
|
|
70
|
+
/** Deploy to a short-lived, unauthenticated account where the host offers one. */
|
|
71
|
+
temporary?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/** Neutral options for a local dev server. */
|
|
74
|
+
interface DevRequest {
|
|
75
|
+
/** Host config file to run against, when the flow uses a generated one. */
|
|
76
|
+
configPath?: string;
|
|
77
|
+
/** Named environment. */
|
|
78
|
+
environment?: string;
|
|
79
|
+
/** Extra host-specific flags the caller has already resolved. */
|
|
80
|
+
extraArgs?: ReadonlyArray<string>;
|
|
81
|
+
}
|
|
82
|
+
/** Neutral options for tailing live logs. */
|
|
83
|
+
interface TailRequest {
|
|
84
|
+
/** Named environment. */
|
|
85
|
+
environment?: string;
|
|
86
|
+
/** Output format the host tail supports (`"json"`, `"pretty"`, …). */
|
|
87
|
+
format?: string;
|
|
88
|
+
/** Free-text filter. */
|
|
89
|
+
search?: string;
|
|
90
|
+
/** Status filter (`"error"`, `"ok"`, …). */
|
|
91
|
+
status?: string;
|
|
92
|
+
/** Tail a short-lived account's deployment. */
|
|
93
|
+
temporary?: boolean;
|
|
94
|
+
/** Tail a specific deployed worker/service by name, when the host addresses them individually. */
|
|
95
|
+
worker?: string;
|
|
96
|
+
}
|
|
97
|
+
/** Neutral options for reading or writing deployment secrets. */
|
|
98
|
+
interface SecretRequest {
|
|
99
|
+
/** Named environment. */
|
|
100
|
+
environment?: string;
|
|
101
|
+
/** The secret's name — required for `put`, unused for `list`. */
|
|
102
|
+
key?: string;
|
|
103
|
+
/** Operate against a short-lived account. */
|
|
104
|
+
temporary?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The host's command-line surface. Optional as a whole: a host with no vendor
|
|
108
|
+
* CLI (the Node target; a hypothetical API-driven one) declares none, and
|
|
109
|
+
* `isRunnableTarget` refuses it for the commands that would have to shell out.
|
|
110
|
+
*
|
|
111
|
+
* `deploy` and `dev` are what make a target runnable. The secret and tail
|
|
112
|
+
* commands are optional on their own, because a runnable host can simply not
|
|
113
|
+
* have them — celld keeps configuration in plain `vars` and has no log tail —
|
|
114
|
+
* and the commands that need one say so rather than guessing a substitute.
|
|
115
|
+
*/
|
|
116
|
+
interface DriverToolchain {
|
|
117
|
+
/** The command that deploys the app. */
|
|
118
|
+
deploy: (request: DeployRequest) => ToolchainCommand;
|
|
119
|
+
/** The command that runs a local dev server. */
|
|
120
|
+
dev: (request: DevRequest) => ToolchainCommand;
|
|
121
|
+
/**
|
|
122
|
+
* Where `lunora dev` runs the worker. `"workerd"`: `wrangler dev`, or the
|
|
123
|
+
* Vite plugin's `@cloudflare/vite-plugin`, whichever flavor the project
|
|
124
|
+
* picks. `"own"`: the host's dev server ({@link DriverToolchain.dev}) on
|
|
125
|
+
* the projected config, always the standalone flavor — neither Vite nor a
|
|
126
|
+
* framework sidecar can serve the worker on that runtime.
|
|
127
|
+
*/
|
|
128
|
+
readonly devServer: "own" | "workerd";
|
|
129
|
+
/**
|
|
130
|
+
* Whether `lunora deploy` builds and pushes container images itself
|
|
131
|
+
* (railpack, into the host's registry) before `deploy`. `false` when the
|
|
132
|
+
* host CLI builds each image from its Dockerfile during the deploy.
|
|
133
|
+
*/
|
|
134
|
+
readonly prebuildsContainerImages: boolean;
|
|
135
|
+
/** The command that writes many secrets in one call, as a JSON object of name to value on stdin. Optional: hosts without it get one `secretPut` per key. */
|
|
136
|
+
secretBulk?: (request: SecretRequest) => ToolchainCommand;
|
|
137
|
+
/** The command that lists remote secret names, when the host has a secret store. */
|
|
138
|
+
secretList?: (request: SecretRequest) => ToolchainCommand;
|
|
139
|
+
/** The command that writes one secret, when the host has a secret store. Its value is passed on stdin, never argv. */
|
|
140
|
+
secretPut?: (request: SecretRequest) => ToolchainCommand;
|
|
141
|
+
/** The command that tails live logs, when the host has one. */
|
|
142
|
+
tail?: (request: TailRequest) => ToolchainCommand;
|
|
143
|
+
}
|
|
144
|
+
/** What a {@link DeployDriver.projectConfig} projection is for — a dev server may need a different source than a deploy. */
|
|
145
|
+
type ProjectionPurpose = "deploy" | "dev";
|
|
146
|
+
/**
|
|
147
|
+
* The result of {@link DeployDriver.projectConfig}: a plan, not yet on disk.
|
|
148
|
+
* The caller validates the request it is for (the toolchain's argv builder
|
|
149
|
+
* refuses unsupported options), then calls `write` — so a refused command
|
|
150
|
+
* changes nothing.
|
|
151
|
+
*/
|
|
152
|
+
interface ProjectedConfig {
|
|
153
|
+
/** Where the projection goes, to pass as the request's `configPath`. */
|
|
154
|
+
configPath: string;
|
|
155
|
+
/** Every key removed, as a dotted path (`observability`, `containers[0].rollout_step_percentage`). */
|
|
156
|
+
dropped: ReadonlyArray<string>;
|
|
157
|
+
/** Write the projection (and any build-artifact cleanup it planned). */
|
|
158
|
+
write: () => void;
|
|
159
|
+
}
|
|
160
|
+
/** A deploy target's implementation: an identity the registry resolves, and the host CLI surface (if any) behind it. */
|
|
161
|
+
interface DeployDriver {
|
|
162
|
+
/** The target id this driver serves (`"cloudflare"`, …) — matches codegen's `target`. */
|
|
163
|
+
readonly id: string;
|
|
164
|
+
/** Human-readable target name, for logs. */
|
|
165
|
+
readonly name: string;
|
|
166
|
+
/**
|
|
167
|
+
* Rewrite the project's wrangler config into the form this host's CLI
|
|
168
|
+
* accepts, and return the file to hand `deploy`/`dev` as `configPath`.
|
|
169
|
+
* Absent when the host reads the project's config as-is (Cloudflare).
|
|
170
|
+
*
|
|
171
|
+
* Needed because Lunora's reconcilers and templates write Cloudflare-only
|
|
172
|
+
* keys (`observability`, `limits`, …) that a Workers-compatible host with a
|
|
173
|
+
* strict config reader refuses outright. `dropped` names what was removed,
|
|
174
|
+
* so the caller can say so instead of silently deploying less than the
|
|
175
|
+
* config describes.
|
|
176
|
+
*/
|
|
177
|
+
readonly projectConfig?: (projectRoot: string, purpose: ProjectionPurpose) => ProjectedConfig;
|
|
178
|
+
/**
|
|
179
|
+
* The host's command-line surface, or `undefined` for a host that has none.
|
|
180
|
+
* Pure: these build argv, they never spawn.
|
|
181
|
+
*/
|
|
182
|
+
readonly toolchain?: DriverToolchain;
|
|
183
|
+
}
|
|
184
|
+
export { DeployDriver as D, ProjectedConfig as P, SecretRequest as S, TailRequest as T, DeployRequest as a, DevRequest as b, DriverToolchain as c, ProjectionPurpose as d, ToolchainCommand as e };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as u}from"node:fs";import{modify as y,applyEdits as w}from"jsonc-parser";import{r as m,f as v,a as $}from"./lunora-manifest-DuH_Cmyu.mjs";import{findWranglerFile as x,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";const b=(r,n)=>r.length===n.length&&r.every((e,t)=>e===n[t]),j=(r,n)=>{if(r?.lunoraIsForeign===!0)return n.push(`${r.path}: \`lunora\` is not an object, so the cron ownership record cannot be read or written — a removed cron will keep firing.`),[];const e=r?.lunora?.crons;if(e===void 0)return[];if(!Array.isArray(e))return n.push(`${r?.path??"package.json"}: \`lunora.crons\` is not an array of cron expressions — the crons it recorded are now treated as hand-written and will not be cleared.`),[];const t=e.filter(o=>typeof o=="string");return t.length!==e.length&&n.push(`${r?.path??"package.json"}: \`lunora.crons\` dropped ${String(e.length-t.length)} non-string entry(s) — anything it recorded there is now treated as hand-written and will not be cleared.`),t},k=(r,n)=>{$(r,"crons",n.length===0?void 0:[...n])},W=(r,n)=>{const e=x(r);if(!e)return{changed:!1,preserved:[],reason:"wrangler.jsonc not found",warnings:[]};const{parsed:t,text:o}=C(e);if(t===void 0)return{changed:!1,preserved:[],reason:`failed to parse ${e} as JSONC`,warnings:[],wranglerPath:e};const g=Array.isArray(t.triggers?.crons)?t.triggers.crons.filter(i=>typeof i=="string"):[],c=[...n],s=[],d=m(r),p=j(d,s),a=g.filter(i=>!c.includes(i)&&!p.includes(i)),l=[...c,...a],f=()=>{d!==void 0&&k(d,c)};if(b(g,l))return f(),{changed:!1,preserved:a,reason:"triggers.crons already in sync",warnings:s,wranglerPath:e};const h=y(o,["triggers","crons"],l,{formattingOptions:v(o)});return h.length===0?{changed:!1,preserved:a,reason:"no structural edit produced",warnings:s,wranglerPath:e}:(u(e,w(o,h),"utf8"),f(),{changed:!0,preserved:a,warnings:s,wranglerPath:e})},J=r=>r.length===0?void 0:`kept ${String(r.length)} hand-written cron trigger(s): ${r.join(", ")}`;export{J as describePreservedCrons,W as reconcileWranglerCrons};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{rmSync as s,readdirSync as c,writeFileSync as l}from"node:fs";import{join as i}from"node:path";const u=/^\.wrangler\.lunora-(?:dev|service)\.(\d+)\.\d+\.jsonc$/;let t=0;const a=e=>(t+=1,`.wrangler.lunora-${e}.${String(process.pid)}.${String(t)}.jsonc`),d=e=>{try{return process.kill(e,0),!0}catch(r){return r.code==="EPERM"}},f=e=>{let r;try{r=c(e)}catch{return}for(const o of r){const n=u.exec(o);if(!(n===null||Number(n[1])===process.pid||d(Number(n[1]))))try{s(i(e,o),{force:!0})}catch{}}},h=()=>{},g=e=>{let r=!1;return()=>{if(!r){r=!0;try{s(e,{force:!0})}catch{}}}},A=(e,r,o)=>{f(e);const n=i(e,a(r));return l(n,o,"utf8"),{cleanup:g(n),configPath:n}},w=(e,r)=>{if(!(e==null||r()))return typeof e.binding=="string"?e.binding:"AI"},v=e=>`Workers AI is off in this dev session (${e} binding left out): no Cloudflare login found, and Workers AI only runs remotely. \`@cf/…\` models will throw; AI SDK models and \`LUNORA_AI_PROXY_URL\` slugs still work. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`;export{u as STALE_DEV_CONFIG,g as createCleanup,v as describeWithheldWorkersAi,a as devConfigBasename,h as noopCleanup,f as sweepStaleDevConfigs,w as withheldWorkersAi,A as writeDevConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readProjectDependencyNames as a}from"./readProjectDependencies-l3uhUKjo.mjs";const n=[{class:"A",dependency:"@tanstack/react-start",framework:"tanstack-start"},{class:"A",dependency:"@tanstack/solid-start",framework:"tanstack-start-solid"},{class:"A",dependency:"@react-router/dev",framework:"react-router"},{class:"A",dependency:"vinext",framework:"vinext"},{class:"A",dependency:"@solidjs/start",framework:"solid-start"},{class:"A",dependency:"solid-start",framework:"solid-start"},{class:"B",dependency:"@sveltejs/kit",framework:"sveltekit"},{class:"B",dependency:"nuxt",framework:"nuxt"},{class:"B",dependency:"astro",framework:"astro"}],t={class:"C",framework:"none"},o=e=>a(e).has("lunorash"),d=e=>{const r=a(e);if(r.size===0)return t;for(const s of n)if(r.has(s.dependency))return{class:s.class,framework:s.framework};return t};export{d as detectFramework,o as projectUsesUmbrella};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as m}from"node:fs";import{Project as f}from"ts-morph";import{join as t}from"node:path";const p=(e,o,n,s,i={})=>{if(!m(t(e,o,n??"")))return{};try{const r=new f({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1,...i});return{value:s(r,t(e,o))}}catch(r){return{error:r instanceof Error?r.message:String(r)}}};export{p as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{discoverAgents as s,AGENTS_FILENAME as n}from"@lunora/codegen";import{d as i}from"./discover-info-DC2MrAIM.mjs";const v=(o,e)=>{const{error:r,value:t}=i(o,e,n,s);return r===void 0?{agents:t??[]}:{agents:[],error:r}};export{v as discoverAgentInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{discoverContainers as s,CONTAINERS_FILENAME as t}from"@lunora/codegen";import{d}from"./discover-info-DC2MrAIM.mjs";const e=(n,o)=>{const{error:r,value:i}=d(n,o,t,s,{skipFileDependencyResolution:!0});return r===void 0?{containers:i??[]}:{containers:[],error:r}},I=(n,o,r)=>r===void 0?e(n,o):r.memo(`containers:${n}:${o}`,()=>e(n,o));export{I as discoverContainerInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as d}from"node:fs";import{discoverSchema as l,isHyperdriveGlobalTable as f,isD1GlobalTable as b}from"@lunora/codegen";import{Project as u}from"ts-morph";import{join as p}from"node:path";const a=e=>{if(e?.kind==="optional")return a(e.inner);if(e?.kind==="union"){const s=new Set((e.members??[]).filter(i=>i.kind!=="null").map(i=>a(i)));return s.size===1?[...s][0]:e.kind}return e?.kind},m=(e,s)=>{const i=p(e,s,"schema.ts");if(!d(i))return{info:void 0};try{const o=new u({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1}),r=l(o,i,e),c=n=>r.tables.find(t=>t.name===n)?.shape??{};return{info:{hasD1GlobalTable:r.tables.some(n=>b(n)),hasHyperdriveGlobalTable:r.tables.some(n=>f(n)),...r.jurisdiction===void 0?{}:{jurisdiction:r.jurisdiction},vectorIndexNames:r.vectorIndexes.map(n=>n.name),vectorMetadata:r.vectorIndexes.flatMap(n=>(n.metadata??[]).map(t=>({index:n.name,kind:a(c(n.table)[t]),property:t})))}}}catch(o){return{error:o instanceof Error?o.message:String(o),info:void 0}}},I=(e,s,i)=>i===void 0?m(e,s):i.memo(`schema:${e}:${s}`,()=>m(e,s));export{I as discoverSchemaInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{discoverWorkflows as f,WORKFLOWS_FILENAME as i}from"@lunora/codegen";import{d as t}from"./discover-info-DC2MrAIM.mjs";const d=(r,s)=>{const{error:o,value:e}=t(r,s,i,f);return o===void 0?{workflows:e??[]}:{error:o,workflows:[]}};export{d as discoverWorkflowInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),s=t=>typeof t=="string"&&t.length>0;export{s as a,n as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as d,readdirSync as m}from"node:fs";import{homedir as L}from"node:os";import{join as r}from"node:path";const u=[".env",".env.local",".env.development",".env.development.local"],l=["CLOUDFLARE_API_TOKEN","CF_API_TOKEN"],f=["CLOUDFLARE_API_KEY","CF_API_KEY"],A=["CLOUDFLARE_EMAIL","CF_EMAIL"],v=new Set([...l,...f,...A]),O=/^export\s+/u,S=/\r?\n/u,p=/^(["'])(.*)\1$/u,E=t=>t!==void 0&&t.trim()!=="",C=(t,o)=>[o,t.XDG_CONFIG_HOME,r(o,"Library","Preferences"),r(o,".config"),t.APPDATA===void 0?void 0:r(t.APPDATA,"xdg.config"),r(o,"AppData","Roaming","xdg.config")].filter(s=>E(s)),I=t=>{try{return m(t).length>0}catch{return!1}},K=t=>{const o=new Set;for(const s of u){let n;try{n=d(r(t,s),"utf8")}catch{continue}for(const e of n.split(S)){const c=e.trim().replace(O,""),i=c.indexOf("=");if(c.startsWith("#")||i===-1)continue;const a=c.slice(0,i).trim(),_=c.slice(i+1).trim().replace(p,"$2");v.has(a)&&E(_)&&o.add(a)}}return o},F=(t={})=>{const o=t.env??process.env,s=t.projectRoot===void 0?new Set:K(t.projectRoot),n=e=>E(o[e])||s.has(e);return l.some(e=>n(e))||f.some(e=>n(e))&&A.some(e=>n(e))?!0:C(o,t.home??L()).some(e=>I(r(e,".wrangler","config")))};export{F as hasCloudflareCredentials};
|