@lunora/config 1.0.0-alpha.80 → 1.0.0-alpha.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1 -30
- package/dist/packem_shared/ACCENT-CLeV5v0K.mjs +7 -0
- package/dist/packem_shared/AGENT_MODE_ENV-B54hVQ_w.mjs +1 -0
- package/dist/packem_shared/AGENT_RULES_DIR-hP9TiDNx.mjs +1 -0
- package/dist/packem_shared/DEV_DAEMON_ENV-D9Z83rlU.mjs +4 -0
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-DX6xGbpr.mjs +1 -0
- package/dist/packem_shared/LINKED_PROJECT_DIR-CMzUvj-1.mjs +2 -0
- package/dist/packem_shared/LUNORA_CONFIG_FILE-3bpx6TZN.mjs +1 -0
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-ZclWASXS.mjs +1 -0
- package/dist/packem_shared/LunoraReporter-BnXUqh8t.mjs +6 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-BgmvEPA-.mjs +1 -0
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-CUYWD0Mh.mjs +1 -0
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-ws6iE0y-.mjs +1 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-DPcRuAhj.mjs +1 -0
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-CZ8rSh2k.mjs +1 -0
- package/dist/packem_shared/SEED_ENDPOINT-BaYShU8q.mjs +1 -0
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-B1h_wNDN.mjs +1 -0
- package/dist/packem_shared/WRANGLER_FILES-Bi_18Pj6.mjs +1 -0
- package/dist/packem_shared/applyAdditiveEdit-BdcnSa-j.mjs +6 -0
- package/dist/packem_shared/assetContentType-DNZyUOuF.mjs +1 -0
- package/dist/packem_shared/buildPackageSecretsBlock-BpvaZzQ8.mjs +18 -0
- package/dist/packem_shared/classifyPolicyEdit-BzC_MfYK.mjs +24 -0
- package/dist/packem_shared/collectWranglerSecretVariables-OacEwPmL.mjs +1 -0
- package/dist/packem_shared/createConfirm-7IL0kZyE.mjs +7 -0
- package/dist/packem_shared/detectFramework-VTQfCNXy.mjs +1 -0
- package/dist/packem_shared/discoverAgentInfo-BJm0QtoI.mjs +1 -0
- package/dist/packem_shared/discoverContainerInfo-CYG9j2LY.mjs +1 -0
- package/dist/packem_shared/discoverSchemaInfo-B2W3VrcT.mjs +1 -0
- package/dist/packem_shared/discoverWorkflowInfo-Bbc0u2gE.mjs +1 -0
- package/dist/packem_shared/inferLunoraBindings-DWSabh1j.mjs +1 -0
- package/dist/packem_shared/jsonc-edit-BZVpxVA0.mjs +1 -0
- package/dist/packem_shared/parseDevVariable-NAVJ8tgA.mjs +1 -0
- package/dist/packem_shared/parseSchema-BPmtMgmb.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerBindings-Dd3tLauZ.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-BXNiEQ7p.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerCrons-BmQa_kGL.mjs +1 -0
- package/dist/packem_shared/renderStudioHtml-B2AkxcW1.mjs +15 -0
- package/dist/packem_shared/serveJsonHandler-C5GWlWJF.mjs +1 -0
- package/dist/packem_shared/streamContainerLogs-BPYBNrWS.mjs +2 -0
- package/dist/packem_shared/write-atomic-Cdr2oQb-.mjs +1 -0
- package/dist/studio-host/index.mjs +1 -7
- package/package.json +3 -3
- package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
- package/dist/packem_shared/AGENT_MODE_ENV-B5R7jpY7.mjs +0 -17
- package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
- package/dist/packem_shared/DEV_DAEMON_ENV-FIEtW7Fz.mjs +0 -163
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
- package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
- package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-M1KM9_pR.mjs +0 -112
- package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-NCTSphDk.mjs +0 -138
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-CvTZpaZF.mjs +0 -100
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-C-F_Flgy.mjs +0 -100
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-DP0SFVy9.mjs +0 -607
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Bt2SNkpV.mjs +0 -95
- package/dist/packem_shared/SEED_ENDPOINT-7izz_Jao.mjs +0 -61
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-CaXbS7CX.mjs +0 -11
- package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
- package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
- package/dist/packem_shared/assetContentType-ByZjeV3D.mjs +0 -72
- package/dist/packem_shared/buildPackageSecretsBlock-BxOcyaAY.mjs +0 -281
- package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
- package/dist/packem_shared/collectWranglerSecretVariables-BRWIvT-e.mjs +0 -56
- package/dist/packem_shared/createConfirm-BMikeJC9.mjs +0 -117
- package/dist/packem_shared/detectFramework-U08038Yp.mjs +0 -41
- package/dist/packem_shared/discoverAgentInfo-eXA3hF4v.mjs +0 -19
- package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
- package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
- package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
- package/dist/packem_shared/inferLunoraBindings-BcvvtpSG.mjs +0 -397
- package/dist/packem_shared/jsonc-edit-SbcD7MAe.mjs +0 -9
- package/dist/packem_shared/parseDevVariable-B0FEvfHC.mjs +0 -21
- package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
- package/dist/packem_shared/reconcileWranglerBindings-2Cww5VLa.mjs +0 -362
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-C8c497ag.mjs +0 -31
- package/dist/packem_shared/reconcileWranglerCrons-DvsceVFz.mjs +0 -29
- package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
- package/dist/packem_shared/serveJsonHandler-Cl2Wqkv8.mjs +0 -86
- package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
- package/dist/packem_shared/write-atomic-B2REqapi.mjs +0 -14
package/dist/index.mjs
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { discoverAgentInfo } from './packem_shared/discoverAgentInfo-eXA3hF4v.mjs';
|
|
3
|
-
export { AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, LUNORA_SKILL_NAMES, ROOT_SKILL_NAME, claimAgentRulesHint, detectAgentRules } from './packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs';
|
|
4
|
-
export { discoverContainerInfo } from './packem_shared/discoverContainerInfo-BXFs6Wav.mjs';
|
|
5
|
-
export { streamContainerLogs } from './packem_shared/streamContainerLogs-BZ4cOZwH.mjs';
|
|
6
|
-
export { detectFramework, readProjectDependencyNames } from './packem_shared/detectFramework-U08038Yp.mjs';
|
|
7
|
-
export { DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, claimDevServerState, clearDevServerState, isProcessAlive, isRecordedProcessCurrent, readDevServerState, readLiveDevServerState, updateDevServerState, writeDevServerState } from './packem_shared/DEV_DAEMON_ENV-FIEtW7Fz.mjs';
|
|
8
|
-
export { DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, parseDevVariableEntries } from './packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs';
|
|
9
|
-
export { inferLunoraBindings, packageNamesFromBindings } from './packem_shared/inferLunoraBindings-BcvvtpSG.mjs';
|
|
10
|
-
export { LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, readLinkedProject, writeLinkedProject } from './packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs';
|
|
11
|
-
export { LUNORA_EVENT_SOURCE, formatLunoraEvent } from './packem_shared/LUNORA_EVENT_SOURCE-M1KM9_pR.mjs';
|
|
12
|
-
export { default as LunoraReporter } from './packem_shared/LunoraReporter-Ci-bDCK9.mjs';
|
|
13
|
-
export { PACKAGE_SECRETS_REGISTRY, secretsForPackages } from './packem_shared/PACKAGE_SECRETS_REGISTRY-NCTSphDk.mjs';
|
|
14
|
-
export { LUNORA_CONFIG_FILE, interpretRemote, readProjectRemotePreference } from './packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs';
|
|
15
|
-
export { createConfirm, isInteractive, promptMultiSelect, promptSelect, promptText, promptYesNo } from './packem_shared/createConfirm-BMikeJC9.mjs';
|
|
16
|
-
export { reconcileWranglerBindings } from './packem_shared/reconcileWranglerBindings-2Cww5VLa.mjs';
|
|
17
|
-
export { reconcileWranglerCompatibilityDate } from './packem_shared/reconcileWranglerCompatibilityDate-C8c497ag.mjs';
|
|
18
|
-
export { reconcileWranglerCrons } from './packem_shared/reconcileWranglerCrons-DvsceVFz.mjs';
|
|
19
|
-
export { REMOTE_ELIGIBLE_KEYS, injectRemoteFlags, isRemoteEnvEnabled, materializeRemoteWranglerConfig, planRemoteBindings, resolveRemoteEnabled } from './packem_shared/REMOTE_ELIGIBLE_KEYS-C-F_Flgy.mjs';
|
|
20
|
-
export { buildPackageSecretsBlock, ensureDevVariables, ensureDevVarsExample, fillDevSecrets, generateSecretValue, isMintableSecretKey, isPlaceholderValue, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, requiredSecrets } from './packem_shared/buildPackageSecretsBlock-BxOcyaAY.mjs';
|
|
21
|
-
export { applyAdditiveEdit, classifyEdit } from './packem_shared/applyAdditiveEdit-C-snTFEV.mjs';
|
|
22
|
-
export { parseSchema } from './packem_shared/parseSchema-DSeyktvG.mjs';
|
|
23
|
-
export { classifyPolicyEdit, scaffoldPolicyFile, wireRlsIntoProcedure } from './packem_shared/classifyPolicyEdit-BHeAqF8P.mjs';
|
|
24
|
-
export { discoverSchemaInfo } from './packem_shared/discoverSchemaInfo-BB-CKlTK.mjs';
|
|
25
|
-
export { ACCENT, BADGES, BADGE_COLUMN_WIDTH, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, STEP_BADGE_NAMES, badgeLead, badgeWidth, padBadge, paintAnswer, paintBadge } from './packem_shared/ACCENT-DW1XJn8i.mjs';
|
|
26
|
-
export { WORKERS_CACHE_MIN_DATE, isCacheEnabled } from './packem_shared/WORKERS_CACHE_MIN_DATE-CaXbS7CX.mjs';
|
|
27
|
-
export { discoverWorkflowInfo } from './packem_shared/discoverWorkflowInfo-CedvR0mn.mjs';
|
|
28
|
-
export { WRANGLER_FILES, findWranglerFile, readWranglerJsonc } from './packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs';
|
|
29
|
-
export { collectWranglerSecretVariables, scanWranglerVariablesForSecrets } from './packem_shared/collectWranglerSecretVariables-BRWIvT-e.mjs';
|
|
30
|
-
export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer } from './packem_shared/REQUIRED_COMPATIBILITY_DATE-DP0SFVy9.mjs';
|
|
1
|
+
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-B54hVQ_w.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-BJm0QtoI.mjs";import{AGENT_RULES_DIR as n,AGENT_RULES_HINT as l,AGENT_RULES_HINT_ENV as _,LUNORA_SKILL_NAMES as c,ROOT_SKILL_NAME as s,claimAgentRulesHint as m,detectAgentRules as p}from"./packem_shared/AGENT_RULES_DIR-hP9TiDNx.mjs";import{discoverContainerInfo as d}from"./packem_shared/discoverContainerInfo-CYG9j2LY.mjs";import{streamContainerLogs as A}from"./packem_shared/streamContainerLogs-BPYBNrWS.mjs";import{detectFramework as L,readProjectDependencyNames as D}from"./packem_shared/detectFramework-VTQfCNXy.mjs";import{DEV_DAEMON_ENV as I,DEV_HANDOFF_ENV as v,DEV_LOG_FILE as g,DEV_LOG_FILE_ENV as x,DEV_STATE_DIR as T,DEV_STATE_FILE as V,claimDevServerState as C,clearDevServerState as F,isProcessAlive as P,isRecordedProcessCurrent as O,readDevServerState as u,readLiveDevServerState as G,updateDevServerState as W,writeDevServerState as U}from"./packem_shared/DEV_DAEMON_ENV-D9Z83rlU.mjs";import{DEV_VARS_EXAMPLE_FILE as B,DEV_VARS_FILE as M,DEV_VARS_KEY_PATTERN as K,parseDevVariableEntries as k}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-DX6xGbpr.mjs";import{inferLunoraBindings as w,packageNamesFromBindings as h}from"./packem_shared/inferLunoraBindings-DWSabh1j.mjs";import{LINKED_PROJECT_DIR as H,LINKED_PROJECT_FILE as Y,readLinkedProject as J,writeLinkedProject as Q}from"./packem_shared/LINKED_PROJECT_DIR-CMzUvj-1.mjs";import{LUNORA_EVENT_SOURCE as z,formatLunoraEvent as X}from"./packem_shared/LUNORA_EVENT_SOURCE-ZclWASXS.mjs";import{default as $}from"./packem_shared/LunoraReporter-BnXUqh8t.mjs";import{PACKAGE_SECRETS_REGISTRY as re,secretsForPackages as oe}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-BgmvEPA-.mjs";import{LUNORA_CONFIG_FILE as ae,interpretRemote as Ee,readProjectRemotePreference as ie}from"./packem_shared/LUNORA_CONFIG_FILE-3bpx6TZN.mjs";import{createConfirm as le,isInteractive as _e,promptMultiSelect as ce,promptSelect as se,promptText as me,promptYesNo as pe}from"./packem_shared/createConfirm-7IL0kZyE.mjs";import{reconcileWranglerBindings as de}from"./packem_shared/reconcileWranglerBindings-Dd3tLauZ.mjs";import{reconcileWranglerCompatibilityDate as Ae}from"./packem_shared/reconcileWranglerCompatibilityDate-BXNiEQ7p.mjs";import{reconcileWranglerCrons as Le}from"./packem_shared/reconcileWranglerCrons-BmQa_kGL.mjs";import{REMOTE_ELIGIBLE_KEYS as Ne,injectRemoteFlags as Ie,isRemoteEnvEnabled as ve,materializeRemoteWranglerConfig as ge,planRemoteBindings as xe,resolveRemoteEnabled as Te}from"./packem_shared/REMOTE_ELIGIBLE_KEYS-ws6iE0y-.mjs";import{buildPackageSecretsBlock as Ce,ensureDevVariables as Fe,ensureDevVarsExample as Pe,fillDevSecrets as Oe,generateSecretValue as ue,isMintableSecretKey as Ge,isPlaceholderValue as We,planDevSecretsFill as Ue,planDevVariablesAugment as be,planDevVariablesScaffold as Be,requiredSecrets as Me}from"./packem_shared/buildPackageSecretsBlock-BpvaZzQ8.mjs";import{applyAdditiveEdit as ke,classifyEdit as ye}from"./packem_shared/applyAdditiveEdit-BdcnSa-j.mjs";import{parseSchema as he}from"./packem_shared/parseSchema-BPmtMgmb.mjs";import{classifyPolicyEdit as He,scaffoldPolicyFile as Ye,wireRlsIntoProcedure as Je}from"./packem_shared/classifyPolicyEdit-BzC_MfYK.mjs";import{discoverSchemaInfo as qe}from"./packem_shared/discoverSchemaInfo-B2W3VrcT.mjs";import{ACCENT as Xe,BADGES as Ze,BADGE_COLUMN_WIDTH as $e,LUNA_ART as er,LUNA_BUNNY as rr,LUNA_NAME as or,LUNA_SIGNOFF as tr,STEP_BADGE_NAMES as ar,badgeLead as Er,badgeWidth as ir,padBadge as nr,paintAnswer as lr,paintBadge as _r}from"./packem_shared/ACCENT-CLeV5v0K.mjs";import{WORKERS_CACHE_MIN_DATE as sr,isCacheEnabled as mr}from"./packem_shared/WORKERS_CACHE_MIN_DATE-B1h_wNDN.mjs";import{discoverWorkflowInfo as fr}from"./packem_shared/discoverWorkflowInfo-Bbc0u2gE.mjs";import{WRANGLER_FILES as Sr,findWranglerFile as Ar,readWranglerJsonc as Rr}from"./packem_shared/WRANGLER_FILES-Bi_18Pj6.mjs";import{collectWranglerSecretVariables as Dr,scanWranglerVariablesForSecrets as Nr}from"./packem_shared/collectWranglerSecretVariables-OacEwPmL.mjs";import{REQUIRED_COMPATIBILITY_DATE as vr,REQUIRED_FLAG as gr,validateWrangler as xr,validateWranglerConfig as Tr,validateWranglerProject as Vr,withTailConsumer as Cr}from"./packem_shared/REQUIRED_COMPATIBILITY_DATE-DPcRuAhj.mjs";export{Xe as ACCENT,o as AGENT_MODE_ENV,n as AGENT_RULES_DIR,l as AGENT_RULES_HINT,_ as AGENT_RULES_HINT_ENV,Ze as BADGES,$e as BADGE_COLUMN_WIDTH,I as DEV_DAEMON_ENV,v as DEV_HANDOFF_ENV,g as DEV_LOG_FILE,x as DEV_LOG_FILE_ENV,T as DEV_STATE_DIR,V as DEV_STATE_FILE,B as DEV_VARS_EXAMPLE_FILE,M as DEV_VARS_FILE,K as DEV_VARS_KEY_PATTERN,H as LINKED_PROJECT_DIR,Y as LINKED_PROJECT_FILE,er as LUNA_ART,rr as LUNA_BUNNY,or as LUNA_NAME,tr as LUNA_SIGNOFF,ae as LUNORA_CONFIG_FILE,z as LUNORA_EVENT_SOURCE,c as LUNORA_SKILL_NAMES,$ as LunoraReporter,re as PACKAGE_SECRETS_REGISTRY,Ne as REMOTE_ELIGIBLE_KEYS,vr as REQUIRED_COMPATIBILITY_DATE,gr as REQUIRED_FLAG,s as ROOT_SKILL_NAME,ar as STEP_BADGE_NAMES,sr as WORKERS_CACHE_MIN_DATE,Sr as WRANGLER_FILES,ke as applyAdditiveEdit,Er as badgeLead,ir as badgeWidth,Ce as buildPackageSecretsBlock,m as claimAgentRulesHint,C as claimDevServerState,ye as classifyEdit,He as classifyPolicyEdit,F as clearDevServerState,Dr as collectWranglerSecretVariables,le as createConfirm,p as detectAgentRules,t as detectAiAgent,L as detectFramework,E as discoverAgentInfo,d as discoverContainerInfo,qe as discoverSchemaInfo,fr as discoverWorkflowInfo,Fe as ensureDevVariables,Pe as ensureDevVarsExample,Oe as fillDevSecrets,Ar as findWranglerFile,X as formatLunoraEvent,ue as generateSecretValue,w as inferLunoraBindings,Ie as injectRemoteFlags,Ee as interpretRemote,mr as isCacheEnabled,_e as isInteractive,Ge as isMintableSecretKey,We as isPlaceholderValue,P as isProcessAlive,O as isRecordedProcessCurrent,ve as isRemoteEnvEnabled,ge as materializeRemoteWranglerConfig,h as packageNamesFromBindings,nr as padBadge,lr as paintAnswer,_r as paintBadge,k as parseDevVariableEntries,he as parseSchema,Ue as planDevSecretsFill,be as planDevVariablesAugment,Be as planDevVariablesScaffold,xe as planRemoteBindings,ce as promptMultiSelect,se as promptSelect,me as promptText,pe as promptYesNo,u as readDevServerState,J as readLinkedProject,G as readLiveDevServerState,D as readProjectDependencyNames,ie as readProjectRemotePreference,Rr as readWranglerJsonc,de as reconcileWranglerBindings,Ae as reconcileWranglerCompatibilityDate,Le as reconcileWranglerCrons,Me as requiredSecrets,Te as resolveRemoteEnabled,Ye as scaffoldPolicyFile,Nr as scanWranglerVariablesForSecrets,oe as secretsForPackages,A as streamContainerLogs,W as updateDevServerState,xr as validateWrangler,Tr as validateWranglerConfig,Vr as validateWranglerProject,Je as wireRlsIntoProcedure,Cr as withTailConsumer,U as writeDevServerState,Q as writeLinkedProject};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import b from"@visulima/colorize";const a="#a855f7",e="#0b0b0b",n=["lunora","dir","tmpl","add","deps","git","next"],i={add:{bg:a,fg:e,text:"add"},debug:{bg:"#6b7280",fg:"#f3f4f6",text:"debug"},deps:{bg:a,fg:e,text:"deps"},dir:{bg:a,fg:e,text:"dir"},error:{bg:"#ef4444",fg:e,text:"error"},git:{bg:"#f59e0b",fg:e,text:"git"},info:{bg:"#3b82f6",fg:e,text:"info"},lunora:{bg:"#22c55e",fg:e,text:"lunora"},next:{bg:"#06b6d4",fg:e,text:"next"},success:{bg:"#22c55e",fg:e,text:"ok"},tmpl:{bg:a,fg:e,text:"tmpl"},warn:{bg:"#f59e0b",fg:e,text:"warn"}},o="Luna",p="Safe travels, voyager.",g=String.raw`
|
|
2
|
+
.-"""""-.
|
|
3
|
+
/ (\(\ \
|
|
4
|
+
| ( -.-) |
|
|
5
|
+
\ o(")(") /
|
|
6
|
+
'-._____.-'`,_=g.startsWith(`
|
|
7
|
+
`)?g.slice(1):g,f=6,s=t=>` ${t} `,d=t=>" ".repeat(Math.max(0,f-t.length)),r=f+2,A=t=>r,N=t=>d(t.text)+b.bgHex(t.bg).hex(t.fg).bold(s(t.text)),l=t=>b.dim(t);export{a as ACCENT,i as BADGES,r as BADGE_COLUMN_WIDTH,_ as LUNA_ART,g as LUNA_BUNNY,o as LUNA_NAME,p as LUNA_SIGNOFF,n as STEP_BADGE_NAMES,d as badgeLead,A as badgeWidth,s as padBadge,l as paintAnswer,N as paintBadge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{detectAiSession as i}from"@visulima/find-ai-runner";const r="LUNORA_AGENT_MODE",n=t=>{const e=t.trim().toLowerCase();return e==="0"||e==="false"},a=(t=process.env)=>{const e=t[r];if(e!==void 0&&e!=="")return n(e)?void 0:{name:"agent (forced)",variable:r};const o=i(t);return o===void 0?void 0:{name:o.agent,variable:o.signal}};export{r as AGENT_MODE_ENV,a as detectAiAgent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as r}from"node:fs";import{join as u}from"node:path";const l=".agents/skills",e="LUNORA_RULES_HINT_SHOWN",i=["lunora","lunora-quickstart","lunora-functions","lunora-realtime","lunora-setup-auth","lunora-create-package","lunora-migration-helper","lunora-deploy","lunora-performance-audit"],c="lunora",_="Lunora AI rules not installed — run `lunora rules install` so your coding agent knows how to use Lunora.",N=()=>process.env[e]==="1"?!1:(process.env[e]="1",!0),t=(s,n)=>u(s,l,n,"SKILL.md"),A=s=>{const n=[],o=[];for(const a of i)r(t(s,a))?n.push(a):o.push(a);return{installed:r(t(s,c)),missing:o,present:n}};export{l as AGENT_RULES_DIR,_ as AGENT_RULES_HINT,e as AGENT_RULES_HINT_ENV,i as LUNORA_SKILL_NAMES,c as ROOT_SKILL_NAME,N as claimAgentRulesHint,A as detectAgentRules};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{mkdirSync as S,writeFileSync as N,rmSync as E,existsSync as D,readFileSync as f}from"node:fs";import{join as s}from"node:path";const a=".lunora",d=s(a,"dev.json"),I=s(a,"dev.log"),h="LUNORA_DEV_DAEMON",x="LUNORA_DEV_LOG_FILE",T="LUNORA_DEV_HANDOFF_PID",_=t=>t!==null&&typeof t=="object",u=(t,e)=>{const r=t[e];return typeof r=="string"&&r.length>0?r:void 0},m=t=>{if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch{return!1}},y=1e4,A=100,F=t=>{if(process.platform==="linux")try{const e=f(`/proc/${String(t)}/stat`,"utf8"),r=e.slice(e.lastIndexOf(")")+2).split(" "),i=Number(r[19]),c=f("/proc/stat","utf8").split(`
|
|
2
|
+
`).find(v=>v.startsWith("btime ")),o=Number(c?.slice(6));return!Number.isFinite(i)||!Number.isFinite(o)?void 0:o*1e3+i/A*1e3}catch{return}},O=t=>{if(!m(t.pid))return!1;const e=t.startedAt===void 0?Number.NaN:Date.parse(t.startedAt);if(Number.isNaN(e))return!0;const r=F(t.pid);return r===void 0||r<=e+y},l=t=>{const e=s(t,d);if(!D(e))return;let r;try{r=JSON.parse(f(e,"utf8"))}catch{return}if(!_(r)||typeof r.pid!="number")return;const i=u(r,"url");if(i!==void 0)return{background:r.background===!0,logFile:u(r,"logFile"),mode:r.mode==="vite"?"vite":"cli",pid:r.pid,startedAt:u(r,"startedAt"),studioUrl:u(r,"studioUrl"),url:i}},n=(t,e)=>{try{S(s(t,a),{recursive:!0});const r=s(t,d);return N(r,`${JSON.stringify(e,void 0,2)}
|
|
3
|
+
`,"utf8"),r}catch{return}},R=(t,e)=>{const r=l(t);if(r===void 0)return;const i={...r,...e};return n(t,i),i},g=(t,e)=>{try{if(e!==void 0){const r=l(t);if(r!==void 0&&r.pid!==e)return}E(s(t,d),{force:!0})}catch{}},b=t=>{const e=l(t);if(e!==void 0){if(O(e))return e;g(t,e.pid)}},V=(t,e,r)=>{const i=b(t);if(i!==void 0)return r!==void 0&&i.pid===r?{ok:n(t,e)!==void 0}:i.pid!==e.pid?{existing:i,ok:!1}:{ok:n(t,e)!==void 0}},U=(t,e,r)=>{const i=s(t,d),c=`${JSON.stringify(e,void 0,2)}
|
|
4
|
+
`;for(let o=0;o<2;o+=1)try{return S(s(t,a),{recursive:!0}),N(i,c,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(v){if(v.code!=="EEXIST")return{ok:n(t,e)!==void 0};const p=V(t,e,r?.supersedePid);if(p!==void 0)return p}return{ok:n(t,e)!==void 0}};export{h as DEV_DAEMON_ENV,T as DEV_HANDOFF_ENV,I as DEV_LOG_FILE,x as DEV_LOG_FILE_ENV,a as DEV_STATE_DIR,d as DEV_STATE_FILE,U as claimDevServerState,g as clearDevServerState,m as isProcessAlive,O as isRecordedProcessCurrent,l as readDevServerState,b as readLiveDevServerState,R as updateDevServerState,n as writeDevServerState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const u=".dev.vars",E=".dev.vars.example",r=/^[A-Za-z_]\w*$/u,i=/\r?\n/u,n=e=>e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))?e.slice(1,-1):e,l=e=>{const s=e.trim();if(s===""||s.startsWith("#"))return;const a=s.indexOf("=");if(a<=0)return;const t=s.slice(0,a).trim();if(r.test(t))return{key:t,value:s.slice(a+1).trim()}},o=e=>{const s=[];for(const a of e.split(i)){const t=l(a);t&&s.push({key:t.key,value:n(t.value)})}return s};export{E as DEV_VARS_EXAMPLE_FILE,u as DEV_VARS_FILE,r as DEV_VARS_KEY_PATTERN,i as DEV_VARS_NEWLINE,o as parseDevVariableEntries,l as splitDevVariableLine,n as unquoteDevVariable};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{existsSync as m,readFileSync as d,mkdirSync as f,writeFileSync as k}from"node:fs";import{parse as w}from"jsonc-parser";import{join as i}from"node:path";const l=".lunora",u=i(l,"project.json"),y=r=>r!==null&&typeof r=="object",c=(r,o)=>{const t=r[o];return typeof t=="string"&&t.length>0?t:void 0},N=r=>{const o=i(r,u);if(!m(o))return;let t;try{t=d(o,"utf8")}catch{return}const n=[],e=w(t,n,{allowTrailingComma:!0});if(!(n.length>0||!y(e)))return{account:c(e,"account"),env:c(e,"env"),linkedAt:c(e,"linkedAt"),workerName:c(e,"workerName"),workerUrl:c(e,"workerUrl")}},g=(r,o)=>{const t=i(r,l);f(t,{recursive:!0});const n={};for(const a of["account","env","linkedAt","workerName","workerUrl"]){const s=o[a];s!==void 0&&s!==""&&(n[a]=s)}const e=i(r,u);return k(e,`${JSON.stringify(n,void 0,2)}
|
|
2
|
+
`,"utf8"),e};export{l as LINKED_PROJECT_DIR,u as LINKED_PROJECT_FILE,N as readLinkedProject,g as writeLinkedProject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as i,readFileSync as f}from"node:fs";import{parse as a}from"jsonc-parser";import{join as l}from"node:path";const m="lunora.json",c=r=>{if(typeof r=="boolean")return r;if(r!==null&&typeof r=="object")return!0},y=r=>{const e=l(r,m);if(!i(e))return;let o;try{o=f(e,"utf8")}catch{return}const n=[],t=a(o,n,{allowTrailingComma:!0});if(!(n.length>0||t===null||typeof t!="object"))return c(t.remote)};export{m as LUNORA_CONFIG_FILE,c as interpretRemote,y as readProjectRemotePreference};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l=r=>{if(typeof r=="string")return r;try{return JSON.stringify(r)??String(r)}catch{return String(r)}},f=r=>typeof r!="object"||r===null||Array.isArray(r)?"":Object.entries(r).map(([t,e])=>`${t}=${l(e)}`).join(" "),p="lunora",d="__root__",n=r=>typeof r=="string"?r:"",a=r=>Array.isArray(r)?r.filter(t=>typeof t=="string"):[],g=r=>typeof r=="number"&&Number.isFinite(r)?`${String(Math.round(r))}ms`:"?ms",h=r=>r==="error"||r==="fatal"?"error":r==="warn"?"warn":"info",y=r=>{const t=r.trim();if(!t.startsWith("{")||!t.endsWith("}"))return;let e;try{e=JSON.parse(t)}catch{return}if(typeof e!="object"||e===null)return;const o=e;return o.source===p?o:void 0},c=(r,t)=>{const e=n(t.shard);return e===""||e===d?r:`${r}@${e}`},m=(r,t)=>{const e=r.outcome==="error",o=[c(t,r),e?"error":"ok",g(r.durationMs)],s=a(r.tablesRead),i=a(r.tablesWritten);s.length>0&&o.push(`read[${s.join(",")}]`),i.length>0&&o.push(`write[${i.join(",")}]`),r.cacheHit===!0&&o.push("cached");const u=n(r.error);return e&&u!==""&&o.push(u),{kind:"rpc",level:e?"error":"info",text:o.join(" ")}},$=r=>{const t=n(r.container)||"<unknown>",e=n(r.instance),o=n(r.event)||"event",s=e===""||e==="unknown"?"":`#${e.slice(0,8)}`,i=n(r.message),u=[`container:${t}${s}`,o];return i!==""&&u.push(i),{kind:"log",level:r.event==="error"?"error":"info",text:u.join(" ")}},j=r=>{const t=y(r);if(!t)return;const e=n(t.function)||"<unknown>";if(t.type==="log"){const o=[`${c(e,t)} ${n(t.message)}`.trimEnd()],s=f(t.fields);s!==""&&o.push(s);const i=n(t.traceId);return i!==""&&o.push(`trace=${i.slice(0,8)}`),{kind:"log",level:h(n(t.level)),text:o.join(" ")}}if(t.type==="request")return m(t,e);if(t.type==="container")return $(t)};export{p as LUNORA_EVENT_SOURCE,j as formatLunoraEvent};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{paintBadge as g,badgeWidth as p,BADGES as s}from"./ACCENT-CLeV5v0K.mjs";const u={informational:"info",warning:"warn"},l=new Set(["alert","critical","emergency","error","warn","warning"]),f=t=>{if(t in s)return s[t];const r=u[t];return r===void 0?void 0:s[r]},m=t=>{if(t instanceof Error)return`
|
|
2
|
+
${t.stack??t.message}`;if(typeof t=="object"&&t!==null)try{return` ${JSON.stringify(t)}`}catch{return" [unserializable]"}return` ${String(t)}`},d=t=>{const r=typeof t.message=="string"?t.message:String(t.message),n=t.context??[];return n.length===0?r:r+n.map(e=>m(e)).join("")};class i{#t=process.stdout;#r=process.stderr;setStdout(r){this.#t=r}setStderr(r){this.#r=r}log(r){const n=r,e=f(n.type.name);(l.has(n.type.level??n.type.name)?this.#r:this.#t).write(i.#n(e,d(n)))}static#n(r,n){if(r===void 0)return`${n}
|
|
3
|
+
`;const[e="",...a]=n.split(`
|
|
4
|
+
`),o=" ".repeat(p()+1);return`${[`${g(r)} ${e}`,...a.map(c=>`${o}${c}`)].join(`
|
|
5
|
+
`)}
|
|
6
|
+
`}}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=[{description:"Bearer token the local Lunora Studio uses to call the worker's admin endpoints (data browser, schema edits) in dev. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/studio",key:"LUNORA_ADMIN_TOKEN",placeholderValue:"replace-with-openssl-rand-hex-32"}],t={"@lunora/auth":[{description:"32-byte random secret used to sign sessions and tokens. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_SECRET",placeholderValue:"replace-with-openssl-rand-hex-32"},{description:"Public base URL of your worker (used by better-auth for redirects and cookie domain). For local dev this is typically http://localhost:8787",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_URL",placeholderValue:"http://localhost:8787"}],"@lunora/mail":[{description:"Resend API key for sending transactional email via @lunora/mail. Obtain at https://resend.com/api-keys",docsUrl:"https://lunora.sh/docs/packages/mail#secrets",key:"RESEND_API_KEY",placeholderValue:"<your-resend-api-key>"}],"@lunora/notify":[{description:"Public VAPID key (base64url) for Web Push. Generate a keypair once with: npx web-push generate-vapid-keys — the public key is also shipped to the browser to subscribe.",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PUBLIC_KEY",placeholderValue:"<your-vapid-public-key>"},{description:"Private VAPID key (base64url) for Web Push — the application-server signing key. Generate with: npx web-push generate-vapid-keys",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PRIVATE_KEY",placeholderValue:"<your-vapid-private-key>"},{description:"VAPID `sub` contact — a mailto: or https: URL identifying the application server (e.g. mailto:you@example.com).",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_SUBJECT",placeholderValue:"mailto:you@example.com"},{description:"Firebase project id for FCM (HTTP v1) push. Found in the Firebase console project settings.",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_PROJECT_ID",placeholderValue:"<your-firebase-project-id>"},{description:"OAuth2 access token for FCM (HTTP v1). Convenient for dev but expires — in production supply a getAccessToken() in defineNotify instead. Obtain via the Google Cloud SDK / a service account.",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_ACCESS_TOKEN",placeholderValue:"<your-fcm-access-token>"}],"@lunora/payment":[{description:"Stripe secret key (sk_test_…). Required when using the Stripe adapter. Obtain at https://dashboard.stripe.com/apikeys",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_SECRET_KEY",placeholderValue:"<your-stripe-secret-key>"},{description:"Stripe webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://dashboard.stripe.com/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_WEBHOOK_SECRET",placeholderValue:"<your-stripe-webhook-secret>"},{description:"Polar access token for the Polar payment adapter. Obtain at https://polar.sh/settings/tokens",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_ACCESS_TOKEN",placeholderValue:"<your-polar-access-token>"},{description:"Polar webhook secret for verifying event payloads from Polar. Obtain at https://polar.sh/settings/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_WEBHOOK_SECRET",placeholderValue:"<your-polar-webhook-secret>"},{description:"Autumn secret key (am_sk_…) for the Autumn payment adapter. Obtain at https://app.useautumn.com/dev",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_SECRET_KEY",placeholderValue:"<your-autumn-secret-key>"},{description:"Autumn webhook signing secret for verifying Standard Webhooks event payloads. Obtain from your Autumn dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_WEBHOOK_SECRET",placeholderValue:"<your-autumn-webhook-secret>"},{description:"Dodo Payments API key (bearer token) for the Dodo Payments adapter. Obtain at https://app.dodopayments.com/developer/api-keys",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_API_KEY",placeholderValue:"<your-dodo-payments-api-key>"},{description:"Dodo Payments webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://app.dodopayments.com/developer/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_WEBHOOK_KEY",placeholderValue:"<your-dodo-payments-webhook-secret>"},{description:"Creem API key for the Creem payment adapter. Obtain at https://www.creem.io/dashboard/developers",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_API_KEY",placeholderValue:"<your-creem-api-key>"},{description:"Creem webhook signing secret for verifying the creem-signature header. Obtain from your Creem dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_WEBHOOK_SECRET",placeholderValue:"<your-creem-webhook-secret>"}]},n=s=>{const e=[];for(const a of s){const o=t[a];o!==void 0&&e.push(...o)}return e};export{r as CORE_SECRETS,t as PACKAGE_SECRETS_REGISTRY,n as secretsForPackages};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as d,readFileSync as f}from"node:fs";import{join as i,isAbsolute as a,relative as y}from"node:path";import{runCodegen as m,CodegenDiagnosticError as p}from"@lunora/codegen";import{LunoraError as k}from"@lunora/errors";import{classifyPolicyEdit as b,scaffoldPolicyFile as g,wireRlsIntoProcedure as h}from"./classifyPolicyEdit-BzC_MfYK.mjs";import{m as l}from"./write-atomic-Cdr2oQb-.mjs";const C="/__lunora/policy-scaffold",c=r=>r==="unknown-procedure"?404:r==="already-wired"||r==="destructive"?409:422,u=(r,t)=>{let e=[];try{m({lunoraDirectory:r.schemaDirectory??"lunora",projectRoot:r.projectRoot})}catch(o){if(o instanceof p)e=[o.message];else return{body:{error:o instanceof Error?o.message:String(o),ok:!1},status:500}}return{body:{...t,diagnostics:e,ok:!0},status:200}},w=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}),N=(r,t)=>{const e=g(t);if(!e.ok)return{body:{error:e.reason,ok:!1},status:c(e.reason)};const o=r.schemaDirectory??"lunora",s=i(r.projectRoot,o,e.fileName);return d(s)?{body:{error:"file-exists",fileName:e.fileName,ok:!1},status:409}:(l(s,e.source),u(r,{fileName:e.fileName}))},P=(r,t,e)=>{if(typeof e!="string"||e.length===0||a(e)||e.includes("\\"))return;const o=i(r,t),s=i(o,`${e}.ts`),n=y(o,s);if(!(n.startsWith("..")||a(n)))return s},R=(r,t)=>{const e=P(r.projectRoot,r.schemaDirectory??"lunora",t.filePath);if(e===void 0||!d(e))return{body:{error:"unknown-procedure",ok:!1},status:404};const o=h(f(e,"utf8"),t);return o.ok?(l(e,o.text),u(r,{exportName:t.exportName})):{body:{error:o.reason,ok:!1},status:c(o.reason)}},F=r=>{if(r.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:t}=r;if(t==null||typeof t!="object"||typeof t.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const e=t;if(b(e)==="destructive")return w(e);if(e.kind==="scaffoldPolicy")return N(r,e);if(e.kind==="wireRls")return R(r,e);throw new k("INTERNAL",`unhandled additive policy edit kind: ${String(e.kind)}`)};export{C as POLICY_SCAFFOLD_ENDPOINT,F as handlePolicyScaffoldRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as d,rmSync as p}from"node:fs";import{e as f}from"./jsonc-edit-BZVpxVA0.mjs";import{findWranglerFile as g,readWranglerJsonc as b}from"./WRANGLER_FILES-Bi_18Pj6.mjs";import{join as m}from"node:path";const c={ai:{label:"AI",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"}},h=Object.keys(c),u=(e,r)=>typeof e.binding=="string"?e.binding:r,l=(e,r,n,t)=>{const a=[];for(const[o,i]of r.entries())i!=null&&a.push({binding:u(i,`#${String(o)}`),kind:n,path:[...t,o],section:e});return a},y=(e,r)=>{const{label:n,shape:t}=c[e];if(t==="array"){const o=r[e]??[];return l(e,o,n,[])}if(t==="producers")return l(e,r.queues?.producers??[],n,["producers"]);const a=r.ai;return a==null?[]:[{binding:u(a,e),kind:n,path:[],section:e}]},v=e=>h.flatMap(r=>y(r,e)),R=(e,r)=>{let n=e;for(const t of r)n=f(n,[t.section,...t.path,"remote"],!0);return n},s=()=>{},j=e=>{let r=!1;return()=>{if(!r){r=!0;try{p(e,{force:!0,recursive:!0})}catch{}}}},B=()=>`.wrangler.lunora-remote.${String(process.pid)}.jsonc`,w=e=>{if(!e.enabled)return{cleanup:s,enabled:!1,remoteBindings:[]};const r=g(e.projectRoot);if(!r)return{cleanup:s,enabled:!0,reason:"wrangler.jsonc not found",remoteBindings:[]};const{parsed:n,text:t}=b(r);if(n===void 0)return{cleanup:s,enabled:!0,reason:`failed to parse ${r} as JSONC`,remoteBindings:[]};const a=v(n);if(a.length===0)return{cleanup:s,enabled:!0,reason:"no remote-eligible bindings to proxy",remoteBindings:[]};const o=m(e.projectRoot,B());return d(o,R(t,a),"utf8"),{cleanup:j(o),configPath:o,enabled:!0,remoteBindings:a}},E=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},x=e=>e.flag===!0||E(e.envValue)?!0:e.configPreference??!1;export{c as REMOTE_ELIGIBLE_KEYS,R as injectRemoteFlags,E as isRemoteEnvEnabled,w as materializeRemoteWranglerConfig,v as planRemoteBindings,x as resolveRemoteEnabled};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as b}from"node:fs";import{dirname as _,join as h}from"node:path";import{discoverSchemaInfo as v}from"./discoverSchemaInfo-B2W3VrcT.mjs";import{isCacheEnabled as $,WORKERS_CACHE_MIN_DATE as m}from"./WORKERS_CACHE_MIN_DATE-B1h_wNDN.mjs";import{findWranglerFile as j,readWranglerJsonc as w}from"./WRANGLER_FILES-Bi_18Pj6.mjs";const g="2026-04-07",te="web_socket_auto_reply_to_close",p=/^\d{4}-\d{2}-\d{2}$/,A=(e,s,n)=>{if(s.length===0)return;const r=e.vectorize??[],t=new Set(r.filter(Boolean).map(a=>a?.index_name));for(const a of s)t.has(a)||n.push(`schema declares vector index "${a}"; wrangler "vectorize" must include a binding with index_name "${a}"`)},S=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),k={disk_mb:2e4,memory_mib:12288,vcpu:4},M=(e,s,n)=>{const r=e.instance_type;if(r===void 0)return;if(typeof r=="string"){S.has(r)||n.push(`${s} has unknown instance_type "${r}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[o,c]of Object.entries(k)){const d=r[o];d!==void 0&&(typeof d!="number"||d<=0||d>c)&&n.push(`${s} custom instance_type ${o} must be a positive number ≤ ${String(c)} (got ${String(d)})`)}const{disk_mb:t,memory_mib:a,vcpu:i}=r;if(typeof i=="number"&&typeof a=="number"&&a<i*3072&&n.push(`${s} custom instance_type needs ≥ 3 GiB (3072 MiB) memory per vCPU (got ${String(a)} MiB for ${String(i)} vCPU)`),typeof a=="number"&&typeof t=="number"){const o=Math.floor(a/1024*2e3);t>o&&n.push(`${s} custom instance_type allows ≤ 2 GB disk per GiB memory (≤ ${String(o)} MB for ${String(a)} MiB memory; got ${String(t)} MB)`)}},q=(e,s,n)=>{const{boundClasses:r,errors:t,nonSqliteClasses:a,sqliteClasses:i,warnings:o}=n;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){t.push(`${s} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}(typeof e.image!="string"||e.image.length===0)&&t.push(`${s} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),r.has(e.class_name)||t.push(`${s} class "${e.class_name}" has no matching durable_objects binding — run \`lunora dev\` to auto-reconcile wrangler.jsonc, or add { "name": "...", "class_name": "${e.class_name}" }`),i.has(e.class_name)||t.push(a.has(e.class_name)?`${s} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${s} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),M(e,`${s} ("${e.class_name}")`,t),e.max_instances===void 0&&o.push(`${s} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},l=e=>Array.isArray(e)?e.filter(s=>s!==null&&typeof s=="object"):[],E=(e,s,n)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){s.push("containers must be an array of { class_name, image, ... } entries");return}const r=e.containers;if(r.length===0)return;const t=new Set(l(e.durable_objects?.bindings).map(c=>c.class_name)),a=e.migrations??[],i=new Set(a.flatMap(c=>[...c?.new_sqlite_classes??[]])),o=new Set(a.flatMap(c=>[...c?.new_classes??[]]));for(const[c,d]of r.entries())q(d,`containers[${String(c)}]`,{boundClasses:t,errors:s,nonSqliteClasses:o,sqliteClasses:i,warnings:n});e.observability?.enabled!==!0&&n.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},R=(e,s)=>{if(e.workflows===void 0)return;if(!Array.isArray(e.workflows)){s.push("workflows must be an array of { name, binding, class_name } entries");return}const n=e.workflows;for(const[r,t]of n.entries()){const a=`workflows[${String(r)}]`;if(!t||typeof t!="object"){s.push(`${a} must be a { name, binding, class_name } object`);continue}(typeof t.binding!="string"||t.binding.length===0)&&s.push(`${a} must have a non-empty "binding" naming the Workflow binding (e.g. WORKFLOW_ORDER_PIPELINE)`),(typeof t.class_name!="string"||t.class_name.length===0)&&s.push(`${a} must have a non-empty "class_name" naming the exported WorkflowEntrypoint class`),(typeof t.name!="string"||t.name.length===0)&&s.push(`${a} must have a non-empty "name" naming the deployed workflow`)}},O=(e,s)=>{if(e===void 0)return;if(!Array.isArray(e)){s.push("queues.producers must be an array of { binding, queue } entries");return}const n=e;for(const[r,t]of n.entries()){const a=`queues.producers[${String(r)}]`;if(!t||typeof t!="object"){s.push(`${a} must be a { binding, queue } object`);continue}(typeof t.binding!="string"||t.binding.length===0)&&s.push(`${a} must have a non-empty "binding" naming the Queue producer (e.g. QUEUE_EMAIL)`),(typeof t.queue!="string"||t.queue.length===0)&&s.push(`${a} must have a non-empty "queue" naming the deployed queue`)}},D=(e,s)=>{if(e===void 0)return;if(!Array.isArray(e)){s.push("queues.consumers must be an array of { queue } entries");return}const n=e;for(const[r,t]of n.entries()){const a=`queues.consumers[${String(r)}]`;if(!t||typeof t!="object"){s.push(`${a} must be a { queue } object`);continue}(typeof t.queue!="string"||t.queue.length===0)&&s.push(`${a} must have a non-empty "queue" naming the consumed queue`)}},L=(e,s)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){s.push("queues must be a { producers, consumers } object");return}O(e.queues.producers,s),D(e.queues.consumers,s)}},W=(e,s)=>{if(e.secrets_store_secrets===void 0)return;if(!Array.isArray(e.secrets_store_secrets)){s.push("secrets_store_secrets must be an array of { binding, store_id, secret_name } entries");return}const n=e.secrets_store_secrets;for(const[r,t]of n.entries()){const a=`secrets_store_secrets[${String(r)}]`;if(!t||typeof t!="object"){s.push(`${a} must be a { binding, store_id, secret_name } object`);continue}for(const i of["binding","store_id","secret_name"])(typeof t[i]!="string"||t[i].length===0)&&s.push(`${a} must have a non-empty "${i}"`)}},u=e=>typeof e=="string"&&e.length>0,f=e=>e,C=[{arrayMessage:"kv_namespaces must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the KV namespace binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler kv namespace create\` and set the namespace id, or the binding can't resolve`,key:"kv_namespaces"},{arrayMessage:"flagship must be an array of { binding, app_id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Flagship binding`,hintField:"app_id",hintMessage:(e,s)=>`${e} ("${s}") has no "app_id" — create a Flagship app and set its id, or the binding can't resolve`,key:"flagship"},{arrayMessage:"hyperdrive must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Hyperdrive binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler hyperdrive create\` and set the id, or the binding can't connect`,key:"hyperdrive"},{arrayMessage:"pipelines must be an array of { binding, pipeline } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Pipelines binding`,hintField:"pipeline",hintMessage:(e,s)=>`${e} ("${s}") has no "pipeline" — run \`wrangler pipelines create <name>\` and set the pipeline name, or the binding can't resolve`,key:"pipelines"},{arrayMessage:"analytics_engine_datasets must be an array of { binding, dataset } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Analytics Engine binding`,hintField:"dataset",hintMessage:(e,s)=>`${e} ("${s}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],x=(e,s,n,r)=>{const t=e[s.key];if(t!==void 0){if(!Array.isArray(t)){n.push(s.arrayMessage);return}for(const[a,i]of f(t).entries()){const o=`${s.key}[${String(a)}]`;if(!i||typeof i!="object"||!u(i.binding)){n.push(s.bindingMessage(o));continue}u(i[s.hintField])||r.push(s.hintMessage(o,i.binding))}}},I=[{key:"browser",message:'browser must be an object with a non-empty "binding" (e.g. { "binding": "BROWSER" })'},{key:"images",message:'images must be an object with a non-empty "binding" (e.g. { "binding": "IMAGES" })'}],N=(e,s,n)=>{const r=e[s.key];r!==void 0&&(typeof r!="object"||Array.isArray(r)||!u(r.binding))&&n.push(s.message)},B=[{arrayMessage:"services must be an array of { binding, service, entrypoint? } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the service binding`},{field:"service",message:e=>`${e} must have a non-empty "service" naming the target Worker`}],key:"services",objectMessage:e=>`${e} must be a { binding, service, entrypoint? } object`},{arrayMessage:"dispatch_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the dispatch namespace`}],key:"dispatch_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"mtls_certificates must be an array of { binding, certificate_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"certificate_id",message:e=>`${e} must have a non-empty "certificate_id" (upload via \`wrangler mtls-certificate upload\`)`}],key:"mtls_certificates",objectMessage:e=>`${e} must be a { binding, certificate_id } object`}],F=(e,s,n)=>{const r=e[s.key];if(r!==void 0){if(!Array.isArray(r)){n.push(s.arrayMessage);return}for(const[t,a]of f(r).entries()){const i=`${s.key}[${String(t)}]`;if(!a||typeof a!="object"){n.push(s.objectMessage(i));continue}for(const o of s.fields)u(a[o.field])||n.push(o.message(i))}}},P=(e,s,n)=>{const r=e.send_email;if(r===void 0)return;if(!Array.isArray(r)){s.push("send_email must be an array of { name, destination_address? } entries");return}const t=r;for(const[a,i]of t.entries())(!i||typeof i!="object"||typeof i.name!="string"||i.name.length===0)&&n.push(`send_email[${String(a)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},T=(e,s)=>{e.logpush!==void 0&&typeof e.logpush!="boolean"&&s.push('logpush must be a boolean (set "logpush": true to enable Cloudflare Logpush)')},U=(e,s)=>{const{placement:n}=e;if(n!==void 0){if(typeof n!="object"||Array.isArray(n)){s.push('placement must be an object (e.g. { "mode": "smart" })');return}n.mode!==void 0&&n.mode!=="smart"&&s.push('placement.mode must be "smart" (the only supported Smart Placement mode)')}},G=(e,s)=>{const{observability:n}=e;if(n===void 0)return;if(typeof n!="object"||Array.isArray(n)){s.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}const r=(t,a)=>{t!==void 0&&(typeof t!="number"||Number.isNaN(t)||t<0||t>1)&&s.push(`${a} must be a number in [0, 1] (the fraction of requests sampled)`)};r(n.head_sampling_rate,"observability.head_sampling_rate"),n.logs!==void 0&&(typeof n.logs!="object"||Array.isArray(n.logs)?s.push("observability.logs must be an object"):r(n.logs.head_sampling_rate,"observability.logs.head_sampling_rate"))},H=(e,s)=>{const{cache:n}=e;if(n!==void 0){if(typeof n!="object"||n===null||Array.isArray(n)){s.push('cache must be an object (e.g. { "enabled": true })');return}n.enabled!==void 0&&typeof n.enabled!="boolean"&&s.push("cache.enabled must be a boolean (true or false)")}},Q=(e,s)=>{const{exports:n}=e;if(n!==void 0){if(typeof n!="object"||n===null||Array.isArray(n)){s.push("exports must be an object keyed by entrypoint name");return}for(const[r,t]of Object.entries(n)){if(typeof t!="object"||t===null){s.push(`exports["${r}"] must be an object`);continue}t.type!==void 0&&typeof t.type!="string"&&s.push(`exports["${r}"].type must be a string`),t.cache!==void 0&&(typeof t.cache!="object"||t.cache===null||Array.isArray(t.cache)?s.push(`exports["${r}"].cache must be an object`):t.cache.enabled!==void 0&&typeof t.cache.enabled!="boolean"&&s.push(`exports["${r}"].cache.enabled must be a boolean`))}}},Y=(e,s)=>{const{assets:n}=e;if(n!==void 0){if(typeof n!="object"||Array.isArray(n)){s.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof n.directory!="string"||n.directory.length===0)&&s.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),n.binding!==void 0&&(typeof n.binding!="string"||n.binding.length===0)&&s.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),n.html_handling!==void 0&&typeof n.html_handling!="string"&&s.push("assets.html_handling must be a string"),n.not_found_handling!==void 0&&typeof n.not_found_handling!="string"&&s.push("assets.not_found_handling must be a string")}},K=(e,s)=>{const n=e.tail_consumers;if(n===void 0)return;if(!Array.isArray(n)){s.push("tail_consumers must be an array of { service, environment? } entries");return}const r=n;for(const[t,a]of r.entries())(!a||typeof a!="object"||typeof a.service!="string"||a.service.length===0)&&s.push(`tail_consumers[${String(t)}] must have a non-empty "service" naming the consumer Worker`)},ae=(e,s)=>{const n=e.tail_consumers??[];return n.some(r=>!!r&&r?.service===s.service&&r?.environment===s.environment)?e:{...e,tail_consumers:[...n,s]}},z=new Set(["1","enabled","on","true","yes"]),J=(e,s)=>{const{vars:n}=e;if(!n||typeof n!="object")return;const r=n.LUNORA_ALLOWED_ORIGINS,t=n.LUNORA_CORS_ALLOW_CREDENTIALS,a=typeof r=="string"&&r.split(",").some(o=>o.trim()==="*"),i=typeof t=="string"&&z.has(t.trim().toLowerCase());a&&i&&s.push('vars.LUNORA_ALLOWED_ORIGINS includes a "*" wildcard while vars.LUNORA_CORS_ALLOW_CREDENTIALS is on — browsers reject this combination and it defeats the allowlist; name explicit origins or drop credentials')},y=(e,s)=>{const n=[],r=[];if(!e||typeof e!="object")return n.push("wrangler config is not a valid object"),{errors:n,valid:!1,warnings:r};l(e.durable_objects?.bindings).find(a=>a.name==="SHARD"&&a.class_name==="ShardDO")||n.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — run `lunora dev` to auto-reconcile wrangler.jsonc, or add the binding manually');const t=e.compatibility_date??"";t&&!p.test(t)?n.push(`compatibility_date must be in YYYY-MM-DD format (got "${t}")`):t<g&&n.push(`compatibility_date must be >= "${g}" (got "${t||"<missing>"}")`),$(e)&&p.test(t)&&t<m&&n.push(`cache.enabled requires compatibility_date >= "${m}" (got "${t||"<missing>"}")`),s?.hasGlobalTable&&(l(e.d1_databases).find(a=>a.binding==="DB")||n.push('schema declares .global() tables; d1_databases must include a binding named "DB" — run `lunora dev` to auto-reconcile wrangler.jsonc, or add the binding manually')),A(e,s?.vectorIndexNames??[],n),K(e,n),E(e,n,r),R(e,n),L(e,n),W(e,n);for(const a of C)x(e,a,n,r);for(const a of B)F(e,a,n);for(const a of I)N(e,a,n);return P(e,n,r),T(e,n),U(e,n),G(e,n),Y(e,n),H(e,n),Q(e,n),J(e,n),{errors:n,valid:n.length===0,warnings:r}},re=y,V=(e,s,n)=>{const r=[];for(const t of e){const a=t?.image;typeof a!="string"||!(a.startsWith("./")||a.startsWith("../")||a.startsWith("/")||a.includes("Dockerfile"))||b(a.startsWith("/")?a:h(s,a))||r.push(`containers image "${a}" does not exist (resolved relative to ${n}); create the Dockerfile or point image at a registry reference`)}return r},ie=e=>{const s=e.schemaDir??"lunora",n=j(e.projectRoot);if(!n){const d=`wrangler.jsonc not found in ${e.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[d],report:{errors:[d],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:r}=w(n);if(r===void 0){const d=`failed to parse ${n} as JSONC.`;return{problems:[d],report:{errors:[d],valid:!1,warnings:[]},wranglerPath:n}}const{error:t,info:a}=v(e.projectRoot,s),i=y(r,a);t!==void 0&&i.warnings.push(`schema parse failed in ${s}/schema.ts: ${t}`);const o=_(n);i.errors.push(...V(r.containers??[],o,n));const c=r.assets?.directory;if(typeof c=="string"&&c.length>0){const d=c.startsWith("/")?c:h(o,c);b(d)||i.warnings.push(`assets.directory "${c}" does not exist yet — it is created by the client build; run the build before deploy`)}return i.valid=i.errors.length===0,{problems:i.errors,report:i,wranglerPath:n}};export{g as REQUIRED_COMPATIBILITY_DATE,te as REQUIRED_FLAG,re as validateWrangler,y as validateWranglerConfig,ie as validateWranglerProject,ae as withTailConsumer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as n,readFileSync as d}from"node:fs";import{runCodegen as u,CodegenDiagnosticError as c}from"@lunora/codegen";import{classifyEdit as m,applyAdditiveEdit as f}from"./applyAdditiveEdit-BdcnSa-j.mjs";import{parseSchema as l}from"./parseSchema-BPmtMgmb.mjs";import{m as p}from"./write-atomic-Cdr2oQb-.mjs";import{join as b}from"node:path";const T="/__lunora/schema-edit",y=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,h=t=>({body:{error:t.reason,ok:!1},status:422}),g=t=>{if(!n(t))return{response:{body:{error:"no-schema-file",ok:!1},status:404}};const e=l(d(t,"utf8"));return e.ok?{tables:e.tables}:{response:h(e)}},k=t=>({body:{edit:t,message:"This edit changes stored data and must go through a migration. Review the migration before applying.",needsMigration:!0,ok:!1},status:409}),E=(t,e)=>{const o=t.body;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};if(m(o)==="destructive")return k(o);if(!n(e))return{body:{error:"no-schema-file",ok:!1},status:404};const r=f(d(e,"utf8"),o);if(!r.ok)return{body:{error:r.reason,ok:!1},status:y(r.reason)};p(e,r.text);let a=[];try{u({lunoraDirectory:t.schemaDirectory??"lunora",projectRoot:t.projectRoot})}catch(s){if(s instanceof c)a=[s.message];else return{body:{error:s instanceof Error?s.message:String(s),ok:!1},status:500}}const i=l(r.text);return{body:{diagnostics:a,ok:!0,tables:i.ok?i.tables:[]},status:200}},_=t=>{const e=b(t.projectRoot,t.schemaDirectory??"lunora","schema.ts");if(t.method==="GET"){const o=g(e);return"response"in o?o.response:{body:{ok:!0,tables:o.tables},status:200}}return t.method==="POST"?E(t,e):{body:{error:"method-not-allowed",ok:!1},status:405}};export{T as SCHEMA_EDIT_ENDPOINT,_ as handleSchemaEditRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as c}from"node:fs";import{discoverSchema as b,schemaFromIr as y}from"@lunora/codegen";import{seedPlan as h}from"@lunora/seed";import{Project as p}from"ts-morph";import{join as g}from"node:path";const O="/__lunora/seed",k=1e3,w=(e,t)=>typeof t=="bigint"?Number(t):t instanceof ArrayBuffer?[...new Uint8Array(t)]:t,S=e=>typeof e!="number"||!Number.isFinite(e)?10:Math.min(Math.max(1,Math.floor(e)),k),P=e=>{if(e.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:t}=e;if(t==null||typeof t!="object")return{body:{error:"invalid-request",ok:!1},status:400};const{count:a,existingIds:i,seed:u,table:o}=t;if(typeof o!="string"||o.length===0)return{body:{error:"missing-table",ok:!1},status:400};const f=e.schemaDirectory??"lunora",s=g(e.projectRoot,f,"schema.ts");if(!c(s))return{body:{error:"schema-not-found",ok:!1},status:404};const m=new p({skipAddingFilesFromTsConfig:!0}),n=b(m,s);if(!n.tables.some(r=>r.name===o))return{body:{error:"unknown-table",ok:!1,table:o},status:404};const d=y(n),l=h(d,{existingIds:i??{},defaultCount:S(a),only:[o],seed:u??0}).find(r=>r.table===o)?.rows??[];return{body:{ok:!0,rows:JSON.parse(JSON.stringify(l,w))},status:200}};export{O as SEED_ENDPOINT,P as handleSeedRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n="2026-05-01",a=e=>{if(!e)return!1;const c=typeof e.cache=="object"&&e.cache!==null&&e.cache.enabled===!0,o=typeof e.exports=="object"&&e.exports!==null&&Object.values(e.exports).some(t=>typeof t=="object"&&t!==null&&t.cache?.enabled===!0);return c||o};export{n as WORKERS_CACHE_MIN_DATE,a as isCacheEnabled};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as n,readFileSync as a}from"node:fs";import{parse as s}from"jsonc-parser";import{join as i}from"node:path";const l=["wrangler.jsonc","wrangler.json"],p=o=>{for(const r of l){const e=i(o,r);if(n(e))return e}},d=o=>{const r=a(o,"utf8"),e=[],t=s(r,e,{allowTrailingComma:!0});return e.length>0||t===null||typeof t!="object"?{parsed:void 0,text:r}:{parsed:t,text:r}};export{l as WRANGLER_FILES,p as findWranglerFile,d as readWranglerJsonc};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{Project as f,SyntaxKind as n}from"ts-morph";import{collectCalls as m}from"./parseSchema-BPmtMgmb.mjs";const x=/^[A-Za-z_$][\w$]*$/u,v=new Set(["any","array","bigint","boolean","bytes","date","id","literal","null","number","object","optional","record","storage","string","timestamp","union"]),g=e=>{if(e.getKind()===n.ParenthesizedExpression)return g(e.asKindOrThrow(n.ParenthesizedExpression).getExpression());if(e.getKind()!==n.CallExpression)return!1;const t=e.asKindOrThrow(n.CallExpression),r=t.getExpression();if(r.getKind()!==n.PropertyAccessExpression)return!1;const i=r.asKindOrThrow(n.PropertyAccessExpression);return i.getExpression().getKind()!==n.Identifier||i.getExpression().getText()!=="v"||!v.has(i.getName())?!1:t.getArguments().every(s=>u(s))},u=e=>{const t=e.getKind();return t===n.ParenthesizedExpression?u(e.asKindOrThrow(n.ParenthesizedExpression).getExpression()):t===n.StringLiteral||t===n.NumericLiteral||t===n.TrueKeyword||t===n.FalseKeyword||t===n.NullKeyword?!0:t===n.PrefixUnaryExpression?e.asKindOrThrow(n.PrefixUnaryExpression).getOperand().getKind()===n.NumericLiteral:t===n.ObjectLiteralExpression?e.asKindOrThrow(n.ObjectLiteralExpression).getProperties().every(r=>{if(r.getKind()!==n.PropertyAssignment)return!1;const i=r.getInitializer();return i!==void 0&&u(i)}):t===n.ArrayLiteralExpression?e.asKindOrThrow(n.ArrayLiteralExpression).getElements().every(r=>u(r)):g(e)},y=e=>{if(typeof e!="string"||e.trim().length===0)return!1;const t=new f({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}),r=t.createSourceFile("validator.ts",`const __v = (${e});`,{overwrite:!0});if(t.getProgram().getSyntacticDiagnostics(r).length>0||r.getStatements().length!==1)return!1;const i=r.getVariableDeclaration("__v")?.getInitializer();return i!==void 0&&g(i)},E=new Set(["addIndex","addOptionalColumn","addTable"]),b=e=>E.has(e.kind)?"additive":"destructive",d=e=>typeof e=="string"&&x.test(e),K=e=>{if(!d(e.table))return"invalid-identifier";if(e.kind==="addOptionalColumn"){if(!d(e.column))return"invalid-identifier";if(!y(e.validator))return"invalid-validator"}if(e.kind==="addIndex"&&(!d(e.name)||!Array.isArray(e.fields)||!e.fields.every(t=>d(t))))return"invalid-identifier"},w=e=>{const t=new f({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}).createSourceFile("schema.ts",e,{overwrite:!0});let r;for(const s of t.getDescendantsOfKind(n.CallExpression))if(s.getExpression().getText()==="defineSchema"){r=s;break}if(r===void 0)return{reason:t.getImportDeclarations().some(s=>s.getNamedImports().some(o=>o.getName()==="defineSchema"&&o.getAliasNode()!==void 0))?"aliased-define-schema":"no-define-schema"};const i=r.getArguments()[0];return i?.getKind()!==n.ObjectLiteralExpression?{reason:"non-object-argument"}:{object:i.asKindOrThrow(n.ObjectLiteralExpression),sourceFile:t}},c=(e,t)=>{for(const r of e.getProperties())if(r.getKind()===n.PropertyAssignment&&r.getNameNode().getText().replaceAll(/["']/gu,"")===t)return r},O=e=>{const t=e.getInitializer()?.getDescendantsOfKind(n.CallExpression).find(r=>r.getExpression().getText()==="defineTable")?.getArguments()[0];return t?.getKind()===n.ObjectLiteralExpression?t.asKindOrThrow(n.ObjectLiteralExpression):void 0},h=(e,t)=>{if(c(e,t.table)!==void 0)return"duplicate-table";e.addPropertyAssignment({initializer:`defineTable({
|
|
2
|
+
// Add your column validators here.
|
|
3
|
+
// Example:
|
|
4
|
+
// text: v.string(),
|
|
5
|
+
// createdAt: v.number(),
|
|
6
|
+
})`,name:t.table})},A=(e,t)=>{const r=c(e,t.table);if(r===void 0)return"unknown-table";const i=O(r);if(i===void 0)return"unknown-table";if(i.getProperties().some(s=>s.getKind()===n.PropertyAssignment&&s.getNameNode().getText().replaceAll(/["']/gu,"")===t.column))return"duplicate-column";i.addPropertyAssignment({initializer:`v.optional(${t.validator})`,name:t.column})},T=(e,t)=>{if(e===void 0)return"unknown-table";const r=e.getInitializer();if(r===void 0)return"unknown-table";if(m(r).some(o=>{const l=o.getExpression();if(l.getKind()!==n.PropertyAccessExpression)return!1;const a=l.asKindOrThrow(n.PropertyAccessExpression),[p]=o.getArguments();return a.getName()==="index"&&p?.getKind()===n.StringLiteral&&p.asKindOrThrow(n.StringLiteral).getLiteralText()===t.name}))return"duplicate-index";const i=t.fields.map(o=>JSON.stringify(o)).join(", "),s=t.unique===!0?", { unique: true }":"";e.setInitializer(`${r.getText()}.index(${JSON.stringify(t.name)}, [${i}]${s})`)},S=(e,t)=>{if(b(t)==="destructive")return{ok:!1,reason:"destructive"};const r=t,i=K(r);if(i!==void 0)return{ok:!1,reason:i};const s=w(e);if("reason"in s)return{ok:!1,reason:s.reason};const{object:o,sourceFile:l}=s;let a;return r.kind==="addTable"?a=h(o,r):r.kind==="addOptionalColumn"?a=A(o,r):a=T(c(o,r.table),r),a!==void 0?{ok:!1,reason:a}:{ok:!0,text:l.getFullText()}};export{S as applyAdditiveEdit,b as classifyEdit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as n,statSync as a}from"node:fs";import{createRequire as o}from"node:module";import{normalize as i,join as u,relative as l,isAbsolute as c,dirname as d}from"node:path";const y=(t,s=import.meta.url)=>{try{const r=o(s);return{script:n(r.resolve("@lunora/studio/standalone/studio.js")),styles:n(r.resolve("@lunora/studio/styles.css"))}}catch(r){const e=r instanceof Error?r.message:String(r);t?.warnOnce?.(`[lunora] studio assets unavailable (build @lunora/studio?): ${e}`);return}},j=(t=import.meta.url)=>{try{const s=o(t),r=a(s.resolve("@lunora/studio/standalone/studio.js")).mtimeMs,e=a(s.resolve("@lunora/studio/styles.css")).mtimeMs;return Math.max(r,e)}catch{return}},m=(t=import.meta.url)=>{try{return d(o(t).resolve("@lunora/studio/standalone/studio.js"))}catch{return}},p=(t,s)=>{if(s===""||s==="."||s===".."||s.includes("/")||s.includes("\\")||s.includes("\0"))return;const r=i(u(t,s)),e=l(t,r);if(!(e===""||e.startsWith("..")||c(e)||e.includes("/")||e.includes("\\")))return r},S=(t,s=import.meta.url)=>{const r=m(s);if(r===void 0)return;const e=p(r,t);if(e!==void 0)try{return n(e)}catch{return}},W=t=>t.endsWith(".js")||t.endsWith(".js.map"),x=t=>t.endsWith(".css")?"text/css; charset=utf-8":t.endsWith(".map")?"application/json; charset=utf-8":"text/javascript; charset=utf-8";export{x as assetContentType,W as isStandaloneModulePath,y as loadStudioAssets,S as readStandaloneAsset,p as resolveContainedFile,m as resolveStandaloneDirectory,j as studioAssetsStamp};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{randomBytes as R}from"node:crypto";import{existsSync as m,readFileSync as p,writeFileSync as $,renameSync as h,rmSync as f,statSync as L}from"node:fs";import{join as g}from"node:path";import{LunoraError as z}from"@lunora/errors";import{DEV_VARS_FILE as l,DEV_VARS_EXAMPLE_FILE as y,splitDevVariableLine as K,parseDevVariableEntries as S,DEV_VARS_NEWLINE as k,unquoteDevVariable as H}from"./DEV_VARS_EXAMPLE_FILE-DX6xGbpr.mjs";import{CORE_SECRETS as E,PACKAGE_SECRETS_REGISTRY as F,secretsForPackages as W}from"./PACKAGE_SECRETS_REGISTRY-BgmvEPA-.mjs";const A=e=>[...E,...W(e)],v=32,b=/(?:KEY|PASSWORD|SECRET|TOKEN)$/u,M=["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"],P=/[.*+?^${}()|[\]\\]/gu,T=/[a-z0-9]$/u,N=e=>{const t=e.trim().toLowerCase();return t===""||t.startsWith("<")&&t.endsWith(">")?!0:M.some(n=>{const r=n.replaceAll(P,String.raw`\$&`),s=T.test(n)?`(^|[^a-z0-9])${r}([^a-z0-9]|$)`:`(^|[^a-z0-9])${r}`;return new RegExp(s,"u").test(t)})},G=e=>N(H(e.trim())),x=e=>R(e).toString("hex"),I=new Set([...E,...Object.values(F).flat()].filter(e=>b.test(e.key)&&e.placeholderValue.startsWith("<")).map(e=>e.key)),O=e=>b.test(e)&&!I.has(e),w=(e,t,n)=>O(e)&&G(t)?n(v):void 0,ae=(e=x)=>e(v),q=e=>{if(e.devVarsExists)return{status:"exists"};if(e.exampleContent===void 0)return{status:"no-example"};const t=e.randomHex??x,n=[];return{content:e.exampleContent.split(k).map(r=>{const s=K(r),i=s?w(s.key,s.value,t):void 0;return!s||i===void 0?r:(n.push(s.key),`${s.key}="${i}"`)}).join(`
|
|
2
|
+
`),generatedKeys:n,status:"generate"}},V=e=>{const t=e.randomHex??x,n=new Set(S(e.existingContent).map(c=>c.key)),r=[],s=[],i=[];for(const c of e.exampleContent.split(k)){const o=K(c);if(!o||n.has(o.key))continue;const a=w(o.key,o.value,t);i.push(o.key),a===void 0?r.push(`${o.key}="${H(o.value)}"`):(s.push(o.key),r.push(`${o.key}="${a}"`))}return{additions:r,generatedKeys:s,missingKeys:i}},_=e=>e.length>0?` (generated ${e.join(", ")})`:"",B=(e,t)=>{const n=`${e}.tmp-${String(process.pid)}`;try{$(n,t,{encoding:"utf8",flag:"wx",mode:384}),h(n,e)}catch(r){throw f(n,{force:!0}),r}},D=5,j=e=>{try{const t=L(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}},U=(e,t)=>e===void 0||t===void 0?!1:e.mtimeMs===t.mtimeMs&&e.size===t.size,Y=(e,t)=>{for(let n=0;n<D;n+=1){const r=j(e),s=p(e,"utf8"),i=t(s);if(i.length===0)return[];const c=s.length>0&&!s.endsWith(`
|
|
3
|
+
`)?`
|
|
4
|
+
`:"",o=`${s}${c}${i.join(`
|
|
5
|
+
`)}
|
|
6
|
+
`,a=`${e}.tmp-${String(process.pid)}-${R(6).toString("hex")}`;try{$(a,o,{encoding:"utf8",mode:384});const d=j(e);if(!U(r,d)){f(a,{force:!0});continue}return h(a,e),i}catch(d){throw f(a,{force:!0}),d}}throw new z("INTERNAL",`Failed to append to ${e} after ${String(D)} attempts — a concurrent writer kept winning the race.`)},ie=async e=>{const t=g(e.cwd,l),n=g(e.cwd,y);if(!m(n))return{addedKeys:[],generatedKeys:[],status:"no-example"};const r=p(n,"utf8");if(!m(t)){const a=q({devVarsExists:!1,exampleContent:r,randomHex:e.randomHex});return a.status!=="generate"?{addedKeys:[],generatedKeys:[],status:"no-example"}:e.yes===!0||await e.confirm(`No ${l} found. Generate it from ${y} (secrets auto-filled)?`)?m(t)?{addedKeys:[],generatedKeys:[],status:"skipped-exists"}:(B(t,a.content),e.info(`Created ${l}${_(a.generatedKeys)}.`),{addedKeys:[],generatedKeys:a.generatedKeys,status:"generated"}):(e.info(`Skipped — copy ${y} to ${l} and fill it in when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"})}const s=V({existingContent:p(t,"utf8"),exampleContent:r,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(`${l} is missing ${String(s.missingKeys.length)} key(s) from ${y} (${i}). Add them?`)))return e.info(`Skipped — add ${i} to ${l} when you're ready.`),{addedKeys:[],generatedKeys:[],status:"declined"};const c=Y(t,a=>V({existingContent:a,exampleContent:r,randomHex:e.randomHex}).additions).map(a=>K(a)?.key).filter(a=>a!==void 0);if(c.length===0)return{addedKeys:[],generatedKeys:[],status:"exists"};const o=s.generatedKeys.filter(a=>c.includes(a));return e.info(`Updated ${l} — added ${c.join(", ")}${_(o)}.`),{addedKeys:c,generatedKeys:o,status:"augmented"}},X=e=>[`# ${e.description}`,`# Docs: ${e.docsUrl}`,`${e.key}="${e.placeholderValue}"`].join(`
|
|
7
|
+
`),J=(e,t)=>{const n=A(e).filter(r=>!t.has(r.key));return n.length===0?"":n.map(r=>X(r)).join(`
|
|
8
|
+
|
|
9
|
+
`)},oe=(e,t)=>{const n=g(e,y),r=m(n)?p(n,"utf8"):"",s=new Set(S(r).map(d=>d.key)),i=J(t,s);if(i==="")return[];const c=r.length>0&&!r.endsWith(`
|
|
10
|
+
`)?`
|
|
11
|
+
`:"",o=`${r}${c}
|
|
12
|
+
${i}
|
|
13
|
+
`,a=`${n}.tmp-${String(process.pid)}`;try{$(a,o,{encoding:"utf8"}),h(a,n)}catch(d){throw f(a,{force:!0}),d}return A(t).filter(d=>!s.has(d.key)).map(d=>d.key)},Q=e=>{const t=e.randomHex??x,n=[],r=e.existingContent.split(k).map(d=>{const u=K(d),C=u?w(u.key,u.value,t):void 0;return!u||C===void 0?d:(n.push(u.key),`${u.key}="${C}"`)}),s=new Set(S(e.existingContent).map(d=>d.key)),i=[],c=[];for(const d of E)s.has(d.key)||(i.push(d.key),c.push(`# ${d.description}`,`${d.key}="${t(v)}"`));const o=r.join(`
|
|
14
|
+
`);if(c.length===0)return{addedKeys:i,content:o,filledKeys:n};const a=o===""||o.endsWith(`
|
|
15
|
+
`)?"":`
|
|
16
|
+
`;return{addedKeys:i,content:`${o}${a}${c.join(`
|
|
17
|
+
`)}
|
|
18
|
+
`,filledKeys:n}},de=e=>{const t=g(e.cwd,l),n=m(t),r=n?p(t,"utf8"):"",s=Q({existingContent:r,randomHex:e.randomHex});if(s.filledKeys.length===0&&s.addedKeys.length===0)return{addedKeys:[],filledKeys:[],status:"unchanged"};const i=`${t}.tmp-${String(process.pid)}`;try{$(i,s.content,{encoding:"utf8",mode:384}),h(i,t)}catch(o){throw f(i,{force:!0}),o}const c=[...s.filledKeys,...s.addedKeys];return e.info?.(`Generated ${String(c.length)} dev secret(s) in ${l}: ${c.join(", ")}`),{addedKeys:s.addedKeys,filledKeys:s.filledKeys,status:n?"filled":"created"}};export{J as buildPackageSecretsBlock,ie as ensureDevVariables,oe as ensureDevVarsExample,de as fillDevSecrets,ae as generateSecretValue,O as isMintableSecretKey,N as isPlaceholderValue,Q as planDevSecretsFill,V as planDevVariablesAugment,q as planDevVariablesScaffold,A as requiredSecrets};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{Project as l,SyntaxKind as t}from"ts-morph";const c=new Set(["action","mutation","query","stream"]),a=/^[A-Za-z_$][\w$]*$/u,d=new Set(["scaffoldPolicy","wireRls"]),g=e=>d.has(e.kind)?"additive":"destructive",h=e=>{if(typeof e.name!="string"||typeof e.table!="string"||!a.test(e.name)||!a.test(e.table))return{ok:!1,reason:"invalid-identifier"};const r=`${e.name}Policies`,s=`${e.name}Roles`,o=JSON.stringify(e.table),n=`import { definePermission, definePolicies, definePolicy, defineRole } from "@lunora/server";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Access rules for the ${e.table} table — scaffolded by the Lunora studio
|
|
5
|
+
* (plan 025). The \`when\` predicates below DENY by default (\`() => false\`);
|
|
6
|
+
* replace each TODO with the real condition, then wire \`${r}\`
|
|
7
|
+
* into the procedures that read/write ${e.table} via
|
|
8
|
+
* \`.use(rls(${r}, { roles: ${s} }))\`.
|
|
9
|
+
*/
|
|
10
|
+
export const ${r} = definePolicies([
|
|
11
|
+
definePolicy({
|
|
12
|
+
on: "read",
|
|
13
|
+
table: ${o},
|
|
14
|
+
// TODO: return \`true\` to allow, a \`WhereInput\` to filter, or \`false\` to deny.
|
|
15
|
+
when: () => false,
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
/** Named permissions \`${r}\` can check with \`ctx.auth.can(...)\`. */
|
|
20
|
+
export const ${e.name}View = definePermission("${e.name}:view");
|
|
21
|
+
|
|
22
|
+
/** Roles that grant the permissions above; register via \`rls(policies, { roles })\`. */
|
|
23
|
+
export const ${s} = [defineRole("${e.name}-admin", { permissions: [${e.name}View] })];
|
|
24
|
+
`;return{fileName:`${e.name}.policies.ts`,ok:!0,source:n}},p=e=>{const r=e.getExpression();if(r.getKind()!==t.PropertyAccessExpression)return;const s=r.asKindOrThrow(t.PropertyAccessExpression);return c.has(s.getName())?s.getExpression():void 0},u=e=>{const r=e.getImportDeclaration(s=>s.getModuleSpecifierValue()==="@lunora/server");if(r===void 0){e.addImportDeclaration({moduleSpecifier:"@lunora/server",namedImports:["rls"]});return}r.getNamedImports().some(s=>s.getName()==="rls")||r.addNamedImport("rls")},f=e=>{const r=e.getDescendantsOfKind(t.CallExpression);e.getKind()===t.CallExpression&&r.push(e.asKindOrThrow(t.CallExpression));for(const s of r){const o=s.getExpression();if(o.getKind()!==t.PropertyAccessExpression)continue;const n=o.asKindOrThrow(t.PropertyAccessExpression),[i]=s.getArguments();if(n.getName()==="use"&&i?.getKind()===t.CallExpression&&i.asKindOrThrow(t.CallExpression).getExpression().getText()==="rls")return!0}return!1},x=(e,r)=>{if(typeof r.policies!="string"||!a.test(r.policies))return{ok:!1,reason:"invalid-identifier"};const s=new l({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}).createSourceFile("procedure.ts",e,{overwrite:!0}),o=s.getVariableDeclaration(r.exportName),n=o?.getInitializer();if(o===void 0||n?.getKind()!==t.CallExpression)return{ok:!1,reason:"unknown-procedure"};const i=p(n.asKindOrThrow(t.CallExpression));return i===void 0?{ok:!1,reason:"unsupported-procedure-shape"}:f(i)?{ok:!1,reason:"already-wired"}:(i.replaceWithText(`${i.getText()}.use(rls(${r.policies}))`),u(s),{ok:!0,text:s.getFullText()})};export{g as classifyPolicyEdit,h as scaffoldPolicyFile,x as wireRlsIntoProcedure};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{relative as i}from"node:path";import{secretKindOf as c,redact as l}from"@lunora/codegen";import{isPlaceholderValue as S}from"./buildPackageSecretsBlock-BpvaZzQ8.mjs";import{findWranglerFile as E,readWranglerJsonc as p}from"./WRANGLER_FILES-Bi_18Pj6.mjs";const d=8,f=new Set(["CREDENTIAL","CREDENTIALS","DSN","PASSPHRASE","PASSWD","PASSWORD","SECRET","TOKEN"]),m=["ACCESS_KEY","API_KEY","ENCRYPTION_KEY","PRIVATE_KEY","SIGNING_KEY"],A=new Set(["PUBLIC","PUBLISHABLE"]),_=/[_-]/u,a=e=>e.toUpperCase().split(_),u=e=>{const r=e.toUpperCase().replaceAll("-","_");return a(e).some(t=>f.has(t))?!0:m.some(t=>r===t||r.endsWith(`_${t}`))},I=e=>a(e).some(r=>A.has(r)),P=(e,r)=>{if(e===void 0)return[];const t=[];for(const[s,o]of Object.entries(e)){if(typeof o!="string"||S(o)||I(s))continue;const n=c(o)??(u(s)&&o.length>=d?"secret_named_var":void 0);n!==void 0&&t.push({file:r,key:s,kind:n,preview:l(o)})}return t},R=e=>{const r=E(e);if(r===void 0)return[];const{parsed:t}=p(r);return t===void 0?[]:P(t.vars,i(e,r))};export{R as collectWranglerSecretVariables,P as scanWranglerVariablesForSecrets};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{createInterface as m}from"node:readline";const w=/[\s,]+/u,$=()=>process.stdin.isTTY,y=async(i,t)=>{const o=m({input:process.stdin,output:process.stdout});try{const e=(await new Promise(u=>{o.question(i,l=>{u(l)})})).trim().toLowerCase();return e===""?t?.defaultYes===!0:e==="y"||e==="yes"}finally{o.close()}},b=(i="")=>$()?t=>y(`${i}${t} [Y/n] `,{defaultYes:!0}):()=>Promise.resolve(!1),S=async(i,t,o)=>{if(!$()||t.length===0)return o?.default;const e=o?.default===void 0?-1:t.findIndex(r=>r.value===o.default),u=t.map((r,n)=>` ${String(n+1)}) ${r.label}${r.description===void 0?"":` — ${r.description}`}`),l=`${i}
|
|
2
|
+
${u.join(`
|
|
3
|
+
`)}
|
|
4
|
+
> ${e>=0?`[${String(e+1)}] `:""}`,f=m({input:process.stdin,output:process.stdout});try{const r=(await new Promise(a=>{f.question(l,d=>{a(d)})})).trim();if(r==="")return o?.default;const n=Number.parseInt(r,10);return Number.isInteger(n)&&n>=1&&n<=t.length?t[n-1]?.value:t.find(a=>a.value===r||a.label.toLowerCase()===r.toLowerCase())?.value??o?.default}finally{f.close()}},I=async(i,t)=>{if(!$())return t?.default;const o=m({input:process.stdin,output:process.stdout});try{const e=(await new Promise(u=>{o.question(i,l=>{u(l)})})).trim();return e===""?t?.default:e}finally{o.close()}},h=async(i,t,o)=>{const e=o?.defaults??[];if(!$()||t.length===0)return[...e];const u=t.map((n,a)=>` ${String(a+1)}) ${n.label}${n.description===void 0?"":` — ${n.description}`}`),l=e.length===0?"":`[${e.join(", ")}] `,f=`${i} (comma-separated; Enter for default)
|
|
5
|
+
${u.join(`
|
|
6
|
+
`)}
|
|
7
|
+
> ${l}`,r=m({input:process.stdin,output:process.stdout});try{const n=(await new Promise(s=>{r.question(f,c=>{s(c)})})).trim();if(n==="")return[...e];const a=n.split(w).map(s=>s.trim()).filter(s=>s!==""),d=new Set;for(const s of a){const c=Number.parseInt(s,10);if(Number.isInteger(c)&&c>=1&&c<=t.length&&String(c)===s){const p=t[c-1]?.value;p!==void 0&&d.add(p);continue}const v=t.find(p=>p.value===s||p.label.toLowerCase()===s.toLowerCase());v!==void 0&&d.add(v.value)}return t.filter(s=>d.has(s.value)).map(s=>s.value)}finally{r.close()}};export{b as createConfirm,$ as isInteractive,h as promptMultiSelect,S as promptSelect,I as promptText,y as promptYesNo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as n,readFileSync as c}from"node:fs";import{join as o}from"node:path";const d=[{class:"A",dependency:"@tanstack/react-start",framework:"tanstack-start"},{class:"A",dependency:"@tanstack/solid-start",framework:"tanstack-start-solid"},{class:"A",dependency:"@react-router/dev",framework:"react-router"},{class:"A",dependency:"@solidjs/start",framework:"solid-start"},{class:"A",dependency:"solid-start",framework:"solid-start"},{class:"B",dependency:"@sveltejs/kit",framework:"sveltekit"},{class:"B",dependency:"nuxt",framework:"nuxt"},{class:"B",dependency:"astro",framework:"astro"}],a={class:"C",framework:"none"},k=s=>{const e=o(s,"package.json");if(!n(e))return new Set;try{const r=c(e,"utf8"),t=JSON.parse(r);return new Set([...Object.keys(t.dependencies??{}),...Object.keys(t.devDependencies??{})])}catch{return new Set}},f=s=>{const e=k(s);if(e.size===0)return a;for(const r of d)if(e.has(r.dependency))return{class:r.class,framework:r.framework};return a};export{f as detectFramework,k as readProjectDependencyNames};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as s}from"node:fs";import{AGENTS_FILENAME as i,discoverAgents as m}from"@lunora/codegen";import{Project as c}from"ts-morph";import{join as t}from"node:path";const u=(e,o)=>{const n=t(e,o,i);if(!s(n))return{agents:[]};try{const r=new c({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1});return{agents:m(r,t(e,o))}}catch(r){return{agents:[],error:r instanceof Error?r.message:String(r)}}};export{u as discoverAgentInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as i}from"node:fs";import{CONTAINERS_FILENAME as s,discoverContainers as c}from"@lunora/codegen";import{Project as m}from"ts-morph";import{join as n}from"node:path";const d=(e,o)=>{const t=n(e,o,s);if(!i(t))return{containers:[]};try{const r=new m({skipAddingFilesFromTsConfig:!0,skipFileDependencyResolution:!0,useInMemoryFileSystem:!1});return{containers:c(r,n(e,o))}}catch(r){return{containers:[],error:r instanceof Error?r.message:String(r)}}};export{d as discoverContainerInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as i}from"node:fs";import{discoverSchema as m}from"@lunora/codegen";import{Project as a}from"ts-morph";import{join as c}from"node:path";const h=(r,t)=>{const s=c(r,t,"schema.ts");if(!i(s))return{info:void 0};try{const e=new a({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1}),n=m(e,s,r);return{info:{hasGlobalTable:n.tables.some(o=>o.shardMode==="global"),vectorIndexNames:n.vectorIndexes.map(o=>o.name)}}}catch(e){return{error:e instanceof Error?e.message:String(e),info:void 0}}};export{h as discoverSchemaInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as i}from"node:fs";import{WORKFLOWS_FILENAME as n,discoverWorkflows as f}from"@lunora/codegen";import{Project as m}from"ts-morph";import{join as e}from"node:path";const p=(r,s)=>{const t=e(r,s,n);if(!i(t))return{workflows:[]};try{const o=new m({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1});return{workflows:f(o,e(r,s))}}catch(o){return{error:o instanceof Error?o.message:String(o),workflows:[]}}};export{p as discoverWorkflowInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as u,statSync as R,readFileSync as b,readdirSync as F}from"node:fs";import{init as C,parse as f}from"es-module-lexer";import{discoverAgentInfo as T}from"./discoverAgentInfo-BJm0QtoI.mjs";import{discoverContainerInfo as P}from"./discoverContainerInfo-CYG9j2LY.mjs";import{FLAGS_FILENAME as B,discoverFlags as L,QUEUES_FILENAME as K,discoverQueues as M}from"@lunora/codegen";import{Project as k}from"ts-morph";import{join as i}from"node:path";import{discoverSchemaInfo as H}from"./discoverSchemaInfo-B2W3VrcT.mjs";import{discoverWorkflowInfo as q}from"./discoverWorkflowInfo-Bbc0u2gE.mjs";import{WRANGLER_FILES as G,readWranglerJsonc as W}from"./WRANGLER_FILES-Bi_18Pj6.mjs";const U=(e,r)=>{const t=i(e,r,B);if(!u(t))return{};try{const s=new k({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1});return{flags:L(s,i(e,r))}}catch(s){return{error:s instanceof Error?s.message:String(s)}}},X=(e,r)=>{const t=i(e,r,K);if(!u(t))return{queues:[]};try{const s=new k({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!1});return{queues:M(s,i(e,r))}}catch(s){return{error:s instanceof Error?s.message:String(s),queues:[]}}},Q=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),Y=new Set([".git",".lunora-cache",".wrangler","_generated","dist","node_modules"]),z=["lunora","src"],J=["src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],$={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD"},O=Object.keys($),V={SchedulerDO:/\btype\s+SchedulerDO\b/,SessionDO:/\btype\s+SessionDO\b/,ShardDO:/\btype\s+ShardDO\b/},Z=/\benv\s*\.\s*DB\b/,ee=/\benv\s*\.\s*AI\b/,_=/\bctx\s*\.\s*pipelines\b/,A=/^\s*import\s+type\b/,re=new Set(["@lunora/agent","@lunora/agent/sandbox"]),se=e=>{const r=e.indexOf("{");if(r===-1)return"";const t=e.indexOf("}",r+1);return t===-1?e.slice(r+1):e.slice(r+1,t)},te=/\btype\s+browserTool\b/,ne=/\bbrowserTool\b/,oe=/import\s+\{[^}]*\bbrowserTool\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']/,ae=e=>{if(A.test(e))return!1;const r=se(e);return ne.test(r)&&!te.test(r)},ie=e=>{try{const[r]=f(e);return r.some(t=>t.n!==void 0&&re.has(t.n)&&ae(e.slice(t.ss,t.se)))}catch{return oe.test(e)}},g={usesAi:{pattern:/\bfrom\s+["']@lunora\/ai["']/,source:"@lunora/ai"},usesAnalytics:{pattern:/\bfrom\s+["']@lunora\/bindings\/analytics["']/,source:"@lunora/bindings/analytics"},usesAuth:{pattern:/\bfrom\s+["']@lunora\/auth["']/,source:"@lunora/auth"},usesBrowser:{pattern:/\bfrom\s+["']@lunora\/browser["']/,source:"@lunora/browser"},usesHyperdrive:{pattern:/\bfrom\s+["']@lunora\/hyperdrive["']/,source:"@lunora/hyperdrive"},usesImages:{pattern:/\bfrom\s+["']@lunora\/bindings\/images["']/,source:"@lunora/bindings/images"},usesKv:{pattern:/\bfrom\s+["']@lunora\/bindings\/kv["']/,source:"@lunora/bindings/kv"},usesMail:{pattern:/\bfrom\s+["']@lunora\/mail["']/,source:"@lunora/mail"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:_,source:"@lunora/bindings/pipelines"},usesScheduler:{pattern:/\bfrom\s+["']@lunora\/scheduler["']/,source:"@lunora/scheduler"},usesStorage:{pattern:/\bfrom\s+["']@lunora\/storage["']/,source:"@lunora/storage"},usesX402Charge:{pattern:/\bfrom\s+["']@lunora\/x402\/charge["']/,source:"@lunora/x402/charge"},usesX402Pay:{pattern:/\bfrom\s+["']@lunora\/x402\/pay["']/,source:"@lunora/x402/pay"}},l=Object.keys(g),ce="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",I=[...l,"needsD1"],de=()=>{const e={};for(const r of I)e[r]=!1;return e},p=Object.freeze(de()),y=(e,r)=>{const t={};for(const s of I)t[s]=e[s]||r[s];return t},ue=e=>{for(const r of l)if(g[r].source===e)return{...p,[r]:!0};return p},pe=e=>{const[r]=f(e);let t=p;for(const s of r){const n=s.n;!n||A.test(e.slice(s.ss,s.se))||(t=y(t,ue(n)))}return t},le=e=>{const r={...p};for(const t of l)r[t]=g[t].pattern.test(e);return r},me=e=>{let r;try{r=pe(e)}catch{r=le(e)}return y(r,{...p,needsD1:Z.test(e),usesAi:ee.test(e),usesPipelines:_.test(e)})},S=(e,r)=>{let t;try{t=F(e,{withFileTypes:!0})}catch{return}for(const s of t){if(s.isDirectory()){Y.has(s.name)||S(i(e,s.name),r);continue}const n=s.name.lastIndexOf(".");n!==-1&&Q.has(s.name.slice(n))&&r.push(i(e,s.name))}},be=e=>{for(const r of G){const t=i(e,r);if(!u(t))continue;const{parsed:s}=W(t),n=s?.main;if(typeof n=="string"&&u(i(e,n)))return i(e,n);break}for(const r of J){const t=i(e,r);if(u(t))return t}},fe=e=>{const r=b(e,"utf8");let t;try{const[,s]=f(r);t=new Set(s.map(n=>n.n))}catch{t=new Set(O.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`).test(r)))}return O.filter(s=>t.has(s)&&!V[s].test(r)).map(s=>({binding:$[s],className:s}))},ge=(e,r)=>new RegExp(String.raw`\bexport\s+type\s+${r}\b`).test(e)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${r}\b`).test(e)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${r}\b`).test(e),w=(e,r,t)=>{if(r.length===0)return[];if(e===void 0)return r.map(o=>({...o,exported:!1}));const s=b(e,"utf8"),n=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${t}(?:\.js)?["']`).test(s);let a;try{const[,o]=f(s);a=new Set(o.map(c=>c.n))}catch{a=new Set(r.map(o=>o.className).filter(o=>new RegExp(String.raw`\bexport\b[^\n;]*\b${o}\b`).test(s)))}return r.map(o=>{const c=n||a.has(o.className)&&!ge(s,o.className);return{...o,exported:c}})},he=(e,r)=>w(e,r,"containers"),ye=(e,r)=>w(e,r,"workflows"),Se=(e,r)=>w(e,r,"agents"),we=(e,r)=>H(e,r).info?.hasGlobalTable??!1,xe=(e,r)=>{let t=p;for(const s of r){const n=i(e,s);if(!u(n)||!R(n).isDirectory())continue;const a=[];S(n,a);for(const o of a)t=y(t,me(b(o,"utf8")))}return t},ve=(e,r)=>{const t=i(e,r);if(!u(t)||!R(t).isDirectory())return!1;const s=[];return S(t,s),s.some(n=>ie(b(n,"utf8")))},Ee=(e,r,t)=>[...e.map(s=>s.exported?`${s.bindingName}/${s.className} (container "${s.exportName}" declared and exported)`:`hint: container "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...r.map(s=>s.exported?`${s.bindingName}/${s.className} (workflow "${s.exportName}" declared and exported)`:`hint: workflow "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...t.map(s=>s.exported?`${s.bindingName}/${s.className} (agent "${s.exportName}" declared and exported)`:`hint: agent "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Ne=(e,r)=>[[e.usesAi,"AI (@lunora/ai imported or env.AI used)"],[e.usesAuth&&!r.has("SessionDO"),"hint: @lunora/auth is imported but no SessionDO is exported (sessions are D1-backed, or export SessionDO for DO-backed sessions)"],[e.usesScheduler&&!r.has("SchedulerDO"),"hint: @lunora/scheduler is imported but no SchedulerDO is exported by the worker entry"],[e.usesStorage,"hint: @lunora/storage is imported; add an r2_buckets binding (bucket binding names are user-defined)"],[e.usesMail,"hint: @lunora/mail is imported; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)"],[e.usesPayment,`hint: @lunora/payment is imported; set the provider secrets in .dev.vars — ${ce}`],[e.usesBrowser,"browser (@lunora/browser imported) — self-describing { binding: BROWSER }"],[e.usesImages,"images (@lunora/bindings/images imported) — self-describing { binding: IMAGES }"],[e.usesAnalytics,"analytics_engine_datasets (@lunora/bindings/analytics imported) — self-describing { binding: ANALYTICS, dataset }"],[e.usesKv,"hint: @lunora/bindings/kv is imported; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned"],[e.usesHyperdrive,"hint: @lunora/hyperdrive is imported; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned"],[e.usesPipelines,"hint: ctx.pipelines is used; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, pipeline }) — the pipeline resource can't be auto-provisioned"],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402Pay,"hint: @lunora/x402/pay is imported (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned"]].filter(([t])=>t).map(([,t])=>t),De=(e,r,t,s=[],n=[],a=[])=>{const o=new Set(e.map(d=>d.className)),c=e.map(d=>`${d.binding}/${d.className} (exported by worker entry)`);return r&&c.push("DB (.global() table declared)"),c.push(...Ee(s,n,a),...Ne(t,o)),c},Te=async e=>{await C;const r=e.schemaDir??"lunora",t=e.scanDirs??z,s=xe(e.projectRoot,t),n={...s,usesBrowser:s.usesBrowser||ve(e.projectRoot,r)},a=be(e.projectRoot),o=a?fe(a):[],c=n.needsD1||we(e.projectRoot,r),d=he(a,P(e.projectRoot,r).containers),x=ye(a,q(e.projectRoot,r).workflows),v=Se(a,T(e.projectRoot,r).agents),j=[...X(e.projectRoot,r).queues],{flags:m}=U(e.projectRoot,r),h=m?.provider==="flagship"&&m.mode==="binding"?m.bindingName:void 0,E={};for(const D of l)E[D]=n[D];const N=De(o,c,n,d,x,v);return h!==void 0&&N.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${h}", app_id }) — the app_id can't be auto-provisioned`),{agents:v,containers:d,durableObjects:o,flagshipBinding:h,needsD1:c,queues:j,signals:N,usesFlags:m!==void 0,workflows:x,...E}},Pe=e=>{const r=[];for(const t of l)e[t]&&r.push(g[t].source);return r};export{Te as inferLunoraBindings,Pe as packageNamesFromBindings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{modify as i,applyEdits as p}from"jsonc-parser";const s={formattingOptions:{insertSpaces:!0,tabSize:4}},a=(t,e,o)=>{const r=i(t,[...e],o,s);return r.length>0?p(t,r):t};export{a as e,s as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as n}from"node:fs";import{join as i}from"node:path";import{parseDevVariableEntries as a}from"./DEV_VARS_EXAMPLE_FILE-DX6xGbpr.mjs";const s=(e,r)=>{const o=a(e).find(t=>t.key===r);return o===void 0||o.value===""?void 0:o.value},d=e=>{const r=process.env.LUNORA_ADMIN_TOKEN;if(typeof r=="string"&&r!=="")return r;try{return s(n(i(e,".dev.vars"),"utf8"),"LUNORA_ADMIN_TOKEN")}catch{return}};export{s as parseDevVariable,d as resolveAdminToken};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Project as p,SyntaxKind as r}from"ts-morph";const u=/^v\s*\.\s*optional\s*\(/u,m=/\.shardBy\(\s*["']([^"']+)["']\s*\)/u,f=/\.global\(\s*\)/u,c=/["']/gu,x=t=>{const e=t.getDescendantsOfKind(r.CallExpression);return t.getKind()===r.CallExpression&&e.push(t.asKindOrThrow(r.CallExpression)),e},K=t=>u.test(t.trim()),h=t=>t?.getKind()!==r.ArrayLiteralExpression?[]:t.asKindOrThrow(r.ArrayLiteralExpression).getElements().filter(e=>e.getKind()===r.StringLiteral).map(e=>e.asKindOrThrow(r.StringLiteral).getLiteralText()),E=t=>{if(t?.getKind()!==r.ObjectLiteralExpression)return!1;const e=t.asKindOrThrow(r.ObjectLiteralExpression).getProperty("unique");return e?.getKind()===r.PropertyAssignment&&e.getInitializer()?.getText()==="true"},O=t=>{const e=t.getExpression();if(e.getKind()!==r.PropertyAccessExpression||e.asKindOrThrow(r.PropertyAccessExpression).getName()!=="index")return;const[n,s,i]=t.getArguments();if(n?.getKind()===r.StringLiteral)return{fields:h(s),name:n.asKindOrThrow(r.StringLiteral).getLiteralText(),unique:E(i)}},T=t=>{const e=t.getInitializer();if(e===void 0)return[];const n=[];for(const s of x(e)){const i=O(s);i!==void 0&&n.push(i)}return n},y=t=>{const e=[],n=t.getInitializer()?.getDescendantsOfKind(r.CallExpression).find(s=>s.getExpression().getText()==="defineTable")?.getArguments()[0];if(n?.getKind()!==r.ObjectLiteralExpression)return e;for(const s of n.getProperties()){if(s.getKind()!==r.PropertyAssignment)continue;const i=s,a=i.getName().replaceAll(c,""),o=i.getInitializer()?.getText()??"";e.push({name:a,optional:K(o),validator:o})}return e},L=t=>{const e=new p({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}).createSourceFile("schema.ts",t,{overwrite:!0}),n=e.getDescendantsOfKind(r.CallExpression).find(a=>a.getExpression().getText()==="defineSchema");if(n===void 0)return{ok:!1,reason:e.getImportDeclarations().some(a=>a.getNamedImports().some(o=>o.getName()==="defineSchema"&&o.getAliasNode()!==void 0))?"aliased-define-schema":"no-define-schema"};const s=n.getArguments()[0];if(s?.getKind()!==r.ObjectLiteralExpression)return{ok:!1,reason:"non-object-argument"};const i=[];for(const a of s.getProperties()){if(a.getKind()!==r.PropertyAssignment)continue;const o=a,d=o.getName().replaceAll(c,""),l=o.getInitializer()?.getText()??"",g=m.exec(l);i.push({columns:y(o),global:f.test(l),indexes:T(o),name:d,...g?.[1]===void 0?{}:{shardBy:g[1]}})}return{ok:!0,tables:i}};export{x as collectCalls,L as parseSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as y}from"node:fs";import{containerBuildTag as N}from"@lunora/container";import{e as b}from"./jsonc-edit-BZVpxVA0.mjs";import{findWranglerFile as S,readWranglerJsonc as k}from"./WRANGLER_FILES-Bi_18Pj6.mjs";const w="<replace-with-d1-create-id>",B=e=>{const a=[];for(const n of e.containers)n.exported||a.push({className:n.className,exportName:n.exportName,kind:"container",module:"containers"});for(const n of e.workflows)n.exported||a.push({className:n.className,exportName:n.exportName,kind:"workflow",module:"workflows"});for(const n of e.agents)n.exported||a.push({className:n.className,exportName:n.exportName,kind:"agent",module:"agents"});return a},D=(e,a)=>{const n=e.flagshipBinding!==void 0&&!(a?.flagship??[]).some(s=>s.binding===e.flagshipBinding);return[[e.usesKv&&(a?.kv_namespaces?.length??0)===0,"@lunora/bindings/kv is used but no kv_namespaces binding exists; add a kv_namespaces entry ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned."],[e.usesHyperdrive&&(a?.hyperdrive?.length??0)===0,"@lunora/hyperdrive is used but no hyperdrive binding exists; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned."],[e.usesPipelines&&(a?.pipelines?.length??0)===0,"ctx.pipelines is used but no pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, pipeline }) — the pipeline resource can't be auto-provisioned."],[n,`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(([s])=>s).map(([,s])=>s)},A=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.usesX402Pay,"@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(([a])=>a).map(([,a])=>a),f=(e,a,n)=>n.filter(s=>!s.exported).map(s=>`${e} "${s.exportName}" is declared but ${s.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${a}"\` so its binding can be provisioned.`),x=(e,a)=>{const n=new Set(e.durableObjects.map(o=>o.className)),s=[],r=(a?.r2_buckets?.length??0)>0,d=(a?.d1_databases?.some(o=>o.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!r&&s.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&&!n.has("SessionDO")&&!d&&s.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&&!n.has("SchedulerDO")&&s.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),s.push(...f("container","containers",e.containers),...f("workflow","workflows",e.workflows),...f("agent","agents",e.agents)),e.containers.length>0&&a?.observability?.enabled===!1&&s.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayment&&s.push("@lunora/payment is used; set the provider secrets in .dev.vars — STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)."),s.push(...A(e),...D(e,a)),s},E=e=>{const a=new Set(e.map(s=>s.tag));let n=1;for(;a.has(`v${String(n)}`);)n+=1;return`v${String(n)}`},I=(e,a,n)=>{const s=a.durable_objects?.bindings??[],r=new Set(s.map(u=>u.name)),d=n.filter(u=>!r.has(u.binding));let o=e;const c=[];if(d.length>0){const u=[...s,...d.map(m=>({class_name:m.className,name:m.binding}))];o=b(o,["durable_objects","bindings"],u),c.push(...d.map(m=>`${m.binding}/${m.className}`))}const g=a.migrations??[],l=new Set(g.flatMap(u=>[...u.new_sqlite_classes??[],...u.new_classes??[]])),h=n.map(u=>u.className).filter(u=>!l.has(u));if(h.length>0){const u=[...g,{new_sqlite_classes:h,tag:E(g)}];o=b(o,["migrations"],u)}return{added:c,text:o}},O=(e,a)=>{const n=a.d1_databases??[];if(n.some(d=>d.binding==="DB"))return{added:[],text:e};const s=typeof a.name=="string"&&a.name.length>0?a.name:"lunora",r=[...n,{binding:"DB",database_id:w,database_name:s}];return{added:["DB (D1)"],text:b(e,["d1_databases"],r)}},v=(e,a,n,s,r)=>{const d=a[n]?.binding;return typeof d=="string"&&d.length>0?{added:[],text:e}:{added:[r],text:b(e,[n],{binding:s})}},C=(e,a)=>(a.analytics_engine_datasets?.length??0)>0?{added:[],text:e}:{added:["ANALYTICS (Analytics Engine)"],text:b(e,["analytics_engine_datasets"],[{binding:"ANALYTICS",dataset:"ANALYTICS"}])},P=e=>{if(typeof e=="string")return e;const a={};return e.diskMb!==void 0&&(a.disk_mb=e.diskMb),e.memoryMib!==void 0&&(a.memory_mib=e.memoryMib),e.vcpu!==void 0&&(a.vcpu=e.vcpu),a},R=e=>e.image.kind==="dockerfile"?e.image.dockerfilePath:e.image.kind==="registry"?e.image.reference:N(e.exportName),T=e=>{const a={class_name:e.className,image:R(e)};return e.image.kind==="dockerfile"&&(a.image_build_context=e.image.buildContext),e.buildArgs!==void 0&&e.image.kind!=="registry"&&(a.image_vars=e.buildArgs),e.instanceType!==void 0&&(a.instance_type=P(e.instanceType)),e.maxInstances!==void 0&&(a.max_instances=e.maxInstances),e.name!==void 0&&(a.name=e.name),e.rollout?.stepPercentage!==void 0&&(a.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(a.rollout_active_grace_period=e.rollout.gracePeriodSeconds),a},$=(e,a,n)=>{const s=a.containers??[],r=new Set(s.map(c=>c.class_name)),d=n.filter(c=>!r.has(c.className));if(d.length===0)return{added:[],text:e};const o=b(e,["containers"],[...s,...d.map(c=>T(c))]);return{added:d.map(c=>`containers/${c.className}`),text:o}},q=(e,a)=>{if(a.observability!==void 0)return{added:[],text:e};const n=b(e,["observability"],{enabled:!0,head_sampling_rate:1});return{added:["observability"],text:n}},G=e=>({binding:e.bindingName,class_name:e.className,name:e.name}),L=e=>({binding:e.bindingName,class_name:e.className,name:e.name}),W=(e,a,n,s=[])=>{const r=a.workflows??[],d=new Set(r.map(l=>l.class_name)),o=n.filter(l=>!d.has(l.className)),c=s.filter(l=>!d.has(l.className));if(o.length===0&&c.length===0)return{added:[],text:e};const g=b(e,["workflows"],[...r,...o.map(l=>G(l)),...c.map(l=>L(l))]);return{added:[...o.map(l=>`workflows/${l.className}`),...c.map(l=>`workflows/${l.className}`)],text:g}},M=(e,a,n)=>{const s=a.queues??{},r=s.producers??[],d=s.consumers??[],o=new Set(r.map(i=>i.binding)),c=new Set(d.map(i=>i.queue)),g=n.filter(i=>!o.has(i.bindingName)),l=n.filter(i=>!c.has(i.name));if(g.length===0&&l.length===0)return{added:[],text:e};const h=[...r,...g.map(i=>({binding:i.bindingName,queue:i.name}))],u=[...d,...l.map(i=>{const p={queue:i.name};return i.mode==="pull"&&(p.type="http_pull"),i.tuning.maxBatchSize!==void 0&&(p.max_batch_size=i.tuning.maxBatchSize),i.tuning.maxBatchTimeout!==void 0&&(p.max_batch_timeout=i.tuning.maxBatchTimeout),i.tuning.maxRetries!==void 0&&(p.max_retries=i.tuning.maxRetries),i.tuning.deadLetterQueue!==void 0&&(p.dead_letter_queue=i.tuning.deadLetterQueue),i.tuning.retryDelay!==void 0&&(p.retry_delay=i.tuning.retryDelay),p})],m=b(e,["queues"],{consumers:u,producers:h});return{added:[...g.map(i=>`queues.producers/${i.bindingName}`),...l.map(i=>`queues.consumers/${i.name}`)],text:m}},z=(e,a)=>{const n=S(e),s=B(a);if(!n)return{added:[],changed:!1,exportGaps:s,reason:"wrangler.jsonc not found",warnings:x(a)};const{parsed:r,text:d}=k(n);if(r===void 0)return{added:[],changed:!1,exportGaps:s,reason:`failed to parse ${n} as JSONC`,warnings:x(a),wranglerPath:n};const o=x(a,r),c=a.containers.filter(t=>t.exported),g=a.agents.filter(t=>t.exported&&t.voice===!0&&t.voiceBindingName!==void 0&&t.voiceClassName!==void 0),l=[...a.durableObjects,...c.map(t=>({binding:t.bindingName,className:t.className})),...g.map(t=>({binding:t.voiceBindingName,className:t.voiceClassName}))],h=a.workflows.filter(t=>t.exported),u=a.agents.filter(t=>t.exported),m=[{enabled:!0,run:t=>I(t,r,l)},{enabled:a.needsD1,run:t=>O(t,r)},{enabled:a.usesAi,run:t=>v(t,r,"ai","AI","AI (Workers AI)")},{enabled:a.usesBrowser,run:t=>v(t,r,"browser","BROWSER","BROWSER (Browser Rendering)")},{enabled:a.usesImages,run:t=>v(t,r,"images","IMAGES","IMAGES (Cloudflare Images)")},{enabled:a.usesAnalytics,run:t=>C(t,r)},{enabled:!0,run:t=>q(t,r)},{enabled:c.length>0,run:t=>$(t,r,c)},{enabled:h.length>0||u.length>0,run:t=>W(t,r,h,u)},{enabled:a.queues.length>0,run:t=>M(t,r,a.queues)}];let i=d;const p=[];for(const t of m){if(!t.enabled)continue;const _=t.run(i);i=_.text,p.push(..._.added)}return p.includes("DB (D1)")&&o.push(`wrote a DB binding with a placeholder database_id ("${w}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),i===d?{added:[],changed:!1,exportGaps:s,reason:"bindings already in sync",warnings:o,wranglerPath:n}:(y(n,i,"utf8"),{added:p,changed:!0,exportGaps:s,warnings:o,wranglerPath:n})};export{z as reconcileWranglerBindings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as d}from"node:fs";import{modify as l,applyEdits as c}from"jsonc-parser";import{r as s}from"./jsonc-edit-BZVpxVA0.mjs";import{isCacheEnabled as f,WORKERS_CACHE_MIN_DATE as r}from"./WORKERS_CACHE_MIN_DATE-B1h_wNDN.mjs";import{findWranglerFile as g,readWranglerJsonc as m}from"./WRANGLER_FILES-Bi_18Pj6.mjs";const b=i=>{const e=g(i);if(!e)return{changed:!1,date:void 0,reason:"wrangler.jsonc not found"};const{parsed:t,text:n}=m(e);if(t===void 0)return{changed:!1,date:void 0,reason:`failed to parse ${e} as JSONC`,wranglerPath:e};const a=t.compatibility_date??"";if(!f(t))return{changed:!1,date:a||void 0,reason:"cache not enabled",wranglerPath:e};if(a>=r)return{changed:!1,date:a,reason:`compatibility_date already >= ${r}`,wranglerPath:e};const o=l(n,["compatibility_date"],r,s);return o.length===0?{changed:!1,date:a||void 0,reason:"no structural edit produced",wranglerPath:e}:(d(e,c(n,o),"utf8"),{changed:!0,date:r,wranglerPath:e})};export{b as reconcileWranglerCompatibilityDate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as g}from"node:fs";import{modify as c,applyEdits as l}from"jsonc-parser";import{findWranglerFile as d,readWranglerJsonc as f}from"./WRANGLER_FILES-Bi_18Pj6.mjs";const h=(t,e)=>t.length===e.length&&t.every((r,n)=>r===e[n]),m=(t,e)=>{const r=d(t);if(!r)return{changed:!1,reason:"wrangler.jsonc not found"};const{parsed:n,text:a}=f(r);if(n===void 0)return{changed:!1,reason:`failed to parse ${r} as JSONC`,wranglerPath:r};const o=Array.isArray(n.triggers?.crons)?n.triggers.crons.filter(i=>typeof i=="string"):[];if(h(o,e))return{changed:!1,reason:"triggers.crons already in sync",wranglerPath:r};const s=c(a,["triggers","crons"],[...e],{formattingOptions:{insertSpaces:!0,tabSize:4}});return s.length===0?{changed:!1,reason:"no structural edit produced",wranglerPath:r}:(g(r,l(a,s),"utf8"),{changed:!0,wranglerPath:r})};export{m as reconcileWranglerCrons};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const i=e=>JSON.stringify(e).replaceAll("<",String.raw`\u003c`),_=e=>e.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<"),l=e=>{const t=[`window.__LUNORA_BASE_PATH__=${i(e.basePath)};`];return e.adminToken!==void 0&&e.adminToken!==""&&t.push(`window.__LUNORA_ADMIN_TOKEN__=${i(e.adminToken)};`),e.dataEditable===!0&&t.push("window.__LUNORA_DATA_EDITABLE__=true;"),e.runAsIdentity===!0&&t.push("window.__LUNORA_RUN_AS_IDENTITY__=true;"),e.schemaEditable===!0&&t.push("window.__LUNORA_SCHEMA_EDITABLE__=true;"),e.rulesInstalled===!1&&t.push("window.__LUNORA_RULES_INSTALLED__=false;"),`<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Lunora Studio</title>
|
|
7
|
+
<script>${t.join("")}<\/script>
|
|
8
|
+
<link rel="stylesheet" href="${_(e.styleHref)}" />
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
<script type="module" src="${_(e.scriptSrc)}"><\/script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
15
|
+
`};export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const u=async e=>await new Promise((t,r)=>{const o=[];let a=0;e.on("data",s=>{if(a+=s.length,a>1e6){r(new Error("request body too large"));return}o.push(s)}),e.on("end",()=>{t(Buffer.concat(o).toString("utf8"))}),e.on("error",r)}),i=(e,t,r)=>{e.statusCode=t,e.setHeader("Content-Type","application/json; charset=utf-8"),e.end(JSON.stringify(r))},n=e=>{const t=Array.isArray(e)?e[0]:e;return typeof t=="string"?t.trim().toLowerCase():void 0},f=new Set(["none","same-origin","same-site"]),l=e=>{const t=n(e.headers["sec-fetch-site"]);if(t!==void 0)return f.has(t)?void 0:"cross-origin request rejected";const r=n(e.headers.origin);if(r===void 0||r==="null")return;let o;try{o=new URL(r).host.toLowerCase()}catch{return"invalid origin header"}return o===n(e.headers.host)?void 0:"cross-origin request rejected"},p=e=>{const t=(e.method??"GET").toUpperCase(),r=t!=="GET"&&t!=="HEAD",o=l(e);if(o!==void 0)return o;if(r&&!n(e.headers["content-type"])?.startsWith("application/json"))return"content-type must be application/json"},y=(e,t,r,o,a)=>{(async()=>{try{const s=p(e);if(s!==void 0){i(t,403,{error:s,ok:!1});return}const c=e.method==="GET"?"":await u(e);let d;try{d=c===""?void 0:JSON.parse(c)}catch{i(t,400,{error:"invalid-json",ok:!1});return}const h=r({body:d,method:e.method??"POST",projectRoot:o,schemaDirectory:a});i(t,h.status,h.body)}catch(s){i(t,500,{error:s instanceof Error?s.message:String(s),ok:!1})}})().catch(()=>{})};export{y as serveJsonHandler};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Writable as S}from"node:stream";import{StringDecoder as b}from"node:string_decoder";const y="cloudflare-dev/",M=1500,N=async()=>{const{default:t}=await import("dockerode");return new t},W=t=>{if(!t.startsWith(y))return;const[s]=t.slice(y.length).split(":");return s!==void 0&&s.length>0?s:void 0},h=t=>{const s=new b("utf8");let a="";const n=r=>{t(r.endsWith("\r")?r.slice(0,-1):r)};return new S({final(r){a+=s.end(),a.length>0&&(n(a),a=""),r()},write(r,m,i){a+=s.write(r);const d=a.split(`
|
|
2
|
+
`);a=d.pop()??"";for(const w of d)n(w);i()}})},P=t=>{const s=new Map(t.containers.map(e=>[e.className.toLowerCase(),e.exportName]));if(s.size===0)return{close:()=>{}};const a=t.pollIntervalMs??M,n=new Map;let r=!1,m=!1,i,d;const w=async()=>(d??=t.docker?Promise.resolve(t.docker):N(),d),I=async(e,l,f)=>{try{const o=await e.getContainer(l).logs({follow:!0,stderr:!0,stdout:!0,tail:"all",timestamps:!1});if(r){o.destroy();return}const c=h(p=>{t.onLine({level:"info",name:f,text:p})}),u=h(p=>{t.onLine({level:"error",name:f,text:p})});e.modem.demuxStream(o,c,u),o.on("end",()=>{c.end(),u.end(),n.delete(l)}),o.on("error",()=>{n.delete(l)}),n.set(l,o)}catch{}},x=async()=>{try{const e=await(await w()).listContainers({filters:{status:["running"]}});return m=!1,e}catch(e){m||(m=!0,t.onUnavailable?.(e instanceof Error?e.message:String(e)));return}},C=async(e,l)=>{const f=new Set;for(const o of l){const c=W(o.Image),u=c===void 0?void 0:s.get(c);u!==void 0&&(f.add(o.Id),n.has(o.Id)||await I(e,o.Id,u))}for(const[o,c]of n)f.has(o)||(c.destroy(),n.delete(o))},L=async()=>{if(r)return;const e=await x();e!==void 0&&await C(await w(),e)};let v=!1;const g=()=>{v||r||(v=!0,L().finally(()=>{v=!1}).catch(()=>{}))};return i=setInterval(g,a),i.unref(),g(),{close:()=>{r=!0,i&&(clearInterval(i),i=void 0);for(const[e,l]of n)l.destroy(),n.delete(e)}}};export{P as streamContainerLogs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as e,renameSync as n,rmSync as m}from"node:fs";const a=(t,o)=>{const r=`${t}.lunora-tmp`;try{e(r,o,"utf8"),n(r,t)}catch(c){throw m(r,{force:!0}),c}};export{a as m};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { assetContentType, isStandaloneModulePath, loadStudioAssets, readStandaloneAsset, resolveStandaloneDirectory, studioAssetsStamp } from '../packem_shared/assetContentType-ByZjeV3D.mjs';
|
|
3
|
-
export { POLICY_SCAFFOLD_ENDPOINT, handlePolicyScaffoldRequest } from '../packem_shared/POLICY_SCAFFOLD_ENDPOINT-CvTZpaZF.mjs';
|
|
4
|
-
export { default as renderStudioHtml } from '../packem_shared/renderStudioHtml-449Ysn75.mjs';
|
|
5
|
-
export { SCHEMA_EDIT_ENDPOINT, handleSchemaEditRequest } from '../packem_shared/SCHEMA_EDIT_ENDPOINT-Bt2SNkpV.mjs';
|
|
6
|
-
export { SEED_ENDPOINT, handleSeedRequest } from '../packem_shared/SEED_ENDPOINT-7izz_Jao.mjs';
|
|
7
|
-
export { serveJsonHandler } from '../packem_shared/serveJsonHandler-Cl2Wqkv8.mjs';
|
|
1
|
+
import{parseDevVariable as t,resolveAdminToken as r}from"../packem_shared/parseDevVariable-NAVJ8tgA.mjs";import{assetContentType as s,isStandaloneModulePath as d,loadStudioAssets as l,readStandaloneAsset as n,resolveStandaloneDirectory as S,studioAssetsStamp as m}from"../packem_shared/assetContentType-DNZyUOuF.mjs";import{POLICY_SCAFFOLD_ENDPOINT as p,handlePolicyScaffoldRequest as i}from"../packem_shared/POLICY_SCAFFOLD_ENDPOINT-CUYWD0Mh.mjs";import{default as D}from"../packem_shared/renderStudioHtml-B2AkxcW1.mjs";import{SCHEMA_EDIT_ENDPOINT as x,handleSchemaEditRequest as A}from"../packem_shared/SCHEMA_EDIT_ENDPOINT-CZ8rSh2k.mjs";import{SEED_ENDPOINT as P,handleSeedRequest as T}from"../packem_shared/SEED_ENDPOINT-BaYShU8q.mjs";import{serveJsonHandler as I}from"../packem_shared/serveJsonHandler-C5GWlWJF.mjs";export{p as POLICY_SCAFFOLD_ENDPOINT,x as SCHEMA_EDIT_ENDPOINT,P as SEED_ENDPOINT,s as assetContentType,i as handlePolicyScaffoldRequest,A as handleSchemaEditRequest,T as handleSeedRequest,d as isStandaloneModulePath,l as loadStudioAssets,t as parseDevVariable,n as readStandaloneAsset,D as renderStudioHtml,r as resolveAdminToken,S as resolveStandaloneDirectory,I as serveJsonHandler,m as studioAssetsStamp};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/config",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.82",
|
|
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",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
53
|
+
"@lunora/codegen": "1.0.0-alpha.56",
|
|
54
54
|
"@lunora/container": "1.0.0-alpha.16",
|
|
55
55
|
"@lunora/errors": "1.0.0-alpha.8",
|
|
56
|
-
"@lunora/seed": "1.0.0-alpha.
|
|
56
|
+
"@lunora/seed": "1.0.0-alpha.31",
|
|
57
57
|
"@visulima/colorize": "2.0.0",
|
|
58
58
|
"@visulima/find-ai-runner": "1.0.0",
|
|
59
59
|
"dockerode": "^5.0.1",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import colorize from '@visulima/colorize';
|
|
2
|
-
|
|
3
|
-
const ACCENT = "#a855f7";
|
|
4
|
-
const INK = "#0b0b0b";
|
|
5
|
-
const STEP_BADGE_NAMES = ["lunora", "dir", "tmpl", "add", "deps", "git", "next"];
|
|
6
|
-
const BADGES = {
|
|
7
|
-
add: { bg: ACCENT, fg: INK, text: "add" },
|
|
8
|
-
debug: { bg: "#6b7280", fg: "#f3f4f6", text: "debug" },
|
|
9
|
-
deps: { bg: ACCENT, fg: INK, text: "deps" },
|
|
10
|
-
dir: { bg: ACCENT, fg: INK, text: "dir" },
|
|
11
|
-
error: { bg: "#ef4444", fg: INK, text: "error" },
|
|
12
|
-
git: { bg: "#f59e0b", fg: INK, text: "git" },
|
|
13
|
-
info: { bg: "#3b82f6", fg: INK, text: "info" },
|
|
14
|
-
lunora: { bg: "#22c55e", fg: INK, text: "lunora" },
|
|
15
|
-
next: { bg: "#06b6d4", fg: INK, text: "next" },
|
|
16
|
-
success: { bg: "#22c55e", fg: INK, text: "ok" },
|
|
17
|
-
tmpl: { bg: ACCENT, fg: INK, text: "tmpl" },
|
|
18
|
-
warn: { bg: "#f59e0b", fg: INK, text: "warn" }
|
|
19
|
-
};
|
|
20
|
-
const LUNA_NAME = "Luna";
|
|
21
|
-
const LUNA_SIGNOFF = "Safe travels, voyager.";
|
|
22
|
-
const LUNA_BUNNY = String.raw`
|
|
23
|
-
.-"""""-.
|
|
24
|
-
/ (\(\ \
|
|
25
|
-
| ( -.-) |
|
|
26
|
-
\ o(")(") /
|
|
27
|
-
'-._____.-'`;
|
|
28
|
-
const LUNA_ART = LUNA_BUNNY.startsWith("\n") ? LUNA_BUNNY.slice(1) : LUNA_BUNNY;
|
|
29
|
-
const BADGE_GUTTER = 6;
|
|
30
|
-
const padBadge = (text) => ` ${text} `;
|
|
31
|
-
const badgeLead = (text) => " ".repeat(Math.max(0, BADGE_GUTTER - text.length));
|
|
32
|
-
const BADGE_COLUMN_WIDTH = BADGE_GUTTER + 2;
|
|
33
|
-
const badgeWidth = (_spec) => BADGE_COLUMN_WIDTH;
|
|
34
|
-
const paintBadge = (spec) => (
|
|
35
|
-
// eslint-disable-next-line import/no-named-as-default-member -- see file header.
|
|
36
|
-
badgeLead(spec.text) + colorize.bgHex(spec.bg).hex(spec.fg).bold(padBadge(spec.text))
|
|
37
|
-
);
|
|
38
|
-
const paintAnswer = (text) => colorize.dim(text);
|
|
39
|
-
|
|
40
|
-
export { ACCENT, BADGES, BADGE_COLUMN_WIDTH, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, STEP_BADGE_NAMES, badgeLead, badgeWidth, padBadge, paintAnswer, paintBadge };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { detectAiSession } from '@visulima/find-ai-runner';
|
|
2
|
-
|
|
3
|
-
const AGENT_MODE_ENV = "LUNORA_AGENT_MODE";
|
|
4
|
-
const isDisabled = (value) => {
|
|
5
|
-
const normalized = value.trim().toLowerCase();
|
|
6
|
-
return normalized === "0" || normalized === "false";
|
|
7
|
-
};
|
|
8
|
-
const detectAiAgent = (env = process.env) => {
|
|
9
|
-
const override = env[AGENT_MODE_ENV];
|
|
10
|
-
if (override !== void 0 && override !== "") {
|
|
11
|
-
return isDisabled(override) ? void 0 : { name: "agent (forced)", variable: AGENT_MODE_ENV };
|
|
12
|
-
}
|
|
13
|
-
const session = detectAiSession(env);
|
|
14
|
-
return session === void 0 ? void 0 : { name: session.agent, variable: session.signal };
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { AGENT_MODE_ENV, detectAiAgent };
|