@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
package/dist/index.d.ts
CHANGED
|
@@ -1,76 +1,172 @@
|
|
|
1
|
-
import { ContainerIR, WorkflowIR,
|
|
2
|
-
export type { ContainerIR, WorkflowIR } from '@lunora/codegen';
|
|
1
|
+
import { AgentIR, ContainerIR, WorkflowIR, CodegenResult } from '@lunora/codegen';
|
|
2
|
+
export type { AgentIR, ContainerIR, WorkflowIR } from '@lunora/codegen';
|
|
3
|
+
export { A as ACCENT, a as AGENT_RULES_DIR, b as AGENT_RULES_HINT, c as AGENT_RULES_HINT_ENV, type d as AgentRulesStatus, B as BADGES, e as BADGE_COLUMN_WIDTH, type f as BadgeName, type g as BadgeSpec, D as DEFAULT_DEPLOY_TARGET, L as LUNA_ART, h as LUNA_BUNNY, i as LUNA_NAME, j as LUNA_SIGNOFF, k as LUNORA_SKILL_NAMES, l as LUNORA_TAG, type m as LevelBadgeName, n as LunoraReporter, type P as PackageManager, type o as PackageManagerProbe, R as ROOT_SKILL_NAME, S as STEP_BADGE_NAMES, type p as StepBadgeName, type T as ToolchainInvocation, q as addArgsFor, r as advisoryLine, s as badgeLead, t as badgeWidth, u as claimAgentRulesHint, v as deployTargetIds, w as detectAgentRules, x as detectInstalledManagers, y as detectPackageManager, z as execArgsFor, C as installArgsFor, E as isRunnableTarget, F as lunoraLine, G as padBadge, H as paintAnswer, I as paintBadge, J as planToolchainInvocation, K as readProjectDependencies, M as readProjectDependencyNames, N as readProjectManifest, O as resolveDeployDriver, Q as runScriptArgsFor, U as runScriptCommand, V as runnableTargetIds, W as targetRunsOwnDevServer, X as toolchainExecArgs } from "./packem_shared/index.d-Cmx4jMFV.js";
|
|
4
|
+
import { ChildProcess } from 'node:child_process';
|
|
5
|
+
import { D as DiscoveryCache } from "./packem_shared/infer-bindings.d-eFzcOnRh.js";
|
|
6
|
+
export { C as COMPOSED_WORKER_ENTRY, a as DURABLE_OBJECT_BINDINGS, type b as DiscoverSchemaInfoResult, G as GENERATED_CLASS_MODULES, c as GENERATED_MODULE_DURABLE_OBJECTS, type d as GeneratedClassModule, type I as InferOptions, type e as InferredAgent, type f as InferredBindings, type g as InferredContainer, type h as InferredWorkflow, M as MERGED_DURABLE_OBJECTS_MODULE, type S as SchemaInfo, i as createDiscoveryCache, j as discoverSchemaInfo, k as inferLunoraBindings, l as isMergedProject, m as isMergedRoleModule, s as secretSourcesFromBindings } from "./packem_shared/infer-bindings.d-eFzcOnRh.js";
|
|
3
7
|
import { Writable } from 'node:stream';
|
|
4
|
-
|
|
5
|
-
export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
declare const AGENT_RULES_DIR = ".agents/skills";
|
|
12
|
-
/** Env var the once-per-process-tree hint guard ({@link claimAgentRulesHint}) sets. */
|
|
13
|
-
declare const AGENT_RULES_HINT_ENV = "LUNORA_RULES_HINT_SHOWN";
|
|
14
|
-
/**
|
|
15
|
-
* The Lunora agent skills shipped by `@lunora/cli`. The first entry (`lunora`)
|
|
16
|
-
* is the router skill — its presence is what {@link detectAgentRules} treats as
|
|
17
|
-
* "rules installed", since every other skill is reachable through it.
|
|
18
|
-
*/
|
|
19
|
-
declare const LUNORA_SKILL_NAMES: ReadonlyArray<string>;
|
|
20
|
-
/** The router skill whose presence marks the rule set as installed. */
|
|
21
|
-
declare const ROOT_SKILL_NAME = "lunora";
|
|
22
|
-
/**
|
|
23
|
-
* The single "rules not installed" message shared by every surface (the CLI
|
|
24
|
-
* `lunora dev` summary and the Vite dev plugin), so the wording and the
|
|
25
|
-
* pointer at `lunora rules install` stay identical wherever it appears.
|
|
26
|
-
*/
|
|
27
|
-
declare const AGENT_RULES_HINT = "Lunora AI rules not installed — run `lunora rules install` so your coding agent knows how to use Lunora.";
|
|
28
|
-
/**
|
|
29
|
-
* Process-tree guard so the hint is emitted at most once. The first surface to
|
|
30
|
-
* print it sets {@link AGENT_RULES_HINT_ENV} on `process.env`; later surfaces (a
|
|
31
|
-
* Vite dev-server restart, or a child process that inherited the env) read it
|
|
32
|
-
* and stay quiet. Returns `true` the first time, `false` afterwards.
|
|
33
|
-
*/
|
|
34
|
-
declare const claimAgentRulesHint: () => boolean;
|
|
35
|
-
interface AgentRulesStatus {
|
|
36
|
-
/**
|
|
37
|
-
* True when the `lunora` router skill is installed. We key on the router
|
|
38
|
-
* (not "all nine present") so a project that intentionally trims the set
|
|
39
|
-
* still counts as installed and isn't nagged.
|
|
40
|
-
*/
|
|
41
|
-
readonly installed: boolean;
|
|
42
|
-
/** Skill names with no `SKILL.md` under `<root>/.agents/skills/<name>/`. */
|
|
43
|
-
readonly missing: ReadonlyArray<string>;
|
|
44
|
-
/** Skill names found under `<root>/.agents/skills/<name>/SKILL.md`. */
|
|
45
|
-
readonly present: ReadonlyArray<string>;
|
|
8
|
+
export type { D as DeployDriver, a as DeployRequest, b as DevRequest, c as DriverToolchain, P as ProjectedConfig, d as ProjectionPurpose, S as SecretRequest, T as TailRequest, e as ToolchainCommand } from "./packem_shared/deploy-driver.d-Cl96-c1l.js";
|
|
9
|
+
export { type A as AdditivePolicyEdit, type D as DestructivePolicyEdit, type P as PolicyEdit, type a as PolicyScaffoldFailureReason, type b as ScaffoldFileResult, type S as ScaffoldPolicyEdit, type c as WireResult, type W as WireRlsEdit, d as classifyPolicyEdit, r as resolveServerModule, s as scaffoldPolicyFile, w as wireRlsIntoProcedure } from "./packem_shared/policy-scaffold.d-D2H4_G01.js";
|
|
10
|
+
interface DiscoverAgentInfoResult {
|
|
11
|
+
/** Discovered agent definitions; `[]` when none are declared or parsing failed. */
|
|
12
|
+
agents: ReadonlyArray<AgentIR>;
|
|
13
|
+
/** Parse error message, when `lunora/agents.ts` exists but could not be analyzed. */
|
|
14
|
+
error?: string;
|
|
46
15
|
}
|
|
47
16
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
declare const detectAgentRules: (projectRoot: string) => AgentRulesStatus;
|
|
17
|
+
* Discover the project's `defineAgent` declarations. Returns `{ agents: [] }`
|
|
18
|
+
* when the project has no `lunora/agents.ts` (not an error), or
|
|
19
|
+
* `{ agents: [], error }` when the file exists but could not be parsed — callers
|
|
20
|
+
* decide whether that is a warning (validator) or ignorable (inference).
|
|
21
|
+
*/
|
|
22
|
+
declare const discoverAgentInfo: (projectRoot: string, schemaDirectory: string) => DiscoverAgentInfoResult;
|
|
55
23
|
interface DiscoverContainerInfoResult {
|
|
56
24
|
/** Discovered container definitions; `[]` when none are declared or parsing failed. */
|
|
57
25
|
containers: ReadonlyArray<ContainerIR>;
|
|
58
26
|
/** Parse error message, when `lunora/containers.ts` exists but could not be analyzed. */
|
|
59
27
|
error?: string;
|
|
60
28
|
}
|
|
29
|
+
/** Discover the container facts, memoised on `cache` when one is given. */
|
|
30
|
+
declare const discoverContainerInfo: (projectRoot: string, schemaDirectory: string, cache?: DiscoveryCache) => DiscoverContainerInfoResult;
|
|
31
|
+
interface DiscoverWorkflowInfoResult {
|
|
32
|
+
/** Parse error message, when `lunora/workflows.ts` exists but could not be analyzed. */
|
|
33
|
+
error?: string;
|
|
34
|
+
/** Discovered workflow definitions; `[]` when none are declared or parsing failed. */
|
|
35
|
+
workflows: ReadonlyArray<WorkflowIR>;
|
|
36
|
+
}
|
|
61
37
|
/**
|
|
62
|
-
* Discover the project's `
|
|
63
|
-
* `{
|
|
64
|
-
* error), or `{
|
|
65
|
-
* parsed — callers decide whether that is a warning (validator) or ignorable
|
|
66
|
-
* (inference).
|
|
67
|
-
*/
|
|
68
|
-
declare const
|
|
38
|
+
* Discover the project's `defineWorkflow` declarations. Returns
|
|
39
|
+
* `{ workflows: [] }` when the project has no `lunora/workflows.ts` (not an
|
|
40
|
+
* error), or `{ workflows: [], error }` when the file exists but could not be
|
|
41
|
+
* parsed — callers decide whether that is a warning (validator) or ignorable
|
|
42
|
+
* (inference).
|
|
43
|
+
*/
|
|
44
|
+
declare const discoverWorkflowInfo: (projectRoot: string, schemaDirectory: string) => DiscoverWorkflowInfoResult;
|
|
45
|
+
/** Minimal env shape — `process.env` structurally, injectable for tests. */
|
|
46
|
+
type EnvLike = Readonly<Record<string, string | undefined>>;
|
|
47
|
+
/** One detected agent: which tool, and which env var gave it away. */
|
|
48
|
+
interface AgentDetection {
|
|
49
|
+
/** Human-readable agent name, for the "agent detected" log line. */
|
|
50
|
+
name: string;
|
|
51
|
+
/** The environment variable that matched. */
|
|
52
|
+
variable: string;
|
|
53
|
+
}
|
|
54
|
+
/** Env var that forces agent mode on (`1`/`true`) or off (`0`/`false`), overriding detection. */
|
|
55
|
+
declare const AGENT_MODE_ENV = "LUNORA_AGENT_MODE";
|
|
56
|
+
/**
|
|
57
|
+
* Detect the AI agent driving this process, or `undefined` when none is.
|
|
58
|
+
* `LUNORA_AGENT_MODE` wins over `@visulima/find-ai-runner`'s marker table in
|
|
59
|
+
* both directions. Pure — pass a custom `env` in tests.
|
|
60
|
+
*/
|
|
61
|
+
declare const detectAiAgent: (env?: EnvLike) => AgentDetection | undefined;
|
|
62
|
+
/** Spawns the process — injectable so tests run without the binary. */
|
|
63
|
+
type DevProcessSpawner = (command: string, args: ReadonlyArray<string>, options: {
|
|
64
|
+
cwd: string;
|
|
65
|
+
shell: boolean;
|
|
66
|
+
}) => ChildProcess;
|
|
67
|
+
interface DevProcessOptions {
|
|
68
|
+
args: ReadonlyArray<string>;
|
|
69
|
+
command: string;
|
|
70
|
+
cwd: string;
|
|
71
|
+
/** Names the process in errors, e.g. `wrangler dev`. */
|
|
72
|
+
label: string;
|
|
73
|
+
/** The error when `command` is not on PATH, naming the fix. */
|
|
74
|
+
notFound: string;
|
|
75
|
+
/** One line of output; the remainder after the last newline is flushed when the stream ends. */
|
|
76
|
+
onLine: (line: string, stream: "stderr" | "stdout") => void;
|
|
77
|
+
port: number;
|
|
78
|
+
readyTimeoutMs: number;
|
|
79
|
+
/** Windows `.cmd` shims only launch through a shell. */
|
|
80
|
+
shell?: boolean;
|
|
81
|
+
/** Aborting it stops the process while it is still starting; the start then rejects. */
|
|
82
|
+
signal?: AbortSignal;
|
|
83
|
+
spawn?: DevProcessSpawner;
|
|
84
|
+
}
|
|
85
|
+
interface DevProcess {
|
|
86
|
+
/** Resolves with the exit code when the process exits without {@link DevProcess.stop} asking it to. */
|
|
87
|
+
crashed: Promise<number>;
|
|
88
|
+
/** Terminate it; resolves once it has exited. */
|
|
89
|
+
stop: () => Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
/** `true` once something accepts a TCP connection on `port`. */
|
|
92
|
+
declare const acceptsConnection: (port: number) => Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Spawn the process and resolve once it accepts connections on `port`; reject,
|
|
95
|
+
* with the process stopped, when it cannot be spawned, exits first, or misses
|
|
96
|
+
* the deadline. The caller checks the port is free beforehand: the probe cannot
|
|
97
|
+
* tell this process from another one already listening there.
|
|
98
|
+
*/
|
|
99
|
+
declare const startDevProcess: (options: DevProcessOptions) => Promise<DevProcess>;
|
|
100
|
+
/**
|
|
101
|
+
* Where a line came from: `celld` (the app, and the session's own notices) or
|
|
102
|
+
* `celld:<worker>`, and `stderr` for a session notice that reports a failure.
|
|
103
|
+
*/
|
|
104
|
+
interface CelldLineOrigin {
|
|
105
|
+
stream: "stderr" | "stdout";
|
|
106
|
+
tag: string;
|
|
107
|
+
}
|
|
108
|
+
interface CelldDevSessionOptions {
|
|
109
|
+
/** Prints one non-empty line of the session's output. */
|
|
110
|
+
log: (line: string, origin: CelldLineOrigin) => void;
|
|
111
|
+
/** Port the app serves on. */
|
|
112
|
+
port: number;
|
|
113
|
+
projectRoot: string;
|
|
114
|
+
spawn?: DevProcessSpawner;
|
|
115
|
+
}
|
|
116
|
+
interface CelldDevSession {
|
|
117
|
+
/**
|
|
118
|
+
* Resolves with an exit code once the app is gone without {@link CelldDevSession.stop}
|
|
119
|
+
* asking: its `celld dev` crashed, or did not come back after a restart.
|
|
120
|
+
*/
|
|
121
|
+
exited: Promise<number>;
|
|
122
|
+
/** Stop watching, cut short a restart in flight, then stop the app. */
|
|
123
|
+
stop: () => Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Start the session: register every service, run the app, then watch the
|
|
127
|
+
* service folders. Resolves once the app accepts connections; rejects, with
|
|
128
|
+
* nothing left running, when a service or the app cannot start — including an
|
|
129
|
+
* app `celld dev` cannot run at all (a Vite virtual `main`).
|
|
130
|
+
*/
|
|
131
|
+
declare const startCelldDevSession: (options: CelldDevSessionOptions) => Promise<CelldDevSession>;
|
|
132
|
+
/**
|
|
133
|
+
* The environment switch that turns codegen off — the other spelling of
|
|
134
|
+
* `lunora dev --no-codegen`.
|
|
135
|
+
*
|
|
136
|
+
* The flag alone could not reach the Vite flavors: there the codegen watch lives
|
|
137
|
+
* in `@lunora/vite`, inside the framework dev server the CLI spawns as a separate
|
|
138
|
+
* process, which re-parses its own argv and never sees it. So the flag travels as
|
|
139
|
+
* this variable, and both the plugin and the CLI's own watcher read it — one
|
|
140
|
+
* switch, one meaning, every flavor.
|
|
141
|
+
*
|
|
142
|
+
* It is a DEV switch. `vite build` ignores it deliberately: skipping generation
|
|
143
|
+
* there would also skip the ERROR-level advisory gate that fails the build.
|
|
144
|
+
*
|
|
145
|
+
* One-directional, like `LUNORA_REMOTE`: it can turn codegen off, nothing turns
|
|
146
|
+
* it back on. Settable by hand for a project that runs its framework dev script
|
|
147
|
+
* directly rather than through `lunora dev`.
|
|
148
|
+
*/
|
|
149
|
+
/** Env var that turns codegen off when it spells `0` / `false`. Unset means on. */
|
|
150
|
+
declare const CODEGEN_ENV = "LUNORA_CODEGEN";
|
|
151
|
+
/** Env var that enables lazy function imports for codegen when it spells `1` / `true`. */
|
|
152
|
+
declare const LAZY_FUNCTIONS_ENV = "LUNORA_LAZY_FUNCTIONS";
|
|
153
|
+
/**
|
|
154
|
+
* Whether a {@link CODEGEN_ENV} value spells an explicit "off".
|
|
155
|
+
*
|
|
156
|
+
* Takes the VALUE, not the environment, mirroring `isRemoteEnvEnabled` in
|
|
157
|
+
* `./cloudflare/remote-bindings` — the same package's existing answer to the same
|
|
158
|
+
* question, with the opposite polarity.
|
|
159
|
+
*/
|
|
160
|
+
declare const isCodegenDisabled: (value: string | undefined) => boolean;
|
|
161
|
+
/** Whether a {@link LAZY_FUNCTIONS_ENV} value explicitly opts into lazy imports. */
|
|
162
|
+
declare const isLazyFunctionsEnabled: (value: string | undefined) => boolean;
|
|
163
|
+
/** Either opt-in enables lazy function imports: the explicit option or {@link LAZY_FUNCTIONS_ENV}. `false` does not veto the environment. */
|
|
164
|
+
declare const resolveLazyFunctions: (flag?: boolean) => boolean;
|
|
69
165
|
/** Severity a container output line is surfaced at: `stderr` → `error`, `stdout` → `info`. */
|
|
70
166
|
type ContainerLogLevel = "error" | "info";
|
|
71
167
|
/** One declared container to follow, identified by the names codegen lifts from `defineContainer`. */
|
|
72
168
|
interface ContainerLogSource {
|
|
73
|
-
/** Generated Durable Object class name, e.g. `TranscoderContainer`. Wrangler's dev image is `cloudflare-dev
|
|
169
|
+
/** Generated Durable Object class name, e.g. `TranscoderContainer`. Wrangler's dev image is `cloudflare-dev/<lowercased>`. */
|
|
74
170
|
className: string;
|
|
75
171
|
/** The `lunora/containers.ts` export name, e.g. `transcoder` — used as the display tag. */
|
|
76
172
|
exportName: string;
|
|
@@ -130,25 +226,25 @@ interface DockerLike {
|
|
|
130
226
|
};
|
|
131
227
|
}
|
|
132
228
|
/**
|
|
133
|
-
* Follow the local Docker logs of every declared container, emitting each output
|
|
134
|
-
* line through `onLine` tagged with its export name. Polls for containers (they
|
|
135
|
-
* start lazily on first request and may be replaced on restart), attaches once
|
|
136
|
-
* per container id, and drops streams whose container has gone. Returns
|
|
137
|
-
* immediately with a `close()` handle; all work happens asynchronously.
|
|
138
|
-
*/
|
|
229
|
+
* Follow the local Docker logs of every declared container, emitting each output
|
|
230
|
+
* line through `onLine` tagged with its export name. Polls for containers (they
|
|
231
|
+
* start lazily on first request and may be replaced on restart), attaches once
|
|
232
|
+
* per container id, and drops streams whose container has gone. Returns
|
|
233
|
+
* immediately with a `close()` handle; all work happens asynchronously.
|
|
234
|
+
*/
|
|
139
235
|
declare const streamContainerLogs: (options: ContainerLogStreamOptions) => ContainerLogStreamHandle;
|
|
140
236
|
/**
|
|
141
|
-
* The meta-frameworks Lunora can compose with, plus `"none"` for a standalone
|
|
142
|
-
* SPA / SSR-less project (the current default). Mirrors PLAN4 §2.4.
|
|
143
|
-
*/
|
|
144
|
-
type DetectedFramework = "astro" | "none" | "nuxt" | "react-router" | "solid-start" | "sveltekit" | "tanstack-start" | "tanstack-start-solid";
|
|
145
|
-
/**
|
|
146
|
-
* void's class model (PLAN4 §3). Class A is Vite-native and Lunora owns the
|
|
147
|
-
* worker entry (`createWorker({ httpRouter })`). Class B frameworks own their own
|
|
148
|
-
* Cloudflare adapter, so Lunora injects its worker composition into the
|
|
149
|
-
* framework's server entry via hooks (PLAN4 M4). Class C is non-CF / SSR-less —
|
|
150
|
-
* ship the client adapter + a standalone Lunora worker (today's default).
|
|
151
|
-
*/
|
|
237
|
+
* The meta-frameworks Lunora can compose with, plus `"none"` for a standalone
|
|
238
|
+
* SPA / SSR-less project (the current default). Mirrors PLAN4 §2.4.
|
|
239
|
+
*/
|
|
240
|
+
type DetectedFramework = "astro" | "none" | "nuxt" | "react-router" | "solid-start" | "sveltekit" | "tanstack-start" | "tanstack-start-solid" | "vinext";
|
|
241
|
+
/**
|
|
242
|
+
* void's class model (PLAN4 §3). Class A is Vite-native and Lunora owns the
|
|
243
|
+
* worker entry (`createWorker({ httpRouter })`). Class B frameworks own their own
|
|
244
|
+
* Cloudflare adapter, so Lunora injects its worker composition into the
|
|
245
|
+
* framework's server entry via hooks (PLAN4 M4). Class C is non-CF / SSR-less —
|
|
246
|
+
* ship the client adapter + a standalone Lunora worker (today's default).
|
|
247
|
+
*/
|
|
152
248
|
type FrameworkClass = "A" | "B" | "C";
|
|
153
249
|
interface FrameworkDetection {
|
|
154
250
|
/** void's composition class for the detected framework. */
|
|
@@ -157,170 +253,279 @@ interface FrameworkDetection {
|
|
|
157
253
|
framework: DetectedFramework;
|
|
158
254
|
}
|
|
159
255
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
|
|
256
|
+
* Whether the project depends on the unscoped `lunorash` umbrella rather than
|
|
257
|
+
* the granular `@lunora/*` packages.
|
|
258
|
+
*
|
|
259
|
+
* Every generator that writes an import INTO the user's project has to ask:
|
|
260
|
+
* an umbrella-only install — the default for every starter template — never
|
|
261
|
+
* installs `@lunora/server`, so under pnpm's strict layout a scaffolded
|
|
262
|
+
* `from "@lunora/server"` is unresolvable and the worker stops bundling.
|
|
263
|
+
* Codegen answers the same question from its own dependency set
|
|
264
|
+
* (`dependencies.has("lunorash")`); this is that answer for every consumer
|
|
265
|
+
* that has only a project root.
|
|
266
|
+
*/
|
|
267
|
+
declare const projectUsesUmbrella: (root: string) => boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Detect which meta-framework a project uses by inspecting its `package.json`
|
|
270
|
+
* dependencies, and classify it under void's class-A/B/C model (PLAN4 §3).
|
|
271
|
+
*
|
|
272
|
+
* Pure and best-effort: never throws. An unknown / missing / malformed
|
|
273
|
+
* `package.json` yields `{ framework: "none", class: "C" }` so the standalone
|
|
274
|
+
* SPA flow is preserved.
|
|
275
|
+
*/
|
|
167
276
|
declare const detectFramework: (root: string) => FrameworkDetection;
|
|
277
|
+
/** Directory holding per-checkout Lunora state (gitignored by convention). */
|
|
278
|
+
declare const DEV_STATE_DIR = ".lunora";
|
|
279
|
+
/** The dev-server state filename, relative to the project root. */
|
|
280
|
+
declare const DEV_STATE_FILE: string;
|
|
281
|
+
/** Log file a backgrounded dev server's output is captured to, relative to the project root. */
|
|
282
|
+
declare const DEV_LOG_FILE: string;
|
|
283
|
+
/**
|
|
284
|
+
* Where `lunora dev` writes the binding manifest by default, relative to the
|
|
285
|
+
* project root.
|
|
286
|
+
*
|
|
287
|
+
* A fixed path so a supervisor can read it without being told one, and next to
|
|
288
|
+
* the state record because the two are read together: this says what the Worker
|
|
289
|
+
* needs and where it will serve, `dev.json` says whether it is serving yet.
|
|
290
|
+
*/
|
|
291
|
+
declare const DEV_BINDINGS_FILE: string;
|
|
292
|
+
/**
|
|
293
|
+
* Marker env `lunora dev --background` sets on the detached server process
|
|
294
|
+
* (the daemon `lunora dev` or `vite dev`), so it records itself as
|
|
295
|
+
* `background: true` — and, for the CLI daemon, never re-detects an agent and
|
|
296
|
+
* recurses into background mode again.
|
|
297
|
+
*/
|
|
298
|
+
declare const DEV_DAEMON_ENV = "LUNORA_DEV_DAEMON";
|
|
299
|
+
/** Env carrying the capture-log path into the detached server, recorded in the state file. */
|
|
300
|
+
declare const DEV_LOG_FILE_ENV = "LUNORA_DEV_LOG_FILE";
|
|
301
|
+
/**
|
|
302
|
+
* Env carrying the PID of a parent that holds a *provisional* state record it
|
|
303
|
+
* expects the child dev server to supersede. The CLI claims `.lunora/dev.json`
|
|
304
|
+
* with its own PID before spawning the real server (closing the duplicate-start
|
|
305
|
+
* race for the vite flavor and the wrangler daemon), then hands its PID down
|
|
306
|
+
* via this variable; the child's claim (see {@link claimDevServerState}'s
|
|
307
|
+
* `supersedePid`) may replace exactly that record with the authoritative
|
|
308
|
+
* URL + PID.
|
|
309
|
+
*/
|
|
310
|
+
declare const DEV_HANDOFF_ENV = "LUNORA_DEV_HANDOFF_PID";
|
|
311
|
+
/** How the recorded dev server runs. */
|
|
312
|
+
type DevServerMode = "cli" | "vite";
|
|
313
|
+
/** The state record persisted to `.lunora/dev.json`. */
|
|
314
|
+
interface DevServerState {
|
|
315
|
+
/** Whether the server was detached into the background (`lunora dev --background`). */
|
|
316
|
+
background?: boolean;
|
|
317
|
+
/** Absolute path of the log file capturing the server's output, when captured. */
|
|
318
|
+
logFile?: string;
|
|
319
|
+
/** `"cli"` for the `lunora dev` wrangler orchestration, `"vite"` for a Vite dev server. */
|
|
320
|
+
mode: DevServerMode;
|
|
321
|
+
/** PID of the process to signal for shutdown (the orchestrating CLI or the Vite process). */
|
|
322
|
+
pid: number;
|
|
323
|
+
/**
|
|
324
|
+
* ISO-8601 stamp marking when the server at {@link DevServerState.url} was
|
|
325
|
+
* first observed accepting requests — absent until then.
|
|
326
|
+
*
|
|
327
|
+
* The rest of this record exists as soon as the server is STARTING: `url` is
|
|
328
|
+
* the origin it intends to serve on and `pid` is a process that exists, both
|
|
329
|
+
* written before anything is listening. That is enough to find and stop a
|
|
330
|
+
* server, and not enough for a task runner deciding when to start the next
|
|
331
|
+
* thing — which is what this field is for. Poll it rather than sleeping.
|
|
332
|
+
*
|
|
333
|
+
* Deliberately a claim about `url` and nothing else. `lunora dev` observes it
|
|
334
|
+
* by probing; `@lunora/vite` observes it from the listen callback, since its
|
|
335
|
+
* record is only written once Vite has resolved that URL. Both are honest
|
|
336
|
+
* about the one origin this record advertises — neither says anything about a
|
|
337
|
+
* sidecar on another port.
|
|
338
|
+
*
|
|
339
|
+
* Absent forever is a legitimate outcome: a server that never binds, or one
|
|
340
|
+
* slower than the probe was willing to wait. Treat missing as "not ready
|
|
341
|
+
* yet", never as "will never be ready".
|
|
342
|
+
*/
|
|
343
|
+
readyAt?: string;
|
|
344
|
+
/** ISO-8601 stamp written at startup, purely informational (drives `status` uptime). */
|
|
345
|
+
startedAt?: string;
|
|
346
|
+
/** The embedded studio server's URL, when it runs. */
|
|
347
|
+
studioUrl?: string;
|
|
348
|
+
/**
|
|
349
|
+
* The public quick-tunnel URL `lunora dev --tunnel` was assigned, once
|
|
350
|
+
* cloudflared reports it — absent without `--tunnel`, before the URL
|
|
351
|
+
* arrives, and after the tunnel closes. Lets a `--background` start and
|
|
352
|
+
* `lunora dev status` show a URL that otherwise only reaches the log.
|
|
353
|
+
*/
|
|
354
|
+
tunnelUrl?: string;
|
|
355
|
+
/** The primary URL serving the worker/app. */
|
|
356
|
+
url: string;
|
|
357
|
+
}
|
|
168
358
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
|
|
359
|
+
* True when a process with `pid` is currently alive AND signalable by this
|
|
360
|
+
* user. Signal `0` performs the existence check without delivering anything.
|
|
361
|
+
*
|
|
362
|
+
* `EPERM` ("alive but another user's process") deliberately counts as NOT
|
|
363
|
+
* alive here: every dev server this module tracks was spawned by the current
|
|
364
|
+
* user, so a PID we cannot signal is by definition a recycled PID — treating
|
|
365
|
+
* it as running would wedge the lockfile permanently and aim `dev stop`'s
|
|
366
|
+
* kill escalation at an innocent process.
|
|
367
|
+
*/
|
|
368
|
+
declare const isProcessAlive: (pid: number) => boolean;
|
|
369
|
+
/**
|
|
370
|
+
* True when the record's PID verifiably still refers to the dev server that
|
|
371
|
+
* wrote the record — not merely "some process exists with that number".
|
|
372
|
+
* Guards against PID reuse: a server process necessarily starts BEFORE its
|
|
373
|
+
* record is written, so a process that started after `startedAt` (+ skew) is
|
|
374
|
+
* a recycled PID wearing the corpse's number. The start-time check runs only
|
|
375
|
+
* where the platform exposes it (Linux); elsewhere liveness alone decides.
|
|
376
|
+
*/
|
|
377
|
+
declare const isRecordedProcessCurrent: (state: DevServerState) => boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Read the state record from `.lunora/dev.json`, or `undefined` when there is
|
|
380
|
+
* no usable record. Best-effort; performs NO liveness check — use
|
|
381
|
+
* {@link readLiveDevServerState} for "is a dev server actually running".
|
|
382
|
+
*/
|
|
383
|
+
declare const readDevServerState: (projectRoot: string) => DevServerState | undefined;
|
|
384
|
+
/**
|
|
385
|
+
* Write the state record to `.lunora/dev.json`, creating the `.lunora/`
|
|
386
|
+
* directory when absent. Returns the absolute path written, or `undefined`
|
|
387
|
+
* when the write failed (state is convenience metadata — a read-only checkout
|
|
388
|
+
* must never crash dev startup).
|
|
389
|
+
*/
|
|
390
|
+
declare const writeDevServerState: (projectRoot: string, state: DevServerState) => string | undefined;
|
|
391
|
+
/**
|
|
392
|
+
* Merge `patch` into the existing state record, when one exists. Used by the
|
|
393
|
+
* CLI to stamp `background`/`logFile` onto the record the Vite plugin wrote.
|
|
394
|
+
* Returns the merged record, or `undefined` when there was nothing to update.
|
|
395
|
+
*
|
|
396
|
+
* Pass `expectedPid` to patch only while the record still belongs to that
|
|
397
|
+
* process — the counterpart to {@link clearDevServerState}'s guard, and needed
|
|
398
|
+
* by any patch that can land LATE. A readiness stamp is the case in point: this
|
|
399
|
+
* process's server can answer after a newer one has replaced the record, and an
|
|
400
|
+
* unguarded merge would mark that newer server ready on the old one's behalf.
|
|
401
|
+
*/
|
|
402
|
+
declare const updateDevServerState: (projectRoot: string, patch: Partial<DevServerState>, options?: {
|
|
403
|
+
expectedPid?: number;
|
|
404
|
+
}) => DevServerState | undefined;
|
|
405
|
+
/**
|
|
406
|
+
* Whether a record reports a server that is accepting requests, as opposed to
|
|
407
|
+
* one that has merely started. Lives here so the CLI's `status`, its JSON
|
|
408
|
+
* output, and any future reader cannot each invent their own answer.
|
|
409
|
+
*/
|
|
410
|
+
declare const isDevServerReady: (state: Pick<DevServerState, "readyAt"> | undefined) => boolean;
|
|
411
|
+
/**
|
|
412
|
+
* Remove `.lunora/dev.json`. Idempotent and never throws. When `expectedPid`
|
|
413
|
+
* is given, the file is only removed while it still records that PID — so a
|
|
414
|
+
* shutting-down server can't clobber the record a newer server just wrote.
|
|
415
|
+
*/
|
|
416
|
+
declare const clearDevServerState: (projectRoot: string, expectedPid?: number) => void;
|
|
417
|
+
/**
|
|
418
|
+
* The state record of a dev server that is verifiably running right now, or
|
|
419
|
+
* `undefined`. A record whose PID is dead — or recycled onto a different
|
|
420
|
+
* process (see {@link isRecordedProcessCurrent}) — is stale: it is cleared on
|
|
421
|
+
* the spot so subsequent starts don't keep re-reading a corpse.
|
|
422
|
+
*/
|
|
423
|
+
declare const readLiveDevServerState: (projectRoot: string) => DevServerState | undefined;
|
|
424
|
+
/** Result of {@link claimDevServerState}: claimed, or lost to the live server already recorded. */
|
|
425
|
+
interface ClaimDevServerStateResult {
|
|
426
|
+
/** The live record that won the race, when `ok` is `false`. */
|
|
427
|
+
existing?: DevServerState;
|
|
428
|
+
/** Whether this process now owns the record. */
|
|
429
|
+
ok: boolean;
|
|
430
|
+
}
|
|
431
|
+
declare const claimDevServerState: (projectRoot: string, state: DevServerState, options?: {
|
|
432
|
+
supersedePid?: number;
|
|
433
|
+
}) => ClaimDevServerStateResult;
|
|
176
434
|
/** The conventional filename for local Cloudflare dev secrets (gitignored). */
|
|
177
435
|
declare const DEV_VARS_FILE: string;
|
|
178
436
|
/** Its committed, secret-free counterpart that scaffolding reads from. */
|
|
179
437
|
declare const DEV_VARS_EXAMPLE_FILE: string;
|
|
180
|
-
/**
|
|
438
|
+
/**
|
|
439
|
+
* A bare `KEY` identifier accepted on the **write** path — `lunora env set`,
|
|
440
|
+
* `env unset`, `env generate`, and {@link upsertDevVariableLine}'s line
|
|
441
|
+
* targeting. Deliberately stricter than what the reader accepts: dotenv keys
|
|
442
|
+
* are `[\w.-]+`, but a key we *write* stays a conventional env-var name so it
|
|
443
|
+
* needs no quoting and round-trips through every consumer. Never use this to
|
|
444
|
+
* decide whether a line in an existing file counts — that is the reader's job.
|
|
445
|
+
*/
|
|
181
446
|
declare const DEV_VARS_KEY_PATTERN: RegExp;
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
|
|
447
|
+
/**
|
|
448
|
+
* Parse `.dev.vars` content into its `{ key, value }` entries, in file order.
|
|
449
|
+
*
|
|
450
|
+
* Delegates to dotenv's own `parse()` — the literal function `wrangler dev` /
|
|
451
|
+
* `@cloudflare/vite-plugin` run over this file before handing the variables to
|
|
452
|
+
* the worker. Using the library rather than a compatible reimplementation is
|
|
453
|
+
* the point: every line the worker sees, Lunora reads identically, including
|
|
454
|
+
* `export `-prefixed lines, dotted/dashed keys, `KEY: value` separators,
|
|
455
|
+
* quote stripping (single/double/backtick), `\n`/`\r` expansion inside double
|
|
456
|
+
* quotes, `#` comments ending unquoted values, and multi-line quoted values.
|
|
457
|
+
* Duplicate keys resolve last-wins, at the key's first position — dotenv
|
|
458
|
+
* returns an object, so a repeated key overwrites in place.
|
|
459
|
+
*
|
|
460
|
+
* The canonical read of the whole file: every reader of `.dev.vars` (and of
|
|
461
|
+
* `.dev.vars.example`) goes through here or through {@link
|
|
462
|
+
* parseDevVariableLine} below, so the format cannot drift between packages.
|
|
463
|
+
*/
|
|
190
464
|
declare const parseDevVariableEntries: (content: string) => {
|
|
191
465
|
key: string;
|
|
192
466
|
value: string;
|
|
193
467
|
}[];
|
|
194
|
-
interface DiscoverWorkflowInfoResult {
|
|
195
|
-
/** Parse error message, when `lunora/workflows.ts` exists but could not be analyzed. */
|
|
196
|
-
error?: string;
|
|
197
|
-
/** Discovered workflow definitions; `[]` when none are declared or parsing failed. */
|
|
198
|
-
workflows: ReadonlyArray<WorkflowIR>;
|
|
199
|
-
}
|
|
200
468
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
* un-mintable `app_id`, so it is reconciled as a hint, not auto-written.
|
|
248
|
-
*/
|
|
249
|
-
flagshipBinding?: string;
|
|
250
|
-
/** Schema declares a `.global()` table → needs the `DB` D1 binding. */
|
|
251
|
-
needsD1: boolean;
|
|
252
|
-
/** Queues declared in `lunora/queues.ts` → reconciled into `queues.producers[]` / `queues.consumers[]`. */
|
|
253
|
-
queues: InferredQueue[];
|
|
254
|
-
/** Human-readable provenance for each inferred binding / hint, for logging. */
|
|
255
|
-
signals: string[];
|
|
256
|
-
/** `@lunora/ai` is imported or `env.AI` is used → needs the `ai` Workers AI binding. */
|
|
257
|
-
usesAi: boolean;
|
|
258
|
-
/** `@lunora/bindings/analytics` is imported → self-describing `analytics_engine_datasets` binding (auto-writeable). */
|
|
259
|
-
usesAnalytics: boolean;
|
|
260
|
-
/** `@lunora/auth` is imported (sessions may be D1- or `SessionDO`-backed). */
|
|
261
|
-
usesAuth: boolean;
|
|
262
|
-
/** `@lunora/browser` is imported → self-describing `browser` binding (auto-writeable). */
|
|
263
|
-
usesBrowser: boolean;
|
|
264
|
-
/** `lunora/flags.ts` declares a feature-flag provider (any OpenFeature provider — Flagship or custom). */
|
|
265
|
-
usesFlags: boolean;
|
|
266
|
-
/** `@lunora/hyperdrive` is imported (binding needs an un-mintable remote `id`; hint-only). */
|
|
267
|
-
usesHyperdrive: boolean;
|
|
268
|
-
/** `@lunora/bindings/images` is imported → self-describing `images` binding (auto-writeable). */
|
|
269
|
-
usesImages: boolean;
|
|
270
|
-
/** `@lunora/bindings/kv` is imported (namespace binding name + id are user-defined; hint-only). */
|
|
271
|
-
usesKv: boolean;
|
|
272
|
-
/** `@lunora/mail` is imported (Resend API key must be set in `.dev.vars`; no binding). */
|
|
273
|
-
usesMail: boolean;
|
|
274
|
-
/** `@lunora/payment` is imported (provider secrets must be set in `.dev.vars`; no binding). */
|
|
275
|
-
usesPayment: boolean;
|
|
276
|
-
/** `ctx.pipelines` is used (binding needs an un-mintable remote pipeline name; hint-only). */
|
|
277
|
-
usesPipelines: boolean;
|
|
278
|
-
/** `@lunora/scheduler` is imported. */
|
|
279
|
-
usesScheduler: boolean;
|
|
280
|
-
/** `@lunora/storage` is imported (R2 bucket binding name is user-defined). */
|
|
281
|
-
usesStorage: boolean;
|
|
282
|
-
/** Workflows declared in `lunora/workflows.ts` (exported or not — see {@link InferredWorkflow.exported}). */
|
|
283
|
-
workflows: InferredWorkflow[];
|
|
284
|
-
}
|
|
285
|
-
interface InferOptions {
|
|
286
|
-
projectRoot: string;
|
|
287
|
-
/** Directories (relative to root) to scan. Defaults to `lunora` + `src`. */
|
|
288
|
-
scanDirs?: ReadonlyArray<string>;
|
|
289
|
-
/** Lunora source directory holding `schema.ts`. Defaults to `lunora`. */
|
|
290
|
-
schemaDir?: string;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Scan a Lunora project and report which Cloudflare bindings its code implies.
|
|
294
|
-
* Read-only: performs no writes. Binding provisioning is driven by the worker
|
|
295
|
-
* entry's Durable Object exports plus the schema's D1 need; capability imports
|
|
296
|
-
* surface as hints.
|
|
297
|
-
*/
|
|
298
|
-
declare const inferLunoraBindings: (options: InferOptions) => Promise<InferredBindings>;
|
|
299
|
-
/**
|
|
300
|
-
* Derive the list of `@lunora/*` package names that are actively used by a
|
|
301
|
-
* project, based on its already-resolved {@link InferredBindings}.
|
|
302
|
-
*
|
|
303
|
-
* This is the canonical bridge between binding inference and the package-aware
|
|
304
|
-
* `.dev.vars.example` scaffolding in `scaffold-dev-variables.ts`. The result is
|
|
305
|
-
* a stable, predictable slice of {@link CAPABILITY_SOURCES} source values,
|
|
306
|
-
* filtered to the flags that are `true` in `bindings` — in CAPABILITY_SOURCES
|
|
307
|
-
* declaration order.
|
|
308
|
-
*/
|
|
309
|
-
declare const packageNamesFromBindings: (bindings: InferredBindings) => string[];
|
|
469
|
+
* Escape a runtime string for safe literal interpolation into a `RegExp`
|
|
470
|
+
* source. The one canonical implementation — `@lunora/config`'s own
|
|
471
|
+
* `infer-bindings.ts` (type-only-export detection) and `@lunora/cli`'s `env`
|
|
472
|
+
* command both need this and used to carry their own (functionally
|
|
473
|
+
* identical) copy; grammar this fundamental gets one owner like everything
|
|
474
|
+
* else in this module.
|
|
475
|
+
*/
|
|
476
|
+
declare const escapeRegExp: (value: string) => string;
|
|
477
|
+
/**
|
|
478
|
+
* Surgically upsert a single `KEY="value"` line in raw `.dev.vars` content,
|
|
479
|
+
* leaving every comment, blank line, and untouched entry verbatim. Rebuilding
|
|
480
|
+
* the whole file from the parsed entry map (an earlier approach) silently
|
|
481
|
+
* dropped all `# …` comments and blank lines — including the documentation the
|
|
482
|
+
* registry installer and scaffolder write — and re-quoted lines the user never
|
|
483
|
+
* touched. If the key already has a line it is replaced in place; otherwise the
|
|
484
|
+
* new line is appended with a single trailing newline. Always quotes the value
|
|
485
|
+
* to preserve a whitespace round-trip; callers (`env set`, `env generate --set`,
|
|
486
|
+
* `deploy`'s minted-secret disclosure) reject newline/`"`/`\` up front so the
|
|
487
|
+
* verbatim quote is safe.
|
|
488
|
+
*
|
|
489
|
+
* Duplicate lines for the key are collapsed down to exactly one. The shared
|
|
490
|
+
* read path is last-wins — dotenv overwrites the key as it walks the file — so
|
|
491
|
+
* replacing only the first match would leave a later, untouched duplicate
|
|
492
|
+
* still winning at read time, i.e. a `set` that silently didn't take effect.
|
|
493
|
+
*/
|
|
494
|
+
declare const upsertDevVariableLine: (content: string, key: string, value: string) => string;
|
|
495
|
+
/**
|
|
496
|
+
* Surgically remove every `.dev.vars` line defining `key` (and its own line
|
|
497
|
+
* terminator), preserving all other lines, comments, and blanks verbatim.
|
|
498
|
+
* Backs `lunora env unset`.
|
|
499
|
+
*/
|
|
500
|
+
declare const removeDevVariableLine: (content: string, key: string) => string;
|
|
501
|
+
/**
|
|
502
|
+
* Worker env var the dev tooling sets so the Lunora runtime recognises a
|
|
503
|
+
* development deployment (`@lunora/do`'s `isDevEnvironment`) and therefore
|
|
504
|
+
* streams every RPC dispatch summary to the terminal, keeps argument/error
|
|
505
|
+
* detail unredacted, and runs the studio security audit with `dev: true`.
|
|
506
|
+
*/
|
|
507
|
+
declare const DEV_WORKER_ENV_VAR = "WORKER_ENV";
|
|
508
|
+
/** The value that flags a dev deployment. */
|
|
509
|
+
declare const DEV_WORKER_ENV_VALUE = "development";
|
|
510
|
+
/**
|
|
511
|
+
* Top up `.dev.vars` with the dev-environment flag unless the project already
|
|
512
|
+
* declares it (in `.dev.vars` itself, or in the wrangler config's `vars`).
|
|
513
|
+
*/
|
|
514
|
+
declare const ensureDevWorkerEnv: (projectRoot: string, info: (message: string) => void) => void;
|
|
310
515
|
/** Directory holding per-checkout Lunora state (gitignored by convention). */
|
|
311
516
|
declare const LINKED_PROJECT_DIR = ".lunora";
|
|
312
517
|
/** The canonical link filename, relative to the project root. */
|
|
313
518
|
declare const LINKED_PROJECT_FILE: string;
|
|
314
519
|
/**
|
|
315
|
-
* The link record persisted to `.lunora/project.json`. Every field is optional
|
|
316
|
-
* so a partially-populated link (e.g. a worker name with no URL yet) still
|
|
317
|
-
* round-trips. `linkedAt` is an ISO-8601 stamp written at link time, purely
|
|
318
|
-
* informational.
|
|
319
|
-
*/
|
|
520
|
+
* The link record persisted to `.lunora/project.json`. Every field is optional
|
|
521
|
+
* so a partially-populated link (e.g. a worker name with no URL yet) still
|
|
522
|
+
* round-trips. `linkedAt` is an ISO-8601 stamp written at link time, purely
|
|
523
|
+
* informational.
|
|
524
|
+
*/
|
|
320
525
|
interface LinkedProject {
|
|
321
526
|
/** Cloudflare account id the worker lives under, when known. */
|
|
322
527
|
account?: string;
|
|
323
|
-
/** Cloudflare environment name (`wrangler … --env
|
|
528
|
+
/** Cloudflare environment name (`wrangler … --env <env>`), when scoped. */
|
|
324
529
|
env?: string;
|
|
325
530
|
/** ISO-8601 timestamp recorded when the link was written. */
|
|
326
531
|
linkedAt?: string;
|
|
@@ -330,34 +535,101 @@ interface LinkedProject {
|
|
|
330
535
|
workerUrl?: string;
|
|
331
536
|
}
|
|
332
537
|
/**
|
|
333
|
-
* Read the link record from `.lunora/project.json`, or `undefined` when there
|
|
334
|
-
* is no usable link. Best-effort: a missing file, parse error, or unexpected
|
|
335
|
-
* shape all collapse to `undefined`.
|
|
336
|
-
*/
|
|
538
|
+
* Read the link record from `.lunora/project.json`, or `undefined` when there
|
|
539
|
+
* is no usable link. Best-effort: a missing file, parse error, or unexpected
|
|
540
|
+
* shape all collapse to `undefined`.
|
|
541
|
+
*/
|
|
337
542
|
declare const readLinkedProject: (projectRoot: string) => LinkedProject | undefined;
|
|
338
543
|
/**
|
|
339
|
-
* Write the link record to `.lunora/project.json`, creating the `.lunora/`
|
|
340
|
-
* directory when absent. Only defined fields are persisted (so an empty value
|
|
341
|
-
* never clobbers a known one). Returns the absolute path written.
|
|
342
|
-
*/
|
|
544
|
+
* Write the link record to `.lunora/project.json`, creating the `.lunora/`
|
|
545
|
+
* directory when absent. Only defined fields are persisted (so an empty value
|
|
546
|
+
* never clobbers a known one). Returns the absolute path written.
|
|
547
|
+
*/
|
|
343
548
|
declare const writeLinkedProject: (projectRoot: string, link: LinkedProject) => string;
|
|
344
549
|
/**
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
|
|
550
|
+
* The generated and derived paths a linter or formatter should skip, in
|
|
551
|
+
* gitignore syntax relative to the project root.
|
|
552
|
+
*
|
|
553
|
+
* Committed-on-purpose entries are in here too, deliberately: being tracked by
|
|
554
|
+
* git says nothing about whether a human should be asked to reformat it.
|
|
555
|
+
*/
|
|
556
|
+
declare const LUNORA_IGNORED_PATHS: ReadonlyArray<string>;
|
|
557
|
+
/** A linter or formatter this module knows how to configure. */
|
|
558
|
+
type LintTool = "biome" | "eslint" | "oxlint" | "prettier";
|
|
559
|
+
/**
|
|
560
|
+
* What happened to one tool's configuration.
|
|
561
|
+
*
|
|
562
|
+
* `"manual"` is not a failure — it means the change is correct but not safe to
|
|
563
|
+
* make automatically, and {@link LintIgnoreOutcome.snippet} carries what to
|
|
564
|
+
* paste. `"failed"` IS a failure, but only of this step: the command that
|
|
565
|
+
* triggered it had already done its real work, so it is reported rather than
|
|
566
|
+
* thrown.
|
|
567
|
+
*/
|
|
568
|
+
type LintIgnoreStatus = "created" | "failed" | "manual" | "unchanged" | "updated";
|
|
569
|
+
interface LintIgnoreOutcome {
|
|
570
|
+
/** For `"failed"`: why the writer could not run. The command itself still succeeded. */
|
|
571
|
+
message?: string;
|
|
572
|
+
/** Config file that was written, or the one the user must edit for `"manual"`. */
|
|
573
|
+
path: string;
|
|
574
|
+
/** For `"manual"`: the exact text to add. */
|
|
575
|
+
snippet?: string;
|
|
576
|
+
status: LintIgnoreStatus;
|
|
577
|
+
tool: LintTool;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Which linters/formatters this project already uses, by declared dependency or
|
|
581
|
+
* config file on disk.
|
|
582
|
+
*
|
|
583
|
+
* Both signals matter: a dependency without a config is a tool about to be
|
|
584
|
+
* configured, and a config without a dependency is a tool installed globally or
|
|
585
|
+
* hoisted from a monorepo root. Missing either one means silently skipping a
|
|
586
|
+
* tool the project genuinely runs.
|
|
587
|
+
*/
|
|
588
|
+
declare const detectLintTools: (projectRoot: string) => LintTool[];
|
|
589
|
+
/**
|
|
590
|
+
* Add {@link LUNORA_IGNORED_PATHS} to each tool's configuration.
|
|
591
|
+
*
|
|
592
|
+
* Idempotent: every writer appends only what is missing, so re-running after a
|
|
593
|
+
* `lunora add` neither duplicates entries nor disturbs a project's own rules.
|
|
594
|
+
* @param projectRoot The project to configure.
|
|
595
|
+
* @param tools Which tools to configure — normally {@link detectLintTools}'s result, or the user's selection at `init`.
|
|
596
|
+
* @returns one outcome per tool, in the order given.
|
|
597
|
+
*/
|
|
598
|
+
declare const applyLintIgnores: (projectRoot: string, tools: ReadonlyArray<LintTool>) => LintIgnoreOutcome[];
|
|
599
|
+
/** The three channels a bundler plugin reports through; `console` satisfies it, as does Rspack's `Logger`. */
|
|
600
|
+
interface FindingLogger {
|
|
601
|
+
error: (message: string) => void;
|
|
602
|
+
warn: (message: string) => void;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Print every schema advisory and platform-portability diagnostic a codegen run
|
|
606
|
+
* produced, each on its own level-appropriate channel.
|
|
607
|
+
*
|
|
608
|
+
* Codegen returns these without printing — each caller presents them through its
|
|
609
|
+
* own channel. Both bundler plugins present them identically, so this is that one
|
|
610
|
+
* presentation: severity → logger method, rendered by {@link advisoryLine}. It
|
|
611
|
+
* lives here rather than in either plugin because the loops were copied verbatim
|
|
612
|
+
* between them, and a copy is how `vite build` and `rspack build` start
|
|
613
|
+
* disagreeing about what a schema problem looks like.
|
|
614
|
+
*
|
|
615
|
+
* Reporting only — {@link blockingFindingsMessage} decides what BLOCKS.
|
|
616
|
+
*/
|
|
617
|
+
declare const reportCodegenFindings: (result: Pick<CodegenResult, "advisories" | "platformDiagnostics">, logger: FindingLogger) => void;
|
|
618
|
+
/**
|
|
619
|
+
* The one aggregated line a bundler plugin fails a production build with, or
|
|
620
|
+
* `undefined` when nothing is ERROR-level.
|
|
621
|
+
*
|
|
622
|
+
* An ERROR advisory says a call throws at runtime; an `error` platform
|
|
623
|
+
* diagnostic says the emitted surface does not match the declared target. Both
|
|
624
|
+
* are wrong output, not style, so `vite build` / `rspack build` / `lunora deploy`
|
|
625
|
+
* all refuse them.
|
|
626
|
+
*
|
|
627
|
+
* The filter+dedup+sort behind it stays in `@lunora/codegen` (shared with the CLI
|
|
628
|
+
* gates); only the wording and the fold of the two categories live here, which is
|
|
629
|
+
* presentation — and presentation is what this module owns, which is also why
|
|
630
|
+
* this needs no `tag` parameter: {@link LUNORA_TAG} is right above it.
|
|
631
|
+
*/
|
|
632
|
+
declare const blockingFindingsMessage: (result: Pick<CodegenResult, "advisories" | "platformDiagnostics">) => string | undefined;
|
|
361
633
|
/** Severity a formatted line should be surfaced at, mapped onto the three logger channels. */
|
|
362
634
|
type LunoraLineLevel = "error" | "info" | "warn";
|
|
363
635
|
/** A formatted lunora event: the channel to surface it on, the display text, and which event produced it. */
|
|
@@ -372,45 +644,12 @@ interface LunoraFormattedLine {
|
|
|
372
644
|
/** Stable `source` tag every lunora console event carries. Mirrors `REQUEST_LOG_EVENT_SOURCE` in `@lunora/do`. */
|
|
373
645
|
declare const LUNORA_EVENT_SOURCE = "lunora";
|
|
374
646
|
/**
|
|
375
|
-
* Parse a single worker-output line and, when it is a lunora structured event,
|
|
376
|
-
* return its severity plus display text. Returns `undefined` for anything else —
|
|
377
|
-
* non-JSON lines, JSON that isn't a lunora event, or an unrecognised event type
|
|
378
|
-
* — so the caller passes the original line through untouched. Pure and total.
|
|
379
|
-
*/
|
|
647
|
+
* Parse a single worker-output line and, when it is a lunora structured event,
|
|
648
|
+
* return its severity plus display text. Returns `undefined` for anything else —
|
|
649
|
+
* non-JSON lines, JSON that isn't a lunora event, or an unrecognised event type
|
|
650
|
+
* — so the caller passes the original line through untouched. Pure and total.
|
|
651
|
+
*/
|
|
380
652
|
declare const formatLunoraEvent: (line: string) => LunoraFormattedLine | undefined;
|
|
381
|
-
declare class LunoraReporter {
|
|
382
|
-
#private;
|
|
383
|
-
setStdout(stdout: NodeJS.WriteStream): void;
|
|
384
|
-
setStderr(stderr: NodeJS.WriteStream): void;
|
|
385
|
-
log(meta: unknown): void;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Per-package secret-requirements registry for `.dev.vars` scaffolding.
|
|
389
|
-
*
|
|
390
|
-
* Each entry maps a `@lunora/*` package name → the secrets it requires at
|
|
391
|
-
* runtime, expressed as `{ key, description, docsUrl }` records. The scaffolder
|
|
392
|
-
* in {@link ./scaffold-dev-variables} reads this registry to emit package-aware
|
|
393
|
-
* `.dev.vars.example` entries (placeholders + inline doc-pointer comments).
|
|
394
|
-
*
|
|
395
|
-
* ## Adding a new add-on
|
|
396
|
-
*
|
|
397
|
-
* When a new `@lunora/*` package requires runtime secrets, add one entry to
|
|
398
|
-
* {@link PACKAGE_SECRETS_REGISTRY} keyed by its exact npm package name. Each
|
|
399
|
-
* `SecretEntry` in the array needs:
|
|
400
|
-
*
|
|
401
|
-
* - `key` — the env-var name the package reads from `env` (e.g. `RESEND_API_KEY`).
|
|
402
|
-
* - `description` — one line describing the secret and how to obtain it.
|
|
403
|
-
* - `docsUrl` — a stable URL to the package/provider docs.
|
|
404
|
-
*
|
|
405
|
-
* The registry lives in `@lunora/config` so that add-ons themselves never need
|
|
406
|
-
* to depend on it (no circular coupling). Add-ons document their secrets in
|
|
407
|
-
* their own READMEs; the registry duplicates that knowledge in a machine-readable
|
|
408
|
-
* form that the scaffolder can consume.
|
|
409
|
-
*
|
|
410
|
-
* **Never write a real secret value** in this file — `placeholderValue` entries
|
|
411
|
-
* are the only allowed values (they must pass `isPlaceholderValue` from
|
|
412
|
-
* scaffold-dev-variables).
|
|
413
|
-
*/
|
|
414
653
|
/** A single secret variable required by a package. */
|
|
415
654
|
interface SecretEntry {
|
|
416
655
|
/** One sentence describing what this secret is and how to obtain it. */
|
|
@@ -420,96 +659,171 @@ interface SecretEntry {
|
|
|
420
659
|
/** The env-var key as it appears in `.dev.vars`, e.g. `AUTH_SECRET`. */
|
|
421
660
|
key: string;
|
|
422
661
|
/**
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
662
|
+
* The placeholder value written into `.dev.vars.example`.
|
|
663
|
+
* Must pass `isPlaceholderValue` from scaffold-dev-variables so the
|
|
664
|
+
* scaffolder regenerates it when generating `.dev.vars`. Use angle-bracket
|
|
665
|
+
* conventions or a recognised marker like `replace-with-openssl-rand-hex-32`.
|
|
666
|
+
* Non-secret env-vars (e.g. `AUTH_URL`) may carry a real default value.
|
|
667
|
+
*/
|
|
429
668
|
placeholderValue: string;
|
|
430
669
|
}
|
|
431
670
|
/**
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
* The canonical registry of per-package secret requirements.
|
|
442
|
-
*
|
|
443
|
-
* Keys are exact npm package names (e.g. `"@lunora/auth"`). Values are
|
|
444
|
-
* non-empty arrays of {@link SecretEntry} — one entry per required secret key.
|
|
445
|
-
*
|
|
446
|
-
* The scaffolder in `scaffold-dev-variables.ts` calls
|
|
447
|
-
* {@link secretsForPackages} to resolve the applicable entries from this map
|
|
448
|
-
* given the set of detected capability package names.
|
|
449
|
-
*/
|
|
671
|
+
* The canonical registry of per-package secret requirements.
|
|
672
|
+
*
|
|
673
|
+
* Keys are exact npm package names (e.g. `"@lunora/auth"`). Values are
|
|
674
|
+
* non-empty arrays of {@link SecretEntry} — one entry per required secret key.
|
|
675
|
+
*
|
|
676
|
+
* The scaffolder in `scaffold-dev-variables.ts` calls
|
|
677
|
+
* {@link secretsForPackages} to resolve the applicable entries from this map
|
|
678
|
+
* given the set of detected capability package names.
|
|
679
|
+
*/
|
|
450
680
|
declare const PACKAGE_SECRETS_REGISTRY: Readonly<Record<string, ReadonlyArray<SecretEntry>>>;
|
|
451
|
-
/**
|
|
452
|
-
* Collect all secret entries required by the given set of package names. The
|
|
453
|
-
* order follows the order of `packageNames` (stable, predictable output), and
|
|
454
|
-
* within each package the entries are returned in registry declaration order.
|
|
455
|
-
*
|
|
456
|
-
* Only packages present in {@link PACKAGE_SECRETS_REGISTRY} contribute entries;
|
|
457
|
-
* unknown package names are silently ignored — this makes the call site resilient
|
|
458
|
-
* to future capability flags whose packages have no secrets.
|
|
459
|
-
*/
|
|
460
681
|
declare const secretsForPackages: (packageNames: ReadonlyArray<string>) => SecretEntry[];
|
|
461
|
-
/**
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
*
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
* The object form (scoping which binding kinds go remote) is reserved for a
|
|
470
|
-
* future increment; for now an object value is treated as "enabled" (truthy
|
|
471
|
-
* presence) so forward-written configs still turn remote on.
|
|
472
|
-
*/
|
|
473
|
-
type RemotePreference = boolean | undefined;
|
|
474
|
-
/** The structural slice of `lunora.json` Lunora reads. */
|
|
475
|
-
interface LunoraProjectConfig {
|
|
476
|
-
remote?: unknown;
|
|
682
|
+
/**
|
|
683
|
+
* The two channels this needs from a caller's logger. Deliberately structural
|
|
684
|
+
* and this small: the CLI's `Logger`, Vite's `server.config.logger` shim, and a
|
|
685
|
+
* two-line test double all satisfy it without any of them being imported here.
|
|
686
|
+
*/
|
|
687
|
+
interface HookLogger {
|
|
688
|
+
error: (message: string) => void;
|
|
689
|
+
info: (message: string) => void;
|
|
477
690
|
}
|
|
691
|
+
/** What a spawner is handed. A superset-accepting spawner (the CLI's) satisfies this. */
|
|
692
|
+
interface HookSpawnDescriptor {
|
|
693
|
+
args: ReadonlyArray<string>;
|
|
694
|
+
command: string;
|
|
695
|
+
cwd?: string;
|
|
696
|
+
/**
|
|
697
|
+
* Route the child's stdout to the parent's stderr (fd 2). Set whenever the
|
|
698
|
+
* caller's own stdout is a machine-readable stream — `--format json`, or
|
|
699
|
+
* `lunora dev`'s NDJSON — since a `postcodegen` script that prints anything
|
|
700
|
+
* would otherwise interleave with and corrupt it.
|
|
701
|
+
*/
|
|
702
|
+
stdoutToStderr?: boolean;
|
|
703
|
+
}
|
|
704
|
+
/** Run a child process and resolve with its exit code. Injectable so tests need no subprocess. */
|
|
705
|
+
type HookSpawner = (descriptor: HookSpawnDescriptor) => Promise<{
|
|
706
|
+
code: number;
|
|
707
|
+
}>;
|
|
708
|
+
interface PostCodegenHookResult {
|
|
709
|
+
/**
|
|
710
|
+
* The hook's failure message, when it ran and did not succeed.
|
|
711
|
+
*
|
|
712
|
+
* Already logged by the time a caller sees it — read it only to decide
|
|
713
|
+
* whether to ABORT, and to carry into a structured result. Logging it again
|
|
714
|
+
* double-reports.
|
|
715
|
+
*/
|
|
716
|
+
error?: string;
|
|
717
|
+
/** True when a `postcodegen` script existed and was invoked. */
|
|
718
|
+
ran: boolean;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Run the project's `postcodegen` script, if it declares one.
|
|
722
|
+
*
|
|
723
|
+
* A failure is reported here and returned rather than thrown, so every caller
|
|
724
|
+
* gets identical reporting and is left with only the decision that actually
|
|
725
|
+
* differs between them: whether it blocks. `deploy` and `prepare` must abort —
|
|
726
|
+
* the whole point is not shipping output the project considers unfinished —
|
|
727
|
+
* while a dev watch loop must not, since the next edit is the chance to fix it.
|
|
728
|
+
*
|
|
729
|
+
* Reporting used to be the caller's job, and all three copied the same
|
|
730
|
+
* `logger.error(result.error)` line. That made "was this surfaced?" a convention
|
|
731
|
+
* rather than a guarantee, and a fourth caller had no way to know it owed one.
|
|
732
|
+
* @returns whether the hook ran, and its (already-logged) error message when it failed.
|
|
733
|
+
*/
|
|
734
|
+
declare const runPostCodegenHook: (options: {
|
|
735
|
+
cwd: string;
|
|
736
|
+
logger: HookLogger;
|
|
737
|
+
spawner?: HookSpawner;
|
|
738
|
+
/** See {@link HookSpawnDescriptor.stdoutToStderr}. */
|
|
739
|
+
stdoutToStderr?: boolean;
|
|
740
|
+
}) => Promise<PostCodegenHookResult>;
|
|
741
|
+
/**
|
|
742
|
+
* The parsed `remote` preference from `lunora.config.*`:
|
|
743
|
+
*
|
|
744
|
+
* - `true` / `false` — the boolean form: enable or explicitly disable remote dev.
|
|
745
|
+
* - `undefined` — no usable preference (file absent, key absent, or malformed).
|
|
746
|
+
*
|
|
747
|
+
* The object form (scoping which binding kinds go remote) is reserved for a
|
|
748
|
+
* future increment; for now an object value is treated as "enabled" (truthy
|
|
749
|
+
* presence) so forward-written configs still turn remote on.
|
|
750
|
+
*/
|
|
751
|
+
type RemotePreference = boolean | undefined;
|
|
478
752
|
/**
|
|
479
|
-
* Interpret a raw `remote` value into a tri-state preference. A boolean passes
|
|
480
|
-
* through; an object is treated as enabled (the documented-but-not-yet-honored
|
|
481
|
-
* scoping form is still an opt-in); anything else (string, number, null) is no
|
|
482
|
-
* preference.
|
|
483
|
-
*/
|
|
753
|
+
* Interpret a raw `remote` value into a tri-state preference. A boolean passes
|
|
754
|
+
* through; an object is treated as enabled (the documented-but-not-yet-honored
|
|
755
|
+
* scoping form is still an opt-in); anything else (string, number, null) is no
|
|
756
|
+
* preference.
|
|
757
|
+
*/
|
|
484
758
|
declare const interpretRemote: (value: unknown) => RemotePreference;
|
|
485
759
|
/**
|
|
486
|
-
* Read the project's `remote` preference
|
|
487
|
-
*
|
|
488
|
-
|
|
489
|
-
* falls through to the env/flag layers.
|
|
490
|
-
*/
|
|
760
|
+
* Read the project's `remote` preference, or `undefined` when there is no
|
|
761
|
+
* usable one — the caller then falls through to the env/flag layers.
|
|
762
|
+
*/
|
|
491
763
|
declare const readProjectRemotePreference: (projectRoot: string) => RemotePreference;
|
|
492
764
|
/**
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
|
|
765
|
+
* Read the project's deploy `target` from `lunora.config.*`, or `undefined` when
|
|
766
|
+
* absent.
|
|
767
|
+
*
|
|
768
|
+
* Delegates to `@lunora/codegen` rather than re-reading the file here.
|
|
769
|
+
* `runCodegen` has to resolve the same key without this package (config
|
|
770
|
+
* depends on codegen, not the reverse), so the parser lives there and this is a
|
|
771
|
+
* re-export — two readers of one key is exactly the kind of copy that drifts.
|
|
772
|
+
*/
|
|
773
|
+
declare const readProjectTarget: (projectRoot: string) => string | undefined;
|
|
774
|
+
/**
|
|
775
|
+
* Resolve the deploy target for a command: an explicit `--target` wins, then
|
|
776
|
+
* `lunora.config.*`, then the registry default.
|
|
777
|
+
*
|
|
778
|
+
* **This is the canonical resolution point, and the reason it is one place.**
|
|
779
|
+
* Codegen tailors the emitted `ctx.*` surface to a target while deploy picks
|
|
780
|
+
* the driver that ships it. Resolve those separately and they can disagree,
|
|
781
|
+
* producing an app that builds cleanly and fails at runtime with nothing in the
|
|
782
|
+
* build to explain it. Every caller — CLI commands, the Vite plugin,
|
|
783
|
+
* `runCodegen`'s own fallback — resolves through here or through
|
|
784
|
+
* {@link resolveTargetOrThrow}, so there is exactly one precedence order to
|
|
785
|
+
* reason about.
|
|
786
|
+
*/
|
|
787
|
+
declare const resolveProjectTarget: (projectRoot: string, explicit?: string) => string;
|
|
788
|
+
/**
|
|
789
|
+
* Resolve the deploy target as {@link resolveProjectTarget} does, then reject
|
|
790
|
+
* one that no registered driver serves.
|
|
791
|
+
*
|
|
792
|
+
* Lives here rather than in `@lunora/cli` because nothing about it is
|
|
793
|
+
* CLI-shaped and the Vite plugin needs the same guard — a validator only the
|
|
794
|
+
* CLI could reach left `vite build` emitting the default surface for a
|
|
795
|
+
* mis-declared target, silently.
|
|
796
|
+
*
|
|
797
|
+
* Callers that go on to resolve a driver get this for free; the ones that never
|
|
798
|
+
* look a driver up — codegen, the Vite plugin — need it, because otherwise
|
|
799
|
+
* nothing in their path ever rejects the name.
|
|
800
|
+
* @param projectRoot Directory containing `lunora.config.*`.
|
|
801
|
+
* @param explicit A caller-supplied target, if any.
|
|
802
|
+
* @throws when the resolved target names no registered driver.
|
|
803
|
+
* @returns the resolved, registered target id.
|
|
804
|
+
*/
|
|
805
|
+
declare const resolveTargetOrThrow: (projectRoot: string, explicit?: string) => string;
|
|
806
|
+
/**
|
|
807
|
+
* Whether we can interactively prompt — stdin must be a TTY. In CI / piped
|
|
808
|
+
* contexts this is false, and callers should fall back to a non-interactive
|
|
809
|
+
* default (skip, or require an explicit `--yes`) rather than hang on a read.
|
|
810
|
+
*/
|
|
497
811
|
declare const isInteractive: () => boolean;
|
|
498
812
|
/**
|
|
499
|
-
* Ask a yes/no question on stdin. With `defaultYes`, an empty answer (just
|
|
500
|
-
* Enter) counts as yes and the prompt should read `[Y/n]`; otherwise empty is
|
|
501
|
-
* no (`[y/N]`). Shared by the CLI (`reset`, `dev`) and the Vite dev server.
|
|
502
|
-
*/
|
|
813
|
+
* Ask a yes/no question on stdin. With `defaultYes`, an empty answer (just
|
|
814
|
+
* Enter) counts as yes and the prompt should read `[Y/n]`; otherwise empty is
|
|
815
|
+
* no (`[y/N]`). Shared by the CLI (`reset`, `dev`) and the Vite dev server.
|
|
816
|
+
*/
|
|
503
817
|
declare const promptYesNo: (prompt: string, options?: {
|
|
504
818
|
defaultYes?: boolean;
|
|
505
819
|
}) => Promise<boolean>;
|
|
506
820
|
/**
|
|
507
|
-
* Build a default-yes `confirm(message)` for the scaffolders' `ensureDevVariables`:
|
|
508
|
-
* an interactive `[Y/n]` prompt (optionally prefixed, e.g. `"[lunora] "`) when
|
|
509
|
-
* stdin is a TTY, or an immediate `false` otherwise — so CI declines silently
|
|
510
|
-
* instead of blocking. Keeps the "non-interactive ⇒ decline" policy in one place
|
|
511
|
-
* rather than re-stated at every call site.
|
|
512
|
-
*/
|
|
821
|
+
* Build a default-yes `confirm(message)` for the scaffolders' `ensureDevVariables`:
|
|
822
|
+
* an interactive `[Y/n]` prompt (optionally prefixed, e.g. `"[lunora] "`) when
|
|
823
|
+
* stdin is a TTY, or an immediate `false` otherwise — so CI declines silently
|
|
824
|
+
* instead of blocking. Keeps the "non-interactive ⇒ decline" policy in one place
|
|
825
|
+
* rather than re-stated at every call site.
|
|
826
|
+
*/
|
|
513
827
|
declare const createConfirm: (prefix?: string) => ((message: string) => Promise<boolean>);
|
|
514
828
|
/** One choice in a {@link promptSelect} list. `value` is returned; `label` (and optional `description`) are shown. */
|
|
515
829
|
interface SelectOption<T extends string> {
|
|
@@ -518,272 +832,87 @@ interface SelectOption<T extends string> {
|
|
|
518
832
|
value: T;
|
|
519
833
|
}
|
|
520
834
|
/**
|
|
521
|
-
* Ask the user to pick one option from a numbered list on stdin. Accepts the
|
|
522
|
-
* 1-based number or the option's `value`/`label` typed verbatim; an empty answer
|
|
523
|
-
* (just Enter) takes `settings.default`. In a non-interactive context (CI /
|
|
524
|
-
* piped — no TTY) it never reads and returns `settings.default` (or `undefined`),
|
|
525
|
-
* mirroring {@link createConfirm}'s "non-interactive ⇒ fall back" policy so
|
|
526
|
-
* automation never blocks.
|
|
527
|
-
*/
|
|
835
|
+
* Ask the user to pick one option from a numbered list on stdin. Accepts the
|
|
836
|
+
* 1-based number or the option's `value`/`label` typed verbatim; an empty answer
|
|
837
|
+
* (just Enter) takes `settings.default`. In a non-interactive context (CI /
|
|
838
|
+
* piped — no TTY) it never reads and returns `settings.default` (or `undefined`),
|
|
839
|
+
* mirroring {@link createConfirm}'s "non-interactive ⇒ fall back" policy so
|
|
840
|
+
* automation never blocks.
|
|
841
|
+
*/
|
|
528
842
|
declare const promptSelect: <T extends string>(message: string, options: ReadonlyArray<SelectOption<T>>, settings?: {
|
|
529
843
|
default?: T;
|
|
530
844
|
}) => Promise<T | undefined>;
|
|
845
|
+
/**
|
|
846
|
+
* Ask a free-text question on stdin, returning the trimmed answer. An empty
|
|
847
|
+
* answer (just Enter) takes `settings.default`. In a non-interactive context
|
|
848
|
+
* (CI / piped — no TTY) it never reads and returns `settings.default` (or
|
|
849
|
+
* `undefined`), mirroring {@link promptSelect}'s "non-interactive ⇒ fall back"
|
|
850
|
+
* policy so automation never blocks.
|
|
851
|
+
*/
|
|
852
|
+
declare const promptText: (message: string, settings?: {
|
|
853
|
+
default?: string;
|
|
854
|
+
}) => Promise<string | undefined>;
|
|
531
855
|
/** One choice in a {@link promptMultiSelect} list. Identical shape to {@link SelectOption}; `value` is returned when picked. */
|
|
532
856
|
type MultiSelectOption<T extends string> = SelectOption<T>;
|
|
533
857
|
/**
|
|
534
|
-
* Ask the user to pick zero or more options from a numbered list on stdin.
|
|
535
|
-
* Accepts a comma- or space-separated list of 1-based numbers and/or option
|
|
536
|
-
* `value`/`label`s typed verbatim; an empty answer (just Enter) takes
|
|
537
|
-
* `settings.defaults`. In a non-interactive context (CI / piped — no TTY) it
|
|
538
|
-
* never reads and returns `settings.defaults ?? []`, mirroring {@link promptSelect}'s
|
|
539
|
-
* "non-interactive ⇒ fall back" policy so automation never blocks. Unknown
|
|
540
|
-
* tokens are ignored; the returned list is de-duplicated and preserves option
|
|
541
|
-
* order.
|
|
542
|
-
*/
|
|
858
|
+
* Ask the user to pick zero or more options from a numbered list on stdin.
|
|
859
|
+
* Accepts a comma- or space-separated list of 1-based numbers and/or option
|
|
860
|
+
* `value`/`label`s typed verbatim; an empty answer (just Enter) takes
|
|
861
|
+
* `settings.defaults`. In a non-interactive context (CI / piped — no TTY) it
|
|
862
|
+
* never reads and returns `settings.defaults ?? []`, mirroring {@link promptSelect}'s
|
|
863
|
+
* "non-interactive ⇒ fall back" policy so automation never blocks. Unknown
|
|
864
|
+
* tokens are ignored; the returned list is de-duplicated and preserves option
|
|
865
|
+
* order.
|
|
866
|
+
*/
|
|
543
867
|
declare const promptMultiSelect: <T extends string>(message: string, options: ReadonlyArray<MultiSelectOption<T>>, settings?: {
|
|
544
868
|
defaults?: ReadonlyArray<T>;
|
|
545
869
|
}) => Promise<T[]>;
|
|
546
870
|
/**
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
/** Which declaration is unexported. */
|
|
561
|
-
kind: "container" | "workflow";
|
|
562
|
-
/** The `_generated/{module}` to re-export from, e.g. `workflows`. */
|
|
563
|
-
module: "containers" | "workflows";
|
|
564
|
-
}
|
|
565
|
-
interface ReconcileBindingsResult {
|
|
566
|
-
/** Short labels for each binding written (e.g. `"SCHEDULER/SchedulerDO"`). */
|
|
567
|
-
added: string[];
|
|
568
|
-
/** `true` when `wrangler.jsonc` was rewritten. */
|
|
569
|
-
changed: boolean;
|
|
570
|
-
/**
|
|
571
|
-
* Declared containers/workflows the worker entry doesn't re-export — the
|
|
572
|
-
* structured form of the corresponding `warnings` entries, for the dev error
|
|
573
|
-
* overlay. Empty when every declaration is wired.
|
|
574
|
-
*/
|
|
575
|
-
exportGaps: ExportGap[];
|
|
576
|
-
/** Reason reconciliation was skipped, for logging. */
|
|
577
|
-
reason?: string;
|
|
578
|
-
/** Non-fatal hints for capabilities that cannot be auto-provisioned. */
|
|
579
|
-
warnings: string[];
|
|
580
|
-
/** Resolved wrangler path, or `undefined` when none was found. */
|
|
581
|
-
wranglerPath?: string;
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Reconcile inferred Durable Object / D1 bindings into `wrangler.jsonc`.
|
|
585
|
-
*
|
|
586
|
-
* Writes only when something is missing; returns `changed: false` when the
|
|
587
|
-
* config already satisfies the inferred needs.
|
|
588
|
-
*/
|
|
589
|
-
declare const reconcileWranglerBindings: (projectRoot: string, inferred: InferredBindings) => ReconcileBindingsResult;
|
|
590
|
-
/**
|
|
591
|
-
* The wrangler config sections Lunora can safely flip to remote mode in dev,
|
|
592
|
-
* each with the human label used in logs and the structural `shape` the entry
|
|
593
|
-
* lives in.
|
|
594
|
-
*
|
|
595
|
-
* `"array"` is a top-level array of binding objects (`d1_databases`,
|
|
596
|
-
* `kv_namespaces`, `r2_buckets`, `vectorize`, `services`). `"producers"` is
|
|
597
|
-
* `queues.producers[]` — consumers are NOT remoted (their schema has no `remote`
|
|
598
|
-
* field) and the edit path is two levels deep. `"object"` is a single binding
|
|
599
|
-
* object, not an array (`ai`), whose edit path targets the section key directly.
|
|
600
|
-
*
|
|
601
|
-
* Every kind here was confirmed against `wrangler/config-schema.json`: the
|
|
602
|
-
* entry's schema declares a `remote` property. Deliberately omits
|
|
603
|
-
* `durable_objects` (no CF remote-DO mode; shards stay local) and sections whose
|
|
604
|
-
* schema has no `remote` field (`hyperdrive`, `analytics_engine_datasets`,
|
|
605
|
-
* `secrets_store_secrets`, queue consumers, …). Widening further is a one-line
|
|
606
|
-
* table edit.
|
|
607
|
-
*/
|
|
608
|
-
declare const REMOTE_ELIGIBLE_KEYS: {
|
|
609
|
-
readonly ai: {
|
|
610
|
-
readonly label: "AI";
|
|
611
|
-
readonly shape: "object";
|
|
612
|
-
};
|
|
613
|
-
readonly d1_databases: {
|
|
614
|
-
readonly label: "D1";
|
|
615
|
-
readonly shape: "array";
|
|
616
|
-
};
|
|
617
|
-
readonly kv_namespaces: {
|
|
618
|
-
readonly label: "KV";
|
|
619
|
-
readonly shape: "array";
|
|
620
|
-
};
|
|
621
|
-
readonly queues: {
|
|
622
|
-
readonly label: "Queue";
|
|
623
|
-
readonly shape: "producers";
|
|
624
|
-
};
|
|
625
|
-
readonly r2_buckets: {
|
|
626
|
-
readonly label: "R2";
|
|
627
|
-
readonly shape: "array";
|
|
628
|
-
};
|
|
629
|
-
readonly services: {
|
|
630
|
-
readonly label: "Service";
|
|
631
|
-
readonly shape: "array";
|
|
632
|
-
};
|
|
633
|
-
readonly vectorize: {
|
|
634
|
-
readonly label: "Vectorize";
|
|
635
|
-
readonly shape: "array";
|
|
636
|
-
};
|
|
637
|
-
};
|
|
638
|
-
type RemoteEligibleKey = keyof typeof REMOTE_ELIGIBLE_KEYS;
|
|
639
|
-
/** One binding object as it appears in any eligible section. */
|
|
640
|
-
interface BindingEntry {
|
|
641
|
-
binding?: string;
|
|
642
|
-
remote?: boolean;
|
|
643
|
-
}
|
|
644
|
-
/** One binding entry we mark remote, with enough provenance to log + edit it. */
|
|
645
|
-
interface RemoteBindingPlan {
|
|
646
|
-
/** The binding name as declared in the config (e.g. `"DB"`, `"FILES"`). */
|
|
647
|
-
binding: string;
|
|
648
|
-
/** Short kind label for logging (`"D1"`, `"KV"`, `"R2"`, `"Vectorize"`, …). */
|
|
649
|
-
kind: string;
|
|
650
|
-
/**
|
|
651
|
-
* The jsonc edit path within {@link RemoteBindingPlan.section}, relative to
|
|
652
|
-
* the section key: `[index]` for an `"array"` section, `["producers", index]`
|
|
653
|
-
* for a queue producer, or `[]` for the single-object `ai` section. The
|
|
654
|
-
* materializer prepends the section key and appends `"remote"`.
|
|
655
|
-
*/
|
|
656
|
-
path: ReadonlyArray<number | string>;
|
|
657
|
-
/** The wrangler config key the entry lives under. */
|
|
658
|
-
section: RemoteEligibleKey;
|
|
659
|
-
}
|
|
660
|
-
/** The structural slice of a wrangler config the remote planner reads. */
|
|
661
|
-
interface RemoteWranglerShape {
|
|
662
|
-
ai?: BindingEntry | null;
|
|
663
|
-
d1_databases?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
664
|
-
kv_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
665
|
-
queues?: {
|
|
666
|
-
producers?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
667
|
-
} | null;
|
|
668
|
-
r2_buckets?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
669
|
-
services?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
670
|
-
vectorize?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
671
|
-
}
|
|
672
|
-
/**
|
|
673
|
-
* Inspect a parsed wrangler config and list every eligible binding that should
|
|
674
|
-
* be flipped to remote mode. Pure — no file-system access, no mutation. An
|
|
675
|
-
* entry already carrying `"remote": true` is still reported (so logging is
|
|
676
|
-
* complete) but the materializer's edit is a harmless no-op for it.
|
|
677
|
-
*/
|
|
678
|
-
declare const planRemoteBindings: (parsed: RemoteWranglerShape) => RemoteBindingPlan[];
|
|
679
|
-
/**
|
|
680
|
-
* Inject `"remote": true` onto each planned binding in the config `text`,
|
|
681
|
-
* comment-preservingly via jsonc edits. Pure string→string; the edits target
|
|
682
|
-
* disjoint entries so applying them sequentially is safe. The edit path is
|
|
683
|
-
* `[section, ...plan.path, "remote"]`, which resolves to the array element, the
|
|
684
|
-
* `queues.producers[i]` entry, or the single `ai` object as the plan demands.
|
|
685
|
-
*/
|
|
686
|
-
declare const injectRemoteFlags: (text: string, plans: ReadonlyArray<RemoteBindingPlan>) => string;
|
|
687
|
-
interface MaterializeOptions {
|
|
688
|
-
/** When `false`, the call is a no-op (returns `enabled: false`). */
|
|
689
|
-
enabled: boolean;
|
|
690
|
-
projectRoot: string;
|
|
691
|
-
}
|
|
692
|
-
interface MaterializeResult {
|
|
693
|
-
/**
|
|
694
|
-
* Removes the generated temp config file. Always present and always safe to
|
|
695
|
-
* call: it is idempotent, a no-op when nothing was written (disabled /
|
|
696
|
-
* fall-through cases), and never throws if the path is already gone. The dev
|
|
697
|
-
* command calls this on every exit path (normal, signal, error).
|
|
698
|
-
*/
|
|
699
|
-
cleanup: () => void;
|
|
700
|
-
/**
|
|
701
|
-
* Absolute path to the generated temp config to pass to
|
|
702
|
-
* `wrangler dev --config`. `undefined` when remote mode is disabled, no
|
|
703
|
-
* wrangler config was found, it failed to parse, or it declared no eligible
|
|
704
|
-
* binding (nothing to remote — run plain local dev).
|
|
705
|
-
*/
|
|
706
|
-
configPath?: string;
|
|
707
|
-
/** Whether remote mode was requested at all. */
|
|
708
|
-
enabled: boolean;
|
|
709
|
-
/** Why no temp config was produced, for logging (only set when none was). */
|
|
710
|
-
reason?: string;
|
|
711
|
-
/** The bindings flipped to remote, for the dev banner. */
|
|
712
|
-
remoteBindings: RemoteBindingPlan[];
|
|
713
|
-
}
|
|
714
|
-
/**
|
|
715
|
-
* Produce a temporary wrangler config with `"remote": true` on every eligible
|
|
716
|
-
* binding, so `lunora dev` can run `wrangler dev --config <temp>` against the
|
|
717
|
-
* deployed D1/KV/R2 without touching the user's file.
|
|
718
|
-
*
|
|
719
|
-
* The temp file is written as a sibling of the source `wrangler.jsonc` (in the
|
|
720
|
-
* project root), NOT an OS temp dir: wrangler resolves a config's relative paths
|
|
721
|
-
* (`main`, `assets`, `migrations_dir`, …) against the **config file's own
|
|
722
|
-
* directory**, so a temp config in `/tmp` would make wrangler look for
|
|
723
|
-
* `/tmp/src/server.ts` and fail to start the worker. Keeping it beside the real
|
|
724
|
-
* config preserves those relative paths. Returns `configPath: undefined` (with a
|
|
725
|
-
* `reason`) for every fall-through case so the caller degrades to plain local
|
|
726
|
-
* dev instead of failing.
|
|
727
|
-
*/
|
|
728
|
-
declare const materializeRemoteWranglerConfig: (options: MaterializeOptions) => MaterializeResult;
|
|
729
|
-
/**
|
|
730
|
-
* Parse a `LUNORA_REMOTE` env value into the on/off decision. Truthy when set to
|
|
731
|
-
* `"1"` or `"true"` (case-insensitive); anything else — unset, `"0"`, `"false"`,
|
|
732
|
-
* empty — is off. Mirrors the `"1" | "true"` convention used across the runtime.
|
|
733
|
-
*/
|
|
734
|
-
declare const isRemoteEnvEnabled: (value: string | undefined) => boolean;
|
|
735
|
-
/** The three inputs that can switch remote-binding dev on, in precedence order. */
|
|
736
|
-
interface RemoteEnableInputs {
|
|
737
|
-
/**
|
|
738
|
-
* The `remote` preference from `lunora.json` (the lowest-priority signal).
|
|
739
|
-
* `undefined` means "no project preference"; an explicit `false` here loses
|
|
740
|
-
* to neither the flag nor the env when those are absent — it just stays off.
|
|
741
|
-
*/
|
|
742
|
-
configPreference?: boolean;
|
|
743
|
-
/** The raw `LUNORA_REMOTE` env value (parsed with {@link isRemoteEnvEnabled}). */
|
|
744
|
-
envValue?: string;
|
|
745
|
-
/** The explicit `--remote` CLI flag — `true` when passed, `undefined`/`false` otherwise. */
|
|
746
|
-
flag?: boolean;
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Resolve whether remote-binding dev is on, with a clear precedence:
|
|
750
|
-
*
|
|
751
|
-
* 1. an explicit `--remote` flag (highest — a deliberate per-invocation choice),
|
|
752
|
-
* 2. then `LUNORA_REMOTE` in the environment,
|
|
753
|
-
* 3. then the `remote` key in `lunora.json` (lowest — a project default).
|
|
754
|
-
*
|
|
755
|
-
* The flag and env are one-directional (they can only turn remote *on*); only
|
|
756
|
-
* the config preference carries a meaningful `false`, and it applies solely when
|
|
757
|
-
* neither stronger signal is present. So a project that sets `"remote": false`
|
|
758
|
-
* is still overridable per-run by `--remote` or `LUNORA_REMOTE=1`.
|
|
759
|
-
*/
|
|
760
|
-
declare const resolveRemoteEnabled: (inputs: RemoteEnableInputs) => boolean;
|
|
871
|
+
* The project's Lunora source directory (the plugin's `schemaDir`), read the way
|
|
872
|
+
* `@lunora/vite` sees it: the `schemaDir` string literal passed to the `lunora()`
|
|
873
|
+
* call in `vite.config.*`, else `"lunora"`. The CLI commands that scan the
|
|
874
|
+
* project (`dev`, `deploy`, `doctor`, `env`, `codegen`) resolve it here, so a
|
|
875
|
+
* project that moved its functions to `backend/` gets its `ctx.*` reads and
|
|
876
|
+
* schema facts read from `backend/` instead of from a directory that does not
|
|
877
|
+
* exist.
|
|
878
|
+
*
|
|
879
|
+
* Parsed, never evaluated: a CLI command must not run the project's build
|
|
880
|
+
* config. A computed `schemaDir`, or a plugin reached any other way, is not seen
|
|
881
|
+
* and falls back to the default — the same answer as before this was read.
|
|
882
|
+
*/
|
|
883
|
+
declare const resolveSchemaDirectory: (projectRoot: string) => string;
|
|
761
884
|
/** Core (always-scaffolded) secrets followed by the package-specific ones for the detected capabilities. */
|
|
762
885
|
declare const requiredSecrets: (packageNames: ReadonlyArray<string>) => SecretEntry[];
|
|
763
886
|
/**
|
|
764
|
-
* Whether an (already-unquoted) value looks like a fill-me-in placeholder —
|
|
765
|
-
* empty, angle-bracketed, or containing a known marker — rather than a real
|
|
766
|
-
* value. Used both when scaffolding (which values to regenerate) and by
|
|
767
|
-
* `lunora env doctor` (which set values are still unfilled).
|
|
768
|
-
*/
|
|
887
|
+
* Whether an (already-unquoted) value looks like a fill-me-in placeholder —
|
|
888
|
+
* empty, angle-bracketed, or containing a known marker — rather than a real
|
|
889
|
+
* value. Used both when scaffolding (which values to regenerate) and by
|
|
890
|
+
* `lunora env doctor` (which set values are still unfilled).
|
|
891
|
+
*/
|
|
769
892
|
declare const isPlaceholderValue: (value: string) => boolean;
|
|
770
893
|
/**
|
|
771
|
-
* True for a secret
|
|
772
|
-
* 32-byte hex, like `openssl rand -hex 32`) —
|
|
773
|
-
* `LUNORA_ADMIN_TOKEN`, `STORAGE_SIGNING_SECRET
|
|
774
|
-
*
|
|
775
|
-
|
|
894
|
+
* True for a secret key the registry says Lunora can mint locally (a random
|
|
895
|
+
* 32-byte hex, like `openssl rand -hex 32`) — `AUTH_SECRET`,
|
|
896
|
+
* `LUNORA_ADMIN_TOKEN`, `STORAGE_SIGNING_SECRET`, …
|
|
897
|
+
*
|
|
898
|
+
* Registry membership, NOT the key's name shape, is the rule. A secret-looking
|
|
899
|
+
* key nothing in the registry declares (`OPENAI_API_KEY`,
|
|
900
|
+
* `GITHUB_CLIENT_SECRET`, a project's own `*_TOKEN`) is provider-issued as far
|
|
901
|
+
* as Lunora knows, so minting for it would write a value the provider rejects at
|
|
902
|
+
* runtime — over the developer's own half-filled `.dev.vars` — and hide the gap
|
|
903
|
+
* from `lunora env doctor`, whose job is to report it as unfilled.
|
|
904
|
+
*/
|
|
776
905
|
declare const isMintableSecretKey: (key: string) => boolean;
|
|
777
906
|
/** Mint a fresh strong secret value — 64 hex chars (32 bytes), like `openssl rand -hex 32`. */
|
|
778
907
|
declare const generateSecretValue: (randomHex?: (bytes: number) => string) => string;
|
|
779
908
|
/**
|
|
780
|
-
* The outcome of planning a scaffold — a discriminated union so the orchestrator
|
|
781
|
-
* never has to re-derive whether `content` is present.
|
|
782
|
-
*
|
|
783
|
-
* `exists`: `.dev.vars` is already there; nothing to do.
|
|
784
|
-
* `no-example`: nothing to scaffold from (stay silent — the project may not use secrets).
|
|
785
|
-
* `generate`: write `content`, a copy of the example with secret-looking placeholders replaced by fresh random hex (`generatedKeys` lists which).
|
|
786
|
-
*/
|
|
909
|
+
* The outcome of planning a scaffold — a discriminated union so the orchestrator
|
|
910
|
+
* never has to re-derive whether `content` is present.
|
|
911
|
+
*
|
|
912
|
+
* `exists`: `.dev.vars` is already there; nothing to do.
|
|
913
|
+
* `no-example`: nothing to scaffold from (stay silent — the project may not use secrets).
|
|
914
|
+
* `generate`: write `content`, a copy of the example with secret-looking placeholders replaced by fresh random hex (`generatedKeys` lists which).
|
|
915
|
+
*/
|
|
787
916
|
type ScaffoldPlan = {
|
|
788
917
|
content: string;
|
|
789
918
|
generatedKeys: string[];
|
|
@@ -796,7 +925,8 @@ type ScaffoldPlan = {
|
|
|
796
925
|
/** Decide whether (and what) to scaffold. Pure — given the current state of the two files. */
|
|
797
926
|
declare const planDevVariablesScaffold: (input: {
|
|
798
927
|
devVarsExists: boolean;
|
|
799
|
-
exampleContent: string | undefined;
|
|
928
|
+
exampleContent: string | undefined;
|
|
929
|
+
/** Injectable for deterministic tests; defaults to `crypto.randomBytes`. */
|
|
800
930
|
randomHex?: (bytes: number) => string;
|
|
801
931
|
}) => ScaffoldPlan;
|
|
802
932
|
interface AugmentPlan {
|
|
@@ -808,22 +938,23 @@ interface AugmentPlan {
|
|
|
808
938
|
missingKeys: string[];
|
|
809
939
|
}
|
|
810
940
|
/**
|
|
811
|
-
* Plan how to top up an existing `.dev.vars` from the example: every example key
|
|
812
|
-
* not already present becomes an appended line (secret placeholders filled with
|
|
813
|
-
* fresh random hex, other values copied). Pure — no I/O. Empty `missingKeys`
|
|
814
|
-
* means the file is already complete.
|
|
815
|
-
*/
|
|
941
|
+
* Plan how to top up an existing `.dev.vars` from the example: every example key
|
|
942
|
+
* not already present becomes an appended line (secret placeholders filled with
|
|
943
|
+
* fresh random hex, other values copied). Pure — no I/O. Empty `missingKeys`
|
|
944
|
+
* means the file is already complete.
|
|
945
|
+
*/
|
|
816
946
|
declare const planDevVariablesAugment: (input: {
|
|
817
947
|
exampleContent: string;
|
|
818
|
-
existingContent: string;
|
|
948
|
+
existingContent: string;
|
|
949
|
+
/** Injectable for deterministic tests; defaults to `crypto.randomBytes`. */
|
|
819
950
|
randomHex?: (bytes: number) => string;
|
|
820
951
|
}) => AugmentPlan;
|
|
821
952
|
interface EnsureDevVariablesDeps {
|
|
822
953
|
/**
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
954
|
+
* Ask the user to confirm generating the file. Return `true` to generate.
|
|
955
|
+
* Consumers pass a TTY-aware prompt; in non-interactive contexts they should
|
|
956
|
+
* resolve `false` (we then report `"declined"` and the caller can hint).
|
|
957
|
+
*/
|
|
827
958
|
confirm: (message: string) => Promise<boolean>;
|
|
828
959
|
cwd: string;
|
|
829
960
|
/** Emit a human-facing line (success / hint). */
|
|
@@ -842,41 +973,51 @@ interface EnsureDevVariablesResult {
|
|
|
842
973
|
status: EnsureDevVariablesStatus;
|
|
843
974
|
}
|
|
844
975
|
/**
|
|
845
|
-
*
|
|
846
|
-
*
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
976
|
+
* Atomically (over)write a `.dev.vars`-shaped file, owner-only. For a file
|
|
977
|
+
* holding secrets a torn write would destroy every other local value alongside
|
|
978
|
+
* the new one, and the new value itself has no other recoverable copy if it
|
|
979
|
+
* was never disclosed anywhere else (Cloudflare secrets are write-only).
|
|
980
|
+
* Exported so a caller writing to a `.dev.vars`-shaped path outside this
|
|
981
|
+
* module (`lunora deploy`'s minted-secret disclosure) reuses this instead of
|
|
982
|
+
* hand-rolling another copy of the pattern.
|
|
983
|
+
*/
|
|
984
|
+
declare const writeDevVariablesFileAtomically: (path: string, content: string) => void;
|
|
985
|
+
/**
|
|
986
|
+
* Reconcile the project's `.dev.vars` with its `.dev.vars.example`:
|
|
987
|
+
*
|
|
988
|
+
* - file missing → offer to generate it (secret placeholders auto-filled);
|
|
989
|
+
* - file present but missing keys the example lists → offer to append them;
|
|
990
|
+
* - file present and complete → nothing to do.
|
|
991
|
+
*
|
|
992
|
+
* Prompts via `confirm` (skipped when `yes`); never overwrites existing values.
|
|
993
|
+
* Returns what happened so the caller can tailor any follow-up. Shared by
|
|
994
|
+
* `lunora dev` and the `@lunora/vite` dev server. All side effects funnel
|
|
995
|
+
* through `confirm`/`info`/`randomHex`.
|
|
996
|
+
*/
|
|
856
997
|
declare const ensureDevVariables: (deps: EnsureDevVariablesDeps) => Promise<EnsureDevVariablesResult>;
|
|
857
998
|
/**
|
|
858
|
-
* Build the text that should be merged into `.dev.vars.example` for the given
|
|
859
|
-
* set of package names. Only entries whose key is not already present in
|
|
860
|
-
* `existingKeys` are included (additive / idempotent). Returns an empty string
|
|
861
|
-
* when there is nothing to add.
|
|
862
|
-
*
|
|
863
|
-
* The output is grouped by package with a blank-line separator so the file
|
|
864
|
-
* reads cleanly when multiple packages each contribute several keys.
|
|
865
|
-
*
|
|
866
|
-
* **Safety invariant:** this function never writes a real secret — every value
|
|
867
|
-
* in the output is the entry's `placeholderValue`.
|
|
868
|
-
*/
|
|
999
|
+
* Build the text that should be merged into `.dev.vars.example` for the given
|
|
1000
|
+
* set of package names. Only entries whose key is not already present in
|
|
1001
|
+
* `existingKeys` are included (additive / idempotent). Returns an empty string
|
|
1002
|
+
* when there is nothing to add.
|
|
1003
|
+
*
|
|
1004
|
+
* The output is grouped by package with a blank-line separator so the file
|
|
1005
|
+
* reads cleanly when multiple packages each contribute several keys.
|
|
1006
|
+
*
|
|
1007
|
+
* **Safety invariant:** this function never writes a real secret — every value
|
|
1008
|
+
* in the output is the entry's `placeholderValue`.
|
|
1009
|
+
*/
|
|
869
1010
|
declare const buildPackageSecretsBlock: (packageNames: ReadonlyArray<string>, existingKeys: ReadonlySet<string>) => string;
|
|
870
1011
|
/**
|
|
871
|
-
* Write (or update) `.dev.vars.example` so that it contains the secrets
|
|
872
|
-
* required by `packageNames`. Existing lines are never removed or rewritten;
|
|
873
|
-
* new entries are appended (with a blank-line separator after existing content).
|
|
874
|
-
*
|
|
875
|
-
* Idempotent: re-running with the same `packageNames` does not duplicate keys
|
|
876
|
-
* already in the file. Returns the list of keys that were actually appended.
|
|
877
|
-
*
|
|
878
|
-
* **Safety invariant:** only placeholder values are written — no real secrets.
|
|
879
|
-
*/
|
|
1012
|
+
* Write (or update) `.dev.vars.example` so that it contains the secrets
|
|
1013
|
+
* required by `packageNames`. Existing lines are never removed or rewritten;
|
|
1014
|
+
* new entries are appended (with a blank-line separator after existing content).
|
|
1015
|
+
*
|
|
1016
|
+
* Idempotent: re-running with the same `packageNames` does not duplicate keys
|
|
1017
|
+
* already in the file. Returns the list of keys that were actually appended.
|
|
1018
|
+
*
|
|
1019
|
+
* **Safety invariant:** only placeholder values are written — no real secrets.
|
|
1020
|
+
*/
|
|
880
1021
|
declare const ensureDevVariablesExample: (cwd: string, packageNames: ReadonlyArray<string>) => string[];
|
|
881
1022
|
interface DevSecretsFillPlan {
|
|
882
1023
|
/** {@link CORE_SECRETS} keys appended because they were absent (each generated). */
|
|
@@ -887,19 +1028,21 @@ interface DevSecretsFillPlan {
|
|
|
887
1028
|
filledKeys: string[];
|
|
888
1029
|
}
|
|
889
1030
|
/**
|
|
890
|
-
* Plan the in-place generation of dev secrets for a `.dev.vars`. First, every
|
|
891
|
-
* line whose
|
|
892
|
-
*
|
|
893
|
-
* generated value
|
|
894
|
-
* secret blank) becomes usable on `lunora dev` / `vite dev` without
|
|
895
|
-
* running `openssl` by hand.
|
|
896
|
-
*
|
|
897
|
-
*
|
|
898
|
-
*
|
|
899
|
-
*
|
|
900
|
-
*
|
|
901
|
-
*
|
|
902
|
-
|
|
1031
|
+
* Plan the in-place generation of dev secrets for a `.dev.vars`. First, every
|
|
1032
|
+
* line whose key is {@link isMintableSecretKey mintable} — registry membership,
|
|
1033
|
+
* NOT the key's name shape — and whose value is empty or a placeholder gets a
|
|
1034
|
+
* freshly generated value, so a `lunora add`-scaffolded `.dev.vars` (which
|
|
1035
|
+
* writes each secret blank) becomes usable on `lunora dev` / `vite dev` without
|
|
1036
|
+
* the user running `openssl` by hand. A provider-issued key (`OPENAI_API_KEY`,
|
|
1037
|
+
* `STRIPE_SECRET_KEY`) is left verbatim so `lunora env doctor` can still report
|
|
1038
|
+
* it as unfilled. Second, any {@link CORE_SECRETS} key absent from
|
|
1039
|
+
* the file is appended (generated) — notably `LUNORA_ADMIN_TOKEN`, which the
|
|
1040
|
+
* local Studio needs to call the worker's admin gate in dev (without it the
|
|
1041
|
+
* Studio shows its login gate).
|
|
1042
|
+
*
|
|
1043
|
+
* Pure (given `randomHex`): real (non-placeholder) values are never touched, and
|
|
1044
|
+
* comments + non-secret entries are preserved verbatim.
|
|
1045
|
+
*/
|
|
903
1046
|
declare const planDevSecretsFill: (input: {
|
|
904
1047
|
existingContent: string;
|
|
905
1048
|
randomHex?: (bytes: number) => string;
|
|
@@ -913,25 +1056,38 @@ interface FillDevSecretsResult {
|
|
|
913
1056
|
status: "created" | "filled" | "unchanged";
|
|
914
1057
|
}
|
|
915
1058
|
/**
|
|
916
|
-
* Generate any missing/empty dev secrets in the project's `.dev.vars`, in place.
|
|
917
|
-
*
|
|
918
|
-
* Complements {@link ensureDevVariables} (which scaffolds `.dev.vars` from
|
|
919
|
-
* `.dev.vars.example`). A `lunora add`-scaffolded project writes secrets blank
|
|
920
|
-
* straight into `.dev.vars` (no example) and never includes `LUNORA_ADMIN_TOKEN`
|
|
921
|
-
* — so the worker boots with empty secrets and the Studio shows its login gate.
|
|
922
|
-
* This fills those gaps at dev startup, so both `lunora dev` and the
|
|
923
|
-
* `@lunora/vite` dev server give a working project with zero manual `openssl`.
|
|
924
|
-
*
|
|
925
|
-
* Never overwrites a real (non-placeholder) value.
|
|
926
|
-
*
|
|
927
|
-
|
|
1059
|
+
* Generate any missing/empty dev secrets in the project's `.dev.vars`, in place.
|
|
1060
|
+
*
|
|
1061
|
+
* Complements {@link ensureDevVariables} (which scaffolds `.dev.vars` from
|
|
1062
|
+
* `.dev.vars.example`). A `lunora add`-scaffolded project writes secrets blank
|
|
1063
|
+
* straight into `.dev.vars` (no example) and never includes `LUNORA_ADMIN_TOKEN`
|
|
1064
|
+
* — so the worker boots with empty secrets and the Studio shows its login gate.
|
|
1065
|
+
* This fills those gaps at dev startup, so both `lunora dev` and the
|
|
1066
|
+
* `@lunora/vite` dev server give a working project with zero manual `openssl`.
|
|
1067
|
+
*
|
|
1068
|
+
* Never overwrites a real (non-placeholder) value. Two writers, on purpose: when
|
|
1069
|
+
* the file does not exist yet, the create goes through {@link createExclusively}
|
|
1070
|
+
* and loses to a peer that creates it first; when it exists, the fill rewrites
|
|
1071
|
+
* it through {@link atomicWrite} (temp + rename, owner-only) with the keys it
|
|
1072
|
+
* just read and planned against.
|
|
1073
|
+
*/
|
|
928
1074
|
declare const fillDevSecrets: (deps: {
|
|
929
1075
|
cwd: string;
|
|
930
1076
|
info?: (message: string) => void;
|
|
931
1077
|
randomHex?: (bytes: number) => string;
|
|
932
1078
|
}) => FillDevSecretsResult;
|
|
1079
|
+
/** Storage backends `.global()` accepts. A closed union, so it is never free text. */
|
|
1080
|
+
type GlobalBackend = "d1" | "hyperdrive";
|
|
933
1081
|
/** Add a new table to `defineSchema({ ... })`. */
|
|
934
1082
|
interface AddTableEdit {
|
|
1083
|
+
/**
|
|
1084
|
+
* Mark the table `.global()`. Pass `{}` for the D1 default, or a backend for
|
|
1085
|
+
* an external store — `lunora introspect` uses `{ backend: "hyperdrive" }`
|
|
1086
|
+
* because the rows live in the database it read.
|
|
1087
|
+
*/
|
|
1088
|
+
readonly global?: {
|
|
1089
|
+
readonly backend?: GlobalBackend;
|
|
1090
|
+
};
|
|
935
1091
|
readonly kind: "addTable";
|
|
936
1092
|
readonly table: string;
|
|
937
1093
|
}
|
|
@@ -941,11 +1097,11 @@ interface AddOptionalColumnEdit {
|
|
|
941
1097
|
readonly kind: "addOptionalColumn";
|
|
942
1098
|
readonly table: string;
|
|
943
1099
|
/**
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1100
|
+
* Inner validator expression text WITHOUT the `v.optional(...)` wrapper, e.g.
|
|
1101
|
+
* `v.string()`. Always wrapped in `v.optional(...)` on apply, because only
|
|
1102
|
+
* optional columns are additive-safe (a required column needs a backfill
|
|
1103
|
+
* migration).
|
|
1104
|
+
*/
|
|
949
1105
|
readonly validator: string;
|
|
950
1106
|
}
|
|
951
1107
|
/** Add a secondary index to an existing table. */
|
|
@@ -959,9 +1115,9 @@ interface AddIndexEdit {
|
|
|
959
1115
|
/** Additive edits — the only requests {@link applyAdditiveEdit} applies. */
|
|
960
1116
|
type AdditiveEdit = AddIndexEdit | AddOptionalColumnEdit | AddTableEdit;
|
|
961
1117
|
/**
|
|
962
|
-
* Destructive edits — never applied directly; routed to the migration handoff
|
|
963
|
-
* (plan 024 Item 5). Carried as data so the editor can describe the request.
|
|
964
|
-
*/
|
|
1118
|
+
* Destructive edits — never applied directly; routed to the migration handoff
|
|
1119
|
+
* (plan 024 Item 5). Carried as data so the editor can describe the request.
|
|
1120
|
+
*/
|
|
965
1121
|
interface DestructiveEdit {
|
|
966
1122
|
readonly column?: string;
|
|
967
1123
|
readonly kind: "changeColumnType" | "dropColumn" | "dropTable" | "makeRequired" | "renameColumn";
|
|
@@ -972,9 +1128,9 @@ interface DestructiveEdit {
|
|
|
972
1128
|
/** Any edit the editor can request. */
|
|
973
1129
|
type SchemaEdit = AdditiveEdit | DestructiveEdit;
|
|
974
1130
|
/**
|
|
975
|
-
* Classify an edit request. Additive edits ({@link AdditiveEdit}) apply
|
|
976
|
-
* directly; everything else changes stored data and is destructive.
|
|
977
|
-
*/
|
|
1131
|
+
* Classify an edit request. Additive edits ({@link AdditiveEdit}) apply
|
|
1132
|
+
* directly; everything else changes stored data and is destructive.
|
|
1133
|
+
*/
|
|
978
1134
|
declare const classifyEdit: (edit: SchemaEdit) => "additive" | "destructive";
|
|
979
1135
|
/** Failure reasons an additive edit can report. */
|
|
980
1136
|
type ApplyFailureReason = "aliased-define-schema" | "destructive" | "duplicate-column" | "duplicate-index" | "duplicate-table" | "invalid-identifier" | "invalid-validator" | "no-define-schema" | "non-object-argument" | "unknown-table";
|
|
@@ -987,10 +1143,10 @@ type ApplyEditResult = {
|
|
|
987
1143
|
text: string;
|
|
988
1144
|
};
|
|
989
1145
|
/**
|
|
990
|
-
* Apply an **additive** edit to a schema source string, preserving formatting.
|
|
991
|
-
* Destructive edits are refused with `{ ok: false, reason: "destructive" }`;
|
|
992
|
-
* route them through the migration handoff (plan 024 Item 5).
|
|
993
|
-
*/
|
|
1146
|
+
* Apply an **additive** edit to a schema source string, preserving formatting.
|
|
1147
|
+
* Destructive edits are refused with `{ ok: false, reason: "destructive" }`;
|
|
1148
|
+
* route them through the migration handoff (plan 024 Item 5).
|
|
1149
|
+
*/
|
|
994
1150
|
declare const applyAdditiveEdit: (source: string, edit: SchemaEdit) => ApplyEditResult;
|
|
995
1151
|
/** A single declared column: its name and the raw validator expression text. */
|
|
996
1152
|
interface SchemaColumn {
|
|
@@ -1029,294 +1185,9 @@ type ParseSchemaResult = {
|
|
|
1029
1185
|
tables: ReadonlyArray<SchemaTable>;
|
|
1030
1186
|
};
|
|
1031
1187
|
/**
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
*/
|
|
1036
|
-
|
|
1037
|
-
/**
|
|
1038
|
-
* Parse the tables (with typed columns + indexes) out of a `lunora/schema.ts`
|
|
1039
|
-
* source string. Returns a tagged result so callers can render a helpful
|
|
1040
|
-
* message per failure mode without throwing.
|
|
1041
|
-
*/
|
|
1188
|
+
* Parse the tables (with typed columns + indexes) out of a `lunora/schema.ts`
|
|
1189
|
+
* source string. Returns a tagged result so callers can render a helpful
|
|
1190
|
+
* message per failure mode without throwing.
|
|
1191
|
+
*/
|
|
1042
1192
|
declare const parseSchema: (source: string) => ParseSchemaResult;
|
|
1043
|
-
|
|
1044
|
-
/** Whether the lunora schema declares any `.global()` table. */
|
|
1045
|
-
hasGlobalTable: boolean;
|
|
1046
|
-
/** Names of vector indexes declared via `.vectorize()` / `defineVectorIndex()`. */
|
|
1047
|
-
vectorIndexNames?: ReadonlyArray<string>;
|
|
1048
|
-
}
|
|
1049
|
-
interface DiscoverSchemaInfoResult {
|
|
1050
|
-
/** Parse error message, when the schema exists but could not be analyzed. */
|
|
1051
|
-
error?: string;
|
|
1052
|
-
/** Schema facts, or `undefined` when no `schema.ts` exists or parsing failed. */
|
|
1053
|
-
info: SchemaInfo | undefined;
|
|
1054
|
-
}
|
|
1055
|
-
/**
|
|
1056
|
-
* Discover {@link SchemaInfo} for a project. Returns `{ info: undefined }` when
|
|
1057
|
-
* the project declares no `schema.ts` (not an error), or `{ info: undefined,
|
|
1058
|
-
* error }` when a present schema could not be parsed — callers decide whether a
|
|
1059
|
-
* parse failure is a warning (validator) or simply ignorable (inference).
|
|
1060
|
-
*/
|
|
1061
|
-
declare const discoverSchemaInfo: (projectRoot: string, schemaDirectory: string) => DiscoverSchemaInfoResult;
|
|
1062
|
-
/**
|
|
1063
|
-
* A badge: the short colored label that prefixes a line. `bg`/`fg` are hex so the
|
|
1064
|
-
* same value drives both colorize's `bgHex().hex()` and the tui `<Text>` props.
|
|
1065
|
-
*/
|
|
1066
|
-
interface BadgeSpec {
|
|
1067
|
-
bg: `#${string}`;
|
|
1068
|
-
fg: `#${string}`;
|
|
1069
|
-
text: string;
|
|
1070
|
-
}
|
|
1071
|
-
/** Lunora purple — the accent shared with the CLI prompt frames. */
|
|
1072
|
-
declare const ACCENT: `#${string}`;
|
|
1073
|
-
/** Standard log-level badge names (the restyled base output). */
|
|
1074
|
-
type LevelBadgeName = "debug" | "error" | "info" | "success" | "warn";
|
|
1075
|
-
/** Step-phase badge names (the create-astro-style flow transcript). */
|
|
1076
|
-
type StepBadgeName = "add" | "deps" | "dir" | "git" | "lunora" | "next" | "tmpl";
|
|
1077
|
-
type BadgeName = LevelBadgeName | StepBadgeName;
|
|
1078
|
-
/** The ordered step-phase names, used to register custom pail log types. */
|
|
1079
|
-
declare const STEP_BADGE_NAMES: ReadonlyArray<StepBadgeName>;
|
|
1080
|
-
/**
|
|
1081
|
-
* Every badge, keyed by name. Levels get their conventional colors (red/amber/
|
|
1082
|
-
* green/blue/grey); step phases follow create-astro's green→purple→cyan rhythm.
|
|
1083
|
-
*/
|
|
1084
|
-
declare const BADGES: Record<BadgeName, BadgeSpec>;
|
|
1085
|
-
/**
|
|
1086
|
-
* Luna, the mascot: the folklore rabbit-in-the-moon — a bunny tucked inside the
|
|
1087
|
-
* moon disc. Pure ASCII so it renders the same everywhere (including piped logs).
|
|
1088
|
-
* The CLI signs off the `init` flow with it, the way create-astro closes with
|
|
1089
|
-
* Houston.
|
|
1090
|
-
*/
|
|
1091
|
-
declare const LUNA_NAME = "Luna";
|
|
1092
|
-
declare const LUNA_SIGNOFF = "Safe travels, voyager.";
|
|
1093
|
-
declare const LUNA_BUNNY: string;
|
|
1094
|
-
/**
|
|
1095
|
-
* {@link LUNA_BUNNY} with its leading newline stripped, ready to render inline
|
|
1096
|
-
* (beside the name + sign-off). Both render paths — the tui mascot frame and the
|
|
1097
|
-
* pail off-TTY fallback — use this so neither re-implements the strip.
|
|
1098
|
-
*/
|
|
1099
|
-
declare const LUNA_ART: string;
|
|
1100
|
-
/** The colored part of a badge — the word with one space of padding each side. */
|
|
1101
|
-
declare const padBadge: (text: string) => string;
|
|
1102
|
-
/** Leading spaces that right-align a badge's box within the gutter. */
|
|
1103
|
-
declare const badgeLead: (text: string) => string;
|
|
1104
|
-
/** Total columns a rendered badge column occupies (lead + box), constant across badges. */
|
|
1105
|
-
declare const BADGE_COLUMN_WIDTH: number;
|
|
1106
|
-
/** Columns a rendered badge occupies — the gutter-aligned column width. */
|
|
1107
|
-
declare const badgeWidth: (_spec: BadgeSpec) => number;
|
|
1108
|
-
/** Paint a badge as an ANSI string (the non-tui path): right-aligning spaces + the colored box. */
|
|
1109
|
-
declare const paintBadge: (spec: BadgeSpec) => string;
|
|
1110
|
-
/** Dim continuation text (a step's chosen answer, shown under the question). */
|
|
1111
|
-
declare const paintAnswer: (text: string) => string;
|
|
1112
|
-
/** Candidate wrangler config filenames, in the order every consumer probes them. */
|
|
1113
|
-
declare const WRANGLER_FILES: readonly ["wrangler.jsonc", "wrangler.json"];
|
|
1114
|
-
/** Locate the project's wrangler config, or `undefined` when none exists. */
|
|
1115
|
-
declare const findWranglerFile: (projectRoot: string) => string | undefined;
|
|
1116
|
-
interface ReadWranglerResult<T> {
|
|
1117
|
-
/** Parsed config, or `undefined` when the file was not valid JSONC. */
|
|
1118
|
-
parsed: T | undefined;
|
|
1119
|
-
/** Raw file text — needed for comment-preserving `modify`/`applyEdits`. */
|
|
1120
|
-
text: string;
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Read and JSONC-parse a wrangler config file. Returns the raw `text` (for
|
|
1124
|
-
* structural edits) alongside `parsed`, which is `undefined` when the file is
|
|
1125
|
-
* not valid JSONC or does not parse to an object. Allows trailing commas, as
|
|
1126
|
-
* wrangler does.
|
|
1127
|
-
*/
|
|
1128
|
-
declare const readWranglerJsonc: <T = unknown>(wranglerPath: string) => ReadWranglerResult<T>;
|
|
1129
|
-
declare const REQUIRED_COMPATIBILITY_DATE: string;
|
|
1130
|
-
declare const REQUIRED_FLAG: string;
|
|
1131
|
-
interface WranglerDurableObjectBinding {
|
|
1132
|
-
class_name?: string;
|
|
1133
|
-
name?: string;
|
|
1134
|
-
}
|
|
1135
|
-
/**
|
|
1136
|
-
* A `tail_consumers` entry: a Worker that receives this Worker's tail events
|
|
1137
|
-
* (logs, exceptions, fetch metadata) for forwarding to an external sink. See
|
|
1138
|
-
* `withTailConsumer` for the wiring helper.
|
|
1139
|
-
*/
|
|
1140
|
-
interface TailConsumer {
|
|
1141
|
-
/** Optional Cloudflare environment of the consumer Worker. */
|
|
1142
|
-
environment?: string;
|
|
1143
|
-
/** Name of the Worker that consumes tail events. */
|
|
1144
|
-
service?: string;
|
|
1145
|
-
}
|
|
1146
|
-
/** A wrangler `containers[]` entry (parsed from untrusted JSONC). */
|
|
1147
|
-
interface WranglerContainerEntry {
|
|
1148
|
-
class_name?: string;
|
|
1149
|
-
image?: string;
|
|
1150
|
-
instance_type?: string | {
|
|
1151
|
-
disk_mb?: number;
|
|
1152
|
-
memory_mib?: number;
|
|
1153
|
-
vcpu?: number;
|
|
1154
|
-
};
|
|
1155
|
-
max_instances?: number;
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* A wrangler `workflows[]` entry (parsed from untrusted JSONC). Unlike
|
|
1159
|
-
* containers, workflows are NOT Durable Objects — the entry stands alone (no
|
|
1160
|
-
* `durable_objects` binding, no migration class).
|
|
1161
|
-
*/
|
|
1162
|
-
interface WranglerWorkflowEntry {
|
|
1163
|
-
binding?: string;
|
|
1164
|
-
class_name?: string;
|
|
1165
|
-
name?: string;
|
|
1166
|
-
}
|
|
1167
|
-
/** A wrangler `queues.producers[]` entry — a `Queue` binding sending to `queue`. */
|
|
1168
|
-
interface WranglerQueueProducer {
|
|
1169
|
-
binding?: string;
|
|
1170
|
-
delivery_delay?: number;
|
|
1171
|
-
queue?: string;
|
|
1172
|
-
}
|
|
1173
|
-
/** A wrangler `queues.consumers[]` entry — push (worker) or `type: "http_pull"`. */
|
|
1174
|
-
interface WranglerQueueConsumer {
|
|
1175
|
-
dead_letter_queue?: string;
|
|
1176
|
-
max_batch_size?: number;
|
|
1177
|
-
max_batch_timeout?: number;
|
|
1178
|
-
max_retries?: number;
|
|
1179
|
-
queue?: string;
|
|
1180
|
-
retry_delay?: number;
|
|
1181
|
-
type?: string;
|
|
1182
|
-
}
|
|
1183
|
-
interface WranglerConfig {
|
|
1184
|
-
analytics_engine_datasets?: ReadonlyArray<{
|
|
1185
|
-
binding?: string;
|
|
1186
|
-
dataset?: string;
|
|
1187
|
-
} | null | undefined>;
|
|
1188
|
-
assets?: {
|
|
1189
|
-
binding?: string;
|
|
1190
|
-
directory?: string;
|
|
1191
|
-
html_handling?: string;
|
|
1192
|
-
not_found_handling?: string;
|
|
1193
|
-
};
|
|
1194
|
-
browser?: {
|
|
1195
|
-
binding?: string;
|
|
1196
|
-
};
|
|
1197
|
-
compatibility_date?: string;
|
|
1198
|
-
compatibility_flags?: ReadonlyArray<string>;
|
|
1199
|
-
containers?: ReadonlyArray<WranglerContainerEntry | null | undefined>;
|
|
1200
|
-
d1_databases?: ReadonlyArray<{
|
|
1201
|
-
binding?: string;
|
|
1202
|
-
}>;
|
|
1203
|
-
dispatch_namespaces?: ReadonlyArray<{
|
|
1204
|
-
binding?: string;
|
|
1205
|
-
namespace?: string;
|
|
1206
|
-
outbound?: unknown;
|
|
1207
|
-
} | null | undefined>;
|
|
1208
|
-
durable_objects?: {
|
|
1209
|
-
bindings?: ReadonlyArray<WranglerDurableObjectBinding>;
|
|
1210
|
-
};
|
|
1211
|
-
flagship?: ReadonlyArray<{
|
|
1212
|
-
app_id?: string;
|
|
1213
|
-
binding?: string;
|
|
1214
|
-
} | null | undefined>;
|
|
1215
|
-
hyperdrive?: ReadonlyArray<{
|
|
1216
|
-
binding?: string;
|
|
1217
|
-
id?: string;
|
|
1218
|
-
localConnectionString?: string;
|
|
1219
|
-
} | null | undefined>;
|
|
1220
|
-
images?: {
|
|
1221
|
-
binding?: string;
|
|
1222
|
-
};
|
|
1223
|
-
kv_namespaces?: ReadonlyArray<{
|
|
1224
|
-
binding?: string;
|
|
1225
|
-
id?: string;
|
|
1226
|
-
} | null | undefined>;
|
|
1227
|
-
logpush?: boolean;
|
|
1228
|
-
migrations?: ReadonlyArray<{
|
|
1229
|
-
new_classes?: ReadonlyArray<string>;
|
|
1230
|
-
new_sqlite_classes?: ReadonlyArray<string>;
|
|
1231
|
-
} | null | undefined>;
|
|
1232
|
-
mtls_certificates?: ReadonlyArray<{
|
|
1233
|
-
binding?: string;
|
|
1234
|
-
certificate_id?: string;
|
|
1235
|
-
} | null | undefined>;
|
|
1236
|
-
observability?: {
|
|
1237
|
-
enabled?: boolean;
|
|
1238
|
-
head_sampling_rate?: number;
|
|
1239
|
-
logs?: {
|
|
1240
|
-
enabled?: boolean;
|
|
1241
|
-
head_sampling_rate?: number;
|
|
1242
|
-
};
|
|
1243
|
-
};
|
|
1244
|
-
pipelines?: ReadonlyArray<{
|
|
1245
|
-
binding?: string;
|
|
1246
|
-
pipeline?: string;
|
|
1247
|
-
} | null | undefined>;
|
|
1248
|
-
placement?: {
|
|
1249
|
-
mode?: string;
|
|
1250
|
-
};
|
|
1251
|
-
queues?: {
|
|
1252
|
-
consumers?: ReadonlyArray<WranglerQueueConsumer | null | undefined>;
|
|
1253
|
-
producers?: ReadonlyArray<WranglerQueueProducer | null | undefined>;
|
|
1254
|
-
};
|
|
1255
|
-
r2_buckets?: ReadonlyArray<{
|
|
1256
|
-
binding?: string;
|
|
1257
|
-
}>;
|
|
1258
|
-
secrets_store_secrets?: ReadonlyArray<{
|
|
1259
|
-
binding?: string;
|
|
1260
|
-
secret_name?: string;
|
|
1261
|
-
store_id?: string;
|
|
1262
|
-
} | null | undefined>;
|
|
1263
|
-
send_email?: ReadonlyArray<{
|
|
1264
|
-
allowed_destination_addresses?: ReadonlyArray<string>;
|
|
1265
|
-
destination_address?: string;
|
|
1266
|
-
name?: string;
|
|
1267
|
-
} | null | undefined>;
|
|
1268
|
-
services?: ReadonlyArray<{
|
|
1269
|
-
binding?: string;
|
|
1270
|
-
entrypoint?: string;
|
|
1271
|
-
environment?: string;
|
|
1272
|
-
service?: string;
|
|
1273
|
-
} | null | undefined>;
|
|
1274
|
-
tail_consumers?: ReadonlyArray<TailConsumer | null | undefined>;
|
|
1275
|
-
vars?: Record<string, unknown>;
|
|
1276
|
-
vectorize?: ReadonlyArray<{
|
|
1277
|
-
binding?: string;
|
|
1278
|
-
index_name?: string;
|
|
1279
|
-
} | null | undefined>;
|
|
1280
|
-
workflows?: ReadonlyArray<WranglerWorkflowEntry | null | undefined>;
|
|
1281
|
-
}
|
|
1282
|
-
interface WranglerValidationReport {
|
|
1283
|
-
errors: string[];
|
|
1284
|
-
valid: boolean;
|
|
1285
|
-
warnings: string[];
|
|
1286
|
-
}
|
|
1287
|
-
/**
|
|
1288
|
-
* Return a new `WranglerConfig` with `consumer` present in `tail_consumers`,
|
|
1289
|
-
* wiring this Worker to forward its tail events (logs/exceptions) to another
|
|
1290
|
-
* Worker that fans them out to an external sink. Pure and idempotent: an
|
|
1291
|
-
* existing entry with the same `service` + `environment` is left untouched
|
|
1292
|
-
* rather than duplicated, so it is safe to call on every codegen/deploy.
|
|
1293
|
-
*/
|
|
1294
|
-
declare const withTailConsumer: (wrangler: WranglerConfig, consumer: TailConsumer) => WranglerConfig;
|
|
1295
|
-
/**
|
|
1296
|
-
* Pure validator: given a parsed `WranglerConfig` object and an optional
|
|
1297
|
-
* `SchemaInfo`, produce a structured report. Performs no I/O.
|
|
1298
|
-
*/
|
|
1299
|
-
declare const validateWranglerConfig: (wrangler: WranglerConfig | undefined, schema?: SchemaInfo) => WranglerValidationReport;
|
|
1300
|
-
/**
|
|
1301
|
-
* Convenience alias matching the original task-spec signature
|
|
1302
|
-
* `validateWrangler(wranglerJson, schema)` returning
|
|
1303
|
-
* `{ valid, errors, warnings }`.
|
|
1304
|
-
*/
|
|
1305
|
-
declare const validateWrangler: typeof validateWranglerConfig;
|
|
1306
|
-
interface WranglerProjectValidationOptions {
|
|
1307
|
-
projectRoot: string;
|
|
1308
|
-
schemaDir?: string;
|
|
1309
|
-
}
|
|
1310
|
-
interface WranglerProjectValidationResult {
|
|
1311
|
-
problems: ReadonlyArray<string>;
|
|
1312
|
-
report: WranglerValidationReport;
|
|
1313
|
-
wranglerPath: string | undefined;
|
|
1314
|
-
}
|
|
1315
|
-
/**
|
|
1316
|
-
* File-system aware variant: reads `wrangler.jsonc`/`wrangler.json` from
|
|
1317
|
-
* the given project root, discovers the schema (if any), and delegates to
|
|
1318
|
-
* `validateWranglerConfig`. Returns the legacy
|
|
1319
|
-
* `{ problems, wranglerPath }` shape plus the structured `report`.
|
|
1320
|
-
*/
|
|
1321
|
-
declare const validateWranglerProject: (options: WranglerProjectValidationOptions) => WranglerProjectValidationResult;
|
|
1322
|
-
export { ACCENT, AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentRulesStatus, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BADGES, BADGE_COLUMN_WIDTH, type BadgeName, type BadgeSpec, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, type DestructiveEdit, type DetectedFramework, type DevSecretsFillPlan, type DiscoverContainerInfoResult, type DiscoverSchemaInfoResult, type DiscoverWorkflowInfoResult, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type ExportGap, type FillDevSecretsResult, type FrameworkClass, type FrameworkDetection, type InferOptions, type InferredBindings, type InferredContainer, type InferredWorkflow, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, LUNORA_CONFIG_FILE, LUNORA_EVENT_SOURCE, LUNORA_SKILL_NAMES, type LevelBadgeName, type LinkedProject, type LunoraFormattedLine, type LunoraLineLevel, type LunoraProjectConfig, LunoraReporter, type MaterializeOptions, type MaterializeResult, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, ROOT_SKILL_NAME, type ReadWranglerResult, type ReconcileBindingsResult, type RemoteBindingPlan, type RemoteEnableInputs, type RemotePreference, type RemoteWranglerShape, STEP_BADGE_NAMES, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaInfo, type SchemaTable, type SecretEntry, type SelectOption, type StepBadgeName, type TailConsumer, WRANGLER_FILES, type WranglerConfig, type WranglerContainerEntry, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry, applyAdditiveEdit, badgeLead, badgeWidth, buildPackageSecretsBlock, claimAgentRulesHint, classifyEdit, createConfirm, detectAgentRules, detectFramework, discoverContainerInfo, discoverSchemaInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, fillDevSecrets, findWranglerFile, formatLunoraEvent, generateSecretValue, inferLunoraBindings, injectRemoteFlags, interpretRemote, isInteractive, isMintableSecretKey, isPlaceholderValue, isRemoteEnvEnabled, materializeRemoteWranglerConfig, packageNamesFromBindings, padBadge, paintAnswer, paintBadge, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, planRemoteBindings, promptMultiSelect, promptSelect, promptYesNo, readLinkedProject, readProjectRemotePreference, readWranglerJsonc, reconcileWranglerBindings, requiredSecrets, resolveRemoteEnabled, secretsForPackages, streamContainerLogs, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer, writeLinkedProject };
|
|
1193
|
+
export { AGENT_MODE_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DestructiveEdit, type DetectedFramework, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DiscoveryCache, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LAZY_FUNCTIONS_ENV, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LunoraFormattedLine, type LunoraLineLevel, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, type PostCodegenHookResult, type RemotePreference, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, acceptsConnection, applyAdditiveEdit, applyLintIgnores, blockingFindingsMessage, buildPackageSecretsBlock, claimDevServerState, classifyEdit, clearDevServerState, createConfirm, detectAiAgent, detectFramework, detectLintTools, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, escapeRegExp, fillDevSecrets, formatLunoraEvent, generateSecretValue, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isLazyFunctionsEnabled, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readDevServerState, readLinkedProject, readLiveDevServerState, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveLazyFunctions, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, updateDevServerState, upsertDevVariableLine, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
|