@lunora/cli 1.0.0-alpha.1 → 1.0.0-alpha.100
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 +6 -0
- package/__assets__/package-og.svg +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +473 -344
- package/dist/index.d.ts +473 -344
- package/dist/index.mjs +10 -11
- package/dist/packem_chunks/handler.mjs +91 -7
- package/dist/packem_chunks/handler10.mjs +8 -14
- package/dist/packem_chunks/handler11.mjs +20 -189
- package/dist/packem_chunks/handler12.mjs +176 -115
- package/dist/packem_chunks/handler13.mjs +118 -52
- package/dist/packem_chunks/handler14.mjs +50 -43
- package/dist/packem_chunks/handler15.mjs +27 -6
- package/dist/packem_chunks/handler16.mjs +6 -3
- package/dist/packem_chunks/handler17.mjs +1 -1
- package/dist/packem_chunks/handler18.mjs +5 -7
- package/dist/packem_chunks/handler19.mjs +44 -5
- package/dist/packem_chunks/handler2.mjs +6 -4
- package/dist/packem_chunks/handler20.mjs +2 -2
- package/dist/packem_chunks/handler21.mjs +158 -267
- package/dist/packem_chunks/handler3.mjs +8 -4
- package/dist/packem_chunks/handler4.mjs +2 -2
- package/dist/packem_chunks/handler5.mjs +7 -4
- package/dist/packem_chunks/handler6.mjs +10 -7
- package/dist/packem_chunks/handler7.mjs +2 -2
- package/dist/packem_chunks/handler8.mjs +1 -1
- package/dist/packem_chunks/handler9.mjs +330 -12
- package/dist/packem_chunks/planDevCommand.mjs +759 -121
- package/dist/packem_chunks/runCodegenCommand.mjs +5 -4
- package/dist/packem_chunks/runDeployCommand.mjs +137 -22
- package/dist/packem_chunks/runInitCommand.mjs +2053 -112
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +98 -51
- package/dist/packem_chunks/runResetCommand.mjs +4 -4
- package/dist/packem_chunks/runRpcCommand.mjs +3 -2
- package/dist/packem_shared/{COMMANDS-1V_KEx35.mjs → COMMANDS-BOJIDoVY.mjs} +154 -28
- package/dist/packem_shared/{DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs → DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs} +7 -2
- package/dist/packem_shared/{api-spec-CtA6ilu4.mjs → api-spec-Bx0iKbxA.mjs} +3 -1
- package/dist/packem_shared/{buildRegistryIndex-BcYe607_.mjs → buildRegistryIndex-BS5ig822.mjs} +1 -1
- package/dist/packem_shared/codegen-error-DJG-ghs_.mjs +31 -0
- package/dist/packem_shared/{command-BDXcJCCJ.mjs → command-lYnl4QyF.mjs} +6 -1
- package/dist/packem_shared/{runAddCommand-BZGkRnBs.mjs → commands-D5Yxt9VY.mjs} +331 -33
- package/dist/packem_shared/{createLogger-CHPNjFw2.mjs → createLogger-CIWSHrTL.mjs} +40 -8
- package/dist/packem_shared/{defaultSpawner-DxI3mebw.mjs → createRecordingSpawner-WuSn20kb.mjs} +23 -2
- package/dist/packem_shared/detect-package-manager-v4hHpQd0.mjs +62 -0
- package/dist/packem_shared/{diffSnapshots-RR2ZE8Ya.mjs → diffSnapshots-BeDvvNiF.mjs} +1 -1
- package/dist/packem_shared/{insertSchemaExtension-BuzF6-t2.mjs → insertSchemaExtension-DAqbfr9Z.mjs} +15 -10
- package/dist/packem_shared/{open-url-Dfq6fAyT.mjs → open-url-4PBLY9X0.mjs} +3 -2
- package/dist/packem_shared/{output-format-7gyGR3h8.mjs → output-format-B4642rjE.mjs} +1 -1
- package/dist/packem_shared/{parseManifest--vZf2FY1.mjs → parseManifest-Dbp-Q2q3.mjs} +36 -9
- package/dist/packem_shared/prompt-cancelled-APzX1Im-.mjs +9 -0
- package/dist/packem_shared/runAddCommand-D1hgfqFQ.mjs +4 -0
- package/dist/packem_shared/{schemaIrToSnapshot-aBTo7TM5.mjs → schemaIrToSnapshot-DdsljJT-.mjs} +1 -1
- package/dist/packem_shared/storage-BXU4ax4O.mjs +84 -0
- package/dist/packem_shared/tui-prompts-BjEN8XgP.mjs +658 -0
- package/dist/packem_shared/wrangler-secrets-Coni-mER.mjs +49 -0
- package/package.json +23 -17
- package/skills/lunora-quickstart/SKILL.md +26 -5
- package/skills/lunora-setup-storage/SKILL.md +7 -3
- package/dist/packem_shared/features-ocSSpZtS.mjs +0 -24
- package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { runCodegen } from '@lunora/codegen';
|
|
2
|
-
import { validateWranglerProject, inferLunoraBindings, reconcileWranglerBindings } from '@lunora/config';
|
|
3
|
-
import { p as parseApiSpec } from '../packem_shared/api-spec-
|
|
4
|
-
import {
|
|
2
|
+
import { validateWranglerProject, inferLunoraBindings, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons } from '@lunora/config';
|
|
3
|
+
import { p as parseApiSpec } from '../packem_shared/api-spec-Bx0iKbxA.mjs';
|
|
4
|
+
import { r as renderCodegenFailure } from '../packem_shared/codegen-error-DJG-ghs_.mjs';
|
|
5
|
+
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
5
6
|
import { r as runSchemaDriftGate } from '../packem_shared/schema-drift-gate-BtBt0as0.mjs';
|
|
6
7
|
|
|
7
|
-
const provisionBindings = async (cwd, logger) => {
|
|
8
|
+
const provisionBindings = async (cwd, logger, cronTriggers = []) => {
|
|
8
9
|
try {
|
|
9
10
|
const inferred = await inferLunoraBindings({ projectRoot: cwd });
|
|
10
11
|
const reconciled = reconcileWranglerBindings(cwd, inferred);
|
|
@@ -18,6 +19,26 @@ const provisionBindings = async (cwd, logger) => {
|
|
|
18
19
|
const message = error instanceof Error ? error.message : String(error);
|
|
19
20
|
logger.warn(`binding inference skipped: ${message}`);
|
|
20
21
|
}
|
|
22
|
+
try {
|
|
23
|
+
const reconciled = reconcileWranglerCompatibilityDate(cwd);
|
|
24
|
+
if (reconciled.changed) {
|
|
25
|
+
logger.success(
|
|
26
|
+
`bumped compatibility_date to ${reconciled.date ?? "unknown"} (Workers Cache enabled) → ${reconciled.wranglerPath ?? "wrangler.jsonc"}`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
} catch (error) {
|
|
30
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
31
|
+
logger.warn(`compatibility date sync skipped: ${message}`);
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const reconciled = reconcileWranglerCrons(cwd, cronTriggers);
|
|
35
|
+
if (reconciled.changed) {
|
|
36
|
+
logger.success(`synced ${String(cronTriggers.length)} cron trigger(s) → ${reconciled.wranglerPath ?? "wrangler.jsonc"}`);
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
40
|
+
logger.warn(`cron trigger sync skipped: ${message}`);
|
|
41
|
+
}
|
|
21
42
|
};
|
|
22
43
|
const runPrepareCommand = async (options) => {
|
|
23
44
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -28,7 +49,7 @@ const runPrepareCommand = async (options) => {
|
|
|
28
49
|
options.logger.success("codegen complete");
|
|
29
50
|
} catch (error) {
|
|
30
51
|
const message = error instanceof Error ? error.message : String(error);
|
|
31
|
-
options.logger.error(
|
|
52
|
+
options.logger.error(renderCodegenFailure(error));
|
|
32
53
|
return {
|
|
33
54
|
code: 1,
|
|
34
55
|
error: `codegen failed: ${message}`,
|
|
@@ -49,7 +70,7 @@ const runPrepareCommand = async (options) => {
|
|
|
49
70
|
validation: { problems: [], wranglerPath: void 0 }
|
|
50
71
|
};
|
|
51
72
|
}
|
|
52
|
-
await provisionBindings(cwd, options.logger);
|
|
73
|
+
await provisionBindings(cwd, options.logger, codegen.cronTriggers);
|
|
53
74
|
const validation = validateWranglerProject({ projectRoot: cwd });
|
|
54
75
|
if (validation.problems.length > 0) {
|
|
55
76
|
options.logger.error("wrangler.jsonc validation failed:");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as defineHandler } from '../packem_shared/command-
|
|
2
|
-
import { runAddCommand, runRegistryViewCommand, runBuildIndexCommand } from '../packem_shared/
|
|
1
|
+
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
2
|
+
import { r as runAddCommand, b as runRegistryViewCommand, a as runBuildIndexCommand } from '../packem_shared/commands-D5Yxt9VY.mjs';
|
|
3
3
|
|
|
4
4
|
const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
5
5
|
const subcommand = argument[0];
|
|
@@ -15,19 +15,22 @@ const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
|
15
15
|
logger,
|
|
16
16
|
names,
|
|
17
17
|
overwrite: options.overwrite === true,
|
|
18
|
+
ref: options.ref,
|
|
18
19
|
source: options.source,
|
|
19
20
|
yes: options.yes === true
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
23
|
if (subcommand === "list") {
|
|
23
|
-
return runAddCommand({ cwd, from: options.from, json: options.json === true, list: true, logger, names: [], source: options.source });
|
|
24
|
+
return runAddCommand({ cwd, from: options.from, json: options.json === true, list: true, logger, names: [], ref: options.ref, source: options.source });
|
|
24
25
|
}
|
|
25
26
|
if (subcommand === "view") {
|
|
26
27
|
return runRegistryViewCommand({
|
|
27
28
|
allowUnsafeSource: options.allowUnsafeSource === true,
|
|
29
|
+
cwd,
|
|
28
30
|
from: options.from,
|
|
29
31
|
logger,
|
|
30
32
|
names,
|
|
33
|
+
ref: options.ref,
|
|
31
34
|
source: options.source
|
|
32
35
|
});
|
|
33
36
|
}
|
|
@@ -2,7 +2,7 @@ import { existsSync, readFileSync, readdirSync, statSync, mkdirSync, writeFileSy
|
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { AGENT_RULES_DIR, detectAgentRules, LUNORA_SKILL_NAMES } from '@lunora/config';
|
|
4
4
|
import { join, relative, dirname } from '@visulima/path';
|
|
5
|
-
import { d as defineHandler } from '../packem_shared/command-
|
|
5
|
+
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
6
6
|
|
|
7
7
|
const resolveBundledSkillsDirectory = (startDirectory = dirname(fileURLToPath(import.meta.url))) => {
|
|
8
8
|
let directory = startDirectory;
|
|
@@ -2,13 +2,13 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { mkdtemp, writeFile, rm } from 'node:fs/promises';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
4
|
import { discoverSchema, schemaFromIr } from '@lunora/codegen';
|
|
5
|
-
import { promptYesNo } from '@lunora/config';
|
|
6
5
|
import { seedPlan } from '@lunora/seed';
|
|
7
6
|
import { join } from '@visulima/path';
|
|
8
7
|
import { Project } from 'ts-morph';
|
|
9
|
-
import { d as defineHandler } from '../packem_shared/command-
|
|
8
|
+
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
10
9
|
import { a as resolveProductionWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
|
|
11
|
-
import {
|
|
10
|
+
import { b as tuiConfirm } from '../packem_shared/tui-prompts-BjEN8XgP.mjs';
|
|
11
|
+
import { runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs';
|
|
12
12
|
import { runResetCommand } from './runResetCommand.mjs';
|
|
13
13
|
|
|
14
14
|
const isLocalUrl = (url) => {
|
|
@@ -88,10 +88,8 @@ const confirmRemoteSeedTarget = async (options, generated) => {
|
|
|
88
88
|
options.logger.error("seed: refusing to insert into a non-local target without confirmation — re-run with --yes");
|
|
89
89
|
return seedFailure(1);
|
|
90
90
|
}
|
|
91
|
-
const confirmer = options.confirm ??
|
|
92
|
-
const confirmed = await confirmer(
|
|
93
|
-
`This will insert ${String(generated)} generated row(s) into ${options.url ?? "the production worker"}. Continue? [y/N] `
|
|
94
|
-
);
|
|
91
|
+
const confirmer = options.confirm ?? tuiConfirm;
|
|
92
|
+
const confirmed = await confirmer(`This will insert ${String(generated)} generated row(s) into ${options.url ?? "the production worker"}. Continue?`);
|
|
95
93
|
if (!confirmed) {
|
|
96
94
|
options.logger.info("seed: aborted");
|
|
97
95
|
return seedFailure(1);
|
|
@@ -1,20 +1,50 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { runCodegen } from '@lunora/codegen';
|
|
4
|
-
import { p as parseApiSpec } from '../packem_shared/api-spec-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { p as parseApiSpec } from '../packem_shared/api-spec-Bx0iKbxA.mjs';
|
|
5
|
+
import { a as renderCodegenHint } from '../packem_shared/codegen-error-DJG-ghs_.mjs';
|
|
6
|
+
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
7
|
+
import { e as execArgsFor, d as detectPackageManager } from '../packem_shared/detect-package-manager-v4hHpQd0.mjs';
|
|
8
|
+
import { v as validateOutputFormat, i as isJsonFormat, p as printJson, l as loggerForFormat } from '../packem_shared/output-format-B4642rjE.mjs';
|
|
7
9
|
import { r as runSchemaDriftGate } from '../packem_shared/schema-drift-gate-BtBt0as0.mjs';
|
|
8
|
-
import { defaultSpawner } from '../packem_shared/
|
|
10
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
9
11
|
import { validateWranglerProject } from '@lunora/config';
|
|
10
12
|
|
|
11
13
|
const runTypecheckStep = async (cwd, spawner) => {
|
|
12
14
|
if (!existsSync(join(cwd, "tsconfig.json"))) {
|
|
13
15
|
return { warning: "no tsconfig.json found — skipping TypeScript type-check" };
|
|
14
16
|
}
|
|
15
|
-
const
|
|
17
|
+
const exec = execArgsFor(detectPackageManager(cwd), "tsc", ["--noEmit", "-p", "tsconfig.json"]);
|
|
18
|
+
const result = await spawner({ args: exec.args, command: exec.command, cwd });
|
|
16
19
|
return result.code === 0 ? {} : { error: `type errors: tsc --noEmit exited ${String(result.code)}` };
|
|
17
20
|
};
|
|
21
|
+
const HEALTH_PATH = "/_lunora/health";
|
|
22
|
+
const joinHealthUrl = (base) => (base.endsWith("/") ? base.slice(0, -1) : base) + HEALTH_PATH;
|
|
23
|
+
const runHealthProbeStep = async (healthUrl, healthFetch) => {
|
|
24
|
+
const url = joinHealthUrl(healthUrl);
|
|
25
|
+
let response;
|
|
26
|
+
try {
|
|
27
|
+
response = await healthFetch(url);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
30
|
+
return { error: `health probe failed: could not reach ${url} (${message})` };
|
|
31
|
+
}
|
|
32
|
+
if (response.ok) {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
return { error: `health probe failed: ${url} returned HTTP ${String(response.status)}` };
|
|
36
|
+
};
|
|
37
|
+
const probeHealthIfRequested = async (options, logger) => {
|
|
38
|
+
if (options.healthUrl === void 0 || options.healthUrl === "") {
|
|
39
|
+
return void 0;
|
|
40
|
+
}
|
|
41
|
+
const probe = await runHealthProbeStep(options.healthUrl, options.healthFetch ?? ((url) => fetch(url)));
|
|
42
|
+
if (probe.error === void 0) {
|
|
43
|
+
logger.success(`verify: health probe ok (${joinHealthUrl(options.healthUrl)})`);
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
return probe.error;
|
|
47
|
+
};
|
|
18
48
|
const reportVerifyResult = (logger, errors, warnings, wranglerPath) => {
|
|
19
49
|
if (errors.length === 0 && warnings.length === 0) {
|
|
20
50
|
logger.success("verify: project is valid");
|
|
@@ -30,6 +60,10 @@ const reportVerifyResult = (logger, errors, warnings, wranglerPath) => {
|
|
|
30
60
|
logger.error("verify: errors:");
|
|
31
61
|
for (const error of errors) {
|
|
32
62
|
logger.error(` - ${error}`);
|
|
63
|
+
const hint = renderCodegenHint(error);
|
|
64
|
+
if (hint !== void 0) {
|
|
65
|
+
logger.error(hint);
|
|
66
|
+
}
|
|
33
67
|
}
|
|
34
68
|
return { code: 1, errors, warnings, wranglerPath };
|
|
35
69
|
}
|
|
@@ -66,6 +100,10 @@ const runVerifyCommand = async (options) => {
|
|
|
66
100
|
warnings.push(typecheck.warning);
|
|
67
101
|
}
|
|
68
102
|
}
|
|
103
|
+
const healthError = await probeHealthIfRequested(options, logger);
|
|
104
|
+
if (healthError !== void 0) {
|
|
105
|
+
errors.push(healthError);
|
|
106
|
+
}
|
|
69
107
|
const result = reportVerifyResult(logger, errors, warnings, validation.wranglerPath);
|
|
70
108
|
if (isJsonFormat(options.format)) {
|
|
71
109
|
printJson(result);
|
|
@@ -78,6 +116,7 @@ const execute = defineHandler(async ({ cwd, logger, options }) => {
|
|
|
78
116
|
apiSpec: parseApiSpec(options.apiSpec),
|
|
79
117
|
cwd,
|
|
80
118
|
format: options.format,
|
|
119
|
+
healthUrl: options.healthUrl,
|
|
81
120
|
logger,
|
|
82
121
|
// `--no-typecheck` is declared as a `no-*` option but cerebro exposes it
|
|
83
122
|
// under the negated `typecheck` key (false when passed, true when absent).
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { mkdtempSync, rmSync, existsSync, readdirSync, statSync } from 'node:fs';
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import { join, relative } from 'node:path';
|
|
4
|
-
import { d as defineHandler } from '../packem_shared/command-
|
|
5
|
-
import {
|
|
4
|
+
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
5
|
+
import { e as execArgsFor, d as detectPackageManager } from '../packem_shared/detect-package-manager-v4hHpQd0.mjs';
|
|
6
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
6
7
|
|
|
7
8
|
const walk = (root) => {
|
|
8
9
|
const entries = [];
|
|
@@ -71,9 +72,10 @@ const runAnalyzeCommand = async (options) => {
|
|
|
71
72
|
} else {
|
|
72
73
|
outdir = mkdtempSync(join(tmpdir(), "lunora-analyze-"));
|
|
73
74
|
temporary = true;
|
|
75
|
+
const exec = execArgsFor(detectPackageManager(cwd), "wrangler", ["deploy", "--dry-run", "--outdir", outdir]);
|
|
74
76
|
descriptor = {
|
|
75
|
-
args:
|
|
76
|
-
command:
|
|
77
|
+
args: exec.args,
|
|
78
|
+
command: exec.command,
|
|
77
79
|
cwd
|
|
78
80
|
};
|
|
79
81
|
logger.info(`analyze: building via ${descriptor.command} ${descriptor.args.join(" ")}`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFileSync, existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { parse } from 'jsonc-parser';
|
|
4
|
-
import { d as defineHandler } from '../packem_shared/command-
|
|
5
|
-
import { o as openUrl } from '../packem_shared/open-url-
|
|
4
|
+
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
5
|
+
import { o as openUrl } from '../packem_shared/open-url-4PBLY9X0.mjs';
|
|
6
6
|
|
|
7
7
|
const DEFAULT_DEV_PORT = 8787;
|
|
8
8
|
const STUDIO_PATH = "/_lunora/studio";
|