lism-cli 0.0.1 → 0.3.0
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 +21 -0
- package/README.md +16 -16
- package/dist/chunk-5ULZ7QME.js +616 -0
- package/dist/index.js +91 -81
- package/dist/lib.d.ts +430 -1
- package/dist/lib.js +9 -3
- package/package.json +28 -10
- package/dist/chunk-4TQG5MGT.js +0 -137
package/dist/index.js
CHANGED
|
@@ -9,8 +9,11 @@ import {
|
|
|
9
9
|
UI_HELPER_PATH,
|
|
10
10
|
UI_REGISTRY_INDEX_PATH,
|
|
11
11
|
createCommand,
|
|
12
|
-
logger
|
|
13
|
-
|
|
12
|
+
logger,
|
|
13
|
+
preScanLang,
|
|
14
|
+
setLang,
|
|
15
|
+
t
|
|
16
|
+
} from "./chunk-5ULZ7QME.js";
|
|
14
17
|
|
|
15
18
|
// src/createProgram.ts
|
|
16
19
|
import { Command as Command3 } from "commander";
|
|
@@ -51,10 +54,10 @@ function getDefaultConfigPath() {
|
|
|
51
54
|
async function readConfig() {
|
|
52
55
|
const found = findConfigFile();
|
|
53
56
|
if (!found) {
|
|
54
|
-
throw new Error("
|
|
57
|
+
throw new Error(t("config.notFound"));
|
|
55
58
|
}
|
|
56
59
|
if (found.kind === "legacy-json") {
|
|
57
|
-
logger.warn(
|
|
60
|
+
logger.warn(t("config.legacyWarning", { filename: LEGACY_CONFIG_FILE }));
|
|
58
61
|
const raw = fs.readFileSync(found.path, "utf-8");
|
|
59
62
|
const parsed = JSON.parse(raw);
|
|
60
63
|
return parsed;
|
|
@@ -63,7 +66,7 @@ async function readConfig() {
|
|
|
63
66
|
const mod = await jiti.import(found.path);
|
|
64
67
|
const cli = mod?.cli ?? mod;
|
|
65
68
|
if (!cli || typeof cli !== "object") {
|
|
66
|
-
throw new Error(
|
|
69
|
+
throw new Error(t("config.cliSectionMissing", { filename: found.filename }));
|
|
67
70
|
}
|
|
68
71
|
validateCliConfig(cli);
|
|
69
72
|
return cli;
|
|
@@ -71,13 +74,13 @@ async function readConfig() {
|
|
|
71
74
|
function validateCliConfig(cli) {
|
|
72
75
|
const c = cli;
|
|
73
76
|
if (c.framework !== "react" && c.framework !== "astro") {
|
|
74
|
-
throw new Error(
|
|
77
|
+
throw new Error(t("config.invalidFramework"));
|
|
75
78
|
}
|
|
76
79
|
if (typeof c.componentsDir !== "string" || !c.componentsDir) {
|
|
77
|
-
throw new Error("
|
|
80
|
+
throw new Error(t("config.invalidComponentsDir"));
|
|
78
81
|
}
|
|
79
82
|
if (typeof c.helperDir !== "string" || !c.helperDir) {
|
|
80
|
-
throw new Error("
|
|
83
|
+
throw new Error(t("config.invalidHelperDir"));
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
function writeFreshConfig(cli) {
|
|
@@ -92,7 +95,7 @@ async function hasCliSection(filePath) {
|
|
|
92
95
|
const mod = await jiti.import(filePath);
|
|
93
96
|
return !!mod?.cli;
|
|
94
97
|
} catch (err) {
|
|
95
|
-
throw new Error(
|
|
98
|
+
throw new Error(t("config.loadFailed", { path: filePath, reason: String(err) }));
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
async function patchConfigWithCli(cli, targetPath, options = {}) {
|
|
@@ -361,18 +364,18 @@ async function fetchHelper(name, options = {}) {
|
|
|
361
364
|
import { select, input } from "@inquirer/prompts";
|
|
362
365
|
async function runInit(options = {}) {
|
|
363
366
|
const framework = options.framework ?? await select({
|
|
364
|
-
message: "
|
|
367
|
+
message: t("ui.init.promptFramework"),
|
|
365
368
|
choices: [
|
|
366
369
|
{ name: "React", value: "react" },
|
|
367
370
|
{ name: "Astro", value: "astro" }
|
|
368
371
|
]
|
|
369
372
|
});
|
|
370
373
|
const componentsDir = options.componentsDir ?? await input({
|
|
371
|
-
message: "
|
|
374
|
+
message: t("ui.init.promptComponentsDir"),
|
|
372
375
|
default: "src/components/ui"
|
|
373
376
|
});
|
|
374
377
|
const helperDir = options.helperDir ?? await input({
|
|
375
|
-
message: "
|
|
378
|
+
message: t("ui.init.promptHelperDir"),
|
|
376
379
|
default: `${componentsDir}/_helper`
|
|
377
380
|
});
|
|
378
381
|
const config = { framework, componentsDir, helperDir };
|
|
@@ -383,13 +386,13 @@ async function runInit(options = {}) {
|
|
|
383
386
|
existingCli: options.existingCli
|
|
384
387
|
});
|
|
385
388
|
if (patched) {
|
|
386
|
-
logger.success(
|
|
389
|
+
logger.success(t(options.force ? "ui.init.patchedUpdate" : "ui.init.patchedAdd", { path: outPath }));
|
|
387
390
|
} else {
|
|
388
|
-
logger.warn(
|
|
391
|
+
logger.warn(t("ui.init.notPatched", { path: outPath }));
|
|
389
392
|
}
|
|
390
393
|
} else {
|
|
391
394
|
const outPath = writeFreshConfig(config);
|
|
392
|
-
logger.success(
|
|
395
|
+
logger.success(t("ui.init.created", { path: outPath }));
|
|
393
396
|
}
|
|
394
397
|
return config;
|
|
395
398
|
}
|
|
@@ -397,7 +400,7 @@ async function initCommand(options) {
|
|
|
397
400
|
const found = findConfigFile();
|
|
398
401
|
let existingCli = false;
|
|
399
402
|
if (found?.kind === "legacy-json") {
|
|
400
|
-
logger.warn(
|
|
403
|
+
logger.warn(t("ui.init.legacyDetected", { filename: found.filename }));
|
|
401
404
|
} else if (found?.kind === "module") {
|
|
402
405
|
try {
|
|
403
406
|
existingCli = await hasCliSection(found.path);
|
|
@@ -407,10 +410,10 @@ async function initCommand(options) {
|
|
|
407
410
|
}
|
|
408
411
|
if (existingCli) {
|
|
409
412
|
if (!options.force) {
|
|
410
|
-
logger.warn(
|
|
413
|
+
logger.warn(t("ui.init.alreadyExists", { filename: found.filename }));
|
|
411
414
|
return;
|
|
412
415
|
}
|
|
413
|
-
logger.warn(
|
|
416
|
+
logger.warn(t("ui.init.willOverwrite", { filename: found.filename }));
|
|
414
417
|
}
|
|
415
418
|
}
|
|
416
419
|
await runInit({ ...options, existingCli });
|
|
@@ -425,7 +428,7 @@ async function addCommand(names, options) {
|
|
|
425
428
|
if (configExists()) {
|
|
426
429
|
config = await readConfig();
|
|
427
430
|
} else {
|
|
428
|
-
logger.info("
|
|
431
|
+
logger.info(t("ui.add.noConfig"));
|
|
429
432
|
config = await runInit();
|
|
430
433
|
console.log();
|
|
431
434
|
}
|
|
@@ -436,15 +439,15 @@ async function addCommand(names, options) {
|
|
|
436
439
|
} catch (err) {
|
|
437
440
|
const refInfo = options.ref ? ` (ref: ${options.ref})` : "";
|
|
438
441
|
const reason = err instanceof Error ? err.message : String(err);
|
|
439
|
-
logger.error(
|
|
442
|
+
logger.error(t("ui.catalogFailed", { refInfo, reason }));
|
|
440
443
|
process.exit(1);
|
|
441
444
|
}
|
|
442
445
|
if (options.all) {
|
|
443
446
|
names = catalog.components.map((c) => c.name);
|
|
444
|
-
logger.info(
|
|
447
|
+
logger.info(t("ui.add.addingAll", { count: names.length }));
|
|
445
448
|
}
|
|
446
449
|
if (names.length === 0) {
|
|
447
|
-
logger.error("
|
|
450
|
+
logger.error(t("ui.add.specifyName"));
|
|
448
451
|
process.exit(1);
|
|
449
452
|
}
|
|
450
453
|
const resolvedNames = [];
|
|
@@ -456,7 +459,7 @@ async function addCommand(names, options) {
|
|
|
456
459
|
else notFound.push(input2);
|
|
457
460
|
}
|
|
458
461
|
if (notFound.length > 0) {
|
|
459
|
-
logger.error(
|
|
462
|
+
logger.error(t("ui.add.notFound", { list: notFound.join(", ") }));
|
|
460
463
|
process.exit(1);
|
|
461
464
|
}
|
|
462
465
|
const excludeRootFiles = new Set(catalog.excludeComponentFiles);
|
|
@@ -471,7 +474,7 @@ async function addCommand(names, options) {
|
|
|
471
474
|
for (let i = 0; i < resolvedNames.length; i++) {
|
|
472
475
|
const result = results[i];
|
|
473
476
|
if (result.status === "rejected") {
|
|
474
|
-
logger.error(
|
|
477
|
+
logger.error(t("ui.add.componentFetchFailed", { name: resolvedNames[i], reason: String(result.reason) }));
|
|
475
478
|
hasFailure = true;
|
|
476
479
|
continue;
|
|
477
480
|
}
|
|
@@ -479,31 +482,31 @@ async function addCommand(names, options) {
|
|
|
479
482
|
if (helperFailed) hasFailure = true;
|
|
480
483
|
}
|
|
481
484
|
if (hasFailure) {
|
|
482
|
-
logger.error("
|
|
485
|
+
logger.error(t("ui.add.someFailed"));
|
|
483
486
|
process.exit(1);
|
|
484
487
|
}
|
|
485
|
-
logger.success("
|
|
488
|
+
logger.success(t("common.done"));
|
|
486
489
|
}
|
|
487
490
|
async function askOverwritePolicy() {
|
|
488
491
|
return select2({
|
|
489
|
-
message: "
|
|
492
|
+
message: t("ui.add.promptOverwritePolicy"),
|
|
490
493
|
choices: [
|
|
491
|
-
{ name: "
|
|
492
|
-
{ name: "
|
|
493
|
-
{ name: "
|
|
494
|
+
{ name: t("ui.add.policyAll"), value: "all" },
|
|
495
|
+
{ name: t("ui.add.policyNone"), value: "none" },
|
|
496
|
+
{ name: t("ui.add.policyPerComponent"), value: "per-component" }
|
|
494
497
|
]
|
|
495
498
|
});
|
|
496
499
|
}
|
|
497
500
|
function writeFile(filePath, content) {
|
|
498
501
|
fs3.mkdirSync(path4.dirname(filePath), { recursive: true });
|
|
499
502
|
fs3.writeFileSync(filePath, content);
|
|
500
|
-
logger.log(
|
|
503
|
+
logger.log(t("ui.add.created", { path: path4.relative(process.cwd(), filePath) }));
|
|
501
504
|
}
|
|
502
505
|
function hasExistingFiles(files, baseDir) {
|
|
503
506
|
return files.some((f) => fs3.existsSync(path4.join(baseDir, f.path)));
|
|
504
507
|
}
|
|
505
508
|
async function writeComponent(component, config, overwriteAll, policy, installedHelpers, fetchOpts) {
|
|
506
|
-
logger.info(
|
|
509
|
+
logger.info(t("ui.add.deploying", { name: component.name }));
|
|
507
510
|
const filesToWrite = [...component.files.shared, ...component.files[config.framework]];
|
|
508
511
|
const componentDirName = component.name;
|
|
509
512
|
const componentDir = path4.resolve(process.cwd(), config.componentsDir, componentDirName);
|
|
@@ -518,14 +521,14 @@ async function writeComponent(component, config, overwriteAll, policy, installed
|
|
|
518
521
|
shouldWrite = false;
|
|
519
522
|
} else if (policy === "per-component") {
|
|
520
523
|
shouldWrite = await confirm({
|
|
521
|
-
message:
|
|
524
|
+
message: t("ui.add.confirmOverwriteComponent", { name: componentDirName }),
|
|
522
525
|
default: false
|
|
523
526
|
});
|
|
524
527
|
} else {
|
|
525
528
|
shouldWrite = true;
|
|
526
529
|
}
|
|
527
530
|
if (!shouldWrite) {
|
|
528
|
-
logger.log(
|
|
531
|
+
logger.log(t("ui.add.skippedComponent", { name: componentDirName }));
|
|
529
532
|
} else {
|
|
530
533
|
for (const file of filesToWrite) {
|
|
531
534
|
const filePath = path4.join(componentDir, file.path);
|
|
@@ -541,7 +544,7 @@ async function writeComponent(component, config, overwriteAll, policy, installed
|
|
|
541
544
|
for (let i = 0; i < helpersToInstall.length; i++) {
|
|
542
545
|
const result = helperResults[i];
|
|
543
546
|
if (result.status === "rejected") {
|
|
544
|
-
logger.error(
|
|
547
|
+
logger.error(t("ui.add.helperFetchFailed", { name: helpersToInstall[i], reason: String(result.reason) }));
|
|
545
548
|
helperFailed = true;
|
|
546
549
|
continue;
|
|
547
550
|
}
|
|
@@ -549,16 +552,16 @@ async function writeComponent(component, config, overwriteAll, policy, installed
|
|
|
549
552
|
const filePath = path4.join(helperDir, file.path);
|
|
550
553
|
if (fs3.existsSync(filePath) && !overwriteAll) {
|
|
551
554
|
if (policy === "none") {
|
|
552
|
-
logger.log(
|
|
555
|
+
logger.log(t("ui.add.skippedFile", { path: file.path }));
|
|
553
556
|
continue;
|
|
554
557
|
}
|
|
555
558
|
if (policy === "per-component") {
|
|
556
559
|
const shouldOverwrite = await confirm({
|
|
557
|
-
message:
|
|
560
|
+
message: t("ui.add.confirmOverwriteFile", { path: path4.relative(process.cwd(), filePath) }),
|
|
558
561
|
default: false
|
|
559
562
|
});
|
|
560
563
|
if (!shouldOverwrite) {
|
|
561
|
-
logger.log(
|
|
564
|
+
logger.log(t("ui.add.skippedFile", { path: file.path }));
|
|
562
565
|
continue;
|
|
563
566
|
}
|
|
564
567
|
}
|
|
@@ -572,7 +575,7 @@ async function writeComponent(component, config, overwriteAll, policy, installed
|
|
|
572
575
|
|
|
573
576
|
// src/commands/ui/list.ts
|
|
574
577
|
async function listCommand(options = {}) {
|
|
575
|
-
logger.info("
|
|
578
|
+
logger.info(t("ui.list.fetching"));
|
|
576
579
|
const fetchOpts = { ref: options.ref };
|
|
577
580
|
let catalog;
|
|
578
581
|
try {
|
|
@@ -580,27 +583,27 @@ async function listCommand(options = {}) {
|
|
|
580
583
|
} catch (err) {
|
|
581
584
|
const refInfo = options.ref ? ` (ref: ${options.ref})` : "";
|
|
582
585
|
const reason = err instanceof Error ? err.message : String(err);
|
|
583
|
-
logger.error(
|
|
586
|
+
logger.error(t("ui.catalogFailed", { refInfo, reason }));
|
|
584
587
|
process.exit(1);
|
|
585
588
|
}
|
|
586
589
|
logger.log(`
|
|
587
590
|
Lism UI v${catalog.version}
|
|
588
591
|
`);
|
|
589
|
-
logger.log("
|
|
592
|
+
logger.log(t("ui.list.header"));
|
|
590
593
|
for (const component of catalog.components) {
|
|
591
594
|
const helpers = component.helpers.length > 0 ? ` (helpers: ${component.helpers.join(", ")})` : "";
|
|
592
595
|
logger.log(` - ${component.name}${helpers}`);
|
|
593
596
|
}
|
|
594
597
|
logger.log(`
|
|
595
|
-
|
|
598
|
+
${t("ui.list.total", { count: catalog.components.length })}`);
|
|
596
599
|
}
|
|
597
600
|
|
|
598
601
|
// src/commands/ui/index.ts
|
|
599
602
|
function createUiCommand() {
|
|
600
|
-
const ui = new Command("ui").description("
|
|
601
|
-
ui.command("init").description("
|
|
602
|
-
ui.command("add").description("
|
|
603
|
-
ui.command("list").description("
|
|
603
|
+
const ui = new Command("ui").description(t("cli.ui.description"));
|
|
604
|
+
ui.command("init").description(t("cli.ui.init.description")).addOption(new Option("--framework <name>", t("cli.ui.init.opt.framework")).choices(["react", "astro"])).option("--components-dir <path>", t("cli.ui.init.opt.componentsDir")).option("--helper-dir <path>", t("cli.ui.init.opt.helperDir")).option("-f, --force", t("cli.ui.init.opt.force"), false).action(initCommand);
|
|
605
|
+
ui.command("add").description(t("cli.ui.add.description")).argument("[names...]", t("cli.ui.add.arg.names")).option("-o, --overwrite", t("cli.ui.add.opt.overwrite"), false).option("-a, --all", t("cli.ui.add.opt.all"), false).option("--ref <ref>", t("cli.ui.opt.ref")).action(addCommand);
|
|
606
|
+
ui.command("list").description(t("cli.ui.list.description")).option("--ref <ref>", t("cli.ui.opt.ref")).action(listCommand);
|
|
604
607
|
return ui;
|
|
605
608
|
}
|
|
606
609
|
|
|
@@ -717,7 +720,7 @@ function copyDirRecursive(src, dest) {
|
|
|
717
720
|
// src/commands/skill/add.ts
|
|
718
721
|
function resolveExplicitTools(options) {
|
|
719
722
|
if (options.all) return [...ALL_SKILL_TOOLS];
|
|
720
|
-
const explicit = ALL_SKILL_TOOLS.filter((
|
|
723
|
+
const explicit = ALL_SKILL_TOOLS.filter((t2) => options[t2]);
|
|
721
724
|
return explicit;
|
|
722
725
|
}
|
|
723
726
|
function autoDetectTools(cwd) {
|
|
@@ -729,29 +732,29 @@ async function skillAddCommand(options) {
|
|
|
729
732
|
if (targets.length === 0) {
|
|
730
733
|
const detected = autoDetectTools(cwd);
|
|
731
734
|
if (detected.length > 0) {
|
|
732
|
-
logger.info(
|
|
735
|
+
logger.info(t("skill.add.detected", { list: detected.join(", ") }));
|
|
733
736
|
}
|
|
734
737
|
targets = await checkbox({
|
|
735
|
-
message: "
|
|
736
|
-
choices: ALL_SKILL_TOOLS.map((
|
|
737
|
-
name: `${
|
|
738
|
-
value:
|
|
739
|
-
checked: detected.includes(
|
|
738
|
+
message: t("skill.add.promptTools"),
|
|
739
|
+
choices: ALL_SKILL_TOOLS.map((tool) => ({
|
|
740
|
+
name: `${tool} \u2192 ${SKILL_PATHS[tool]}`,
|
|
741
|
+
value: tool,
|
|
742
|
+
checked: detected.includes(tool)
|
|
740
743
|
}))
|
|
741
744
|
});
|
|
742
745
|
}
|
|
743
746
|
if (targets.length === 0) {
|
|
744
|
-
logger.warn("
|
|
747
|
+
logger.warn(t("skill.add.noTargets"));
|
|
745
748
|
return;
|
|
746
749
|
}
|
|
747
750
|
const ref = options.ref ?? DEFAULT_SKILL_REF;
|
|
748
|
-
logger.info(
|
|
751
|
+
logger.info(t("skill.add.fetching", { ref }));
|
|
749
752
|
const { dir: srcDir } = await fetchSkillSource(ref);
|
|
750
753
|
try {
|
|
751
754
|
for (const tool of targets) {
|
|
752
755
|
await deploySkillTo(srcDir, tool, options);
|
|
753
756
|
}
|
|
754
|
-
logger.success("
|
|
757
|
+
logger.success(t("common.done"));
|
|
755
758
|
} finally {
|
|
756
759
|
cleanupTempDir(srcDir);
|
|
757
760
|
}
|
|
@@ -763,29 +766,29 @@ async function deploySkillTo(srcDir, tool, options) {
|
|
|
763
766
|
const diff = compareSkillDirs(destDir, srcDir);
|
|
764
767
|
const label = `${tool} (${SKILL_PATHS[tool]})`;
|
|
765
768
|
if (!hasDiff(diff)) {
|
|
766
|
-
logger.log(
|
|
769
|
+
logger.log(t("skill.add.skippedSame", { label }));
|
|
767
770
|
return;
|
|
768
771
|
}
|
|
769
772
|
logger.log("");
|
|
770
|
-
logger.log(
|
|
771
|
-
if (diff.modified.length > 0) logger.log(
|
|
772
|
-
if (diff.added.length > 0) logger.log(
|
|
773
|
+
logger.log(t("skill.add.hasDiff", { label }));
|
|
774
|
+
if (diff.modified.length > 0) logger.log(t("skill.add.modifiedFiles", { count: diff.modified.length }));
|
|
775
|
+
if (diff.added.length > 0) logger.log(t("skill.add.addedFiles", { count: diff.added.length }));
|
|
773
776
|
if (diff.localOnly.length > 0) {
|
|
774
|
-
logger.log(
|
|
777
|
+
logger.log(t("skill.add.localOnlyFiles", { count: diff.localOnly.length }));
|
|
775
778
|
for (const rel of diff.localOnly) logger.log(` - ${rel}`);
|
|
776
779
|
}
|
|
777
780
|
const go = await confirm2({
|
|
778
|
-
message:
|
|
781
|
+
message: t("skill.add.confirmOverwrite", { path: SKILL_PATHS[tool] }),
|
|
779
782
|
default: false
|
|
780
783
|
});
|
|
781
784
|
if (!go) {
|
|
782
|
-
logger.log(
|
|
785
|
+
logger.log(t("skill.add.skippedTool", { tool }));
|
|
783
786
|
return;
|
|
784
787
|
}
|
|
785
788
|
}
|
|
786
789
|
if (existing) fs5.rmSync(destDir, { recursive: true, force: true });
|
|
787
790
|
copyDirRecursive(srcDir, destDir);
|
|
788
|
-
logger.log(
|
|
791
|
+
logger.log(t("skill.add.deployed", { tool, path: path6.relative(process.cwd(), destDir) }));
|
|
789
792
|
}
|
|
790
793
|
|
|
791
794
|
// src/commands/skill/check.ts
|
|
@@ -795,11 +798,11 @@ async function skillCheckCommand(options = {}) {
|
|
|
795
798
|
const cwd = process.cwd();
|
|
796
799
|
const installed = ALL_SKILL_TOOLS.filter((tool) => fs6.existsSync(path7.join(cwd, SKILL_PATHS[tool], "SKILL.md")));
|
|
797
800
|
if (installed.length === 0) {
|
|
798
|
-
logger.info("
|
|
801
|
+
logger.info(t("skill.check.noneInstalled"));
|
|
799
802
|
return;
|
|
800
803
|
}
|
|
801
804
|
const ref = options.ref ?? DEFAULT_SKILL_REF;
|
|
802
|
-
logger.info(
|
|
805
|
+
logger.info(t("skill.check.fetching", { ref }));
|
|
803
806
|
const { dir: remoteDir } = await fetchSkillSource(ref);
|
|
804
807
|
try {
|
|
805
808
|
let outdatedCount = 0;
|
|
@@ -808,7 +811,7 @@ async function skillCheckCommand(options = {}) {
|
|
|
808
811
|
const diff = compareSkillDirs(localDir, remoteDir);
|
|
809
812
|
const label = `${tool.padEnd(9)} ${SKILL_PATHS[tool]}`;
|
|
810
813
|
if (!hasDiff(diff)) {
|
|
811
|
-
logger.log(
|
|
814
|
+
logger.log(t("skill.check.upToDate", { label }));
|
|
812
815
|
continue;
|
|
813
816
|
}
|
|
814
817
|
outdatedCount += 1;
|
|
@@ -818,9 +821,9 @@ async function skillCheckCommand(options = {}) {
|
|
|
818
821
|
}
|
|
819
822
|
logger.log("");
|
|
820
823
|
if (outdatedCount === 0) {
|
|
821
|
-
logger.success("
|
|
824
|
+
logger.success(t("skill.check.allLatest"));
|
|
822
825
|
} else {
|
|
823
|
-
logger.info(
|
|
826
|
+
logger.info(t("skill.check.outdated", { count: outdatedCount }));
|
|
824
827
|
}
|
|
825
828
|
} finally {
|
|
826
829
|
cleanupTempDir(remoteDir);
|
|
@@ -828,9 +831,9 @@ async function skillCheckCommand(options = {}) {
|
|
|
828
831
|
}
|
|
829
832
|
function formatDiffSummary(diff) {
|
|
830
833
|
const parts = [];
|
|
831
|
-
if (diff.modified.length > 0) parts.push(
|
|
832
|
-
if (diff.added.length > 0) parts.push(
|
|
833
|
-
if (diff.localOnly.length > 0) parts.push(
|
|
834
|
+
if (diff.modified.length > 0) parts.push(t("skill.check.diffModified", { count: diff.modified.length }));
|
|
835
|
+
if (diff.added.length > 0) parts.push(t("skill.check.diffAdded", { count: diff.added.length }));
|
|
836
|
+
if (diff.localOnly.length > 0) parts.push(t("skill.check.diffDeleted", { count: diff.localOnly.length }));
|
|
834
837
|
return ` ${parts.join(" / ")}`;
|
|
835
838
|
}
|
|
836
839
|
function formatDiffDetails(diff) {
|
|
@@ -848,28 +851,35 @@ async function skillUpdateCommand(options) {
|
|
|
848
851
|
|
|
849
852
|
// src/commands/skill/index.ts
|
|
850
853
|
function createSkillCommand() {
|
|
851
|
-
const skill = new Command2("skill").description("
|
|
852
|
-
const
|
|
854
|
+
const skill = new Command2("skill").description(t("cli.skill.description"));
|
|
855
|
+
const toolOptDescription = (tool) => t("cli.skill.opt.toolPath", { path: SKILL_PATHS[tool] });
|
|
856
|
+
const toolFlags = (cmd) => cmd.option("--all", t("cli.skill.opt.all")).option("--claude", toolOptDescription("claude")).option("--codex", toolOptDescription("codex")).option("--cursor", toolOptDescription("cursor")).option("--windsurf", toolOptDescription("windsurf")).option("--cline", toolOptDescription("cline")).option("--copilot", toolOptDescription("copilot")).option("--gemini", toolOptDescription("gemini")).option("--junie", toolOptDescription("junie"));
|
|
853
857
|
toolFlags(
|
|
854
|
-
skill.command("add").description("
|
|
858
|
+
skill.command("add").description(t("cli.skill.add.description")).option("-o, --overwrite", t("cli.skill.add.opt.overwrite"), false).option("--ref <ref>", t("cli.skill.opt.ref"))
|
|
855
859
|
).action(skillAddCommand);
|
|
856
|
-
skill.command("check").description("
|
|
857
|
-
toolFlags(
|
|
858
|
-
|
|
859
|
-
)
|
|
860
|
+
skill.command("check").description(t("cli.skill.check.description")).option("--ref <ref>", t("cli.skill.opt.ref")).option("-v, --verbose", t("cli.skill.check.opt.verbose")).action(skillCheckCommand);
|
|
861
|
+
toolFlags(skill.command("update").description(t("cli.skill.update.description")).option("--ref <ref>", t("cli.skill.opt.ref"))).action(
|
|
862
|
+
skillUpdateCommand
|
|
863
|
+
);
|
|
860
864
|
return skill;
|
|
861
865
|
}
|
|
862
866
|
|
|
863
867
|
// src/createProgram.ts
|
|
864
868
|
function createLismProgram() {
|
|
865
869
|
const program2 = new Command3();
|
|
866
|
-
program2.name("lism").description("
|
|
867
|
-
program2.
|
|
870
|
+
program2.name("lism").description(t("cli.description")).version(CLI_VERSION).option("--lang <code>", t("cli.opt.lang"));
|
|
871
|
+
program2.hook("preAction", (thisCommand) => {
|
|
872
|
+
const opts = thisCommand.optsWithGlobals();
|
|
873
|
+
const lang = opts.lang;
|
|
874
|
+
if (typeof lang === "string") setLang(lang);
|
|
875
|
+
});
|
|
876
|
+
program2.command("create").description(t("cli.create.description")).argument("[targetDir]", t("cli.create.arg.targetDir")).option("-t, --template <name>", t("cli.create.opt.template")).option("-f, --force", t("cli.create.opt.force"), false).action(createCommand);
|
|
868
877
|
program2.addCommand(createUiCommand());
|
|
869
878
|
program2.addCommand(createSkillCommand());
|
|
870
879
|
return program2;
|
|
871
880
|
}
|
|
872
881
|
|
|
873
882
|
// src/index.ts
|
|
883
|
+
preScanLang(process.argv.slice(2));
|
|
874
884
|
var program = createLismProgram();
|
|
875
885
|
program.parse();
|