@lunora/cli 1.0.0-alpha.30 → 1.0.0-alpha.32
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { runCodegen } from '@lunora/codegen';
|
|
2
2
|
import { validateWranglerProject, inferLunoraBindings, reconcileWranglerBindings } from '@lunora/config';
|
|
3
3
|
import { p as parseApiSpec } from '../packem_shared/api-spec-CtA6ilu4.mjs';
|
|
4
|
+
import { r as renderCodegenFailure } from '../packem_shared/codegen-error-DJG-ghs_.mjs';
|
|
4
5
|
import { d as defineHandler } from '../packem_shared/command-D3lB_4Az.mjs';
|
|
5
6
|
import { r as runSchemaDriftGate } from '../packem_shared/schema-drift-gate-BtBt0as0.mjs';
|
|
6
7
|
|
|
@@ -28,7 +29,7 @@ const runPrepareCommand = async (options) => {
|
|
|
28
29
|
options.logger.success("codegen complete");
|
|
29
30
|
} catch (error) {
|
|
30
31
|
const message = error instanceof Error ? error.message : String(error);
|
|
31
|
-
options.logger.error(
|
|
32
|
+
options.logger.error(renderCodegenFailure(error));
|
|
32
33
|
return {
|
|
33
34
|
code: 1,
|
|
34
35
|
error: `codegen failed: ${message}`,
|
|
@@ -2,6 +2,7 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { runCodegen } from '@lunora/codegen';
|
|
4
4
|
import { p as parseApiSpec } from '../packem_shared/api-spec-CtA6ilu4.mjs';
|
|
5
|
+
import { a as renderCodegenHint } from '../packem_shared/codegen-error-DJG-ghs_.mjs';
|
|
5
6
|
import { d as defineHandler } from '../packem_shared/command-D3lB_4Az.mjs';
|
|
6
7
|
import { v as validateOutputFormat, i as isJsonFormat, p as printJson, l as loggerForFormat } from '../packem_shared/output-format-wUvAN6AL.mjs';
|
|
7
8
|
import { r as runSchemaDriftGate } from '../packem_shared/schema-drift-gate-BtBt0as0.mjs';
|
|
@@ -30,6 +31,10 @@ const reportVerifyResult = (logger, errors, warnings, wranglerPath) => {
|
|
|
30
31
|
logger.error("verify: errors:");
|
|
31
32
|
for (const error of errors) {
|
|
32
33
|
logger.error(` - ${error}`);
|
|
34
|
+
const hint = renderCodegenHint(error);
|
|
35
|
+
if (hint !== void 0) {
|
|
36
|
+
logger.error(hint);
|
|
37
|
+
}
|
|
33
38
|
}
|
|
34
39
|
return { code: 1, errors, warnings, wranglerPath };
|
|
35
40
|
}
|
|
@@ -4,6 +4,7 @@ import { p as parseApiSpec } from '../packem_shared/api-spec-CtA6ilu4.mjs';
|
|
|
4
4
|
import { existsSync, watch } from 'node:fs';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { runCodegen } from '@lunora/codegen';
|
|
7
|
+
import { r as renderCodegenFailure } from '../packem_shared/codegen-error-DJG-ghs_.mjs';
|
|
7
8
|
import { d as defineHandler } from '../packem_shared/command-D3lB_4Az.mjs';
|
|
8
9
|
import { d as detectPackageManager, e as execArgsFor } from '../packem_shared/detect-package-manager-DYp7n3mJ.mjs';
|
|
9
10
|
import { createServer, request } from 'node:http';
|
|
@@ -18,7 +19,7 @@ const runOnce = (projectRoot, lunoraDirectory, apiSpec, logger, reason) => {
|
|
|
18
19
|
runCodegen({ apiSpec, lunoraDirectory, projectRoot });
|
|
19
20
|
logger.success(`codegen: wrote ${lunoraDirectory}/_generated (${reason})`);
|
|
20
21
|
} catch (error) {
|
|
21
|
-
logger.error(
|
|
22
|
+
logger.error(renderCodegenFailure(error, reason));
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
const startCodegenWatch = (options) => {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { findLunoraSolution } from '@lunora/codegen';
|
|
2
|
+
import { VisulimaError, renderError } from '@visulima/error';
|
|
3
|
+
|
|
4
|
+
const flattenSolutionBody = (solution) => solution.body.split("\n").filter((line) => !line.startsWith("```")).join("\n").replaceAll(/\*\*(.+?)\*\*/gu, "$1").replaceAll(/`([^`]+)`/gu, "$1");
|
|
5
|
+
const NO_STACK = { filterStacktrace: () => false, hideErrorCodeView: true };
|
|
6
|
+
const renderCodegenFailure = (error, reason) => {
|
|
7
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
8
|
+
const solution = findLunoraSolution(message);
|
|
9
|
+
const rendered = new VisulimaError({
|
|
10
|
+
hint: solution ? [solution.header, "", flattenSolutionBody(solution)] : void 0,
|
|
11
|
+
message: reason === void 0 ? `codegen failed: ${message}` : `codegen failed (${reason}): ${message}`,
|
|
12
|
+
name: "CodegenError"
|
|
13
|
+
});
|
|
14
|
+
rendered.stack = "";
|
|
15
|
+
return renderError(rendered, NO_STACK);
|
|
16
|
+
};
|
|
17
|
+
const renderCodegenHint = (message) => {
|
|
18
|
+
const solution = findLunoraSolution(message);
|
|
19
|
+
if (solution === void 0) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
const rendered = new VisulimaError({
|
|
23
|
+
hint: [flattenSolutionBody(solution)],
|
|
24
|
+
message: solution.header,
|
|
25
|
+
name: "Hint"
|
|
26
|
+
});
|
|
27
|
+
rendered.stack = "";
|
|
28
|
+
return renderError(rendered, NO_STACK);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { renderCodegenHint as a, renderCodegenFailure as r };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.32",
|
|
4
4
|
"description": "The Lunora CLI: init, dev, deploy, codegen, run, reset, and migrate commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-skills",
|
|
@@ -52,12 +52,13 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@bomb.sh/tab": "0.0.16",
|
|
55
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
56
|
-
"@lunora/config": "1.0.0-alpha.
|
|
55
|
+
"@lunora/codegen": "1.0.0-alpha.13",
|
|
56
|
+
"@lunora/config": "1.0.0-alpha.21",
|
|
57
57
|
"@lunora/container": "1.0.0-alpha.4",
|
|
58
58
|
"@lunora/d1": "1.0.0-alpha.7",
|
|
59
59
|
"@lunora/seed": "1.0.0-alpha.5",
|
|
60
60
|
"@visulima/cerebro": "3.0.0-alpha.32",
|
|
61
|
+
"@visulima/error": "6.0.0-alpha.34",
|
|
61
62
|
"@visulima/fs": "5.0.0-alpha.32",
|
|
62
63
|
"@visulima/pail": "4.0.0-alpha.22",
|
|
63
64
|
"@visulima/path": "3.0.0-alpha.13",
|