@lunora/config 1.0.0-alpha.35 → 1.0.0-alpha.351
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +135 -0
- package/README.md +3 -3
- package/dist/cloudflare/index.d.mts +1252 -0
- package/dist/cloudflare/index.d.ts +1252 -0
- package/dist/cloudflare/index.mjs +1 -0
- package/dist/index.d.mts +1048 -917
- package/dist/index.d.ts +1048 -917
- package/dist/index.mjs +1 -23
- package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
- package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
- package/dist/packem_shared/AGENT_RULES_DIR-HrrbNZPy.mjs +1 -0
- package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-CfXEYG8e.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-BKMrOuXV.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_DRIVER-CULavrYO.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DV5E_f_q.mjs +1 -0
- package/dist/packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs +1 -0
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs +1 -0
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-rR7buNQw.mjs +1 -0
- package/dist/packem_shared/DEFAULT_OBSERVABILITY-bN6UkTMx.mjs +1 -0
- package/dist/packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs +4 -0
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs +6 -0
- package/dist/packem_shared/DEV_WORKER_ENV_VALUE-2XFXmRrP.mjs +1 -0
- package/dist/packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs +1 -0
- package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs +1 -0
- package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
- package/dist/packem_shared/LUNORA_TAG-CiQM3BkI.mjs +1 -0
- package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-38Plje8b.mjs +1 -0
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-BmJYwAy2.mjs +1 -0
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-PLeh_74E.mjs +1 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-OLQlG0oj.mjs +1 -0
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-BeTxqCuQ.mjs +1 -0
- package/dist/packem_shared/SEED_ENDPOINT-2B56PN_H.mjs +1 -0
- package/dist/packem_shared/STUDIO_PATH-CSx_psKS.mjs +1 -0
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-DwJCN8fX.mjs +1 -0
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
- package/dist/packem_shared/WRANGLER_FILES-UNW-xY5u.mjs +1 -0
- package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
- package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
- package/dist/packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs +6 -0
- package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
- package/dist/packem_shared/applyStudioAssetCache-DHQEJuuv.mjs +1 -0
- package/dist/packem_shared/assertWranglerSatisfiesSchema-Dd7ZPhw7.mjs +3 -0
- package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
- package/dist/packem_shared/buildPackageSecretsBlock-BWV_VxqV.mjs +19 -0
- package/dist/packem_shared/celld-config-D-L6uskI.mjs +3 -0
- package/dist/packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs +24 -0
- package/dist/packem_shared/collectExportGaps-BPuhGH2J.mjs +2 -0
- package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
- package/dist/packem_shared/createDiscoveryCache-npJI4uej.mjs +1 -0
- package/dist/packem_shared/describePreservedCrons-C5KPuPy3.mjs +1 -0
- package/dist/packem_shared/describeWithheldWorkersAi-IIxe3TuI.mjs +1 -0
- package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
- package/dist/packem_shared/discover-info-DC2MrAIM.mjs +1 -0
- package/dist/packem_shared/discoverAgentInfo-pqFMJBtJ.mjs +1 -0
- package/dist/packem_shared/discoverContainerInfo-DzXr7Vm3.mjs +1 -0
- package/dist/packem_shared/discoverSchemaInfo-BBRlXZop.mjs +1 -0
- package/dist/packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs +1 -0
- package/dist/packem_shared/guards-Buu_E7mP.mjs +1 -0
- package/dist/packem_shared/hasCloudflareCredentials-byvHpEiD.mjs +1 -0
- package/dist/packem_shared/infer-bindings-C1NFOdMi.mjs +1 -0
- package/dist/packem_shared/infer-bindings.d-CFxssIAC.d.mts +480 -0
- package/dist/packem_shared/infer-bindings.d-CFxssIAC.d.ts +480 -0
- package/dist/packem_shared/inferLunoraBindings-Gp_7yyIo.mjs +1 -0
- package/dist/packem_shared/interpretRemote-CcmGeGZ_.mjs +1 -0
- package/dist/packem_shared/lunora-manifest-DuH_Cmyu.mjs +6 -0
- package/dist/packem_shared/materializeServiceDevConfigs-DLUHefD-.mjs +1 -0
- package/dist/packem_shared/mergeWranglerEnvironment-DXiB-HcS.mjs +1 -0
- package/dist/packem_shared/package-secrets-registry-BeheNwsP.mjs +1 -0
- package/dist/packem_shared/parseDevVariable-teAAahVD.mjs +1 -0
- package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
- package/dist/packem_shared/process-tree-once-Ou4SfxKM.mjs +1 -0
- package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
- package/dist/packem_shared/reconcile-services-DFqH4eMQ.mjs +1 -0
- package/dist/packem_shared/reconcileBindingsSafely-7IJ58Uit.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-hocXEuRA.mjs +1 -0
- package/dist/packem_shared/renderStudioHtml-ByowDtMl.mjs +15 -0
- package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
- package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
- package/dist/packem_shared/scanWranglerVariablesForSecrets-BFTVje1q.mjs +1 -0
- package/dist/packem_shared/serveJsonHandler-Dv0EdCb9.mjs +1 -0
- package/dist/packem_shared/startCelldDevSession-BLFsd6jG.mjs +1 -0
- package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
- package/dist/packem_shared/validate-bindings-CvNBF3U4.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-DngzpJMK.mjs +1 -0
- package/dist/packem_shared/worker-entry-checks-AIASCYl7.mjs +1 -0
- package/dist/packem_shared/wranglerCodegenInputs-CbisphsH.mjs +1 -0
- package/dist/packem_shared/wranglerToAlchemy-CBO2ucRm.mjs +6 -0
- package/dist/packem_shared/write-atomic-CK6VZaPI.mjs +1 -0
- package/dist/studio-host/index.d.mts +314 -110
- package/dist/studio-host/index.d.ts +314 -110
- package/dist/studio-host/index.mjs +1 -7
- package/package.json +16 -7
- package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
- package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
- package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
- package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
- package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-CiC2IGKx.mjs +0 -103
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
- package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
- package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
- package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
- package/dist/packem_shared/buildPackageSecretsBlock-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-ByMwG-gH.mjs +0 -352
- package/dist/packem_shared/loadStudioAssets-Csk5RS4E.mjs +0 -28
- package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
- package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
- package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
- package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
- package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
- package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { discoverContainerInfo } from './packem_shared/discoverContainerInfo-BXFs6Wav.mjs';
|
|
3
|
-
export { streamContainerLogs } from './packem_shared/streamContainerLogs-BZ4cOZwH.mjs';
|
|
4
|
-
export { detectFramework } from './packem_shared/detectFramework-Br-BcPBq.mjs';
|
|
5
|
-
export { DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, parseDevVariableEntries } from './packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs';
|
|
6
|
-
export { inferLunoraBindings, packageNamesFromBindings } from './packem_shared/inferLunoraBindings-ByMwG-gH.mjs';
|
|
7
|
-
export { LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, readLinkedProject, writeLinkedProject } from './packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs';
|
|
8
|
-
export { LUNORA_EVENT_SOURCE, formatLunoraEvent } from './packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs';
|
|
9
|
-
export { default as LunoraReporter } from './packem_shared/LunoraReporter-Ci-bDCK9.mjs';
|
|
10
|
-
export { PACKAGE_SECRETS_REGISTRY, secretsForPackages } from './packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs';
|
|
11
|
-
export { LUNORA_CONFIG_FILE, interpretRemote, readProjectRemotePreference } from './packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs';
|
|
12
|
-
export { createConfirm, isInteractive, promptMultiSelect, promptSelect, promptYesNo } from './packem_shared/createConfirm-fvpdgJ9s.mjs';
|
|
13
|
-
export { reconcileWranglerBindings } from './packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs';
|
|
14
|
-
export { REMOTE_ELIGIBLE_KEYS, injectRemoteFlags, isRemoteEnvEnabled, materializeRemoteWranglerConfig, planRemoteBindings, resolveRemoteEnabled } from './packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs';
|
|
15
|
-
export { buildPackageSecretsBlock, ensureDevVariables, ensureDevVarsExample, fillDevSecrets, generateSecretValue, isMintableSecretKey, isPlaceholderValue, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, requiredSecrets } from './packem_shared/buildPackageSecretsBlock-DWDKHViT.mjs';
|
|
16
|
-
export { applyAdditiveEdit, classifyEdit } from './packem_shared/applyAdditiveEdit-C-snTFEV.mjs';
|
|
17
|
-
export { parseSchema } from './packem_shared/parseSchema-DSeyktvG.mjs';
|
|
18
|
-
export { classifyPolicyEdit, scaffoldPolicyFile, wireRlsIntoProcedure } from './packem_shared/classifyPolicyEdit-BHeAqF8P.mjs';
|
|
19
|
-
export { discoverSchemaInfo } from './packem_shared/discoverSchemaInfo-BB-CKlTK.mjs';
|
|
20
|
-
export { ACCENT, BADGES, BADGE_COLUMN_WIDTH, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, STEP_BADGE_NAMES, badgeLead, badgeWidth, padBadge, paintAnswer, paintBadge } from './packem_shared/ACCENT-DW1XJn8i.mjs';
|
|
21
|
-
export { discoverWorkflowInfo } from './packem_shared/discoverWorkflowInfo-CedvR0mn.mjs';
|
|
22
|
-
export { WRANGLER_FILES, findWranglerFile, readWranglerJsonc } from './packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs';
|
|
23
|
-
export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer } from './packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs';
|
|
1
|
+
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as s}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as i,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as c,ROOT_SKILL_NAME as l,claimAgentRulesHint as p,detectAgentRules as D}from"./packem_shared/AGENT_RULES_DIR-HrrbNZPy.mjs";import{startCelldDevSession as m}from"./packem_shared/startCelldDevSession-BLFsd6jG.mjs";import{CODEGEN_ENV as S,isCodegenDisabled as f}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as v}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as N}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as g,projectUsesUmbrella as x}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{acceptsConnection as I,startDevProcess as O}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as u,DEV_DAEMON_ENV as C,DEV_HANDOFF_ENV as F,DEV_LOG_FILE as U,DEV_LOG_FILE_ENV as M,DEV_STATE_DIR as G,DEV_STATE_FILE as B,claimDevServerState as b,clearDevServerState as y,isDevServerReady as k,isProcessAlive as j,isRecordedProcessCurrent as K,readDevServerState as h,readLiveDevServerState as w,updateDevServerState as H,writeDevServerState as W}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{DEV_VARS_EXAMPLE_FILE as J,DEV_VARS_FILE as q,DEV_VARS_KEY_PATTERN as X,escapeRegExp as z,parseDevVariableEntries as Q,removeDevVariableLine as Z,upsertDevVariableLine as $}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as re,DEV_WORKER_ENV_VAR as oe,ensureDevWorkerEnv as te}from"./packem_shared/DEV_WORKER_ENV_VALUE-2XFXmRrP.mjs";import{createDiscoveryCache as se}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as ie,deployTargetIds as ne,isRunnableTarget as _e,planToolchainInvocation as ce,resolveDeployDriver as le,runnableTargetIds as pe,targetRunsOwnDevServer as De}from"./packem_shared/DEFAULT_DEPLOY_TARGET-rR7buNQw.mjs";import{i as me,s as Ae}from"./packem_shared/infer-bindings-C1NFOdMi.mjs";import{LINKED_PROJECT_DIR as fe,LINKED_PROJECT_FILE as Le,readLinkedProject as ve,writeLinkedProject as Re}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Te,applyLintIgnores as ge,detectLintTools as xe}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{LUNORA_TAG as Ie,advisoryLine as Oe,blockingFindingsMessage as Pe,lunoraLine as ue,reportCodegenFindings as Ce}from"./packem_shared/LUNORA_TAG-CiQM3BkI.mjs";import{LUNORA_EVENT_SOURCE as Ue,formatLunoraEvent as Me}from"./packem_shared/LUNORA_EVENT_SOURCE-B9ZVohjO.mjs";import{default as Be}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as ye,detectInstalledManagers as ke,detectPackageManager as je,execArgsFor as Ke,installArgsFor as he,runScriptArgsFor as we,runScriptCommand as He,toolchainExecArgs as We}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as Je,s as qe}from"./packem_shared/package-secrets-registry-BeheNwsP.mjs";import{runPostCodegenHook as ze}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{interpretRemote as Ze,readProjectRemotePreference as $e,readProjectTarget as er,resolveProjectTarget as rr,resolveTargetOrThrow as or}from"./packem_shared/interpretRemote-CcmGeGZ_.mjs";import{readProjectDependencies as ar,readProjectDependencyNames as sr,readProjectManifest as Er}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as nr,isInteractive as _r,promptMultiSelect as cr,promptSelect as lr,promptText as pr,promptYesNo as Dr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as mr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as Sr,ensureDevVariables as fr,ensureDevVarsExample as Lr,fillDevSecrets as vr,generateSecretValue as Rr,isMintableSecretKey as Nr,isPlaceholderValue as Tr,planDevSecretsFill as gr,planDevVariablesAugment as xr,planDevVariablesScaffold as Vr,requiredSecrets as Ir,writeDevVariablesFileAtomically as Or}from"./packem_shared/buildPackageSecretsBlock-BWV_VxqV.mjs";import{applyAdditiveEdit as ur,classifyEdit as Cr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as Ur}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as Gr,resolveServerModule as Br,scaffoldPolicyFile as br,wireRlsIntoProcedure as yr}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as jr}from"./packem_shared/discoverSchemaInfo-BBRlXZop.mjs";import{ACCENT as hr,BADGES as wr,BADGE_COLUMN_WIDTH as Hr,LUNA_ART as Wr,LUNA_BUNNY as Yr,LUNA_NAME as Jr,LUNA_SIGNOFF as qr,STEP_BADGE_NAMES as Xr,badgeLead as zr,badgeWidth as Qr,padBadge as Zr,paintAnswer as $r,paintBadge as eo}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as oo,DURABLE_OBJECT_BINDINGS as to,GENERATED_CLASS_MODULES as ao,GENERATED_MODULE_DURABLE_OBJECTS as so,MERGED_DURABLE_OBJECTS_MODULE as Eo,isMergedProject as io,isMergedRoleModule as no}from"./packem_shared/COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{discoverWorkflowInfo as co}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";export{hr as ACCENT,o as AGENT_MODE_ENV,i as AGENT_RULES_DIR,n as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,wr as BADGES,Hr as BADGE_COLUMN_WIDTH,S as CODEGEN_ENV,oo as COMPOSED_WORKER_ENTRY,ie as DEFAULT_DEPLOY_TARGET,u as DEV_BINDINGS_FILE,C as DEV_DAEMON_ENV,F as DEV_HANDOFF_ENV,U as DEV_LOG_FILE,M as DEV_LOG_FILE_ENV,G as DEV_STATE_DIR,B as DEV_STATE_FILE,J as DEV_VARS_EXAMPLE_FILE,q as DEV_VARS_FILE,X as DEV_VARS_KEY_PATTERN,re as DEV_WORKER_ENV_VALUE,oe as DEV_WORKER_ENV_VAR,to as DURABLE_OBJECT_BINDINGS,ao as GENERATED_CLASS_MODULES,so as GENERATED_MODULE_DURABLE_OBJECTS,fe as LINKED_PROJECT_DIR,Le as LINKED_PROJECT_FILE,Wr as LUNA_ART,Yr as LUNA_BUNNY,Jr as LUNA_NAME,qr as LUNA_SIGNOFF,Ue as LUNORA_EVENT_SOURCE,Te as LUNORA_IGNORED_PATHS,c as LUNORA_SKILL_NAMES,Ie as LUNORA_TAG,Be as LunoraReporter,Eo as MERGED_DURABLE_OBJECTS_MODULE,Je as PACKAGE_SECRETS_REGISTRY,l as ROOT_SKILL_NAME,Xr as STEP_BADGE_NAMES,I as acceptsConnection,ye as addArgsFor,Oe as advisoryLine,ur as applyAdditiveEdit,ge as applyLintIgnores,zr as badgeLead,Qr as badgeWidth,Pe as blockingFindingsMessage,Sr as buildPackageSecretsBlock,p as claimAgentRulesHint,b as claimDevServerState,Cr as classifyEdit,Gr as classifyPolicyEdit,y as clearDevServerState,nr as createConfirm,se as createDiscoveryCache,ne as deployTargetIds,D as detectAgentRules,t as detectAiAgent,g as detectFramework,ke as detectInstalledManagers,xe as detectLintTools,je as detectPackageManager,s as discoverAgentInfo,v as discoverContainerInfo,jr as discoverSchemaInfo,co as discoverWorkflowInfo,fr as ensureDevVariables,Lr as ensureDevVarsExample,te as ensureDevWorkerEnv,z as escapeRegExp,Ke as execArgsFor,vr as fillDevSecrets,Me as formatLunoraEvent,Rr as generateSecretValue,me as inferLunoraBindings,he as installArgsFor,Ze as interpretRemote,f as isCodegenDisabled,k as isDevServerReady,_r as isInteractive,io as isMergedProject,no as isMergedRoleModule,Nr as isMintableSecretKey,Tr as isPlaceholderValue,j as isProcessAlive,K as isRecordedProcessCurrent,_e as isRunnableTarget,ue as lunoraLine,Zr as padBadge,$r as paintAnswer,eo as paintBadge,Q as parseDevVariableEntries,Ur as parseSchema,gr as planDevSecretsFill,xr as planDevVariablesAugment,Vr as planDevVariablesScaffold,ce as planToolchainInvocation,x as projectUsesUmbrella,cr as promptMultiSelect,lr as promptSelect,pr as promptText,Dr as promptYesNo,h as readDevServerState,ve as readLinkedProject,w as readLiveDevServerState,ar as readProjectDependencies,sr as readProjectDependencyNames,Er as readProjectManifest,$e as readProjectRemotePreference,er as readProjectTarget,Z as removeDevVariableLine,Ce as reportCodegenFindings,Ir as requiredSecrets,le as resolveDeployDriver,rr as resolveProjectTarget,mr as resolveSchemaDirectory,Br as resolveServerModule,or as resolveTargetOrThrow,ze as runPostCodegenHook,we as runScriptArgsFor,He as runScriptCommand,pe as runnableTargetIds,br as scaffoldPolicyFile,Ae as secretSourcesFromBindings,qe as secretsForPackages,m as startCelldDevSession,O as startDevProcess,N as streamContainerLogs,De as targetRunsOwnDevServer,We as toolchainExecArgs,H as updateDevServerState,$ as upsertDevVariableLine,yr as wireRlsIntoProcedure,W as writeDevServerState,Or as writeDevVariablesFileAtomically,Re as writeLinkedProject};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import o from"@visulima/colorize";const g="#a855f7",e="#0b0b0b",s=["lunora","dir","tmpl","add","deps","git","next"],x={add:{bg:g,fg:e,text:"add"},debug:{bg:"#6b7280",fg:"#f3f4f6",text:"debug"},deps:{bg:g,fg:e,text:"deps"},dir:{bg:g,fg:e,text:"dir"},error:{bg:"#ef4444",fg:e,text:"error"},git:{bg:"#f59e0b",fg:e,text:"git"},info:{bg:"#3b82f6",fg:e,text:"info"},lunora:{bg:"#22c55e",fg:e,text:"lunora"},next:{bg:"#06b6d4",fg:e,text:"next"},success:{bg:"#22c55e",fg:e,text:"ok"},tmpl:{bg:g,fg:e,text:"tmpl"},warn:{bg:"#f59e0b",fg:e,text:"warn"}},c="Luna",i="Safe travels, voyager.",n=String.raw`
|
|
2
|
+
.-"""""-.
|
|
3
|
+
/ (\(\ \
|
|
4
|
+
| ( -.-) |
|
|
5
|
+
\ o(")(") /
|
|
6
|
+
'-._____.-'`,_=n.startsWith(`
|
|
7
|
+
`)?n.slice(1):n,b=6,a=t=>` ${t} `,f=t=>" ".repeat(Math.max(0,b-t.length)),r=b+2,A=t=>r,N=t=>f(t.text)+o.bgHex(t.bg).hex(t.fg).bold(a(t.text)),l=t=>o.dim(t);export{g as ACCENT,x as BADGES,r as BADGE_COLUMN_WIDTH,_ as LUNA_ART,n as LUNA_BUNNY,c as LUNA_NAME,i as LUNA_SIGNOFF,s as STEP_BADGE_NAMES,f as badgeLead,A as badgeWidth,a as padBadge,l as paintAnswer,N as paintBadge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{detectAiSession as n}from"@visulima/find-ai-runner";const i="LUNORA_AGENT_MODE",r=o=>{const e=o.trim().toLowerCase();return e==="0"||e==="false"},a=(o=process.env)=>{const e=o[i];if(e!==void 0&&e!=="")return r(e)?void 0:{name:"agent (forced)",variable:i};const t=n(o);return t===void 0?void 0:{name:t.agent,variable:t.signal}};export{i as AGENT_MODE_ENV,a as detectAiAgent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as s}from"node:fs";import{join as l}from"node:path";import{c as a}from"./process-tree-once-Ou4SfxKM.mjs";const u=".agents/skills",i="LUNORA_RULES_HINT_SHOWN",c=["lunora","lunora-quickstart","lunora-functions","lunora-realtime","lunora-setup-auth","lunora-setup-hyperdrive","lunora-setup-hyperdrive-global","lunora-setup-mail","lunora-setup-scheduler","lunora-setup-storage","lunora-create-package","lunora-migration-helper","lunora-deploy","lunora-performance-audit"],p="lunora",N="Lunora AI rules not installed — run `lunora rules install` so your coding agent knows how to use Lunora.",d=()=>a(i),t=(n,o)=>l(n,u,o,"SKILL.md"),g=n=>{const o=[],r=[];for(const e of c)s(t(n,e))?o.push(e):r.push(e);return{installed:s(t(n,p)),missing:r,present:o}};export{u as AGENT_RULES_DIR,N as AGENT_RULES_HINT,i as AGENT_RULES_HINT_ENV,c as LUNORA_SKILL_NAMES,p as ROOT_SKILL_NAME,d as claimAgentRulesHint,g as detectAgentRules};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=e=>{const o=Array.isArray(e)?e[0]:e;return typeof o=="string"?o.trim().toLowerCase():void 0},d=e=>{if(e===void 0||e==="")return!0;const o=e.toLowerCase(),r=o.startsWith("::ffff:")?o.slice(7):o;return r==="::1"?!0:r.startsWith("127.")},a=e=>{if(e===void 0)return;if(e.startsWith("[")){const r=e.indexOf("]");return r===-1?e.slice(1):e.slice(1,r)}const o=e.indexOf(":");return o===-1?e:e.slice(0,o)},c=new Set(["0.0.0.0","127.0.0.1","::1","localhost"]),u=["x-forwarded-for","x-forwarded-host","x-forwarded-proto","forwarded"],n="LUNORA_STUDIO_ALLOW_FORWARDED",l=()=>process.env[n]==="1",f=(e,o)=>{if(!d(e.socket?.remoteAddress??void 0))return"Lunora studio is only available on loopback connections in dev.";const r=a(i(e.headers?.host));if(r!==void 0&&!c.has(r))return"Lunora studio rejects a non-localhost Host header in dev.";const t=u.find(s=>e.headers?.[s]!==void 0);if(t!==void 0&&!l())return o?.warnOnce?.(`[lunora] studio: refusing a request carrying the "${t}" header — this dev server is being reached through a proxy/tunnel (Codespaces, devcontainers, Gitpod, Cloud Workstations, ngrok, and Docker reverse proxies all add this). If this is YOUR trusted dev tunnel, set ${n}=1 to allow it.`),`Lunora studio refuses a proxied request in dev (saw the "${t}" header). If you're intentionally running behind a trusted dev tunnel/proxy (e.g. Codespaces, devcontainers, Gitpod, ngrok), set ${n}=1 to allow it.`};export{n as ALLOW_FORWARDED_ENV,i as headerValue,d as isLoopbackAddress,f as transportRejectionReason};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{sqliteClasses as l}from"./wranglerToAlchemy-CBO2ucRm.mjs";const p=1,u=new Set(["$schema","account_id","compatibility_date","compatibility_flags","keep_vars","main","migrations","minify","name","observability","placement","routes","rules","secrets","triggers","upload_source_maps","vars","workers_dev"]),y=e=>Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0)),d=[{bindingKey:"binding",field:"ai_search",resourceKey:"instance_name",type:"ai_search"},{bindingKey:"binding",field:"ai_search_namespaces",resourceKey:"namespace",type:"ai_search_namespace"},{bindingKey:"binding",field:"analytics_engine_datasets",resourceKey:"dataset",type:"analytics_engine"},{bindingKey:"binding",field:"artifacts",resourceKey:"namespace",type:"artifacts"},{bindingKey:"class_name",field:"containers",resourceKey:"image",type:"container"},{bindingKey:"binding",field:"d1_databases",resourceIdKey:"database_id",resourceKey:"database_name",type:"d1"},{bindingKey:"binding",field:"hyperdrive",resourceIdKey:"id",type:"hyperdrive"},{bindingKey:"binding",field:"kv_namespaces",resourceIdKey:"id",type:"kv"},{bindingKey:"binding",field:"pipelines",resourceKey:["stream","pipeline"],type:"pipeline"},{bindingKey:"binding",field:"r2_buckets",resourceKey:"bucket_name",type:"r2"},{bindingKey:"binding",field:"services",resourceKey:"service",type:"service"},{bindingKey:"binding",field:"vectorize",resourceKey:"index_name",type:"vectorize"},{bindingKey:"binding",field:"vpc_networks",resourceIdKey:["tunnel_id","network_id"],type:"vpc_network"},{bindingKey:"binding",field:"vpc_services",resourceIdKey:"service_id",type:"vpc_service"},{bindingKey:"binding",field:"workflows",resourceKey:"name",type:"workflow"}],c=[{field:"ai",type:"ai"},{field:"analytics",type:"analytics_sql"},{field:"assets",type:"assets"},{field:"browser",type:"browser"},{field:"images",type:"images"},{field:"media",type:"media"},{field:"stream",type:"stream"}],b=new Set([...d.map(e=>e.field),...c.map(e=>e.field),"durable_objects","exports","queues"]),a=(e,n)=>(typeof n=="string"?[n]:n??[]).map(i=>e[i]).find(i=>typeof i=="string"&&i!==""),m=(e,n)=>{const s=[];for(const i of d)for(const r of e[i.field]??[]){const t=a(r,i.bindingKey);if(t===void 0){n.push(i.field);continue}s.push({binding:t,className:a(r,"class_name"),resource:a(r,i.resourceKey),resourceId:a(r,i.resourceIdKey),type:i.type})}return s},_=(e,n)=>{const s=l(e),i=[];for(const r of e.durable_objects?.bindings??[]){if(r.name===void 0||r.name===""){n.push("durable_objects");continue}i.push({binding:r.name,className:r.class_name,sqlite:r.script_name===void 0&&r.class_name!==void 0?s.has(r.class_name):void 0,type:"durable_object"})}return i},g=(e,n)=>{const s=[];for(const i of e.queues?.producers??[]){if(i.binding===void 0||i.binding===""){n.push("queues.producers");continue}s.push({binding:i.binding,resource:i.queue,type:"queue_producer"})}for(const i of e.queues?.consumers??[]){if(i.queue===void 0||i.queue===""){n.push("queues.consumers");continue}s.push({binding:i.queue,resource:i.queue,type:"queue_consumer"})}return s},f=(e,n)=>Object.entries(e.exports??{}).flatMap(([s,i])=>i?.type!=="workflow"?(n.push(`exports.${s}`),[]):[{binding:s,className:s,resource:i.name,type:"workflow"}]),v=(e,n,s)=>[...f(e,s),...m(e,n),..._(e,n),...g(e,n),...c.filter(i=>e[i.field]?.binding!==void 0).map(i=>({binding:e[i.field]?.binding,type:i.type}))],h=e=>{const n=[],s=[],i=v(e,n,s).map(t=>y(t)).toSorted((t,o)=>t.type.localeCompare(o.type)||t.binding.localeCompare(o.binding)),r=[...Object.keys(e).filter(t=>!u.has(t)&&!b.has(t)),...n.map(t=>`${t} (entry with no binding name)`),...s].toSorted((t,o)=>t.localeCompare(o));return{bindings:i,...e.compatibility_date===void 0?{}:{compatibilityDate:e.compatibility_date},...e.compatibility_flags===void 0?{}:{compatibilityFlags:e.compatibility_flags},crons:e.triggers?.crons??[],...e.name===void 0?{}:{name:e.name},unknown:r,vars:Object.keys(e.vars??{}).toSorted((t,o)=>t.localeCompare(o)),version:p}};export{p as BINDING_MANIFEST_VERSION,h as buildBindingManifest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as c}from"node:fs";import{join as t,basename as f}from"node:path";import{i as l,c as d}from"./process-tree-once-Ou4SfxKM.mjs";import{findWranglerFile as u}from"./WRANGLER_FILES-UNW-xY5u.mjs";const m=["cloudflare.config.ts","cloudflare.config.mts","cloudflare.config.js","cloudflare.config.mjs"],g="https://github.com/anolilab/lunora/issues/964",s="LUNORA_CF_CONFIG_WARNING_SHOWN",C=o=>{const n=m.find(a=>c(t(o,a)));if(n===void 0)return;const e=u(o),r=e===void 0?void 0:f(e),i=r===void 0?"in the project root":`next to ${r}`;return{fix:`\`cf\` resource commands (zones, DNS, KV, …) are fine. Don't use \`cf dev\` / \`cf build\` / \`cf deploy\` on a Lunora project until Lunora supports \`cf\` — see ${g}.`,message:`${n} found ${i}. Lunora manages ${r??"the wrangler config"} and never updates a Cloudflare CLI (\`cf\`) config, so \`cf dev\` / \`cf build\` / \`cf deploy\` would run from a stale config, silently missing the bindings, Durable Object classes and migrations Lunora adds.`}},I=(o,n)=>{if(l(s))return!1;const e=C(o);return e===void 0||!d(s)?!1:(n(`${e.message} ${e.fix}`),!0)};export{s as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,C as detectCloudflareCliConfig,I as warnCloudflareCliConfigOnce};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r={devServer:"workerd",prebuildsContainerImages:!0,deploy:o=>{const n=o.preview===!0?["versions","upload"]:["deploy"];return o.entry!==void 0&&n.push(o.entry),o.configPath!==void 0&&n.push("--config",o.configPath),o.environment!==void 0&&n.push("--env",o.environment),o.temporary===!0&&n.push("--temporary"),o.dryRun===!0&&n.push("--dry-run"),o.outDir!==void 0&&n.push("--outdir",o.outDir,"--metafile"),{args:n,tool:"wrangler"}},dev:o=>{const n=["dev"];return o.configPath!==void 0&&n.push("--config",o.configPath),o.environment!==void 0&&n.push("--env",o.environment),n.push(...o.extraArgs??[]),{args:n,tool:"wrangler"}},secretList:o=>{const n=["secret","list","--format","json"];return o.environment!==void 0&&n.push("--env",o.environment),o.temporary===!0&&n.push("--temporary"),{args:n,tool:"wrangler"}},secretBulk:o=>{const n=["secret","bulk"];return o.environment!==void 0&&n.push("--env",o.environment),o.temporary===!0&&n.push("--temporary"),{args:n,tool:"wrangler"}},secretPut:o=>{const n=["secret","put",o.key??""];return o.environment!==void 0&&n.push("--env",o.environment),o.temporary===!0&&n.push("--temporary"),{args:n,tool:"wrangler"}},tail:o=>{const n=["tail"];return o.worker!==void 0&&n.push(o.worker),o.environment!==void 0&&n.push("--env",o.environment),o.format!==void 0&&n.push("--format",o.format),o.status!==void 0&&n.push("--status",o.status),o.search!==void 0&&n.push("--search",o.search),o.temporary===!0&&n.push("--temporary"),{args:n,tool:"wrangler"}}},i={id:"cloudflare",name:"Cloudflare",toolchain:r};export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={"@cloudflare/vite-plugin":"^1.62.5","@cloudflare/workers-types":"^5.20261004.1",wrangler:"^4.147.0"};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s="LUNORA_CODEGEN",t=o=>{const e=o?.trim().toLowerCase();return e==="0"||e==="false"};export{s as CODEGEN_ENV,t as isCodegenDisabled};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as E,readFileSync as O}from"node:fs";import{parse as S}from"es-module-lexer";import{WRANGLER_FILES as m,readWranglerJsonc as f}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{escapeRegExp as i}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{join as c}from"node:path";const g="_generated",x=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],h=new Set(["build","coverage","dist",g,"node_modules","out","target"]),w=new Set([".client",".server"]),A=/[/\\]/u,L=t=>{const e=[];for(const r of t.split(A))r===""||r==="."||(r===".."&&e.length>0&&e.at(-1)!==".."?e.pop():e.push(r));return e},T=t=>L(t).slice(0,-1).some(e=>h.has(e)||e.startsWith(".")&&!w.has(e)),l={LunoraDO:"SHARD",SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD",ShardRegistryDO:"SHARD_REGISTRY"},R=Object.keys(l),$=t=>Object.hasOwn(l,t),C="virtual:lunora/worker",d=["ShardDO"],J=["agents","containers","scheduler","shardRegistry","workflows"],u={scheduler:"SchedulerDO",shardRegistry:"ShardRegistryDO"},D="LunoraDO",y=new Set([...d,...Object.values(u)]),B="durableObjects",I=t=>E(c(t,`${B}.ts`)),W=t=>Object.hasOwn(u,t),F=t=>I(t)?[D]:[...d,...Object.entries(u).filter(([e])=>E(c(t,`${e}.ts`))).map(([,e])=>e)],N=t=>t.includes(D)?t.filter(e=>!y.has(e)):[...t],U="src/worker.ts",Y=t=>{for(const e of m){const r=c(t,e);if(!E(r))continue;const{parsed:s}=f(r),o=s?.main;if(o===C)return{composed:!0};const a=c(t,U);if(E(a))return{composed:!1,path:a};if(typeof o=="string"&&!T(o)&&E(c(t,o)))return{composed:!1,path:c(t,o)};break}for(const e of x){const r=c(t,e);if(E(r))return{composed:!1,path:r}}return{composed:!1}},M=/(?:^|[\s,{])type$/u,_=(t,e)=>{const r=e.ls>=0?e.ls:e.s;return M.test(t.slice(0,r).trimEnd())},b=(t,e)=>{const r=i(e);return new RegExp(String.raw`\bexport\s+type\s+${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${r}\b`,"u").test(t)},H=t=>{const e=O(t,"utf8");let r;try{const[,s]=S(e);r=new Set(s.filter(o=>!_(e,o)).map(o=>o.n))}catch{r=new Set(R.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`,"u").test(e)&&!b(e,s)))}return N(R.filter(s=>r.has(s))).map(s=>({binding:l[s],className:s}))},K=(t,e,r)=>{if(e.length===0)return[];if(t.composed)return e.map(n=>({...n,exported:!0}));if(t.path===void 0)return e.map(n=>({...n,exported:!1}));const s=O(t.path,"utf8"),o=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${r}(?:\.js)?["']`).test(s);let a;try{const[,n]=S(s);a=new Set(n.filter(p=>!_(s,p)).map(p=>p.n))}catch{a=new Set(e.map(n=>n.className).filter(n=>new RegExp(String.raw`\bexport\b[^\n;]*\b${i(n)}\b`,"u").test(s)&&!b(s,n)))}return e.map(n=>{const p=o||a.has(n.className);return{...n,exported:p}})};export{d as COMPOSED_ENTRY_DURABLE_OBJECTS,U as COMPOSED_WORKER_ENTRY,l as DURABLE_OBJECT_BINDINGS,J as GENERATED_CLASS_MODULES,g as GENERATED_DIRECTORY,u as GENERATED_MODULE_DURABLE_OBJECTS,C as LUNORA_WORKER_VIRTUAL_ID,D as MERGED_DURABLE_OBJECT,B as MERGED_DURABLE_OBJECTS_MODULE,y as MERGED_ROLE_DURABLE_OBJECTS,h as NON_SOURCE_DIRECTORIES,w as SOURCE_DOT_DIRECTORIES,x as WORKER_ENTRY_FALLBACKS,N as collapseMergedDurableObjects,F as composedEntryDurableObjects,K as detectClassExports,H as detectExportedDurableObjects,$ as isFrameworkDurableObject,T as isGeneratedOutput,I as isMergedProject,W as isMergedRoleModule,Y as resolveWorkerEntry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as a}from"./celld-config-D-L6uskI.mjs";import s from"./CLOUDFLARE_DRIVER-CULavrYO.mjs";const p=[["entry","`celld deploy` deploys the config's `main`; a composed framework entry has no celld equivalent yet"],["environment","celld has no Wrangler environments — deploy a separate config per environment"],["outDir","`celld deploy` does not write its bundle to disk"],["preview","celld has no preview versions — a deploy replaces the fleet's current deployment"],["temporary","celld has no short-lived accounts — it deploys to the fleet bucket in CELLD_BUCKET"]],l=e=>{if(e===void 0)throw new Error("the celld driver runs the projected wrangler config — pass `configPath` from `projectConfig`");return e},v={deploy:e=>{const o=p.find(([r])=>e[r]!==void 0&&e[r]!==!1);if(o!==void 0)throw new Error(o[1]);return{args:["deploy",l(e.configPath),...e.dryRun===!0?["--dry-run"]:[]],onPath:!0,tool:"celld"}},devServer:"own",prebuildsContainerImages:!1,dev:e=>{if(e.environment!==void 0)throw new Error("celld has no Wrangler environments — `celld dev` runs the top-level config");return{args:["dev",l(e.configPath),...e.extraArgs??[]],onPath:!0,tool:"celld"}}},f={id:"celld",name:"celld",projectConfig:a,toolchain:v},h={id:"node",name:"Node"},m="cloudflare",t={celld:f,cloudflare:s,node:h},d=()=>Object.keys(t).toSorted((e,o)=>e.localeCompare(o)),c=(e=m)=>{const o=t[e];if(o===void 0)throw new Error(`unknown deploy target "${e}" — available targets: ${d().join(", ")}`);return o},g=e=>Object.hasOwn(t,e)&&c(e).toolchain!==void 0,y=()=>d().filter(e=>g(e)),D=e=>c(e).toolchain?.devServer==="own",O=(e,o,r,i)=>{const n=e.projectConfig?.(o,r);return{command:i(n?.configPath),commit:()=>n?.write(),projection:n===void 0?void 0:{configPath:n.configPath,dropped:n.dropped}}};export{m as DEFAULT_DEPLOY_TARGET,d as deployTargetIds,g as isRunnableTarget,O as planToolchainInvocation,c as resolveDeployDriver,y as runnableTargetIds,D as targetRunsOwnDevServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=Object.freeze({enabled:!0,head_sampling_rate:1}),t=1,n=l=>{const e=l??a;return{logs:{enabled:e.logs?.enabled??e.enabled??a.enabled,headSamplingRate:e.logs?.head_sampling_rate??e.head_sampling_rate??t},traces:{enabled:e.traces?.enabled===!0,headSamplingRate:e.traces?.head_sampling_rate??t}}};export{a as DEFAULT_OBSERVABILITY,n as resolveObservabilitySampling};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{mkdirSync as _,writeFileSync as E,rmSync as N,existsSync as D,readFileSync as a}from"node:fs";import{join as n}from"node:path";const u=".lunora",v=n(u,"dev.json"),h=n(u,"dev.log"),k=n(u,"dev-bindings.json"),T="LUNORA_DEV_DAEMON",U="LUNORA_DEV_LOG_FILE",x="LUNORA_DEV_HANDOFF_PID",m=r=>r!==null&&typeof r=="object",o=(r,e)=>{const t=r[e];return typeof t=="string"&&t.length>0?t:void 0},p=r=>{if(!Number.isInteger(r)||r<=0)return!1;try{return process.kill(r,0),!0}catch{return!1}},y=1e4,g=100,A=r=>{if(process.platform==="linux")try{const e=a(`/proc/${String(r)}/stat`,"utf8"),t=e.slice(e.lastIndexOf(")")+2).split(" "),i=Number(t[19]),s=a("/proc/stat","utf8").split(`
|
|
2
|
+
`).find(l=>l.startsWith("btime ")),d=Number(s?.slice(6));return!Number.isFinite(i)||!Number.isFinite(d)?void 0:d*1e3+i/g*1e3}catch{return}},b=r=>{if(!p(r.pid))return!1;const e=r.startedAt===void 0?Number.NaN:Date.parse(r.startedAt);if(Number.isNaN(e))return!0;const t=A(r.pid);return t===void 0||t<=e+y},f=r=>{const e=n(r,v);if(!D(e))return;let t;try{t=JSON.parse(a(e,"utf8"))}catch{return}if(!m(t)||typeof t.pid!="number")return;const i=o(t,"url");if(i!==void 0)return{background:t.background===!0,logFile:o(t,"logFile"),mode:t.mode==="vite"?"vite":"cli",pid:t.pid,readyAt:o(t,"readyAt"),startedAt:o(t,"startedAt"),studioUrl:o(t,"studioUrl"),tunnelUrl:o(t,"tunnelUrl"),url:i}},c=(r,e)=>{try{_(n(r,u),{recursive:!0});const t=n(r,v);return E(t,`${JSON.stringify(e,void 0,2)}
|
|
3
|
+
`,"utf8"),t}catch{return}},C=(r,e,t)=>{const i=f(r);if(i===void 0||t?.expectedPid!==void 0&&i.pid!==t.expectedPid)return;const s={...i,...e};return c(r,s),s},M=r=>r?.readyAt!==void 0,O=(r,e)=>{try{if(e!==void 0){const t=f(r);if(t!==void 0&&t.pid!==e)return}N(n(r,v),{force:!0})}catch{}},F=r=>{const e=f(r);if(e!==void 0){if(b(e))return e;O(r,e.pid)}},I=(r,e,t)=>{const i=F(r);if(i!==void 0)return t!==void 0&&i.pid===t?{ok:c(r,e)!==void 0}:i.pid!==e.pid?{existing:i,ok:!1}:{ok:c(r,{...e,tunnelUrl:e.tunnelUrl??i.tunnelUrl})!==void 0}},P=(r,e,t)=>{const i=n(r,v),s=`${JSON.stringify(e,void 0,2)}
|
|
4
|
+
`;for(let d=0;d<2;d+=1)try{return _(n(r,u),{recursive:!0}),E(i,s,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(l){if(l.code!=="EEXIST")return{ok:c(r,e)!==void 0};const S=I(r,e,t?.supersedePid);if(S!==void 0)return S}return{ok:c(r,e)!==void 0}};export{k as DEV_BINDINGS_FILE,T as DEV_DAEMON_ENV,x as DEV_HANDOFF_ENV,h as DEV_LOG_FILE,U as DEV_LOG_FILE_ENV,u as DEV_STATE_DIR,v as DEV_STATE_FILE,P as claimDevServerState,O as clearDevServerState,M as isDevServerReady,p as isProcessAlive,b as isRecordedProcessCurrent,f as readDevServerState,F as readLiveDevServerState,C as updateDevServerState,c as writeDevServerState};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{parse as p}from"dotenv";const A=".dev.vars",D=".dev.vars.example",$=/^[A-Za-z_]\w*$/u,d=/\r?\n/u,u=e=>Object.entries(p(e)).map(([t,n])=>({key:t,value:n})),V=e=>u(e)[0],L=e=>e.replaceAll(/[.*+?^${}()|[\]\\]/gu,String.raw`\$&`),_=/(\r?\n)/u,E=(e,t,n)=>{const r=e.split(_),s=[];let a=!1;for(let i=0;i<r.length;i+=2){const o=r[i]??"",c=r[i+1]??"";if(V(o)?.key!==t){s.push(o,c);continue}const l=!a;a=!0,n!==void 0&&l&&s.push(n,c)}return{content:s.join(""),matched:a}},m=(e,t,n)=>{const r=`${t}="${n}"`,s=E(e,t,r);return s.matched?s.content:e===""?`${r}
|
|
2
|
+
`:e.endsWith(`
|
|
3
|
+
`)?`${e}${r}
|
|
4
|
+
`:`${e}
|
|
5
|
+
${r}
|
|
6
|
+
`},R=(e,t)=>E(e,t,void 0).content;export{D as DEV_VARS_EXAMPLE_FILE,A as DEV_VARS_FILE,$ as DEV_VARS_KEY_PATTERN,d as DEV_VARS_NEWLINE,L as escapeRegExp,u as parseDevVariableEntries,V as parseDevVariableLine,R as removeDevVariableLine,m as upsertDevVariableLine};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as l}from"node:fs";import{findWranglerFile as m,readWranglerJsonc as E}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{DEV_VARS_FILE as i,parseDevVariableEntries as V,upsertDevVariableLine as c}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{writeDevVariablesFileAtomically as p}from"./buildPackageSecretsBlock-BWV_VxqV.mjs";import{join as v}from"node:path";const n="WORKER_ENV",a="development",d=e=>{const r=m(e);return r===void 0?{}:E(r).parsed?.vars??{}},W=(e,r)=>{const o=v(e,i);let t;try{t=l(o,"utf8")}catch{return}V(t).some(s=>s.key===n)||n in d(e)||(p(o,c(t,n,a)),r(`set ${n}=${a} in ${i} so the dev worker runs in development mode`))};export{a as DEV_WORKER_ENV_VALUE,n as DEV_WORKER_ENV_VAR,W as ensureDevWorkerEnv};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _="global_fetch_strictly_public";export{_ as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{existsSync as u,readFileSync as f,mkdirSync as k,writeFileSync as m}from"node:fs";import{parse as p}from"jsonc-parser";import{join as i}from"node:path";const l=".lunora",d=i(l,"project.json"),v=r=>r!==null&&typeof r=="object",c=(r,o)=>{const e=r[o];return typeof e=="string"&&e.length>0?e:void 0},j=r=>{const o=i(r,d);if(!u(o))return;let e;try{e=f(o,"utf8")}catch{return}const n=[],t=p(e,n,{allowTrailingComma:!0});if(!(n.length>0||!v(t)))return{account:c(t,"account"),env:c(t,"env"),linkedAt:c(t,"linkedAt"),workerName:c(t,"workerName"),workerUrl:c(t,"workerUrl")}},E=(r,o)=>{const e=i(r,l);k(e,{recursive:!0});const n={};for(const a of["account","env","linkedAt","workerName","workerUrl"]){const s=o[a];s!==void 0&&s!==""&&(n[a]=s)}const t=i(r,d);return m(t,`${JSON.stringify(n,void 0,2)}
|
|
2
|
+
`,"utf8"),t};export{l as LINKED_PROJECT_DIR,d as LINKED_PROJECT_FILE,j as readLinkedProject,E as writeLinkedProject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const u=r=>{if(typeof r=="string")return r;if(r instanceof Error)return String(r);try{return JSON.stringify(r)??String(r)}catch{return String(r)}},d=r=>typeof r!="object"||r===null||Array.isArray(r)?"":Object.entries(r).map(([t,n])=>`${t}=${u(n)}`).join(" "),p="lunora",g="__root__",e=r=>typeof r=="string"?r:"",a=r=>Array.isArray(r)?r.filter(t=>typeof t=="string"):[],h=r=>typeof r=="number"&&Number.isFinite(r)?`${String(Math.round(r))}ms`:"?ms",l=r=>r==="error"||r==="fatal"?"error":r==="warn"?"warn":"info",m=r=>{const t=r.trim();if(!t.startsWith("{")||!t.endsWith("}"))return;let n;try{n=JSON.parse(t)}catch{return}if(typeof n!="object"||n===null)return;const o=n;return o.source===p?o:void 0},f=(r,t)=>{const n=e(t.shard);return n===""||n===g?r:`${r}@${n}`},y=(r,t)=>{const n=r.outcome==="error",o=[f(t,r),n?"error":"ok",h(r.durationMs)],i=a(r.tablesRead),s=a(r.tablesWritten);i.length>0&&o.push(`read[${i.join(",")}]`),s.length>0&&o.push(`write[${s.join(",")}]`),r.cacheHit===!0&&o.push("cached");const c=e(r.error);return n&&c!==""&&o.push(c),{kind:"rpc",level:n?"error":"info",text:o.join(" ")}},$=r=>{const t=e(r.container)||"<unknown>",n=e(r.instance),o=e(r.event)||"event",i=n===""||n==="unknown"?"":`#${n.slice(0,8)}`,s=e(r.message),c=[`container:${t}${i}`,o];return s!==""&&c.push(s),{kind:"log",level:r.event==="error"?"error":"info",text:c.join(" ")}},S=r=>{const t=m(r);if(!t)return;const n=e(t.function)||"<unknown>";if(t.type==="log"){const o=[`${f(n,t)} ${e(t.message)}`.trimEnd()],i=d(t.fields);i!==""&&o.push(i);const s=e(t.traceId);return s!==""&&o.push(`trace=${s.slice(0,8)}`),{kind:"log",level:l(e(t.level)),text:o.join(" ")}}if(t.type==="request")return y(t,n);if(t.type==="container")return $(t)};export{p as LUNORA_EVENT_SOURCE,S as formatLunoraEvent};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{existsSync as g,readFileSync as h,writeFileSync as d}from"node:fs";import{join as p,dirname as x}from"node:path";import{parse as v}from"jsonc-parser";import{applyModify as $}from"./applyModify-DKP2l6S9.mjs";import{readProjectDependencyNames as S,readProjectManifest as w}from"./readProjectDependencies-l3uhUKjo.mjs";const c=["lunora/_generated/","lunora/.lunora-schema.json","lunora.advisor.map.json",".lunora/",".wrangler/"],f={biome:{configFiles:["biome.json","biome.jsonc"],packages:["@biomejs/biome"],shadowable:!0},eslint:{configFiles:["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],packages:["eslint"],shadowable:!0},oxlint:{configFiles:[".oxlintrc.json"],packages:["oxlint"],shadowable:!0},prettier:{configFiles:[".prettierrc",".prettierrc.json",".prettierrc.js",".prettierrc.mjs",".prettierrc.cjs","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],packages:["prettier"],shadowable:!1}},L=Object.keys(f),y=(e,n)=>f[n].configFiles.map(t=>p(e,t)).find(t=>g(t)),k=(e,n)=>{let t=e;for(;;){const i=y(t,n);if(i!==void 0)return i;if(g(p(t,".git")))return;const s=x(t);if(s===t)return;t=s}},j=(e,n)=>{const t=y(e,n);if(t!==void 0)return{action:"extend",path:t};const i=g(p(e,".git")),s=f[n].shadowable&&!i?k(x(e),n):void 0,[a=""]=f[n].configFiles;return s===void 0?{action:"create",path:p(e,a)}:{action:"report",path:s}},U=e=>{const n=S(e),t=()=>w(e)?.prettier!==void 0;return L.filter(i=>f[i].packages.some(s=>n.has(s))||y(e,i)!==void 0||i==="prettier"&&t())},O="# Lunora generated + derived artifacts",I=e=>{const n=p(e,".prettierignore"),t=g(n)?h(n,"utf8"):void 0,i=t===void 0?[]:t.split(`
|
|
2
|
+
`).map(o=>o.trim()),s=c.filter(o=>!i.includes(o));if(s.length===0)return{path:n,status:t===void 0?"created":"unchanged",tool:"prettier"};const a=`${O}
|
|
3
|
+
${s.join(`
|
|
4
|
+
`)}
|
|
5
|
+
`;return t===void 0?(d(n,a,"utf8"),{path:n,status:"created",tool:"prettier"}):(d(n,`${t.endsWith(`
|
|
6
|
+
`)?t:`${t}
|
|
7
|
+
`}
|
|
8
|
+
${a}`,"utf8"),{path:n,status:"updated",tool:"prettier"})},A=(e,n,t,i)=>{const s=g(e),a=s?h(e,"utf8"):`{}
|
|
9
|
+
`;let r=v(a)??{};for(const l of n)r=r!==null&&typeof r=="object"?r[l]:void 0;const m=Array.isArray(r)?r:[],b=t.filter(l=>!m.includes(l));return b.length===0&&s?{path:e,status:"unchanged",tool:i}:(d(e,$(a,n,[...m,...b]),"utf8"),{path:e,status:s?"updated":"created",tool:i})},F=(e,n)=>`"${e}": [${n.map(t=>`"${t}"`).join(", ")}]`,P=()=>F("files.includes",c.map(e=>`!${e.endsWith("/")?`${e}**`:e}`)),E=e=>{const{action:n,path:t}=j(e,"oxlint");return n==="report"?{path:t,snippet:F("ignorePatterns",c),status:"manual",tool:"oxlint"}:A(t,["ignorePatterns"],c,"oxlint")},T=e=>{const{action:n,path:t}=j(e,"biome");if(n==="report")return{path:t,snippet:P(),status:"manual",tool:"biome"};const i=n==="extend",s=i?h(t,"utf8"):`{}
|
|
10
|
+
`,o=(v(s)??{}).files??{};if(Array.isArray(o.ignore))return A(t,["files","ignore"],c,"biome");const r=Array.isArray(o.includes)?o.includes:[],m=r.length===0?["**"]:r,l=c.map(u=>`!${u.endsWith("/")?`${u}**`:u}`).filter(u=>!r.includes(u));return l.length===0&&i?{path:t,status:"unchanged",tool:"biome"}:(d(t,$(s,["files","includes"],[...m,...l]),"utf8"),{path:t,status:i?"updated":"created",tool:"biome"})},W=()=>`{
|
|
11
|
+
// Lunora generated + derived artifacts.
|
|
12
|
+
ignores: [${c.map(e=>`"${e.endsWith("/")?`${e}**`:e}"`).join(", ")}],
|
|
13
|
+
}`,_=e=>{const{action:n,path:t}=j(e,"eslint"),i=W();if(n!=="create"){const a=h(t,"utf8"),o=c.every(r=>a.includes(r))?"unchanged":"manual";return{path:t,...o==="manual"?{snippet:i}:{},status:o,tool:"eslint"}}const s=p(e,"eslint.config.mjs");return d(s,`// Flat config. Add your own entries alongside the ignores below.
|
|
14
|
+
export default [
|
|
15
|
+
${i.replaceAll(`
|
|
16
|
+
`,`
|
|
17
|
+
`)},
|
|
18
|
+
];
|
|
19
|
+
`,"utf8"),{path:s,status:"created",tool:"eslint"}},C={biome:T,eslint:_,oxlint:E,prettier:I},G=(e,n)=>n.map(t=>{try{return C[t](e)}catch(i){return{message:i instanceof Error?i.message:String(i),path:e,status:"failed",tool:t}}});export{c as LUNORA_IGNORED_PATHS,G as applyLintIgnores,U as detectLintTools};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{describeErrorLevelFindings as c,sortedUniqueNames as d}from"@lunora/codegen";import{paintBadge as t,BADGES as r}from"./ACCENT-CotPTfv7.mjs";const a=t(r.lunora),v=n=>`${a} ${n}`,m={ERROR:r.error,INFO:r.info,WARN:r.warn},s=(n,i,e,o)=>`${t(m[n])} ${i}: ${e} — ${o}`,g=(n,i)=>{for(const e of n.advisories){const o=s(e.level,e.name,e.detail,e.remediation);e.level==="ERROR"?i.error(o):i.warn(o)}for(const e of n.platformDiagnostics){const o=s(e.level==="error"?"ERROR":"WARN",e.name,e.message,e.remediation);e.level==="error"?i.error(o):i.warn(o)}},$=n=>{const{advisoryNames:i,platformDiagnosticNames:e}=c(n),o=d([...i,...e]);if(o.length===0)return;const l=o.length===1?"advisory/platform diagnostic":"advisories/platform diagnostics";return`${a} ${String(o.length)} ERROR-level ${l} (${o.join(", ")}) — see the log above for detail.`};export{a as LUNORA_TAG,s as advisoryLine,$ as blockingFindingsMessage,v as lunoraLine,g as reportCodegenFindings};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{paintBadge as d,badgeWidth as g,BADGES as s}from"./ACCENT-CotPTfv7.mjs";const p={informational:"info",warning:"warn"},f=new Set(["alert","critical","emergency","error","warn","warning"]),l=t=>{if(t in s)return s[t];const e=p[t];return e===void 0?void 0:s[e]},m=t=>{if(t instanceof Error)return`
|
|
2
|
+
${t.stack??t.message}`;if(typeof t=="object"&&t!==null)try{return` ${JSON.stringify(t)}`}catch{return" [unserializable]"}return` ${String(t)}`},S=t=>{const e=typeof t.message=="string"?t.message:String(t.message),r=t.context??[];return r.length===0?e:e+r.map(n=>m(n)).join("")};class i{#t=process.stdout;#e=process.stderr;setStdout(e){this.#t=e}setStderr(e){this.#e=e}log(e){const r=e,n=l(r.type.name);(f.has(r.type.level??r.type.name)?this.#e:this.#t).write(i.#r(n,S(r)))}static#r(e,r){if(e===void 0)return`${r}
|
|
3
|
+
`;const[n="",...o]=r.split(`
|
|
4
|
+
`),c=" ".repeat(g()+1);return`${[`${d(e)} ${n}`,...o.map(a=>`${c}${a}`)].join(`
|
|
5
|
+
`)}
|
|
6
|
+
`}}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as S,M as a,P as C,s as R}from"./package-secrets-registry-BeheNwsP.mjs";export{S as CORE_SECRETS,a as MINTABLE_SECRET_KEYS,C as PACKAGE_SECRETS_REGISTRY,R as secretsForPackages};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as v,resolveServerModule as l,wireRlsIntoProcedure as b}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as h}from"./write-atomic-CK6VZaPI.mjs";const D="/__lunora/policy-scaffold",u=e=>e==="unknown-procedure"?404:e==="already-wired"||e==="destructive"?409:422,f=(e,o)=>{let r;try{r=h(e)}catch(t){return{body:{error:t instanceof Error?t.message:String(t),ok:!1},status:500}}return{body:{...o,diagnostics:r,ok:!0},status:200}},g=e=>({body:{edit:e,message:"Rewriting an existing policy predicate changes evaluation semantics and must be done by hand. The scaffolder only adds new, deny-by-default rules.",needsManualEdit:!0,ok:!1},status:409}),w=(e,o)=>{const r=v(o,l(e.projectRoot));if(!r.ok)return{body:{error:r.reason,ok:!1},status:u(r.reason)};const t=e.schemaDirectory??"lunora",n=s(e.projectRoot,t,r.fileName);return d(n)?{body:{error:"file-exists",fileName:r.fileName,ok:!1},status:409}:(c(n,r.source),f(e,{fileName:r.fileName}))},R=(e,o,r)=>{if(typeof r!="string"||r.length===0||a(r)||r.includes("\\"))return;const t=s(e,o),n=s(t,`${r}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(e,o)=>{const r=R(e.projectRoot,e.schemaDirectory??"lunora",o.filePath);if(r===void 0||!d(r))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=b(y(r,"utf8"),o,l(e.projectRoot));return t.ok?(c(r,t.text),f(e,{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=e=>{if(e.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=e;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const r=o;if(k(r)==="destructive")return g(r);if(r.kind==="scaffoldPolicy")return w(e,r);if(r.kind==="wireRls")return N(e,r);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(r.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{applyModify as m}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as y}from"./hasCloudflareCredentials-byvHpEiD.mjs";import{withheldWorkersAi as E,writeDevConfig as R,noopCleanup as S}from"./describeWithheldWorkersAi-IIxe3TuI.mjs";import{r as j}from"./lunora-manifest-DuH_Cmyu.mjs";import{o as w}from"./reconcile-services-DFqH4eMQ.mjs";import{findWranglerFile as _,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";const h={ai:{label:"AI",shape:"object"},ai_search:{label:"AI Search",shape:"array"},ai_search_namespaces:{label:"AI Search namespace",shape:"array"},analytics:{label:"Analytics SQL",shape:"object"},d1_databases:{label:"D1",shape:"array"},kv_namespaces:{label:"KV",shape:"array"},queues:{label:"Queue",shape:"producers"},r2_buckets:{label:"R2",shape:"array"},services:{label:"Service",shape:"array"},vectorize:{label:"Vectorize",shape:"array"}},I=Object.keys(h),b=(e,r)=>typeof e.binding=="string"?e.binding:r,f=(e,r,t,n)=>{const i=[];for(const[s,a]of r.entries())a!=null&&i.push({binding:b(a,`#${String(s)}`),kind:t,path:[...n,s],section:e});return i},g=(e,r)=>h[e].shape===r,A=(e,r)=>{const{label:t}=h[e];if(g(e,"array"))return f(e,r[e]??[],t,[]);if(g(e,"object")){const n=r[e];return n==null?[]:[{binding:b(n,e),kind:t,path:[],section:e}]}return f(e,r.queues?.producers??[],t,["producers"])},B=e=>I.flatMap(r=>A(r,e)),L=(e,r)=>{let t=e;for(const n of r)t=m(t,[n.section,...n.path,"remote"],!0);return t},D=e=>{const r=o=>({cleanup:S,reason:o,remoteBindings:[],withheld:[]}),t=_(e.projectRoot);if(!t)return r("wrangler.jsonc not found");const{parsed:n,text:i}=C(t);if(n===void 0)return r(`failed to parse ${t} as JSONC`);const s=w(j(e.projectRoot)),a=e.remote?B(n).filter(o=>o.section!=="services"||!s.has(o.binding)):[],c=E(n.ai,e.hasCredentials??(()=>y({projectRoot:e.projectRoot}))),d=c===void 0?[]:[c],l=c===void 0?a:a.filter(o=>o.section!=="ai");if(l.length===0&&d.length===0)return r(e.remote?"no remote-eligible bindings to proxy":void 0);const p=d.length>0?m(i,["ai"],void 0):i,v=l.length>0?L(p,l):p,u=R(e.projectRoot,"dev",v);return{cleanup:u.cleanup,configPath:u.configPath,remoteBindings:l,withheld:d}},k=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},K=e=>e.flag===!0||k(e.envValue)?!0:e.configPreference??!1;export{h as REMOTE_ELIGIBLE_KEYS,L as injectRemoteFlags,k as isRemoteEnvEnabled,D as materializeDevWranglerConfig,B as planRemoteBindings,K as resolveRemoteEnabled};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MERGED_DURABLE_OBJECT as _}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as E,v as h,a as p,b as D,c as O,d as R,e as l,g as y,h as I,H as S,i as $,R as j,S as A,j as k,k as L,W as w,l as B}from"./validate-bindings-CvNBF3U4.mjs";import{validateTailConsumers as T,validateSendEmail as C,validateSecretsRequired as N,validateLogpush as U,validateLimits as G,validatePlacement as P,validateObservability as K,validateAssets as V,validateCache as W,validateExports as M,validateCorsVariables as x,validateSchedulerOrigin as F}from"./withTailConsumer-DngzpJMK.mjs";import{isCacheEnabled as H,WORKERS_CACHE_MIN_DATE as b}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as Y}from"./mergeWranglerEnvironment-DXiB-HcS.mjs";const q=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),g=i=>Array.isArray(i)?i.flatMap((a,n)=>q(a)?[[n,a]]:[]):[],m=i=>typeof i.binding=="string"?i.binding:"",J=(i,a,n)=>{for(const[e,s]of g(i.kv_namespaces))typeof s.id=="string"&&s.id!==""||n.push(`kv_namespaces[${String(e)}] ("${m(s)}") is not created yet and the schema pins data to "${a}" — create it with \`wrangler kv namespace create <name> --jurisdiction=${a}\`; a namespace's jurisdiction cannot be changed afterwards`)},Q=(i,a,n)=>{for(const[e,s]of g(i.r2_buckets)){const o=s.jurisdiction;if(o===a)continue;const t=typeof o=="string"?`names the "${o}" jurisdiction`:"names no jurisdiction";n.push(`r2_buckets[${String(e)}] ("${m(s)}") ${t}, but the schema pins data to "${a}" — create the bucket with \`wrangler r2 bucket create <name> --jurisdiction=${a}\` and set "jurisdiction": "${a}" on the binding`)}},z=(i,a,n)=>{const e=a?.jurisdiction;e!==void 0&&(J(i,e,n),Q(i,e,n))},v="2026-04-07",le="web_socket_auto_reply_to_close",u="2026-10-01",f="durable_object_io_tasks_prevent_eviction",X="durable_object_io_tasks_do_not_prevent_eviction",Z=/^\d{4}-\d{2}-\d{2}$/,ee=(i,a,n)=>{i>=u||a.includes(f)||a.includes(X)||n.push(`compatibility_date "${i}" predates "${u}", so pending I/O (waitUntil, cross-Durable-Object RPC, service-binding calls, timers) does not keep a Durable Object alive once its last client disconnects — live-query refreshes and durable streams can be cut off mid-flight. Set compatibility_date >= "${u}" or add the "${f}" compatibility flag`)},te=(i,a,n)=>{const{error:e,merged:s,unverifiedKeys:o}=Y(i,a);return e!==void 0?{error:e,wrangler:s}:(o.length>0&&n.push(`env.${String(a)} overrides ${o.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${o.length===1?"it":"them"} by hand for "${String(a)}".`),{wrangler:s})},ie=(i,a,n)=>{const e=[],s=[];if(!i||typeof i!="object")return e.push("wrangler config is not a valid object"),{errors:e,valid:!1,warnings:s};const{error:o,wrangler:t}=te(i,n,s);if(o!==void 0)return e.push(o),{errors:e,valid:!1,warnings:s};E(t.durable_objects?.bindings).find(r=>r.name==="SHARD"&&(r.class_name==="ShardDO"||r.class_name===_))||e.push(`durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } (or "${_}" when the app merges its Durable Objects) — your dev server auto-reconciles this on startup, or add the binding manually`),h(t,e);const d=t.compatibility_date??"",c=Z.test(d);d&&!c?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${d}")`):d<v&&e.push(`compatibility_date must be >= "${v}" (got "${d||"<missing>"}")`),H(t)&&c&&d<b&&e.push(`cache.enabled requires compatibility_date >= "${b}" (got "${d||"<missing>"}")`),c&&ee(d,t.compatibility_flags??[],s),p(t,a,e),z(t,a,s),D(t,e),O(t,a?.vectorIndexNames??[],e),T(t,e),R(t,e,s),l(t.workflows,"workflows",w,e),y(t,e),I(t,e),l(t.secrets_store_secrets,"secrets_store_secrets",B,e);for(const r of S)$(t,r,e,s);for(const r of j)l(t[r.key],r.key,r,e);for(const r of A)k(t,r,e);return L(t,e),C(t,e,s),N(t,e),U(t,e),G(t,e),P(t,e),K(t,e,s),V(t,e),W(t,e),M(t,e),x(t,e),F(t,n,s),{errors:e,valid:e.length===0,warnings:s}},ue=ie;export{v as REQUIRED_COMPATIBILITY_DATE,le as REQUIRED_FLAG,ue as validateWrangler,ie as validateWranglerConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-CK6VZaPI.mjs";import{join as m}from"node:path";const F="/__lunora/schema-edit",b=t=>t==="destructive"||t==="duplicate-table"||t==="duplicate-column"||t==="duplicate-index"?409:t==="unknown-table"?404:t==="invalid-identifier"||t==="invalid-validator"?400:422,y=t=>({body:{error:t.reason,ok:!1},status:422}),h=t=>{if(!a(t))return{response:{body:{error:"no-schema-file",ok:!1},status:404}};const r=u(d(t,"utf8"));return r.ok?{tables:r.tables}:{response:y(r)}},k=t=>({body:{edit:t,message:"This edit changes stored data and must go through a migration. Review the migration before applying.",needsMigration:!0,ok:!1},status:409}),g=(t,r)=>{const e=t.body;if(e==null||typeof e!="object"||typeof e.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};if(l(e)==="destructive")return k(e);if(!a(r))return{body:{error:"no-schema-file",ok:!1},status:404};const o=c(d(r,"utf8"),e);if(!o.ok)return{body:{error:o.reason,ok:!1},status:b(o.reason)};f(r,o.text);let i;try{i=p(t)}catch(s){return{body:{error:s instanceof Error?s.message:String(s),ok:!1},status:500}}const n=u(o.text);return{body:{diagnostics:i,ok:!0,tables:n.ok?n.tables:[]},status:200}},R=t=>{const r=m(t.projectRoot,t.schemaDirectory??"lunora","schema.ts");if(t.method==="GET"){const e=h(r);return"response"in e?e.response:{body:{ok:!0,tables:e.tables},status:200}}return t.method==="POST"?g(t,r):{body:{error:"method-not-allowed",ok:!1},status:405}};export{F as SCHEMA_EDIT_ENDPOINT,R as handleSchemaEditRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as y}from"node:fs";import{discoverSchema as p,schemaFromIr as h}from"@lunora/codegen";import{seedPlan as k}from"@lunora/seed";import{Project as S}from"ts-morph";import{join as g}from"node:path";const P="/__lunora/seed",w=1e3,j=(o,t)=>typeof t=="bigint"?Number(t):t instanceof ArrayBuffer?[...new Uint8Array(t)]:t,N=o=>typeof o!="number"||!Number.isFinite(o)?10:Math.min(Math.max(1,Math.floor(o)),w),A=o=>{if(o.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:t}=o;if(t==null||typeof t!="object")return{body:{error:"invalid-request",ok:!1},status:400};const{count:f,existingIds:c,seed:m,table:e}=t;if(typeof e!="string"||e.length===0)return{body:{error:"missing-table",ok:!1},status:400};const l=o.schemaDirectory??"lunora",s=g(o.projectRoot,l,"schema.ts");if(!y(s))return{body:{error:"schema-not-found",ok:!1},status:404};const d=new S({skipAddingFilesFromTsConfig:!0}),n=p(d,s);if(!n.tables.some(r=>r.name===e))return{body:{error:"unknown-table",ok:!1,table:e},status:404};const u=h(n),a=k(u,{existingIds:c??{},defaultCount:N(f),only:[e],seed:m??0}),i=a.filter(r=>r.table!==e).map(r=>r.table);if(i.length>0)return{body:{error:"fk-parents-empty",ok:!1,tables:i},status:409};const b=a.find(r=>r.table===e)?.rows??[];return{body:{ok:!0,rows:JSON.parse(JSON.stringify(b,j))},status:200}};export{P as SEED_ENDPOINT,A as handleSeedRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveAdminToken as A}from"./parseDevVariable-teAAahVD.mjs";import{sendStudioDocument as I,applyStudioAssetCache as O}from"./applyStudioAssetCache-DHQEJuuv.mjs";import{isStandaloneModulePath as _,studioAssetsStamp as H,loadStudioAssets as N,readStandaloneAsset as C,assetContentType as D}from"./assetContentType-CUb5bpbI.mjs";import{detectAgentRules as E}from"./AGENT_RULES_DIR-HrrbNZPy.mjs";import{handlePolicyScaffoldRequest as v,POLICY_SCAFFOLD_ENDPOINT as L}from"./POLICY_SCAFFOLD_ENDPOINT-BmJYwAy2.mjs";import R from"./renderStudioHtml-ByowDtMl.mjs";import{handleSchemaEditRequest as b,SCHEMA_EDIT_ENDPOINT as x}from"./SCHEMA_EDIT_ENDPOINT-BeTxqCuQ.mjs";import{handleSeedRequest as k,SEED_ENDPOINT as $}from"./SEED_ENDPOINT-2B56PN_H.mjs";import{serveJsonHandler as g}from"./serveJsonHandler-Dv0EdCb9.mjs";import{transportRejectionReason as j}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";const d="/__lunora",M=`${d}/studio.js`,m=`${d}/styles.css`,p=/\/$/,U={[L]:v,[x]:b,[$]:k},q=new Set(["127.0.0.1","::1","localhost"]),X=t=>t!==void 0&&t!==!1&&!q.has(t),y=t=>t===void 0||t==="/"?"":t.replace(p,""),Z=t=>`${y(t)}${d}`,T=(t,n,c)=>{t.statusCode=200,t.setHeader("Content-Type",c),t.end(n)},w=t=>{try{return new URL(t,"http://localhost").pathname}catch{const n=t.indexOf("?");return n===-1?t:t.slice(0,n)}},tt=t=>{const{logger:n,projectRoot:c}=t,u=y(t.base);let l,f,S;const P=(o,s,e)=>{const i=H();if((l===void 0||i!==f)&&(l=N(n),f=i),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=o===m,r=o.slice(o.lastIndexOf("/")+1);if(O(s,e,r,i))return;if(a){T(e,l.styles,"text/css; charset=utf-8");return}const h=C(r);if(h===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}T(e,h,D(r))};return(o,s,e)=>{const i=w(o.url??"").replace(p,""),a=u!==""&&i.startsWith(u)?i.slice(u.length):i;if(a!==d&&!a.startsWith(`${d}/`)){e();return}if(t.isNonLoopbackBind||j(o,n)!==void 0){s.statusCode=403,s.setHeader("Content-Type","text/plain"),s.end("Lunora studio is only available on loopback hosts in dev.");return}const r=U[a];if(r!==void 0){g(o,s,r,c,{apiSpec:t.apiSpec,schemaDirectory:t.schemaDirectory});return}if(a===m||_(a)){P(a,o,s);return}S??=R({adminToken:A(c),basePath:d,dataEditable:!0,rulesInstalled:E(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m}),I(s,S)}};export{d as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,tt as createStudioMiddleware,X as isNonLoopbackHost,w as requestPathname,Z as studioMountPath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as h}from"node:fs";import{dirname as y,join as p}from"node:path";import{discoverSchemaInfo as E}from"./discoverSchemaInfo-BBRlXZop.mjs";import{MERGED_DURABLE_OBJECT as i,GENERATED_DIRECTORY as w,MERGED_ROLE_DURABLE_OBJECTS as u,COMPOSED_ENTRY_DURABLE_OBJECTS as $,GENERATED_CLASS_MODULES as k,isFrameworkDurableObject as D}from"./COMPOSED_WORKER_ENTRY-Ciiba5g_.mjs";import{o as R,f as j}from"./validate-bindings-CvNBF3U4.mjs";import{validateSchedulerOrigin as x}from"./withTailConsumer-DngzpJMK.mjs";import{l as O,r as _,s as A}from"./worker-entry-checks-AIASCYl7.mjs";import{mergeWranglerEnvironment as S}from"./mergeWranglerEnvironment-DXiB-HcS.mjs";import{findWranglerFile as W,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as T}from"./REQUIRED_COMPATIBILITY_DATE-OLQlG0oj.mjs";const v=r=>Array.isArray(r)?r:[],L=(r,o,t)=>Object.entries(r?.images??{}).flatMap(([s,n])=>{const e=n?.dockerfile;return typeof e!="string"||h(e.startsWith("/")?e:p(o,e))?[]:[`containers images["${s}"] dockerfile "${e}" does not exist (resolved relative to ${t}); create the Dockerfile`]}),I=(r,o,t)=>{const s=[];for(const n of v(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!h(e.startsWith("/")?e:p(o,e))&&s.push(`containers image "${e}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`),s.push(...L(n,o,t))}return s},P=(r,o)=>{const t=r?.vectorIndexNames??[],s=[];if(t.length>0&&s.push({message:e=>`schema declares vector index(es) ${t.map(l=>`"${l}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${e}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(t[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&s.push({message:e=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of a global table throws INTERNAL ("requires a globalDb writer"). Add \`.global({ d1: (env) => env.DB })\` to the chain.`,method:"global"}),r?.hasHyperdriveGlobalTable&&s.push({message:e=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of those tables throws INTERNAL. Add \`.hyperdriveGlobal({ engine: "postgres", exec: (env) => buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))) })\` to the chain (\`buildPgExec\` from \`@lunora/hyperdrive/global\`, \`fromPostgresJs\` from \`@lunora/hyperdrive\`).`,method:"hyperdriveGlobal"}),s.length===0)return[];const n=A(o,new Set(s.map(e=>e.method)));return n===void 0?[]:s.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},G="does not export it",B=(r,o)=>{if(o.exports?.has(i)===!0&&u.has(r))return`This app merges its Durable Objects (\`durableObjects.merge\` in lunora.config), so ${i} hosts ${r}: bind only \`SHARD\` to "${i}" and drop the SCHEDULER / SHARD_REGISTRY bindings. Do that only if this Worker has never been deployed — a deployed ${r} namespace keeps its data, which the merged class cannot reach; turn \`durableObjects.merge\` off to keep it.`;if(r===i)return`${i} is the merged class (\`durableObjects.merge\` in lunora.config), and merging cannot be undone once deployed: the shard data lives in ${i}. Turn \`durableObjects.merge\` back on. Only a Worker that has never been deployed may rebind SHARD to "ShardDO".`;if(o.kind!=="composed")return`Re-export it from the module that defines it (\`export { ${r} } from "./…";\`), or add it to the app builder's own export (\`export const { ${r} } = app;\`).`;const t=`it exports ${$.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${k.map(s=>`${s}.ts`).join(" / ")} declarations`;return D(r)?`\`@lunora/vite\` generates that entry — ${t}, and ${r} is not among them. Class-A composition does not carry ${r}, so drop the binding; a project that needs it has to own its worker entry (add \`src/worker.ts\`, which \`lunora deploy\` bundles in place of \`main\`, and compose \`defineApp()\` there).`:`\`@lunora/vite\` generates that entry, so there is no file to add a re-export to: ${t}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},M=(r,o)=>{const t=o.exports;if(t===void 0)return[];const s=[];for(const e of R(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of v(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"workflows"});for(const[e,l]of Object.entries(r.exports??{}))l?.type==="workflow"&&s.push({className:e,label:"workflows"});return s.filter(e=>!t.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${o.kind==="composed"?"composed class-A worker entry":"worker entry"} (${o.path}) ${G} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${B(e.className,o)}`)},N=r=>[...j(r.migrations)].filter(o=>u.has(o)).map(o=>`migrations create class "${o}", which this app hosts in ${i} because it merges its Durable Objects (\`durableObjects.merge\`). Before the first deploy, replace "${o}" with "${i}" in new_sqlite_classes; a Worker already deployed with "${o}" keeps its data there and cannot merge — turn \`durableObjects.merge\` off.`),U=r=>r?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${r.path}) — wrangler cannot resolve the worker entry, so a deploy will fail there. Point main at the entry that composes your app, or remove it to fall back to the conventional locations.`],Z=r=>{const o=r.schemaDir??"lunora",t=W(r.projectRoot);if(!t){const c=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:s}=C(t);if(s===void 0){const c=`failed to parse ${t} as JSONC.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:e}=S(s,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:l,info:f}=E(r.projectRoot,o),a=T(s,f,r.environment);l!==void 0&&a.warnings.push(`schema parse failed in ${o}/schema.ts: ${l}`);const g=y(t),b=O(e.main,r.projectRoot,t),m=_(b,r.projectRoot,o);a.errors.push(...I(e.containers??[],g,t)),a.warnings.push(...U(b)),m!==void 0&&a.errors.push(...M(e,m)),m?.exports?.has(i)===!0&&(a.errors.push(...N(e)),h(p(r.projectRoot,o,w,"scheduler.ts"))&&x(e,r.environment,a.warnings,"the merged LunoraDO hosts the scheduler")),a.errors.push(...P(f,r.projectRoot));const d=e.assets?.directory;if(typeof d=="string"&&d.length>0){const c=d.startsWith("/")?d:p(g,d);h(c)||a.warnings.push(`assets.directory "${d}" does not exist yet — it is created by the client build; run the build before deploy`)}return a.valid=a.errors.length===0,{problems:a.errors,report:a,wranglerPath:t}};export{G as UNEXPORTED_CLASS_MARKER,Z as validateWranglerProject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l="2026-05-01",n=e=>{if(!e)return!1;const c=typeof e.cache=="object"&&e.cache!==null&&e.cache.enabled===!0,o=typeof e.exports=="object"&&e.exports!==null&&Object.values(e.exports).some(t=>typeof t=="object"&&t!==null&&t.cache?.enabled===!0);return c||o};export{l as WORKERS_CACHE_MIN_DATE,n as isCacheEnabled};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as e,readFileSync as s}from"node:fs";import{parse as a}from"jsonc-parser";import{join as i}from"node:path";const l=["wrangler.jsonc","wrangler.json"],p=n=>{for(const r of l){const o=i(n,r);if(e(o))return o}},u=n=>{const r=s(n,"utf8"),o=[],t=a(r,o,{allowTrailingComma:!0});return o.length>0||t===null||typeof t!="object"?{parsed:void 0,text:r}:{parsed:t,text:r}};export{l as WRANGLER_FILES,p as findWranglerFile,u as readWranglerJsonc};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{spawn as f}from"node:child_process";import{connect as h}from"node:net";const m=150,p=5e3,E=(e,t,r)=>f(e,[...t],{cwd:r.cwd,shell:r.shell,stdio:["ignore","pipe","pipe"]}),x=async e=>new Promise(t=>{const r=h({host:"127.0.0.1",port:e}),o=s=>{r.destroy(),t(s)};r.once("connect",()=>{o(!0)}),r.once("error",()=>{o(!1)})}),d=(e,t)=>{let r="";e?.setEncoding("utf8"),e?.on("data",o=>{r+=o;const s=r.split(`
|
|
2
|
+
`);r=s.pop()??"";for(const a of s)t(a)}),e?.once("end",()=>{r!==""&&(t(r),r="")})},w=e=>e.exitCode!==null||e.signalCode!==null,L=async e=>{const t=(e.spawn??E)(e.command,e.args,{cwd:e.cwd,shell:e.shell===!0});let r=!1,o,s;d(t.stdout,n=>{e.onLine(n,"stdout")}),d(t.stderr,n=>{e.onLine(n,"stderr")}),t.once("error",n=>{o=n.code==="ENOENT"?new Error(e.notFound):n}),t.once("exit",n=>{s??=new Error(`${e.label} exited with code ${String(n)} before it was ready`)});const a=new Promise(n=>{t.once("exit",i=>{r||n(i??1)})}),l=()=>{t.kill("SIGKILL")};process.once("exit",l);const c=async()=>{r=!0,process.removeListener("exit",l),!w(t)&&await new Promise(n=>{const i=setTimeout(()=>{t.kill("SIGKILL")},p);t.once("exit",()=>{clearTimeout(i),n()}),t.kill("SIGTERM")})},u=Date.now()+e.readyTimeoutMs;for(;Date.now()<u;){const n=o??s;if(n!==void 0)throw process.removeListener("exit",l),n;if(e.signal?.aborted===!0)throw await c(),new Error(`${e.label} was stopped before it was ready`);if(await x(e.port)){if(w(t))throw await c(),new Error(`the server on port ${String(e.port)} is not the ${e.label} started here — it exited while something else took the port`);return{crashed:a,stop:c}}await new Promise(i=>{setTimeout(i,m)})}throw await c(),new Error(`${e.label} did not accept connections on port ${String(e.port)} within ${String(e.readyTimeoutMs/1e3)}s`)};export{x as acceptsConnection,L as startDevProcess};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawnSync as o}from"node:child_process";import{LunoraError as s}from"@lunora/errors";import{findPackageManagerSync as i,identifyInitiatingPackageManager as c}from"@visulima/package/package-manager";const a=["pnpm","bun","yarn","npm"],u=new Set(a),d=r=>u.has(r),l=r=>{try{return o(r,["--version"],{shell:process.platform==="win32",stdio:"ignore",timeout:5e3}).status===0}catch{return!1}},m=(r=l)=>a.filter(n=>r(n)),y=r=>({args:["install"],command:r}),E=(r,n,t={})=>{const e=t.dev===!0;return r==="npm"?{args:["install",...e?["--save-dev"]:[],...n],command:"npm"}:r==="bun"?{args:["add",...e?["-d"]:[],...n],command:"bun"}:{args:["add",...e?["-D"]:[],...n],command:r}},M=r=>{try{return i(r).packageManager}catch{}const n=c();if(n!==void 0){const e=n.name==="cnpm"?"npm":n.name;if(d(e))return e}const[t]=m();if(t!==void 0)return t;throw new s("INTERNAL","Could not detect a package manager: no lock file or `packageManager` field was found, and none (pnpm, bun, yarn, npm) is installed on PATH.")},g=(r,n,t)=>r==="yarn"?{args:[n,...t],command:"yarn"}:r==="bun"?{args:["x",n,...t],command:"bun"}:r==="npm"?{args:["--",n,...t],command:"npx"}:{args:["exec",n,...t],command:"pnpm"},b=(r,n)=>n.onPath===!0?{args:[...n.args],command:n.tool}:g(r,n.tool,n.args),P=(r,n)=>({args:["run",n],command:r}),h=(r,n)=>r==="npm"?`npm run ${n}`:r==="bun"?`bun run ${n}`:`${r} ${n}`;export{E as addArgsFor,m as detectInstalledManagers,M as detectPackageManager,g as execArgsFor,y as installArgsFor,P as runScriptArgsFor,h as runScriptCommand,b as toolchainExecArgs};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{Project as p,SyntaxKind as n}from"ts-morph";import{collectCalls as m}from"./parseSchema-D1Wbr1qv.mjs";const v=/^[A-Za-z_$][\w$]*$/u,b=new Set(["any","array","bigint","boolean","bytes","date","id","literal","null","number","object","optional","record","storage","string","timestamp","union"]),u=e=>{if(e.getKind()===n.ParenthesizedExpression)return u(e.asKindOrThrow(n.ParenthesizedExpression).getExpression());if(e.getKind()!==n.CallExpression)return!1;const t=e.asKindOrThrow(n.CallExpression),r=t.getExpression();if(r.getKind()!==n.PropertyAccessExpression)return!1;const i=r.asKindOrThrow(n.PropertyAccessExpression);return i.getExpression().getKind()!==n.Identifier||i.getExpression().getText()!=="v"||!b.has(i.getName())?!1:t.getArguments().every(s=>c(s))},c=e=>{const t=e.getKind();return t===n.ParenthesizedExpression?c(e.asKindOrThrow(n.ParenthesizedExpression).getExpression()):t===n.StringLiteral||t===n.NumericLiteral||t===n.TrueKeyword||t===n.FalseKeyword||t===n.NullKeyword?!0:t===n.PrefixUnaryExpression?e.asKindOrThrow(n.PrefixUnaryExpression).getOperand().getKind()===n.NumericLiteral:t===n.ObjectLiteralExpression?e.asKindOrThrow(n.ObjectLiteralExpression).getProperties().every(r=>{if(r.getKind()!==n.PropertyAssignment)return!1;const i=r.getInitializer();return i!==void 0&&c(i)}):t===n.ArrayLiteralExpression?e.asKindOrThrow(n.ArrayLiteralExpression).getElements().every(r=>c(r)):u(e)},y=e=>{if(typeof e!="string"||e.trim().length===0)return!1;const t=new p({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),r=t.createSourceFile("validator.ts",`const __v = (${e});`,{overwrite:!0});if(t.getProgram().getSyntacticDiagnostics(r).length>0||r.getStatements().length!==1)return!1;const s=r.getVariableDeclaration("__v")?.getInitializer();return s!==void 0&&u(s)},E=new Set(["addIndex","addOptionalColumn","addTable"]),A=new Set(["d1","hyperdrive"]),T=e=>E.has(e.kind)?"additive":"destructive",d=e=>typeof e=="string"&&v.test(e),h=e=>{if(!d(e.table)||e.kind==="addTable"&&e.global?.backend!==void 0&&!A.has(e.global.backend))return"invalid-identifier";if(e.kind==="addOptionalColumn"){if(!d(e.column))return"invalid-identifier";if(!y(e.validator))return"invalid-validator"}if(e.kind==="addIndex"&&(!d(e.name)||!Array.isArray(e.fields)||!e.fields.every(t=>d(t))))return"invalid-identifier"},O=e=>{const r=new p({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}).createSourceFile("schema.ts",e,{overwrite:!0});let i;for(const o of r.getDescendantsOfKind(n.CallExpression))if(o.getExpression().getText()==="defineSchema"){i=o;break}if(i===void 0)return{reason:r.getImportDeclarations().some(l=>l.getNamedImports().some(a=>a.getName()==="defineSchema"&&a.getAliasNode()!==void 0))?"aliased-define-schema":"no-define-schema"};const s=i.getArguments()[0];return s?.getKind()!==n.ObjectLiteralExpression?{reason:"non-object-argument"}:{object:s.asKindOrThrow(n.ObjectLiteralExpression),sourceFile:r}},g=(e,t)=>{for(const r of e.getProperties())if(r.getKind()===n.PropertyAssignment&&r.getNameNode().getText().replaceAll(/["']/gu,"")===t)return r},K=e=>{const t=e.getInitializer(),i=(t===void 0?void 0:m(t).find(s=>s.getExpression().getText()==="defineTable"))?.getArguments()[0];return i?.getKind()===n.ObjectLiteralExpression?i.asKindOrThrow(n.ObjectLiteralExpression):void 0},w=(e,t)=>{if(g(e,t.table)!==void 0)return"duplicate-table";const r=t.global?.backend,i=r===void 0?"":`{ backend: ${JSON.stringify(r)} }`,s=t.global===void 0?"":`.global(${i})`;e.addPropertyAssignment({initializer:`defineTable({
|
|
2
|
+
// Add your column validators here.
|
|
3
|
+
// Example:
|
|
4
|
+
// text: v.string(),
|
|
5
|
+
// createdAt: v.number(),
|
|
6
|
+
})${s}`,name:t.table})},k=(e,t)=>{const r=g(e,t.table);if(r===void 0)return"unknown-table";const i=K(r);if(i===void 0)return"unknown-table";if(i.getProperties().some(o=>o.getKind()===n.PropertyAssignment&&o.getNameNode().getText().replaceAll(/["']/gu,"")===t.column))return"duplicate-column";i.addPropertyAssignment({initializer:`v.optional(${t.validator})`,name:t.column})},S=(e,t)=>{if(e===void 0)return"unknown-table";const r=e.getInitializer();if(r===void 0)return"unknown-table";if(m(r).some(l=>{const a=l.getExpression();if(a.getKind()!==n.PropertyAccessExpression)return!1;const x=a.asKindOrThrow(n.PropertyAccessExpression),[f]=l.getArguments();return x.getName()==="index"&&f?.getKind()===n.StringLiteral&&f.asKindOrThrow(n.StringLiteral).getLiteralText()===t.name}))return"duplicate-index";const s=t.fields.map(l=>JSON.stringify(l)).join(", "),o=t.unique===!0?", { unique: true }":"";e.setInitializer(`${r.getText()}.index(${JSON.stringify(t.name)}, [${s}]${o})`)},N=(e,t)=>{if(T(t)==="destructive")return{ok:!1,reason:"destructive"};const r=t,i=h(r);if(i!==void 0)return{ok:!1,reason:i};const s=O(e);if("reason"in s)return{ok:!1,reason:s.reason};const{object:o,sourceFile:l}=s;let a;return r.kind==="addTable"?a=w(o,r):r.kind==="addOptionalColumn"?a=k(o,r):a=S(g(o,r.table),r),a!==void 0?{ok:!1,reason:a}:{ok:!0,text:l.getFullText()}};export{N as applyAdditiveEdit,T as classifyEdit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{modify as p,applyEdits as r}from"jsonc-parser";const s={formattingOptions:{insertSpaces:!0,tabSize:4}},a=(t,i,n)=>{const o=p(t,[...i],n,s);return o.length>0?r(t,o):t};export{s as FORMATTING,a as applyModify};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=t=>Array.isArray(t)?t[0]:t,o=(t,e,d,a)=>{if(e.setHeader("Cache-Control","no-cache"),a===void 0)return!1;const r=`W/"${d}-${String(a)}"`;return e.setHeader("ETag",r),n(t.headers?.["if-none-match"])!==r?!1:(e.statusCode=304,e.end(),!0)},c=(t,e)=>{t.statusCode=200,t.setHeader("Cache-Control","no-store"),t.setHeader("Content-Type","text/html; charset=utf-8"),t.end(e)};export{o as applyStudioAssetCache,c as sendStudioDocument};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-CiQM3BkI.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-DwJCN8fX.mjs";const m=(e,a,t)=>{const r=l({projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
|
|
2
|
+
`));for(const o of r.report.warnings)a(i(`wrangler validator: ${o}`));if(r.problems.length>0)throw new n("INTERNAL",["[lunora] wrangler configuration is missing bindings required by your schema.",` file: ${r.wranglerPath}`,"",...r.problems.map(o=>` - ${o}`),"",` ${t}`].join(`
|
|
3
|
+
`))};export{m as assertWranglerSatisfiesSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as o,statSync as i}from"node:fs";import{createRequire as n}from"node:module";import{normalize as u,join as a,relative as c,isAbsolute as d,dirname as l}from"node:path";const j=(t,s=import.meta.url)=>{try{const r=n(s);return{script:o(r.resolve("@lunora/studio/standalone/studio.js")),styles:o(r.resolve("@lunora/studio/styles.css"))}}catch(r){const e=r instanceof Error?r.message:String(r);t?.warnOnce?.(`[lunora] studio assets unavailable (build @lunora/studio?): ${e}`);return}},S=(t=import.meta.url)=>{try{const s=n(t),r=i(s.resolve("@lunora/studio/standalone/studio.js")).mtimeMs,e=i(s.resolve("@lunora/studio/styles.css")).mtimeMs;return Math.max(r,e)}catch{return}},v=(t=import.meta.url)=>{try{return l(n(t).resolve("@lunora/studio/standalone/studio.js"))}catch{return}},m=(t,s)=>{if(s===""||s==="."||s===".."||s.includes("/")||s.includes("\\")||s.includes("\0"))return;const r=u(a(t,s)),e=c(t,r);if(!(e===""||e.startsWith("..")||d(e)||e.includes("/")||e.includes("\\")))return r},f=(t,s=import.meta.url)=>{const r=v(s);if(r===void 0)return;const e=m(r,t);if(e!==void 0)try{return o(e)}catch{return}},M=t=>t.endsWith(".js")||t.endsWith(".js.map"),W=t=>t.endsWith(".css")?"text/css; charset=utf-8":t.endsWith(".map")?"application/json; charset=utf-8":"text/javascript; charset=utf-8";export{W as assetContentType,M as isStandaloneModulePath,j as loadStudioAssets,f as readStandaloneAsset,m as resolveContainedFile,v as resolveStandaloneDirectory,S as studioAssetsStamp};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{randomBytes as _}from"node:crypto";import{existsSync as m,readFileSync as y,writeFileSync as h,linkSync as M,rmSync as g,renameSync as A,statSync as T}from"node:fs";import{join as p}from"node:path";import{LunoraError as F}from"@lunora/errors";import{DEV_VARS_FILE as u,DEV_VARS_EXAMPLE_FILE as f,parseDevVariableLine as $,parseDevVariableEntries as E,DEV_VARS_NEWLINE as C}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{C as P,M as j,s as I}from"./package-secrets-registry-BeheNwsP.mjs";const R=e=>[...P,...I(e)],S=32,N=["replace","openssl","changeme","change-me","change_me","change-this","change_this","your-","your_","example","placeholder","todo","fill-me","fill_me","fill-in","fill_in","xxx"],z=/[.*+?^${}()|[\]\\]/gu,B=/[a-z0-9]$/u,W=e=>{const t=e.trim().toLowerCase();return t===""||t.startsWith("<")&&t.endsWith(">")?!0:N.some(r=>{const s=r.replaceAll(z,String.raw`\$&`),o=B.test(r)?`(^|[^a-z0-9])${s}([^a-z0-9]|$)`:`(^|[^a-z0-9])${s}`;return new RegExp(o,"u").test(t)})},x=e=>_(e).toString("hex"),X=e=>j.has(e),D=(e,t,r)=>X(e)&&W(t)?r(S):void 0,ae=(e=x)=>e(S),H=(e,t,r)=>e.split(C).map(s=>{const n=$(s),o=n?D(n.key,n.value,t):void 0;return!n||o===void 0?s:(r.push(n.key),`${n.key}="${o}"`)}),G=e=>{if(e.devVarsExists)return{status:"exists"};if(e.exampleContent===void 0)return{status:"no-example"};const t=[];return{content:H(e.exampleContent,e.randomHex??x,t).join(`
|
|
2
|
+
`),generatedKeys:t,status:"generate"}},O=e=>e.includes('"')||e.includes("\\")?"":e.replaceAll("\r",String.raw`\r`).replaceAll(`
|
|
3
|
+
`,String.raw`\n`),w=e=>{const t=e.randomHex??x,r=new Set(E(e.existingContent).map(d=>d.key)),s=[],n=[],o=[];for(const d of e.exampleContent.split(C)){const i=$(d);if(!i||r.has(i.key))continue;const a=D(i.key,i.value,t);o.push(i.key),a===void 0?s.push(`${i.key}="${O(i.value)}"`):(n.push(i.key),s.push(`${i.key}="${a}"`))}return{additions:s,generatedKeys:n,missingKeys:o}},k=e=>e.length>0?` (generated ${e.join(", ")})`:"",b=e=>`${e}.tmp-${String(process.pid)}`,K=(e,t,r={})=>{const s=b(e);try{h(s,t,{encoding:"utf8",...r}),A(s,e)}catch(n){throw g(s,{force:!0}),n}},U=(e,t)=>{try{return h(e,t,{encoding:"utf8",flag:"wx",mode:384}),!0}catch(r){if(r.code==="EEXIST")return!1;throw r}},L=(e,t)=>{const r=b(e);try{h(r,t,{encoding:"utf8",flag:"wx",mode:384});try{return M(r,e),!0}catch(s){const{code:n}=s;if(n==="EEXIST")return!1;if(n==="EPERM"||n==="ENOTSUP")return U(e,t);throw s}}finally{g(r,{force:!0})}},ce=(e,t)=>{K(e,t,{mode:384})},v=5,V=e=>{try{const t=T(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}},Y=(e,t)=>e===void 0||t===void 0?!1:e.mtimeMs===t.mtimeMs&&e.size===t.size,q=(e,t)=>{for(let r=0;r<v;r+=1){const s=V(e),n=y(e,"utf8"),o=t(n);if(o.length===0)return[];const d=n.length>0&&!n.endsWith(`
|
|
4
|
+
`)?`
|
|
5
|
+
`:"",i=`${n}${d}${o.join(`
|
|
6
|
+
`)}
|
|
7
|
+
`,a=`${e}.tmp-${String(process.pid)}-${_(6).toString("hex")}`;try{h(a,i,{encoding:"utf8",mode:384});const c=V(e);if(!Y(s,c)){g(a,{force:!0});continue}return A(a,e),o}catch(c){throw g(a,{force:!0}),c}}throw new F("INTERNAL",`Failed to append to ${e} after ${String(v)} attempts — a concurrent writer kept winning the race.`)},de=async e=>{const t=p(e.cwd,u),r=p(e.cwd,f);if(!m(r))return{addedKeys:[],generatedKeys:[],status:"no-example"};const s=y(r,"utf8");if(!m(t)){const l=G({devVarsExists:!1,exampleContent:s,randomHex:e.randomHex});return l.status!=="generate"?{addedKeys:[],generatedKeys:[],status:"no-example"}:e.yes===!0||await e.confirm(`No ${u} found. Generate it from ${f} (secrets auto-filled)?`)?L(t,l.content)?(e.info(`Created ${u}${k(l.generatedKeys)}.`),{addedKeys:[],generatedKeys:l.generatedKeys,status:"generated"}):{addedKeys:[],generatedKeys:[],status:"skipped-exists"}:(e.info(`Skipped — copy ${f} to ${u} and fill it in when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"})}const n=w({existingContent:y(t,"utf8"),exampleContent:s,randomHex:e.randomHex});if(n.missingKeys.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const o=n.missingKeys.join(", ");if(!(e.yes===!0||await e.confirm(`${u} is missing ${String(n.missingKeys.length)} key(s) from ${f} (${o}). Add them?`)))return e.info(`Skipped — add ${o} to ${u} when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"};const a=q(t,l=>w({existingContent:l,exampleContent:s,randomHex:e.randomHex}).additions).map(l=>$(l)?.key).filter(l=>l!==void 0);if(a.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const c=n.generatedKeys.filter(l=>a.includes(l));return e.info(`Updated ${u} — added ${a.join(", ")}${k(c)}.`),{addedKeys:a,generatedKeys:c,status:"augmented"}},J=e=>[`# ${e.description}`,`# Docs: ${e.docsUrl}`,`${e.key}="${e.placeholderValue}"`].join(`
|
|
8
|
+
`),Q=(e,t)=>{const r=R(e).filter(s=>!t.has(s.key));return r.length===0?"":r.map(s=>J(s)).join(`
|
|
9
|
+
|
|
10
|
+
`)},le=(e,t)=>{const r=p(e,f),s=m(r)?y(r,"utf8"):"",n=new Set(E(s).map(i=>i.key)),o=Q(t,n);if(o==="")return[];const d=s.length>0&&!s.endsWith(`
|
|
11
|
+
`)?`
|
|
12
|
+
`:"";return K(r,`${s}${d}
|
|
13
|
+
${o}
|
|
14
|
+
`),R(t).filter(i=>!n.has(i.key)).map(i=>i.key)},Z=e=>{const t=e.randomHex??x,r=[],s=H(e.existingContent,t,r),n=new Set(E(e.existingContent).map(c=>c.key)),o=[],d=[];for(const c of P)n.has(c.key)||(o.push(c.key),d.push(`# ${c.description}`,`${c.key}="${t(S)}"`));const i=s.join(`
|
|
15
|
+
`);if(d.length===0)return{addedKeys:o,content:i,filledKeys:r};const a=i===""||i.endsWith(`
|
|
16
|
+
`)?"":`
|
|
17
|
+
`;return{addedKeys:o,content:`${i}${a}${d.join(`
|
|
18
|
+
`)}
|
|
19
|
+
`,filledKeys:r}},ue=e=>{const t=p(e.cwd,u),r=m(t),s=r?y(t,"utf8"):"",n=Z({existingContent:s,randomHex:e.randomHex});if(n.filledKeys.length===0&&n.addedKeys.length===0)return{addedKeys:[],filledKeys:[],status:"unchanged"};if(r)K(t,n.content,{mode:384});else if(!L(t,n.content))return{addedKeys:[],filledKeys:[],status:"unchanged"};const o=[...n.filledKeys,...n.addedKeys];return e.info?.(`Generated ${String(o.length)} dev secret(s) in ${u}: ${o.join(", ")}`),{addedKeys:n.addedKeys,filledKeys:n.filledKeys,status:r?"filled":"created"}};export{Q as buildPackageSecretsBlock,de as ensureDevVariables,le as ensureDevVarsExample,ue as fillDevSecrets,ae as generateSecretValue,X as isMintableSecretKey,W as isPlaceholderValue,Z as planDevSecretsFill,w as planDevVariablesAugment,G as planDevVariablesScaffold,R as requiredSecrets,ce as writeDevVariablesFileAtomically};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{writeFileSync as $,rmSync as V,existsSync as b,readFileSync as j}from"node:fs";import{dirname as E,resolve as h,join as y,sep as g,relative as v,isAbsolute as R}from"node:path";import{findWranglerFile as W,readWranglerJsonc as x}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{DEV_VARS_FILE as F,parseDevVariableEntries as L}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";const B=".celld.wrangler.json",Y=y(".wrangler","deploy","config.json"),J=new Set(["$schema","assets","compatibility_date","compatibility_flags","containers","d1_databases","define","durable_objects","kv_namespaces","main","migrations","name","no_bundle","queues","r2_buckets","rules","services","triggers","vars","worker_loaders","workflows"]),K=new Set(["class_name","image","instance_type","max_instances","name","runtime"]),q=new Set(["CompiledWasm","Data","Text"]),G=/\r?\n/u,M=/[!*?[]/u,U=/[.[]/u,X=["deleted_classes","new_classes","renamed_classes","transferred_classes"],l=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),O=e=>Array.isArray(e)&&e.length===0||l(e)&&Object.values(e).every(t=>O(t)),z=e=>Array.isArray(e)?e.map(t=>{if(!l(t))return t;const s=X.find(r=>t[r]!==void 0);if(s!==void 0)throw new Error(`migration "${String(t.tag)}" uses \`${s}\`, which celld refuses — celld accepts only \`new_sqlite_classes\` migrations`);return{new_sqlite_classes:t.new_sqlite_classes,tag:t.tag}}):e,H=(e,t)=>Array.isArray(e)?e.map((s,r)=>l(s)?Object.fromEntries(Object.entries(s).filter(([n])=>{const o=K.has(n);return o||t.push(`containers[${String(r)}].${n}`),o})):s):e,Q=(e,t)=>Array.isArray(e)?e.filter((s,r)=>{const n=l(s)&&typeof s.type=="string"&&q.has(s.type);return n||t.push(`rules[${String(r)}]`),n}):e,Z=e=>{const t=[],s={};for(const[r,n]of Object.entries(l(e)?e:{}))l(n)&&n.type==="workflow"?t.push({binding:r,class_name:r,name:n.name}):s[r]=n;return{bindings:t,rest:s}},k=e=>{const t=[],s={},r=Z(e.exports),n={...e,exports:r.rest};for(const[o,i]of Object.entries(n)){if(!J.has(o)){O(i)||t.push(o);continue}switch(o){case"containers":{s[o]=H(i,t);break}case"migrations":{s[o]=z(i);break}case"rules":{s[o]=Q(i,t);break}default:s[o]=i}}if(r.bindings.length>0){const o=Array.isArray(s.workflows)?s.workflows:[];s.workflows=[...o,...r.bindings]}return{config:s,dropped:t}},ee=e=>{const[t=[],...s]=e.map(n=>h(n).split(g));let r=0;for(;r<t.length&&s.every(n=>n[r]===t[r]);)r+=1;return t.slice(0,r).join(g)||g},C=(e,t,s)=>{const r=o=>v(s,h(t,o)).split(g).join("/"),n={...e};return typeof e.main=="string"&&(n.main=r(e.main)),l(e.assets)&&typeof e.assets.directory=="string"&&(n.assets={...e.assets,directory:r(e.assets.directory)}),n},se=e=>{const t=y(e,".assetsignore");if(!b(t))return;const s=j(t,"utf8").split(G).map(r=>r.trim()).filter(r=>r!==""&&!r.startsWith("#")).filter(r=>M.test(r)||b(y(e,r)));if(s.length>0)throw new Error(`${t} hides ${s.join(", ")} from the assets, and celld has no .assetsignore — remove those files from ${e} first`);return t},re=(e,t)=>{const s=y(e,Y);if(!b(s))throw new Error(`wrangler \`main\` is the Vite virtual module "${t}", so celld deploys the Vite build output — and there is none yet. Run the project's build (\`vite build\`) first`);const{configPath:r}=JSON.parse(j(s,"utf8"));if(typeof r!="string")throw new TypeError(`${s} names no configPath`);return h(E(s),r)},A=e=>{const{parsed:t}=x(e);if(t===void 0)throw new Error(`${e} is not valid JSONC`);return t},D=(e,t,s,r)=>{const{d1_databases:n}=e;if(!Array.isArray(n)||r===s)return e;const o=Array.isArray(t.d1_databases)?t.d1_databases.filter(i=>l(i)):[];return{...e,d1_databases:n.map(i=>{if(!l(i))return i;const a=o.find(w=>w.binding===i.binding),c=a?.migrations_dir,f=h(s,typeof c=="string"?c:"migrations"),d=b(f)?{...i,migrations_dir:v(r,f).split(g).join("/")}:i,u=a?.migrations_pattern;return typeof u=="string"?{...d,migrations_pattern:v(r,h(s,u)).split(g).join("/")}:d})}},te=(e,t,s,r)=>{const{main:n}=s;if(typeof n!="string"||!n.startsWith("virtual:"))return{fromBuild:!1,source:s,sourcePath:t};if(r==="dev")throw new Error(`wrangler \`main\` is the Vite virtual module "${n}", which only a Vite build can resolve — \`celld dev\` rebuilds from a source file. Use \`vite dev\` for the dev loop and \`lunora deploy\` to ship the build to celld, or point \`main\` at a worker file`);const o=re(e,n);return{fromBuild:!0,source:A(o),sourcePath:o}},ne=(e,t,s,r,n)=>{const o=t.filter(c=>Object.hasOwn(s,c.split(U)[0]??c));let i=e;e.no_bundle!==void 0&&(i=Object.fromEntries(Object.entries(e).filter(([c])=>c!=="no_bundle")),o.push("no_bundle (celld re-bundles the build output)"));const a=r===void 0?void 0:se(r);return a!==void 0&&o.push(`${v(n,a)} (matched no files)`),{assetsIgnore:a,projected:i,reported:o}},I=e=>{const t=l(e.vars)?e.vars:{};return{...e,vars:{WORKER_ENV:"development",...t}}},le=(e,t)=>{const s=W(e);if(s===void 0)throw new Error(`no wrangler.jsonc or wrangler.json in ${e} — celld deploys from the project's Wrangler config`);const r=A(s),{fromBuild:n,source:o,sourcePath:i}=te(e,s,r,t),a=E(i),{config:c,dropped:f}=k(o),{assets:d}=o,u=l(d)&&typeof d.directory=="string"?h(a,d.directory):void 0,w=typeof o.main=="string"?E(h(a,o.main)):void 0,p=ee([a,w,u].filter(T=>T!==void 0));if(!n&&p!==a)throw new Error(`wrangler \`main\` and \`assets.directory\` must sit inside ${a} — celld resolves everything against the config's directory`);const _=D(C(c,a,p),r,e,p),m=n?ne(_,f,r,u,p):{assetsIgnore:void 0,projected:_,reported:f},N=t==="dev"?I(m.projected):m.projected,S=y(p,B),P=`${JSON.stringify(N,void 0,4)}
|
|
2
|
+
`;return{configPath:S,dropped:m.reported,write:()=>{$(S,P),m.assetsIgnore!==void 0&&V(m.assetsIgnore)}}},de=(e,t)=>{const s=A(t),r=E(t),{config:n,dropped:o}=k(s),i=typeof s.name=="string"?s.name:"service",a=v(e,r);if(a===".."||a.startsWith(`..${g}`)||R(a))throw new Error(`service ${i} (${r}) must sit inside ${e} — celld dev runs it from a config beside the app's`);const c=y(r,F),f=b(c)?Object.fromEntries(L(j(c,"utf8")).map(({key:_,value:m})=>[_,m])):{},d=D(C(n,r,e),s,r,e),u=l(d.vars)?d.vars:{},w=y(e,`.celld.service.${i.replaceAll(/[^\w.-]/gu,"-")}.wrangler.json`),p=`${JSON.stringify(I({...d,vars:{...u,...f}}),void 0,4)}
|
|
3
|
+
`;return{configPath:w,dropped:o,write:()=>{$(w,p)}}};export{de as a,le as p};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{Project as p,SyntaxKind as o}from"ts-morph";import{projectUsesUmbrella as u}from"./detectFramework-Dfpvu6rD.mjs";const f=new Set(["action","mutation","query","stream"]),l=/^[A-Za-z_$][\w$]*$/u,d=new Set(["@lunora/server","lunorash/server"]),y=e=>u(e)?"lunorash/server":"@lunora/server",m=new Set(["scaffoldPolicy","wireRls"]),$=e=>m.has(e.kind)?"additive":"destructive",v=(e,s)=>{if(typeof e.name!="string"||typeof e.table!="string"||!l.test(e.name)||!l.test(e.table))return{ok:!1,reason:"invalid-identifier"};const r=`${e.name}Policies`,t=`${e.name}Roles`,n=JSON.stringify(e.table),i=`import { definePermission, definePolicies, definePolicy, defineRole } from "${s}";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Access rules for the ${e.table} table — scaffolded by the Lunora studio
|
|
5
|
+
* (plan 025). The \`when\` predicates below DENY by default (\`() => false\`);
|
|
6
|
+
* replace each TODO with the real condition, then wire \`${r}\`
|
|
7
|
+
* into the procedures that read/write ${e.table} via
|
|
8
|
+
* \`.use(rls(${r}, { roles: ${t} }))\`.
|
|
9
|
+
*/
|
|
10
|
+
export const ${r} = definePolicies([
|
|
11
|
+
definePolicy({
|
|
12
|
+
on: "read",
|
|
13
|
+
table: ${n},
|
|
14
|
+
// TODO: return \`true\` to allow, a \`WhereInput\` to filter, or \`false\` to deny.
|
|
15
|
+
when: () => false,
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
/** Named permissions \`${r}\` can check with \`ctx.auth.can(...)\`. */
|
|
20
|
+
export const ${e.name}View = definePermission("${e.name}:view");
|
|
21
|
+
|
|
22
|
+
/** Roles that grant the permissions above; register via \`rls(policies, { roles })\`. */
|
|
23
|
+
export const ${t} = [defineRole("${e.name}-admin", { permissions: [${e.name}View] })];
|
|
24
|
+
`;return{fileName:`${e.name}.policies.ts`,ok:!0,source:i}},h=e=>{const s=e.getExpression();if(s.getKind()!==o.PropertyAccessExpression)return;const r=s.asKindOrThrow(o.PropertyAccessExpression);return f.has(r.getName())?r.getExpression():void 0},g=(e,s)=>{const r=e.getImportDeclaration(t=>d.has(t.getModuleSpecifierValue()));if(r===void 0){e.addImportDeclaration({moduleSpecifier:s,namedImports:["rls"]});return}r.getNamedImports().some(t=>t.getName()==="rls")||r.addNamedImport("rls")},w=e=>{const s=e.getDescendantsOfKind(o.CallExpression);e.getKind()===o.CallExpression&&s.push(e.asKindOrThrow(o.CallExpression));for(const r of s){const t=r.getExpression();if(t.getKind()!==o.PropertyAccessExpression)continue;const n=t.asKindOrThrow(o.PropertyAccessExpression),[i]=r.getArguments();if(n.getName()==="use"&&i?.getKind()===o.CallExpression&&i.asKindOrThrow(o.CallExpression).getExpression().getText()==="rls")return!0}return!1},I=(e,s,r)=>{if(typeof s.policies!="string"||!l.test(s.policies))return{ok:!1,reason:"invalid-identifier"};const n=new p({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}).createSourceFile("procedure.ts",e,{overwrite:!0}),i=n.getVariableDeclaration(s.exportName),c=i?.getInitializer();if(i===void 0||c?.getKind()!==o.CallExpression)return{ok:!1,reason:"unknown-procedure"};const a=h(c.asKindOrThrow(o.CallExpression));return a===void 0?{ok:!1,reason:"unsupported-procedure-shape"}:w(a)?{ok:!1,reason:"already-wired"}:(a.replaceWithText(`${a.getText()}.use(rls(${s.policies}))`),g(n,r),{ok:!0,text:n.getFullText()})};export{$ as classifyPolicyEdit,y as resolveServerModule,v as scaffoldPolicyFile,I as wireRlsIntoProcedure};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{readFileSync as X,writeFileSync as z}from"node:fs";import{createRequire as Z}from"node:module";import{join as Q}from"node:path";import{containerBuildTag as ee}from"@lunora/container";import{readJsonSync as ne}from"@visulima/fs";import{applyModify as S}from"./applyModify-DKP2l6S9.mjs";import{a as se,r as K}from"./lunora-manifest-DuH_Cmyu.mjs";import{parseTree as te,findNodeAtLocation as oe}from"jsonc-parser";import{r as ie,a as re,b as ae,c as de}from"./reconcile-services-DFqH4eMQ.mjs";import{a as ce,s as le}from"./infer-bindings-C1NFOdMi.mjs";import{DEV_VARS_FILE as ue,parseDevVariableEntries as ge}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{requiredSecrets as me}from"./buildPackageSecretsBlock-BWV_VxqV.mjs";import{w as pe,m as fe,s as Y,o as B,n as C,p as be}from"./validate-bindings-CvNBF3U4.mjs";import{s as he}from"./worker-entry-checks-AIASCYl7.mjs";import{DEFAULT_OBSERVABILITY as we}from"./DEFAULT_OBSERVABILITY-bN6UkTMx.mjs";import{findWranglerFile as ve,readWranglerJsonc as _e}from"./WRANGLER_FILES-UNW-xY5u.mjs";const ye=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],R=e=>Object.fromEntries(ye.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",Se=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,xe=/^[\t ]*,/u,Ne=(e,n)=>{const s=te(e),t=s===void 0?void 0:oe(s,[...n])?.parent;if(t?.type==="property"){const o=t.offset+t.length,i=e.lastIndexOf(`
|
|
2
|
+
`,t.offset-1)+1,r=Se.exec(e.slice(o));if(r!==null&&e.slice(i,t.offset).trim()===""){const d=t.parent?.children??[],m=d.indexOf(t),c=m===d.length-1&&m>0?d[m-1]:void 0,l=c===void 0?void 0:xe.exec(e.slice(c.offset+c.length))??void 0;return(l===void 0||c===void 0?e.slice(0,i):e.slice(0,c.offset+c.length)+e.slice(c.offset+c.length+l[0].length,i))+e.slice(o+r[0].length)}}return S(e,n,void 0)},G=(e,n,s,t,o,i=new Set)=>{const r=s.join("."),d={},m=[],c=[];let l=e;return{entries:n.map((u,w)=>{const g=t(u);if(g===void 0||u.queue===void 0)return u;const b=Object.fromEntries(Object.entries(R(g)).filter(([f])=>!i.has(f))),h=Object.entries(o[u.queue]??{}).filter(([f])=>!Object.hasOwn(b,f)),v=Object.entries(b).filter(([f,_])=>u[f]!==_),x=h.filter(([f,_])=>u[f]===_).map(([f])=>f),E=Object.fromEntries(Object.entries({...u,...b}).filter(([f])=>!x.includes(f)));for(const[f,_]of v)l=S(l,[...s,w,f],_);for(const f of x)l=Ne(l,[...s,w,f]);for(const[f,_]of h){const O=u[f];O!==void 0&&O!==_&&c.push(`${r}/${u.queue}: ${f} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(O)} from the declared ${JSON.stringify(_)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(v.length>0||x.length>0)&&m.push(`${r}/${u.queue} (${[...v.map(([f])=>f),...x.map(f=>`removed ${f}`)].join(", ")})`),Object.keys(b).length>0&&(d[u.queue]=b),E}),owned:d,text:l,updated:m,warnings:c}},Oe=(e,n,s,t)=>{const o=n.queues??{},i=o.producers??[],r=o.consumers??[],d=new Set(i.map(g=>g?.binding)),m=new Set(r.map(g=>g.queue)),c=s.filter(g=>!d.has(g.bindingName)),l=s.filter(g=>!m.has(g.name)),p=G(e,r,["queues","consumers"],g=>s.find(b=>b.name===g.queue),t);let u=p.text;const w={...p.owned};if(c.length>0||l.length>0){const g=[...i,...c.map(h=>({binding:h.bindingName,queue:h.name}))],b=[...p.entries,...l.map(h=>({queue:h.name,...h.mode==="pull"?{type:"http_pull"}:{},...R(h)}))];for(const h of l){const v=R(h);Object.keys(v).length>0&&(w[h.name]=v)}u=S(u,["queues"],{consumers:b,producers:g})}return{added:[...c.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:w,text:u,updated:p.updated,warnings:p.warnings}},Ee=(e,n,s,t,o)=>{const i=n.env?.[t],r=i?.queues?.consumers??[],d=i?.queues?.producers??[],m=u=>{const w=d.find(g=>g?.queue===u.queue)?.binding;return w!==void 0?s.find(g=>g.bindingName===w):s.find(g=>g.name===u.queue&&!d.some(b=>b?.binding===g.bindingName))},c=G(e,r,["env",t,"queues","consumers"],m,o,new Set(["dead_letter_queue"])),l=r.filter(u=>u.queue!==void 0&&m(u)===void 0).map(u=>`env.${t}.queues.consumers/${String(u.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(u.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),p=r.flatMap(u=>{const w=m(u)?.tuning.deadLetterQueue;return w===void 0||u.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(u.queue)}: defineQueue declares deadLetterQueue "${w}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:c.owned,text:c.text,updated:c.updated,warnings:[...c.warnings,...p,...l]}},ke=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[P],t=o=>typeof o=="object"&&o!==null&&!Array.isArray(o);return s===void 0?{}:!t(s)||!Object.values(s).every(o=>t(o)&&Object.values(o).every(i=>t(i)))?(n.push(`${e?.path??"package.json"}: \`lunora.${P}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},$e=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,o])=>Object.keys(o).length>0));se(e,P,Object.keys(t).length===0?void 0:t)},j="PIPELINES",I="ARTIFACTS",Ae=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(d=>d.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(d=>d.binding===j),o=e.usesArtifacts?n?.artifacts??[]:[],i=o.some(d=>d.binding===I)?[]:o.flatMap(d=>d.binding===void 0?[]:[d.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0,"@lunora/bindings/kv is used but no kv_namespaces binding exists; add a kv_namespaces entry ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned."],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0,"@lunora/hyperdrive is used but no hyperdrive binding exists; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned."],[t,`ctx.pipelines is used but no "${j}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${j}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[e.usesArtifacts&&o.length===0,ce(e.jurisdiction)],[i.length>0,`ctx.artifacts is used and ${i.map(d=>`"${d}"`).join(", ")} ${i.length===1?"is":"are"} bound, but none is named "${I}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${I} and throws.`],[s,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([d])=>d).map(([,d])=>d)},qe=e=>[[e.usesX402Charge,"@lunora/x402/charge is used; set the recipient wallet address as a [vars] entry (the var name is your choice) and pass it to the charge config — the x402 facilitator settles USDC to that address."],[e.usesX402,"@lunora/x402/pay is used (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding holding the agent wallet key (binding name == signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars."]].filter(([s])=>s).map(([,s])=>s),D=(e,n,s)=>s.filter(t=>!t.exported).map(t=>`${e} "${t.exportName}" is declared but ${t.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${n}"\` so its binding can be provisioned.`),Ce=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(i=>i.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([i,r])=>r?.type==="workflow"?[i]:[]),o=(n.workflows??[]).flatMap(i=>i.class_name===void 0||i.script_name!==void 0?[]:[i.class_name]);return[...new Set([...t,...o])].filter(i=>!s.has(i)).map(i=>`wrangler.jsonc declares workflow "${i}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},je=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(o=>o.name)),t=new Set(e.queues.map(o=>o.bindingName));return[...(n.queues?.consumers??[]).flatMap(o=>{const{queue:i}=o;return i===void 0||s.has(i)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${i}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(o=>{const i=o?.binding;return i===void 0||t.has(i)?[]:[`wrangler.jsonc declares queues.producers[] binding "${i}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},Ie=(e,n)=>[...Ce(e,n),...je(e,n)],U=[{keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"],label:"Stripe"},{keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],label:"Polar"},{keys:["CREEM_API_KEY","CREEM_WEBHOOK_SECRET"],label:"Creem"},{keys:["AUTUMN_SECRET_KEY","AUTUMN_WEBHOOK_SECRET"],label:"Autumn"},{keys:["DODO_PAYMENTS_API_KEY","DODO_PAYMENTS_WEBHOOK_KEY"],label:"Dodo Payments"}],De=()=>U.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Te=e=>{let n;try{n=X(Q(e,ue),"utf8")}catch{return!1}const s=new Map(ge(n).map(t=>[t.key,t.value]));return U.some(({keys:t})=>t.every(o=>(s.get(o)??"")!==""))},Be=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),o=me(le(e)).map(i=>i.key).filter(i=>!t.has(i));return o.length===0?[]:[`wrangler.jsonc declares secrets.required without ${o.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${o.length===1?"it":"them"} to secrets.required.`]},T=(e,n,s)=>{const t=new Set(e.durableObjects.map(d=>d.className)),o=[],i=(s?.r2_buckets?.length??0)>0,r=(s?.d1_databases?.some(d=>d.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!i&&o.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!t.has("SessionDO")&&!r&&o.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!t.has("SchedulerDO")&&o.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),o.push(...D("container","containers",e.containers),...D("workflow","workflows",e.workflows),...D("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&o.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!Te(n)&&o.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${De()}.`),o.push(...qe(e),...Ae(e,s),...Be(e,s)),s!==void 0&&o.push(...Ie(e,s)),o},H="<replace-with-d1-create-id>",Re=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,o])=>o.filter(i=>!i.exported).map(({className:i,exportName:r})=>({className:i,exportName:r,kind:s,module:t}))),Pe=e=>{const n=new Set(B(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},Le=e=>{const n=new Set;for(const s of B(e)){for(const t of C(s.deleted_classes))n.delete(t);for(const{from:t,to:o}of B(s.renamed_classes))t!==void 0&&n.delete(t),o!==void 0&&n.add(o);for(const t of[...C(s.new_classes),...C(s.new_sqlite_classes)])n.add(t)}return n},Me=(e,n,s)=>{const t=n.durable_objects?.bindings??[],o=new Set(t.map(l=>l.name)),i=s.filter(l=>!o.has(l.binding));let r=e;const d=[];if(i.length>0){const l=[...t,...i.map(p=>({class_name:p.className,name:p.binding}))];r=S(r,["durable_objects","bindings"],l),d.push(...i.map(p=>`${p.binding}/${p.className}`))}const m=n.migrations??[],c=s.map(l=>l.className).filter(l=>!Le(m).has(l));if(c.length>0){const l=[...m,{new_sqlite_classes:c,tag:Pe(m)}];r=S(r,["migrations"],l)}return{added:d,text:r}},We=(e,n)=>{const s=n.d1_databases??[];if(s.some(i=>i.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",o=[...s,{binding:"DB",database_id:H,database_name:t}];return{added:["DB (D1)"],text:S(e,["d1_databases"],o)}},Ke={ai:{binding:"AI",label:"AI (Workers AI)"},analytics:{binding:"ANALYTICS_SQL",label:"ANALYTICS_SQL (Analytics SQL)"},browser:{binding:"BROWSER",label:"BROWSER (Browser Rendering)"},images:{binding:"IMAGES",label:"IMAGES (Cloudflare Images)"}},$=(e,n,s)=>{const{binding:t,label:o}=Ke[s],i=n[s]?.binding;return typeof i=="string"&&i.length>0?{added:[],text:e}:{added:[o],text:S(e,[s],{binding:t})}},Fe=(e,n)=>e.usesAnalyticsSql&&he(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,Qe=new Set(["ratelimits","send_email"]),Ye=["durable_objects","logfwdr","unsafe"],Ge=new Set(["data_blobs","text_blobs","vars","wasm_modules"]),M=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),L=(e,n,s)=>M(e)&&e[n]===s,Ue=(e,n,s)=>{if(Ge.has(e))return M(n)&&Object.hasOwn(n,s);const t=Qe.has(e)?"name":"binding";return Array.isArray(n)?n.some(o=>L(o,t,s)):L(n,"binding",s)},He=(e,n)=>{const s=e,t=Object.entries(s).find(([i,r])=>i!=="env"&&Ue(i,r,n));if(t!==void 0)return t[0];for(const i of Ye){const r=s[i];if(M(r)&&Array.isArray(r.bindings)&&r.bindings.some(d=>L(d,"name",n)))return`${i}.bindings`}if(e.queues?.producers?.some(i=>i?.binding===n)===!0)return"queues.producers";const o=e.secrets?.required;if(Array.isArray(o)&&o.includes(n))return"secrets.required"},F=(e,n,s,t,o)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const i=He(n,t.binding);return i!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${i}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[o],text:S(e,[s],[t])}},Je=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:S(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},Ve=e=>{if(typeof e=="string")return e;const n={};return e.diskMb!==void 0&&(n.disk_mb=e.diskMb),e.memoryMib!==void 0&&(n.memory_mib=e.memoryMib),e.vcpu!==void 0&&(n.vcpu=e.vcpu),n},Xe=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:ee(e.exportName)},J=e=>{const n={};for(const[s,t]of Object.entries(e.images??{}))n[s]=t.kind==="registry"?{image:t.reference}:{build_context:t.buildContext,dockerfile:t.dockerfilePath,...e.buildArgs===void 0?{}:{build_vars:e.buildArgs}};return{class_name:e.className,scheduling_policy:"durable_object",...Object.keys(n).length>0?{images:n}:{},...e.name===void 0?{}:{name:e.name}}},ze=e=>{if(e.schedulingPolicy==="durable_object")return J(e);const{image:n}=e,s={class_name:e.className,image:Xe(e)};return n.kind==="dockerfile"&&(s.image_build_context=n.buildContext),e.buildArgs!==void 0&&n.kind!=="registry"&&(s.image_vars=e.buildArgs),e.instanceType!==void 0&&(s.instance_type=Ve(e.instanceType)),e.maxInstances!==void 0&&(s.max_instances=e.maxInstances),e.name!==void 0&&(s.name=e.name),e.rollout?.stepPercentage!==void 0&&(s.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(s.rollout_active_grace_period=e.rollout.gracePeriodSeconds),s},Ze=(e,n,s)=>{const t=n.containers??[],o=new Set(t.map(c=>c.class_name)),i=s.filter(c=>!o.has(c.className));let r=i.length===0?e:S(e,["containers"],[...t,...i.map(c=>ze(c))]);const d=[],m=[];for(const[c,l]of t.entries()){const p=s.find(g=>g.className===l.class_name);if(p===void 0)continue;const u=p.schedulingPolicy??"default";if((l.scheduling_policy??"default")!==u){m.push(`containers/${p.className} has scheduling_policy "${l.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${p.exportName}" declares "${u}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const w=p.schedulingPolicy==="durable_object"?J(p).images:void 0;w!==void 0&&JSON.stringify(l.images)!==JSON.stringify(w)&&(r=S(r,["containers",c,"images"],w),d.push(`containers/${p.className}.images`))}return{added:i.map(c=>`containers/${c.className}`),text:r,updated:d,warnings:m}},en=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=S(e,["observability"],{...we});return{added:["observability"],text:s}},nn=(e,n)=>n.upload_source_maps!==void 0?{added:[],text:e}:{added:["upload_source_maps"],text:S(e,["upload_source_maps"],!0)},V=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],sn=V.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),tn=(e,n)=>{try{const s=Z(Q(e,"package.json")).resolve(`${n}/package.json`),[t=0,o=0]=String(ne(s).version).split(".").map(Number);return[t,o]}catch{return}},on=e=>{const n=V.flatMap(({minimum:s,name:t})=>{const o=tn(e,t);return o!==void 0&&(o[0]<s[0]||o[0]===s[0]&&o[1]<s[1])?[`${t} ${o.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D ${sn}\`) and re-run.`},rn=e=>Object.entries(e.env??{}).flatMap(([n,s])=>Array.isArray(s?.workflows)?[`env.${n}.workflows declares workflow bindings, but Lunora now declares workflows in \`exports\` and resolves them on ctx.exports — move them to that environment's own \`exports\` by hand.`]:[]),an=(e,n,s)=>{let t=e;const o=[],i=[];for(const r of s){const d=n[r.className];if(d?.type==="workflow")for(const{of:m,path:c}of be){const l=m(r),p=Y(d,c),u=`exports/${r.className}.${c.join(".")}`;if(l===void 0){p!==void 0&&i.push(`${u} is set in wrangler.jsonc but defineWorkflow "${r.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(p)!==JSON.stringify(l)&&(t=S(t,["exports",r.className,...c],l),o.push(u))}}return{text:t,updated:o,warnings:i}},dn=(e,n,s,t,o)=>{if(o!==void 0)return{added:[],text:e,warnings:[o]};const i=[...s.map(b=>({settings:pe(b),workflow:b})),...t.map(b=>({settings:{},workflow:b}))],r=new Set(i.map(({workflow:b})=>b.className)),d=n.workflows??[],m=d.filter(b=>b.script_name===void 0&&b.class_name!==void 0&&r.has(b.class_name)),c=n.exports??{},l=[],p=[],u=[];let w=e;for(const{settings:b,workflow:h}of i){if(c[h.className]!==void 0&&c[h.className]!==null)continue;const v=m.find(f=>f.class_name===h.className),x=Object.fromEntries(fe.flatMap(f=>{const _=Y(v,[f]);return _===void 0?[]:[[f,_]]})),E=v?.name??h.name;v?.name!==void 0&&v.name!==h.name&&u.push(`workflows/${h.className} is deployed as "${v.name}" but declared as "${h.name}" — its export keeps "${v.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),w=S(w,["exports",h.className],{type:"workflow",...x,...b,name:E}),(v===void 0?l:p).push(`exports/${h.className}`)}if(m.length>0){const b=d.filter(h=>!m.includes(h));w=S(w,["workflows"],b.length===0?void 0:b),p.push(...m.map(h=>`workflows/${String(h.class_name)} → exports`))}u.push(...rn(n));const g=an(w,c,s);return{added:l,text:g.text,updated:[...p,...g.updated],warnings:[...u,...g.warnings]}},On=(e,n,{environment:s,target:t}={})=>{const o=ve(e),i=Re(n);if(!o)return{added:[],changed:!1,exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:T(n,e)};const{parsed:r,text:d}=_e(o);if(r===void 0)return{added:[],changed:!1,exportGaps:i,reason:`failed to parse ${o} as JSONC`,updated:[],warnings:T(n,e),wranglerPath:o};const m=T(n,e,r);if(s!==void 0){const a=r.env?.[s]!==void 0;m.push(a?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const c=n.containers.filter(a=>a.exported),l=n.agents.filter(a=>a.exported&&a.voice===!0&&a.voiceBindingName!==void 0&&a.voiceClassName!==void 0),p=[...n.durableObjects,...c.map(a=>({binding:a.bindingName,className:a.className})),...l.map(a=>({binding:a.voiceBindingName,className:a.voiceClassName}))],u=n.workflows.filter(a=>a.exported),w=n.agents.filter(a=>a.exported),g=K(e),b=ke(g,m),h={},v=ie(g);let x;const E=[{enabled:!0,run:a=>Me(a,r,p)},{enabled:n.needsD1,run:a=>We(a,r)},{enabled:n.usesAi,run:a=>$(a,r,"ai")},{enabled:n.usesAiSearch,run:a=>F(a,r,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:Fe(n,e),run:a=>$(a,r,"analytics")},{enabled:n.usesBrowser,run:a=>$(a,r,"browser")},{enabled:n.usesImages,run:a=>$(a,r,"images")},{enabled:n.usesAnalytics,run:a=>F(a,r,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:a=>Je(a,r)},{enabled:!0,run:a=>en(a,r)},{enabled:t===void 0||t==="cloudflare",run:a=>nn(a,r)},{enabled:c.length>0,run:a=>Ze(a,r,c)},{enabled:u.length>0||w.length>0,run:a=>dn(a,r,u,w,on(e))},{enabled:n.queues.length>0,run:a=>{const y=Oe(a,r,n.queues,b.queues??{});return h.queues=y.owned,y}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(v).length>0),run:a=>{const y=re(a,r,n.services??[],v);return x=y.owned,y}},...s===void 0||r.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:a=>{const y=`env.${s}.queues`,k=Ee(a,r,n.queues,s,b[y]??{});return h[y]=k.owned,k}}]];let f=d;const _=[],O=[];for(const a of E){if(!a.enabled)continue;const y=a.run(f);f=y.text,_.push(...y.added),O.push(...y.updated??[]),m.push(...y.warnings??[])}const W=a=>{if(g===void 0)return;const y=x,k=[...Object.keys(h).length>0?[{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:N=>{$e(N,b,h)}}]:[],...y===void 0?[]:[{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:N=>{de(N,y)}}]];for(const N of k)try{N.write(K(e)??g)}catch(q){m.push(`${a?"wrangler.jsonc was updated, but ":""}recording the ${N.label} reconcile owns in ${g.path} (lunora.${N.key}) failed: ${q instanceof Error?q.message:String(q)}. Until it is recorded, ${N.consequence}.`)}};let A;if(n.services!==void 0){const a=ae(e,n.services,v);m.push(...a.warnings),x={...x,...a.owned},A=a.added.length>0||a.updated.length>0?{added:a.added,path:a.path,updated:a.updated}:void 0}return _.includes("DB (D1)")&&m.push(`wrote a DB binding with a placeholder database_id ("${H}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),f===d?(W(!1),{added:_,changed:!1,devConfig:A,exportGaps:i,reason:"bindings already in sync",updated:O,warnings:m,wranglerPath:o}):(z(o,f,"utf8"),W(!0),{added:_,changed:!0,devConfig:A,exportGaps:i,updated:O,warnings:m,wranglerPath:o})};export{Re as collectExportGaps,On as reconcileWranglerBindings};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{createInterface as v}from"node:readline";const y=/[\s,]+/u,u=()=>process.stdin.isTTY,d=async a=>{const e=v({input:process.stdin,output:process.stdout});try{return await new Promise(s=>{e.question(a,r=>{s(r)})})}finally{e.close()}},b=async(a,e)=>{const r=(await d(a)).trim().toLowerCase();return r===""?e?.defaultYes===!0:r==="y"||r==="yes"},S=(a="")=>u()?e=>b(`${a}${e} [Y/n] `,{defaultYes:!0}):()=>Promise.resolve(!1),T=async(a,e,s)=>{if(!u()||e.length===0)return s?.default;const r=s?.default===void 0?-1:e.findIndex(n=>n.value===s.default),f=e.map((n,t)=>` ${String(t+1)}) ${n.label}${n.description===void 0?"":` — ${n.description}`}`),m=`${a}
|
|
2
|
+
${f.join(`
|
|
3
|
+
`)}
|
|
4
|
+
> ${r>=0?`[${String(r+1)}] `:""}`,i=(await d(m)).trim();if(i==="")return s?.default;const c=Number.parseInt(i,10);return Number.isInteger(c)&&c>=1&&c<=e.length?e[c-1]?.value:e.find(n=>n.value===i||n.label.toLowerCase()===i.toLowerCase())?.value??s?.default},g=async(a,e)=>{if(!u())return e?.default;const r=(await d(a)).trim();return r===""?e?.default:r},h=async(a,e,s)=>{const r=s?.defaults??[];if(!u()||e.length===0)return[...r];const f=e.map((t,o)=>` ${String(o+1)}) ${t.label}${t.description===void 0?"":` — ${t.description}`}`),m=r.length===0?"":`[${r.join(", ")}] `,w=`${a} (comma-separated; Enter for default)
|
|
5
|
+
${f.join(`
|
|
6
|
+
`)}
|
|
7
|
+
> ${m}`,c=(await d(w)).trim();if(c==="")return[...r];const $=c.split(y).map(t=>t.trim()).filter(t=>t!==""),n=new Set;for(const t of $){const o=Number.parseInt(t,10);if(Number.isInteger(o)&&o>=1&&o<=e.length&&String(o)===t){const l=e[o-1]?.value;l!==void 0&&n.add(l);continue}const p=e.find(l=>l.value===t||l.label.toLowerCase()===t.toLowerCase());p!==void 0&&n.add(p.value)}return e.filter(t=>n.has(t.value)).map(t=>t.value)};export{S as createConfirm,u as isInteractive,h as promptMultiSelect,T as promptSelect,g as promptText,b as promptYesNo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=()=>{const e=new Map;return{clear:()=>{e.clear()},memo:(r,c)=>{if(e.has(r))return e.get(r);const t=c();return e.set(r,t),t}}};export{n as createDiscoveryCache};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as u}from"node:fs";import{modify as y,applyEdits as w}from"jsonc-parser";import{r as m,f as v,a as $}from"./lunora-manifest-DuH_Cmyu.mjs";import{findWranglerFile as x,readWranglerJsonc as C}from"./WRANGLER_FILES-UNW-xY5u.mjs";const b=(r,n)=>r.length===n.length&&r.every((e,t)=>e===n[t]),j=(r,n)=>{if(r?.lunoraIsForeign===!0)return n.push(`${r.path}: \`lunora\` is not an object, so the cron ownership record cannot be read or written — a removed cron will keep firing.`),[];const e=r?.lunora?.crons;if(e===void 0)return[];if(!Array.isArray(e))return n.push(`${r?.path??"package.json"}: \`lunora.crons\` is not an array of cron expressions — the crons it recorded are now treated as hand-written and will not be cleared.`),[];const t=e.filter(o=>typeof o=="string");return t.length!==e.length&&n.push(`${r?.path??"package.json"}: \`lunora.crons\` dropped ${String(e.length-t.length)} non-string entry(s) — anything it recorded there is now treated as hand-written and will not be cleared.`),t},k=(r,n)=>{$(r,"crons",n.length===0?void 0:[...n])},W=(r,n)=>{const e=x(r);if(!e)return{changed:!1,preserved:[],reason:"wrangler.jsonc not found",warnings:[]};const{parsed:t,text:o}=C(e);if(t===void 0)return{changed:!1,preserved:[],reason:`failed to parse ${e} as JSONC`,warnings:[],wranglerPath:e};const g=Array.isArray(t.triggers?.crons)?t.triggers.crons.filter(i=>typeof i=="string"):[],c=[...n],s=[],d=m(r),p=j(d,s),a=g.filter(i=>!c.includes(i)&&!p.includes(i)),l=[...c,...a],f=()=>{d!==void 0&&k(d,c)};if(b(g,l))return f(),{changed:!1,preserved:a,reason:"triggers.crons already in sync",warnings:s,wranglerPath:e};const h=y(o,["triggers","crons"],l,{formattingOptions:v(o)});return h.length===0?{changed:!1,preserved:a,reason:"no structural edit produced",warnings:s,wranglerPath:e}:(u(e,w(o,h),"utf8"),f(),{changed:!0,preserved:a,warnings:s,wranglerPath:e})},J=r=>r.length===0?void 0:`kept ${String(r.length)} hand-written cron trigger(s): ${r.join(", ")}`;export{J as describePreservedCrons,W as reconcileWranglerCrons};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{rmSync as s,readdirSync as c,writeFileSync as l}from"node:fs";import{join as i}from"node:path";const u=/^\.wrangler\.lunora-(?:dev|service)\.(\d+)\.\d+\.jsonc$/;let t=0;const a=e=>(t+=1,`.wrangler.lunora-${e}.${String(process.pid)}.${String(t)}.jsonc`),d=e=>{try{return process.kill(e,0),!0}catch(r){return r.code==="EPERM"}},f=e=>{let r;try{r=c(e)}catch{return}for(const o of r){const n=u.exec(o);if(!(n===null||Number(n[1])===process.pid||d(Number(n[1]))))try{s(i(e,o),{force:!0})}catch{}}},h=()=>{},g=e=>{let r=!1;return()=>{if(!r){r=!0;try{s(e,{force:!0})}catch{}}}},A=(e,r,o)=>{f(e);const n=i(e,a(r));return l(n,o,"utf8"),{cleanup:g(n),configPath:n}},w=(e,r)=>{if(!(e==null||r()))return typeof e.binding=="string"?e.binding:"AI"},v=e=>`Workers AI is off in this dev session (${e} binding left out): no Cloudflare login found, and Workers AI only runs remotely. \`@cf/…\` models will throw; AI SDK models and \`LUNORA_AI_PROXY_URL\` slugs still work. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`;export{u as STALE_DEV_CONFIG,g as createCleanup,v as describeWithheldWorkersAi,a as devConfigBasename,h as noopCleanup,f as sweepStaleDevConfigs,w as withheldWorkersAi,A as writeDevConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readProjectDependencyNames as a}from"./readProjectDependencies-l3uhUKjo.mjs";const n=[{class:"A",dependency:"@tanstack/react-start",framework:"tanstack-start"},{class:"A",dependency:"@tanstack/solid-start",framework:"tanstack-start-solid"},{class:"A",dependency:"@react-router/dev",framework:"react-router"},{class:"A",dependency:"vinext",framework:"vinext"},{class:"A",dependency:"@solidjs/start",framework:"solid-start"},{class:"A",dependency:"solid-start",framework:"solid-start"},{class:"B",dependency:"@sveltejs/kit",framework:"sveltekit"},{class:"B",dependency:"nuxt",framework:"nuxt"},{class:"B",dependency:"astro",framework:"astro"}],t={class:"C",framework:"none"},o=e=>a(e).has("lunorash"),d=e=>{const r=a(e);if(r.size===0)return t;for(const s of n)if(r.has(s.dependency))return{class:s.class,framework:s.framework};return t};export{d as detectFramework,o as projectUsesUmbrella};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as m}from"node:fs";import{Project as f}from"ts-morph";import{join as t}from"node:path";const p=(e,o,n,s,i={})=>{if(!m(t(e,o,n??"")))return{};try{const r=new f({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1,...i});return{value:s(r,t(e,o))}}catch(r){return{error:r instanceof Error?r.message:String(r)}}};export{p as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{discoverAgents as s,AGENTS_FILENAME as n}from"@lunora/codegen";import{d as i}from"./discover-info-DC2MrAIM.mjs";const v=(o,e)=>{const{error:r,value:t}=i(o,e,n,s);return r===void 0?{agents:t??[]}:{agents:[],error:r}};export{v as discoverAgentInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{discoverContainers as s,CONTAINERS_FILENAME as t}from"@lunora/codegen";import{d}from"./discover-info-DC2MrAIM.mjs";const e=(n,o)=>{const{error:r,value:i}=d(n,o,t,s,{skipFileDependencyResolution:!0});return r===void 0?{containers:i??[]}:{containers:[],error:r}},I=(n,o,r)=>r===void 0?e(n,o):r.memo(`containers:${n}:${o}`,()=>e(n,o));export{I as discoverContainerInfo};
|