@lunora/config 0.0.0 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +105 -0
- package/README.md +115 -9
- package/__assets__/package-og.svg +14 -0
- package/dist/index.d.mts +1075 -0
- package/dist/index.d.ts +1075 -0
- package/dist/index.mjs +20 -0
- package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +40 -0
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +37 -0
- package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +52 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CySy5vR_.mjs +62 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-Dd1suoit.mjs +476 -0
- package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +228 -0
- package/dist/packem_shared/buildPackageSecretsBlock-S74dgmwy.mjs +187 -0
- package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +99 -0
- package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +100 -0
- package/dist/packem_shared/detectFramework-Br-BcPBq.mjs +41 -0
- package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +19 -0
- package/dist/packem_shared/discoverSchemaInfo-DWtypqpP.mjs +25 -0
- package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +19 -0
- package/dist/packem_shared/findWranglerFile-DwSuC-Kn.mjs +25 -0
- package/dist/packem_shared/formatLunoraEvent-D2fDeGB6.mjs +86 -0
- package/dist/packem_shared/handlePolicyScaffoldRequest-CiC2IGKx.mjs +103 -0
- package/dist/packem_shared/handleSchemaEditRequest-Df-Wrix-.mjs +99 -0
- package/dist/packem_shared/handleSeedRequest-DVCjaGO-.mjs +61 -0
- package/dist/packem_shared/inferLunoraBindings-0W3eRdIP.mjs +302 -0
- package/dist/packem_shared/injectRemoteFlags-C-WZAKLY.mjs +105 -0
- package/dist/packem_shared/interpretRemote-CtcIcB5-.mjs +34 -0
- package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +30 -0
- package/dist/packem_shared/parseSchema-DSeyktvG.mjs +107 -0
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +74 -0
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +74 -0
- package/dist/packem_shared/reconcileWranglerBindings-ByJk3yLU.mjs +277 -0
- package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +37 -0
- package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +86 -0
- package/dist/packem_shared/studioAssetsStamp-Csk5RS4E.mjs +28 -0
- package/dist/studio-host/index.d.mts +227 -0
- package/dist/studio-host/index.d.ts +227 -0
- package/dist/studio-host/index.mjs +7 -0
- package/package.json +57 -17
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
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';
|
|
2
|
+
export { discoverContainerInfo } from './packem_shared/discoverContainerInfo-BXFs6Wav.mjs';
|
|
3
|
+
export { detectFramework } from './packem_shared/detectFramework-Br-BcPBq.mjs';
|
|
4
|
+
export { DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, parseDevVariableEntries } from './packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs';
|
|
5
|
+
export { inferLunoraBindings, packageNamesFromBindings } from './packem_shared/inferLunoraBindings-0W3eRdIP.mjs';
|
|
6
|
+
export { LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, readLinkedProject, writeLinkedProject } from './packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs';
|
|
7
|
+
export { LUNORA_EVENT_SOURCE, formatLunoraEvent } from './packem_shared/formatLunoraEvent-D2fDeGB6.mjs';
|
|
8
|
+
export { PACKAGE_SECRETS_REGISTRY, secretsForPackages } from './packem_shared/PACKAGE_SECRETS_REGISTRY-CySy5vR_.mjs';
|
|
9
|
+
export { LUNORA_CONFIG_FILE, interpretRemote, readProjectRemotePreference } from './packem_shared/interpretRemote-CtcIcB5-.mjs';
|
|
10
|
+
export { createConfirm, isInteractive, promptMultiSelect, promptSelect, promptYesNo } from './packem_shared/createConfirm-fvpdgJ9s.mjs';
|
|
11
|
+
export { reconcileWranglerBindings } from './packem_shared/reconcileWranglerBindings-ByJk3yLU.mjs';
|
|
12
|
+
export { REMOTE_ELIGIBLE_KEYS, injectRemoteFlags, isRemoteEnvEnabled, materializeRemoteWranglerConfig, planRemoteBindings, resolveRemoteEnabled } from './packem_shared/injectRemoteFlags-C-WZAKLY.mjs';
|
|
13
|
+
export { buildPackageSecretsBlock, ensureDevVariables, ensureDevVarsExample, isPlaceholderValue, planDevVariablesAugment, planDevVariablesScaffold } from './packem_shared/buildPackageSecretsBlock-S74dgmwy.mjs';
|
|
14
|
+
export { applyAdditiveEdit, classifyEdit } from './packem_shared/applyAdditiveEdit-C-snTFEV.mjs';
|
|
15
|
+
export { parseSchema } from './packem_shared/parseSchema-DSeyktvG.mjs';
|
|
16
|
+
export { classifyPolicyEdit, scaffoldPolicyFile, wireRlsIntoProcedure } from './packem_shared/classifyPolicyEdit-BHeAqF8P.mjs';
|
|
17
|
+
export { discoverSchemaInfo } from './packem_shared/discoverSchemaInfo-DWtypqpP.mjs';
|
|
18
|
+
export { discoverWorkflowInfo } from './packem_shared/discoverWorkflowInfo-CedvR0mn.mjs';
|
|
19
|
+
export { WRANGLER_FILES, findWranglerFile, readWranglerJsonc } from './packem_shared/findWranglerFile-DwSuC-Kn.mjs';
|
|
20
|
+
export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer } from './packem_shared/REQUIRED_COMPATIBILITY_DATE-Dd1suoit.mjs';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
const AGENT_RULES_DIR = ".agents/skills";
|
|
5
|
+
const AGENT_RULES_HINT_ENV = "LUNORA_RULES_HINT_SHOWN";
|
|
6
|
+
const LUNORA_SKILL_NAMES = [
|
|
7
|
+
"lunora",
|
|
8
|
+
"lunora-quickstart",
|
|
9
|
+
"lunora-functions",
|
|
10
|
+
"lunora-realtime",
|
|
11
|
+
"lunora-setup-auth",
|
|
12
|
+
"lunora-create-package",
|
|
13
|
+
"lunora-migration-helper",
|
|
14
|
+
"lunora-deploy",
|
|
15
|
+
"lunora-performance-audit"
|
|
16
|
+
];
|
|
17
|
+
const ROOT_SKILL_NAME = "lunora";
|
|
18
|
+
const AGENT_RULES_HINT = "Lunora AI rules not installed — run `lunora rules install` so your coding agent knows how to use Lunora.";
|
|
19
|
+
const claimAgentRulesHint = () => {
|
|
20
|
+
if (process.env[AGENT_RULES_HINT_ENV] === "1") {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
process.env[AGENT_RULES_HINT_ENV] = "1";
|
|
24
|
+
return true;
|
|
25
|
+
};
|
|
26
|
+
const skillFile = (projectRoot, name) => join(projectRoot, AGENT_RULES_DIR, name, "SKILL.md");
|
|
27
|
+
const detectAgentRules = (projectRoot) => {
|
|
28
|
+
const present = [];
|
|
29
|
+
const missing = [];
|
|
30
|
+
for (const name of LUNORA_SKILL_NAMES) {
|
|
31
|
+
if (existsSync(skillFile(projectRoot, name))) {
|
|
32
|
+
present.push(name);
|
|
33
|
+
} else {
|
|
34
|
+
missing.push(name);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return { installed: existsSync(skillFile(projectRoot, ROOT_SKILL_NAME)), missing, present };
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, LUNORA_SKILL_NAMES, ROOT_SKILL_NAME, claimAgentRulesHint, detectAgentRules };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const DEV_VARS_FILE = ".dev.vars";
|
|
2
|
+
const DEV_VARS_EXAMPLE_FILE = ".dev.vars.example";
|
|
3
|
+
const DEV_VARS_KEY_PATTERN = /^[A-Za-z_]\w*$/u;
|
|
4
|
+
const DEV_VARS_NEWLINE = /\r?\n/u;
|
|
5
|
+
const unquoteDevVariable = (value) => {
|
|
6
|
+
if (value.length >= 2 && (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'"))) {
|
|
7
|
+
return value.slice(1, -1);
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
};
|
|
11
|
+
const splitDevVariableLine = (line) => {
|
|
12
|
+
const trimmed = line.trim();
|
|
13
|
+
if (trimmed === "" || trimmed.startsWith("#")) {
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
const equals = trimmed.indexOf("=");
|
|
17
|
+
if (equals <= 0) {
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
const key = trimmed.slice(0, equals).trim();
|
|
21
|
+
if (!DEV_VARS_KEY_PATTERN.test(key)) {
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
return { key, value: trimmed.slice(equals + 1).trim() };
|
|
25
|
+
};
|
|
26
|
+
const parseDevVariableEntries = (content) => {
|
|
27
|
+
const entries = [];
|
|
28
|
+
for (const line of content.split(DEV_VARS_NEWLINE)) {
|
|
29
|
+
const parsed = splitDevVariableLine(line);
|
|
30
|
+
if (parsed) {
|
|
31
|
+
entries.push({ key: parsed.key, value: unquoteDevVariable(parsed.value) });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return entries;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_VARS_NEWLINE, parseDevVariableEntries, splitDevVariableLine, unquoteDevVariable };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { parse } from 'jsonc-parser';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
const LINKED_PROJECT_DIR = ".lunora";
|
|
6
|
+
const LINKED_PROJECT_FILE = join(LINKED_PROJECT_DIR, "project.json");
|
|
7
|
+
const isObject = (value) => value !== null && typeof value === "object";
|
|
8
|
+
const stringField = (record, key) => {
|
|
9
|
+
const value = record[key];
|
|
10
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
11
|
+
};
|
|
12
|
+
const readLinkedProject = (projectRoot) => {
|
|
13
|
+
const path = join(projectRoot, LINKED_PROJECT_FILE);
|
|
14
|
+
if (!existsSync(path)) {
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
17
|
+
let text;
|
|
18
|
+
try {
|
|
19
|
+
text = readFileSync(path, "utf8");
|
|
20
|
+
} catch {
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
const parseErrors = [];
|
|
24
|
+
const parsed = parse(text, parseErrors, { allowTrailingComma: true });
|
|
25
|
+
if (parseErrors.length > 0 || !isObject(parsed)) {
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
account: stringField(parsed, "account"),
|
|
30
|
+
env: stringField(parsed, "env"),
|
|
31
|
+
linkedAt: stringField(parsed, "linkedAt"),
|
|
32
|
+
workerName: stringField(parsed, "workerName"),
|
|
33
|
+
workerUrl: stringField(parsed, "workerUrl")
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const writeLinkedProject = (projectRoot, link) => {
|
|
37
|
+
const directory = join(projectRoot, LINKED_PROJECT_DIR);
|
|
38
|
+
mkdirSync(directory, { recursive: true });
|
|
39
|
+
const record = {};
|
|
40
|
+
for (const key of ["account", "env", "linkedAt", "workerName", "workerUrl"]) {
|
|
41
|
+
const value = link[key];
|
|
42
|
+
if (value !== void 0 && value !== "") {
|
|
43
|
+
record[key] = value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const path = join(projectRoot, LINKED_PROJECT_FILE);
|
|
47
|
+
writeFileSync(path, `${JSON.stringify(record, void 0, 2)}
|
|
48
|
+
`, "utf8");
|
|
49
|
+
return path;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, readLinkedProject, writeLinkedProject };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const PACKAGE_SECRETS_REGISTRY = {
|
|
2
|
+
"@lunora/auth": [
|
|
3
|
+
{
|
|
4
|
+
description: "32-byte random secret used to sign sessions and tokens. Generate with: openssl rand -hex 32",
|
|
5
|
+
docsUrl: "https://lunora.sh/docs/packages/auth#secrets",
|
|
6
|
+
key: "AUTH_SECRET",
|
|
7
|
+
placeholderValue: "replace-with-openssl-rand-hex-32"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
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",
|
|
11
|
+
docsUrl: "https://lunora.sh/docs/packages/auth#secrets",
|
|
12
|
+
key: "AUTH_URL",
|
|
13
|
+
placeholderValue: "http://localhost:8787"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"@lunora/mail": [
|
|
17
|
+
{
|
|
18
|
+
description: "Resend API key for sending transactional email via @lunora/mail. Obtain at https://resend.com/api-keys",
|
|
19
|
+
docsUrl: "https://lunora.sh/docs/packages/mail#secrets",
|
|
20
|
+
key: "RESEND_API_KEY",
|
|
21
|
+
placeholderValue: "<your-resend-api-key>"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"@lunora/payment": [
|
|
25
|
+
{
|
|
26
|
+
description: "Stripe secret key (sk_test_…). Required when using the Stripe adapter. Obtain at https://dashboard.stripe.com/apikeys",
|
|
27
|
+
docsUrl: "https://lunora.sh/docs/packages/payment#stripe",
|
|
28
|
+
key: "STRIPE_SECRET_KEY",
|
|
29
|
+
placeholderValue: "<your-stripe-secret-key>"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
description: "Stripe webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://dashboard.stripe.com/webhooks",
|
|
33
|
+
docsUrl: "https://lunora.sh/docs/packages/payment#stripe",
|
|
34
|
+
key: "STRIPE_WEBHOOK_SECRET",
|
|
35
|
+
placeholderValue: "<your-stripe-webhook-secret>"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
description: "Polar access token for the Polar payment adapter. Obtain at https://polar.sh/settings/tokens",
|
|
39
|
+
docsUrl: "https://lunora.sh/docs/packages/payment#polar",
|
|
40
|
+
key: "POLAR_ACCESS_TOKEN",
|
|
41
|
+
placeholderValue: "<your-polar-access-token>"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
description: "Polar webhook secret for verifying event payloads from Polar. Obtain at https://polar.sh/settings/webhooks",
|
|
45
|
+
docsUrl: "https://lunora.sh/docs/packages/payment#polar",
|
|
46
|
+
key: "POLAR_WEBHOOK_SECRET",
|
|
47
|
+
placeholderValue: "<your-polar-webhook-secret>"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
const secretsForPackages = (packageNames) => {
|
|
52
|
+
const result = [];
|
|
53
|
+
for (const name of packageNames) {
|
|
54
|
+
const entries = PACKAGE_SECRETS_REGISTRY[name];
|
|
55
|
+
if (entries !== void 0) {
|
|
56
|
+
result.push(...entries);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { PACKAGE_SECRETS_REGISTRY, secretsForPackages };
|