@lunora/config 1.0.0-alpha.47 → 1.0.0-alpha.471

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/LICENSE.md +336 -104
  2. package/README.md +6 -6
  3. package/dist/celld/index.d.mts +77 -0
  4. package/dist/celld/index.d.ts +77 -0
  5. package/dist/celld/index.mjs +1 -0
  6. package/dist/celld-names/index.d.mts +57 -0
  7. package/dist/celld-names/index.d.ts +57 -0
  8. package/dist/celld-names/index.mjs +1 -0
  9. package/dist/cli/index.d.mts +2 -0
  10. package/dist/cli/index.d.ts +2 -0
  11. package/dist/cli/index.mjs +1 -0
  12. package/dist/cloudflare/index.d.mts +941 -0
  13. package/dist/cloudflare/index.d.ts +941 -0
  14. package/dist/cloudflare/index.mjs +1 -0
  15. package/dist/index.d.mts +1068 -1044
  16. package/dist/index.d.ts +1068 -1044
  17. package/dist/index.mjs +1 -25
  18. package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
  19. package/dist/packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs +1 -0
  20. package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
  21. package/dist/packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs +1 -0
  22. package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
  23. package/dist/packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs +1 -0
  24. package/dist/packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs +1 -0
  25. package/dist/packem_shared/CELLD_RELEASE_ASSETS_DIRECTORY-YBhEotjs.mjs +1 -0
  26. package/dist/packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs +1 -0
  27. package/dist/packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs +1 -0
  28. package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs +1 -0
  29. package/dist/packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs +1 -0
  30. package/dist/packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs +1 -0
  31. package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs +1 -0
  32. package/dist/packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs +1 -0
  33. package/dist/packem_shared/DEV_BINDINGS_FILE-BUTedHwq.mjs +4 -0
  34. package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs +6 -0
  35. package/dist/packem_shared/DEV_WORKER_ENV_VALUE-FoysLtF0.mjs +1 -0
  36. package/dist/packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs +1 -0
  37. package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
  38. package/dist/packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs +9 -0
  39. package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
  40. package/dist/packem_shared/LUNORA_TAG-DQTGPqcJ.mjs +1 -0
  41. package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
  42. package/dist/packem_shared/MissingBuildOutputError-BAyekzof.mjs +1 -0
  43. package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs +1 -0
  44. package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-BiQ1zNsR.mjs +1 -0
  45. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-DgmXfSuu.mjs +1 -0
  46. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-BqFeetpX.mjs +1 -0
  47. package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-D296PlpV.mjs +1 -0
  48. package/dist/packem_shared/SEED_ENDPOINT-C1fhrehH.mjs +1 -0
  49. package/dist/packem_shared/STUDIO_PATH-CvVcvTbQ.mjs +1 -0
  50. package/dist/packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs +1 -0
  51. package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-BZEXldUo.mjs +1 -0
  52. package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
  53. package/dist/packem_shared/WRANGLER_FILES-BF8PUjuo.mjs +1 -0
  54. package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
  55. package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
  56. package/dist/packem_shared/applyAdditiveEdit-DEwPKcJg.mjs +6 -0
  57. package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
  58. package/dist/packem_shared/assertBuildTargetMatches-D11J7F38.mjs +1 -0
  59. package/dist/packem_shared/assertWranglerSatisfiesSchema-_70vhvqk.mjs +3 -0
  60. package/dist/packem_shared/asset-headers-CPuEX21i.mjs +4 -0
  61. package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
  62. package/dist/packem_shared/binding-manifest.d-BRdoMhGE.d.mts +593 -0
  63. package/dist/packem_shared/binding-manifest.d-BRdoMhGE.d.ts +593 -0
  64. package/dist/packem_shared/bindingsNeedingDatabase-3KyGflIq.mjs +3 -0
  65. package/dist/packem_shared/blockingFindingsMessage-BQ9z7cie.mjs +1 -0
  66. package/dist/packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs +19 -0
  67. package/dist/packem_shared/canonicalPath-DrfMiT3U.mjs +1 -0
  68. package/dist/packem_shared/celld-binding-id-9MiUoteo.mjs +1 -0
  69. package/dist/packem_shared/celld-config-Ef1RZ02t.mjs +3 -0
  70. package/dist/packem_shared/checkDevEnv-BwZSVBbB.mjs +3 -0
  71. package/dist/packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs +24 -0
  72. package/dist/packem_shared/clearApiSpecMarker-DMGpP41V.mjs +2 -0
  73. package/dist/packem_shared/collectExportGaps-DvirOIVB.mjs +2 -0
  74. package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
  75. package/dist/packem_shared/createDiscoveryCache-npJI4uej.mjs +1 -0
  76. package/dist/packem_shared/createStudioDocumentCache-XBG1aWbl.mjs +1 -0
  77. package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.mts +190 -0
  78. package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.ts +190 -0
  79. package/dist/packem_shared/describePreservedCrons-i5XT6rtl.mjs +1 -0
  80. package/dist/packem_shared/describeWithheld-CN3D-4pU.mjs +1 -0
  81. package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
  82. package/dist/packem_shared/devTriggerHints-CN_RJxWW.mjs +1 -0
  83. package/dist/packem_shared/devVariablesStamp-BQkGEn9d.mjs +1 -0
  84. package/dist/packem_shared/discover-info-DC2MrAIM.mjs +1 -0
  85. package/dist/packem_shared/discoverAgentInfo-pqFMJBtJ.mjs +1 -0
  86. package/dist/packem_shared/discoverContainerInfo-DzXr7Vm3.mjs +1 -0
  87. package/dist/packem_shared/discoverSchemaInfo-DRPnqgif.mjs +1 -0
  88. package/dist/packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs +1 -0
  89. package/dist/packem_shared/emitProjectAssetHeaders-BdqdTVN3.mjs +1 -0
  90. package/dist/packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs +7 -0
  91. package/dist/packem_shared/env-flag-u4B05gLp.mjs +1 -0
  92. package/dist/packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs +1 -0
  93. package/dist/packem_shared/index.d-BoUSSRrk.d.mts +270 -0
  94. package/dist/packem_shared/index.d-C1nVDcie.d.ts +270 -0
  95. package/dist/packem_shared/inferLunoraBindings-BUk28bSQ.mjs +1 -0
  96. package/dist/packem_shared/is-plain-object-CWxHeOY1.mjs +1 -0
  97. package/dist/packem_shared/is-within-directory-DRMw89rK.mjs +1 -0
  98. package/dist/packem_shared/isOwnedStudioAssets-CHII-uIX.mjs +1 -0
  99. package/dist/packem_shared/materializeServiceDevConfigs-CdmKflBp.mjs +1 -0
  100. package/dist/packem_shared/mergeWranglerEnvironment-CxT2PV1N.mjs +1 -0
  101. package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
  102. package/dist/packem_shared/pendingBindingChanges-DkVojIQe.mjs +1 -0
  103. package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.mts +338 -0
  104. package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.ts +338 -0
  105. package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
  106. package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
  107. package/dist/packem_shared/probeCelldToolchain-DxDttfHy.mjs +1 -0
  108. package/dist/packem_shared/process-tree-once-Ou4SfxKM.mjs +1 -0
  109. package/dist/packem_shared/queue-info-D38n7YdX.mjs +1 -0
  110. package/dist/packem_shared/readManifest-Cighz3WC.mjs +6 -0
  111. package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
  112. package/dist/packem_shared/reconcile-services-CjgIJKim.mjs +1 -0
  113. package/dist/packem_shared/reconcileWranglerBindings-D6B81UKU.mjs +1 -0
  114. package/dist/packem_shared/reconcileWranglerCompatibilityDate-Cj94osA-.mjs +1 -0
  115. package/dist/packem_shared/renderStudioHtml-CRDTNivi.mjs +15 -0
  116. package/dist/packem_shared/resolveLocalWorkerEnv-C1s-quRt.mjs +1 -0
  117. package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
  118. package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
  119. package/dist/packem_shared/scanWranglerVariablesForSecrets-DmdOBmwn.mjs +1 -0
  120. package/dist/packem_shared/secret-key-xi4VK8Jw.mjs +1 -0
  121. package/dist/packem_shared/sendStudioAsset-B81Pex91.mjs +1 -0
  122. package/dist/packem_shared/serveJsonHandler-B8_GE6QC.mjs +1 -0
  123. package/dist/packem_shared/spa-assets-wX8rTPEQ.mjs +1 -0
  124. package/dist/packem_shared/startCelldDevSession-DfuDVsha.mjs +1 -0
  125. package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
  126. package/dist/packem_shared/studio-assets-BKWx838V.mjs +1 -0
  127. package/dist/packem_shared/validate-bindings-DSMH8bRQ.mjs +1 -0
  128. package/dist/packem_shared/withTailConsumer-BXOIqXxv.mjs +1 -0
  129. package/dist/packem_shared/wranglerCodegenInputs-B8iRZZZw.mjs +1 -0
  130. package/dist/packem_shared/wranglerToAlchemy-ClIdvJFu.mjs +5 -0
  131. package/dist/packem_shared/write-atomic-9sY2z8DB.mjs +3 -0
  132. package/dist/packem_shared/writeAssetHeaders-C5igmezc.mjs +1 -0
  133. package/dist/studio-host/index.d.mts +371 -136
  134. package/dist/studio-host/index.d.ts +371 -136
  135. package/dist/studio-host/index.mjs +1 -7
  136. package/package.json +43 -10
  137. package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
  138. package/dist/packem_shared/AGENT_MODE_ENV-DM1Siczo.mjs +0 -17
  139. package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
  140. package/dist/packem_shared/DEV_DAEMON_ENV-FIEtW7Fz.mjs +0 -163
  141. package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
  142. package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
  143. package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
  144. package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
  145. package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
  146. package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
  147. package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-8bNMHGiu.mjs +0 -104
  148. package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
  149. package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
  150. package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
  151. package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
  152. package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
  153. package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
  154. package/dist/packem_shared/assetContentType-ByZjeV3D.mjs +0 -72
  155. package/dist/packem_shared/buildPackageSecretsBlock-B8iSX1Zo.mjs +0 -281
  156. package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
  157. package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
  158. package/dist/packem_shared/detectFramework-U08038Yp.mjs +0 -41
  159. package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
  160. package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
  161. package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
  162. package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
  163. package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
  164. package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
  165. package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
  166. package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
  167. package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
  168. package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
  169. package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
  170. package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
@@ -0,0 +1,270 @@
1
+ import { e as ToolchainCommand, D as DeployDriver, d as ProjectionPurpose } from "./deploy-driver.d-CHVNQFV2.mjs";
2
+ /**
3
+ * Project-relative directory the Lunora agent skills ("rules") install into.
4
+ * This is the portable [Agent Skills](https://tanstack.com/intent/latest/docs/registry)
5
+ * location — Cursor, Claude Code, and GitHub Copilot all discover skills here.
6
+ */
7
+ declare const AGENT_RULES_DIR = ".agents/skills";
8
+ /** Env var the once-per-process-tree hint guard ({@link claimAgentRulesHint}) sets. */
9
+ declare const AGENT_RULES_HINT_ENV = "LUNORA_RULES_HINT_SHOWN";
10
+ /**
11
+ * The Lunora agent skills shipped by `@lunora/cli`. The first entry (`lunora`)
12
+ * is the router skill — its presence is what {@link detectAgentRules} treats as
13
+ * "rules installed", since every other skill is reachable through it.
14
+ *
15
+ * `lunora rules install` enumerates `@lunora/cli`'s `skills/` directory rather
16
+ * than reading this list, so a skill missing here still installs — but
17
+ * `lunora rules check` counts against it, and reported "9/9 skills" with an
18
+ * empty "Missing:" line for a project holding all 14. The CLI's rules test
19
+ * pins the two together, since this package cannot see that directory.
20
+ */
21
+ declare const LUNORA_SKILL_NAMES: ReadonlyArray<string>;
22
+ /** The router skill whose presence marks the rule set as installed. */
23
+ declare const ROOT_SKILL_NAME = "lunora";
24
+ /**
25
+ * The single "rules not installed" message shared by every surface (the CLI
26
+ * `lunora dev` summary and the Vite dev plugin), so the wording and the
27
+ * pointer at `lunora rules install` stay identical wherever it appears.
28
+ */
29
+ declare const AGENT_RULES_HINT = "Lunora AI rules not installed — run `lunora rules install` so your coding agent knows how to use Lunora.";
30
+ /**
31
+ * Process-tree guard so the hint is emitted at most once. The first surface to
32
+ * print it sets {@link AGENT_RULES_HINT_ENV} on `process.env`; later surfaces (a
33
+ * Vite dev-server restart, or a child process that inherited the env) read it
34
+ * and stay quiet. Returns `true` the first time, `false` afterwards.
35
+ */
36
+ declare const claimAgentRulesHint: () => boolean;
37
+ interface AgentRulesStatus {
38
+ /**
39
+ * True when the `lunora` router skill is installed. We key on the router
40
+ * (not "all nine present") so a project that intentionally trims the set
41
+ * still counts as installed and isn't nagged.
42
+ */
43
+ readonly installed: boolean;
44
+ /** Skill names with no `SKILL.md` under `<root>/.agents/skills/<name>/`. */
45
+ readonly missing: ReadonlyArray<string>;
46
+ /** Skill names found under `<root>/.agents/skills/<name>/SKILL.md`. */
47
+ readonly present: ReadonlyArray<string>;
48
+ }
49
+ /**
50
+ * Detect whether the Lunora agent skills are installed in `projectRoot` by
51
+ * checking the skills folder for each `SKILL.md`. Pure filesystem reads, safe to
52
+ * call on every dev-server / CLI startup — the CLI, the Vite plugin, and the
53
+ * studio host all use it to decide whether to surface the "rules not installed"
54
+ * hint.
55
+ */
56
+ declare const detectAgentRules: (projectRoot: string) => AgentRulesStatus;
57
+ /** The default deploy target — today's behavior for every project. */
58
+ declare const DEFAULT_DEPLOY_TARGET = "cloudflare";
59
+ /** The ids a caller may select, for error messages and `--target` help text. */
60
+ declare const deployTargetIds: () => ReadonlyArray<string>;
61
+ /**
62
+ * Resolve a target name to its driver.
63
+ * @throws when `target` names no registered driver — never falls back to the default.
64
+ */
65
+ declare const resolveDeployDriver: (target?: string) => DeployDriver;
66
+ /**
67
+ * Whether `target`'s driver ships a `toolchain` — i.e. whether any tool can
68
+ * actually build, serve or deploy it, as opposed to merely generate for it.
69
+ *
70
+ * One predicate rather than one per caller: the CLI (`deploy`, `dev`) and the
71
+ * Vite plugin (`build`, `dev`) must refuse the same set, and a second copy
72
+ * fails silently — the tool that forgot runs the WRONG pipeline for the target
73
+ * instead of rejecting it.
74
+ * @param target A target id already resolved by `resolveTargetOrThrow`. Unknown
75
+ * ids answer `false` rather than throwing, so this is safe to ask about
76
+ * arbitrary input.
77
+ * @returns `true` when the target can be run.
78
+ */
79
+ declare const isRunnableTarget: (target: string) => boolean;
80
+ /**
81
+ * The subset of {@link deployTargetIds} that {@link isRunnableTarget} accepts,
82
+ * in the same (alphabetical) order.
83
+ * @returns every target id a tool can build, serve or deploy — used to name the
84
+ * alternatives when one is refused.
85
+ */
86
+ declare const runnableTargetIds: () => ReadonlyArray<string>;
87
+ /**
88
+ * Whether `lunora dev` serves `target`'s worker with the host's own dev server
89
+ * (`DriverToolchain.devServer === "own"`) instead of workerd. The CLI's flavor
90
+ * choice and the Vite plugin's warning both ask this, so it is answered once.
91
+ */
92
+ declare const targetRunsOwnDevServer: (target: string) => boolean;
93
+ /** A toolchain command planned against the driver's config projection, with nothing written yet. */
94
+ interface ToolchainInvocation {
95
+ command: ToolchainCommand;
96
+ /** Write the projection, if the driver has one. Call only once the command is going to run. */
97
+ commit: () => void;
98
+ /** The projection the command reads, and every key it left out — `undefined` when the host reads the project config as-is. */
99
+ projection: {
100
+ configPath: string;
101
+ dropped: ReadonlyArray<string>;
102
+ } | undefined;
103
+ }
104
+ /**
105
+ * Plan a toolchain call in the one safe order: project the config (in memory),
106
+ * build the argv against the projection's path — which is where a host refuses
107
+ * an option it cannot honour, so a refusal throws here — and only then offer the
108
+ * write. A refused command therefore leaves nothing on disk, and `configPath`
109
+ * is set on every request whose driver projects.
110
+ */
111
+ declare const planToolchainInvocation: (driver: DeployDriver, projectRoot: string, purpose: ProjectionPurpose, build: (configPath: string | undefined) => ToolchainCommand) => ToolchainInvocation;
112
+ /** The painted ` lunora ` badge, prepended to the plugin's branded log lines. */
113
+ declare const LUNORA_TAG: string;
114
+ /** Prefix a message with the Lunora badge (e.g. `lunoraLine("codegen done")`). */
115
+ declare const lunoraLine: (message: string) => string;
116
+ /**
117
+ * A branded schema-advisory line: the level-coloured badge (`warn`/`error`/`info`)
118
+ * — same badges the CLI reporter uses, so the dev server reads as one tool — then
119
+ * the rule name, the detail, and the remediation. Replaces the old dense
120
+ * `lunora-badge … schema advisory [WARN] …` line with the level-appropriate badge.
121
+ */
122
+ declare const advisoryLine: (level: "ERROR" | "INFO" | "WARN", name: string, detail: string, remediation: string) => string;
123
+ declare class LunoraReporter {
124
+ #private;
125
+ setStdout(stdout: NodeJS.WriteStream): void;
126
+ setStderr(stderr: NodeJS.WriteStream): void;
127
+ log(meta: unknown): void;
128
+ }
129
+ type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
130
+ /** True when `manager` is on PATH — probed by running `<manager> --version`. Injectable for tests. */
131
+ type PackageManagerProbe = (manager: PackageManager) => boolean;
132
+ /**
133
+ * The package managers actually installed on this machine, in preference order
134
+ * ({@link INSTALL_PREFERENCE} — pnpm > bun > yarn > npm). The first entry is the
135
+ * recommended default for the install prompt; the whole list is what the user
136
+ * picks from. Empty when none are found.
137
+ */
138
+ declare const detectInstalledManagers: (probe?: PackageManagerProbe) => PackageManager[];
139
+ /** The argv that installs a project's dependencies with `manager` (`<manager> install`). */
140
+ declare const installArgsFor: (manager: PackageManager) => {
141
+ args: string[];
142
+ command: string;
143
+ };
144
+ /**
145
+ * The argv that adds `packages` as new dependencies with `manager` — the
146
+ * counterpart to {@link installArgsFor}, which reinstalls what package.json
147
+ * already declares rather than adding something new to it.
148
+ *
149
+ * npm's dev flag is `--save-dev` (its own docs lead with the long form); bun's
150
+ * is the lowercase `-d` (uppercase `-D` is not one of its recognized flags);
151
+ * pnpm and yarn both take `-D`.
152
+ */
153
+ declare const addArgsFor: (manager: PackageManager, packages: ReadonlyArray<string>, options?: {
154
+ dev?: boolean;
155
+ }) => {
156
+ args: string[];
157
+ command: string;
158
+ };
159
+ /**
160
+ * Resolve the package manager to drive for the project rooted at (or above)
161
+ * `startDirectory`. Every step is a real signal — Lunora never blindly assumes a
162
+ * particular manager, and there is no hardcoded fallback:
163
+ *
164
+ * 1. `@visulima/package` — the nearest lock file (`pnpm-lock.yaml`, `yarn.lock`,
165
+ * `package-lock.json`, `bun.lockb`) or the `packageManager` field of the nearest
166
+ * `package.json`.
167
+ * 2. The manager that launched this CLI, read from `npm_config_user_agent` (so
168
+ * `pnpm dlx lunora …` / `npx lunora …` resolve to the right manager).
169
+ * 3. The first package manager actually installed on this machine
170
+ * ({@link detectInstalledManagers}).
171
+ *
172
+ * Throws when none of those resolve — i.e. there is no lock file / `packageManager`
173
+ * field, the CLI wasn't launched by a known manager, and none is on `PATH`.
174
+ * Surfacing that is better than silently guessing a manager that can't run.
175
+ */
176
+ declare const detectPackageManager: (startDirectory: string) => PackageManager;
177
+ /** Map a package manager to the argv pair that runs an installed CLI. */
178
+ declare const execArgsFor: (manager: PackageManager, command: string, args: ReadonlyArray<string>) => {
179
+ args: string[];
180
+ command: string;
181
+ };
182
+ /**
183
+ * The argv that runs a driver's {@link ToolchainCommand}: through the package
184
+ * manager for a project dependency, directly for a binary on `PATH`.
185
+ */
186
+ declare const toolchainExecArgs: (manager: PackageManager, command: ToolchainCommand) => {
187
+ args: string[];
188
+ command: string;
189
+ };
190
+ /**
191
+ * The argv that runs a project SCRIPT with `manager` — the counterpart to
192
+ * {@link execArgsFor}, which runs a BINARY.
193
+ *
194
+ * All four managers accept `<manager> run <script>`, so this is uniform. It is a
195
+ * separate function because reaching for `execArgsFor(manager, "run", [script])`
196
+ * silently produces something else entirely: `pnpm exec run <script>` fails with
197
+ * `Command "run" not found`, and `npx -- run <script>` resolves the registry
198
+ * PACKAGE named `run` and executes it.
199
+ */
200
+ declare const runScriptArgsFor: (manager: PackageManager, script: string) => {
201
+ args: string[];
202
+ command: string;
203
+ };
204
+ /** The shell command that runs a project script with `manager` (`pnpm dev`, `npm run dev`, …). */
205
+ declare const runScriptCommand: (manager: PackageManager, script: string) => string;
206
+ /**
207
+ * The `package.json` at `root` as a plain object, or `undefined` when it is
208
+ * missing, unreadable, or not a JSON object. Best-effort on purpose: every
209
+ * caller reads one fact off it (a script, a key, the dependencies) and falls
210
+ * back to its default rather than failing over a broken manifest.
211
+ */
212
+ declare const readProjectManifest: (root: string) => Readonly<Record<string, unknown>> | undefined;
213
+ /**
214
+ * The manifest's merged `devDependencies` + `dependencies` map — a runtime
215
+ * dependency wins a name declared in both — or `{}` when it cannot be read.
216
+ */
217
+ declare const readProjectDependencies: (root: string) => Readonly<Record<string, string>>;
218
+ /** The names {@link readProjectDependencies} reads — empty when the manifest cannot be read. */
219
+ declare const readProjectDependencyNames: (root: string) => ReadonlySet<string>;
220
+ /**
221
+ * A badge: the short colored label that prefixes a line. `bg`/`fg` are hex so the
222
+ * same value drives both colorize's `bgHex().hex()` and the tui `<Text>` props.
223
+ */
224
+ interface BadgeSpec {
225
+ bg: `#${string}`;
226
+ fg: `#${string}`;
227
+ text: string;
228
+ }
229
+ /** Lunora purple — the accent shared with the CLI prompt frames. */
230
+ declare const ACCENT: `#${string}`;
231
+ /** Standard log-level badge names (the restyled base output). */
232
+ type LevelBadgeName = "debug" | "error" | "info" | "success" | "warn";
233
+ /** Step-phase badge names (the create-astro-style flow transcript). */
234
+ type StepBadgeName = "add" | "deps" | "dir" | "git" | "lunora" | "next" | "tmpl";
235
+ type BadgeName = LevelBadgeName | StepBadgeName;
236
+ /** The ordered step-phase names, used to register custom pail log types. */
237
+ declare const STEP_BADGE_NAMES: ReadonlyArray<StepBadgeName>;
238
+ /**
239
+ * Every badge, keyed by name. Levels get their conventional colors (red/amber/
240
+ * green/blue/grey); step phases follow create-astro's green→purple→cyan rhythm.
241
+ */
242
+ declare const BADGES: Record<BadgeName, BadgeSpec>;
243
+ /**
244
+ * Luna, the mascot: the folklore rabbit-in-the-moon — a bunny tucked inside the
245
+ * moon disc. Pure ASCII so it renders the same everywhere (including piped logs).
246
+ * The CLI signs off the `init` flow with it, the way create-astro closes with
247
+ * Houston.
248
+ */
249
+ declare const LUNA_NAME = "Luna";
250
+ declare const LUNA_SIGNOFF = "Safe travels, voyager.";
251
+ declare const LUNA_BUNNY: string;
252
+ /**
253
+ * {@link LUNA_BUNNY} with its leading newline stripped, ready to render inline
254
+ * (beside the name + sign-off). Both render paths — the tui mascot frame and the
255
+ * pail off-TTY fallback — use this so neither re-implements the strip.
256
+ */
257
+ declare const LUNA_ART: string;
258
+ /** The colored part of a badge — the word with one space of padding each side. */
259
+ declare const padBadge: (text: string) => string;
260
+ /** Leading spaces that right-align a badge's box within the gutter. */
261
+ declare const badgeLead: (text: string) => string;
262
+ /** Total columns a rendered badge column occupies (lead + box), constant across badges. */
263
+ declare const BADGE_COLUMN_WIDTH: number;
264
+ /** Columns a rendered badge occupies — the gutter-aligned column width. */
265
+ declare const badgeWidth: (_spec: BadgeSpec) => number;
266
+ /** Paint a badge as an ANSI string (the non-tui path): right-aligning spaces + the colored box. */
267
+ declare const paintBadge: (spec: BadgeSpec) => string;
268
+ /** Dim continuation text (a step's chosen answer, shown under the question). */
269
+ declare const paintAnswer: (text: string) => string;
270
+ export { ACCENT as A, BADGES as B, installArgsFor as C, DEFAULT_DEPLOY_TARGET as D, isRunnableTarget as E, lunoraLine as F, padBadge as G, paintAnswer as H, paintBadge as I, planToolchainInvocation as J, readProjectDependencies as K, LUNA_ART as L, readProjectDependencyNames as M, readProjectManifest as N, resolveDeployDriver as O, PackageManager as P, runScriptArgsFor as Q, ROOT_SKILL_NAME as R, STEP_BADGE_NAMES as S, ToolchainInvocation as T, runScriptCommand as U, runnableTargetIds as V, targetRunsOwnDevServer as W, toolchainExecArgs as X, AGENT_RULES_DIR as a, AGENT_RULES_HINT as b, AGENT_RULES_HINT_ENV as c, AgentRulesStatus as d, BADGE_COLUMN_WIDTH as e, BadgeName as f, BadgeSpec as g, LUNA_BUNNY as h, LUNA_NAME as i, LUNA_SIGNOFF as j, LUNORA_SKILL_NAMES as k, LUNORA_TAG as l, LevelBadgeName as m, LunoraReporter as n, PackageManagerProbe as o, StepBadgeName as p, addArgsFor as q, advisoryLine as r, badgeLead as s, badgeWidth as t, claimAgentRulesHint as u, deployTargetIds as v, detectAgentRules as w, detectInstalledManagers as x, detectPackageManager as y, execArgsFor as z };
@@ -0,0 +1,270 @@
1
+ import { e as ToolchainCommand, D as DeployDriver, d as ProjectionPurpose } from "./deploy-driver.d-CHVNQFV2.js";
2
+ /**
3
+ * Project-relative directory the Lunora agent skills ("rules") install into.
4
+ * This is the portable [Agent Skills](https://tanstack.com/intent/latest/docs/registry)
5
+ * location — Cursor, Claude Code, and GitHub Copilot all discover skills here.
6
+ */
7
+ declare const AGENT_RULES_DIR = ".agents/skills";
8
+ /** Env var the once-per-process-tree hint guard ({@link claimAgentRulesHint}) sets. */
9
+ declare const AGENT_RULES_HINT_ENV = "LUNORA_RULES_HINT_SHOWN";
10
+ /**
11
+ * The Lunora agent skills shipped by `@lunora/cli`. The first entry (`lunora`)
12
+ * is the router skill — its presence is what {@link detectAgentRules} treats as
13
+ * "rules installed", since every other skill is reachable through it.
14
+ *
15
+ * `lunora rules install` enumerates `@lunora/cli`'s `skills/` directory rather
16
+ * than reading this list, so a skill missing here still installs — but
17
+ * `lunora rules check` counts against it, and reported "9/9 skills" with an
18
+ * empty "Missing:" line for a project holding all 14. The CLI's rules test
19
+ * pins the two together, since this package cannot see that directory.
20
+ */
21
+ declare const LUNORA_SKILL_NAMES: ReadonlyArray<string>;
22
+ /** The router skill whose presence marks the rule set as installed. */
23
+ declare const ROOT_SKILL_NAME = "lunora";
24
+ /**
25
+ * The single "rules not installed" message shared by every surface (the CLI
26
+ * `lunora dev` summary and the Vite dev plugin), so the wording and the
27
+ * pointer at `lunora rules install` stay identical wherever it appears.
28
+ */
29
+ declare const AGENT_RULES_HINT = "Lunora AI rules not installed — run `lunora rules install` so your coding agent knows how to use Lunora.";
30
+ /**
31
+ * Process-tree guard so the hint is emitted at most once. The first surface to
32
+ * print it sets {@link AGENT_RULES_HINT_ENV} on `process.env`; later surfaces (a
33
+ * Vite dev-server restart, or a child process that inherited the env) read it
34
+ * and stay quiet. Returns `true` the first time, `false` afterwards.
35
+ */
36
+ declare const claimAgentRulesHint: () => boolean;
37
+ interface AgentRulesStatus {
38
+ /**
39
+ * True when the `lunora` router skill is installed. We key on the router
40
+ * (not "all nine present") so a project that intentionally trims the set
41
+ * still counts as installed and isn't nagged.
42
+ */
43
+ readonly installed: boolean;
44
+ /** Skill names with no `SKILL.md` under `<root>/.agents/skills/<name>/`. */
45
+ readonly missing: ReadonlyArray<string>;
46
+ /** Skill names found under `<root>/.agents/skills/<name>/SKILL.md`. */
47
+ readonly present: ReadonlyArray<string>;
48
+ }
49
+ /**
50
+ * Detect whether the Lunora agent skills are installed in `projectRoot` by
51
+ * checking the skills folder for each `SKILL.md`. Pure filesystem reads, safe to
52
+ * call on every dev-server / CLI startup — the CLI, the Vite plugin, and the
53
+ * studio host all use it to decide whether to surface the "rules not installed"
54
+ * hint.
55
+ */
56
+ declare const detectAgentRules: (projectRoot: string) => AgentRulesStatus;
57
+ /** The default deploy target — today's behavior for every project. */
58
+ declare const DEFAULT_DEPLOY_TARGET = "cloudflare";
59
+ /** The ids a caller may select, for error messages and `--target` help text. */
60
+ declare const deployTargetIds: () => ReadonlyArray<string>;
61
+ /**
62
+ * Resolve a target name to its driver.
63
+ * @throws when `target` names no registered driver — never falls back to the default.
64
+ */
65
+ declare const resolveDeployDriver: (target?: string) => DeployDriver;
66
+ /**
67
+ * Whether `target`'s driver ships a `toolchain` — i.e. whether any tool can
68
+ * actually build, serve or deploy it, as opposed to merely generate for it.
69
+ *
70
+ * One predicate rather than one per caller: the CLI (`deploy`, `dev`) and the
71
+ * Vite plugin (`build`, `dev`) must refuse the same set, and a second copy
72
+ * fails silently — the tool that forgot runs the WRONG pipeline for the target
73
+ * instead of rejecting it.
74
+ * @param target A target id already resolved by `resolveTargetOrThrow`. Unknown
75
+ * ids answer `false` rather than throwing, so this is safe to ask about
76
+ * arbitrary input.
77
+ * @returns `true` when the target can be run.
78
+ */
79
+ declare const isRunnableTarget: (target: string) => boolean;
80
+ /**
81
+ * The subset of {@link deployTargetIds} that {@link isRunnableTarget} accepts,
82
+ * in the same (alphabetical) order.
83
+ * @returns every target id a tool can build, serve or deploy — used to name the
84
+ * alternatives when one is refused.
85
+ */
86
+ declare const runnableTargetIds: () => ReadonlyArray<string>;
87
+ /**
88
+ * Whether `lunora dev` serves `target`'s worker with the host's own dev server
89
+ * (`DriverToolchain.devServer === "own"`) instead of workerd. The CLI's flavor
90
+ * choice and the Vite plugin's warning both ask this, so it is answered once.
91
+ */
92
+ declare const targetRunsOwnDevServer: (target: string) => boolean;
93
+ /** A toolchain command planned against the driver's config projection, with nothing written yet. */
94
+ interface ToolchainInvocation {
95
+ command: ToolchainCommand;
96
+ /** Write the projection, if the driver has one. Call only once the command is going to run. */
97
+ commit: () => void;
98
+ /** The projection the command reads, and every key it left out — `undefined` when the host reads the project config as-is. */
99
+ projection: {
100
+ configPath: string;
101
+ dropped: ReadonlyArray<string>;
102
+ } | undefined;
103
+ }
104
+ /**
105
+ * Plan a toolchain call in the one safe order: project the config (in memory),
106
+ * build the argv against the projection's path — which is where a host refuses
107
+ * an option it cannot honour, so a refusal throws here — and only then offer the
108
+ * write. A refused command therefore leaves nothing on disk, and `configPath`
109
+ * is set on every request whose driver projects.
110
+ */
111
+ declare const planToolchainInvocation: (driver: DeployDriver, projectRoot: string, purpose: ProjectionPurpose, build: (configPath: string | undefined) => ToolchainCommand) => ToolchainInvocation;
112
+ /** The painted ` lunora ` badge, prepended to the plugin's branded log lines. */
113
+ declare const LUNORA_TAG: string;
114
+ /** Prefix a message with the Lunora badge (e.g. `lunoraLine("codegen done")`). */
115
+ declare const lunoraLine: (message: string) => string;
116
+ /**
117
+ * A branded schema-advisory line: the level-coloured badge (`warn`/`error`/`info`)
118
+ * — same badges the CLI reporter uses, so the dev server reads as one tool — then
119
+ * the rule name, the detail, and the remediation. Replaces the old dense
120
+ * `lunora-badge … schema advisory [WARN] …` line with the level-appropriate badge.
121
+ */
122
+ declare const advisoryLine: (level: "ERROR" | "INFO" | "WARN", name: string, detail: string, remediation: string) => string;
123
+ declare class LunoraReporter {
124
+ #private;
125
+ setStdout(stdout: NodeJS.WriteStream): void;
126
+ setStderr(stderr: NodeJS.WriteStream): void;
127
+ log(meta: unknown): void;
128
+ }
129
+ type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
130
+ /** True when `manager` is on PATH — probed by running `<manager> --version`. Injectable for tests. */
131
+ type PackageManagerProbe = (manager: PackageManager) => boolean;
132
+ /**
133
+ * The package managers actually installed on this machine, in preference order
134
+ * ({@link INSTALL_PREFERENCE} — pnpm > bun > yarn > npm). The first entry is the
135
+ * recommended default for the install prompt; the whole list is what the user
136
+ * picks from. Empty when none are found.
137
+ */
138
+ declare const detectInstalledManagers: (probe?: PackageManagerProbe) => PackageManager[];
139
+ /** The argv that installs a project's dependencies with `manager` (`<manager> install`). */
140
+ declare const installArgsFor: (manager: PackageManager) => {
141
+ args: string[];
142
+ command: string;
143
+ };
144
+ /**
145
+ * The argv that adds `packages` as new dependencies with `manager` — the
146
+ * counterpart to {@link installArgsFor}, which reinstalls what package.json
147
+ * already declares rather than adding something new to it.
148
+ *
149
+ * npm's dev flag is `--save-dev` (its own docs lead with the long form); bun's
150
+ * is the lowercase `-d` (uppercase `-D` is not one of its recognized flags);
151
+ * pnpm and yarn both take `-D`.
152
+ */
153
+ declare const addArgsFor: (manager: PackageManager, packages: ReadonlyArray<string>, options?: {
154
+ dev?: boolean;
155
+ }) => {
156
+ args: string[];
157
+ command: string;
158
+ };
159
+ /**
160
+ * Resolve the package manager to drive for the project rooted at (or above)
161
+ * `startDirectory`. Every step is a real signal — Lunora never blindly assumes a
162
+ * particular manager, and there is no hardcoded fallback:
163
+ *
164
+ * 1. `@visulima/package` — the nearest lock file (`pnpm-lock.yaml`, `yarn.lock`,
165
+ * `package-lock.json`, `bun.lockb`) or the `packageManager` field of the nearest
166
+ * `package.json`.
167
+ * 2. The manager that launched this CLI, read from `npm_config_user_agent` (so
168
+ * `pnpm dlx lunora …` / `npx lunora …` resolve to the right manager).
169
+ * 3. The first package manager actually installed on this machine
170
+ * ({@link detectInstalledManagers}).
171
+ *
172
+ * Throws when none of those resolve — i.e. there is no lock file / `packageManager`
173
+ * field, the CLI wasn't launched by a known manager, and none is on `PATH`.
174
+ * Surfacing that is better than silently guessing a manager that can't run.
175
+ */
176
+ declare const detectPackageManager: (startDirectory: string) => PackageManager;
177
+ /** Map a package manager to the argv pair that runs an installed CLI. */
178
+ declare const execArgsFor: (manager: PackageManager, command: string, args: ReadonlyArray<string>) => {
179
+ args: string[];
180
+ command: string;
181
+ };
182
+ /**
183
+ * The argv that runs a driver's {@link ToolchainCommand}: through the package
184
+ * manager for a project dependency, directly for a binary on `PATH`.
185
+ */
186
+ declare const toolchainExecArgs: (manager: PackageManager, command: ToolchainCommand) => {
187
+ args: string[];
188
+ command: string;
189
+ };
190
+ /**
191
+ * The argv that runs a project SCRIPT with `manager` — the counterpart to
192
+ * {@link execArgsFor}, which runs a BINARY.
193
+ *
194
+ * All four managers accept `<manager> run <script>`, so this is uniform. It is a
195
+ * separate function because reaching for `execArgsFor(manager, "run", [script])`
196
+ * silently produces something else entirely: `pnpm exec run <script>` fails with
197
+ * `Command "run" not found`, and `npx -- run <script>` resolves the registry
198
+ * PACKAGE named `run` and executes it.
199
+ */
200
+ declare const runScriptArgsFor: (manager: PackageManager, script: string) => {
201
+ args: string[];
202
+ command: string;
203
+ };
204
+ /** The shell command that runs a project script with `manager` (`pnpm dev`, `npm run dev`, …). */
205
+ declare const runScriptCommand: (manager: PackageManager, script: string) => string;
206
+ /**
207
+ * The `package.json` at `root` as a plain object, or `undefined` when it is
208
+ * missing, unreadable, or not a JSON object. Best-effort on purpose: every
209
+ * caller reads one fact off it (a script, a key, the dependencies) and falls
210
+ * back to its default rather than failing over a broken manifest.
211
+ */
212
+ declare const readProjectManifest: (root: string) => Readonly<Record<string, unknown>> | undefined;
213
+ /**
214
+ * The manifest's merged `devDependencies` + `dependencies` map — a runtime
215
+ * dependency wins a name declared in both — or `{}` when it cannot be read.
216
+ */
217
+ declare const readProjectDependencies: (root: string) => Readonly<Record<string, string>>;
218
+ /** The names {@link readProjectDependencies} reads — empty when the manifest cannot be read. */
219
+ declare const readProjectDependencyNames: (root: string) => ReadonlySet<string>;
220
+ /**
221
+ * A badge: the short colored label that prefixes a line. `bg`/`fg` are hex so the
222
+ * same value drives both colorize's `bgHex().hex()` and the tui `<Text>` props.
223
+ */
224
+ interface BadgeSpec {
225
+ bg: `#${string}`;
226
+ fg: `#${string}`;
227
+ text: string;
228
+ }
229
+ /** Lunora purple — the accent shared with the CLI prompt frames. */
230
+ declare const ACCENT: `#${string}`;
231
+ /** Standard log-level badge names (the restyled base output). */
232
+ type LevelBadgeName = "debug" | "error" | "info" | "success" | "warn";
233
+ /** Step-phase badge names (the create-astro-style flow transcript). */
234
+ type StepBadgeName = "add" | "deps" | "dir" | "git" | "lunora" | "next" | "tmpl";
235
+ type BadgeName = LevelBadgeName | StepBadgeName;
236
+ /** The ordered step-phase names, used to register custom pail log types. */
237
+ declare const STEP_BADGE_NAMES: ReadonlyArray<StepBadgeName>;
238
+ /**
239
+ * Every badge, keyed by name. Levels get their conventional colors (red/amber/
240
+ * green/blue/grey); step phases follow create-astro's green→purple→cyan rhythm.
241
+ */
242
+ declare const BADGES: Record<BadgeName, BadgeSpec>;
243
+ /**
244
+ * Luna, the mascot: the folklore rabbit-in-the-moon — a bunny tucked inside the
245
+ * moon disc. Pure ASCII so it renders the same everywhere (including piped logs).
246
+ * The CLI signs off the `init` flow with it, the way create-astro closes with
247
+ * Houston.
248
+ */
249
+ declare const LUNA_NAME = "Luna";
250
+ declare const LUNA_SIGNOFF = "Safe travels, voyager.";
251
+ declare const LUNA_BUNNY: string;
252
+ /**
253
+ * {@link LUNA_BUNNY} with its leading newline stripped, ready to render inline
254
+ * (beside the name + sign-off). Both render paths — the tui mascot frame and the
255
+ * pail off-TTY fallback — use this so neither re-implements the strip.
256
+ */
257
+ declare const LUNA_ART: string;
258
+ /** The colored part of a badge — the word with one space of padding each side. */
259
+ declare const padBadge: (text: string) => string;
260
+ /** Leading spaces that right-align a badge's box within the gutter. */
261
+ declare const badgeLead: (text: string) => string;
262
+ /** Total columns a rendered badge column occupies (lead + box), constant across badges. */
263
+ declare const BADGE_COLUMN_WIDTH: number;
264
+ /** Columns a rendered badge occupies — the gutter-aligned column width. */
265
+ declare const badgeWidth: (_spec: BadgeSpec) => number;
266
+ /** Paint a badge as an ANSI string (the non-tui path): right-aligning spaces + the colored box. */
267
+ declare const paintBadge: (spec: BadgeSpec) => string;
268
+ /** Dim continuation text (a step's chosen answer, shown under the question). */
269
+ declare const paintAnswer: (text: string) => string;
270
+ export { ACCENT as A, BADGES as B, installArgsFor as C, DEFAULT_DEPLOY_TARGET as D, isRunnableTarget as E, lunoraLine as F, padBadge as G, paintAnswer as H, paintBadge as I, planToolchainInvocation as J, readProjectDependencies as K, LUNA_ART as L, readProjectDependencyNames as M, readProjectManifest as N, resolveDeployDriver as O, PackageManager as P, runScriptArgsFor as Q, ROOT_SKILL_NAME as R, STEP_BADGE_NAMES as S, ToolchainInvocation as T, runScriptCommand as U, runnableTargetIds as V, targetRunsOwnDevServer as W, toolchainExecArgs as X, AGENT_RULES_DIR as a, AGENT_RULES_HINT as b, AGENT_RULES_HINT_ENV as c, AgentRulesStatus as d, BADGE_COLUMN_WIDTH as e, BadgeName as f, BadgeSpec as g, LUNA_BUNNY as h, LUNA_NAME as i, LUNA_SIGNOFF as j, LUNORA_SKILL_NAMES as k, LUNORA_TAG as l, LevelBadgeName as m, LunoraReporter as n, PackageManagerProbe as o, StepBadgeName as p, addArgsFor as q, advisoryLine as r, badgeLead as s, badgeWidth as t, claimAgentRulesHint as u, deployTargetIds as v, detectAgentRules as w, detectInstalledManagers as x, detectPackageManager as y, execArgsFor as z };
@@ -0,0 +1 @@
1
+ import{statSync as j,readFileSync as k,existsSync as B,readdirSync as ue}from"node:fs";import{join as E,dirname as $,resolve as pe}from"node:path";import{discoverFlags as me,FLAGS_FILENAME as fe,CAPABILITY_PROBES as Q,COMPANION_BINDING as z,ALL_NOTIFY_CHANNELS as ge,readBoundServiceBindings as he,discoverHttpRoutes as Se,discoverNotifyChannels as Ee,NOTIFY_FILENAME as xe,createTargetScope as ye,mayReadCapabilityContext as ve,sourceCapabilitySignals as Ne,foldCapabilitySignals as V,capabilitiesUsedBy as Te}from"@lunora/codegen";import{init as be}from"es-module-lexer";import{ts as n,Node as m,Project as Z}from"ts-morph";import{discoverAgentInfo as Ce}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as Re}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as Ae}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{d as M}from"./discover-info-DC2MrAIM.mjs";import{i as ee}from"./is-within-directory-DRMw89rK.mjs";import{PACKAGE_SECRETS_REGISTRY as Ie}from"./PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs";import{d as Oe}from"./queue-info-D38n7YdX.mjs";import{discoverSchemaInfo as _e}from"./discoverSchemaInfo-DRPnqgif.mjs";import{resolveWorkerEntry as we,composedEntryDurableObjects as De,GENERATED_DIRECTORY as _,DURABLE_OBJECT_BINDINGS as Le,detectExportedDurableObjects as Pe,detectClassExports as L,isMergedProject as te}from"./COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{discoverWorkflowInfo as $e}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const Fe="/api/auth",je="/.well-known/oauth-protected-resource",ke="/.well-known/oauth-authorization-server",Be=String.raw`\/\*[\s\S]*?\*\/`,Me=String.raw`\/\/[^\n]*`,Ke=String.raw`"(?:[^"\\\n]|\\.)*"`,Ge=String.raw`'(?:[^'\\\n]|\\.)*'`,Ue=String.raw`\x60(?:[^\x60\\$]|\\.|\$(?!\{))*\x60`,We=new RegExp([Be,Me,Ke,Ge,Ue].join("|"),"gu"),Ve=/[^\n]/gu,He=e=>e.replaceAll(Ve," "),Ye=e=>e.replaceAll(We,t=>t.startsWith("//")||t.startsWith("/*")?He(t):t),Xe=(e,t)=>{const{error:o,value:s}=M(e,t,fe,me);return o===void 0?{flags:s}:{error:o}},b="@lunora/replica",h="EventLogDOClient",qe=/\.[cm]?[jt]sx?$/u,H=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],Y=new Map,K=e=>{const{mtimeMs:t}=j(e),o=Y.get(e);if(o?.mtimeMs===t)return o.source;const s=n.createSourceFile(e,k(e,"utf8"),n.ScriptTarget.Latest);return Y.set(e,{mtimeMs:t,source:s}),s},X=new WeakMap,Je=e=>{const t=X.get(e);if(t!==void 0&&t[0]?.wasForgotten()!==!0)return t;const o=e.getDescendantsOfKind(n.SyntaxKind.Identifier);return X.set(e,o),o},q=e=>n.sys.fileExists(e)?j(e).mtimeMs:-1,J=new Map,Qe=e=>{const t=n.findConfigFile($(e),i=>n.sys.fileExists(i));if(t===void 0)return{};const o=J.get(t);if(o!==void 0&&[...o.mtimes].every(([i,c])=>q(i)===c))return o.options;const s=n.readJsonConfigFile(t,i=>n.sys.readFile(i)),{options:r}=n.parseJsonSourceFileConfigFileContent(s,n.sys,$(t)),a=new Map([t,...s.extendedSourceFiles??[]].map(i=>[i,q(i)]));return J.set(t,{mtimes:a,options:r}),r},G=(e,t)=>{if(t===b)return;if(!t.startsWith("./")&&!t.startsWith("../")){const a={moduleResolution:n.ModuleResolutionKind.Bundler,...Qe(e)},i=n.resolveModuleName(t,e,a,n.sys).resolvedModule;return i?.isExternalLibraryImport===!0?void 0:i?.resolvedFileName}const o=E($(e),t.replace(qe,"")),s=H.map(a=>`${o}${a}`),r=H.map(a=>E(o,`index${a}`));return[...s,...r].find(a=>B(a))},ze=e=>{const t=new Map;for(const o of e.statements){if(!n.isImportDeclaration(o)||o.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(o.moduleSpecifier))continue;const s=o.importClause?.namedBindings,r=s!==void 0&&n.isNamedImports(s)?s.elements:[];for(const a of r)a.isTypeOnly||t.set(a.name.text,{module:o.moduleSpecifier.text,name:(a.propertyName??a.name).text})}return t},Ze=e=>{const t=new Map;for(const o of e.statements){if(!n.isImportDeclaration(o)||o.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(o.moduleSpecifier))continue;const s=o.importClause?.namedBindings;s!==void 0&&n.isNamespaceImport(s)&&t.set(s.name.text,o.moduleSpecifier.text)}return t},w=e=>n.canHaveModifiers(e)&&(n.getModifiers(e)??[]).some(t=>t.kind===n.SyntaxKind.ExportKeyword),et=e=>n.isVariableStatement(e)?w(e)?e.declarationList.declarations.flatMap(t=>n.isIdentifier(t.name)?[t.name.text]:[]):[]:(n.isClassDeclaration(e)||n.isFunctionDeclaration(e))&&w(e)?e.name===void 0?[]:[e.name.text]:n.isExportDeclaration(e)&&e.moduleSpecifier===void 0&&!e.isTypeOnly&&e.exportClause!==void 0&&n.isNamedExports(e.exportClause)?e.exportClause.elements.map(t=>t.name.text):[],tt=e=>new Set(e.statements.flatMap(t=>et(t))),st=(e,t,o)=>{if(n.isIdentifier(e))return t.get(e.text);if(n.isPropertyAccessExpression(e)&&n.isIdentifier(e.expression)){const s=o.get(e.expression.text);return s===void 0?void 0:{module:s,name:e.name.text}}},ot=(e,t,o)=>w(e)?e.declarationList.declarations.flatMap(s=>{if(!n.isIdentifier(s.name)||s.initializer===void 0)return[];const r=st(s.initializer,t,o);return r===void 0?[]:[{exported:s.name.text,module:r.module,name:r.name}]}):[],rt=(e,t)=>{const o=e.heritageClauses?.find(r=>r.token===n.SyntaxKind.ExtendsKeyword)?.types[0]?.expression;if(!w(e)||e.name===void 0||o===void 0||!n.isIdentifier(o))return[];const s=t.get(o.text);return s===void 0?[]:[{exported:e.name.text,module:s.module,name:s.name}]},nt=e=>{const t=ze(e),o=Ze(e);return e.statements.flatMap(s=>{if(n.isVariableStatement(s))return ot(s,t,o);if(n.isClassDeclaration(s))return rt(s,t);if(!n.isExportDeclaration(s)||s.isTypeOnly)return[];const{exportClause:r,moduleSpecifier:a}=s,i=a!==void 0&&n.isStringLiteral(a)?a.text:void 0;return r===void 0?i===void 0?[]:[{exported:void 0,module:i,name:void 0}]:n.isNamedExports(r)?r.elements.flatMap(c=>{if(c.isTypeOnly)return[];const d=c.name.text,l=(c.propertyName??c.name).text;if(i!==void 0)return[{exported:d,module:i,name:l}];const u=t.get(l);return u===void 0?[]:[{exported:d,module:u.module,name:u.name}]}):[]})},U=(e,t,o,s,r=new Set)=>{const a=JSON.stringify([e,o,[...r]]);if(s.has(a))return!1;s.add(a);const i=K(e),c=nt(i),d=new Set([...r,...tt(i),...c.flatMap(l=>l.exported===void 0?[]:[l.exported])]);return c.some(l=>{if(o!==void 0&&l.exported!==void 0&&l.exported!==o||l.exported!==void 0&&r.has(l.exported))return!1;if(l.exported===void 0){const g=o??(l.module===b?t:void 0);if(g!==void 0&&d.has(g))return!1}const u=l.exported===void 0?o:l.name;if(l.module===b)return u===void 0||u===t;const v=G(e,l.module);return v!==void 0&&U(v,t,u,s,l.exported===void 0?d:r)})},F=(e,t)=>Je(e).some(o=>{const s=o.getParent();return o.getText()!==t||m.isNamespaceImport(s)||m.isPropertyAccessExpression(s)&&s.getNameNode()===o||m.isQualifiedName(s)&&s.getRight()===o?!1:m.isPropertyAccessExpression(s)?s.getName()===h:m.isQualifiedName(s)?!m.isTypeReference(s.getParent())&&s.getRight().getText()===h:!0}),it=e=>{const[t]=e.getArguments();return e.getExpression().getKind()===n.SyntaxKind.ImportKeyword&&t!==void 0&&(m.isStringLiteral(t)||m.isNoSubstitutionTemplateLiteral(t))&&t.getLiteralValue()===b},at=e=>{const t=e.getPropertyNameNode();if(t===void 0)return e.getNameNode().getText();const o=m.isComputedPropertyName(t)?t.getExpression():t;return m.isStringLiteral(o)||m.isNoSubstitutionTemplateLiteral(o)?o.getLiteralValue():t.getText()},ct=e=>{let t=e,o=!1;for(let r=e.getParent();m.isParenthesizedExpression(r)||m.isAwaitExpression(r);r=t.getParent())o||=m.isAwaitExpression(r),t=r;if(!o)return!0;const s=t.getParent();if(m.isVariableDeclaration(s)){const r=s.getNameNode();return!m.isObjectBindingPattern(r)||r.getElements().some(a=>a.getDotDotDotToken()!==void 0||at(a)===h)}return m.isPropertyAccessExpression(s)&&s.getExpression()===t?s.getName()===h:!0},dt=(e,t)=>K(e).statements.some(o=>n.isExportDeclaration(o)&&o.moduleSpecifier!==void 0&&n.isStringLiteral(o.moduleSpecifier)&&o.moduleSpecifier.text===b&&o.exportClause!==void 0&&n.isNamespaceExport(o.exportClause)&&o.exportClause.name.text===t),lt=e=>e.getImportDeclarations().some(t=>{const o=t.getNamespaceImport(),s=t.isTypeOnly()?[]:t.getNamedImports().filter(d=>!d.isTypeOnly()),r=s.some(d=>d.getNameNode().getText()===h),a=s.filter(d=>F(e,(d.getAliasNode()??d.getNameNode()).getText())),i=o!==void 0&&F(e,o.getText());if(!r&&!i&&a.length===0)return!1;const c=G(e.getFilePath(),t.getModuleSpecifierValue());return c===void 0?!1:(r||i)&&U(c,h,h,new Set)||a.some(d=>dt(c,d.getNameNode().getText()))}),se=e=>{const t=e.getImportDeclarations().filter(o=>o.getModuleSpecifierValue()===b&&!o.isTypeOnly());return t.some(o=>o.getNamedImports().some(s=>!s.isTypeOnly()&&s.getNameNode().getText()===h))||t.some(o=>{const s=o.getNamespaceImport();return s!==void 0&&F(e,s.getText())})||e.getExportDeclarations().some(o=>o.getModuleSpecifierValue()===b&&!o.isTypeOnly()&&o.getNamedExports().some(s=>!s.isTypeOnly()&&s.getNameNode().getText()===h))||lt(e)||e.getDescendantsOfKind(n.SyntaxKind.CallExpression).some(o=>it(o)&&ct(o))},ut=e=>{const t=[],o=s=>{if(n.isImportDeclaration(s)&&s.importClause?.phaseModifier!==n.SyntaxKind.TypeKeyword&&n.isStringLiteral(s.moduleSpecifier))t.push(s.moduleSpecifier.text);else if(n.isExportDeclaration(s)&&!s.isTypeOnly&&s.moduleSpecifier!==void 0&&n.isStringLiteral(s.moduleSpecifier))t.push(s.moduleSpecifier.text);else if(n.isCallExpression(s)&&s.expression.kind===n.SyntaxKind.ImportKeyword){const[r]=s.arguments;r!==void 0&&(n.isStringLiteral(r)||n.isNoSubstitutionTemplateLiteral(r))&&t.push(r.text)}n.forEachChild(s,o)};return o(e),t},pt=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),mt=new Set([".git",".lunora-cache",".wrangler","dist",_,"node_modules"]),ft=["lunora","src"],gt=/\benv\s*\.\s*DB\b/,ht=/\benv\s*\.\s*AI\b/,oe=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],re=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,ne=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"],["usesPaymentAutumn","@lunora/payment/autumn"],["usesPaymentCreem","@lunora/payment/creem"],["usesPaymentDodopayments","@lunora/payment/dodopayments"],["usesPaymentPolar","@lunora/payment/polar"],["usesPaymentStripe","@lunora/payment/stripe"]],ie=[...oe.map(e=>[re(e),Q[e].moduleSpecifier]),...ne].toSorted(([e],[t])=>e.localeCompare(t)),St=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyFcmTokenSource","@lunora/notify:fcmTokenSource"],["usesNotifyWebPush","@lunora/notify:webPush"],["hostsShardRegistry","@lunora/do:shardRegistry"],["hostsEventLog","@lunora/replica:eventLog"],["usesEventLogClient","@lunora/replica:eventLogClient"],["usesRequestSecretTool","@lunora/agent:requestSecretTool"]],Et=["@lunora/agent","@lunora/agent/sandbox"],ae=new RegExp(String.raw`["'\x60](?:${[...ie.map(([,e])=>e),...Et,b].map(e=>Ae(e)).join("|")})["'\x60]`,"u"),p=e=>{const{contextProperty:t,moduleSpecifier:o}=Q[e];return t===void 0?`${o} is imported`:`${o} is imported or ctx.${t} is read`},xt="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",yt=/\b(authBasePath|basePath):\s*(["'`])(\/[^"'`$\s]*)\2/gu,vt=/["']@lunora\/auth(?:\/[^"']*)?["']/u,Nt=/[Bb]asePath/u,Tt=e=>{const t=new Set;for(const o of e){const s=k(o,"utf8");if(!Nt.test(s))continue;const r=Ye(s),a=vt.test(r);for(const[,i,,c]of r.matchAll(yt)){const d=c?.endsWith("/")===!0?c.slice(0,-1):c??"";d!==""&&(i==="authBasePath"||a)&&t.add(d)}}return t.size===0?[Fe]:[...t].toSorted((o,s)=>o.localeCompare(s))},bt=(e,t,o,s)=>{const{error:r,value:a}=M(e,t,void 0,Se);if(r!==void 0)return;const i=o?[...Tt(s),je,ke].map(c=>`${c}/*`):[];return[...(a??[]).map(c=>c.path),...i]},Ct=/\bfrom\s+["']\.{1,2}\//u,ce=(e,t)=>{let o;try{o=ue(e,{withFileTypes:!0})}catch{return}for(const s of o){if(s.isDirectory()){mt.has(s.name)||ce(E(e,s.name),t);continue}const r=s.name.lastIndexOf(".");r!==-1&&pt.has(s.name.slice(r))&&t.push(E(e,s.name))}},Rt=(e,t,o)=>{const s=he(e,t);return o?{...s,services:s.services.filter(r=>r.binding!==z)}:s},At=(e,t,o)=>{const{info:s}=_e(e,t,o);return{jurisdiction:s?.jurisdiction,needsD1:s?.hasD1GlobalTable??!1}};let P;const It=e=>{const t=pe(e);return P?.root!==t&&(P={project:new Z({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),root:t}),P.project},Ot=(e,t,o)=>{e.getSourceFile(t)?.getFullText()!==o&&e.createSourceFile(t,o,{overwrite:!0})},_t=(e,t)=>{for(const o of e.getSourceFiles())t.has(o)||e.removeSourceFile(o)},wt=(e,t,o)=>{const s=E(e,o),r=It(e),a=[],i=new Set,c=[],d=[],l=ye();let u=!1,v=!1;for(const f of t){const S=E(e,f);if(!B(S)||!j(S).isDirectory())continue;const O=[];ce(S,O);for(const R of O){i.add(R);const x=k(R,"utf8"),T=ee(R,s);u||=ht.test(x),v||=gt.test(x),(ae.test(x)||x.includes(h)||T&&(ve(x)||Ct.test(x)))&&(Ot(r,R,x),a.push({file:R,inLunora:T}))}}_t(r,new Set(a.map(({file:f})=>r.getSourceFileOrThrow(f))));for(const{file:f,inLunora:S}of a)(S?c:d).push(Ne(r.getSourceFileOrThrow(f),l));const g=V(c),C=V([g,...d]),I=new Set([...C.valueImports,...C.dynamicImports]),N=Te({contextReads:g.contextReads,valueImports:I});return{...Object.fromEntries([...oe.map(f=>[re(f),N.has(f)]),...ne.map(([f,S])=>[f,I.has(S)])]),needsD1:v,usesEventLogClient:a.some(({file:f})=>se(r.getSourceFileOrThrow(f))),usesRequestSecretTool:g.requestSecretTool,usesAi:N.has("ai")||u,usesBrowser:N.has("browser")||g.sandboxTools.usesSandboxBrowser,usesWorkerLoader:g.sandboxTools.usesSandboxLoader,scannedFiles:i}},Dt=(e,t,o)=>[...e.map(s=>s.exported?`${s.bindingName}/${s.className} (container "${s.exportName}" declared and exported)`:`hint: container "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...t.map(s=>s.exported?`exports.${s.className} (workflow "${s.exportName}" declared and exported)`:`hint: workflow "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...o.map(s=>s.exported?`exports.${s.className} (agent "${s.exportName}" declared and exported)`:`hint: agent "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Lt=(e,t,o)=>[[e.usesAi,`AI (${p("ai")}, env.AI is used, or an agent is declared)`],[e.usesAuth&&!t.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!t.has("SchedulerDO"),`hint: ${p("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${p("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${p("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${p("payments")}; set the provider secrets in .dev.vars — ${xt}`],[e.usesBrowser,`browser (${p("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${p("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${p("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${p("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${p("analyticsSql")}) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so \`lunora dev\` queries the account's live analytics`],[e.usesKv,o.jurisdiction===void 0?`kv_namespaces (${p("kv")}) — { binding: KV } with no id; wrangler creates the namespace on the first deploy`:`hint: ${p("kv")} and the schema pins "${o.jurisdiction}"; create the namespace with --jurisdiction ${o.jurisdiction} and add a kv_namespaces binding ({ binding, id })`],[e.usesHyperdrive,`hyperdrive (${p("hyperdrive")}) — { binding: HYPERDRIVE } with a placeholder id; dev uses an embedded Postgres and \`lunora deploy\` creates the config`],[e.usesPipelines,`hint: ${p("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,o.jurisdiction===void 0?`artifacts (${p("artifacts")}) — { binding: ARTIFACTS, namespace }`:`hint: ${p("artifacts")}; the schema pins data to "${o.jurisdiction}", so create the namespace in that jurisdiction first and add { binding: ARTIFACTS, namespace } yourself — \`lunora deploy\` then checks it (a first create() in dev would make it unrestricted)`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${p("x402")} (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned`]].filter(([r])=>r).map(([,r])=>r),Pt=(e,t,o,s=[],r=[],a=[])=>{const i=new Set(e.map(d=>d.className)),c=e.map(d=>`${d.binding}/${d.className} (exported by worker entry)`);return t.needsD1&&c.push("DB (.global() table declared)"),c.push(...Dt(s,r,a),...Lt(o,i,t)),c},$t=(e,t)=>e.some(o=>o.binding==="SHARD_REGISTRY")||te(t)&&B(E(t,"shardRegistry.ts")),Ft=(e,t,o)=>{const s=new Z({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),r=[e],a=new Set;for(let i=r.pop();i!==void 0;i=r.pop()){if(a.has(i))continue;a.add(i);const c=K(i),d=c.text;if((ae.test(d)||d.includes(h))&&se(s.createSourceFile(i,d,{overwrite:!0})))return!0;for(const l of ut(c)){const u=G(i,l);u!==void 0&&!t.has(u)&&!ee(u,o)&&r.push(u)}}return!1},jt=e=>!e.composed&&e.path!==void 0&&U(e.path,"EventLogDO",void 0,new Set),kt=e=>({usesNotifyFcm:e?.fcm==="env",usesNotifyFcmTokenSource:e?.fcm==="ownToken",usesNotifyWebPush:e?.hasWebPush??!1}),es=async e=>{await be;const t=e.schemaDir??"lunora",o=e.scanDirs??ft,s=()=>wt(e.projectRoot,o,t),{scannedFiles:r,...a}=e.cache===void 0?s():e.cache.memo(`capabilities:${e.projectRoot}:${t}:${o.join(",")}`,s),i=we(e.projectRoot);let c;i.composed?c=De(E(e.projectRoot,t,_)).map(W=>({binding:Le[W],className:W})):c=i.path===void 0?[]:Pe(i.path);const d=At(e.projectRoot,t,e.cache),l={...d,needsD1:a.needsD1||d.needsD1},u=L(i,Re(e.projectRoot,t,e.cache).containers,"containers"),v=L(i,$e(e.projectRoot,t).workflows,"workflows"),g=L(i,Ce(e.projectRoot,t).agents,"agents"),C={...a,usesAi:a.usesAi||g.length>0},I=[...Oe(e.projectRoot,t).queues],{flags:N}=Xe(e.projectRoot,t),D=M(e.projectRoot,t,xe,Ee),f=N?.provider==="flagship"&&N.mode==="binding"?N.bindingName:void 0,S=E(e.projectRoot,t,_),O=$t(c,S),R=jt(i),x=!i.composed&&i.path!==void 0&&Ft(i.path,r,S),T=Pt(c,l,C,u,v,g);!i.composed&&te(E(e.projectRoot,t,_))&&!c.some(y=>y.className==="LunoraDO")&&T.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),f!==void 0&&T.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${f}", app_id }) — the app_id can't be auto-provisioned`);const A=Rt(e.projectRoot,t,e.skipCompanion===!0),de=A.error===void 0?A.services:void 0;A.error!==void 0&&T.push(`hint: lunora.config \`services\` not reconciled — ${A.error}`),T.push(...A.services.map(y=>y.binding===z?`${y.binding} → ${y.worker} (studio.companion)`:`${y.binding} → ${y.worker} (lunora.config services.${y.name})`));const le=bt(e.projectRoot,t,C.usesAuth,r);return{...C,usesEventLogClient:C.usesEventLogClient||x,agents:g,containers:u,durableObjects:c,flagshipBinding:f,...l.jurisdiction===void 0?{}:{jurisdiction:l.jurisdiction},needsD1:l.needsD1,queues:I,services:de,signals:T,usesFlags:N!==void 0,...kt(D.error===void 0?D.value:ge),hostsEventLog:R,hostsShardRegistry:O,workerRoutes:le,workflows:v}},ts=e=>[...ie,...St].filter(([t,o])=>e[t]&&Ie[o]!==void 0).map(([,t])=>t);export{es as inferLunoraBindings,ts as secretSourcesFromBindings};
@@ -0,0 +1 @@
1
+ const e=t=>{if(t===null||typeof t!="object")return!1;const o=Object.getPrototypeOf(t);return o===null||o===Object.prototype};export{e as i};
@@ -0,0 +1 @@
1
+ import{relative as s,sep as e,isAbsolute as o}from"node:path";const n=(i,r)=>{const t=s(r,i);return t!==""&&t!==".."&&!t.startsWith(`..${e}`)&&!o(t)};export{n as i};
@@ -0,0 +1 @@
1
+ import"./detectFramework-Dfpvu6rD.mjs";import"./readProjectDependencies-l3uhUKjo.mjs";import{S as e,i as a,o as d,s as r}from"./studio-assets-BKWx838V.mjs";import"./WRANGLER_FILES-BF8PUjuo.mjs";export{e as STUDIO_ASSETS_DIRECTORY,a as isOwnedStudioAssets,d as ownedStudioAssetsBlock,r as studioAssetsPlan};
@@ -0,0 +1 @@
1
+ import{isAbsolute as p,dirname as m,resolve as h}from"node:path";import{applyModify as l}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as u}from"./hasCloudflareCredentials-ByCrwaLT.mjs";import{withheldBindings as g,writeDevConfig as w}from"./describeWithheld-CN3D-4pU.mjs";import{readWranglerJsonc as v}from"./WRANGLER_FILES-BF8PUjuo.mjs";const C=(e,i)=>{const{parsed:t,text:c}=v(e),o=t?.build,r=g(t,i.hasCredentials??(()=>u({projectRoot:i.projectRoot}))),s=typeof o?.command=="string"&&o.command!==""&&!(typeof o.cwd=="string"&&p(o.cwd));if(!s&&r.length===0)return{configPath:e,withheld:r};const d=m(e);let n=c;for(const{kind:f}of r)n=l(n,[f],void 0);s&&(n=l(n,["build","cwd"],h(d,typeof o.cwd=="string"?o.cwd:".")));const a=w(d,"service",n,i.projectRoot);return{cleanup:a.cleanup,configPath:a.configPath,withheld:r}},R=(e,i)=>{const t=e.map(o=>C(o,i)),c=t.flatMap(o=>o.cleanup===void 0?[]:[o.cleanup]);return{cleanup:()=>{for(const o of c)o()},configPaths:t.map(o=>o.configPath),withheld:t.flatMap(o=>o.withheld)}};export{R as materializeServiceDevConfigs};
@@ -0,0 +1 @@
1
+ const i=["ai_search","ai_search_namespaces","analytics","artifacts","containers","d1_databases","durable_objects","hyperdrive","k2","kv_namespaces","queues","r2_buckets","secrets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],a=["assets","compatibility_date","compatibility_flags","exports","logpush","main","migrations","observability","placement"],_=(s,t)=>{if(t===void 0)return{merged:s,unverifiedKeys:[]};const n=s.env??void 0,o=n!==void 0&&Object.hasOwn(n,t)?n[t]:void 0;if(o===void 0){const e=Object.keys(s.env??{}).toSorted((f,m)=>f.localeCompare(m)),v=e.length>0?` (declared: ${e.join(", ")}).`:" (no environments are declared).";return{error:`--env "${t}" names no environment declared in wrangler.jsonc's "env" block${v}`,merged:s,unverifiedKeys:[]}}const r={...s},c=Object.keys(o).filter(e=>e!=="env");for(const e of c)a.includes(e)&&(r[e]=o[e]);for(const e of i)r[e]=o[e];const d=new Set([...i,...a]),l=c.filter(e=>!d.has(e)).map(String);return{merged:r,unverifiedKeys:l}};export{i as NON_INHERITABLE_KEYS,_ as mergeWranglerEnvironment};
@@ -0,0 +1 @@
1
+ import{Project as m,SyntaxKind as n}from"ts-morph";const f=/^v\s*\.\s*optional\s*\(/u,x=/\.shardBy\(\s*["']([^"']+)["']\s*\)/u,T=/\.global\(\s*(?:\{[^{}]*\}\s*)?\)/u,p=/["']/gu,u=e=>{const t=e.getDescendantsOfKind(n.CallExpression);return e.getKind()===n.CallExpression&&t.push(e.asKindOrThrow(n.CallExpression)),t},A=e=>f.test(e.trim()),h=e=>e?.getKind()!==n.ArrayLiteralExpression?[]:e.asKindOrThrow(n.ArrayLiteralExpression).getElements().filter(t=>t.getKind()===n.StringLiteral).map(t=>t.asKindOrThrow(n.StringLiteral).getLiteralText()),E=e=>{if(e?.getKind()!==n.ObjectLiteralExpression)return!1;const t=e.asKindOrThrow(n.ObjectLiteralExpression).getProperty("unique");return t?.getKind()===n.PropertyAssignment&&t.getInitializer()?.getText()==="true"},K=e=>{const t=e.getExpression();if(t.getKind()!==n.PropertyAccessExpression||t.asKindOrThrow(n.PropertyAccessExpression).getName()!=="index")return;const[r,a,s]=e.getArguments();if(r?.getKind()===n.StringLiteral)return{fields:h(a),name:r.asKindOrThrow(n.StringLiteral).getLiteralText(),unique:E(s)}},O=e=>{const t=e.getInitializer();if(t===void 0)return[];const r=[];for(const a of u(t)){const s=K(a);s!==void 0&&r.push(s)}return r},y=e=>{const t=[],r=e.getInitializer(),s=(r===void 0?void 0:u(r).find(l=>l.getExpression().getText()==="defineTable"))?.getArguments()[0];if(s?.getKind()!==n.ObjectLiteralExpression)return t;for(const l of s.getProperties()){if(l.getKind()!==n.PropertyAssignment)continue;const i=l,o=i.getName().replaceAll(p,""),c=i.getInitializer()?.getText()??"";t.push({name:o,optional:A(c),validator:c})}return t},P=e=>{const r=new m({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}).createSourceFile("schema.ts",e,{overwrite:!0}),a=r.getDescendantsOfKind(n.CallExpression).find(i=>i.getExpression().getText()==="defineSchema");if(a===void 0)return{ok:!1,reason:r.getImportDeclarations().some(o=>o.getNamedImports().some(c=>c.getName()==="defineSchema"&&c.getAliasNode()!==void 0))?"aliased-define-schema":"no-define-schema"};const s=a.getArguments()[0];if(s?.getKind()!==n.ObjectLiteralExpression)return{ok:!1,reason:"non-object-argument"};const l=[];for(const i of s.getProperties()){if(i.getKind()!==n.PropertyAssignment)continue;const o=i,c=o.getName().replaceAll(p,""),g=o.getInitializer()?.getText()??"",d=x.exec(g);l.push({columns:y(o),global:T.test(g),indexes:O(o),name:c,...d?.[1]===void 0?{}:{shardBy:d[1]}})}return{ok:!0,tables:l}};export{u as collectCalls,P as parseSchema};
@@ -0,0 +1 @@
1
+ import{mkdirSync as l,writeFileSync as $,rmSync as w}from"node:fs";import{basename as h,join as d,dirname as p}from"node:path";import{inferLunoraBindings as u}from"./inferLunoraBindings-BUk28bSQ.mjs";import{LUNORA_TAG as a}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{applyWranglerBindings as v}from"./reconcileWranglerBindings-D6B81UKU.mjs";import{r as y}from"./validate-bindings-DSMH8bRQ.mjs";import{planWranglerBindings as S}from"./collectExportGaps-DvirOIVB.mjs";import{reconcileWranglerCompatibilityDate as j}from"./reconcileWranglerCompatibilityDate-Cj94osA-.mjs";import{reconcileWranglerCrons as b,describePreservedCrons as C}from"./describePreservedCrons-i5XT6rtl.mjs";import{s as x,S as E}from"./studio-assets-BKWx838V.mjs";import{findWranglerFile as k,readWranglerJsonc as P}from"./WRANGLER_FILES-BF8PUjuo.mjs";const m=async r=>S(r.projectRoot,await u({cache:r.cache,projectRoot:r.projectRoot,schemaDir:r.schemaDir}),{target:r.target}),L=async(r,o,t)=>{try{const n=v(r.projectRoot,await m(r)),e=n.wranglerPath??"wrangler.jsonc";if(n.added.length>0&&o.info?.(`${a} inferred bindings → ${n.added.join(", ")} (written to ${e})`),n.updated.length>0&&o.info?.(`${a} updated bindings → ${n.updated.join(", ")} (written to ${e})`),n.devConfig!==void 0){const{added:i,path:s,updated:c}=n.devConfig;o.info?.(`${a} dev sidecar bindings → ${[...i,...c].join(", ")} (written to ${s})`)}for(const i of n.warnings)o.warn(`${a} ${i}`);n.exportGaps.length>0&&t?.(n.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);o.warn(`${a} binding inference skipped: ${e}`)}},M=async r=>{try{const{added:o,devConfig:t,updated:n}=await m(r),e=t===void 0?[]:[...t.added,...t.updated].map(i=>`${h(t.path)} ${i}`);return[...new Set([...o,...n,...e])]}catch{return[]}},f=new Map,N=(r,o,t)=>{try{const n=b(r,o);n.changed&&t.info?.(`${a} synced ${o.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)t.warn(`${a} ${s}`);const e=n.preserved.join("\0"),i=C(n.preserved);i!==void 0&&(n.changed||f.get(r)!==e)&&t.info?.(`${a} ${i}`),f.set(r,e)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${a} cron trigger sync skipped: ${e}`)}try{const n=j(r);n.changed&&t.info?.(`${a} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${a} compatibility date sync skipped: ${e}`)}},W=["architecture.json","openapi.json","openrpc.json"],J=(r,o,t)=>{const n=k(r),e=n===void 0?void 0:P(n);if(n===void 0||e?.parsed===void 0)return;const i=x(r,e.parsed,o),s=y(e.text,e.parsed,i);if(i!==void 0&&l(d(p(n),i.directory),{recursive:!0}),s.text!==e.text&&($(n,s.text,"utf8"),t.info?.(`${a} ${[...s.added,...s.updated].join(", ")} → ${n}`)),i===void 0){const c=d(p(n),E,"_lunora","studio");for(const g of W)w(d(c,g),{force:!0})}};export{M as pendingBindingChanges,L as reconcileBindingsSafely,J as reconcileStudioAssets,N as reconcileWranglerExtras};