@lunora/cli 1.0.0-alpha.1 → 1.0.0-alpha.3
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/bin.mjs +1 -1
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.mjs +2 -2
- package/dist/packem_chunks/handler.mjs +3 -1
- package/dist/packem_chunks/handler16.mjs +4 -2
- package/dist/packem_chunks/runInitCommand.mjs +10 -34
- package/dist/packem_shared/{COMMANDS-1V_KEx35.mjs → COMMANDS-CHw4zOZ9.mjs} +18 -1
- package/dist/packem_shared/{runAddCommand-BZGkRnBs.mjs → commands-DIQ3nf0C.mjs} +55 -5
- package/dist/packem_shared/runAddCommand-3I3JFZUG.mjs +4 -0
- package/package.json +5 -5
package/dist/bin.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -572,14 +572,22 @@ interface InitCommandOptions {
|
|
|
572
572
|
* and the auth-provider sub-select.
|
|
573
573
|
*/
|
|
574
574
|
prompt?: Pick<OfferDeps, "multiSelect" | "select">;
|
|
575
|
+
/**
|
|
576
|
+
* Override the git ref (branch, tag, or commit) the default template source
|
|
577
|
+
* is fetched from. Takes precedence over the version-derived ref. Ignored
|
|
578
|
+
* when `source` or `from` is set.
|
|
579
|
+
*/
|
|
580
|
+
ref?: string;
|
|
575
581
|
/** Local registry root for the offer's `runAddCommand` (offline / tests). Mirrors `from` but for registry items. */
|
|
576
582
|
registryFrom?: string;
|
|
577
583
|
/** Override the remote registry source base for the offer (default `gh:anolilab/lunora/registry`). */
|
|
578
584
|
registrySource?: string;
|
|
579
585
|
/**
|
|
580
586
|
* Override the remote source giget downloads from. Default:
|
|
581
|
-
* `gh:anolilab/lunora/templates/<templateType
|
|
582
|
-
*
|
|
587
|
+
* `gh:anolilab/lunora/templates/<templateType>#<ref>`, where `<ref>` is
|
|
588
|
+
* the `ref` option when set, else derived from the CLI version (pre-release
|
|
589
|
+
* channels → their branch, stable → `main`). Tests typically use `from`
|
|
590
|
+
* instead to skip the network.
|
|
583
591
|
*/
|
|
584
592
|
source?: string;
|
|
585
593
|
templateType?: Template;
|
|
@@ -707,6 +715,8 @@ interface AddCommandOptions {
|
|
|
707
715
|
out?: string;
|
|
708
716
|
/** Force-overwrite existing files (take the incoming copy) instead of skipping/conflicting. */
|
|
709
717
|
overwrite?: boolean;
|
|
718
|
+
/** Override the git ref (branch, tag, or commit) items are fetched from (default: version-derived); appended to the `source` base when that is set. Ignored when `from` is set. */
|
|
719
|
+
ref?: string;
|
|
710
720
|
/** Override the remote registry source base (default gh:anolilab/lunora/registry). */
|
|
711
721
|
source?: string;
|
|
712
722
|
/** Skip the package.json mutation confirmation prompt. */
|
package/dist/index.d.ts
CHANGED
|
@@ -572,14 +572,22 @@ interface InitCommandOptions {
|
|
|
572
572
|
* and the auth-provider sub-select.
|
|
573
573
|
*/
|
|
574
574
|
prompt?: Pick<OfferDeps, "multiSelect" | "select">;
|
|
575
|
+
/**
|
|
576
|
+
* Override the git ref (branch, tag, or commit) the default template source
|
|
577
|
+
* is fetched from. Takes precedence over the version-derived ref. Ignored
|
|
578
|
+
* when `source` or `from` is set.
|
|
579
|
+
*/
|
|
580
|
+
ref?: string;
|
|
575
581
|
/** Local registry root for the offer's `runAddCommand` (offline / tests). Mirrors `from` but for registry items. */
|
|
576
582
|
registryFrom?: string;
|
|
577
583
|
/** Override the remote registry source base for the offer (default `gh:anolilab/lunora/registry`). */
|
|
578
584
|
registrySource?: string;
|
|
579
585
|
/**
|
|
580
586
|
* Override the remote source giget downloads from. Default:
|
|
581
|
-
* `gh:anolilab/lunora/templates/<templateType
|
|
582
|
-
*
|
|
587
|
+
* `gh:anolilab/lunora/templates/<templateType>#<ref>`, where `<ref>` is
|
|
588
|
+
* the `ref` option when set, else derived from the CLI version (pre-release
|
|
589
|
+
* channels → their branch, stable → `main`). Tests typically use `from`
|
|
590
|
+
* instead to skip the network.
|
|
583
591
|
*/
|
|
584
592
|
source?: string;
|
|
585
593
|
templateType?: Template;
|
|
@@ -707,6 +715,8 @@ interface AddCommandOptions {
|
|
|
707
715
|
out?: string;
|
|
708
716
|
/** Force-overwrite existing files (take the incoming copy) instead of skipping/conflicting. */
|
|
709
717
|
overwrite?: boolean;
|
|
718
|
+
/** Override the git ref (branch, tag, or commit) items are fetched from (default: version-derived); appended to the `source` base when that is set. Ignored when `from` is set. */
|
|
719
|
+
ref?: string;
|
|
710
720
|
/** Override the remote registry source base (default gh:anolilab/lunora/registry). */
|
|
711
721
|
source?: string;
|
|
712
722
|
/** Skip the package.json mutation confirmation prompt. */
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { COMMANDS, VERSION, runCli } from './packem_shared/COMMANDS-
|
|
1
|
+
export { COMMANDS, VERSION, runCli } from './packem_shared/COMMANDS-CHw4zOZ9.mjs';
|
|
2
2
|
export { runCodegenCommand } from './packem_chunks/runCodegenCommand.mjs';
|
|
3
3
|
export { DEFAULT_IMPORT_BATCH_SIZE, runExportCommand, runImportCommand } from './packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs';
|
|
4
4
|
export { runDeployCommand } from './packem_chunks/runDeployCommand.mjs';
|
|
@@ -16,4 +16,4 @@ export { createRecordingSpawner, defaultSpawner } from './packem_shared/defaultS
|
|
|
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 { runAddCommand, runBuildIndexCommand, runRegistryViewCommand } from './packem_shared/
|
|
19
|
+
export { r as runAddCommand, a as runBuildIndexCommand, b as runRegistryViewCommand } from './packem_shared/commands-DIQ3nf0C.mjs';
|
|
@@ -3,7 +3,7 @@ import { findWranglerFile, promptSelect } from '@lunora/config';
|
|
|
3
3
|
import { join } from '@visulima/path';
|
|
4
4
|
import { d as defineHandler } from '../packem_shared/command-BDXcJCCJ.mjs';
|
|
5
5
|
import { n as normalizeFeature, E as EMAIL_ITEM, D as DEFAULT_AUTH_ITEM, p as promptAuthProvider, A as AUTH_PROVIDER_OPTIONS } from '../packem_shared/features-ocSSpZtS.mjs';
|
|
6
|
-
import { runAddCommand } from '../packem_shared/
|
|
6
|
+
import { r as runAddCommand } from '../packem_shared/commands-DIQ3nf0C.mjs';
|
|
7
7
|
|
|
8
8
|
const providerToItem = (provider) => {
|
|
9
9
|
const value = provider.trim().toLowerCase();
|
|
@@ -54,6 +54,7 @@ const runAddFeature = async (options) => {
|
|
|
54
54
|
from: options.from,
|
|
55
55
|
logger: options.logger,
|
|
56
56
|
names: [...items],
|
|
57
|
+
ref: options.ref,
|
|
57
58
|
source: options.source,
|
|
58
59
|
yes: true
|
|
59
60
|
});
|
|
@@ -67,6 +68,7 @@ const execute = defineHandler(async ({ argument, cwd, logger, options }) => {
|
|
|
67
68
|
from: options.from,
|
|
68
69
|
logger,
|
|
69
70
|
provider: options.provider,
|
|
71
|
+
ref: options.ref,
|
|
70
72
|
source: options.source,
|
|
71
73
|
yes: options.yes === true
|
|
72
74
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as defineHandler } from '../packem_shared/command-BDXcJCCJ.mjs';
|
|
2
|
-
import { runAddCommand, runRegistryViewCommand, runBuildIndexCommand } from '../packem_shared/
|
|
2
|
+
import { r as runAddCommand, b as runRegistryViewCommand, a as runBuildIndexCommand } from '../packem_shared/commands-DIQ3nf0C.mjs';
|
|
3
3
|
|
|
4
4
|
const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
5
5
|
const subcommand = argument[0];
|
|
@@ -15,12 +15,13 @@ 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({
|
|
@@ -28,6 +29,7 @@ const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
|
28
29
|
from: options.from,
|
|
29
30
|
logger,
|
|
30
31
|
names,
|
|
32
|
+
ref: options.ref,
|
|
31
33
|
source: options.source
|
|
32
34
|
});
|
|
33
35
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync, readdirSync, mkdtempSync, rmSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
3
|
import { detectFramework as detectFramework$1, isInteractive, promptSelect, promptMultiSelect } from '@lunora/config';
|
|
5
4
|
import { walkSync } from '@visulima/fs';
|
|
6
5
|
import { resolve, join as join$1, relative, dirname as dirname$1 } from '@visulima/path';
|
|
@@ -9,8 +8,8 @@ import { join, dirname } from 'node:path';
|
|
|
9
8
|
import { d as defineHandler } from '../packem_shared/command-BDXcJCCJ.mjs';
|
|
10
9
|
import MagicString from 'magic-string';
|
|
11
10
|
import { Project, SyntaxKind } from 'ts-morph';
|
|
11
|
+
import { c as resolveSourceRef, r as runAddCommand } from '../packem_shared/commands-DIQ3nf0C.mjs';
|
|
12
12
|
import { p as promptAuthProvider, E as EMAIL_ITEM } from '../packem_shared/features-ocSSpZtS.mjs';
|
|
13
|
-
import { runAddCommand } from '../packem_shared/runAddCommand-BZGkRnBs.mjs';
|
|
14
13
|
|
|
15
14
|
const GITHUB_CONTENT = `name: Deploy
|
|
16
15
|
|
|
@@ -324,32 +323,6 @@ export const send = mutation
|
|
|
324
323
|
});
|
|
325
324
|
`;
|
|
326
325
|
const DEFAULT_SOURCE_BASE = "gh:anolilab/lunora/templates";
|
|
327
|
-
const DEFAULT_SOURCE_REF_FALLBACK = "alpha";
|
|
328
|
-
const resolveCliVersion = () => {
|
|
329
|
-
try {
|
|
330
|
-
let directory = dirname$1(fileURLToPath(import.meta.url));
|
|
331
|
-
for (let index = 0; index < 5; index += 1) {
|
|
332
|
-
const candidate = join$1(directory, "package.json");
|
|
333
|
-
if (existsSync(candidate)) {
|
|
334
|
-
const parsed = JSON.parse(readFileSync(candidate, "utf8"));
|
|
335
|
-
if (parsed.name === "@lunora/cli" && typeof parsed.version === "string") {
|
|
336
|
-
return parsed.version;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
const parent = dirname$1(directory);
|
|
340
|
-
if (parent === directory) {
|
|
341
|
-
break;
|
|
342
|
-
}
|
|
343
|
-
directory = parent;
|
|
344
|
-
}
|
|
345
|
-
} catch {
|
|
346
|
-
}
|
|
347
|
-
return "0.0.0";
|
|
348
|
-
};
|
|
349
|
-
const resolveDefaultSourceRef = () => {
|
|
350
|
-
const version = resolveCliVersion();
|
|
351
|
-
return version === "0.0.0" ? DEFAULT_SOURCE_REF_FALLBACK : `v${version}`;
|
|
352
|
-
};
|
|
353
326
|
const isTextFile = (filePath) => {
|
|
354
327
|
const lastDot = filePath.lastIndexOf(".");
|
|
355
328
|
if (lastDot === -1) {
|
|
@@ -383,11 +356,11 @@ const copyTemplate = (sourceDirectory, target, name) => {
|
|
|
383
356
|
}
|
|
384
357
|
return written;
|
|
385
358
|
};
|
|
386
|
-
const resolveTemplateSource = (templateType, source) => {
|
|
359
|
+
const resolveTemplateSource = (templateType, source, ref) => {
|
|
387
360
|
if (source !== void 0 && source.length > 0) {
|
|
388
361
|
return source;
|
|
389
362
|
}
|
|
390
|
-
return `${DEFAULT_SOURCE_BASE}/${templateType}#${
|
|
363
|
+
return `${DEFAULT_SOURCE_BASE}/${templateType}#${resolveSourceRef(ref)}`;
|
|
391
364
|
};
|
|
392
365
|
const isSafeSource = (source) => {
|
|
393
366
|
if (source.includes("..")) {
|
|
@@ -412,11 +385,12 @@ const scaffoldFromLocal = (fromRoot, templateType, target, name, logger) => {
|
|
|
412
385
|
logScaffoldSuccess(logger, written, target, name);
|
|
413
386
|
return { code: 0, files: written, target };
|
|
414
387
|
};
|
|
415
|
-
const scaffoldFromRemote = async (
|
|
388
|
+
const scaffoldFromRemote = async (options) => {
|
|
389
|
+
const { logger, name, ref, source, target, templateType } = options;
|
|
416
390
|
const stagingRoot = mkdtempSync(join$1(tmpdir(), "lunora-init-fetch-"));
|
|
417
391
|
const stagingDirectory = join$1(stagingRoot, "template");
|
|
418
392
|
try {
|
|
419
|
-
const remote = resolveTemplateSource(templateType, source);
|
|
393
|
+
const remote = resolveTemplateSource(templateType, source, ref);
|
|
420
394
|
logger.info(`fetching template from ${remote}`);
|
|
421
395
|
const downloaded = await downloadTemplate(remote, {
|
|
422
396
|
cwd: stagingRoot,
|
|
@@ -566,6 +540,7 @@ const maybeOfferExtras = async (options, projectDirectory) => {
|
|
|
566
540
|
from: options.registryFrom,
|
|
567
541
|
logger: options.logger,
|
|
568
542
|
names: [...names],
|
|
543
|
+
ref: options.ref,
|
|
569
544
|
source: options.registrySource,
|
|
570
545
|
yes: true
|
|
571
546
|
});
|
|
@@ -607,7 +582,7 @@ const scaffoldNewProject = async (options, cwd) => {
|
|
|
607
582
|
);
|
|
608
583
|
return { code: 1, files: [], target };
|
|
609
584
|
}
|
|
610
|
-
return scaffoldFromRemote(options.
|
|
585
|
+
return scaffoldFromRemote({ logger: options.logger, name, ref: options.ref, source: options.source, target, templateType });
|
|
611
586
|
};
|
|
612
587
|
const runInitCommand = async (options) => {
|
|
613
588
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -643,10 +618,11 @@ const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
|
643
618
|
interactive: options.interactive === true ? true : void 0,
|
|
644
619
|
logger,
|
|
645
620
|
name: argument[0],
|
|
621
|
+
ref: options.ref,
|
|
646
622
|
source: options.source,
|
|
647
623
|
templateType: template,
|
|
648
624
|
yes: options.yes === true
|
|
649
625
|
});
|
|
650
626
|
});
|
|
651
627
|
|
|
652
|
-
export { execute, isTemplate, runInitCommand };
|
|
628
|
+
export { execute, isTemplate, resolveTemplateSource, runInitCommand };
|
|
@@ -15,7 +15,8 @@ const addCommand = {
|
|
|
15
15
|
["lunora add auth --provider clerk", "Add Clerk auth without prompting"],
|
|
16
16
|
["lunora add email", "Add transactional email (Cloudflare Email Workers + dev mail catcher)"],
|
|
17
17
|
["lunora add storage", "Add the R2 storage registry item"],
|
|
18
|
-
["lunora add crons", "Add the scheduled-jobs registry item"]
|
|
18
|
+
["lunora add crons", "Add the scheduled-jobs registry item"],
|
|
19
|
+
["lunora add storage --ref alpha", "Add an item from the alpha branch's registry"]
|
|
19
20
|
],
|
|
20
21
|
group: "Project",
|
|
21
22
|
loader: () => import('../packem_chunks/handler.mjs').then((m) => {
|
|
@@ -27,6 +28,11 @@ const addCommand = {
|
|
|
27
28
|
{ description: "Skip the provider prompt and use the default (email & password)", name: "yes", type: Boolean },
|
|
28
29
|
{ description: "Local registry root (offline; expects <name>/ subdirs)", name: "from", type: String },
|
|
29
30
|
{ description: "Override the remote registry source base (e.g. gh:owner/repo/registry)", name: "source", type: String },
|
|
31
|
+
{
|
|
32
|
+
description: "Fetch items from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",
|
|
33
|
+
name: "ref",
|
|
34
|
+
type: String
|
|
35
|
+
},
|
|
30
36
|
{ description: "Permit --source values outside gh:/github:/https://", name: "allow-unsafe-source", type: Boolean }
|
|
31
37
|
]
|
|
32
38
|
};
|
|
@@ -342,6 +348,7 @@ const initCommand = {
|
|
|
342
348
|
["lunora init my-app", "Scaffold with the default (vite) template"],
|
|
343
349
|
["lunora init my-app -t tanstack-start-react", "Scaffold a TanStack Start (React) app"],
|
|
344
350
|
["lunora init my-app -t tanstack-start-solid", "Scaffold a TanStack Start (Solid) app"],
|
|
351
|
+
["lunora init my-app --ref alpha", "Scaffold from the alpha branch's templates"],
|
|
345
352
|
["lunora init --here", "Add Lunora to the current project"],
|
|
346
353
|
["lunora init my-app --ci github", "Scaffold + add a GitHub Actions deploy pipeline"],
|
|
347
354
|
["lunora init my-app --ci gitlab", "Scaffold + add a GitLab CI deploy pipeline"]
|
|
@@ -369,6 +376,11 @@ const initCommand = {
|
|
|
369
376
|
name: "source",
|
|
370
377
|
type: String
|
|
371
378
|
},
|
|
379
|
+
{
|
|
380
|
+
description: "Fetch templates from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",
|
|
381
|
+
name: "ref",
|
|
382
|
+
type: String
|
|
383
|
+
},
|
|
372
384
|
{
|
|
373
385
|
description: "Permit --source values outside gh:/github:/https:// (e.g. local file://)",
|
|
374
386
|
name: "allow-unsafe-source",
|
|
@@ -541,6 +553,11 @@ const registryCommand = {
|
|
|
541
553
|
{ description: "add: skip the package.json mutation confirmation prompt", name: "yes", type: Boolean },
|
|
542
554
|
{ description: "Local registry root (offline; expects <name>/ subdirs)", name: "from", type: String },
|
|
543
555
|
{ description: "Override the remote registry source base (e.g. gh:owner/repo/registry)", name: "source", type: String },
|
|
556
|
+
{
|
|
557
|
+
description: "Fetch items from a git ref (branch, tag, or commit), e.g. --ref alpha. Overrides the version-derived default",
|
|
558
|
+
name: "ref",
|
|
559
|
+
type: String
|
|
560
|
+
},
|
|
544
561
|
{ description: "Permit --source values outside gh:/github:/https://", name: "allow-unsafe-source", type: Boolean },
|
|
545
562
|
{ description: "Emit JSON output (add plan / list)", name: "json", type: Boolean },
|
|
546
563
|
{ description: "build: output path for the catalog (default <root>/index.json)", name: "out", type: String },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs';
|
|
2
|
-
import {
|
|
2
|
+
import { dirname, join } from '@visulima/path';
|
|
3
3
|
import { DEV_VARS_FILE, parseDevVariableEntries, promptYesNo } from '@lunora/config';
|
|
4
4
|
import { modify, applyEdits, parse } from 'jsonc-parser';
|
|
5
5
|
import { collectCatalog, buildRegistryIndex } from './buildRegistryIndex-BcYe607_.mjs';
|
|
@@ -7,8 +7,59 @@ import { insertSchemaExtension } from './insertSchemaExtension-BuzF6-t2.mjs';
|
|
|
7
7
|
import { createHash } from 'node:crypto';
|
|
8
8
|
import { tmpdir } from 'node:os';
|
|
9
9
|
import { downloadTemplate } from 'giget';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
10
11
|
import parseManifest from './parseManifest--vZf2FY1.mjs';
|
|
11
12
|
|
|
13
|
+
const DEFAULT_SOURCE_REF_FALLBACK = "alpha";
|
|
14
|
+
const STABLE_BRANCH = "main";
|
|
15
|
+
const PRERELEASE_CHANNEL_BRANCHES = /* @__PURE__ */ new Set(["alpha", "beta", "next"]);
|
|
16
|
+
const SAFE_REF = /^[\w./@-]+$/;
|
|
17
|
+
const isSafeRef = (ref) => !ref.includes("..") && SAFE_REF.test(ref);
|
|
18
|
+
const resolveCliVersion = () => {
|
|
19
|
+
try {
|
|
20
|
+
let directory = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
for (let index = 0; index < 6; index += 1) {
|
|
22
|
+
const candidate = join(directory, "package.json");
|
|
23
|
+
if (existsSync(candidate)) {
|
|
24
|
+
const parsed = JSON.parse(readFileSync(candidate, "utf8"));
|
|
25
|
+
if (parsed.name === "@lunora/cli" && typeof parsed.version === "string") {
|
|
26
|
+
return parsed.version;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const parent = dirname(directory);
|
|
30
|
+
if (parent === directory) {
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
directory = parent;
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
return "0.0.0";
|
|
38
|
+
};
|
|
39
|
+
const resolveVersionRef = (version) => {
|
|
40
|
+
if (version === "0.0.0") {
|
|
41
|
+
return DEFAULT_SOURCE_REF_FALLBACK;
|
|
42
|
+
}
|
|
43
|
+
const core = version.split("+")[0] ?? version;
|
|
44
|
+
const dashIndex = core.indexOf("-");
|
|
45
|
+
if (dashIndex !== -1) {
|
|
46
|
+
const [channel] = core.slice(dashIndex + 1).split(".");
|
|
47
|
+
if (channel !== void 0 && PRERELEASE_CHANNEL_BRANCHES.has(channel)) {
|
|
48
|
+
return channel;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return STABLE_BRANCH;
|
|
52
|
+
};
|
|
53
|
+
const resolveSourceRef = (ref) => {
|
|
54
|
+
if (ref !== void 0 && ref.length > 0) {
|
|
55
|
+
if (!isSafeRef(ref)) {
|
|
56
|
+
throw new Error(`invalid --ref "${ref}" — a ref may contain letters, digits, ".", "_", "-", "/", "@" and must not contain "..".`);
|
|
57
|
+
}
|
|
58
|
+
return ref;
|
|
59
|
+
}
|
|
60
|
+
return resolveVersionRef(resolveCliVersion());
|
|
61
|
+
};
|
|
62
|
+
|
|
12
63
|
const applyDeps = (deps, projectRoot, logger, section = "dependencies") => {
|
|
13
64
|
const entries = Object.entries(deps);
|
|
14
65
|
if (entries.length === 0) {
|
|
@@ -379,7 +430,6 @@ const reconcileItems = (items, cwd, logger, reconcileOptions = {}) => {
|
|
|
379
430
|
};
|
|
380
431
|
|
|
381
432
|
const DEFAULT_SOURCE_BASE = "gh:anolilab/lunora/registry";
|
|
382
|
-
const DEFAULT_SOURCE_REF = "alpha";
|
|
383
433
|
const VALID_ITEM_NAME = /^[A-Za-z0-9][\w-]*$/u;
|
|
384
434
|
const assertSafeItemName = (name) => {
|
|
385
435
|
if (!VALID_ITEM_NAME.test(name)) {
|
|
@@ -431,7 +481,7 @@ const resolveItemDirectory = async (name, options) => {
|
|
|
431
481
|
}, directory };
|
|
432
482
|
}
|
|
433
483
|
const base = options.source ?? DEFAULT_SOURCE_BASE;
|
|
434
|
-
return fetchToStaging(`${base}/${name}#${
|
|
484
|
+
return fetchToStaging(`${base}/${name}#${resolveSourceRef(options.ref)}`, "item", options.logger);
|
|
435
485
|
};
|
|
436
486
|
const resolveRegistryRoot = async (options) => {
|
|
437
487
|
if (options.from !== void 0) {
|
|
@@ -442,7 +492,7 @@ const resolveRegistryRoot = async (options) => {
|
|
|
442
492
|
}, root: options.from };
|
|
443
493
|
}
|
|
444
494
|
const base = options.source ?? DEFAULT_SOURCE_BASE;
|
|
445
|
-
const { cleanup, directory } = await fetchToStaging(`${base}#${
|
|
495
|
+
const { cleanup, directory } = await fetchToStaging(`${base}#${resolveSourceRef(options.ref)}`, "registry", options.logger);
|
|
446
496
|
return { cleanup, root: directory };
|
|
447
497
|
};
|
|
448
498
|
const readManifest = (itemDirectory, name) => {
|
|
@@ -690,4 +740,4 @@ const runBuildIndexCommand = async (options) => {
|
|
|
690
740
|
return empty;
|
|
691
741
|
};
|
|
692
742
|
|
|
693
|
-
export {
|
|
743
|
+
export { runBuildIndexCommand as a, runRegistryViewCommand as b, resolveSourceRef as c, runListCommand as d, runAddCommand 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.3",
|
|
4
4
|
"description": "The Lunora CLI: init, dev, deploy, codegen, run, reset, and migrate commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-skills",
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@bomb.sh/tab": "0.0.17",
|
|
55
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
56
|
-
"@lunora/config": "1.0.0-alpha.
|
|
55
|
+
"@lunora/codegen": "1.0.0-alpha.2",
|
|
56
|
+
"@lunora/config": "1.0.0-alpha.3",
|
|
57
57
|
"@lunora/container": "1.0.0-alpha.1",
|
|
58
|
-
"@lunora/d1": "1.0.0-alpha.
|
|
58
|
+
"@lunora/d1": "1.0.0-alpha.3",
|
|
59
59
|
"@lunora/seed": "1.0.0-alpha.1",
|
|
60
60
|
"@lunora/server": "1.0.0-alpha.1",
|
|
61
|
-
"@lunora/studio": "1.0.0-alpha.
|
|
61
|
+
"@lunora/studio": "1.0.0-alpha.2",
|
|
62
62
|
"@lunora/values": "1.0.0-alpha.1",
|
|
63
63
|
"@visulima/cerebro": "3.0.0-alpha.32",
|
|
64
64
|
"@visulima/fs": "5.0.0-alpha.32",
|