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