@lunora/config 1.0.0-alpha.17 → 1.0.0-alpha.170

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