@lunora/cli 1.0.0-alpha.10 → 1.0.0-alpha.12

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 CHANGED
@@ -8,7 +8,7 @@ export { runMigrateGenerateCommand } from './packem_chunks/runMigrateGenerateCom
8
8
  export { runResetCommand } from './packem_chunks/runResetCommand.mjs';
9
9
  export { runRpcCommand } from './packem_chunks/runRpcCommand.mjs';
10
10
  export { default as parseArgs } from './packem_shared/parseArgs-YXFuKdEk.mjs';
11
- export { insertSchemaExtension } from './packem_shared/insertSchemaExtension-BuzF6-t2.mjs';
11
+ export { insertSchemaExtension } from './packem_shared/insertSchemaExtension-DAqbfr9Z.mjs';
12
12
  export { createLogger, pail } from './packem_shared/createLogger-B40gPzQo.mjs';
13
13
  export { diffSnapshots, renderAddColumn, renderCreateIndex, renderCreateTable, renderDropIndex, renderDropTable, renderMigrationFile, validatorKindToSqlType } from './packem_shared/diffSnapshots-BeDvvNiF.mjs';
14
14
  export { default as schemaIrToSnapshot } from './packem_shared/schemaIrToSnapshot-DdsljJT-.mjs';
@@ -16,4 +16,4 @@ export { createRecordingSpawner, defaultSpawner } from './packem_shared/createRe
16
16
  export { default as parseManifest } from './packem_shared/parseManifest--vZf2FY1.mjs';
17
17
  export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, validateWranglerProject as validateWrangler, validateWranglerConfig } from '@lunora/config';
18
18
  export { buildRegistryIndex } from './packem_shared/buildRegistryIndex-BcYe607_.mjs';
19
- export { r as runAddCommand, a as runBuildIndexCommand, b as runRegistryViewCommand } from './packem_shared/commands-DPKWlqqX.mjs';
19
+ export { r as runAddCommand, a as runBuildIndexCommand, b as runRegistryViewCommand } from './packem_shared/commands-DVr4lduS.mjs';
@@ -2,9 +2,9 @@ import { existsSync } from 'node:fs';
2
2
  import { findWranglerFile } from '@lunora/config';
3
3
  import { join, basename } from '@visulima/path';
4
4
  import { d as defineHandler } from '../packem_shared/command-BC30oSBW.mjs';
5
- import { t as tuiText, a as tuiSelect } from '../packem_shared/tui-prompts-DEiPCKV-.mjs';
6
- import { n as normalizeFeature, E as EMAIL_ITEM, s as sanitizeBucketName, d as deriveBucketName, p as promptBucketName, r as resolveTypedDestination, M as MAIL_DESTINATION_PROMPT, a as sanitizeDatabaseName, b as deriveDatabaseName, c as promptDatabaseName, D as DEFAULT_AUTH_ITEM, e as promptAuthProvider, A as AUTH_PROVIDER_OPTIONS, w as withStorageBucketName, f as withMailDestination, g as withAuthDatabaseName } from '../packem_shared/storage-2RJBhUC4.mjs';
7
- import { r as runAddCommand } from '../packem_shared/commands-DPKWlqqX.mjs';
5
+ import { t as tuiText, a as tuiSelect } from '../packem_shared/tui-prompts-M6OWsuyw.mjs';
6
+ import { n as normalizeFeature, E as EMAIL_ITEM, s as sanitizeBucketName, d as deriveBucketName, p as promptBucketName, r as resolveTypedDestination, M as MAIL_DESTINATION_PROMPT, a as sanitizeDatabaseName, b as deriveDatabaseName, c as promptDatabaseName, D as DEFAULT_AUTH_ITEM, e as promptAuthProvider, A as AUTH_PROVIDER_OPTIONS, w as withStorageBucketName, f as withMailDestination, g as withAuthDatabaseName } from '../packem_shared/storage-DL9OE4oE.mjs';
7
+ import { r as runAddCommand } from '../packem_shared/commands-DVr4lduS.mjs';
8
8
 
9
9
  const providerToItem = (provider) => {
10
10
  const value = provider.trim().toLowerCase();
@@ -1,5 +1,5 @@
1
1
  import { d as defineHandler } from '../packem_shared/command-BC30oSBW.mjs';
2
- import { r as runAddCommand, b as runRegistryViewCommand, a as runBuildIndexCommand } from '../packem_shared/commands-DPKWlqqX.mjs';
2
+ import { r as runAddCommand, b as runRegistryViewCommand, a as runBuildIndexCommand } from '../packem_shared/commands-DVr4lduS.mjs';
3
3
 
4
4
  const execute = defineHandler(({ argument, cwd, logger, options }) => {
5
5
  const subcommand = argument[0];
@@ -7,7 +7,7 @@ import { join } from '@visulima/path';
7
7
  import { Project } from 'ts-morph';
8
8
  import { d as defineHandler } from '../packem_shared/command-BC30oSBW.mjs';
9
9
  import { a as resolveProductionWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
10
- import { b as tuiConfirm } from '../packem_shared/tui-prompts-DEiPCKV-.mjs';
10
+ import { b as tuiConfirm } from '../packem_shared/tui-prompts-M6OWsuyw.mjs';
11
11
  import { runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs';
12
12
  import { runResetCommand } from './runResetCommand.mjs';
13
13
 
@@ -9,7 +9,7 @@ import { d as detectPackageManager, e as execArgsFor } from '../packem_shared/de
9
9
  import { createServer, request } from 'node:http';
10
10
  import { connect } from 'node:net';
11
11
  import { loadStudioAssets, studioAssetsStamp, renderStudioHtml, resolveAdminToken, SCHEMA_EDIT_ENDPOINT, POLICY_SCAFFOLD_ENDPOINT, SEED_ENDPOINT, serveJsonHandler, handleSchemaEditRequest, handlePolicyScaffoldRequest, handleSeedRequest } from '@lunora/config/studio-host';
12
- import { c as createTuiConfirm } from '../packem_shared/tui-prompts-DEiPCKV-.mjs';
12
+ import { c as createTuiConfirm } from '../packem_shared/tui-prompts-M6OWsuyw.mjs';
13
13
 
14
14
  const DEFAULT_DEBOUNCE_MS = 100;
15
15
  const PATH_SEGMENT_SEPARATOR = /[/\\]/u;
@@ -10,11 +10,11 @@ import { d as defineHandler } from '../packem_shared/command-BC30oSBW.mjs';
10
10
  import { a as detectInstalledManagers, i as installArgsFor } from '../packem_shared/detect-package-manager-DYp7n3mJ.mjs';
11
11
  import MagicString from 'magic-string';
12
12
  import { Project, SyntaxKind } from 'ts-morph';
13
- import { c as resolveSourceRef, d as resolveDistTag, r as runAddCommand } from '../packem_shared/commands-DPKWlqqX.mjs';
13
+ import { c as resolveSourceRef, d as resolveDistTag, r as runAddCommand } from '../packem_shared/commands-DVr4lduS.mjs';
14
14
  import { defaultSpawner } from '../packem_shared/createRecordingSpawner-DxI3mebw.mjs';
15
- import { d as tuiMascot, e as tuiStep, P as PromptCancelledError, f as tuiMoonrise, t as tuiText, g as tuiHeadline, h as tuiInfo, a as tuiSelect, w as withTuiSpinner, b as tuiConfirm, i as tuiNextSteps, j as tuiTasks, k as tuiMultiSelect, l as withTuiBadgeProgress } from '../packem_shared/tui-prompts-DEiPCKV-.mjs';
15
+ import { d as tuiMascot, e as tuiStep, P as PromptCancelledError, f as tuiMoonrise, t as tuiText, g as tuiHeadline, h as tuiInfo, a as tuiSelect, w as withTuiSpinner, b as tuiConfirm, i as tuiNextSteps, j as tuiTasks, k as tuiMultiSelect, l as withTuiBadgeProgress } from '../packem_shared/tui-prompts-M6OWsuyw.mjs';
16
16
  import { logStep } from '../packem_shared/createLogger-B40gPzQo.mjs';
17
- import { E as EMAIL_ITEM, p as promptBucketName, w as withStorageBucketName, M as MAIL_DESTINATION_PROMPT, r as resolveTypedDestination, f as withMailDestination, e as promptAuthProvider, c as promptDatabaseName, g as withAuthDatabaseName } from '../packem_shared/storage-2RJBhUC4.mjs';
17
+ import { E as EMAIL_ITEM, p as promptBucketName, w as withStorageBucketName, M as MAIL_DESTINATION_PROMPT, r as resolveTypedDestination, f as withMailDestination, e as promptAuthProvider, c as promptDatabaseName, g as withAuthDatabaseName } from '../packem_shared/storage-DL9OE4oE.mjs';
18
18
  import dns from 'node:dns/promises';
19
19
 
20
20
  const GITHUB_CONTENT = `name: Deploy
@@ -1238,16 +1238,17 @@ const maybeOfferExtras = async (options, projectDirectory) => {
1238
1238
  logWould(options.logger, `add ${plans.map((plan) => plan.label).join(", ")}`);
1239
1239
  return true;
1240
1240
  }
1241
+ const buffered = [];
1241
1242
  const applyLogger = isInteractive() ? {
1242
1243
  error: (message) => {
1243
- options.logger.error(message);
1244
+ buffered.push({ level: "error", message });
1244
1245
  },
1245
1246
  info: () => {
1246
1247
  },
1247
1248
  success: () => {
1248
1249
  },
1249
1250
  warn: (message) => {
1250
- options.logger.warn(message);
1251
+ buffered.push({ level: "warn", message });
1251
1252
  }
1252
1253
  } : options.logger;
1253
1254
  const steps = plans.map((plan) => {
@@ -1268,6 +1269,9 @@ const maybeOfferExtras = async (options, projectDirectory) => {
1268
1269
  });
1269
1270
  const done = `added ${plans.map((plan) => plan.label).join(", ")}`;
1270
1271
  const results = await withTuiBadgeProgress(BADGES.add, steps, done);
1272
+ for (const { level, message } of buffered) {
1273
+ options.logger[level](message);
1274
+ }
1271
1275
  return results.every((result) => result.code === 0);
1272
1276
  };
1273
1277
  const deps = {
@@ -1,7 +1,7 @@
1
1
  import { existsSync, rmSync } from 'node:fs';
2
2
  import { join } from '@visulima/path';
3
3
  import { d as defineHandler } from '../packem_shared/command-BC30oSBW.mjs';
4
- import { b as tuiConfirm } from '../packem_shared/tui-prompts-DEiPCKV-.mjs';
4
+ import { b as tuiConfirm } from '../packem_shared/tui-prompts-M6OWsuyw.mjs';
5
5
 
6
6
  const runResetCommand = async (options) => {
7
7
  const cwd = options.cwd ?? process.cwd();
@@ -3,9 +3,9 @@ import { dirname, join } from '@visulima/path';
3
3
  import { DEV_VARS_FILE, parseDevVariableEntries } from '@lunora/config';
4
4
  import { modify, applyEdits, parse } from 'jsonc-parser';
5
5
  import { fileURLToPath } from 'node:url';
6
- import { b as tuiConfirm } from './tui-prompts-DEiPCKV-.mjs';
6
+ import { b as tuiConfirm } from './tui-prompts-M6OWsuyw.mjs';
7
7
  import { collectCatalog, buildRegistryIndex } from './buildRegistryIndex-BcYe607_.mjs';
8
- import { insertSchemaExtension } from './insertSchemaExtension-BuzF6-t2.mjs';
8
+ import { insertSchemaExtension } from './insertSchemaExtension-DAqbfr9Z.mjs';
9
9
  import { createHash } from 'node:crypto';
10
10
  import { tmpdir } from 'node:os';
11
11
  import { downloadTemplate } from 'giget';
@@ -1,4 +1,4 @@
1
- import { Project, SyntaxKind } from 'ts-morph';
1
+ import { Project, SyntaxKind, Node } from 'ts-morph';
2
2
 
3
3
  const VALID_JS_IDENTIFIER = /^[A-Za-z_$][\w$]*$/u;
4
4
  const startMarker = (key) => `// lunora:add:${key}:start`;
@@ -12,6 +12,19 @@ const findDefineSchemaCall = (callExpressions) => {
12
12
  }
13
13
  return void 0;
14
14
  };
15
+ const outermostChainExpression = (defineSchemaCall) => {
16
+ let node = defineSchemaCall;
17
+ for (let parent = node.getParent(); parent !== void 0; parent = node.getParent()) {
18
+ if (Node.isPropertyAccessExpression(parent) && parent.getExpression() === node) {
19
+ node = parent;
20
+ } else if (Node.isCallExpression(parent) && parent.getExpression() === node) {
21
+ node = parent;
22
+ } else {
23
+ break;
24
+ }
25
+ }
26
+ return node;
27
+ };
15
28
  const insertSchemaExtension = (source, key) => {
16
29
  if (!VALID_JS_IDENTIFIER.test(key)) {
17
30
  return { ok: false, reason: "invalid-identifier" };
@@ -33,15 +46,7 @@ const insertSchemaExtension = (source, key) => {
33
46
  if (tablesArgument?.getKind() !== SyntaxKind.ObjectLiteralExpression) {
34
47
  return { ok: false, reason: "non-object-argument" };
35
48
  }
36
- const variableDeclaration = defineSchemaCall.getFirstAncestorByKind(SyntaxKind.VariableDeclaration);
37
- if (!variableDeclaration) {
38
- return { ok: false, reason: "no-define-schema" };
39
- }
40
- const initializer = variableDeclaration.getInitializer();
41
- if (!initializer) {
42
- return { ok: false, reason: "no-define-schema" };
43
- }
44
- const insertAt = initializer.getEnd();
49
+ const insertAt = outermostChainExpression(defineSchemaCall).getEnd();
45
50
  const chainText = `
46
51
  ${startMarker(key)}
47
52
  .extend(${key}.extension)
@@ -1,4 +1,4 @@
1
1
  import 'node:fs';
2
2
  import '@visulima/path';
3
- export { r as runAddCommand, a as runBuildIndexCommand, e as runListCommand, b as runRegistryViewCommand } from './commands-DPKWlqqX.mjs';
3
+ export { r as runAddCommand, a as runBuildIndexCommand, e as runListCommand, b as runRegistryViewCommand } from './commands-DVr4lduS.mjs';
4
4
  import './buildRegistryIndex-BcYe607_.mjs';
@@ -1,4 +1,4 @@
1
- import { s as setBindingField } from './commands-DPKWlqqX.mjs';
1
+ import { s as setBindingField } from './commands-DVr4lduS.mjs';
2
2
 
3
3
  const INVALID_SLUG_CHARS = /[^a-z0-9]+/u;
4
4
  const toKebabSlug = (input, min, max) => {
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { isInteractive, ACCENT, LUNA_ART, LUNA_NAME, LUNA_SIGNOFF, badgeLead, padBadge, badgeWidth } from '@lunora/config';
2
+ import { isInteractive, ACCENT, LUNA_ART, LUNA_NAME, LUNA_SIGNOFF, BADGE_COLUMN_WIDTH, badgeLead, padBadge, badgeWidth } from '@lunora/config';
3
3
  import { render } from '@visulima/tui';
4
4
  import '@visulima/tui/components/big-text';
5
5
  import { Box } from '@visulima/tui/components/box';
@@ -57,7 +57,7 @@ const PromptHeader = ({ badge, message }) => badge === void 0 ? jsx(Text, { bold
57
57
  jsx(Text, { bold: true, children: ` ${message}` })
58
58
  ] });
59
59
  const BODY_INDENT = 2;
60
- const HEADER_INDENT = " ".repeat(6);
60
+ const HEADER_INDENT = " ".repeat(BADGE_COLUMN_WIDTH - 1);
61
61
  const badgeIndent = (badge) => " ".repeat(badgeWidth(badge) + 1);
62
62
  const bodyIndent = (badge) => badge === void 0 ? BODY_INDENT : badgeWidth(badge) + 1;
63
63
  const PromptShell = ({
@@ -449,7 +449,7 @@ const tuiNextSteps = async (badge, header, steps, help) => {
449
449
  ] })
450
450
  );
451
451
  };
452
- const TASK_INDENT = " ".repeat(9);
452
+ const TASK_INDENT = " ".repeat(BADGE_COLUMN_WIDTH - 1);
453
453
  const SPINNER_FIRST = "#a855f7";
454
454
  const SPINNER_LAST = "#06b6d4";
455
455
  const SPINNER_COLORS = [SPINNER_FIRST, "#9b51f6", "#8a5cf6", "#6f86f6", "#4aa6ef", "#2bb6dd", "#12bcd0", SPINNER_LAST];
@@ -465,6 +465,7 @@ const SPINNER_FRAMES = SPINNER_STRIP.map((_, offset) => {
465
465
  const window = SPINNER_STRIP.slice(offset, offset + SPINNER_BAR_WIDTH);
466
466
  return [...window, ...repeatColor(SPINNER_BAR_WIDTH - window.length, SPINNER_FIRST)];
467
467
  });
468
+ const SPINNER_LEAD = " ".repeat(Math.max(0, BADGE_COLUMN_WIDTH - SPINNER_BAR_WIDTH));
468
469
  const GradientSpinner = ({ label }) => {
469
470
  const [index, setIndex] = useState(0);
470
471
  useInterval(() => {
@@ -472,11 +473,12 @@ const GradientSpinner = ({ label }) => {
472
473
  }, 90);
473
474
  const colors = SPINNER_FRAMES[index % SPINNER_FRAMES.length] ?? [];
474
475
  return jsxs(Text, { children: [
476
+ SPINNER_LEAD,
475
477
  colors.map((color, blockIndex) => (
476
478
  // eslint-disable-next-line react-x/no-array-index-key -- fixed-length gradient bar that never reorders.
477
479
  jsx(Text, { color, children: "█" }, blockIndex)
478
480
  )),
479
- ` ${label}`
481
+ ` ${label}`
480
482
  ] });
481
483
  };
482
484
  const TaskRow = ({ label, status }) => {
@@ -536,7 +538,7 @@ const TasksView = ({ end, onSettle, start, tasks }) => {
536
538
  return jsxs(Box, { flexDirection: "column", children: [
537
539
  allDone ? jsxs(Box, { children: [
538
540
  jsx(Text, { bold: true, color: "green", children: `${HEADER_INDENT}✔` }),
539
- jsx(Text, { bold: true, color: "green", children: ` ${end}` })
541
+ jsx(Text, { bold: true, color: "green", children: ` ${end}` })
540
542
  ] }) : jsx(GradientSpinner, { label: start }),
541
543
  tasks.map((task, index) => jsx(TaskRow, { label: task.label, status: statuses[index] ?? "pending" }, task.label))
542
544
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/cli",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.12",
4
4
  "description": "The Lunora CLI: init, dev, deploy, codegen, run, reset, and migrate commands",
5
5
  "keywords": [
6
6
  "agent-skills",
@@ -52,11 +52,11 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@bomb.sh/tab": "0.0.16",
55
- "@lunora/codegen": "1.0.0-alpha.3",
56
- "@lunora/config": "1.0.0-alpha.5",
55
+ "@lunora/codegen": "1.0.0-alpha.4",
56
+ "@lunora/config": "1.0.0-alpha.6",
57
57
  "@lunora/container": "1.0.0-alpha.1",
58
58
  "@lunora/d1": "1.0.0-alpha.4",
59
- "@lunora/seed": "1.0.0-alpha.1",
59
+ "@lunora/seed": "1.0.0-alpha.2",
60
60
  "@visulima/cerebro": "3.0.0-alpha.32",
61
61
  "@visulima/fs": "5.0.0-alpha.32",
62
62
  "@visulima/pail": "4.0.0-alpha.22",