@lunora/config 1.0.0-alpha.19 → 1.0.0-alpha.190

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