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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/celld/index.mjs +1 -1
  2. package/dist/cli/index.mjs +1 -1
  3. package/dist/cloudflare/index.mjs +1 -1
  4. package/dist/index.d.mts +58 -9
  5. package/dist/index.d.ts +58 -9
  6. package/dist/index.mjs +1 -1
  7. package/dist/packem_shared/{CELLD_RELEASE_ASSETS_DIRECTORY-YBhEotjs.mjs → CELLD_RELEASE_ASSETS_DIRECTORY-D4-_Fz-I.mjs} +1 -1
  8. package/dist/packem_shared/{DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs → DEFAULT_DEPLOY_TARGET-ZGMeeKMO.mjs} +1 -1
  9. package/dist/packem_shared/DEV_BINDINGS_FILE-DaCgPGfL.mjs +4 -0
  10. package/dist/packem_shared/{DEV_WORKER_ENV_VALUE-FoysLtF0.mjs → DEV_WORKER_ENV_VALUE-BHgGdjqB.mjs} +1 -1
  11. package/dist/packem_shared/{POLICY_SCAFFOLD_ENDPOINT-BiQ1zNsR.mjs → POLICY_SCAFFOLD_ENDPOINT-CewfdPRV.mjs} +1 -1
  12. package/dist/packem_shared/{REMOTE_ELIGIBLE_KEYS-DgmXfSuu.mjs → REMOTE_ELIGIBLE_KEYS-Dpy_r2Oc.mjs} +1 -1
  13. package/dist/packem_shared/{SCHEMA_EDIT_ENDPOINT-D296PlpV.mjs → SCHEMA_EDIT_ENDPOINT-B58YfQ7N.mjs} +1 -1
  14. package/dist/packem_shared/{STUDIO_PATH-CvVcvTbQ.mjs → STUDIO_PATH-B34bprPH.mjs} +1 -1
  15. package/dist/packem_shared/{assertBuildTargetMatches-D11J7F38.mjs → assertBuildTargetMatches-CsHD_hg_.mjs} +1 -1
  16. package/dist/packem_shared/atomic-write-DA2tlY-2.mjs +1 -0
  17. package/dist/packem_shared/buildPackageSecretsBlock-Jla_XY6q.mjs +19 -0
  18. package/dist/packem_shared/{celld-config-Ef1RZ02t.mjs → celld-config-CC5YKtVa.mjs} +1 -1
  19. package/dist/packem_shared/{collectExportGaps-DvirOIVB.mjs → collectExportGaps-BIQcF5z_.mjs} +1 -1
  20. package/dist/packem_shared/describeWithheld-C9rBOaSo.mjs +1 -0
  21. package/dist/packem_shared/{emitProjectAssetHeaders-BdqdTVN3.mjs → emitProjectAssetHeaders-BPTKcmHX.mjs} +1 -1
  22. package/dist/packem_shared/ensureGitignoreEntries-DFNmLdCz.mjs +7 -0
  23. package/dist/packem_shared/gitCheckIgnore-DmE9479j.mjs +1 -0
  24. package/dist/packem_shared/{materializeServiceDevConfigs-CdmKflBp.mjs → materializeServiceDevConfigs-BYz2HqQJ.mjs} +1 -1
  25. package/dist/packem_shared/{pendingBindingChanges-DkVojIQe.mjs → pendingBindingChanges-DZmJfFPo.mjs} +1 -1
  26. package/dist/packem_shared/{reconcileWranglerBindings-D6B81UKU.mjs → reconcileWranglerBindings-BlAdgUm3.mjs} +1 -1
  27. package/dist/packem_shared/{scanWranglerVariablesForSecrets-DmdOBmwn.mjs → scanWranglerVariablesForSecrets-DSfoIIk7.mjs} +1 -1
  28. package/dist/packem_shared/{startCelldDevSession-DfuDVsha.mjs → startCelldDevSession-BHhguXmm.mjs} +1 -1
  29. package/dist/packem_shared/{wranglerCodegenInputs-B8iRZZZw.mjs → wranglerCodegenInputs-aZOJbiin.mjs} +1 -1
  30. package/dist/packem_shared/{write-atomic-9sY2z8DB.mjs → write-atomic-DL9BV55L.mjs} +1 -1
  31. package/dist/studio-host/index.mjs +1 -1
  32. package/package.json +3 -3
  33. package/dist/packem_shared/DEV_BINDINGS_FILE-BUTedHwq.mjs +0 -4
  34. package/dist/packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs +0 -19
  35. package/dist/packem_shared/describeWithheld-CN3D-4pU.mjs +0 -1
  36. package/dist/packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs +0 -7
@@ -1 +1 @@
1
- import{CELLD_RELEASE_ASSETS_DIRECTORY as A,CELLD_RELEASE_MAIN as L,celldConfigFromRelease as _}from"../packem_shared/CELLD_RELEASE_ASSETS_DIRECTORY-YBhEotjs.mjs";import{CELLD_RELEASE_BINDINGS as S,CELLD_RELEASE_BINDING_TYPES as r,CelldReleaseConfigError as l,MAX_RELEASE_ALIAS_LENGTH as o,MAX_RESOURCE_NAME as C,RELEASE_ALIAS_PATTERN as N,isReleaseAlias as I,releaseResourceName as s}from"../celld-names/index.mjs";export{A as CELLD_RELEASE_ASSETS_DIRECTORY,S as CELLD_RELEASE_BINDINGS,r as CELLD_RELEASE_BINDING_TYPES,L as CELLD_RELEASE_MAIN,l as CelldReleaseConfigError,o as MAX_RELEASE_ALIAS_LENGTH,C as MAX_RESOURCE_NAME,N as RELEASE_ALIAS_PATTERN,_ as celldConfigFromRelease,I as isReleaseAlias,s as releaseResourceName};
1
+ import{CELLD_RELEASE_ASSETS_DIRECTORY as A,CELLD_RELEASE_MAIN as L,celldConfigFromRelease as _}from"../packem_shared/CELLD_RELEASE_ASSETS_DIRECTORY-D4-_Fz-I.mjs";import{CELLD_RELEASE_BINDINGS as S,CELLD_RELEASE_BINDING_TYPES as r,CelldReleaseConfigError as l,MAX_RELEASE_ALIAS_LENGTH as o,MAX_RESOURCE_NAME as C,RELEASE_ALIAS_PATTERN as N,isReleaseAlias as I,releaseResourceName as s}from"../celld-names/index.mjs";export{A as CELLD_RELEASE_ASSETS_DIRECTORY,S as CELLD_RELEASE_BINDINGS,r as CELLD_RELEASE_BINDING_TYPES,L as CELLD_RELEASE_MAIN,l as CelldReleaseConfigError,o as MAX_RELEASE_ALIAS_LENGTH,C as MAX_RESOURCE_NAME,N as RELEASE_ALIAS_PATTERN,_ as celldConfigFromRelease,I as isReleaseAlias,s as releaseResourceName};
@@ -1 +1 @@
1
- import{AGENT_RULES_HINT as t,claimAgentRulesHint as o,detectAgentRules as a}from"../packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs";import{DEFAULT_DEPLOY_TARGET as s,deployTargetIds as l,isRunnableTarget as A,runnableTargetIds as d}from"../packem_shared/DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs";import{LUNORA_TAG as c,lunoraLine as m}from"../packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as T}from"../packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as x,detectInstalledManagers as E,detectPackageManager as i,execArgsFor as u,installArgsFor as R,runScriptCommand as _,toolchainExecArgs as L}from"../packem_shared/addArgsFor-CYZKhNIo.mjs";import{readProjectManifest as G}from"../packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{STEP_BADGE_NAMES as M}from"../packem_shared/ACCENT-CotPTfv7.mjs";export{t as AGENT_RULES_HINT,s as DEFAULT_DEPLOY_TARGET,c as LUNORA_TAG,T as LunoraReporter,M as STEP_BADGE_NAMES,x as addArgsFor,o as claimAgentRulesHint,l as deployTargetIds,a as detectAgentRules,E as detectInstalledManagers,i as detectPackageManager,u as execArgsFor,R as installArgsFor,A as isRunnableTarget,m as lunoraLine,G as readProjectManifest,_ as runScriptCommand,d as runnableTargetIds,L as toolchainExecArgs};
1
+ import{AGENT_RULES_HINT as t,claimAgentRulesHint as o,detectAgentRules as a}from"../packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs";import{DEFAULT_DEPLOY_TARGET as s,deployTargetIds as l,isRunnableTarget as A,runnableTargetIds as d}from"../packem_shared/DEFAULT_DEPLOY_TARGET-ZGMeeKMO.mjs";import{LUNORA_TAG as c,lunoraLine as m}from"../packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as T}from"../packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as x,detectInstalledManagers as E,detectPackageManager as i,execArgsFor as u,installArgsFor as R,runScriptCommand as _,toolchainExecArgs as L}from"../packem_shared/addArgsFor-CYZKhNIo.mjs";import{readProjectManifest as G}from"../packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{STEP_BADGE_NAMES as M}from"../packem_shared/ACCENT-CotPTfv7.mjs";export{t as AGENT_RULES_HINT,s as DEFAULT_DEPLOY_TARGET,c as LUNORA_TAG,T as LunoraReporter,M as STEP_BADGE_NAMES,x as addArgsFor,o as claimAgentRulesHint,l as deployTargetIds,a as detectAgentRules,E as detectInstalledManagers,i as detectPackageManager,u as execArgsFor,R as installArgsFor,A as isRunnableTarget,m as lunoraLine,G as readProjectManifest,_ as runScriptCommand,d as runnableTargetIds,L as toolchainExecArgs};
@@ -1 +1 @@
1
- import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{reconcileWranglerBindings as a}from"../packem_shared/reconcileWranglerBindings-D6B81UKU.mjs";import{assertWranglerSatisfiesSchema as n}from"../packem_shared/assertWranglerSatisfiesSchema-_70vhvqk.mjs";import{w as s}from"../packem_shared/asset-headers-CPuEX21i.mjs";import{BINDING_MANIFEST_VERSION as m,buildBindingManifest as p}from"../packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs";import{CLOUDFLARE_CLI_CONFIG_WARNING_ENV as E,detectCloudflareCliConfig as g,warnCloudflareCliConfigOnce as x}from"../packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs";import{default as c}from"../packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs";import{default as _}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{hasCloudflareCredentials as L}from"../packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs";import{describeWithheld as S,withheldBindings as D}from"../packem_shared/describeWithheld-CN3D-4pU.mjs";import{bindingsNeedingDatabase as W,startLocalHyperdrive as T}from"../packem_shared/bindingsNeedingDatabase-3KyGflIq.mjs";import{readManifest as v,recordManifestKey as B}from"../packem_shared/readManifest-Cighz3WC.mjs";import{HYPERDRIVE_PLACEHOLDER_ID as b}from"../packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{emitProjectAssetHeaders as h}from"../packem_shared/emitProjectAssetHeaders-BdqdTVN3.mjs";import{collectExportGaps as M}from"../packem_shared/collectExportGaps-DvirOIVB.mjs";import{reconcileWranglerCompatibilityDate as w}from"../packem_shared/reconcileWranglerCompatibilityDate-Cj94osA-.mjs";import{describePreservedCrons as H,reconcileWranglerCrons as U}from"../packem_shared/describePreservedCrons-i5XT6rtl.mjs";import{pendingBindingChanges as Y,reconcileBindingsSafely as K,reconcileStudioAssets as j,reconcileWranglerExtras as z}from"../packem_shared/pendingBindingChanges-DkVojIQe.mjs";import{REMOTE_ELIGIBLE_KEYS as J,injectRemoteFlags as X,isRemoteEnvEnabled as k,materializeDevWranglerConfig as q,planRemoteBindings as Z,resolveRemoteEnabled as $,toRemotePlan as ee}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DgmXfSuu.mjs";import{materializeServiceDevConfigs as oe}from"../packem_shared/materializeServiceDevConfigs-CdmKflBp.mjs";import{i as ae}from"../packem_shared/studio-assets-BKWx838V.mjs";import{default as ne}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs";import{withTailConsumer as se}from"../packem_shared/withTailConsumer-BXOIqXxv.mjs";import{WORKERS_CACHE_MIN_DATE as me,isCacheEnabled as pe}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as Ee}from"../packem_shared/wranglerCodegenInputs-B8iRZZZw.mjs";import{DEFAULT_OBSERVABILITY as xe,resolveObservabilitySampling as Ce}from"../packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{mergeWranglerEnvironment as Re}from"../packem_shared/mergeWranglerEnvironment-CxT2PV1N.mjs";import{WRANGLER_FILES as Ie,findWranglerFile as Le,readWranglerJsonc as Ae}from"../packem_shared/WRANGLER_FILES-BF8PUjuo.mjs";import{UNEXPORTED_CLASS_MARKER as De,validateWranglerProject as Oe}from"../packem_shared/UNEXPORTED_CLASS_MARKER-BZEXldUo.mjs";import{scanWranglerVariablesForSecrets as Te}from"../packem_shared/scanWranglerVariablesForSecrets-DmdOBmwn.mjs";import{wranglerToAlchemy as ve}from"../packem_shared/wranglerToAlchemy-ClIdvJFu.mjs";import{REQUIRED_COMPATIBILITY_DATE as Fe,REQUIRED_FLAG as be,validateWrangler as ue,validateWranglerConfig as he}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-BqFeetpX.mjs";export{m as BINDING_MANIFEST_VERSION,E as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,c as CLOUDFLARE_DRIVER,ne as CLOUDFLARE_TOOLCHAIN_VERSIONS,xe as DEFAULT_OBSERVABILITY,_ as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,b as HYPERDRIVE_PLACEHOLDER_ID,J as REMOTE_ELIGIBLE_KEYS,Fe as REQUIRED_COMPATIBILITY_DATE,be as REQUIRED_FLAG,De as UNEXPORTED_CLASS_MARKER,me as WORKERS_CACHE_MIN_DATE,Ie as WRANGLER_FILES,o as applyModify,n as assertWranglerSatisfiesSchema,W as bindingsNeedingDatabase,p as buildBindingManifest,M as collectExportGaps,H as describePreservedCrons,S as describeWithheld,g as detectCloudflareCliConfig,h as emitProjectAssetHeaders,Le as findWranglerFile,L as hasCloudflareCredentials,X as injectRemoteFlags,pe as isCacheEnabled,ae as isOwnedStudioAssets,k as isRemoteEnvEnabled,q as materializeDevWranglerConfig,oe as materializeServiceDevConfigs,Re as mergeWranglerEnvironment,Y as pendingBindingChanges,Z as planRemoteBindings,v as readManifest,Ae as readWranglerJsonc,K as reconcileBindingsSafely,j as reconcileStudioAssets,a as reconcileWranglerBindings,w as reconcileWranglerCompatibilityDate,U as reconcileWranglerCrons,z as reconcileWranglerExtras,B as recordManifestKey,Ce as resolveObservabilitySampling,$ as resolveRemoteEnabled,Te as scanWranglerVariablesForSecrets,T as startLocalHyperdrive,ee as toRemotePlan,ue as validateWrangler,he as validateWranglerConfig,Oe as validateWranglerProject,x as warnCloudflareCliConfigOnce,se as withTailConsumer,D as withheldBindings,Ee as wranglerCodegenInputs,ve as wranglerToAlchemy,s as writeAssetHeaders};
1
+ import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{reconcileWranglerBindings as a}from"../packem_shared/reconcileWranglerBindings-BlAdgUm3.mjs";import{assertWranglerSatisfiesSchema as n}from"../packem_shared/assertWranglerSatisfiesSchema-_70vhvqk.mjs";import{w as s}from"../packem_shared/asset-headers-CPuEX21i.mjs";import{BINDING_MANIFEST_VERSION as m,buildBindingManifest as p}from"../packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs";import{CLOUDFLARE_CLI_CONFIG_WARNING_ENV as E,detectCloudflareCliConfig as g,warnCloudflareCliConfigOnce as x}from"../packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs";import{default as c}from"../packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs";import{default as _}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{hasCloudflareCredentials as L}from"../packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs";import{describeWithheld as S,withheldBindings as D}from"../packem_shared/describeWithheld-C9rBOaSo.mjs";import{bindingsNeedingDatabase as W,startLocalHyperdrive as T}from"../packem_shared/bindingsNeedingDatabase-3KyGflIq.mjs";import{readManifest as v,recordManifestKey as B}from"../packem_shared/readManifest-Cighz3WC.mjs";import{HYPERDRIVE_PLACEHOLDER_ID as b}from"../packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{emitProjectAssetHeaders as h}from"../packem_shared/emitProjectAssetHeaders-BPTKcmHX.mjs";import{collectExportGaps as M}from"../packem_shared/collectExportGaps-BIQcF5z_.mjs";import{reconcileWranglerCompatibilityDate as w}from"../packem_shared/reconcileWranglerCompatibilityDate-Cj94osA-.mjs";import{describePreservedCrons as H,reconcileWranglerCrons as U}from"../packem_shared/describePreservedCrons-i5XT6rtl.mjs";import{pendingBindingChanges as Y,reconcileBindingsSafely as K,reconcileStudioAssets as j,reconcileWranglerExtras as z}from"../packem_shared/pendingBindingChanges-DZmJfFPo.mjs";import{REMOTE_ELIGIBLE_KEYS as J,injectRemoteFlags as X,isRemoteEnvEnabled as k,materializeDevWranglerConfig as q,planRemoteBindings as Z,resolveRemoteEnabled as $,toRemotePlan as ee}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-Dpy_r2Oc.mjs";import{materializeServiceDevConfigs as oe}from"../packem_shared/materializeServiceDevConfigs-BYz2HqQJ.mjs";import{i as ae}from"../packem_shared/studio-assets-BKWx838V.mjs";import{default as ne}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs";import{withTailConsumer as se}from"../packem_shared/withTailConsumer-BXOIqXxv.mjs";import{WORKERS_CACHE_MIN_DATE as me,isCacheEnabled as pe}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as Ee}from"../packem_shared/wranglerCodegenInputs-aZOJbiin.mjs";import{DEFAULT_OBSERVABILITY as xe,resolveObservabilitySampling as Ce}from"../packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{mergeWranglerEnvironment as Re}from"../packem_shared/mergeWranglerEnvironment-CxT2PV1N.mjs";import{WRANGLER_FILES as Ie,findWranglerFile as Le,readWranglerJsonc as Ae}from"../packem_shared/WRANGLER_FILES-BF8PUjuo.mjs";import{UNEXPORTED_CLASS_MARKER as De,validateWranglerProject as Oe}from"../packem_shared/UNEXPORTED_CLASS_MARKER-BZEXldUo.mjs";import{scanWranglerVariablesForSecrets as Te}from"../packem_shared/scanWranglerVariablesForSecrets-DSfoIIk7.mjs";import{wranglerToAlchemy as ve}from"../packem_shared/wranglerToAlchemy-ClIdvJFu.mjs";import{REQUIRED_COMPATIBILITY_DATE as Fe,REQUIRED_FLAG as be,validateWrangler as ue,validateWranglerConfig as he}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-BqFeetpX.mjs";export{m as BINDING_MANIFEST_VERSION,E as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,c as CLOUDFLARE_DRIVER,ne as CLOUDFLARE_TOOLCHAIN_VERSIONS,xe as DEFAULT_OBSERVABILITY,_ as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,b as HYPERDRIVE_PLACEHOLDER_ID,J as REMOTE_ELIGIBLE_KEYS,Fe as REQUIRED_COMPATIBILITY_DATE,be as REQUIRED_FLAG,De as UNEXPORTED_CLASS_MARKER,me as WORKERS_CACHE_MIN_DATE,Ie as WRANGLER_FILES,o as applyModify,n as assertWranglerSatisfiesSchema,W as bindingsNeedingDatabase,p as buildBindingManifest,M as collectExportGaps,H as describePreservedCrons,S as describeWithheld,g as detectCloudflareCliConfig,h as emitProjectAssetHeaders,Le as findWranglerFile,L as hasCloudflareCredentials,X as injectRemoteFlags,pe as isCacheEnabled,ae as isOwnedStudioAssets,k as isRemoteEnvEnabled,q as materializeDevWranglerConfig,oe as materializeServiceDevConfigs,Re as mergeWranglerEnvironment,Y as pendingBindingChanges,Z as planRemoteBindings,v as readManifest,Ae as readWranglerJsonc,K as reconcileBindingsSafely,j as reconcileStudioAssets,a as reconcileWranglerBindings,w as reconcileWranglerCompatibilityDate,U as reconcileWranglerCrons,z as reconcileWranglerExtras,B as recordManifestKey,Ce as resolveObservabilitySampling,$ as resolveRemoteEnabled,Te as scanWranglerVariablesForSecrets,T as startLocalHyperdrive,ee as toRemotePlan,ue as validateWrangler,he as validateWranglerConfig,Oe as validateWranglerProject,x as warnCloudflareCliConfigOnce,se as withTailConsumer,D as withheldBindings,Ee as wranglerCodegenInputs,ve as wranglerToAlchemy,s as writeAssetHeaders};
package/dist/index.d.mts CHANGED
@@ -450,6 +450,14 @@ declare const DEV_LOG_FILE_ENV = "LUNORA_DEV_LOG_FILE";
450
450
  * URL + PID.
451
451
  */
452
452
  declare const DEV_HANDOFF_ENV = "LUNORA_DEV_HANDOFF_PID";
453
+ /**
454
+ * Env carrying the PID of the background launcher (`lunora dev --background`) down
455
+ * to every server process it starts, through a daemon if there is one, unlike
456
+ * {@link DEV_HANDOFF_ENV}, which names only the direct parent. A server records it
457
+ * as {@link DevServerState.launcherPid}, so the launcher can tell its own server's
458
+ * record from another launch's when it cleans up after a failed start.
459
+ */
460
+ declare const DEV_LAUNCHER_ENV = "LUNORA_DEV_LAUNCHER_PID";
453
461
  /** How the recorded dev server runs. */
454
462
  type DevServerMode = "cli" | "vite";
455
463
  /** The state record persisted to `.lunora/dev.json`. */
@@ -457,9 +465,19 @@ interface DevServerState {
457
465
  /** Whether the server was detached into the background (`lunora dev --background`). */
458
466
  background?: boolean;
459
467
  /**
460
- * PID of the background launcher that wrote a provisional record. It stays when
461
- * the launcher re-points `pid` at its child, so only that launcher's handoff
462
- * (see {@link DEV_HANDOFF_ENV}) replaces the record, never another launch's child.
468
+ * ISO-8601 stamp set when a reader found this background server's process gone.
469
+ * Its crash and log are only reported by `lunora dev status`, a start, `stop` and
470
+ * the MCP status tool, so a reader that cannot report it (`view`, `logs`, the
471
+ * MCP server's URL lookup) keeps the record for them instead of deleting it. A
472
+ * stamped record never reads as live again, even once its pid is recycled.
473
+ */
474
+ exitedAt?: string;
475
+ /**
476
+ * PID of the background launcher behind this record: the one that wrote a
477
+ * provisional record, kept when it re-points `pid` at its child, so only that
478
+ * launcher's handoff (see {@link DEV_HANDOFF_ENV}) replaces the record, never
479
+ * another launch's child. A server that launcher started records it too (see
480
+ * {@link DEV_LAUNCHER_ENV}), so a failed start removes only its own server's record.
463
481
  */
464
482
  launcherPid?: number;
465
483
  /** Absolute path of the log file capturing the server's output, when captured. */
@@ -530,6 +548,7 @@ declare const isProcessAlive: (pid: number) => boolean;
530
548
  * record is written, so a process that started after `startedAt` (+ skew) is
531
549
  * a recycled PID wearing the corpse's number. The start-time check runs only
532
550
  * where the platform exposes it (Linux); elsewhere liveness alone decides.
551
+ * A record stamped {@link DevServerState.exitedAt} is never current.
533
552
  */
534
553
  declare const isRecordedProcessCurrent: (state: DevServerState) => boolean;
535
554
  /**
@@ -542,7 +561,9 @@ declare const readDevServerState: (projectRoot: string) => DevServerState | unde
542
561
  * Write the state record to `.lunora/dev.json`, creating the `.lunora/`
543
562
  * directory when absent. Returns the absolute path written, or `undefined`
544
563
  * when the write failed (state is convenience metadata — a read-only checkout
545
- * must never crash dev startup).
564
+ * must never crash dev startup). The write goes through a temp file and a
565
+ * rename: `status` polls this file while servers write it, and an in-place
566
+ * write could be read half-done or, interrupted, lose a crash record.
546
567
  */
547
568
  declare const writeDevServerState: (projectRoot: string, state: DevServerState) => string | undefined;
548
569
  /**
@@ -581,14 +602,21 @@ declare const devServerPhase: (state: Pick<DevServerState, "provisional" | "read
581
602
  declare const clearDevServerState: (projectRoot: string, expectedPid?: number) => void;
582
603
  /**
583
604
  * The state record of a dev server that is verifiably running right now, or
584
- * `undefined`. A record whose PID is dead — or recycled onto a different
585
- * process (see {@link isRecordedProcessCurrent}) — is stale: it is cleared on
586
- * the spot so subsequent starts don't keep re-reading a corpse.
605
+ * `undefined`. A record whose PID is dead, or recycled onto a different process
606
+ * (see {@link isRecordedProcessCurrent}), is stale. A stale background record is
607
+ * stamped {@link DevServerState.exitedAt} and kept, so the crash still reaches the
608
+ * next `status` or start; any other stale record is removed.
587
609
  */
588
610
  declare const readLiveDevServerState: (projectRoot: string) => DevServerState | undefined;
589
611
  /** Result of {@link claimDevServerState}: claimed, or lost to the live server already recorded. */
590
612
  interface ClaimDevServerStateResult {
591
- /** The live record that won the race, when `ok` is `false`. */
613
+ /**
614
+ * `true` when both exclusive creates lost to records that died as fast as they
615
+ * appeared: other starts are racing for the file. Absent when the file merely
616
+ * could not be written, which a read-only checkout must be able to live with.
617
+ */
618
+ contended?: boolean;
619
+ /** The live record that won the race, when `ok` is `false`; absent when the file could not be claimed at all. */
592
620
  existing?: DevServerState;
593
621
  /** Whether this process now owns the record. */
594
622
  ok: boolean;
@@ -733,11 +761,32 @@ declare const ensureDevWorkerEnv: (projectRoot: string, info: (message: string)
733
761
  * it sits below every pattern that would otherwise catch its file. An appended
734
762
  * pattern lands BELOW whatever the file already had, so when anything is
735
763
  * appended every negation in `patterns` is re-stated after the additions.
764
+ *
765
+ * The lines are appended, never written over the file: an edit landing between
766
+ * this read and the write survives. Two such calls racing can append the block
767
+ * twice, which git reads the same as once.
736
768
  * @param directory The directory whose `.gitignore` is ensured; the patterns are relative to it.
737
769
  * @param patterns The `.gitignore` lines the directory must carry.
738
770
  * @returns The patterns appended, empty when the file already covered them all.
739
771
  */
740
772
  declare const ensureGitignoreEntries: (directory: string, patterns: ReadonlyArray<string>) => string[];
773
+ /** Git's answer for one path: `unknown` outside a repository or without git, `timed-out` when git did not answer in time. */
774
+ type GitIgnoreStatus = "ignored" | "not-ignored" | "timed-out" | "unknown";
775
+ /**
776
+ * Ask git whether `path` is ignored, counting every ignore source it reads (each
777
+ * `.gitignore` up the tree, `.git/info/exclude`, the global excludes file).
778
+ *
779
+ * `noIndex` decides what a TRACKED file reads as. Without it git reports a tracked
780
+ * file as not ignored whatever the patterns say, which is the right answer before
781
+ * writing a secret into it. With it the patterns alone decide, which is the right
782
+ * answer for a temp file that is about to be created.
783
+ * @param path The file to ask about; git runs in its folder.
784
+ * @param options How git is asked.
785
+ * @param options.noIndex Pass `--no-index`, so a tracked file reads by its patterns alone.
786
+ */
787
+ declare const gitCheckIgnore: (path: string, options: {
788
+ noIndex: boolean;
789
+ }) => GitIgnoreStatus;
741
790
  /** Directory holding per-checkout Lunora state (gitignored by convention). */
742
791
  declare const LINKED_PROJECT_DIR = ".lunora";
743
792
  /** The canonical link filename, relative to the project root. */
@@ -1473,4 +1522,4 @@ type ParseSchemaResult = {
1473
1522
  * message per failure mode without throwing.
1474
1523
  */
1475
1524
  declare const parseSchema: (source: string) => ParseSchemaResult;
1476
- export { AGENT_MODE_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BUILD_ROOT_ENV, BUILD_TARGET_ENV, BUNDLE_META_PATH_ENV, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type CelldToolchainProbe, type CelldToolchainProbeOptions, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_BUNDLE_META_PATH, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DestructiveEdit, type DetectedFramework, type DevEnvCheck, type DevEnvCheckOptions, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerPhase, type DevServerState, type DevTriggerHint, type DevTriggerHintOptions, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DiscoveryCache, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type EnvKeyFailure, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LAZY_FUNCTIONS_ENV, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LocalWorkerEnv, type LocalWorkerEnvOptions, type LunoraFormattedLine, type LunoraLineLevel, type MarkedApiSpec, MissingBuildOutputError, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, type PostCodegenHookResult, type RemotePreference, STRICT_ADVISORIES_ENV, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, acceptsConnection, applyAdditiveEdit, applyLintIgnores, assertBuildTargetMatches, blockingFindingsMessage, buildPackageSecretsBlock, canonicalPath, checkDevEnv, claimDevServerState, classifyEdit, clearApiSpecMarker, clearDevServerState, createConfirm, describeDevEnvCheck, detectAiAgent, detectFramework, detectLintTools, devServerPhase, devTriggerHints, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, ensureGitignoreEntries, escapeRegExp, fillDevSecrets, formatDevBannerRow, formatLunoraEvent, generateSecretValue, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isLazyFunctionsEnabled, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, mintableSecretKeysFor, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, probeCelldToolchain, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readApiSpecMarker, readDevServerState, readDevVariablesRecord, readLinkedProject, readLiveDevServerState, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveLazyFunctions, resolveLocalWorkerEnv, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, updateDevServerState, upsertDevVariableLine, wranglerDotenvFiles, writeApiSpecMarker, writeCelldDevProjection, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1525
+ export { AGENT_MODE_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BUILD_ROOT_ENV, BUILD_TARGET_ENV, BUNDLE_META_PATH_ENV, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type CelldToolchainProbe, type CelldToolchainProbeOptions, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_BUNDLE_META_PATH, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LAUNCHER_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DestructiveEdit, type DetectedFramework, type DevEnvCheck, type DevEnvCheckOptions, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerPhase, type DevServerState, type DevTriggerHint, type DevTriggerHintOptions, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DiscoveryCache, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type EnvKeyFailure, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type GitIgnoreStatus, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LAZY_FUNCTIONS_ENV, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LocalWorkerEnv, type LocalWorkerEnvOptions, type LunoraFormattedLine, type LunoraLineLevel, type MarkedApiSpec, MissingBuildOutputError, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, type PostCodegenHookResult, type RemotePreference, STRICT_ADVISORIES_ENV, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, acceptsConnection, applyAdditiveEdit, applyLintIgnores, assertBuildTargetMatches, blockingFindingsMessage, buildPackageSecretsBlock, canonicalPath, checkDevEnv, claimDevServerState, classifyEdit, clearApiSpecMarker, clearDevServerState, createConfirm, describeDevEnvCheck, detectAiAgent, detectFramework, detectLintTools, devServerPhase, devTriggerHints, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, ensureGitignoreEntries, escapeRegExp, fillDevSecrets, formatDevBannerRow, formatLunoraEvent, generateSecretValue, gitCheckIgnore, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isLazyFunctionsEnabled, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, mintableSecretKeysFor, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, probeCelldToolchain, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readApiSpecMarker, readDevServerState, readDevVariablesRecord, readLinkedProject, readLiveDevServerState, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveLazyFunctions, resolveLocalWorkerEnv, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, updateDevServerState, upsertDevVariableLine, wranglerDotenvFiles, writeApiSpecMarker, writeCelldDevProjection, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
package/dist/index.d.ts CHANGED
@@ -450,6 +450,14 @@ declare const DEV_LOG_FILE_ENV = "LUNORA_DEV_LOG_FILE";
450
450
  * URL + PID.
451
451
  */
452
452
  declare const DEV_HANDOFF_ENV = "LUNORA_DEV_HANDOFF_PID";
453
+ /**
454
+ * Env carrying the PID of the background launcher (`lunora dev --background`) down
455
+ * to every server process it starts, through a daemon if there is one, unlike
456
+ * {@link DEV_HANDOFF_ENV}, which names only the direct parent. A server records it
457
+ * as {@link DevServerState.launcherPid}, so the launcher can tell its own server's
458
+ * record from another launch's when it cleans up after a failed start.
459
+ */
460
+ declare const DEV_LAUNCHER_ENV = "LUNORA_DEV_LAUNCHER_PID";
453
461
  /** How the recorded dev server runs. */
454
462
  type DevServerMode = "cli" | "vite";
455
463
  /** The state record persisted to `.lunora/dev.json`. */
@@ -457,9 +465,19 @@ interface DevServerState {
457
465
  /** Whether the server was detached into the background (`lunora dev --background`). */
458
466
  background?: boolean;
459
467
  /**
460
- * PID of the background launcher that wrote a provisional record. It stays when
461
- * the launcher re-points `pid` at its child, so only that launcher's handoff
462
- * (see {@link DEV_HANDOFF_ENV}) replaces the record, never another launch's child.
468
+ * ISO-8601 stamp set when a reader found this background server's process gone.
469
+ * Its crash and log are only reported by `lunora dev status`, a start, `stop` and
470
+ * the MCP status tool, so a reader that cannot report it (`view`, `logs`, the
471
+ * MCP server's URL lookup) keeps the record for them instead of deleting it. A
472
+ * stamped record never reads as live again, even once its pid is recycled.
473
+ */
474
+ exitedAt?: string;
475
+ /**
476
+ * PID of the background launcher behind this record: the one that wrote a
477
+ * provisional record, kept when it re-points `pid` at its child, so only that
478
+ * launcher's handoff (see {@link DEV_HANDOFF_ENV}) replaces the record, never
479
+ * another launch's child. A server that launcher started records it too (see
480
+ * {@link DEV_LAUNCHER_ENV}), so a failed start removes only its own server's record.
463
481
  */
464
482
  launcherPid?: number;
465
483
  /** Absolute path of the log file capturing the server's output, when captured. */
@@ -530,6 +548,7 @@ declare const isProcessAlive: (pid: number) => boolean;
530
548
  * record is written, so a process that started after `startedAt` (+ skew) is
531
549
  * a recycled PID wearing the corpse's number. The start-time check runs only
532
550
  * where the platform exposes it (Linux); elsewhere liveness alone decides.
551
+ * A record stamped {@link DevServerState.exitedAt} is never current.
533
552
  */
534
553
  declare const isRecordedProcessCurrent: (state: DevServerState) => boolean;
535
554
  /**
@@ -542,7 +561,9 @@ declare const readDevServerState: (projectRoot: string) => DevServerState | unde
542
561
  * Write the state record to `.lunora/dev.json`, creating the `.lunora/`
543
562
  * directory when absent. Returns the absolute path written, or `undefined`
544
563
  * when the write failed (state is convenience metadata — a read-only checkout
545
- * must never crash dev startup).
564
+ * must never crash dev startup). The write goes through a temp file and a
565
+ * rename: `status` polls this file while servers write it, and an in-place
566
+ * write could be read half-done or, interrupted, lose a crash record.
546
567
  */
547
568
  declare const writeDevServerState: (projectRoot: string, state: DevServerState) => string | undefined;
548
569
  /**
@@ -581,14 +602,21 @@ declare const devServerPhase: (state: Pick<DevServerState, "provisional" | "read
581
602
  declare const clearDevServerState: (projectRoot: string, expectedPid?: number) => void;
582
603
  /**
583
604
  * The state record of a dev server that is verifiably running right now, or
584
- * `undefined`. A record whose PID is dead — or recycled onto a different
585
- * process (see {@link isRecordedProcessCurrent}) — is stale: it is cleared on
586
- * the spot so subsequent starts don't keep re-reading a corpse.
605
+ * `undefined`. A record whose PID is dead, or recycled onto a different process
606
+ * (see {@link isRecordedProcessCurrent}), is stale. A stale background record is
607
+ * stamped {@link DevServerState.exitedAt} and kept, so the crash still reaches the
608
+ * next `status` or start; any other stale record is removed.
587
609
  */
588
610
  declare const readLiveDevServerState: (projectRoot: string) => DevServerState | undefined;
589
611
  /** Result of {@link claimDevServerState}: claimed, or lost to the live server already recorded. */
590
612
  interface ClaimDevServerStateResult {
591
- /** The live record that won the race, when `ok` is `false`. */
613
+ /**
614
+ * `true` when both exclusive creates lost to records that died as fast as they
615
+ * appeared: other starts are racing for the file. Absent when the file merely
616
+ * could not be written, which a read-only checkout must be able to live with.
617
+ */
618
+ contended?: boolean;
619
+ /** The live record that won the race, when `ok` is `false`; absent when the file could not be claimed at all. */
592
620
  existing?: DevServerState;
593
621
  /** Whether this process now owns the record. */
594
622
  ok: boolean;
@@ -733,11 +761,32 @@ declare const ensureDevWorkerEnv: (projectRoot: string, info: (message: string)
733
761
  * it sits below every pattern that would otherwise catch its file. An appended
734
762
  * pattern lands BELOW whatever the file already had, so when anything is
735
763
  * appended every negation in `patterns` is re-stated after the additions.
764
+ *
765
+ * The lines are appended, never written over the file: an edit landing between
766
+ * this read and the write survives. Two such calls racing can append the block
767
+ * twice, which git reads the same as once.
736
768
  * @param directory The directory whose `.gitignore` is ensured; the patterns are relative to it.
737
769
  * @param patterns The `.gitignore` lines the directory must carry.
738
770
  * @returns The patterns appended, empty when the file already covered them all.
739
771
  */
740
772
  declare const ensureGitignoreEntries: (directory: string, patterns: ReadonlyArray<string>) => string[];
773
+ /** Git's answer for one path: `unknown` outside a repository or without git, `timed-out` when git did not answer in time. */
774
+ type GitIgnoreStatus = "ignored" | "not-ignored" | "timed-out" | "unknown";
775
+ /**
776
+ * Ask git whether `path` is ignored, counting every ignore source it reads (each
777
+ * `.gitignore` up the tree, `.git/info/exclude`, the global excludes file).
778
+ *
779
+ * `noIndex` decides what a TRACKED file reads as. Without it git reports a tracked
780
+ * file as not ignored whatever the patterns say, which is the right answer before
781
+ * writing a secret into it. With it the patterns alone decide, which is the right
782
+ * answer for a temp file that is about to be created.
783
+ * @param path The file to ask about; git runs in its folder.
784
+ * @param options How git is asked.
785
+ * @param options.noIndex Pass `--no-index`, so a tracked file reads by its patterns alone.
786
+ */
787
+ declare const gitCheckIgnore: (path: string, options: {
788
+ noIndex: boolean;
789
+ }) => GitIgnoreStatus;
741
790
  /** Directory holding per-checkout Lunora state (gitignored by convention). */
742
791
  declare const LINKED_PROJECT_DIR = ".lunora";
743
792
  /** The canonical link filename, relative to the project root. */
@@ -1473,4 +1522,4 @@ type ParseSchemaResult = {
1473
1522
  * message per failure mode without throwing.
1474
1523
  */
1475
1524
  declare const parseSchema: (source: string) => ParseSchemaResult;
1476
- export { AGENT_MODE_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BUILD_ROOT_ENV, BUILD_TARGET_ENV, BUNDLE_META_PATH_ENV, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type CelldToolchainProbe, type CelldToolchainProbeOptions, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_BUNDLE_META_PATH, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DestructiveEdit, type DetectedFramework, type DevEnvCheck, type DevEnvCheckOptions, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerPhase, type DevServerState, type DevTriggerHint, type DevTriggerHintOptions, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DiscoveryCache, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type EnvKeyFailure, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LAZY_FUNCTIONS_ENV, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LocalWorkerEnv, type LocalWorkerEnvOptions, type LunoraFormattedLine, type LunoraLineLevel, type MarkedApiSpec, MissingBuildOutputError, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, type PostCodegenHookResult, type RemotePreference, STRICT_ADVISORIES_ENV, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, acceptsConnection, applyAdditiveEdit, applyLintIgnores, assertBuildTargetMatches, blockingFindingsMessage, buildPackageSecretsBlock, canonicalPath, checkDevEnv, claimDevServerState, classifyEdit, clearApiSpecMarker, clearDevServerState, createConfirm, describeDevEnvCheck, detectAiAgent, detectFramework, detectLintTools, devServerPhase, devTriggerHints, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, ensureGitignoreEntries, escapeRegExp, fillDevSecrets, formatDevBannerRow, formatLunoraEvent, generateSecretValue, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isLazyFunctionsEnabled, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, mintableSecretKeysFor, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, probeCelldToolchain, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readApiSpecMarker, readDevServerState, readDevVariablesRecord, readLinkedProject, readLiveDevServerState, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveLazyFunctions, resolveLocalWorkerEnv, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, updateDevServerState, upsertDevVariableLine, wranglerDotenvFiles, writeApiSpecMarker, writeCelldDevProjection, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
1525
+ export { AGENT_MODE_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BUILD_ROOT_ENV, BUILD_TARGET_ENV, BUNDLE_META_PATH_ENV, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type CelldToolchainProbe, type CelldToolchainProbeOptions, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_BUNDLE_META_PATH, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LAUNCHER_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DestructiveEdit, type DetectedFramework, type DevEnvCheck, type DevEnvCheckOptions, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerPhase, type DevServerState, type DevTriggerHint, type DevTriggerHintOptions, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DiscoveryCache, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type EnvKeyFailure, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type GitIgnoreStatus, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LAZY_FUNCTIONS_ENV, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LocalWorkerEnv, type LocalWorkerEnvOptions, type LunoraFormattedLine, type LunoraLineLevel, type MarkedApiSpec, MissingBuildOutputError, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, type PostCodegenHookResult, type RemotePreference, STRICT_ADVISORIES_ENV, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, acceptsConnection, applyAdditiveEdit, applyLintIgnores, assertBuildTargetMatches, blockingFindingsMessage, buildPackageSecretsBlock, canonicalPath, checkDevEnv, claimDevServerState, classifyEdit, clearApiSpecMarker, clearDevServerState, createConfirm, describeDevEnvCheck, detectAiAgent, detectFramework, detectLintTools, devServerPhase, devTriggerHints, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, ensureGitignoreEntries, escapeRegExp, fillDevSecrets, formatDevBannerRow, formatLunoraEvent, generateSecretValue, gitCheckIgnore, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isLazyFunctionsEnabled, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, mintableSecretKeysFor, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, probeCelldToolchain, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readApiSpecMarker, readDevServerState, readDevVariablesRecord, readLinkedProject, readLiveDevServerState, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveLazyFunctions, resolveLocalWorkerEnv, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, updateDevServerState, upsertDevVariableLine, wranglerDotenvFiles, writeApiSpecMarker, writeCelldDevProjection, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as s,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as c,LUNORA_SKILL_NAMES as l,ROOT_SKILL_NAME as _,claimAgentRulesHint as p,detectAgentRules as D}from"./packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs";import{clearApiSpecMarker as m,readApiSpecMarker as A,writeApiSpecMarker as f}from"./packem_shared/clearApiSpecMarker-DMGpP41V.mjs";import{MissingBuildOutputError as v}from"./packem_shared/MissingBuildOutputError-BAyekzof.mjs";import{default as N}from"./packem_shared/canonicalPath-DrfMiT3U.mjs";import{probeCelldToolchain as T}from"./packem_shared/probeCelldToolchain-DxDttfHy.mjs";import{startCelldDevSession as g,writeCelldDevProjection as V}from"./packem_shared/startCelldDevSession-DfuDVsha.mjs";import{D1_PLACEHOLDER_ID as u}from"./packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{BUILD_ROOT_ENV as P,BUILD_TARGET_ENV as C,BUNDLE_META_PATH_ENV as F,CODEGEN_ENV as M,DEFAULT_BUNDLE_META_PATH as U,LAZY_FUNCTIONS_ENV as B,STRICT_ADVISORIES_ENV as G,isCodegenDisabled as b,isLazyFunctionsEnabled as y,resolveLazyFunctions as k}from"./packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{discoverContainerInfo as w}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as H}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as W,projectUsesUmbrella as Y}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{checkDevEnv as z,describeDevEnvCheck as q}from"./packem_shared/checkDevEnv-BwZSVBbB.mjs";import{acceptsConnection as Z,startDevProcess as Q}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as ee,DEV_DAEMON_ENV as re,DEV_HANDOFF_ENV as oe,DEV_LOG_FILE as te,DEV_LOG_FILE_ENV as ae,DEV_STATE_DIR as Ee,DEV_STATE_FILE as ie,claimDevServerState as se,clearDevServerState as ne,devServerPhase as ce,isDevServerReady as le,isProcessAlive as _e,isRecordedProcessCurrent as pe,readDevServerState as De,readLiveDevServerState as de,updateDevServerState as me,writeDevServerState as Ae}from"./packem_shared/DEV_BINDINGS_FILE-BUTedHwq.mjs";import{devTriggerHints as Se,formatDevBannerRow as ve}from"./packem_shared/devTriggerHints-CN_RJxWW.mjs";import{DEV_VARS_EXAMPLE_FILE as Ne,DEV_VARS_FILE as Re,DEV_VARS_KEY_PATTERN as Te,escapeRegExp as xe,parseDevVariableEntries as ge,readDevVariablesRecord as Ve,removeDevVariableLine as Ie,upsertDevVariableLine as ue,wranglerDotenvFiles as Oe}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{DEV_WORKER_ENV_VALUE as Ce,DEV_WORKER_ENV_VAR as Fe,ensureDevWorkerEnv as Me}from"./packem_shared/DEV_WORKER_ENV_VALUE-FoysLtF0.mjs";import{createDiscoveryCache as Be}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as be,deployTargetIds as ye,isRunnableTarget as ke,planToolchainInvocation as he,resolveDeployDriver as we,runnableTargetIds as je,targetRunsOwnDevServer as He}from"./packem_shared/DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs";import{default as We}from"./packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs";import{inferLunoraBindings as Je,secretSourcesFromBindings as ze}from"./packem_shared/inferLunoraBindings-BUk28bSQ.mjs";import{LINKED_PROJECT_DIR as Xe,LINKED_PROJECT_FILE as Ze,readLinkedProject as Qe,writeLinkedProject as $e}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as rr,applyLintIgnores as or,detectLintTools as tr}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{resolveLocalWorkerEnv as Er}from"./packem_shared/resolveLocalWorkerEnv-C1s-quRt.mjs";import{blockingFindingsMessage as sr,reportCodegenFindings as nr}from"./packem_shared/blockingFindingsMessage-BQ9z7cie.mjs";import{LUNORA_EVENT_SOURCE as lr,formatLunoraEvent as _r}from"./packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs";import{LUNORA_TAG as Dr,advisoryLine as dr,lunoraLine as mr}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as fr}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as vr,detectInstalledManagers as Lr,detectPackageManager as Nr,execArgsFor as Rr,installArgsFor as Tr,runScriptArgsFor as xr,runScriptCommand as gr,toolchainExecArgs as Vr}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{PACKAGE_SECRETS_REGISTRY as ur,mintableSecretKeysFor as Or,secretsForPackages as Pr}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs";import{runPostCodegenHook as Fr}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{assertBuildTargetMatches as Ur,interpretRemote as Br,readProjectRemotePreference as Gr,readProjectTarget as br,resolveProjectTarget as yr,resolveTargetOrThrow as kr}from"./packem_shared/assertBuildTargetMatches-D11J7F38.mjs";import{readProjectDependencies as wr,readProjectDependencyNames as jr,readProjectManifest as Hr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as Wr,isInteractive as Yr,promptMultiSelect as Jr,promptSelect as zr,promptText as qr,promptYesNo as Xr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as Qr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as eo,ensureDevVariables as ro,ensureDevVarsExample as oo,fillDevSecrets as to,generateSecretValue as ao,isMintableSecretKey as Eo,isPlaceholderValue as io,planDevSecretsFill as so,planDevVariablesAugment as no,planDevVariablesScaffold as co,requiredSecrets as lo,writeDevVariablesFileAtomically as _o}from"./packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs";import{applyAdditiveEdit as Do,classifyEdit as mo}from"./packem_shared/applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as fo}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as vo,resolveServerModule as Lo,scaffoldPolicyFile as No,wireRlsIntoProcedure as Ro}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as xo}from"./packem_shared/discoverSchemaInfo-DRPnqgif.mjs";import{ACCENT as Vo,BADGES as Io,BADGE_COLUMN_WIDTH as uo,LUNA_ART as Oo,LUNA_BUNNY as Po,LUNA_NAME as Co,LUNA_SIGNOFF as Fo,STEP_BADGE_NAMES as Mo,badgeLead as Uo,badgeWidth as Bo,padBadge as Go,paintAnswer as bo,paintBadge as yo}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as ho,DURABLE_OBJECT_BINDINGS as wo,GENERATED_CLASS_MODULES as jo,GENERATED_MODULE_DURABLE_OBJECTS as Ho,MERGED_DURABLE_OBJECTS_MODULE as Ko,isMergedProject as Wo,isMergedRoleModule as Yo}from"./packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{discoverWorkflowInfo as zo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";import{ENV_FILENAME as Xo}from"@lunora/codegen";export{Vo as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,n as AGENT_RULES_HINT,c as AGENT_RULES_HINT_ENV,Io as BADGES,uo as BADGE_COLUMN_WIDTH,P as BUILD_ROOT_ENV,C as BUILD_TARGET_ENV,F as BUNDLE_META_PATH_ENV,M as CODEGEN_ENV,ho as COMPOSED_WORKER_ENTRY,u as D1_PLACEHOLDER_ID,U as DEFAULT_BUNDLE_META_PATH,be as DEFAULT_DEPLOY_TARGET,ee as DEV_BINDINGS_FILE,re as DEV_DAEMON_ENV,oe as DEV_HANDOFF_ENV,te as DEV_LOG_FILE,ae as DEV_LOG_FILE_ENV,Ee as DEV_STATE_DIR,ie as DEV_STATE_FILE,Ne as DEV_VARS_EXAMPLE_FILE,Re as DEV_VARS_FILE,Te as DEV_VARS_KEY_PATTERN,Ce as DEV_WORKER_ENV_VALUE,Fe as DEV_WORKER_ENV_VAR,wo as DURABLE_OBJECT_BINDINGS,Xo as ENV_FILENAME,jo as GENERATED_CLASS_MODULES,Ho as GENERATED_MODULE_DURABLE_OBJECTS,B as LAZY_FUNCTIONS_ENV,Xe as LINKED_PROJECT_DIR,Ze as LINKED_PROJECT_FILE,Oo as LUNA_ART,Po as LUNA_BUNNY,Co as LUNA_NAME,Fo as LUNA_SIGNOFF,lr as LUNORA_EVENT_SOURCE,rr as LUNORA_IGNORED_PATHS,l as LUNORA_SKILL_NAMES,Dr as LUNORA_TAG,fr as LunoraReporter,Ko as MERGED_DURABLE_OBJECTS_MODULE,v as MissingBuildOutputError,ur as PACKAGE_SECRETS_REGISTRY,_ as ROOT_SKILL_NAME,Mo as STEP_BADGE_NAMES,G as STRICT_ADVISORIES_ENV,Z as acceptsConnection,vr as addArgsFor,dr as advisoryLine,Do as applyAdditiveEdit,or as applyLintIgnores,Ur as assertBuildTargetMatches,Uo as badgeLead,Bo as badgeWidth,sr as blockingFindingsMessage,eo as buildPackageSecretsBlock,N as canonicalPath,z as checkDevEnv,p as claimAgentRulesHint,se as claimDevServerState,mo as classifyEdit,vo as classifyPolicyEdit,m as clearApiSpecMarker,ne as clearDevServerState,Wr as createConfirm,Be as createDiscoveryCache,ye as deployTargetIds,q as describeDevEnvCheck,D as detectAgentRules,t as detectAiAgent,W as detectFramework,Lr as detectInstalledManagers,tr as detectLintTools,Nr as detectPackageManager,ce as devServerPhase,Se as devTriggerHints,E as discoverAgentInfo,w as discoverContainerInfo,xo as discoverSchemaInfo,zo as discoverWorkflowInfo,ro as ensureDevVariables,oo as ensureDevVarsExample,Me as ensureDevWorkerEnv,We as ensureGitignoreEntries,xe as escapeRegExp,Rr as execArgsFor,to as fillDevSecrets,ve as formatDevBannerRow,_r as formatLunoraEvent,ao as generateSecretValue,Je as inferLunoraBindings,Tr as installArgsFor,Br as interpretRemote,b as isCodegenDisabled,le as isDevServerReady,Yr as isInteractive,y as isLazyFunctionsEnabled,Wo as isMergedProject,Yo as isMergedRoleModule,Eo as isMintableSecretKey,io as isPlaceholderValue,_e as isProcessAlive,pe as isRecordedProcessCurrent,ke as isRunnableTarget,mr as lunoraLine,Or as mintableSecretKeysFor,Go as padBadge,bo as paintAnswer,yo as paintBadge,ge as parseDevVariableEntries,fo as parseSchema,so as planDevSecretsFill,no as planDevVariablesAugment,co as planDevVariablesScaffold,he as planToolchainInvocation,T as probeCelldToolchain,Y as projectUsesUmbrella,Jr as promptMultiSelect,zr as promptSelect,qr as promptText,Xr as promptYesNo,A as readApiSpecMarker,De as readDevServerState,Ve as readDevVariablesRecord,Qe as readLinkedProject,de as readLiveDevServerState,wr as readProjectDependencies,jr as readProjectDependencyNames,Hr as readProjectManifest,Gr as readProjectRemotePreference,br as readProjectTarget,Ie as removeDevVariableLine,nr as reportCodegenFindings,lo as requiredSecrets,we as resolveDeployDriver,k as resolveLazyFunctions,Er as resolveLocalWorkerEnv,yr as resolveProjectTarget,Qr as resolveSchemaDirectory,Lo as resolveServerModule,kr as resolveTargetOrThrow,Fr as runPostCodegenHook,xr as runScriptArgsFor,gr as runScriptCommand,je as runnableTargetIds,No as scaffoldPolicyFile,ze as secretSourcesFromBindings,Pr as secretsForPackages,g as startCelldDevSession,Q as startDevProcess,H as streamContainerLogs,He as targetRunsOwnDevServer,Vr as toolchainExecArgs,me as updateDevServerState,ue as upsertDevVariableLine,Ro as wireRlsIntoProcedure,Oe as wranglerDotenvFiles,f as writeApiSpecMarker,V as writeCelldDevProjection,Ae as writeDevServerState,_o as writeDevVariablesFileAtomically,$e as writeLinkedProject};
1
+ import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as s,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-Bd6JPtNa.mjs";import{clearApiSpecMarker as m,readApiSpecMarker as A,writeApiSpecMarker as f}from"./packem_shared/clearApiSpecMarker-DMGpP41V.mjs";import{MissingBuildOutputError as L}from"./packem_shared/MissingBuildOutputError-BAyekzof.mjs";import{default as N}from"./packem_shared/canonicalPath-DrfMiT3U.mjs";import{probeCelldToolchain as T}from"./packem_shared/probeCelldToolchain-DxDttfHy.mjs";import{startCelldDevSession as g,writeCelldDevProjection as V}from"./packem_shared/startCelldDevSession-BHhguXmm.mjs";import{D1_PLACEHOLDER_ID as u}from"./packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{BUILD_ROOT_ENV as P,BUILD_TARGET_ENV as C,BUNDLE_META_PATH_ENV as F,CODEGEN_ENV as M,DEFAULT_BUNDLE_META_PATH as U,LAZY_FUNCTIONS_ENV as B,STRICT_ADVISORIES_ENV as G,isCodegenDisabled as b,isLazyFunctionsEnabled as k,resolveLazyFunctions as y}from"./packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{discoverContainerInfo as w}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as j}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as W,projectUsesUmbrella as Y}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{checkDevEnv as z,describeDevEnvCheck as q}from"./packem_shared/checkDevEnv-BwZSVBbB.mjs";import{acceptsConnection as Z,startDevProcess as Q}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as ee,DEV_DAEMON_ENV as re,DEV_HANDOFF_ENV as oe,DEV_LAUNCHER_ENV as te,DEV_LOG_FILE as ae,DEV_LOG_FILE_ENV as Ee,DEV_STATE_DIR as ie,DEV_STATE_FILE as se,claimDevServerState as ne,clearDevServerState as _e,devServerPhase as ce,isDevServerReady as le,isProcessAlive as pe,isRecordedProcessCurrent as De,readDevServerState as de,readLiveDevServerState as me,updateDevServerState as Ae,writeDevServerState as fe}from"./packem_shared/DEV_BINDINGS_FILE-DaCgPGfL.mjs";import{devTriggerHints as Le,formatDevBannerRow as ve}from"./packem_shared/devTriggerHints-CN_RJxWW.mjs";import{DEV_VARS_EXAMPLE_FILE as Re,DEV_VARS_FILE as Te,DEV_VARS_KEY_PATTERN as xe,escapeRegExp as ge,parseDevVariableEntries as Ve,readDevVariablesRecord as Ie,removeDevVariableLine as ue,upsertDevVariableLine as Oe,wranglerDotenvFiles as Pe}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{DEV_WORKER_ENV_VALUE as Fe,DEV_WORKER_ENV_VAR as Me,ensureDevWorkerEnv as Ue}from"./packem_shared/DEV_WORKER_ENV_VALUE-BHgGdjqB.mjs";import{createDiscoveryCache as Ge}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as ke,deployTargetIds as ye,isRunnableTarget as he,planToolchainInvocation as we,resolveDeployDriver as He,runnableTargetIds as je,targetRunsOwnDevServer as Ke}from"./packem_shared/DEFAULT_DEPLOY_TARGET-ZGMeeKMO.mjs";import{default as Ye}from"./packem_shared/ensureGitignoreEntries-DFNmLdCz.mjs";import{gitCheckIgnore as ze}from"./packem_shared/gitCheckIgnore-DmE9479j.mjs";import{inferLunoraBindings as Xe,secretSourcesFromBindings as Ze}from"./packem_shared/inferLunoraBindings-BUk28bSQ.mjs";import{LINKED_PROJECT_DIR as $e,LINKED_PROJECT_FILE as er,readLinkedProject as rr,writeLinkedProject as or}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as ar,applyLintIgnores as Er,detectLintTools as ir}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{resolveLocalWorkerEnv as nr}from"./packem_shared/resolveLocalWorkerEnv-C1s-quRt.mjs";import{blockingFindingsMessage as cr,reportCodegenFindings as lr}from"./packem_shared/blockingFindingsMessage-BQ9z7cie.mjs";import{LUNORA_EVENT_SOURCE as Dr,formatLunoraEvent as dr}from"./packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs";import{LUNORA_TAG as Ar,advisoryLine as fr,lunoraLine as Sr}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as vr}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Rr,detectInstalledManagers as Tr,detectPackageManager as xr,execArgsFor as gr,installArgsFor as Vr,runScriptArgsFor as Ir,runScriptCommand as ur,toolchainExecArgs as Or}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{PACKAGE_SECRETS_REGISTRY as Cr,mintableSecretKeysFor as Fr,secretsForPackages as Mr}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs";import{runPostCodegenHook as Br}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{assertBuildTargetMatches as br,interpretRemote as kr,readProjectRemotePreference as yr,readProjectTarget as hr,resolveProjectTarget as wr,resolveTargetOrThrow as Hr}from"./packem_shared/assertBuildTargetMatches-CsHD_hg_.mjs";import{readProjectDependencies as Kr,readProjectDependencyNames as Wr,readProjectManifest as Yr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as zr,isInteractive as qr,promptMultiSelect as Xr,promptSelect as Zr,promptText as Qr,promptYesNo as $r}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as ro}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as to,ensureDevVariables as ao,ensureDevVarsExample as Eo,fillDevSecrets as io,generateSecretValue as so,isMintableSecretKey as no,isPlaceholderValue as _o,planDevSecretsFill as co,planDevVariablesAugment as lo,planDevVariablesScaffold as po,requiredSecrets as Do,writeDevVariablesFileAtomically as mo}from"./packem_shared/buildPackageSecretsBlock-Jla_XY6q.mjs";import{applyAdditiveEdit as fo,classifyEdit as So}from"./packem_shared/applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as vo}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as Ro,resolveServerModule as To,scaffoldPolicyFile as xo,wireRlsIntoProcedure as go}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as Io}from"./packem_shared/discoverSchemaInfo-DRPnqgif.mjs";import{ACCENT as Oo,BADGES as Po,BADGE_COLUMN_WIDTH as Co,LUNA_ART as Fo,LUNA_BUNNY as Mo,LUNA_NAME as Uo,LUNA_SIGNOFF as Bo,STEP_BADGE_NAMES as Go,badgeLead as bo,badgeWidth as ko,padBadge as yo,paintAnswer as ho,paintBadge as wo}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as jo,DURABLE_OBJECT_BINDINGS as Ko,GENERATED_CLASS_MODULES as Wo,GENERATED_MODULE_DURABLE_OBJECTS as Yo,MERGED_DURABLE_OBJECTS_MODULE as Jo,isMergedProject as zo,isMergedRoleModule as qo}from"./packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{discoverWorkflowInfo as Zo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";import{ENV_FILENAME as $o}from"@lunora/codegen";export{Oo as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,n as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,Po as BADGES,Co as BADGE_COLUMN_WIDTH,P as BUILD_ROOT_ENV,C as BUILD_TARGET_ENV,F as BUNDLE_META_PATH_ENV,M as CODEGEN_ENV,jo as COMPOSED_WORKER_ENTRY,u as D1_PLACEHOLDER_ID,U as DEFAULT_BUNDLE_META_PATH,ke as DEFAULT_DEPLOY_TARGET,ee as DEV_BINDINGS_FILE,re as DEV_DAEMON_ENV,oe as DEV_HANDOFF_ENV,te as DEV_LAUNCHER_ENV,ae as DEV_LOG_FILE,Ee as DEV_LOG_FILE_ENV,ie as DEV_STATE_DIR,se as DEV_STATE_FILE,Re as DEV_VARS_EXAMPLE_FILE,Te as DEV_VARS_FILE,xe as DEV_VARS_KEY_PATTERN,Fe as DEV_WORKER_ENV_VALUE,Me as DEV_WORKER_ENV_VAR,Ko as DURABLE_OBJECT_BINDINGS,$o as ENV_FILENAME,Wo as GENERATED_CLASS_MODULES,Yo as GENERATED_MODULE_DURABLE_OBJECTS,B as LAZY_FUNCTIONS_ENV,$e as LINKED_PROJECT_DIR,er as LINKED_PROJECT_FILE,Fo as LUNA_ART,Mo as LUNA_BUNNY,Uo as LUNA_NAME,Bo as LUNA_SIGNOFF,Dr as LUNORA_EVENT_SOURCE,ar as LUNORA_IGNORED_PATHS,c as LUNORA_SKILL_NAMES,Ar as LUNORA_TAG,vr as LunoraReporter,Jo as MERGED_DURABLE_OBJECTS_MODULE,L as MissingBuildOutputError,Cr as PACKAGE_SECRETS_REGISTRY,l as ROOT_SKILL_NAME,Go as STEP_BADGE_NAMES,G as STRICT_ADVISORIES_ENV,Z as acceptsConnection,Rr as addArgsFor,fr as advisoryLine,fo as applyAdditiveEdit,Er as applyLintIgnores,br as assertBuildTargetMatches,bo as badgeLead,ko as badgeWidth,cr as blockingFindingsMessage,to as buildPackageSecretsBlock,N as canonicalPath,z as checkDevEnv,p as claimAgentRulesHint,ne as claimDevServerState,So as classifyEdit,Ro as classifyPolicyEdit,m as clearApiSpecMarker,_e as clearDevServerState,zr as createConfirm,Ge as createDiscoveryCache,ye as deployTargetIds,q as describeDevEnvCheck,D as detectAgentRules,t as detectAiAgent,W as detectFramework,Tr as detectInstalledManagers,ir as detectLintTools,xr as detectPackageManager,ce as devServerPhase,Le as devTriggerHints,E as discoverAgentInfo,w as discoverContainerInfo,Io as discoverSchemaInfo,Zo as discoverWorkflowInfo,ao as ensureDevVariables,Eo as ensureDevVarsExample,Ue as ensureDevWorkerEnv,Ye as ensureGitignoreEntries,ge as escapeRegExp,gr as execArgsFor,io as fillDevSecrets,ve as formatDevBannerRow,dr as formatLunoraEvent,so as generateSecretValue,ze as gitCheckIgnore,Xe as inferLunoraBindings,Vr as installArgsFor,kr as interpretRemote,b as isCodegenDisabled,le as isDevServerReady,qr as isInteractive,k as isLazyFunctionsEnabled,zo as isMergedProject,qo as isMergedRoleModule,no as isMintableSecretKey,_o as isPlaceholderValue,pe as isProcessAlive,De as isRecordedProcessCurrent,he as isRunnableTarget,Sr as lunoraLine,Fr as mintableSecretKeysFor,yo as padBadge,ho as paintAnswer,wo as paintBadge,Ve as parseDevVariableEntries,vo as parseSchema,co as planDevSecretsFill,lo as planDevVariablesAugment,po as planDevVariablesScaffold,we as planToolchainInvocation,T as probeCelldToolchain,Y as projectUsesUmbrella,Xr as promptMultiSelect,Zr as promptSelect,Qr as promptText,$r as promptYesNo,A as readApiSpecMarker,de as readDevServerState,Ie as readDevVariablesRecord,rr as readLinkedProject,me as readLiveDevServerState,Kr as readProjectDependencies,Wr as readProjectDependencyNames,Yr as readProjectManifest,yr as readProjectRemotePreference,hr as readProjectTarget,ue as removeDevVariableLine,lr as reportCodegenFindings,Do as requiredSecrets,He as resolveDeployDriver,y as resolveLazyFunctions,nr as resolveLocalWorkerEnv,wr as resolveProjectTarget,ro as resolveSchemaDirectory,To as resolveServerModule,Hr as resolveTargetOrThrow,Br as runPostCodegenHook,Ir as runScriptArgsFor,ur as runScriptCommand,je as runnableTargetIds,xo as scaffoldPolicyFile,Ze as secretSourcesFromBindings,Mr as secretsForPackages,g as startCelldDevSession,Q as startDevProcess,j as streamContainerLogs,Ke as targetRunsOwnDevServer,Or as toolchainExecArgs,Ae as updateDevServerState,Oe as upsertDevVariableLine,go as wireRlsIntoProcedure,Pe as wranglerDotenvFiles,f as writeApiSpecMarker,V as writeCelldDevProjection,fe as writeDevServerState,mo as writeDevVariablesFileAtomically,or as writeLinkedProject};
@@ -1 +1 @@
1
- import{CelldReleaseConfigError as b,CELLD_RELEASE_BINDING_TYPES as _,releaseResourceName as d}from"../celld-names/index.mjs";import{CELLD_RELEASE_BINDINGS as C,MAX_RELEASE_ALIAS_LENGTH as j,MAX_RESOURCE_NAME as v,RELEASE_ALIAS_PATTERN as k,isReleaseAlias as I}from"../celld-names/index.mjs";import{b as u}from"./celld-config-Ef1RZ02t.mjs";const E="worker.js",p="assets",A="lunora-v1",h=["nodejs_compat"],f=s=>{if(!_.has(s.type))return`${s.type} bindings do not run on celld`;if(s.type==="durable_object"){if(s.className===void 0)return"a Durable Object binding must name its class";if(s.sqlite!==!0)return s.sqlite===!1?`class ${s.className} is KV-backed, and celld creates only SQLite-backed classes`:`class ${s.className} belongs to another Worker; a celld fleet runs one`}if(s.type==="workflow"&&s.className===void 0)return"a workflow binding must name its class"},c=(s,n)=>s.bindings.filter(i=>i.type===n),m=(s,n)=>{const i=c(n,"queue_producer"),o=c(n,"queue_consumer");if(i.length===0&&o.length===0)return;const l=new Map(i.map(a=>[a.resource??a.binding,d(s,a.binding)]));return{...i.length===0?{}:{producers:i.map(a=>({binding:a.binding,queue:d(s,a.binding)}))},...o.length===0?{}:{consumers:o.map(a=>({queue:l.get(a.resource??a.binding)??d(s,a.binding)}))}}},L=(s,n,i)=>{const o=c(n,"durable_object"),l=[...new Set(o.map(e=>e.className))].toSorted((e,t)=>e.localeCompare(t)),a=c(n,"assets")[0],r={assets:i.hasAssets?{...a===void 0?{}:{binding:a.binding},directory:`./${p}`,...i.assetsConfig}:void 0,d1_databases:c(n,"d1").map(e=>{const t=d(s,e.binding);return{binding:e.binding,database_id:t,database_name:t}}),durable_objects:o.length===0?void 0:{bindings:o.map(e=>({class_name:e.className,name:e.binding}))},kv_namespaces:c(n,"kv").map(e=>({binding:e.binding,id:d(s,e.binding)})),migrations:l.length===0?[]:[{new_sqlite_classes:l,tag:A}],queues:m(s,n),r2_buckets:c(n,"r2").map(e=>({binding:e.binding,bucket_name:d(s,e.binding)})),workflows:c(n,"workflow").map(e=>({binding:e.binding,class_name:e.className,name:e.resource??e.binding}))};return Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0&&!(Array.isArray(e)&&e.length===0)))},w=(s,n)=>{const i=s.bindings.flatMap(t=>{const g=f(t);return g===void 0?[]:[{binding:t.binding,reason:g,type:t.type}]});if(i.length>0)throw new b(`this release cannot run on celld: ${i.map(t=>`${t.binding} (${t.type}): ${t.reason}`).join("; ")}`,i);if(s.bindings.some(t=>t.type==="assets")!==n.hasAssets)throw new b(n.hasAssets?"the release carries assets but its manifest has no assets binding":"the manifest has an assets binding but the release carries no assets");const l=n.compatibilityDate??s.compatibilityDate,a={name:n.alias,main:E,no_bundle:!0,...l===void 0?{}:{compatibility_date:l},compatibility_flags:[...n.compatibilityFlags??s.compatibilityFlags??h],...Object.keys(n.vars).length===0?{}:{vars:{...n.vars}},...n.crons.length===0?{}:{triggers:{crons:[...n.crons]}},...L(n.alias,s,n)},{config:r,dropped:e}=u(a);if(e.length>0)throw new b(`celld would refuse ${e.join(", ")}`);return r};export{p as CELLD_RELEASE_ASSETS_DIRECTORY,C as CELLD_RELEASE_BINDINGS,_ as CELLD_RELEASE_BINDING_TYPES,E as CELLD_RELEASE_MAIN,b as CelldReleaseConfigError,j as MAX_RELEASE_ALIAS_LENGTH,v as MAX_RESOURCE_NAME,k as RELEASE_ALIAS_PATTERN,w as celldConfigFromRelease,I as isReleaseAlias,d as releaseResourceName};
1
+ import{CelldReleaseConfigError as b,CELLD_RELEASE_BINDING_TYPES as _,releaseResourceName as d}from"../celld-names/index.mjs";import{CELLD_RELEASE_BINDINGS as C,MAX_RELEASE_ALIAS_LENGTH as j,MAX_RESOURCE_NAME as v,RELEASE_ALIAS_PATTERN as k,isReleaseAlias as I}from"../celld-names/index.mjs";import{b as u}from"./celld-config-CC5YKtVa.mjs";const E="worker.js",p="assets",A="lunora-v1",h=["nodejs_compat"],f=s=>{if(!_.has(s.type))return`${s.type} bindings do not run on celld`;if(s.type==="durable_object"){if(s.className===void 0)return"a Durable Object binding must name its class";if(s.sqlite!==!0)return s.sqlite===!1?`class ${s.className} is KV-backed, and celld creates only SQLite-backed classes`:`class ${s.className} belongs to another Worker; a celld fleet runs one`}if(s.type==="workflow"&&s.className===void 0)return"a workflow binding must name its class"},c=(s,n)=>s.bindings.filter(i=>i.type===n),m=(s,n)=>{const i=c(n,"queue_producer"),o=c(n,"queue_consumer");if(i.length===0&&o.length===0)return;const l=new Map(i.map(a=>[a.resource??a.binding,d(s,a.binding)]));return{...i.length===0?{}:{producers:i.map(a=>({binding:a.binding,queue:d(s,a.binding)}))},...o.length===0?{}:{consumers:o.map(a=>({queue:l.get(a.resource??a.binding)??d(s,a.binding)}))}}},L=(s,n,i)=>{const o=c(n,"durable_object"),l=[...new Set(o.map(e=>e.className))].toSorted((e,t)=>e.localeCompare(t)),a=c(n,"assets")[0],r={assets:i.hasAssets?{...a===void 0?{}:{binding:a.binding},directory:`./${p}`,...i.assetsConfig}:void 0,d1_databases:c(n,"d1").map(e=>{const t=d(s,e.binding);return{binding:e.binding,database_id:t,database_name:t}}),durable_objects:o.length===0?void 0:{bindings:o.map(e=>({class_name:e.className,name:e.binding}))},kv_namespaces:c(n,"kv").map(e=>({binding:e.binding,id:d(s,e.binding)})),migrations:l.length===0?[]:[{new_sqlite_classes:l,tag:A}],queues:m(s,n),r2_buckets:c(n,"r2").map(e=>({binding:e.binding,bucket_name:d(s,e.binding)})),workflows:c(n,"workflow").map(e=>({binding:e.binding,class_name:e.className,name:e.resource??e.binding}))};return Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0&&!(Array.isArray(e)&&e.length===0)))},w=(s,n)=>{const i=s.bindings.flatMap(t=>{const g=f(t);return g===void 0?[]:[{binding:t.binding,reason:g,type:t.type}]});if(i.length>0)throw new b(`this release cannot run on celld: ${i.map(t=>`${t.binding} (${t.type}): ${t.reason}`).join("; ")}`,i);if(s.bindings.some(t=>t.type==="assets")!==n.hasAssets)throw new b(n.hasAssets?"the release carries assets but its manifest has no assets binding":"the manifest has an assets binding but the release carries no assets");const l=n.compatibilityDate??s.compatibilityDate,a={name:n.alias,main:E,no_bundle:!0,...l===void 0?{}:{compatibility_date:l},compatibility_flags:[...n.compatibilityFlags??s.compatibilityFlags??h],...Object.keys(n.vars).length===0?{}:{vars:{...n.vars}},...n.crons.length===0?{}:{triggers:{crons:[...n.crons]}},...L(n.alias,s,n)},{config:r,dropped:e}=u(a);if(e.length>0)throw new b(`celld would refuse ${e.join(", ")}`);return r};export{p as CELLD_RELEASE_ASSETS_DIRECTORY,C as CELLD_RELEASE_BINDINGS,_ as CELLD_RELEASE_BINDING_TYPES,E as CELLD_RELEASE_MAIN,b as CelldReleaseConfigError,j as MAX_RELEASE_ALIAS_LENGTH,v as MAX_RESOURCE_NAME,k as RELEASE_ALIAS_PATTERN,w as celldConfigFromRelease,I as isReleaseAlias,d as releaseResourceName};
@@ -1 +1 @@
1
- import{p as a}from"./celld-config-Ef1RZ02t.mjs";import s from"./CLOUDFLARE_DRIVER-DbmpoIcg.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"],["secretsFile","celld has no secret store — a value the app reads from env is a `vars` entry in the deployed config"],["outFile","`celld deploy` does not write its upload artifact 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)),i=(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)&&i(e).toolchain!==void 0,E=()=>d().filter(e=>g(e)),D=e=>i(e).toolchain?.devServer==="own",O=(e,o,r,c)=>{const n=e.projectConfig?.(o,r);return{command:c(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,i as resolveDeployDriver,E as runnableTargetIds,D as targetRunsOwnDevServer};
1
+ import{p as a}from"./celld-config-CC5YKtVa.mjs";import s from"./CLOUDFLARE_DRIVER-DbmpoIcg.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"],["secretsFile","celld has no secret store — a value the app reads from env is a `vars` entry in the deployed config"],["outFile","`celld deploy` does not write its upload artifact 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)),i=(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)&&i(e).toolchain!==void 0,E=()=>d().filter(e=>g(e)),D=e=>i(e).toolchain?.devServer==="own",O=(e,o,r,c)=>{const n=e.projectConfig?.(o,r);return{command:c(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,i as resolveDeployDriver,E as runnableTargetIds,D as targetRunsOwnDevServer};
@@ -0,0 +1,4 @@
1
+ import{mkdirSync as _,writeFileSync as D,rmSync as p,existsSync as m,readFileSync as f}from"node:fs";import{a as A}from"./atomic-write-DA2tlY-2.mjs";import{join as n}from"node:path";const c=".lunora",a=n(c,"dev.json"),k=n(c,"dev.log"),P=n(c,"dev-bindings.json"),T="LUNORA_DEV_DAEMON",C="LUNORA_DEV_LOG_FILE",M="LUNORA_DEV_HANDOFF_PID",w="LUNORA_DEV_LAUNCHER_PID",g=e=>e!==null&&typeof e=="object",o=(e,t)=>{const r=e[t];return typeof r=="string"&&r.length>0?r:void 0},y=e=>{if(!Number.isInteger(e)||e<=0)return!1;try{return process.kill(e,0),!0}catch{return!1}},b=1e4,O=100,h=e=>{if(process.platform==="linux")try{const t=f(`/proc/${String(e)}/stat`,"utf8"),r=t.slice(t.lastIndexOf(")")+2).split(" "),i=Number(r[19]),s=f("/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/O*1e3}catch{return}},E=e=>{if(e.exitedAt!==void 0||!y(e.pid))return!1;const t=e.startedAt===void 0?Number.NaN:Date.parse(e.startedAt);if(Number.isNaN(t))return!0;const r=h(e.pid);return r===void 0||r<=t+b},v=e=>{const t=n(e,a);if(!m(t))return;let r;try{r=JSON.parse(f(t,"utf8"))}catch{return}if(!g(r)||typeof r.pid!="number")return;const i=o(r,"url");if(i!==void 0)return{background:r.background===!0,exitedAt:o(r,"exitedAt"),launcherPid:typeof r.launcherPid=="number"?r.launcherPid:void 0,logFile:o(r,"logFile"),mode:r.mode==="vite"?"vite":"cli",pid:r.pid,provisional:r.provisional===!0?!0:void 0,readyAt:o(r,"readyAt"),startedAt:o(r,"startedAt"),studioUrl:o(r,"studioUrl"),tunnelUrl:o(r,"tunnelUrl"),url:i}},u=(e,t)=>{try{_(n(e,c),{recursive:!0});const r=n(e,a);return A(r,`${JSON.stringify(t,void 0,2)}
3
+ `),r}catch{return}},L=(e,t,r)=>{const i=v(e);if(i===void 0||r?.expectedPid!==void 0&&i.pid!==r.expectedPid)return;const s={...i,...t};return u(e,s),s},I=e=>e?.readyAt!==void 0,G=e=>e.provisional===!0?"launching":I(e)?"ready":"starting",N=(e,t)=>{try{if(t!==void 0){const r=v(e);if(r!==void 0&&r.pid!==t)return}p(n(e,a),{force:!0})}catch{}},H=e=>{const t=v(e);if(t!==void 0){if(E(t))return t;t.background!==!0?N(e,t.pid):t.exitedAt===void 0&&L(e,{exitedAt:new Date().toISOString()},{expectedPid:t.pid})}},F=(e,t,r)=>{const i=v(e);if(i!==void 0){if(!E(i)){N(e,i.pid);return}return r!==void 0&&(i.pid===r||i.provisional===!0&&i.launcherPid===r)?{ok:u(e,t)!==void 0}:i.pid!==t.pid?{existing:i,ok:!1}:{ok:u(e,{...t,tunnelUrl:t.tunnelUrl??i.tunnelUrl})!==void 0}}},J=(e,t,r)=>{const i=n(e,a),s=`${JSON.stringify(t,void 0,2)}
4
+ `;for(let d=0;d<2;d+=1)try{return _(n(e,c),{recursive:!0}),D(i,s,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(l){if(l.code!=="EEXIST")return{ok:u(e,t)!==void 0};const S=F(e,t,r?.supersedePid);if(S!==void 0)return S}return{contended:!0,ok:!1}};export{P as DEV_BINDINGS_FILE,T as DEV_DAEMON_ENV,M as DEV_HANDOFF_ENV,w as DEV_LAUNCHER_ENV,k as DEV_LOG_FILE,C as DEV_LOG_FILE_ENV,c as DEV_STATE_DIR,a as DEV_STATE_FILE,J as claimDevServerState,N as clearDevServerState,G as devServerPhase,I as isDevServerReady,y as isProcessAlive,E as isRecordedProcessCurrent,v as readDevServerState,H as readLiveDevServerState,L as updateDevServerState,u as writeDevServerState};
@@ -1 +1 @@
1
- import{readFileSync as l}from"node:fs";import{findWranglerFile as m,readWranglerJsonc as E}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{DEV_VARS_FILE as i,parseDevVariableEntries as V,upsertDevVariableLine as c}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{writeDevVariablesFileAtomically as p}from"./buildPackageSecretsBlock-DrSD60vH.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};
1
+ import{readFileSync as l}from"node:fs";import{findWranglerFile as m,readWranglerJsonc as E}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{DEV_VARS_FILE as i,parseDevVariableEntries as V,upsertDevVariableLine as c}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{writeDevVariablesFileAtomically as p}from"./buildPackageSecretsBlock-Jla_XY6q.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};
@@ -1 +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 h,resolveServerModule as l,wireRlsIntoProcedure as v}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as b}from"./write-atomic-9sY2z8DB.mjs";const D="/__lunora/policy-scaffold",u=r=>r==="unknown-procedure"?404:r==="already-wired"||r==="destructive"?409:422,f=(r,o,e)=>{let t;try{t=b(r,o)}catch(n){return{body:{error:n instanceof Error?n.message:String(n),ok:!1},status:500}}return{body:{...e,diagnostics:t,ok:!0},status:200}},g=r=>({body:{edit:r,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=(r,o)=>{const e=h(o,l(r.projectRoot));if(!e.ok)return{body:{error:e.reason,ok:!1},status:u(e.reason)};const t=r.schemaDirectory??"lunora",n=s(r.projectRoot,t,e.fileName);return d(n)?{body:{error:"file-exists",fileName:e.fileName,ok:!1},status:409}:(c(n,e.source),f(r,{path:n,text:e.source},{fileName:e.fileName}))},R=(r,o,e)=>{if(typeof e!="string"||e.length===0||a(e)||e.includes("\\"))return;const t=s(r,o),n=s(t,`${e}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(r,o)=>{const e=R(r.projectRoot,r.schemaDirectory??"lunora",o.filePath);if(e===void 0||!d(e))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=v(y(e,"utf8"),o,l(r.projectRoot));return t.ok?(c(e,t.text),f(r,{path:e,text:t.text},{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=r=>{if(r.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=r;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const e=o;if(k(e)==="destructive")return g(e);if(e.kind==="scaffoldPolicy")return w(r,e);if(e.kind==="wireRls")return N(r,e);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(e.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
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 h,resolveServerModule as l,wireRlsIntoProcedure as v}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as b}from"./write-atomic-DL9BV55L.mjs";const D="/__lunora/policy-scaffold",u=r=>r==="unknown-procedure"?404:r==="already-wired"||r==="destructive"?409:422,f=(r,o,e)=>{let t;try{t=b(r,o)}catch(n){return{body:{error:n instanceof Error?n.message:String(n),ok:!1},status:500}}return{body:{...e,diagnostics:t,ok:!0},status:200}},g=r=>({body:{edit:r,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=(r,o)=>{const e=h(o,l(r.projectRoot));if(!e.ok)return{body:{error:e.reason,ok:!1},status:u(e.reason)};const t=r.schemaDirectory??"lunora",n=s(r.projectRoot,t,e.fileName);return d(n)?{body:{error:"file-exists",fileName:e.fileName,ok:!1},status:409}:(c(n,e.source),f(r,{path:n,text:e.source},{fileName:e.fileName}))},R=(r,o,e)=>{if(typeof e!="string"||e.length===0||a(e)||e.includes("\\"))return;const t=s(r,o),n=s(t,`${e}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(r,o)=>{const e=R(r.projectRoot,r.schemaDirectory??"lunora",o.filePath);if(e===void 0||!d(e))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=v(y(e,"utf8"),o,l(r.projectRoot));return t.ok?(c(e,t.text),f(r,{path:e,text:t.text},{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=r=>{if(r.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=r;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const e=o;if(k(e)==="destructive")return g(e);if(e.kind==="scaffoldPolicy")return w(r,e);if(e.kind==="wireRls")return N(r,e);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(e.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
@@ -1 +1 @@
1
- import{applyModify as g}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as v}from"./hasCloudflareCredentials-ByCrwaLT.mjs";import{withheldBindings as y,writeDevConfig as E,noopCleanup as R}from"./describeWithheld-CN3D-4pU.mjs";import{readManifest as j}from"./readManifest-Cighz3WC.mjs";import{o as w}from"./reconcile-services-CjgIJKim.mjs";import{findWranglerFile as S,readWranglerJsonc as _}from"./WRANGLER_FILES-BF8PUjuo.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"}},B=Object.keys(h),m=(e,r)=>typeof e.binding=="string"?e.binding:r,f=(e,r,n,t)=>{const i=[];for(const[s,o]of r.entries())o!=null&&(e==="kv_namespaces"&&(typeof o.id!="string"||o.id==="")||i.push({binding:m(o,`#${String(s)}`),kind:n,path:[...t,s],section:e}));return i},u=(e,r)=>h[e].shape===r,C=(e,r)=>{const{label:n}=h[e];if(u(e,"array"))return f(e,r[e]??[],n,[]);if(u(e,"object")){const t=r[e];return t==null?[]:[{binding:m(t,e),kind:n,path:[],section:e}]}return f(e,r.queues?.producers??[],n,["producers"])},I=e=>B.flatMap(r=>C(r,e)),k=(e,r)=>{let n=e;for(const t of r)n=g(n,[t.section,...t.path,"remote"],!0);return n},W=(e,r)=>({bindings:e.remoteBindings.map(n=>`${n.binding} (${n.kind})`),cleanup:e.cleanup,configPath:e.configPath,enabled:r,reason:e.reason,withheld:e.withheld}),$=e=>{const r=a=>({cleanup:R,reason:a,remoteBindings:[],withheld:[]}),n=S(e.projectRoot);if(!n)return r("wrangler.jsonc not found");const{parsed:t,text:i}=_(n);if(t===void 0)return r(`failed to parse ${n} as JSONC`);const s=w(j(e.projectRoot)),o=e.remote?I(t).filter(a=>a.section!=="services"||!s.has(a.binding)):[],l=y(t,e.hasCredentials??(()=>v({projectRoot:e.projectRoot}))),c=l.some(({kind:a})=>a==="ai")?o.filter(a=>a.section!=="ai"):o;if(c.length===0&&l.length===0)return r(e.remote?"no remote-eligible bindings to proxy":void 0);let d=i;for(const{kind:a}of l)d=g(d,[a],void 0);const b=c.length>0?k(d,c):d,p=E(e.projectRoot,"dev",b,e.projectRoot);return{cleanup:p.cleanup,configPath:p.configPath,remoteBindings:c,withheld:l}},L=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},D=e=>e.flag===!0||L(e.envValue)?!0:e.configPreference??!1;export{h as REMOTE_ELIGIBLE_KEYS,k as injectRemoteFlags,L as isRemoteEnvEnabled,$ as materializeDevWranglerConfig,I as planRemoteBindings,D as resolveRemoteEnabled,W as toRemotePlan};
1
+ import{applyModify as g}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as v}from"./hasCloudflareCredentials-ByCrwaLT.mjs";import{withheldBindings as y,writeDevConfig as E,noopCleanup as R}from"./describeWithheld-C9rBOaSo.mjs";import{readManifest as j}from"./readManifest-Cighz3WC.mjs";import{o as w}from"./reconcile-services-CjgIJKim.mjs";import{findWranglerFile as S,readWranglerJsonc as _}from"./WRANGLER_FILES-BF8PUjuo.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"}},B=Object.keys(h),m=(e,r)=>typeof e.binding=="string"?e.binding:r,f=(e,r,n,t)=>{const i=[];for(const[s,o]of r.entries())o!=null&&(e==="kv_namespaces"&&(typeof o.id!="string"||o.id==="")||i.push({binding:m(o,`#${String(s)}`),kind:n,path:[...t,s],section:e}));return i},u=(e,r)=>h[e].shape===r,C=(e,r)=>{const{label:n}=h[e];if(u(e,"array"))return f(e,r[e]??[],n,[]);if(u(e,"object")){const t=r[e];return t==null?[]:[{binding:m(t,e),kind:n,path:[],section:e}]}return f(e,r.queues?.producers??[],n,["producers"])},I=e=>B.flatMap(r=>C(r,e)),k=(e,r)=>{let n=e;for(const t of r)n=g(n,[t.section,...t.path,"remote"],!0);return n},W=(e,r)=>({bindings:e.remoteBindings.map(n=>`${n.binding} (${n.kind})`),cleanup:e.cleanup,configPath:e.configPath,enabled:r,reason:e.reason,withheld:e.withheld}),$=e=>{const r=a=>({cleanup:R,reason:a,remoteBindings:[],withheld:[]}),n=S(e.projectRoot);if(!n)return r("wrangler.jsonc not found");const{parsed:t,text:i}=_(n);if(t===void 0)return r(`failed to parse ${n} as JSONC`);const s=w(j(e.projectRoot)),o=e.remote?I(t).filter(a=>a.section!=="services"||!s.has(a.binding)):[],l=y(t,e.hasCredentials??(()=>v({projectRoot:e.projectRoot}))),c=l.some(({kind:a})=>a==="ai")?o.filter(a=>a.section!=="ai"):o;if(c.length===0&&l.length===0)return r(e.remote?"no remote-eligible bindings to proxy":void 0);let d=i;for(const{kind:a}of l)d=g(d,[a],void 0);const b=c.length>0?k(d,c):d,p=E(e.projectRoot,"dev",b,e.projectRoot);return{cleanup:p.cleanup,configPath:p.configPath,remoteBindings:c,withheld:l}},L=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},D=e=>e.flag===!0||L(e.envValue)?!0:e.configPreference??!1;export{h as REMOTE_ELIGIBLE_KEYS,k as injectRemoteFlags,L as isRemoteEnvEnabled,$ as materializeDevWranglerConfig,I as planRemoteBindings,D as resolveRemoteEnabled,W as toRemotePlan};
@@ -1 +1 @@
1
- import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-9sY2z8DB.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}),k=t=>{if(!a(t))return{response:{body:{error:"no-schema-file",ok:!1},status:404}};const e=u(d(t,"utf8"));return e.ok?{tables:e.tables}:{response:y(e)}},g=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}),h=(t,e)=>{const r=t.body;if(r==null||typeof r!="object"||typeof r.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};if(l(r)==="destructive")return g(r);if(!a(e))return{body:{error:"no-schema-file",ok:!1},status:404};const o=c(d(e,"utf8"),r);if(!o.ok)return{body:{error:o.reason,ok:!1},status:b(o.reason)};f(e,o.text);let i;try{i=p(t,{path:e,text:o.text})}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 e=m(t.projectRoot,t.schemaDirectory??"lunora","schema.ts");if(t.method==="GET"){const r=k(e);return"response"in r?r.response:{body:{ok:!0,tables:r.tables},status:200}}return t.method==="POST"?h(t,e):{body:{error:"method-not-allowed",ok:!1},status:405}};export{F as SCHEMA_EDIT_ENDPOINT,R as handleSchemaEditRequest};
1
+ import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-DL9BV55L.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}),k=t=>{if(!a(t))return{response:{body:{error:"no-schema-file",ok:!1},status:404}};const e=u(d(t,"utf8"));return e.ok?{tables:e.tables}:{response:y(e)}},g=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}),h=(t,e)=>{const r=t.body;if(r==null||typeof r!="object"||typeof r.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};if(l(r)==="destructive")return g(r);if(!a(e))return{body:{error:"no-schema-file",ok:!1},status:404};const o=c(d(e,"utf8"),r);if(!o.ok)return{body:{error:o.reason,ok:!1},status:b(o.reason)};f(e,o.text);let i;try{i=p(t,{path:e,text:o.text})}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 e=m(t.projectRoot,t.schemaDirectory??"lunora","schema.ts");if(t.method==="GET"){const r=k(e);return"response"in r?r.response:{body:{ok:!0,tables:r.tables},status:200}}return t.method==="POST"?h(t,e):{body:{error:"method-not-allowed",ok:!1},status:405}};export{F as SCHEMA_EDIT_ENDPOINT,R as handleSchemaEditRequest};
@@ -1 +1 @@
1
- import{resolveAdminToken as A}from"./devVariablesStamp-BQkGEn9d.mjs";import{handleAdvisorProceduresRequest as I,ADVISOR_PROCEDURES_ENDPOINT as O}from"./ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs";import{sendStudioDocument as _,sendStudioAsset as h}from"./sendStudioAsset-B81Pex91.mjs";import{isStandaloneModulePath as y,studioAssetsStamp as N,loadStudioAssets as E,readStandaloneAsset as H,assetContentType as R}from"./assetContentType-CUb5bpbI.mjs";import v from"./createStudioDocumentCache-XBG1aWbl.mjs";import{detectAgentRules as C}from"./AGENT_RULES_DIR-Bd6JPtNa.mjs";import{handlePolicyScaffoldRequest as L,POLICY_SCAFFOLD_ENDPOINT as b}from"./POLICY_SCAFFOLD_ENDPOINT-BiQ1zNsR.mjs";import x from"./renderStudioHtml-CRDTNivi.mjs";import{handleSchemaEditRequest as $,SCHEMA_EDIT_ENDPOINT as k}from"./SCHEMA_EDIT_ENDPOINT-D296PlpV.mjs";import{handleSeedRequest as U,SEED_ENDPOINT as g}from"./SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as j}from"./serveJsonHandler-B8_GE6QC.mjs";import{transportRejectionReason as F}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";import"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const i="/__lunora",M=`${i}/studio.js`,m=`${i}/styles.css`,P=/\/$/,q={[b]:L,[k]:$,[g]:U,[O]:I},w=new Set(["127.0.0.1","::1","localhost"]),st=t=>t!==void 0&&t!==!1&&!w.has(t),T=t=>t===void 0||t==="/"?"":t.replace(P,""),nt=t=>`${T(t)}${i}`,B=t=>{try{return new URL(t,"http://localhost").pathname}catch{const d=t.indexOf("?");return d===-1?t:t.slice(0,d)}},at=t=>{const{logger:d,projectRoot:c}=t,u=T(t.base);let l,S;const p=v(c,()=>x({adminToken:A(c),advisorProcedures:!0,basePath:i,dataEditable:!0,rulesInstalled:C(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m})),D=(s,o,e)=>{const n=N();if((l===void 0||n!==S)&&(l=E(d),S=n),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=s===m,r=s.slice(s.lastIndexOf("/")+1);if(a){h(o,e,l.styles,"text/css; charset=utf-8",r,n);return}const f=H(r);if(f===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}h(o,e,f,R(r),r,n)};return(s,o,e)=>{const n=B(s.url??"").replace(P,""),a=u!==""&&n.startsWith(u)?n.slice(u.length):n;if(a!==i&&!a.startsWith(`${i}/`)){e();return}if(t.isNonLoopbackBind||F(s,d)!==void 0){o.statusCode=403,o.setHeader("Content-Type","text/plain"),o.end("Lunora studio is only available on loopback hosts in dev.");return}const r=q[a];if(r!==void 0){j(s,o,r,c,{apiSpec:t.apiSpec,lazyFunctions:t.lazyFunctions,schemaDirectory:t.schemaDirectory});return}if(a===m||y(a)){D(a,s,o);return}_(o,p())}};export{i as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,at as createStudioMiddleware,st as isNonLoopbackHost,B as requestPathname,nt as studioMountPath};
1
+ import{resolveAdminToken as A}from"./devVariablesStamp-BQkGEn9d.mjs";import{handleAdvisorProceduresRequest as I,ADVISOR_PROCEDURES_ENDPOINT as O}from"./ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs";import{sendStudioDocument as _,sendStudioAsset as h}from"./sendStudioAsset-B81Pex91.mjs";import{isStandaloneModulePath as y,studioAssetsStamp as N,loadStudioAssets as E,readStandaloneAsset as H,assetContentType as R}from"./assetContentType-CUb5bpbI.mjs";import v from"./createStudioDocumentCache-XBG1aWbl.mjs";import{detectAgentRules as C}from"./AGENT_RULES_DIR-Bd6JPtNa.mjs";import{handlePolicyScaffoldRequest as L,POLICY_SCAFFOLD_ENDPOINT as b}from"./POLICY_SCAFFOLD_ENDPOINT-CewfdPRV.mjs";import x from"./renderStudioHtml-CRDTNivi.mjs";import{handleSchemaEditRequest as $,SCHEMA_EDIT_ENDPOINT as k}from"./SCHEMA_EDIT_ENDPOINT-B58YfQ7N.mjs";import{handleSeedRequest as U,SEED_ENDPOINT as g}from"./SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as j}from"./serveJsonHandler-B8_GE6QC.mjs";import{transportRejectionReason as F}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";import"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const i="/__lunora",M=`${i}/studio.js`,m=`${i}/styles.css`,P=/\/$/,q={[b]:L,[k]:$,[g]:U,[O]:I},w=new Set(["127.0.0.1","::1","localhost"]),st=t=>t!==void 0&&t!==!1&&!w.has(t),T=t=>t===void 0||t==="/"?"":t.replace(P,""),nt=t=>`${T(t)}${i}`,B=t=>{try{return new URL(t,"http://localhost").pathname}catch{const d=t.indexOf("?");return d===-1?t:t.slice(0,d)}},at=t=>{const{logger:d,projectRoot:c}=t,u=T(t.base);let l,S;const p=v(c,()=>x({adminToken:A(c),advisorProcedures:!0,basePath:i,dataEditable:!0,rulesInstalled:C(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m})),D=(s,o,e)=>{const n=N();if((l===void 0||n!==S)&&(l=E(d),S=n),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=s===m,r=s.slice(s.lastIndexOf("/")+1);if(a){h(o,e,l.styles,"text/css; charset=utf-8",r,n);return}const f=H(r);if(f===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}h(o,e,f,R(r),r,n)};return(s,o,e)=>{const n=B(s.url??"").replace(P,""),a=u!==""&&n.startsWith(u)?n.slice(u.length):n;if(a!==i&&!a.startsWith(`${i}/`)){e();return}if(t.isNonLoopbackBind||F(s,d)!==void 0){o.statusCode=403,o.setHeader("Content-Type","text/plain"),o.end("Lunora studio is only available on loopback hosts in dev.");return}const r=q[a];if(r!==void 0){j(s,o,r,c,{apiSpec:t.apiSpec,lazyFunctions:t.lazyFunctions,schemaDirectory:t.schemaDirectory});return}if(a===m||y(a)){D(a,s,o);return}_(o,p())}};export{i as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,at as createStudioMiddleware,st as isNonLoopbackHost,B as requestPathname,nt as studioMountPath};
@@ -1 +1 @@
1
- import{readProjectConfigLiterals as s,readProjectTarget as c}from"@lunora/codegen";import n from"./canonicalPath-DrfMiT3U.mjs";import{BUILD_TARGET_ENV as i,BUILD_ROOT_ENV as a}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{DEFAULT_DEPLOY_TARGET as p,resolveDeployDriver as f}from"./DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs";const d=e=>{if(typeof e=="boolean")return e;if(e!==null&&typeof e=="object")return!0},P=e=>d(s(e).remote),T=e=>c(e),g=(e,t)=>t??T(e)??p,j=(e,t)=>{const r=g(e,t);return f(r),r},v=(e,t)=>{const r=process.env[i],o=process.env[a];if(!(o===void 0||o===""||n(o)!==n(t))&&r!==void 0&&r!==""&&r!==e)throw new Error(`the plugin resolves target "${e}" but the CLI resolved "${r}" for this run; set the same target in the plugin options and the project config`)};export{v as assertBuildTargetMatches,d as interpretRemote,P as readProjectRemotePreference,T as readProjectTarget,g as resolveProjectTarget,j as resolveTargetOrThrow};
1
+ import{readProjectConfigLiterals as s,readProjectTarget as c}from"@lunora/codegen";import n from"./canonicalPath-DrfMiT3U.mjs";import{BUILD_TARGET_ENV as i,BUILD_ROOT_ENV as a}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{DEFAULT_DEPLOY_TARGET as p,resolveDeployDriver as f}from"./DEFAULT_DEPLOY_TARGET-ZGMeeKMO.mjs";const d=e=>{if(typeof e=="boolean")return e;if(e!==null&&typeof e=="object")return!0},P=e=>d(s(e).remote),T=e=>c(e),g=(e,t)=>t??T(e)??p,j=(e,t)=>{const r=g(e,t);return f(r),r},v=(e,t)=>{const r=process.env[i],o=process.env[a];if(!(o===void 0||o===""||n(o)!==n(t))&&r!==void 0&&r!==""&&r!==e)throw new Error(`the plugin resolves target "${e}" but the CLI resolved "${r}" for this run; set the same target in the plugin options and the project config`)};export{v as assertBuildTargetMatches,d as interpretRemote,P as readProjectRemotePreference,T as readProjectTarget,g as resolveProjectTarget,j as resolveTargetOrThrow};
@@ -0,0 +1 @@
1
+ import{randomBytes as n}from"node:crypto";import{writeFileSync as i,rmSync as e,renameSync as m}from"node:fs";const s=r=>`${r}.tmp-${String(process.pid)}`,p=(r,c,a={})=>{const t=`${s(r)}-${n(6).toString("hex")}`;try{i(t,c,{encoding:"utf8",flag:"wx",...a})}catch(o){throw o.code!=="EEXIST"&&e(t,{force:!0}),o}try{m(t,r)}catch(o){throw e(t,{force:!0}),o}};export{p as a,s as t};
@@ -0,0 +1,19 @@
1
+ import{randomBytes as V}from"node:crypto";import{existsSync as I,readFileSync as $,writeFileSync as x,linkSync as N,rmSync as S,renameSync as j,statSync as B}from"node:fs";import{join as m}from"node:path";import{LunoraError as O}from"@lunora/errors";import{a as K,t as z}from"./atomic-write-DA2tlY-2.mjs";import{DEV_VARS_FILE as u,DEV_VARS_EXAMPLE_FILE as f,parseDevVariableLine as k,parseDevVariableEntries as g,DEV_VARS_NEWLINE as L}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{MINTABLE_SECRET_KEYS as W,SHARD_RELAY_SECRET_KEY as y,CORE_SECRETS as b,mintableSecretKeysFor as U,SHARD_RELAY_HOST_PLACEHOLDER as Y,secretsForPackages as X}from"./PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs";const H=e=>[...b,...X(e)],w=32,G=["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"],q=/[.*+?^${}()|[\]\\]/gu,J=/[a-z0-9]$/u,P=e=>{const t=e.trim().toLowerCase();return t===""||t.startsWith("<")&&t.endsWith(">")?!0:G.some(n=>{const r=n.replaceAll(q,String.raw`\$&`),s=J.test(n)?`(^|[^a-z0-9])${r}([^a-z0-9]|$)`:`(^|[^a-z0-9])${r}`;return new RegExp(s,"u").test(t)})},E=e=>V(e).toString("hex"),v=new Set([...W,y]),Q=(e,t,n=v)=>e===y?n.has(e)&&(t.trim()===""||t===Y):n.has(e),T=(e,t,n,r)=>Q(e,t,r)&&P(t)?n(w):void 0,ge=(e=E)=>e(w),F=(e,t,n,r=v)=>e.split(L).map(i=>{const s=k(i),o=s?T(s.key,s.value,t,r):void 0;return!s||o===void 0?i:(n.push(s.key),`${s.key}="${o}"`)}),Z=e=>{if(e.devVarsExists)return{status:"exists"};if(e.exampleContent===void 0)return{status:"no-example"};const t=[];return{content:F(e.exampleContent,e.randomHex??E,t).join(`
2
+ `),generatedKeys:t,status:"generate"}},ee=e=>e.includes('"')||e.includes("\\")?"":e.replaceAll("\r",String.raw`\r`).replaceAll(`
3
+ `,String.raw`\n`),A=e=>{const t=e.randomHex??E,n=new Set(g(e.existingContent).map(o=>o.key)),r=[],i=[],s=[];for(const o of e.exampleContent.split(L)){const a=k(o);if(!a||n.has(a.key))continue;const l=T(a.key,a.value,t,v);s.push(a.key),l===void 0?r.push(`${a.key}="${ee(a.value)}"`):(i.push(a.key),r.push(`${a.key}="${l}"`))}return{additions:r,generatedKeys:i,missingKeys:s}},R=e=>e.length>0?` (generated ${e.join(", ")})`:"",te=(e,t)=>{try{return x(e,t,{encoding:"utf8",flag:"wx",mode:384}),!0}catch(n){if(n.code==="EEXIST")return!1;throw n}},M=(e,t)=>{const n=z(e);try{x(n,t,{encoding:"utf8",flag:"wx",mode:384});try{return N(n,e),!0}catch(r){const{code:i}=r;if(i==="EEXIST")return!1;if(i==="EPERM"||i==="ENOTSUP")return te(e,t);throw r}}finally{S(n,{force:!0})}},Ee=(e,t)=>{K(e,t,{mode:384})},D=5,C=e=>{try{const t=B(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}},ne=(e,t)=>e===void 0||t===void 0?!1:e.mtimeMs===t.mtimeMs&&e.size===t.size,re=(e,t)=>{for(let n=0;n<D;n+=1){const r=C(e),i=$(e,"utf8"),s=t(i);if(s.length===0)return[];const o=i.length>0&&!i.endsWith(`
4
+ `)?`
5
+ `:"",a=`${i}${o}${s.join(`
6
+ `)}
7
+ `,l=`${e}.tmp-${String(process.pid)}-${V(6).toString("hex")}`;try{x(l,a,{encoding:"utf8",mode:384});const d=C(e);if(!ne(r,d)){S(l,{force:!0});continue}return j(l,e),s}catch(d){throw S(l,{force:!0}),d}}throw new O("INTERNAL",`Failed to append to ${e} after ${String(D)} attempts — a concurrent writer kept winning the race.`)},se=new Set(["EACCES","EISDIR","EPERM"]),p=e=>{try{return{content:$(e,"utf8"),kind:"read"}}catch(t){const{code:n}=t;if(n==="ENOENT")return{kind:"missing"};if(n!==void 0&&se.has(n))return{code:n,kind:"unreadable"};throw t}},he=async e=>{const t=m(e.cwd,u),n=p(t),r=p(m(e.cwd,f));for(const[c,h]of[[u,n],[f,r]])if(h.kind==="unreadable")return(e.warn??e.info)(`skipped the ${u} scaffold: ${c} is not a readable file (${h.code})`),{addedKeys:[],generatedKeys:[],status:"unreadable"};if(r.kind!=="read")return{addedKeys:[],generatedKeys:[],status:"no-example"};const i=r.content;if(n.kind!=="read"){const c=Z({devVarsExists:!1,exampleContent:i,randomHex:e.randomHex});return c.status!=="generate"?{addedKeys:[],generatedKeys:[],status:"no-example"}:e.yes===!0||await e.confirm(`No ${u} found. Generate it from ${f} (secrets auto-filled)?`)?M(t,c.content)?(e.info(`Created ${u}${R(c.generatedKeys)}.`),{addedKeys:[],generatedKeys:c.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 s=A({existingContent:n.content,exampleContent:i,randomHex:e.randomHex});if(s.missingKeys.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const o=s.missingKeys.join(", ");if(!(e.yes===!0||await e.confirm(`${u} is missing ${String(s.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 d=re(t,c=>A({existingContent:c,exampleContent:i,randomHex:e.randomHex}).additions).map(c=>k(c)?.key).filter(c=>c!==void 0);if(d.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const _=s.generatedKeys.filter(c=>d.includes(c));return e.info(`Updated ${u} — added ${d.join(", ")}${R(_)}.`),{addedKeys:d,generatedKeys:_,status:"augmented"}},oe=e=>[`# ${e.description}`,`# Docs: ${e.docsUrl}`,`${e.key}="${e.placeholderValue}"`].join(`
8
+ `),ie=(e,t)=>{const n=H(e).filter(r=>!t.has(r.key));return n.length===0?"":n.map(r=>oe(r)).join(`
9
+
10
+ `)},Se=(e,t)=>{const n=m(e,f),r=I(n)?$(n,"utf8"):"",i=new Set(g(r).map(a=>a.key)),s=ie(t,i);if(s==="")return[];const o=r.length>0&&!r.endsWith(`
11
+ `)?`
12
+ `:"";return K(n,`${r}${o}
13
+ ${s}
14
+ `),H(t).filter(a=>!i.has(a.key)).map(a=>a.key)},ae=e=>{const t=e.randomHex??E,n=[],r=F(e.existingContent,t,n,e.mintable),i=new Set(g(e.existingContent).map(d=>d.key)),s=[],o=[];for(const d of b)i.has(d.key)||(s.push(d.key),o.push(`# ${d.description}`,`${d.key}="${t(w)}"`));const a=r.join(`
15
+ `);if(o.length===0)return{addedKeys:s,content:a,filledKeys:n};const l=a===""||a.endsWith(`
16
+ `)?"":`
17
+ `;return{addedKeys:s,content:`${a}${l}${o.join(`
18
+ `)}
19
+ `,filledKeys:n}},pe=e=>{const t=m(e.cwd,u),n=p(t);if(n.kind==="unreadable")return{addedKeys:[],filledKeys:[],status:"unchanged"};const r=n.kind==="read",i=r?n.content:"",s=e.secretSources===void 0?void 0:U(e.secretSources),o=ae({existingContent:i,mintable:s,randomHex:e.randomHex}),a=g(o.content).find(d=>d.key===y)?.value;if(s!==void 0&&!s.has(y)&&a!==void 0&&P(a)&&e.info?.(`${y} is still a placeholder. This worker only calls an event log hosted elsewhere, so set it to the ${y} of the worker that hosts EventLogDO.`),o.filledKeys.length===0&&o.addedKeys.length===0)return{addedKeys:[],filledKeys:[],status:"unchanged"};if(r)K(t,o.content,{mode:384});else if(!M(t,o.content))return{addedKeys:[],filledKeys:[],status:"unchanged"};const l=[...o.filledKeys,...o.addedKeys];return e.info?.(`Generated ${String(l.length)} dev secret(s) in ${u}: ${l.join(", ")}`),{addedKeys:o.addedKeys,filledKeys:o.filledKeys,status:r?"filled":"created"}};export{ie as buildPackageSecretsBlock,he as ensureDevVariables,Se as ensureDevVarsExample,pe as fillDevSecrets,ge as generateSecretValue,Q as isMintableSecretKey,P as isPlaceholderValue,ae as planDevSecretsFill,A as planDevVariablesAugment,Z as planDevVariablesScaffold,H as requiredSecrets,Ee as writeDevVariablesFileAtomically};
@@ -1,3 +1,3 @@
1
- import{writeFileSync as $,rmSync as W,existsSync as w,readFileSync as A}from"node:fs";import{dirname as E,resolve as h,join as v,sep as y,relative as _,isAbsolute as B}from"node:path";import{MissingBuildOutputError as x}from"./MissingBuildOutputError-BAyekzof.mjs";import{D1_PLACEHOLDER_ID as F}from"./D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{findWranglerFile as K,readWranglerJsonc as Y}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{DEV_VARS_FILE as G,parseDevVariableEntries as J}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import D from"./ensureGitignoreEntries-Tsk8Qkw7.mjs";import{c as k}from"./celld-binding-id-9MiUoteo.mjs";const q=".celld.wrangler.json",C=[".celld/",".celld.wrangler.json",".celld.service.*.wrangler.json"],M=v(".wrangler","deploy","config.json"),U=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"]),H=new Set(["class_name","image","instance_type","max_instances","name","runtime"]),X=new Set(["CompiledWasm","Data","Text"]),z=/\r?\n/u,Q=/[!*?[]/u,Z=/[.[]/u,ee=["deleted_classes","new_classes","renamed_classes","transferred_classes"],c=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),I=e=>Array.isArray(e)&&e.length===0||c(e)&&Object.values(e).every(s=>I(s)),re=e=>Array.isArray(e)?e.map(s=>{if(!c(s))return s;const r=ee.find(t=>s[t]!==void 0);if(r!==void 0)throw new Error(`migration "${String(s.tag)}" uses \`${r}\`, which celld refuses — celld accepts only \`new_sqlite_classes\` migrations`);return{new_sqlite_classes:s.new_sqlite_classes,tag:s.tag}}):e,se=(e,s)=>Array.isArray(e)?e.map((r,t)=>c(r)?Object.fromEntries(Object.entries(r).filter(([n])=>{const i=H.has(n);return i||s.push(`containers[${String(t)}].${n}`),i})):r):e,te=(e,s)=>Array.isArray(e)?e.filter((r,t)=>{const n=c(r)&&typeof r.type=="string"&&X.has(r.type);return n||s.push(`rules[${String(t)}]`),n}):e,ne=e=>{const s=[],r={};for(const[t,n]of Object.entries(c(e)?e:{}))c(n)&&n.type==="workflow"?s.push({binding:t,class_name:t,name:n.name}):r[t]=n;return{bindings:s,rest:r}},ie=(e,s)=>Array.isArray(e)?e.map(r=>!c(r)||r.database_id!==F?r:typeof r.database_name=="string"?{...r,database_id:r.database_name}:typeof r.binding=="string"?{...r,database_id:k(s,r.binding)}:r):e,oe=(e,s)=>Array.isArray(e)?e.map(r=>c(r)&&r.id===void 0&&typeof r.binding=="string"?{...r,id:k(s,r.binding)}:r):e,N=e=>{const s=[],r={},t=ne(e.exports),n={...e,exports:t.rest};for(const[i,o]of Object.entries(n)){if(!U.has(i)){I(o)||s.push(i);continue}switch(i){case"containers":{r[i]=se(o,s);break}case"d1_databases":{r[i]=ie(o,e.name);break}case"kv_namespaces":{r[i]=oe(o,e.name);break}case"migrations":{r[i]=re(o);break}case"rules":{r[i]=te(o,s);break}default:r[i]=o}}if(t.bindings.length>0){const i=Array.isArray(r.workflows)?r.workflows:[];r.workflows=[...i,...t.bindings]}return{config:r,dropped:s}},ae=e=>{const[s=[],...r]=e.map(n=>h(n).split(y));let t=0;for(;t<s.length&&r.every(n=>n[t]===s[t]);)t+=1;return s.slice(0,t).join(y)||y},P=(e,s,r)=>{const t=i=>_(r,h(s,i)).split(y).join("/"),n={...e};return typeof e.main=="string"&&(n.main=t(e.main)),c(e.assets)&&typeof e.assets.directory=="string"&&(n.assets={...e.assets,directory:t(e.assets.directory)}),n},ce=e=>{const s=v(e,".assetsignore");if(!w(s))return;const r=A(s,"utf8").split(z).map(t=>t.trim()).filter(t=>t!==""&&!t.startsWith("#")).filter(t=>Q.test(t)||w(v(e,t)));if(r.length>0)throw new Error(`${s} hides ${r.join(", ")} from the assets, and celld has no .assetsignore — remove those files from ${e} first`);return s},le=(e,s)=>{const r=v(e,M);if(!w(r))throw new x(`wrangler \`main\` is the Vite virtual module "${s}", so celld deploys the Vite build output — and there is none yet. Run the project's build (\`vite build\`) first`);const{configPath:t}=JSON.parse(A(r,"utf8"));if(typeof t!="string")throw new TypeError(`${r} names no configPath`);return h(E(r),t)},S=e=>{const{parsed:s}=Y(e);if(s===void 0)throw new Error(`${e} is not valid JSONC`);return s},T=(e,s,r,t)=>{const{d1_databases:n}=e;if(!Array.isArray(n)||t===r)return e;const i=Array.isArray(s.d1_databases)?s.d1_databases.filter(o=>c(o)):[];return{...e,d1_databases:n.map(o=>{if(!c(o))return o;const a=i.find(m=>m.binding===o.binding),l=a?.migrations_dir,p=h(r,typeof l=="string"?l:"migrations"),d=w(p)?{...o,migrations_dir:_(t,p).split(y).join("/")}:o,f=a?.migrations_pattern;return typeof f=="string"?{...d,migrations_pattern:_(t,h(r,f)).split(y).join("/")}:d})}},de=(e,s,r,t)=>{const{main:n}=r;if(typeof n!="string"||!n.startsWith("virtual:"))return{fromBuild:!1,source:r,sourcePath:s};if(t==="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 i=le(e,n);return{fromBuild:!0,source:S(i),sourcePath:i}},fe=(e,s,r,t,n)=>{const i=s.filter(l=>Object.hasOwn(r,l.split(Z)[0]??l));let o=e;e.no_bundle!==void 0&&(o=Object.fromEntries(Object.entries(e).filter(([l])=>l!=="no_bundle")),i.push("no_bundle (celld re-bundles the build output)"));const a=t===void 0?void 0:ce(t);return a!==void 0&&i.push(`${_(n,a)} (matched no files)`),{assetsIgnore:a,projected:o,reported:i}},R=(e,s={})=>{const r=c(e.vars)?e.vars:{};return{...e,vars:{...r,WORKER_ENV:"development",...s}}},_e=(e,s)=>{const r=K(e);if(r===void 0)throw new Error(`no wrangler.jsonc or wrangler.json in ${e} — celld deploys from the project's Wrangler config`);const t=S(r),{fromBuild:n,source:i,sourcePath:o}=de(e,r,t,s),a=E(o),{config:l,dropped:p}=N(i),{assets:d}=i,f=c(d)&&typeof d.directory=="string"?h(a,d.directory):void 0,m=typeof i.main=="string"?E(h(a,i.main)):void 0,u=ae([a,m,f].filter(L=>L!==void 0));if(!n&&u!==a)throw new Error(`wrangler \`main\` and \`assets.directory\` must sit inside ${a} — celld resolves everything against the config's directory`);const b=T(P(l,a,u),t,e,u),g=n?fe(b,p,t,f,u):{assetsIgnore:void 0,projected:b,reported:p},j=s==="dev"?R(g.projected):g.projected,O=v(u,q),V=`${JSON.stringify(j,void 0,4)}
1
+ import{writeFileSync as $,rmSync as W,existsSync as w,readFileSync as A}from"node:fs";import{dirname as E,resolve as h,join as v,sep as y,relative as _,isAbsolute as B}from"node:path";import{MissingBuildOutputError as x}from"./MissingBuildOutputError-BAyekzof.mjs";import{D1_PLACEHOLDER_ID as F}from"./D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{findWranglerFile as K,readWranglerJsonc as Y}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{DEV_VARS_FILE as G,parseDevVariableEntries as J}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import D from"./ensureGitignoreEntries-DFNmLdCz.mjs";import{c as k}from"./celld-binding-id-9MiUoteo.mjs";const q=".celld.wrangler.json",C=[".celld/",".celld.wrangler.json",".celld.service.*.wrangler.json"],M=v(".wrangler","deploy","config.json"),U=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"]),H=new Set(["class_name","image","instance_type","max_instances","name","runtime"]),X=new Set(["CompiledWasm","Data","Text"]),z=/\r?\n/u,Q=/[!*?[]/u,Z=/[.[]/u,ee=["deleted_classes","new_classes","renamed_classes","transferred_classes"],c=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),I=e=>Array.isArray(e)&&e.length===0||c(e)&&Object.values(e).every(s=>I(s)),re=e=>Array.isArray(e)?e.map(s=>{if(!c(s))return s;const r=ee.find(t=>s[t]!==void 0);if(r!==void 0)throw new Error(`migration "${String(s.tag)}" uses \`${r}\`, which celld refuses — celld accepts only \`new_sqlite_classes\` migrations`);return{new_sqlite_classes:s.new_sqlite_classes,tag:s.tag}}):e,se=(e,s)=>Array.isArray(e)?e.map((r,t)=>c(r)?Object.fromEntries(Object.entries(r).filter(([n])=>{const i=H.has(n);return i||s.push(`containers[${String(t)}].${n}`),i})):r):e,te=(e,s)=>Array.isArray(e)?e.filter((r,t)=>{const n=c(r)&&typeof r.type=="string"&&X.has(r.type);return n||s.push(`rules[${String(t)}]`),n}):e,ne=e=>{const s=[],r={};for(const[t,n]of Object.entries(c(e)?e:{}))c(n)&&n.type==="workflow"?s.push({binding:t,class_name:t,name:n.name}):r[t]=n;return{bindings:s,rest:r}},ie=(e,s)=>Array.isArray(e)?e.map(r=>!c(r)||r.database_id!==F?r:typeof r.database_name=="string"?{...r,database_id:r.database_name}:typeof r.binding=="string"?{...r,database_id:k(s,r.binding)}:r):e,oe=(e,s)=>Array.isArray(e)?e.map(r=>c(r)&&r.id===void 0&&typeof r.binding=="string"?{...r,id:k(s,r.binding)}:r):e,N=e=>{const s=[],r={},t=ne(e.exports),n={...e,exports:t.rest};for(const[i,o]of Object.entries(n)){if(!U.has(i)){I(o)||s.push(i);continue}switch(i){case"containers":{r[i]=se(o,s);break}case"d1_databases":{r[i]=ie(o,e.name);break}case"kv_namespaces":{r[i]=oe(o,e.name);break}case"migrations":{r[i]=re(o);break}case"rules":{r[i]=te(o,s);break}default:r[i]=o}}if(t.bindings.length>0){const i=Array.isArray(r.workflows)?r.workflows:[];r.workflows=[...i,...t.bindings]}return{config:r,dropped:s}},ae=e=>{const[s=[],...r]=e.map(n=>h(n).split(y));let t=0;for(;t<s.length&&r.every(n=>n[t]===s[t]);)t+=1;return s.slice(0,t).join(y)||y},P=(e,s,r)=>{const t=i=>_(r,h(s,i)).split(y).join("/"),n={...e};return typeof e.main=="string"&&(n.main=t(e.main)),c(e.assets)&&typeof e.assets.directory=="string"&&(n.assets={...e.assets,directory:t(e.assets.directory)}),n},ce=e=>{const s=v(e,".assetsignore");if(!w(s))return;const r=A(s,"utf8").split(z).map(t=>t.trim()).filter(t=>t!==""&&!t.startsWith("#")).filter(t=>Q.test(t)||w(v(e,t)));if(r.length>0)throw new Error(`${s} hides ${r.join(", ")} from the assets, and celld has no .assetsignore — remove those files from ${e} first`);return s},le=(e,s)=>{const r=v(e,M);if(!w(r))throw new x(`wrangler \`main\` is the Vite virtual module "${s}", so celld deploys the Vite build output — and there is none yet. Run the project's build (\`vite build\`) first`);const{configPath:t}=JSON.parse(A(r,"utf8"));if(typeof t!="string")throw new TypeError(`${r} names no configPath`);return h(E(r),t)},S=e=>{const{parsed:s}=Y(e);if(s===void 0)throw new Error(`${e} is not valid JSONC`);return s},T=(e,s,r,t)=>{const{d1_databases:n}=e;if(!Array.isArray(n)||t===r)return e;const i=Array.isArray(s.d1_databases)?s.d1_databases.filter(o=>c(o)):[];return{...e,d1_databases:n.map(o=>{if(!c(o))return o;const a=i.find(m=>m.binding===o.binding),l=a?.migrations_dir,p=h(r,typeof l=="string"?l:"migrations"),d=w(p)?{...o,migrations_dir:_(t,p).split(y).join("/")}:o,f=a?.migrations_pattern;return typeof f=="string"?{...d,migrations_pattern:_(t,h(r,f)).split(y).join("/")}:d})}},de=(e,s,r,t)=>{const{main:n}=r;if(typeof n!="string"||!n.startsWith("virtual:"))return{fromBuild:!1,source:r,sourcePath:s};if(t==="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 i=le(e,n);return{fromBuild:!0,source:S(i),sourcePath:i}},fe=(e,s,r,t,n)=>{const i=s.filter(l=>Object.hasOwn(r,l.split(Z)[0]??l));let o=e;e.no_bundle!==void 0&&(o=Object.fromEntries(Object.entries(e).filter(([l])=>l!=="no_bundle")),i.push("no_bundle (celld re-bundles the build output)"));const a=t===void 0?void 0:ce(t);return a!==void 0&&i.push(`${_(n,a)} (matched no files)`),{assetsIgnore:a,projected:o,reported:i}},R=(e,s={})=>{const r=c(e.vars)?e.vars:{};return{...e,vars:{...r,WORKER_ENV:"development",...s}}},_e=(e,s)=>{const r=K(e);if(r===void 0)throw new Error(`no wrangler.jsonc or wrangler.json in ${e} — celld deploys from the project's Wrangler config`);const t=S(r),{fromBuild:n,source:i,sourcePath:o}=de(e,r,t,s),a=E(o),{config:l,dropped:p}=N(i),{assets:d}=i,f=c(d)&&typeof d.directory=="string"?h(a,d.directory):void 0,m=typeof i.main=="string"?E(h(a,i.main)):void 0,u=ae([a,m,f].filter(L=>L!==void 0));if(!n&&u!==a)throw new Error(`wrangler \`main\` and \`assets.directory\` must sit inside ${a} — celld resolves everything against the config's directory`);const b=T(P(l,a,u),t,e,u),g=n?fe(b,p,t,f,u):{assetsIgnore:void 0,projected:b,reported:p},j=s==="dev"?R(g.projected):g.projected,O=v(u,q),V=`${JSON.stringify(j,void 0,4)}
2
2
  `;return{configPath:O,dropped:g.reported,vars:c(j.vars)?j.vars:{},write:()=>{if(!n)try{D(u,C)}catch{}$(O,V),g.assetsIgnore!==void 0&&W(g.assetsIgnore)}}},be=(e,s)=>{const r=S(s),t=E(s),{config:n,dropped:i}=N(r),o=typeof r.name=="string"?r.name:"service",a=_(e,t);if(a===".."||a.startsWith(`..${y}`)||B(a))throw new Error(`service ${o} (${t}) must sit inside ${e} — celld dev runs it from a config beside the app's`);const l=v(t,G),p=w(l)?Object.fromEntries(J(A(l,"utf8")).map(({key:b,value:g})=>[b,g])):{},d=T(P(n,t,e),r,t,e),f=v(e,`.celld.service.${o.replaceAll(/[^\w.-]/gu,"-")}.wrangler.json`),m=R(d,p),u=`${JSON.stringify(m,void 0,4)}
3
3
  `;return{configPath:f,dropped:i,vars:c(m.vars)?m.vars:{},write:()=>{D(e,C),$(f,u)}}};export{be as a,N as b,_e as p};
@@ -1,2 +1,2 @@
1
- import{createRequire as ee}from"node:module";import{join as V}from"node:path";import{containerBuildTag as ne}from"@lunora/container";import{readJsonSync as se}from"@visulima/fs";import{c as te}from"./celld-binding-id-9MiUoteo.mjs";import{applyModify as w}from"./applyModify-DKP2l6S9.mjs";import{s as F,d as k,a as ie}from"./studio-assets-BKWx838V.mjs";import{recordManifestKey as oe,readManifest as ae}from"./readManifest-Cighz3WC.mjs";import{D1_PLACEHOLDER_ID as Y,HYPERDRIVE_PLACEHOLDER_ID as re}from"./D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{n as de,w as ce,p as le,s as Q,o as D,q as C,t as ue}from"./validate-bindings-DSMH8bRQ.mjs";import{parseTree as ge,findNodeAtLocation as me}from"jsonc-parser";import{r as pe,a as fe,p as be,b as he}from"./reconcile-services-CjgIJKim.mjs";import{readFileSync as ve}from"node:fs";import{DEV_VARS_FILE as we,parseDevVariableEntries as _e}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{secretSourcesFromBindings as ye}from"./inferLunoraBindings-BUk28bSQ.mjs";import{requiredSecrets as Se}from"./buildPackageSecretsBlock-DrSD60vH.mjs";import{a as xe}from"./spa-assets-wX8rTPEQ.mjs";import{DEFAULT_OBSERVABILITY as Ee}from"./DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{findWranglerFile as Ae,readWranglerJsonc as Oe}from"./WRANGLER_FILES-BF8PUjuo.mjs";const ke=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],q=e=>Object.fromEntries(ke.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",$e=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,Ne=/^[\t ]*,/u,Ce=(e,n)=>{const s=ge(e),t=s===void 0?void 0:me(s,[...n])?.parent;if(t?.type==="property"){const o=t.offset+t.length,i=e.lastIndexOf(`
1
+ import{createRequire as ee}from"node:module";import{join as V}from"node:path";import{containerBuildTag as ne}from"@lunora/container";import{readJsonSync as se}from"@visulima/fs";import{c as te}from"./celld-binding-id-9MiUoteo.mjs";import{applyModify as w}from"./applyModify-DKP2l6S9.mjs";import{s as F,d as k,a as ie}from"./studio-assets-BKWx838V.mjs";import{recordManifestKey as oe,readManifest as ae}from"./readManifest-Cighz3WC.mjs";import{D1_PLACEHOLDER_ID as Y,HYPERDRIVE_PLACEHOLDER_ID as re}from"./D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{n as de,w as ce,p as le,s as Q,o as D,q as C,t as ue}from"./validate-bindings-DSMH8bRQ.mjs";import{parseTree as ge,findNodeAtLocation as me}from"jsonc-parser";import{r as pe,a as fe,p as be,b as he}from"./reconcile-services-CjgIJKim.mjs";import{readFileSync as ve}from"node:fs";import{DEV_VARS_FILE as we,parseDevVariableEntries as _e}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{secretSourcesFromBindings as ye}from"./inferLunoraBindings-BUk28bSQ.mjs";import{requiredSecrets as Se}from"./buildPackageSecretsBlock-Jla_XY6q.mjs";import{a as xe}from"./spa-assets-wX8rTPEQ.mjs";import{DEFAULT_OBSERVABILITY as Ee}from"./DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{findWranglerFile as Ae,readWranglerJsonc as Oe}from"./WRANGLER_FILES-BF8PUjuo.mjs";const ke=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],q=e=>Object.fromEntries(ke.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",$e=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,Ne=/^[\t ]*,/u,Ce=(e,n)=>{const s=ge(e),t=s===void 0?void 0:me(s,[...n])?.parent;if(t?.type==="property"){const o=t.offset+t.length,i=e.lastIndexOf(`
2
2
  `,t.offset-1)+1,a=$e.exec(e.slice(o));if(a!==null&&e.slice(i,t.offset).trim()===""){const m=t.parent?.children??[],u=m.indexOf(t),d=u===m.length-1&&u>0?m[u-1]:void 0,c=d===void 0?void 0:Ne.exec(e.slice(d.offset+d.length))??void 0;return(c===void 0||d===void 0?e.slice(0,i):e.slice(0,d.offset+d.length)+e.slice(d.offset+d.length+c[0].length,i))+e.slice(o+a[0].length)}}return w(e,n,void 0)},U=(e,n,s,t,o,i=new Set)=>{const a=s.join("."),m={},u=[],d=[];let c=e;return{entries:n.map((l,v)=>{const g=t(l);if(g===void 0||l.queue===void 0)return l;const f=Object.fromEntries(Object.entries(q(g)).filter(([h])=>!i.has(h))),b=Object.entries(o[l.queue]??{}).filter(([h])=>!Object.hasOwn(f,h)),_=Object.entries(f).filter(([h,y])=>l[h]!==y),x=b.filter(([h,y])=>l[h]===y).map(([h])=>h),E=Object.fromEntries(Object.entries({...l,...f}).filter(([h])=>!x.includes(h)));for(const[h,y]of _)c=w(c,[...s,v,h],y);for(const h of x)c=Ce(c,[...s,v,h]);for(const[h,y]of b){const A=l[h];A!==void 0&&A!==y&&d.push(`${a}/${l.queue}: ${h} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(A)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(_.length>0||x.length>0)&&u.push(`${a}/${l.queue} (${[..._.map(([h])=>h),...x.map(h=>`removed ${h}`)].join(", ")})`),Object.keys(f).length>0&&(m[l.queue]=f),E}),owned:m,text:c,updated:u,warnings:d}},Re=(e,n,s,t)=>{const o=n.queues??{},i=o.producers??[],a=o.consumers??[],m=new Set(i.map(g=>g?.binding)),u=new Set(a.map(g=>g.queue)),d=s.filter(g=>!m.has(g.bindingName)),c=s.filter(g=>!u.has(g.name)),p=U(e,a,["queues","consumers"],g=>s.find(f=>f.name===g.queue),t);let l=p.text;const v={...p.owned};if(d.length>0||c.length>0){const g=[...i,...d.map(b=>({binding:b.bindingName,queue:b.name}))],f=[...p.entries,...c.map(b=>({queue:b.name,...b.mode==="pull"?{type:"http_pull"}:{},...q(b)}))];for(const b of c){const _=q(b);Object.keys(_).length>0&&(v[b.name]=_)}l=w(l,["queues"],{consumers:f,producers:g})}return{added:[...d.map(g=>`queues.producers/${g.bindingName}`),...c.map(g=>`queues.consumers/${g.name}`)],owned:v,text:l,updated:p.updated,warnings:p.warnings}},Te=(e,n,s,t,o)=>{const i=n.env?.[t],a=i?.queues?.consumers??[],m=i?.queues?.producers??[],u=l=>{const v=m.find(g=>g?.queue===l.queue)?.binding;return v!==void 0?s.find(g=>g.bindingName===v):s.find(g=>g.name===l.queue&&!m.some(f=>f?.binding===g.bindingName))},d=U(e,a,["env",t,"queues","consumers"],u,o,new Set(["dead_letter_queue"])),c=a.filter(l=>l.queue!==void 0&&u(l)===void 0).map(l=>`env.${t}.queues.consumers/${String(l.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(l.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=a.flatMap(l=>{const v=u(l)?.tuning.deadLetterQueue;return v===void 0||l.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(l.queue)}: defineQueue declares deadLetterQueue "${v}", 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:d.owned,text:d.text,updated:d.updated,warnings:[...d.warnings,...p,...c]}},Ie=(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},je=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,o])=>Object.keys(o).length>0));oe(e,P,Object.keys(t).length===0?void 0:t)},De="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",qe=e=>{const n='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${n}. The namespace is created by the first repo create() if it does not exist yet.`:`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${De} and body { "namespace": "<name>", "jurisdiction": "${e}" }, then ${n}. A namespace's jurisdiction cannot be changed, and one created implicitly by the first repo create() is unrestricted. With CLOUDFLARE_API_TOKEN set, \`lunora deploy\` creates a missing namespace in that jurisdiction for a binding you have added.`},R="PIPELINES",T="ARTIFACTS",Pe=(e,n,s)=>{const t=n!==void 0&&(s===void 0||s==="cloudflare"),o=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(d=>d.binding===e.flagshipBinding),i=e.usesPipelines&&!(n?.pipelines??[]).some(d=>d.binding===R),a=e.usesArtifacts?n?.artifacts??[]:[],m=a.some(d=>d.binding===T)?[]:a.flatMap(d=>d.binding===void 0?[]:[d.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0&&(!t||e.jurisdiction!==void 0),e.jurisdiction===void 0?'ctx.kv is used but no kv_namespaces binding exists; add one ({ binding: "KV" }) — wrangler creates the namespace on the first deploy.':`ctx.kv is used and the schema pins data to "${e.jurisdiction}"; run \`wrangler kv namespace create <name> --jurisdiction ${e.jurisdiction}\` and add a kv_namespaces entry ({ binding: "KV", id }) — a namespace wrangler creates on deploy is unrestricted.`],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0&&!t,'@lunora/hyperdrive is used but no hyperdrive binding exists; add one ({ binding: "HYPERDRIVE", id }) — on a Cloudflare target `lunora deploy` creates the Hyperdrive config from a connection string.'],[e.usesArtifacts&&a.length===0&&(!t||e.jurisdiction!==void 0),qe(e.jurisdiction)],[i,`ctx.pipelines is used but no "${R}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${R}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[m.length>0,`ctx.artifacts is used and ${m.map(d=>`"${d}"`).join(", ")} ${m.length===1?"is":"are"} bound, but none is named "${T}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${T} and throws.`],[o,`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)},Be=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),I=(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.`),Le=(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,a])=>a?.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.`)},We=(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.`]})]},Me=(e,n)=>[...Le(e,n),...We(e,n)],G=[{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"}],Ke=()=>G.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Fe=e=>{let n;try{n=ve(V(e,we),"utf8")}catch{return!1}const s=new Map(_e(n).map(t=>[t.key,t.value]));return G.some(({keys:t})=>t.every(o=>(s.get(o)??"")!==""))},He=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),o=Se(ye(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.`]},j=(e,n,s,t)=>{const o=new Set(e.durableObjects.map(u=>u.className)),i=[],a=(s?.r2_buckets?.length??0)>0,m=(s?.d1_databases?.some(u=>u.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!a&&i.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&&!o.has("SessionDO")&&!m&&i.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&&!o.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(...I("container","containers",e.containers),...I("workflow","workflows",e.workflows),...I("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!Fe(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Ke()}.`),i.push(...Be(e),...Pe(e,s,t),...He(e,s)),s!==void 0&&i.push(...Me(e,s)),i},Ve=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:a})=>({className:i,exportName:a,kind:s,module:t}))),Ye=e=>{const n=new Set(D(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},Qe=e=>{const n=new Set;for(const s of D(e)){for(const t of C(s.deleted_classes))n.delete(t);for(const{from:t,to:o}of D(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},Ue=(e,n,s)=>{const t=n.durable_objects?.bindings??[],o=new Set(t.map(c=>c.name)),i=s.filter(c=>!o.has(c.binding));let a=e;const m=[];if(i.length>0){const c=[...t,...i.map(p=>({class_name:p.className,name:p.binding}))];a=w(a,["durable_objects","bindings"],c),m.push(...i.map(p=>`${p.binding}/${p.className}`))}const u=n.migrations??[],d=s.map(c=>c.className).filter(c=>!Qe(u).has(c));if(d.length>0){const c=[...u,{new_sqlite_classes:d,tag:Ye(u)}];a=w(a,["migrations"],c)}return{added:m,text:a}},B=e=>e===void 0||e==="cloudflare",Ge=(e,n)=>e.includes("DB (D1)")&&B(n)?[`wrote a DB binding with a placeholder database_id ("${Y}") — run \`wrangler d1 create <name>\` and replace it before deploying.`]:[],Je=(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:Y,database_name:t}];return{added:["DB (D1)"],text:w(e,["d1_databases"],o)}},Xe={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)"}},ze=(e,n)=>e.usesAnalyticsSql&&ie(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,$=(e,n,s)=>{const{binding:t,label:o}=Xe[s],i=n[s]?.binding;if(typeof i=="string"&&i.length>0)return{added:[],text:e};const a=k(n,t);return a!==void 0?{added:[],text:e,warnings:[`${s}: not adding the ${o} binding — the name "${t}" is already bound by \`${a}\` in wrangler.jsonc. Rename that binding, then set ${s}.binding by hand.`]}:{added:[o],text:w(e,[s],{binding:t})}},L=(e,n,s)=>`${e}: not adding "${n}" — the name is already bound by \`${s}\` in wrangler.jsonc. Add a ${e} entry under another binding name and point the matching \`defineApp()\` override at it.`,Ze=(e,n,s)=>{if(!B(s)||(n.hyperdrive?.length??0)>0)return{added:[],text:e};const t=k(n,"HYPERDRIVE");return t!==void 0?{added:[],text:e,warnings:[L("hyperdrive","HYPERDRIVE",t)]}:{added:["HYPERDRIVE (Hyperdrive, created on deploy)"],text:w(e,["hyperdrive"],[{binding:"HYPERDRIVE",id:re}])}},en=new Set(["celld","cloudflare"]),nn=(e,n,s,t)=>{if(t!==void 0&&!en.has(t)||s!==void 0||(n.kv_namespaces?.length??0)>0)return{added:[],text:e};const o=k(n,"KV");return o!==void 0?{added:[],text:e,warnings:[L("kv_namespaces","KV",o)]}:{added:[t==="celld"?`KV (Workers KV, celld namespace ${te(n.name,"KV")})`:"KV (Workers KV, created on deploy)"],text:w(e,["kv_namespaces"],[{binding:"KV"}])}},sn=(e,n,s,t)=>{if(!B(t)||s!==void 0||(n.artifacts?.length??0)>0)return{added:[],text:e};const o=k(n,"ARTIFACTS");if(o!==void 0)return{added:[],text:e,warnings:[L("artifacts","ARTIFACTS",o)]};const i=typeof n.name=="string"&&n.name.length>0?n.name:"lunora";return{added:["ARTIFACTS (Cloudflare Artifacts)"],text:w(e,["artifacts"],[{binding:"ARTIFACTS",namespace:i}])}},H=(e,n,s,t,o)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const i=k(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:w(e,[s],[t])}},tn=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:w(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},on=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},an=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:ne(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}}},rn=e=>{if(e.schedulingPolicy==="durable_object")return J(e);const{image:n}=e,s={class_name:e.className,image:an(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=on(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},dn=(e,n,s)=>{const t=n.containers??[],o=new Set(t.map(d=>d.class_name)),i=s.filter(d=>!o.has(d.className));let a=i.length===0?e:w(e,["containers"],[...t,...i.map(d=>rn(d))]);const m=[],u=[];for(const[d,c]of t.entries()){const p=s.find(g=>g.className===c.class_name);if(p===void 0)continue;const l=p.schedulingPolicy??"default";if((c.scheduling_policy??"default")!==l){u.push(`containers/${p.className} has scheduling_policy "${c.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${p.exportName}" declares "${l}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const v=p.schedulingPolicy==="durable_object"?J(p).images:void 0;v!==void 0&&JSON.stringify(c.images)!==JSON.stringify(v)&&(a=w(a,["containers",d,"images"],v),m.push(`containers/${p.className}.images`))}return{added:i.map(d=>`containers/${d.className}`),text:a,updated:m,warnings:u}},cn=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=w(e,["observability"],{...Ee});return{added:["observability"],text:s}},ln=(e,n)=>n.upload_source_maps!==void 0?{added:[],text:e}:{added:["upload_source_maps"],text:w(e,["upload_source_maps"],!0)},X=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],un=X.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),gn=(e,n)=>{try{const s=ee(V(e,"package.json")).resolve(`${n}/package.json`),[t=0,o=0]=String(se(s).version).split(".").map(Number);return[t,o]}catch{return}},mn=e=>{const n=X.flatMap(({minimum:s,name:t})=>{const o=gn(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 ${un}\`) and re-run.`},pn=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.`]:[]),fn=(e,n,s)=>{let t=e;const o=[],i=[];for(const a of s){const m=n[a.className];if(m?.type==="workflow")for(const{of:u,path:d}of ue){const c=u(a),p=Q(m,d),l=`exports/${a.className}.${d.join(".")}`;if(c===void 0){p!==void 0&&i.push(`${l} is set in wrangler.jsonc but defineWorkflow "${a.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(c)&&(t=w(t,["exports",a.className,...d],c),o.push(l))}}return{text:t,updated:o,warnings:i}},bn=(e,n,s,t,o)=>{if(o!==void 0)return{added:[],text:e,warnings:[o]};const i=[...s.map(f=>({settings:ce(f),workflow:f})),...t.map(f=>({settings:{},workflow:f}))],a=new Set(i.map(({workflow:f})=>f.className)),m=n.workflows??[],u=m.filter(f=>f.script_name===void 0&&f.class_name!==void 0&&a.has(f.class_name)),d=n.exports??{},c=[],p=[],l=[];let v=e;for(const{settings:f,workflow:b}of i){if(d[b.className]!==void 0&&d[b.className]!==null)continue;const _=u.find(h=>h.class_name===b.className),x=Object.fromEntries(le.flatMap(h=>{const y=Q(_,[h]);return y===void 0?[]:[[h,y]]})),E=_?.name??b.name;_?.name!==void 0&&_.name!==b.name&&l.push(`workflows/${b.className} is deployed as "${_.name}" but declared as "${b.name}" — its export keeps "${_.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),v=w(v,["exports",b.className],{type:"workflow",...x,...f,name:E}),(_===void 0?c:p).push(`exports/${b.className}`)}if(u.length>0){const f=m.filter(b=>!u.includes(b));v=w(v,["workflows"],f.length===0?void 0:f),p.push(...u.map(b=>`workflows/${String(b.class_name)} → exports`))}l.push(...pn(n));const g=fn(v,d,s);return{added:c,text:g.text,updated:[...p,...g.updated],warnings:[...l,...g.warnings]}},qn=(e,n,{environment:s,target:t}={})=>{const o=Ae(e),i=Ve(n);if(!o)return{added:[],exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:j(n,e)};const{parsed:a,text:m}=Oe(o);if(a===void 0)return{added:[],exportGaps:i,reason:`failed to parse ${o} as JSONC`,updated:[],warnings:j(n,e),wranglerPath:o};const u=j(n,e,a,t);if(s!==void 0){const r=a.env?.[s]!==void 0;u.push(r?`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 d=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),p=[...n.durableObjects,...d.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],l=n.workflows.filter(r=>r.exported),v=n.agents.filter(r=>r.exported),g=ae(e),f=Ie(g,u),b={},_=pe(g);let x,E={unwritten:{},written:{}};const h=[{enabled:!0,run:r=>Ue(r,a,p)},{enabled:n.needsD1,run:r=>Je(r,a)},{enabled:n.usesKv,run:r=>nn(r,a,n.jurisdiction,t)},{enabled:n.usesHyperdrive,run:r=>Ze(r,a,t)},{enabled:n.usesArtifacts,run:r=>sn(r,a,n.jurisdiction,t)},{enabled:n.usesAi,run:r=>$(r,a,"ai")},{enabled:n.usesAiSearch,run:r=>H(r,a,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:ze(n,e),run:r=>$(r,a,"analytics")},{enabled:n.usesBrowser,run:r=>$(r,a,"browser")},{enabled:n.usesImages,run:r=>$(r,a,"images")},{enabled:n.usesAnalytics,run:r=>H(r,a,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>tn(r,a)},{enabled:!0,run:r=>cn(r,a)},{enabled:t===void 0||t==="cloudflare",run:r=>ln(r,a)},{enabled:(t===void 0||t==="cloudflare")&&n.workerRoutes!==void 0,run:r=>de(r,a,n.workerRoutes??[],g,xe(e),F(e,a,t))},{enabled:d.length>0,run:r=>dn(r,a,d)},{enabled:l.length>0||v.length>0,run:r=>bn(r,a,l,v,mn(e))},{enabled:n.queues.length>0,run:r=>{const S=Re(r,a,n.queues,f.queues??{});return b.queues=S.owned,{...S,record:{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:N=>{je(N,f,b)}}}}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(_).length>0),run:r=>{const S=fe(r,a,n.services??[],_);return x=S.owned,{...S,record:{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:(N,{devConfigWritten:Z})=>{he(N,{...x,...Z?E.written:E.unwritten})}}}}},...s===void 0||a.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const S=`env.${s}.queues`,O=Te(r,a,n.queues,s,f[S]??{});return b[S]=O.owned,O}}]];let y=m;const A=[],W=[],M=[];for(const r of h){if(!r.enabled)continue;const S=r.run(y);y=S.text,A.push(...S.added),W.push(...S.updated??[]),u.push(...S.warnings??[]),M.push(...[S.record].filter(O=>O!==void 0))}let K;if(n.services!==void 0){const r=be(e,n.services,_);u.push(...r.warnings),E={unwritten:r.previouslyOwned,written:r.owned},K=r}u.push(...Ge(A,t));const z=F(e,a,t)?.directory;return{added:A,devConfig:K,edit:{assetsDirectory:z,manifest:g,original:m,records:M,text:y},exportGaps:i,updated:W,warnings:u,wranglerPath:o}};export{Ve as collectExportGaps,qn as planWranglerBindings};
@@ -0,0 +1 @@
1
+ import{rmSync as c,readdirSync as l,writeFileSync as u,lstatSync as f}from"node:fs";import{join as s,dirname as d}from"node:path";import g from"./ensureGitignoreEntries-DFNmLdCz.mjs";import{gitCheckIgnore as m}from"./gitCheckIgnore-DmE9479j.mjs";import{i as h}from"./is-within-directory-DRMw89rK.mjs";const p=/^\.wrangler\.lunora-(?:dev|service)\.(\d+)\.\d+\.jsonc$/,y=".wrangler.lunora-*.jsonc";let a=0;const A=n=>(a+=1,`.wrangler.lunora-${n}.${String(process.pid)}.${String(a)}.jsonc`),w=n=>{try{return process.kill(n,0),!0}catch(r){return r.code==="EPERM"}},I=n=>{let r;try{r=l(n)}catch{return}for(const t of r){const e=p.exec(t);if(!(e===null||Number(e[1])===process.pid||w(Number(e[1]))))try{c(s(n,t),{force:!0})}catch{}}},N=()=>{},C=n=>{let r=!1;return()=>{if(!r){r=!0;try{c(n,{force:!0})}catch{}}}},b=(n,r)=>{const t=d(n),e=t!==r&&h(t,r)?[r,t]:[t];try{for(const o of e){if(m(n,{noIndex:!0})!=="not-ignored")return;f(s(o,".gitignore"),{throwIfNoEntry:!1})?.isSymbolicLink()!==!0&&g(o,[y])}}catch{}},O=(n,r,t,e)=>{I(n);const o=s(n,A(r));return b(o,e),u(o,t,"utf8"),{cleanup:C(o),configPath:o}},k=(n,r)=>{const t=n?.ai,e=n?.artifacts,o=(Array.isArray(e)?e:[]).flatMap(i=>typeof i?.binding=="string"?[i.binding]:[]);return t==null&&o.length===0?[]:r()?[]:[...t==null?[]:[{binding:typeof t.binding=="string"?t.binding:"AI",kind:"ai"}],...o.map(i=>({binding:i,kind:"artifacts"}))]},L=({binding:n,kind:r})=>r==="ai"?`Workers AI is off in this dev session (${n} binding left out): no usable 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.`:`Artifacts is off in this dev session (${n} binding left out): no usable Cloudflare login found, and Artifacts only runs remotely. \`ctx.artifacts\` will throw. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`;export{y as DEV_CONFIG_IGNORE,p as STALE_DEV_CONFIG,C as createCleanup,L as describeWithheld,A as devConfigBasename,N as noopCleanup,I as sweepStaleDevConfigs,k as withheldBindings,O as writeDevConfig};
@@ -1 +1 @@
1
- import{readdirSync as w,existsSync as g}from"node:fs";import{join as l,relative as p,sep as y,isAbsolute as _,resolve as f,dirname as A}from"node:path";import{readProjectSecurityHeaders as D}from"@lunora/codegen";import{i as d}from"./is-plain-object-CWxHeOY1.mjs";import{w as E,e as S}from"./asset-headers-CPuEX21i.mjs";import u from"./canonicalPath-DrfMiT3U.mjs";import{resolveProjectTarget as j}from"./assertBuildTargetMatches-D11J7F38.mjs";import{findWranglerFile as P,readWranglerJsonc as $}from"./WRANGLER_FILES-BF8PUjuo.mjs";const R=/\[(name|hash|extname|ext|format)(?::(\d+))?\]/gu,b=/[$()*+.?[\\\]^{|}]/gu,H=/\.map$/u,T=8,h=e=>e.replaceAll(b,String.raw`\$&`),x=e=>{let t="",r=0;for(const o of e.matchAll(R)){t+=h(e.slice(r,o.index));const[,s,n]=o;switch(s){case"extname":{t+=String.raw`(?:\.[^/]+)?`;break}case"hash":{t+=String.raw`[\w-]{${n??String(T)}}`;break}case"name":{t+=".*";break}default:t+="[^/]*"}r=o.index+o[0].length}return new RegExp(`^${t}${h(e.slice(r))}$`,"u")},L=(e,t)=>{try{return w(l(e,t),{recursive:!0,withFileTypes:!0}).filter(r=>r.isFile()).map(r=>p(e,l(r.parentPath,r.name)).split(y).join("/"))}catch{return[]}},U=(e,t,r)=>{const o=r.map(s=>x(s));return L(e,t).every(s=>o.some(n=>n.test(s.replace(H,""))))},F=()=>{const e=process.env.CLOUDFLARE_ENV;return e===void 0||e===""?void 0:e},m=(e,t,r,{inherit:o})=>{const s=d(e)?e:void 0,n=d(s?.[r])?s[r]:void 0;if(t===void 0)return n;const i=s?.env,c=d(i)?i[t]:void 0,a=d(c)?c[r]:void 0;return d(a)?a:o?n:void 0},N=(e,t,r)=>S(D(e),m(t,r,"vars",{inherit:!1})?.LUNORA_SECURITY_HEADERS),k=(e,t)=>{const{hashedDirectory:r,hashedNamePatterns:o,outputDirectory:s,publicDirectory:n}=e;if(!(r===void 0||r===""||t!==void 0&&t!=="none")&&!(o!==void 0&&!U(s,r,o)))return n!==void 0&&g(l(n,r))?void 0:r},C=e=>{const t=j(e.projectRoot,e.target);if(t!=="cloudflare")return{reason:`target "${t}" does not serve _headers`,written:!1};const r=e.wranglerPath??P(e.projectRoot),o=r===void 0?void 0:$(r).parsed,s=F(),n=m(o,s,"assets",{inherit:!0});if(e.requireAssetsDirectory){const a=n?.directory;if(typeof a!="string"||r===void 0)return{reason:"wrangler declares no assets.directory",written:!1};const v=_(a)?a:f(A(r),a);if(u(v)!==u(e.outputDirectory))return{reason:`the build output is not wrangler's assets.directory (${a})`,written:!1}}const i=o!==void 0,c=E(e.outputDirectory,{headers:N(f(e.projectRoot,e.schemaDir??"lunora"),o,s),immutableDirectory:i?k(e,n?.not_found_handling):void 0});return!i&&e.hashedDirectory!==void 0&&e.hashedDirectory!==""&&c.warnings.push(`_headers: no long-term caching for ${e.hashedDirectory}/, because ${r===void 0?"no wrangler.jsonc or wrangler.json was found":`${r} could not be read or parsed`} and assets.not_found_handling decides whether that is safe`),{result:c,written:!0}},K=(e,t)=>{const r=C(e);if(r.written){r.result.deferred.length>0&&t.info(`_headers: kept your own ${r.result.deferred.join(", ")} for static assets instead of Lunora's default`);for(const o of r.result.warnings)t.warn(o)}return r};export{K as emitProjectAssetHeaders};
1
+ import{readdirSync as w,existsSync as g}from"node:fs";import{join as l,relative as p,sep as y,isAbsolute as _,resolve as f,dirname as A}from"node:path";import{readProjectSecurityHeaders as D}from"@lunora/codegen";import{i as d}from"./is-plain-object-CWxHeOY1.mjs";import{w as E,e as S}from"./asset-headers-CPuEX21i.mjs";import u from"./canonicalPath-DrfMiT3U.mjs";import{resolveProjectTarget as j}from"./assertBuildTargetMatches-CsHD_hg_.mjs";import{findWranglerFile as P,readWranglerJsonc as $}from"./WRANGLER_FILES-BF8PUjuo.mjs";const R=/\[(name|hash|extname|ext|format)(?::(\d+))?\]/gu,b=/[$()*+.?[\\\]^{|}]/gu,H=/\.map$/u,T=8,h=e=>e.replaceAll(b,String.raw`\$&`),x=e=>{let t="",r=0;for(const o of e.matchAll(R)){t+=h(e.slice(r,o.index));const[,s,n]=o;switch(s){case"extname":{t+=String.raw`(?:\.[^/]+)?`;break}case"hash":{t+=String.raw`[\w-]{${n??String(T)}}`;break}case"name":{t+=".*";break}default:t+="[^/]*"}r=o.index+o[0].length}return new RegExp(`^${t}${h(e.slice(r))}$`,"u")},L=(e,t)=>{try{return w(l(e,t),{recursive:!0,withFileTypes:!0}).filter(r=>r.isFile()).map(r=>p(e,l(r.parentPath,r.name)).split(y).join("/"))}catch{return[]}},U=(e,t,r)=>{const o=r.map(s=>x(s));return L(e,t).every(s=>o.some(n=>n.test(s.replace(H,""))))},F=()=>{const e=process.env.CLOUDFLARE_ENV;return e===void 0||e===""?void 0:e},m=(e,t,r,{inherit:o})=>{const s=d(e)?e:void 0,n=d(s?.[r])?s[r]:void 0;if(t===void 0)return n;const i=s?.env,c=d(i)?i[t]:void 0,a=d(c)?c[r]:void 0;return d(a)?a:o?n:void 0},N=(e,t,r)=>S(D(e),m(t,r,"vars",{inherit:!1})?.LUNORA_SECURITY_HEADERS),k=(e,t)=>{const{hashedDirectory:r,hashedNamePatterns:o,outputDirectory:s,publicDirectory:n}=e;if(!(r===void 0||r===""||t!==void 0&&t!=="none")&&!(o!==void 0&&!U(s,r,o)))return n!==void 0&&g(l(n,r))?void 0:r},C=e=>{const t=j(e.projectRoot,e.target);if(t!=="cloudflare")return{reason:`target "${t}" does not serve _headers`,written:!1};const r=e.wranglerPath??P(e.projectRoot),o=r===void 0?void 0:$(r).parsed,s=F(),n=m(o,s,"assets",{inherit:!0});if(e.requireAssetsDirectory){const a=n?.directory;if(typeof a!="string"||r===void 0)return{reason:"wrangler declares no assets.directory",written:!1};const v=_(a)?a:f(A(r),a);if(u(v)!==u(e.outputDirectory))return{reason:`the build output is not wrangler's assets.directory (${a})`,written:!1}}const i=o!==void 0,c=E(e.outputDirectory,{headers:N(f(e.projectRoot,e.schemaDir??"lunora"),o,s),immutableDirectory:i?k(e,n?.not_found_handling):void 0});return!i&&e.hashedDirectory!==void 0&&e.hashedDirectory!==""&&c.warnings.push(`_headers: no long-term caching for ${e.hashedDirectory}/, because ${r===void 0?"no wrangler.jsonc or wrangler.json was found":`${r} could not be read or parsed`} and assets.not_found_handling decides whether that is safe`),{result:c,written:!0}},K=(e,t)=>{const r=C(e);if(r.written){r.result.deferred.length>0&&t.info(`_headers: kept your own ${r.result.deferred.join(", ")} for static assets instead of Lunora's default`);for(const o of r.result.warnings)t.warn(o)}return r};export{K as emitProjectAssetHeaders};
@@ -0,0 +1,7 @@
1
+ import{existsSync as f,readFileSync as g,appendFileSync as m}from"node:fs";import{join as u}from"node:path";const h=/\r?\n/u,p=(a,i)=>{const s=u(a,".gitignore"),e=f(s)?g(s,"utf8"):"",r=e.split(h).map(t=>t.trim()),c=r.findLastIndex(t=>t.startsWith("!")&&!i.includes(t)),n=i.filter(t=>{const o=r.lastIndexOf(t);return o===-1||!t.startsWith("!")&&o<c});if(n.length===0)return[];const l=n.some(t=>!t.startsWith("!"))?[...n.filter(t=>!t.startsWith("!")),...i.filter(t=>t.startsWith("!"))]:n,d=e.length>0&&!e.endsWith(`
2
+ `)?`
3
+ `:"";return m(s,`${d}
4
+ # Lunora — local secrets and dev state, never commit
5
+ ${l.join(`
6
+ `)}
7
+ `,"utf8"),n};export{p as default};
@@ -0,0 +1 @@
1
+ import{spawnSync as i}from"node:child_process";import{basename as d,dirname as c}from"node:path";const s=(o,r)=>{const t=["check-ignore","-q",...r.noIndex?["--no-index"]:[],"--",d(o)],{error:n,status:e}=i("git",t,{cwd:c(o),stdio:"ignore",timeout:5e3});return n!==void 0&&"code"in n&&n.code==="ETIMEDOUT"?"timed-out":e===0?"ignored":e===1?"not-ignored":"unknown"};export{s as gitCheckIgnore};
@@ -1 +1 @@
1
- import{isAbsolute as p,dirname as m,resolve as h}from"node:path";import{applyModify as l}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as u}from"./hasCloudflareCredentials-ByCrwaLT.mjs";import{withheldBindings as g,writeDevConfig as w}from"./describeWithheld-CN3D-4pU.mjs";import{readWranglerJsonc as v}from"./WRANGLER_FILES-BF8PUjuo.mjs";const C=(e,i)=>{const{parsed:t,text:c}=v(e),o=t?.build,r=g(t,i.hasCredentials??(()=>u({projectRoot:i.projectRoot}))),s=typeof o?.command=="string"&&o.command!==""&&!(typeof o.cwd=="string"&&p(o.cwd));if(!s&&r.length===0)return{configPath:e,withheld:r};const d=m(e);let n=c;for(const{kind:f}of r)n=l(n,[f],void 0);s&&(n=l(n,["build","cwd"],h(d,typeof o.cwd=="string"?o.cwd:".")));const a=w(d,"service",n,i.projectRoot);return{cleanup:a.cleanup,configPath:a.configPath,withheld:r}},R=(e,i)=>{const t=e.map(o=>C(o,i)),c=t.flatMap(o=>o.cleanup===void 0?[]:[o.cleanup]);return{cleanup:()=>{for(const o of c)o()},configPaths:t.map(o=>o.configPath),withheld:t.flatMap(o=>o.withheld)}};export{R as materializeServiceDevConfigs};
1
+ import{isAbsolute as p,dirname as m,resolve as h}from"node:path";import{applyModify as l}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as u}from"./hasCloudflareCredentials-ByCrwaLT.mjs";import{withheldBindings as g,writeDevConfig as w}from"./describeWithheld-C9rBOaSo.mjs";import{readWranglerJsonc as v}from"./WRANGLER_FILES-BF8PUjuo.mjs";const C=(e,i)=>{const{parsed:t,text:c}=v(e),o=t?.build,r=g(t,i.hasCredentials??(()=>u({projectRoot:i.projectRoot}))),s=typeof o?.command=="string"&&o.command!==""&&!(typeof o.cwd=="string"&&p(o.cwd));if(!s&&r.length===0)return{configPath:e,withheld:r};const d=m(e);let n=c;for(const{kind:f}of r)n=l(n,[f],void 0);s&&(n=l(n,["build","cwd"],h(d,typeof o.cwd=="string"?o.cwd:".")));const a=w(d,"service",n,i.projectRoot);return{cleanup:a.cleanup,configPath:a.configPath,withheld:r}},R=(e,i)=>{const t=e.map(o=>C(o,i)),c=t.flatMap(o=>o.cleanup===void 0?[]:[o.cleanup]);return{cleanup:()=>{for(const o of c)o()},configPaths:t.map(o=>o.configPath),withheld:t.flatMap(o=>o.withheld)}};export{R as materializeServiceDevConfigs};
@@ -1 +1 @@
1
- import{mkdirSync as l,writeFileSync as $,rmSync as w}from"node:fs";import{basename as h,join as d,dirname as p}from"node:path";import{inferLunoraBindings as u}from"./inferLunoraBindings-BUk28bSQ.mjs";import{LUNORA_TAG as a}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{applyWranglerBindings as v}from"./reconcileWranglerBindings-D6B81UKU.mjs";import{r as y}from"./validate-bindings-DSMH8bRQ.mjs";import{planWranglerBindings as S}from"./collectExportGaps-DvirOIVB.mjs";import{reconcileWranglerCompatibilityDate as j}from"./reconcileWranglerCompatibilityDate-Cj94osA-.mjs";import{reconcileWranglerCrons as b,describePreservedCrons as C}from"./describePreservedCrons-i5XT6rtl.mjs";import{s as x,S as E}from"./studio-assets-BKWx838V.mjs";import{findWranglerFile as k,readWranglerJsonc as P}from"./WRANGLER_FILES-BF8PUjuo.mjs";const m=async r=>S(r.projectRoot,await u({cache:r.cache,projectRoot:r.projectRoot,schemaDir:r.schemaDir}),{target:r.target}),L=async(r,o,t)=>{try{const n=v(r.projectRoot,await m(r)),e=n.wranglerPath??"wrangler.jsonc";if(n.added.length>0&&o.info?.(`${a} inferred bindings → ${n.added.join(", ")} (written to ${e})`),n.updated.length>0&&o.info?.(`${a} updated bindings → ${n.updated.join(", ")} (written to ${e})`),n.devConfig!==void 0){const{added:i,path:s,updated:c}=n.devConfig;o.info?.(`${a} dev sidecar bindings → ${[...i,...c].join(", ")} (written to ${s})`)}for(const i of n.warnings)o.warn(`${a} ${i}`);n.exportGaps.length>0&&t?.(n.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);o.warn(`${a} binding inference skipped: ${e}`)}},M=async r=>{try{const{added:o,devConfig:t,updated:n}=await m(r),e=t===void 0?[]:[...t.added,...t.updated].map(i=>`${h(t.path)} ${i}`);return[...new Set([...o,...n,...e])]}catch{return[]}},f=new Map,N=(r,o,t)=>{try{const n=b(r,o);n.changed&&t.info?.(`${a} synced ${o.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)t.warn(`${a} ${s}`);const e=n.preserved.join("\0"),i=C(n.preserved);i!==void 0&&(n.changed||f.get(r)!==e)&&t.info?.(`${a} ${i}`),f.set(r,e)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${a} cron trigger sync skipped: ${e}`)}try{const n=j(r);n.changed&&t.info?.(`${a} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${a} compatibility date sync skipped: ${e}`)}},W=["architecture.json","openapi.json","openrpc.json"],J=(r,o,t)=>{const n=k(r),e=n===void 0?void 0:P(n);if(n===void 0||e?.parsed===void 0)return;const i=x(r,e.parsed,o),s=y(e.text,e.parsed,i);if(i!==void 0&&l(d(p(n),i.directory),{recursive:!0}),s.text!==e.text&&($(n,s.text,"utf8"),t.info?.(`${a} ${[...s.added,...s.updated].join(", ")} → ${n}`)),i===void 0){const c=d(p(n),E,"_lunora","studio");for(const g of W)w(d(c,g),{force:!0})}};export{M as pendingBindingChanges,L as reconcileBindingsSafely,J as reconcileStudioAssets,N as reconcileWranglerExtras};
1
+ import{mkdirSync as l,writeFileSync as $,rmSync as w}from"node:fs";import{basename as h,join as d,dirname as p}from"node:path";import{inferLunoraBindings as u}from"./inferLunoraBindings-BUk28bSQ.mjs";import{LUNORA_TAG as a}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{applyWranglerBindings as v}from"./reconcileWranglerBindings-BlAdgUm3.mjs";import{r as y}from"./validate-bindings-DSMH8bRQ.mjs";import{planWranglerBindings as S}from"./collectExportGaps-BIQcF5z_.mjs";import{reconcileWranglerCompatibilityDate as j}from"./reconcileWranglerCompatibilityDate-Cj94osA-.mjs";import{reconcileWranglerCrons as b,describePreservedCrons as C}from"./describePreservedCrons-i5XT6rtl.mjs";import{s as x,S as E}from"./studio-assets-BKWx838V.mjs";import{findWranglerFile as k,readWranglerJsonc as P}from"./WRANGLER_FILES-BF8PUjuo.mjs";const m=async r=>S(r.projectRoot,await u({cache:r.cache,projectRoot:r.projectRoot,schemaDir:r.schemaDir}),{target:r.target}),L=async(r,o,t)=>{try{const n=v(r.projectRoot,await m(r)),e=n.wranglerPath??"wrangler.jsonc";if(n.added.length>0&&o.info?.(`${a} inferred bindings → ${n.added.join(", ")} (written to ${e})`),n.updated.length>0&&o.info?.(`${a} updated bindings → ${n.updated.join(", ")} (written to ${e})`),n.devConfig!==void 0){const{added:i,path:s,updated:c}=n.devConfig;o.info?.(`${a} dev sidecar bindings → ${[...i,...c].join(", ")} (written to ${s})`)}for(const i of n.warnings)o.warn(`${a} ${i}`);n.exportGaps.length>0&&t?.(n.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);o.warn(`${a} binding inference skipped: ${e}`)}},M=async r=>{try{const{added:o,devConfig:t,updated:n}=await m(r),e=t===void 0?[]:[...t.added,...t.updated].map(i=>`${h(t.path)} ${i}`);return[...new Set([...o,...n,...e])]}catch{return[]}},f=new Map,N=(r,o,t)=>{try{const n=b(r,o);n.changed&&t.info?.(`${a} synced ${o.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)t.warn(`${a} ${s}`);const e=n.preserved.join("\0"),i=C(n.preserved);i!==void 0&&(n.changed||f.get(r)!==e)&&t.info?.(`${a} ${i}`),f.set(r,e)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${a} cron trigger sync skipped: ${e}`)}try{const n=j(r);n.changed&&t.info?.(`${a} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${a} compatibility date sync skipped: ${e}`)}},W=["architecture.json","openapi.json","openrpc.json"],J=(r,o,t)=>{const n=k(r),e=n===void 0?void 0:P(n);if(n===void 0||e?.parsed===void 0)return;const i=x(r,e.parsed,o),s=y(e.text,e.parsed,i);if(i!==void 0&&l(d(p(n),i.directory),{recursive:!0}),s.text!==e.text&&($(n,s.text,"utf8"),t.info?.(`${a} ${[...s.added,...s.updated].join(", ")} → ${n}`)),i===void 0){const c=d(p(n),E,"_lunora","studio");for(const g of W)w(d(c,g),{force:!0})}};export{M as pendingBindingChanges,L as reconcileBindingsSafely,J as reconcileStudioAssets,N as reconcileWranglerExtras};
@@ -1 +1 @@
1
- import{mkdirSync as g,writeFileSync as c}from"node:fs";import{join as u,dirname as l}from"node:path";import{readManifest as h}from"./readManifest-Cighz3WC.mjs";import{planWranglerBindings as f}from"./collectExportGaps-DvirOIVB.mjs";const d=r=>r===void 0||r.added.length===0&&r.updated.length===0?void 0:{added:r.added,path:r.path,updated:r.updated},w=(r,e,{devConfigWritten:t,wranglerChanged:s})=>{const{manifest:o}=e;if(o===void 0)return[];const n=[];for(const i of e.records)try{i.write(h(r)??o,{devConfigWritten:t})}catch(a){n.push(`${s?"wrangler.jsonc was updated, but ":""}recording the ${i.label} reconcile owns in ${o.path} (lunora.${i.key}) failed: ${a instanceof Error?a.message:String(a)}. Until it is recorded, ${i.consequence}.`)}return n},p=(r,e)=>{if(!(r===void 0||r.text===r.original))try{c(r.path,r.text,"utf8");return}catch(t){return`${e?"wrangler.jsonc was updated, but ":""}writing ${r.path} failed: ${t instanceof Error?t.message:String(t)}. The dev sidecar keeps its previous service bindings until the next reconcile writes it.`}},v=(r,e)=>{const{edit:t,...s}=e;if(t===void 0||e.wranglerPath===void 0)return{...s,changed:!1,devConfig:d(e.devConfig)};const o=[...e.warnings],n=t.text!==t.original;t.assetsDirectory!==void 0&&g(u(l(e.wranglerPath),t.assetsDirectory),{recursive:!0}),n&&c(e.wranglerPath,t.text,"utf8");const i=p(e.devConfig,n);return i!==void 0&&o.push(i),o.push(...w(r,t,{devConfigWritten:i===void 0,wranglerChanged:n})),{...s,changed:n,devConfig:i===void 0?d(e.devConfig):void 0,...n?{}:{reason:"bindings already in sync"},warnings:o}},x=(r,e,t={})=>v(r,f(r,e,t));export{v as applyWranglerBindings,x as reconcileWranglerBindings};
1
+ import{mkdirSync as g,writeFileSync as c}from"node:fs";import{join as u,dirname as l}from"node:path";import{readManifest as h}from"./readManifest-Cighz3WC.mjs";import{planWranglerBindings as f}from"./collectExportGaps-BIQcF5z_.mjs";const d=r=>r===void 0||r.added.length===0&&r.updated.length===0?void 0:{added:r.added,path:r.path,updated:r.updated},w=(r,e,{devConfigWritten:t,wranglerChanged:s})=>{const{manifest:o}=e;if(o===void 0)return[];const n=[];for(const i of e.records)try{i.write(h(r)??o,{devConfigWritten:t})}catch(a){n.push(`${s?"wrangler.jsonc was updated, but ":""}recording the ${i.label} reconcile owns in ${o.path} (lunora.${i.key}) failed: ${a instanceof Error?a.message:String(a)}. Until it is recorded, ${i.consequence}.`)}return n},p=(r,e)=>{if(!(r===void 0||r.text===r.original))try{c(r.path,r.text,"utf8");return}catch(t){return`${e?"wrangler.jsonc was updated, but ":""}writing ${r.path} failed: ${t instanceof Error?t.message:String(t)}. The dev sidecar keeps its previous service bindings until the next reconcile writes it.`}},v=(r,e)=>{const{edit:t,...s}=e;if(t===void 0||e.wranglerPath===void 0)return{...s,changed:!1,devConfig:d(e.devConfig)};const o=[...e.warnings],n=t.text!==t.original;t.assetsDirectory!==void 0&&g(u(l(e.wranglerPath),t.assetsDirectory),{recursive:!0}),n&&c(e.wranglerPath,t.text,"utf8");const i=p(e.devConfig,n);return i!==void 0&&o.push(i),o.push(...w(r,t,{devConfigWritten:i===void 0,wranglerChanged:n})),{...s,changed:n,devConfig:i===void 0?d(e.devConfig):void 0,...n?{}:{reason:"bindings already in sync"},warnings:o}},x=(r,e,t={})=>v(r,f(r,e,t));export{v as applyWranglerBindings,x as reconcileWranglerBindings};
@@ -1 +1 @@
1
- import{secretKindOf as l,redact as f}from"@lunora/codegen";import{parseTree as d}from"jsonc-parser";import{a as u,i as p}from"./secret-key-xi4VK8Jw.mjs";import{isPlaceholderValue as m}from"./buildPackageSecretsBlock-DrSD60vH.mjs";const N=8,_=/(?:^|_)ACCOUNT_ID$/u,h=/^[\da-f]{32}$/u,v=(t,o)=>_.test(t)&&h.test(o),k=(t,o,r=()=>{})=>{if(t===void 0)return[];const i=[];for(const[n,e]of Object.entries(t)){if(typeof e!="string"||m(e)||u(n)||v(n,e))continue;const c=l(e)??(p(n)&&e.length>=N?"secret_named_var":void 0);if(c===void 0)continue;const a=r(n);i.push({file:o,key:n,kind:c,preview:f(e),...a===void 0?{}:{line:a}})}return i},y=/\r\n|\r|\n/u,K=t=>{const o=(d(t,[],{allowTrailingComma:!0})?.children??[]).filter(e=>e.children?.[0]?.value==="vars").flatMap(e=>e.children?.[1]?.children??[]).flatMap(e=>{const s=e.children?.[0];return typeof s?.value=="string"?[{key:s.value,offset:s.offset}]:[]}),r=new Map;let i=1,n=0;for(const e of o)i+=t.slice(n,e.offset).split(y).length-1,n=e.offset,r.set(e.key,i);return r};export{k as scanWranglerVariablesForSecrets,K as variableKeyLines};
1
+ import{secretKindOf as l,redact as f}from"@lunora/codegen";import{parseTree as d}from"jsonc-parser";import{a as u,i as p}from"./secret-key-xi4VK8Jw.mjs";import{isPlaceholderValue as m}from"./buildPackageSecretsBlock-Jla_XY6q.mjs";const N=8,_=/(?:^|_)ACCOUNT_ID$/u,h=/^[\da-f]{32}$/u,v=(t,o)=>_.test(t)&&h.test(o),k=(t,o,r=()=>{})=>{if(t===void 0)return[];const i=[];for(const[n,e]of Object.entries(t)){if(typeof e!="string"||m(e)||u(n)||v(n,e))continue;const c=l(e)??(p(n)&&e.length>=N?"secret_named_var":void 0);if(c===void 0)continue;const a=r(n);i.push({file:o,key:n,kind:c,preview:f(e),...a===void 0?{}:{line:a}})}return i},y=/\r\n|\r|\n/u,K=t=>{const o=(d(t,[],{allowTrailingComma:!0})?.children??[]).filter(e=>e.children?.[0]?.value==="vars").flatMap(e=>e.children?.[1]?.children??[]).flatMap(e=>{const s=e.children?.[0];return typeof s?.value=="string"?[{key:s.value,offset:s.offset}]:[]}),r=new Map;let i=1,n=0;for(const e of o)i+=t.slice(n,e.offset).split(y).length-1,n=e.offset,r.set(e.key,i);return r};export{k as scanWranglerVariablesForSecrets,K as variableKeyLines};
@@ -1 +1 @@
1
- import{watch as R}from"node:fs";import{createServer as _}from"node:net";import{dirname as C}from"node:path";import{readDevServiceBindings as j}from"@lunora/codegen";import{acceptsConnection as M,startDevProcess as x}from"./acceptsConnection-DHhUYGjT.mjs";import N from"./resolveSchemaDirectory-Ca5P6KuP.mjs";import{p as b,a as O}from"./celld-config-Ef1RZ02t.mjs";import{probeCelldToolchain as F}from"./probeCelldToolchain-DxDttfHy.mjs";const I=6e4,B=200,G=new Set([".celld",".wrangler","node_modules"]),H=/[/\\]/u,U=async()=>new Promise((e,o)=>{const s=_();s.once("error",o),s.listen(0,"127.0.0.1",()=>{const n=s.address();s.close(()=>{e(typeof n=="object"&&n!==null?n.port:0)})})}),q=e=>e?.split(H).some(o=>G.has(o))===!0,L=(e,o,s)=>{let n;const c=R(e,{recursive:!0},(l,d)=>{q(d)||(clearTimeout(n),n=setTimeout(o,B))}),i=()=>{clearTimeout(n),c.close()};return c.once("error",l=>{i(),s(l)}),{close:i}},W=e=>e instanceof Error?e.message:String(e),D=async()=>F({env:process.env,purpose:"dev"}),rr=async e=>{const o=await(e.probe??D)();if(o.errors.length>0)throw new Error(o.errors.join("; "));return b(e.projectRoot,"dev").write(),o.warnings},er=async e=>{const{log:o,port:s,projectRoot:n}=e,c=(r,t="stdout")=>{o(r,{stream:t,tag:"celld"})},i=await(e.probe??D)();for(const r of i.warnings)c(r,"stderr");if(i.errors.length>0)throw new Error(i.errors.join("; "));if(await M(s))throw new Error(`port ${String(s)} is already in use — stop whatever is serving there (another dev server?), or pick another worker port`);const l=j(n,N(n));if(l.error!==void 0)throw new Error(`could not read the lunora.config services: ${l.error}`);const d=b(n,"dev");d.write();const $=C(d.configPath),m=[...new Map(l.services.map(r=>[r.wranglerPath,r])).values()],p=new AbortController,h=()=>p.signal.aborted,u=async(r,t,a)=>x({args:["dev",r,"--port",String(a)],command:"celld",cwd:n,label:"celld dev",notFound:"`celld` was not found on PATH — install it (https://celld.dev) to run the celld target",onLine:T=>{T.trim()!==""&&o(T,{stream:"stdout",tag:t})},port:a,readyTimeoutMs:I,signal:p.signal,spawn:e.spawn}),y=async r=>{const t=O($,r.wranglerPath);t.write(),c(`registering service ${r.worker} in the local dev state`),await(await u(t.configPath,`celld:${r.worker}`,await U())).stop()};for(const r of m)await y(r);let g=()=>{};const E=new Promise(r=>{g=r}),S=async()=>{const r=await u(d.configPath,"celld",s);return r.crashed.then(g).catch(()=>{}),r};let w=await S();const k=async r=>{await w.stop();let t;try{await y(r)}catch(a){t=a instanceof Error?a:new Error(String(a))}if(!h()){try{w=await S()}catch(a){throw h()||g(1),a}if(t!==void 0)throw t}};let f=Promise.resolve();const A=r=>{c(`service ${r.worker} changed — restarting`),f=f.then(async()=>k(r)).catch(t=>{h()||c(`service ${r.worker} failed to restart: ${W(t)}`,"stderr")})},P=[],v=()=>{for(const r of P)r.close()};try{for(const r of m)P.push(L(C(r.wranglerPath),()=>{A(r)},t=>{c(`stopped watching service ${r.worker}: ${t.message} — restart the dev server to pick up its edits`,"stderr")}))}catch(r){throw v(),await w.stop(),r}return E.then(v).catch(()=>{}),{exited:E,stop:async()=>{p.abort(),v(),await f,await w.stop()}}};export{er as startCelldDevSession,rr as writeCelldDevProjection};
1
+ import{watch as R}from"node:fs";import{createServer as _}from"node:net";import{dirname as C}from"node:path";import{readDevServiceBindings as j}from"@lunora/codegen";import{acceptsConnection as M,startDevProcess as x}from"./acceptsConnection-DHhUYGjT.mjs";import N from"./resolveSchemaDirectory-Ca5P6KuP.mjs";import{p as b,a as O}from"./celld-config-CC5YKtVa.mjs";import{probeCelldToolchain as F}from"./probeCelldToolchain-DxDttfHy.mjs";const I=6e4,B=200,G=new Set([".celld",".wrangler","node_modules"]),H=/[/\\]/u,U=async()=>new Promise((e,o)=>{const s=_();s.once("error",o),s.listen(0,"127.0.0.1",()=>{const n=s.address();s.close(()=>{e(typeof n=="object"&&n!==null?n.port:0)})})}),q=e=>e?.split(H).some(o=>G.has(o))===!0,L=(e,o,s)=>{let n;const c=R(e,{recursive:!0},(l,d)=>{q(d)||(clearTimeout(n),n=setTimeout(o,B))}),i=()=>{clearTimeout(n),c.close()};return c.once("error",l=>{i(),s(l)}),{close:i}},W=e=>e instanceof Error?e.message:String(e),D=async()=>F({env:process.env,purpose:"dev"}),rr=async e=>{const o=await(e.probe??D)();if(o.errors.length>0)throw new Error(o.errors.join("; "));return b(e.projectRoot,"dev").write(),o.warnings},er=async e=>{const{log:o,port:s,projectRoot:n}=e,c=(r,t="stdout")=>{o(r,{stream:t,tag:"celld"})},i=await(e.probe??D)();for(const r of i.warnings)c(r,"stderr");if(i.errors.length>0)throw new Error(i.errors.join("; "));if(await M(s))throw new Error(`port ${String(s)} is already in use — stop whatever is serving there (another dev server?), or pick another worker port`);const l=j(n,N(n));if(l.error!==void 0)throw new Error(`could not read the lunora.config services: ${l.error}`);const d=b(n,"dev");d.write();const $=C(d.configPath),m=[...new Map(l.services.map(r=>[r.wranglerPath,r])).values()],p=new AbortController,h=()=>p.signal.aborted,u=async(r,t,a)=>x({args:["dev",r,"--port",String(a)],command:"celld",cwd:n,label:"celld dev",notFound:"`celld` was not found on PATH — install it (https://celld.dev) to run the celld target",onLine:T=>{T.trim()!==""&&o(T,{stream:"stdout",tag:t})},port:a,readyTimeoutMs:I,signal:p.signal,spawn:e.spawn}),y=async r=>{const t=O($,r.wranglerPath);t.write(),c(`registering service ${r.worker} in the local dev state`),await(await u(t.configPath,`celld:${r.worker}`,await U())).stop()};for(const r of m)await y(r);let g=()=>{};const E=new Promise(r=>{g=r}),S=async()=>{const r=await u(d.configPath,"celld",s);return r.crashed.then(g).catch(()=>{}),r};let w=await S();const k=async r=>{await w.stop();let t;try{await y(r)}catch(a){t=a instanceof Error?a:new Error(String(a))}if(!h()){try{w=await S()}catch(a){throw h()||g(1),a}if(t!==void 0)throw t}};let f=Promise.resolve();const A=r=>{c(`service ${r.worker} changed — restarting`),f=f.then(async()=>k(r)).catch(t=>{h()||c(`service ${r.worker} failed to restart: ${W(t)}`,"stderr")})},P=[],v=()=>{for(const r of P)r.close()};try{for(const r of m)P.push(L(C(r.wranglerPath),()=>{A(r)},t=>{c(`stopped watching service ${r.worker}: ${t.message} — restart the dev server to pick up its edits`,"stderr")}))}catch(r){throw v(),await w.stop(),r}return E.then(v).catch(()=>{}),{exited:E,stop:async()=>{p.abort(),v(),await f,await w.stop()}}};export{er as startCelldDevSession,rr as writeCelldDevProjection};
@@ -1 +1 @@
1
- import{relative as l,resolve as f,dirname as m}from"node:path";import{resolveWorkerEntry as b}from"./COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{s as w,b as g}from"./studio-assets-BKWx838V.mjs";import{s as y}from"./spa-assets-wX8rTPEQ.mjs";import{findWranglerFile as A,readWranglerJsonc as q}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{variableKeyLines as P,scanWranglerVariablesForSecrets as O}from"./scanWranglerVariablesForSecrets-DmdOBmwn.mjs";const c=(s,i)=>{const r=s?.producers;return(Array.isArray(r)?r:[]).flatMap(e=>g(e)&&typeof e.binding=="string"&&typeof e.queue=="string"?[{binding:e.binding,queue:e.queue,...i===void 0?{}:{env:i}}]:[])},B=(s,i)=>{const r=A(s),t=r===void 0?void 0:q(r),e=t?.parsed,o=b(s).path,d=o===void 0?{}:{workerEntry:o};if(r===void 0||t?.text===void 0||e===void 0)return{...d,wranglerQueueProducers:[],wranglerVariables:[]};const p=P(t.text),u=[...new Set([e.assets,...Object.values(e.env??{}).map(n=>n?.assets)].flatMap(n=>y(n)??[]))],a=w(s,e,i);return{...u.length===0?{}:{spaAssetsBindings:u},...a===void 0?{}:{studioAssets:{binding:a.binding,directory:l(s,f(m(r),a.directory))}},...d,wranglerQueueProducers:[...c(e.queues),...Object.entries(e.env??{}).flatMap(([n,v])=>c(v?.queues,n))],wranglerVariables:O(g(e.vars)?e.vars:void 0,l(s,r),n=>p.get(n))}};export{B as wranglerCodegenInputs};
1
+ import{relative as l,resolve as f,dirname as m}from"node:path";import{resolveWorkerEntry as b}from"./COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{s as w,b as g}from"./studio-assets-BKWx838V.mjs";import{s as y}from"./spa-assets-wX8rTPEQ.mjs";import{findWranglerFile as A,readWranglerJsonc as q}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{variableKeyLines as P,scanWranglerVariablesForSecrets as O}from"./scanWranglerVariablesForSecrets-DSfoIIk7.mjs";const c=(s,i)=>{const r=s?.producers;return(Array.isArray(r)?r:[]).flatMap(e=>g(e)&&typeof e.binding=="string"&&typeof e.queue=="string"?[{binding:e.binding,queue:e.queue,...i===void 0?{}:{env:i}}]:[])},B=(s,i)=>{const r=A(s),t=r===void 0?void 0:q(r),e=t?.parsed,o=b(s).path,d=o===void 0?{}:{workerEntry:o};if(r===void 0||t?.text===void 0||e===void 0)return{...d,wranglerQueueProducers:[],wranglerVariables:[]};const p=P(t.text),u=[...new Set([e.assets,...Object.values(e.env??{}).map(n=>n?.assets)].flatMap(n=>y(n)??[]))],a=w(s,e,i);return{...u.length===0?{}:{spaAssetsBindings:u},...a===void 0?{}:{studioAssets:{binding:a.binding,directory:l(s,f(m(r),a.directory))}},...d,wranglerQueueProducers:[...c(e.queues),...Object.entries(e.env??{}).flatMap(([n,v])=>c(v?.queues,n))],wranglerVariables:O(g(e.vars)?e.vars:void 0,l(s,r),n=>p.get(n))}};export{B as wranglerCodegenInputs};
@@ -1,3 +1,3 @@
1
- import{existsSync as s,statSync as a,writeFileSync as p,renameSync as d,rmSync as g}from"node:fs";import{join as m}from"node:path";import{runCodegen as f,CodegenDiagnosticError as j,refreshCodegenProject as u,createCodegenProject as y,findTsconfig as S,tsconfigFingerprint as C,projectConfigCandidatePaths as h}from"@lunora/codegen";import{wranglerCodegenInputs as l}from"./wranglerCodegenInputs-B8iRZZZw.mjs";import{isCodegenDisabled as w,CODEGEN_ENV as n}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{recordStudioWrite as P,STUDIO_WRITE_TEMP_SUFFIX as $}from"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const F=o=>({apiSpec:o.apiSpec,lazyFunctions:o.lazyFunctions,lunoraDirectory:o.schemaDirectory??"lunora",projectRoot:o.projectRoot,...l(o.projectRoot)});let r;const c=o=>{const t=a(o);return`${o}:${String(t.mtimeMs)}:${String(t.size)}`},E=o=>{const t=S(o);return[t===void 0?"":`${c(t)}
1
+ import{existsSync as s,statSync as a,writeFileSync as p,renameSync as d,rmSync as g}from"node:fs";import{join as m}from"node:path";import{runCodegen as f,CodegenDiagnosticError as j,refreshCodegenProject as u,createCodegenProject as y,findTsconfig as S,tsconfigFingerprint as C,projectConfigCandidatePaths as h}from"@lunora/codegen";import{wranglerCodegenInputs as l}from"./wranglerCodegenInputs-aZOJbiin.mjs";import{isCodegenDisabled as w,CODEGEN_ENV as n}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{recordStudioWrite as P,STUDIO_WRITE_TEMP_SUFFIX as $}from"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const F=o=>({apiSpec:o.apiSpec,lazyFunctions:o.lazyFunctions,lunoraDirectory:o.schemaDirectory??"lunora",projectRoot:o.projectRoot,...l(o.projectRoot)});let r;const c=o=>{const t=a(o);return`${o}:${String(t.mtimeMs)}:${String(t.size)}`},E=o=>{const t=S(o);return[t===void 0?"":`${c(t)}
2
2
  ${C(t)}`,...h(o).filter(e=>s(e)).map(e=>c(e))].join(`
3
3
  `)},R=o=>{const t=E(o);return r?.lunoraDirectory===o&&r.key===t?(u(r.project,o),r.project):(r={key:t,lunoraDirectory:o,project:y(o)},r.project)},x=(o,t)=>{if(w(process.env[n]))return[`codegen is off (${n}=0 / \`lunora dev --no-codegen\`) — the source was written but \`_generated/\` was NOT regenerated`];try{const e=m(o.projectRoot,o.schemaDirectory??"lunora");f({...F(o),project:R(e)})}catch(e){if(r=void 0,e instanceof j)return[e.message];throw e}return P(t.path,t.text),[]},z=(o,t)=>{const e=`${o}${$}`;try{p(e,t,"utf8"),d(e,o)}catch(i){throw g(e,{force:!0}),i}};export{x as r,z as w};
@@ -1 +1 @@
1
- import{devVariablesStamp as t,parseDevVariable as r,resolveAdminToken as a}from"../packem_shared/devVariablesStamp-BQkGEn9d.mjs";import{ADVISOR_PROCEDURES_ENDPOINT as d,handleAdvisorProceduresRequest as n}from"../packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs";import{sendStudioAsset as u,sendStudioDocument as i}from"../packem_shared/sendStudioAsset-B81Pex91.mjs";import{assetContentType as l,isStandaloneModulePath as p,loadStudioAssets as D,readStandaloneAsset as T,resolveStandaloneDirectory as f,studioAssetsStamp as _}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{default as P}from"../packem_shared/createStudioDocumentCache-XBG1aWbl.mjs";import{STUDIO_PATH as c,STUDIO_SCRIPT_PATH as I,STUDIO_STYLE_PATH as O,createStudioMiddleware as x,isNonLoopbackHost as R,requestPathname as h,studioMountPath as N}from"../packem_shared/STUDIO_PATH-CvVcvTbQ.mjs";import{POLICY_SCAFFOLD_ENDPOINT as H,handlePolicyScaffoldRequest as L}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-BiQ1zNsR.mjs";import{default as U}from"../packem_shared/renderStudioHtml-CRDTNivi.mjs";import{SCHEMA_EDIT_ENDPOINT as F,handleSchemaEditRequest as M}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-D296PlpV.mjs";import{SEED_ENDPOINT as b,handleSeedRequest as W}from"../packem_shared/SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as y}from"../packem_shared/serveJsonHandler-B8_GE6QC.mjs";import{STUDIO_WRITE_TEMP_SUFFIX as j,consumeStudioWrite as w}from"../packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";import{ALLOW_FORWARDED_ENV as X,headerValue as g,isLoopbackAddress as z,transportRejectionReason as B}from"../packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs";export{d as ADVISOR_PROCEDURES_ENDPOINT,X as ALLOW_FORWARDED_ENV,H as POLICY_SCAFFOLD_ENDPOINT,F as SCHEMA_EDIT_ENDPOINT,b as SEED_ENDPOINT,c as STUDIO_PATH,I as STUDIO_SCRIPT_PATH,O as STUDIO_STYLE_PATH,j as STUDIO_WRITE_TEMP_SUFFIX,l as assetContentType,w as consumeStudioWrite,P as createStudioDocumentCache,x as createStudioMiddleware,t as devVariablesStamp,n as handleAdvisorProceduresRequest,L as handlePolicyScaffoldRequest,M as handleSchemaEditRequest,W as handleSeedRequest,g as headerValue,z as isLoopbackAddress,R as isNonLoopbackHost,p as isStandaloneModulePath,D as loadStudioAssets,r as parseDevVariable,T as readStandaloneAsset,U as renderStudioHtml,h as requestPathname,a as resolveAdminToken,f as resolveStandaloneDirectory,u as sendStudioAsset,i as sendStudioDocument,y as serveJsonHandler,_ as studioAssetsStamp,N as studioMountPath,B as transportRejectionReason};
1
+ import{devVariablesStamp as t,parseDevVariable as r,resolveAdminToken as a}from"../packem_shared/devVariablesStamp-BQkGEn9d.mjs";import{ADVISOR_PROCEDURES_ENDPOINT as d,handleAdvisorProceduresRequest as n}from"../packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs";import{sendStudioAsset as u,sendStudioDocument as i}from"../packem_shared/sendStudioAsset-B81Pex91.mjs";import{assetContentType as l,isStandaloneModulePath as p,loadStudioAssets as D,readStandaloneAsset as T,resolveStandaloneDirectory as f,studioAssetsStamp as _}from"../packem_shared/assetContentType-CUb5bpbI.mjs";import{default as P}from"../packem_shared/createStudioDocumentCache-XBG1aWbl.mjs";import{STUDIO_PATH as c,STUDIO_SCRIPT_PATH as I,STUDIO_STYLE_PATH as O,createStudioMiddleware as x,isNonLoopbackHost as R,requestPathname as h,studioMountPath as N}from"../packem_shared/STUDIO_PATH-B34bprPH.mjs";import{POLICY_SCAFFOLD_ENDPOINT as H,handlePolicyScaffoldRequest as L}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-CewfdPRV.mjs";import{default as U}from"../packem_shared/renderStudioHtml-CRDTNivi.mjs";import{SCHEMA_EDIT_ENDPOINT as F,handleSchemaEditRequest as M}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-B58YfQ7N.mjs";import{SEED_ENDPOINT as b,handleSeedRequest as W}from"../packem_shared/SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as y}from"../packem_shared/serveJsonHandler-B8_GE6QC.mjs";import{STUDIO_WRITE_TEMP_SUFFIX as j,consumeStudioWrite as w}from"../packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";import{ALLOW_FORWARDED_ENV as X,headerValue as g,isLoopbackAddress as z,transportRejectionReason as B}from"../packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs";export{d as ADVISOR_PROCEDURES_ENDPOINT,X as ALLOW_FORWARDED_ENV,H as POLICY_SCAFFOLD_ENDPOINT,F as SCHEMA_EDIT_ENDPOINT,b as SEED_ENDPOINT,c as STUDIO_PATH,I as STUDIO_SCRIPT_PATH,O as STUDIO_STYLE_PATH,j as STUDIO_WRITE_TEMP_SUFFIX,l as assetContentType,w as consumeStudioWrite,P as createStudioDocumentCache,x as createStudioMiddleware,t as devVariablesStamp,n as handleAdvisorProceduresRequest,L as handlePolicyScaffoldRequest,M as handleSchemaEditRequest,W as handleSeedRequest,g as headerValue,z as isLoopbackAddress,R as isNonLoopbackHost,p as isStandaloneModulePath,D as loadStudioAssets,r as parseDevVariable,T as readStandaloneAsset,U as renderStudioHtml,h as requestPathname,a as resolveAdminToken,f as resolveStandaloneDirectory,u as sendStudioAsset,i as sendStudioDocument,y as serveJsonHandler,_ as studioAssetsStamp,N as studioMountPath,B as transportRejectionReason};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.471",
3
+ "version": "1.0.0-alpha.472",
4
4
  "description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
5
5
  "keywords": [
6
6
  "bindings",
@@ -66,8 +66,8 @@
66
66
  "access": "public"
67
67
  },
68
68
  "dependencies": {
69
- "@lunora/codegen": "^1.0.0-alpha.428",
70
- "@lunora/container": "1.0.0-alpha.108",
69
+ "@lunora/codegen": "^1.0.0-alpha.445",
70
+ "@lunora/container": "^1.0.0-alpha.109",
71
71
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
72
72
  "@lunora/seed": "^1.0.0-alpha.282",
73
73
  "@visulima/colorize": "3.0.0",
@@ -1,4 +0,0 @@
1
- import{mkdirSync as _,writeFileSync as E,rmSync as N,existsSync as p,readFileSync as a}from"node:fs";import{join as n}from"node:path";const c=".lunora",v=n(c,"dev.json"),k=n(c,"dev.log"),T=n(c,"dev-bindings.json"),U="LUNORA_DEV_DAEMON",P="LUNORA_DEV_LOG_FILE",x="LUNORA_DEV_HANDOFF_PID",D=r=>r!==null&&typeof r=="object",s=(r,t)=>{const e=r[t];return typeof e=="string"&&e.length>0?e:void 0},m=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 t=a(`/proc/${String(r)}/stat`,"utf8"),e=t.slice(t.lastIndexOf(")")+2).split(" "),i=Number(e[19]),o=a("/proc/stat","utf8").split(`
2
- `).find(l=>l.startsWith("btime ")),d=Number(o?.slice(6));return!Number.isFinite(i)||!Number.isFinite(d)?void 0:d*1e3+i/g*1e3}catch{return}},b=r=>{if(!m(r.pid))return!1;const t=r.startedAt===void 0?Number.NaN:Date.parse(r.startedAt);if(Number.isNaN(t))return!0;const e=A(r.pid);return e===void 0||e<=t+y},f=r=>{const t=n(r,v);if(!p(t))return;let e;try{e=JSON.parse(a(t,"utf8"))}catch{return}if(!D(e)||typeof e.pid!="number")return;const i=s(e,"url");if(i!==void 0)return{background:e.background===!0,launcherPid:typeof e.launcherPid=="number"?e.launcherPid:void 0,logFile:s(e,"logFile"),mode:e.mode==="vite"?"vite":"cli",pid:e.pid,provisional:e.provisional===!0?!0:void 0,readyAt:s(e,"readyAt"),startedAt:s(e,"startedAt"),studioUrl:s(e,"studioUrl"),tunnelUrl:s(e,"tunnelUrl"),url:i}},u=(r,t)=>{try{_(n(r,c),{recursive:!0});const e=n(r,v);return E(e,`${JSON.stringify(t,void 0,2)}
3
- `,"utf8"),e}catch{return}},C=(r,t,e)=>{const i=f(r);if(i===void 0||e?.expectedPid!==void 0&&i.pid!==e.expectedPid)return;const o={...i,...t};return u(r,o),o},h=r=>r?.readyAt!==void 0,M=r=>r.provisional===!0?"launching":h(r)?"ready":"starting",O=(r,t)=>{try{if(t!==void 0){const e=f(r);if(e!==void 0&&e.pid!==t)return}N(n(r,v),{force:!0})}catch{}},F=r=>{const t=f(r);if(t!==void 0){if(b(t))return t;O(r,t.pid)}},I=(r,t,e)=>{const i=F(r);if(i!==void 0)return e!==void 0&&(i.pid===e||i.provisional===!0&&i.launcherPid===e)?{ok:u(r,t)!==void 0}:i.pid!==t.pid?{existing:i,ok:!1}:{ok:u(r,{...t,tunnelUrl:t.tunnelUrl??i.tunnelUrl})!==void 0}},G=(r,t,e)=>{const i=n(r,v),o=`${JSON.stringify(t,void 0,2)}
4
- `;for(let d=0;d<2;d+=1)try{return _(n(r,c),{recursive:!0}),E(i,o,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(l){if(l.code!=="EEXIST")return{ok:u(r,t)!==void 0};const S=I(r,t,e?.supersedePid);if(S!==void 0)return S}return{ok:u(r,t)!==void 0}};export{T as DEV_BINDINGS_FILE,U as DEV_DAEMON_ENV,x as DEV_HANDOFF_ENV,k as DEV_LOG_FILE,P as DEV_LOG_FILE_ENV,c as DEV_STATE_DIR,v as DEV_STATE_FILE,G as claimDevServerState,O as clearDevServerState,M as devServerPhase,h as isDevServerReady,m as isProcessAlive,b as isRecordedProcessCurrent,f as readDevServerState,F as readLiveDevServerState,C as updateDevServerState,u as writeDevServerState};
@@ -1,19 +0,0 @@
1
- import{randomBytes as V}from"node:crypto";import{existsSync as j,readFileSync as x,writeFileSync as h,linkSync as B,rmSync as m,renameSync as L,statSync as O}from"node:fs";import{join as g}from"node:path";import{LunoraError as z}from"@lunora/errors";import{DEV_VARS_FILE as u,DEV_VARS_EXAMPLE_FILE as f,parseDevVariableLine as K,parseDevVariableEntries as E,DEV_VARS_NEWLINE as b}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{MINTABLE_SECRET_KEYS as W,SHARD_RELAY_SECRET_KEY as y,CORE_SECRETS as P,mintableSecretKeysFor as U,SHARD_RELAY_HOST_PLACEHOLDER as Y,secretsForPackages as X}from"./PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs";const H=e=>[...P,...X(e)],k=32,G=["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"],q=/[.*+?^${}()|[\]\\]/gu,J=/[a-z0-9]$/u,T=e=>{const t=e.trim().toLowerCase();return t===""||t.startsWith("<")&&t.endsWith(">")?!0:G.some(n=>{const r=n.replaceAll(q,String.raw`\$&`),s=J.test(n)?`(^|[^a-z0-9])${r}([^a-z0-9]|$)`:`(^|[^a-z0-9])${r}`;return new RegExp(s,"u").test(t)})},p=e=>V(e).toString("hex"),w=new Set([...W,y]),Q=(e,t,n=w)=>e===y?n.has(e)&&(t.trim()===""||t===Y):n.has(e),F=(e,t,n,r)=>Q(e,t,r)&&T(t)?n(k):void 0,me=(e=p)=>e(k),M=(e,t,n,r=w)=>e.split(b).map(o=>{const s=K(o),i=s?F(s.key,s.value,t,r):void 0;return!s||i===void 0?o:(n.push(s.key),`${s.key}="${i}"`)}),Z=e=>{if(e.devVarsExists)return{status:"exists"};if(e.exampleContent===void 0)return{status:"no-example"};const t=[];return{content:M(e.exampleContent,e.randomHex??p,t).join(`
2
- `),generatedKeys:t,status:"generate"}},ee=e=>e.includes('"')||e.includes("\\")?"":e.replaceAll("\r",String.raw`\r`).replaceAll(`
3
- `,String.raw`\n`),A=e=>{const t=e.randomHex??p,n=new Set(E(e.existingContent).map(i=>i.key)),r=[],o=[],s=[];for(const i of e.exampleContent.split(b)){const a=K(i);if(!a||n.has(a.key))continue;const l=F(a.key,a.value,t,w);s.push(a.key),l===void 0?r.push(`${a.key}="${ee(a.value)}"`):(o.push(a.key),r.push(`${a.key}="${l}"`))}return{additions:r,generatedKeys:o,missingKeys:s}},R=e=>e.length>0?` (generated ${e.join(", ")})`:"",I=e=>`${e}.tmp-${String(process.pid)}`,v=(e,t,n={})=>{const r=I(e);try{h(r,t,{encoding:"utf8",...n}),L(r,e)}catch(o){throw m(r,{force:!0}),o}},te=(e,t)=>{try{return h(e,t,{encoding:"utf8",flag:"wx",mode:384}),!0}catch(n){if(n.code==="EEXIST")return!1;throw n}},N=(e,t)=>{const n=I(e);try{h(n,t,{encoding:"utf8",flag:"wx",mode:384});try{return B(n,e),!0}catch(r){const{code:o}=r;if(o==="EEXIST")return!1;if(o==="EPERM"||o==="ENOTSUP")return te(e,t);throw r}}finally{m(n,{force:!0})}},ge=(e,t)=>{v(e,t,{mode:384})},D=5,C=e=>{try{const t=O(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}},ne=(e,t)=>e===void 0||t===void 0?!1:e.mtimeMs===t.mtimeMs&&e.size===t.size,re=(e,t)=>{for(let n=0;n<D;n+=1){const r=C(e),o=x(e,"utf8"),s=t(o);if(s.length===0)return[];const i=o.length>0&&!o.endsWith(`
4
- `)?`
5
- `:"",a=`${o}${i}${s.join(`
6
- `)}
7
- `,l=`${e}.tmp-${String(process.pid)}-${V(6).toString("hex")}`;try{h(l,a,{encoding:"utf8",mode:384});const c=C(e);if(!ne(r,c)){m(l,{force:!0});continue}return L(l,e),s}catch(c){throw m(l,{force:!0}),c}}throw new z("INTERNAL",`Failed to append to ${e} after ${String(D)} attempts — a concurrent writer kept winning the race.`)},se=new Set(["EACCES","EISDIR","EPERM"]),$=e=>{try{return{content:x(e,"utf8"),kind:"read"}}catch(t){const{code:n}=t;if(n==="ENOENT")return{kind:"missing"};if(n!==void 0&&se.has(n))return{code:n,kind:"unreadable"};throw t}},he=async e=>{const t=g(e.cwd,u),n=$(t),r=$(g(e.cwd,f));for(const[d,S]of[[u,n],[f,r]])if(S.kind==="unreadable")return(e.warn??e.info)(`skipped the ${u} scaffold: ${d} is not a readable file (${S.code})`),{addedKeys:[],generatedKeys:[],status:"unreadable"};if(r.kind!=="read")return{addedKeys:[],generatedKeys:[],status:"no-example"};const o=r.content;if(n.kind!=="read"){const d=Z({devVarsExists:!1,exampleContent:o,randomHex:e.randomHex});return d.status!=="generate"?{addedKeys:[],generatedKeys:[],status:"no-example"}:e.yes===!0||await e.confirm(`No ${u} found. Generate it from ${f} (secrets auto-filled)?`)?N(t,d.content)?(e.info(`Created ${u}${R(d.generatedKeys)}.`),{addedKeys:[],generatedKeys:d.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 s=A({existingContent:n.content,exampleContent:o,randomHex:e.randomHex});if(s.missingKeys.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const i=s.missingKeys.join(", ");if(!(e.yes===!0||await e.confirm(`${u} is missing ${String(s.missingKeys.length)} key(s) from ${f} (${i}). Add them?`)))return e.info(`Skipped — add ${i} to ${u} when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"};const c=re(t,d=>A({existingContent:d,exampleContent:o,randomHex:e.randomHex}).additions).map(d=>K(d)?.key).filter(d=>d!==void 0);if(c.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const _=s.generatedKeys.filter(d=>c.includes(d));return e.info(`Updated ${u} — added ${c.join(", ")}${R(_)}.`),{addedKeys:c,generatedKeys:_,status:"augmented"}},oe=e=>[`# ${e.description}`,`# Docs: ${e.docsUrl}`,`${e.key}="${e.placeholderValue}"`].join(`
8
- `),ie=(e,t)=>{const n=H(e).filter(r=>!t.has(r.key));return n.length===0?"":n.map(r=>oe(r)).join(`
9
-
10
- `)},Ee=(e,t)=>{const n=g(e,f),r=j(n)?x(n,"utf8"):"",o=new Set(E(r).map(a=>a.key)),s=ie(t,o);if(s==="")return[];const i=r.length>0&&!r.endsWith(`
11
- `)?`
12
- `:"";return v(n,`${r}${i}
13
- ${s}
14
- `),H(t).filter(a=>!o.has(a.key)).map(a=>a.key)},ae=e=>{const t=e.randomHex??p,n=[],r=M(e.existingContent,t,n,e.mintable),o=new Set(E(e.existingContent).map(c=>c.key)),s=[],i=[];for(const c of P)o.has(c.key)||(s.push(c.key),i.push(`# ${c.description}`,`${c.key}="${t(k)}"`));const a=r.join(`
15
- `);if(i.length===0)return{addedKeys:s,content:a,filledKeys:n};const l=a===""||a.endsWith(`
16
- `)?"":`
17
- `;return{addedKeys:s,content:`${a}${l}${i.join(`
18
- `)}
19
- `,filledKeys:n}},pe=e=>{const t=g(e.cwd,u),n=$(t);if(n.kind==="unreadable")return{addedKeys:[],filledKeys:[],status:"unchanged"};const r=n.kind==="read",o=r?n.content:"",s=e.secretSources===void 0?void 0:U(e.secretSources),i=ae({existingContent:o,mintable:s,randomHex:e.randomHex}),a=E(i.content).find(c=>c.key===y)?.value;if(s!==void 0&&!s.has(y)&&a!==void 0&&T(a)&&e.info?.(`${y} is still a placeholder. This worker only calls an event log hosted elsewhere, so set it to the ${y} of the worker that hosts EventLogDO.`),i.filledKeys.length===0&&i.addedKeys.length===0)return{addedKeys:[],filledKeys:[],status:"unchanged"};if(r)v(t,i.content,{mode:384});else if(!N(t,i.content))return{addedKeys:[],filledKeys:[],status:"unchanged"};const l=[...i.filledKeys,...i.addedKeys];return e.info?.(`Generated ${String(l.length)} dev secret(s) in ${u}: ${l.join(", ")}`),{addedKeys:i.addedKeys,filledKeys:i.filledKeys,status:r?"filled":"created"}};export{ie as buildPackageSecretsBlock,he as ensureDevVariables,Ee as ensureDevVarsExample,pe as fillDevSecrets,me as generateSecretValue,Q as isMintableSecretKey,T as isPlaceholderValue,ae as planDevSecretsFill,A as planDevVariablesAugment,Z as planDevVariablesScaffold,H as requiredSecrets,ge as writeDevVariablesFileAtomically};
@@ -1 +0,0 @@
1
- import{spawnSync as u}from"node:child_process";import{rmSync as a,readdirSync as f,writeFileSync as d,lstatSync as g}from"node:fs";import{join as s,dirname as l}from"node:path";import m from"./ensureGitignoreEntries-Tsk8Qkw7.mjs";import{i as y}from"./is-within-directory-DRMw89rK.mjs";const h=/^\.wrangler\.lunora-(?:dev|service)\.(\d+)\.\d+\.jsonc$/,p=".wrangler.lunora-*.jsonc";let c=0;const w=n=>(c+=1,`.wrangler.lunora-${n}.${String(process.pid)}.${String(c)}.jsonc`),A=n=>{try{return process.kill(n,0),!0}catch(r){return r.code==="EPERM"}},I=n=>{let r;try{r=f(n)}catch{return}for(const t of r){const e=h.exec(t);if(!(e===null||Number(e[1])===process.pid||A(Number(e[1]))))try{a(s(n,t),{force:!0})}catch{}}},N=()=>{},b=n=>{let r=!1;return()=>{if(!r){r=!0;try{a(n,{force:!0})}catch{}}}},C=n=>u("git",["check-ignore","-q","--no-index",n],{cwd:l(n),stdio:"ignore",timeout:5e3}).status,E=(n,r)=>{const t=l(n),e=t!==r&&y(t,r)?[r,t]:[t];try{for(const o of e){if(C(n)!==1)return;g(s(o,".gitignore"),{throwIfNoEntry:!1})?.isSymbolicLink()!==!0&&m(o,[p])}}catch{}},O=(n,r,t,e)=>{I(n);const o=s(n,w(r));return E(o,e),d(o,t,"utf8"),{cleanup:b(o),configPath:o}},L=(n,r)=>{const t=n?.ai,e=n?.artifacts,o=(Array.isArray(e)?e:[]).flatMap(i=>typeof i?.binding=="string"?[i.binding]:[]);return t==null&&o.length===0?[]:r()?[]:[...t==null?[]:[{binding:typeof t.binding=="string"?t.binding:"AI",kind:"ai"}],...o.map(i=>({binding:i,kind:"artifacts"}))]},R=({binding:n,kind:r})=>r==="ai"?`Workers AI is off in this dev session (${n} binding left out): no usable 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.`:`Artifacts is off in this dev session (${n} binding left out): no usable Cloudflare login found, and Artifacts only runs remotely. \`ctx.artifacts\` will throw. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`;export{p as DEV_CONFIG_IGNORE,h as STALE_DEV_CONFIG,b as createCleanup,R as describeWithheld,w as devConfigBasename,N as noopCleanup,I as sweepStaleDevConfigs,L as withheldBindings,O as writeDevConfig};
@@ -1,7 +0,0 @@
1
- import{existsSync as d,readFileSync as g,writeFileSync as m}from"node:fs";import{join as u}from"node:path";const h=/\r?\n/u,I=(a,s)=>{const e=u(a,".gitignore"),n=d(e)?g(e,"utf8"):"",r=n.split(h).map(t=>t.trim()),c=r.findLastIndex(t=>t.startsWith("!")&&!s.includes(t)),i=s.filter(t=>{const o=r.lastIndexOf(t);return o===-1||!t.startsWith("!")&&o<c});if(i.length===0)return[];const l=i.some(t=>!t.startsWith("!"))?[...i.filter(t=>!t.startsWith("!")),...s.filter(t=>t.startsWith("!"))]:i,f=n.length>0&&!n.endsWith(`
2
- `)?`
3
- `:"";return m(e,`${n}${f}
4
- # Lunora — local secrets and dev state, never commit
5
- ${l.join(`
6
- `)}
7
- `,"utf8"),i};export{I as default};