lism-cli 0.0.1 → 0.3.1

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.js CHANGED
@@ -9,8 +9,11 @@ import {
9
9
  UI_HELPER_PATH,
10
10
  UI_REGISTRY_INDEX_PATH,
11
11
  createCommand,
12
- logger
13
- } from "./chunk-4TQG5MGT.js";
12
+ logger,
13
+ preScanLang,
14
+ setLang,
15
+ t
16
+ } from "./chunk-3PSCUHIC.js";
14
17
 
15
18
  // src/createProgram.ts
16
19
  import { Command as Command3 } from "commander";
@@ -27,6 +30,45 @@ import { confirm, select as select2 } from "@inquirer/prompts";
27
30
  import fs from "fs";
28
31
  import path from "path";
29
32
  import { createJiti } from "jiti";
33
+
34
+ // src/invokeCommand.ts
35
+ function getInvokeCommand() {
36
+ const scriptPath = process.argv[1] ?? "";
37
+ const userAgent = process.env.npm_config_user_agent ?? "";
38
+ const normalizedScriptPath = normalizePath(scriptPath);
39
+ const inDlxCache = /\/_npx\//.test(normalizedScriptPath) || /\/pnpm(?:-cache)?\/(?:[^/]+\/)*dlx-[^/]+\//.test(normalizedScriptPath) || /\/\.yarn\/berry\/cache\//.test(normalizedScriptPath) || /\/\.bun\/install\/cache\//.test(normalizedScriptPath);
40
+ const inLocalDependency = isInProjectNodeModules(normalizedScriptPath) && (/\/node_modules\/\.bin\/lism(?:\.(?:cmd|ps1))?$/.test(normalizedScriptPath) || /\/node_modules\/lism-cli\/bin\/lism\.mjs$/.test(normalizedScriptPath));
41
+ if (inDlxCache) return getDlxInvokeCommand(userAgent);
42
+ if (inLocalDependency) return getLocalInvokeCommand(userAgent);
43
+ return "lism";
44
+ }
45
+ function getDlxInvokeCommand(userAgent) {
46
+ if (userAgent.startsWith("pnpm/")) return "pnpm dlx lism-cli";
47
+ if (userAgent.startsWith("yarn/")) return "yarn dlx lism-cli";
48
+ if (userAgent.startsWith("bun/")) return "bunx lism-cli";
49
+ return "npx lism-cli";
50
+ }
51
+ function getLocalInvokeCommand(userAgent) {
52
+ if (userAgent.startsWith("pnpm/")) return "pnpm exec lism";
53
+ if (userAgent.startsWith("yarn/")) return "yarn lism";
54
+ if (userAgent.startsWith("bun/")) return "bun run lism";
55
+ return "npx lism-cli";
56
+ }
57
+ function isInProjectNodeModules(scriptPath) {
58
+ let dir = normalizePath(process.cwd());
59
+ while (dir) {
60
+ if (scriptPath.startsWith(`${dir}/node_modules/`)) return true;
61
+ const parent = dir.slice(0, dir.lastIndexOf("/"));
62
+ if (parent === dir) break;
63
+ dir = parent;
64
+ }
65
+ return false;
66
+ }
67
+ function normalizePath(value) {
68
+ return value.replaceAll("\\", "/").replace(/\/+$/, "");
69
+ }
70
+
71
+ // src/config.ts
30
72
  var LEGACY_CONFIG_FILE = "lism-ui.json";
31
73
  var CONFIG_SEARCH = ["lism.config.js", "lism.config.mjs"];
32
74
  function resolvePath(filename) {
@@ -51,10 +93,10 @@ function getDefaultConfigPath() {
51
93
  async function readConfig() {
52
94
  const found = findConfigFile();
53
95
  if (!found) {
54
- throw new Error("lism.config.js / lism.config.mjs / lism-ui.json \u306E\u3044\u305A\u308C\u3082\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002");
96
+ throw new Error(t("config.notFound"));
55
97
  }
56
98
  if (found.kind === "legacy-json") {
57
- logger.warn(`[deprecated] ${LEGACY_CONFIG_FILE} \u306F\u5EC3\u6B62\u4E88\u5B9A\u3067\u3059\u3002"lism ui init" \u3067 lism.config.js \u3078\u79FB\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);
99
+ logger.warn(t("config.legacyWarning", { filename: LEGACY_CONFIG_FILE, invoke: getInvokeCommand() }));
58
100
  const raw = fs.readFileSync(found.path, "utf-8");
59
101
  const parsed = JSON.parse(raw);
60
102
  return parsed;
@@ -63,7 +105,7 @@ async function readConfig() {
63
105
  const mod = await jiti.import(found.path);
64
106
  const cli = mod?.cli ?? mod;
65
107
  if (!cli || typeof cli !== "object") {
66
- throw new Error(`${found.filename} \u304B\u3089 CLI \u8A2D\u5B9A\uFF08cli \u30AD\u30FC\uFF09\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002`);
108
+ throw new Error(t("config.cliSectionMissing", { filename: found.filename }));
67
109
  }
68
110
  validateCliConfig(cli);
69
111
  return cli;
@@ -71,13 +113,13 @@ async function readConfig() {
71
113
  function validateCliConfig(cli) {
72
114
  const c = cli;
73
115
  if (c.framework !== "react" && c.framework !== "astro") {
74
- throw new Error(`cli.framework \u306F "react" \u307E\u305F\u306F "astro" \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);
116
+ throw new Error(t("config.invalidFramework"));
75
117
  }
76
118
  if (typeof c.componentsDir !== "string" || !c.componentsDir) {
77
- throw new Error("cli.componentsDir \u306F\u6587\u5B57\u5217\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
119
+ throw new Error(t("config.invalidComponentsDir"));
78
120
  }
79
121
  if (typeof c.helperDir !== "string" || !c.helperDir) {
80
- throw new Error("cli.helperDir \u306F\u6587\u5B57\u5217\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
122
+ throw new Error(t("config.invalidHelperDir"));
81
123
  }
82
124
  }
83
125
  function writeFreshConfig(cli) {
@@ -92,7 +134,7 @@ async function hasCliSection(filePath) {
92
134
  const mod = await jiti.import(filePath);
93
135
  return !!mod?.cli;
94
136
  } catch (err) {
95
- throw new Error(`${filePath} \u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u69CB\u6587\u30A8\u30E9\u30FC\u7B49\uFF09\u3002\u4FEE\u6B63\u3057\u3066\u304B\u3089\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044: ${String(err)}`);
137
+ throw new Error(t("config.loadFailed", { path: filePath, reason: String(err) }));
96
138
  }
97
139
  }
98
140
  async function patchConfigWithCli(cli, targetPath, options = {}) {
@@ -361,18 +403,18 @@ async function fetchHelper(name, options = {}) {
361
403
  import { select, input } from "@inquirer/prompts";
362
404
  async function runInit(options = {}) {
363
405
  const framework = options.framework ?? await select({
364
- message: "\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044:",
406
+ message: t("ui.init.promptFramework"),
365
407
  choices: [
366
408
  { name: "React", value: "react" },
367
409
  { name: "Astro", value: "astro" }
368
410
  ]
369
411
  });
370
412
  const componentsDir = options.componentsDir ?? await input({
371
- message: "\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA:",
413
+ message: t("ui.init.promptComponentsDir"),
372
414
  default: "src/components/ui"
373
415
  });
374
416
  const helperDir = options.helperDir ?? await input({
375
- message: "helper \u306E\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA:",
417
+ message: t("ui.init.promptHelperDir"),
376
418
  default: `${componentsDir}/_helper`
377
419
  });
378
420
  const config = { framework, componentsDir, helperDir };
@@ -383,13 +425,13 @@ async function runInit(options = {}) {
383
425
  existingCli: options.existingCli
384
426
  });
385
427
  if (patched) {
386
- logger.success(`${outPath} \u306B cli \u30BB\u30AF\u30B7\u30E7\u30F3\u3092${options.force ? "\u66F4\u65B0" : "\u8FFD\u8A18"}\u3057\u307E\u3057\u305F\u3002`);
428
+ logger.success(t(options.force ? "ui.init.patchedUpdate" : "ui.init.patchedAdd", { path: outPath }));
387
429
  } else {
388
- logger.warn(`${outPath} \u306B\u65E2\u306B cli \u30BB\u30AF\u30B7\u30E7\u30F3\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u304B\u3001export default \u304C\u691C\u51FA\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u624B\u52D5\u3067\u8FFD\u8A18\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);
430
+ logger.warn(t("ui.init.notPatched", { path: outPath }));
389
431
  }
390
432
  } else {
391
433
  const outPath = writeFreshConfig(config);
392
- logger.success(`${outPath} \u3092\u4F5C\u6210\u3057\u307E\u3057\u305F\u3002`);
434
+ logger.success(t("ui.init.created", { path: outPath }));
393
435
  }
394
436
  return config;
395
437
  }
@@ -397,7 +439,7 @@ async function initCommand(options) {
397
439
  const found = findConfigFile();
398
440
  let existingCli = false;
399
441
  if (found?.kind === "legacy-json") {
400
- logger.warn(`${found.filename} \u3092\u691C\u51FA\u3057\u307E\u3057\u305F\u3002lism.config.js \u3078\u79FB\u884C\u3057\u307E\u3059\u3002\u53E4\u3044\u30D5\u30A1\u30A4\u30EB\u306F\u5F8C\u3067\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);
442
+ logger.warn(t("ui.init.legacyDetected", { filename: found.filename }));
401
443
  } else if (found?.kind === "module") {
402
444
  try {
403
445
  existingCli = await hasCliSection(found.path);
@@ -407,10 +449,10 @@ async function initCommand(options) {
407
449
  }
408
450
  if (existingCli) {
409
451
  if (!options.force) {
410
- logger.warn(`${found.filename} \u306B\u306F\u65E2\u306B cli \u30BB\u30AF\u30B7\u30E7\u30F3\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u4E0A\u66F8\u304D\u3059\u308B\u306B\u306F --force \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`);
452
+ logger.warn(t("ui.init.alreadyExists", { filename: found.filename }));
411
453
  return;
412
454
  }
413
- logger.warn(`${found.filename} \u306E\u65E2\u5B58\u306E cli \u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u4E0A\u66F8\u304D\u3057\u307E\u3059\u3002`);
455
+ logger.warn(t("ui.init.willOverwrite", { filename: found.filename }));
414
456
  }
415
457
  }
416
458
  await runInit({ ...options, existingCli });
@@ -425,7 +467,7 @@ async function addCommand(names, options) {
425
467
  if (configExists()) {
426
468
  config = await readConfig();
427
469
  } else {
428
- logger.info("lism.config.js \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u958B\u59CB\u3057\u307E\u3059...\n");
470
+ logger.info(t("ui.add.noConfig"));
429
471
  config = await runInit();
430
472
  console.log();
431
473
  }
@@ -436,15 +478,15 @@ async function addCommand(names, options) {
436
478
  } catch (err) {
437
479
  const refInfo = options.ref ? ` (ref: ${options.ref})` : "";
438
480
  const reason = err instanceof Error ? err.message : String(err);
439
- logger.error(`\u30AB\u30BF\u30ED\u30B0\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F${refInfo}: ${reason}`);
481
+ logger.error(t("ui.catalogFailed", { refInfo, reason }));
440
482
  process.exit(1);
441
483
  }
442
484
  if (options.all) {
443
485
  names = catalog.components.map((c) => c.name);
444
- logger.info(`\u5168 ${names.length} \u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3092\u8FFD\u52A0\u3057\u307E\u3059...`);
486
+ logger.info(t("ui.add.addingAll", { count: names.length }));
445
487
  }
446
488
  if (names.length === 0) {
447
- logger.error("\u8FFD\u52A0\u3059\u308B\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
489
+ logger.error(t("ui.add.specifyName"));
448
490
  process.exit(1);
449
491
  }
450
492
  const resolvedNames = [];
@@ -456,7 +498,7 @@ async function addCommand(names, options) {
456
498
  else notFound.push(input2);
457
499
  }
458
500
  if (notFound.length > 0) {
459
- logger.error(`\u898B\u3064\u304B\u3089\u306A\u3044\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8: ${notFound.join(", ")}`);
501
+ logger.error(t("ui.add.notFound", { list: notFound.join(", ") }));
460
502
  process.exit(1);
461
503
  }
462
504
  const excludeRootFiles = new Set(catalog.excludeComponentFiles);
@@ -471,7 +513,7 @@ async function addCommand(names, options) {
471
513
  for (let i = 0; i < resolvedNames.length; i++) {
472
514
  const result = results[i];
473
515
  if (result.status === "rejected") {
474
- logger.error(`"${resolvedNames[i]}" \u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${String(result.reason)}`);
516
+ logger.error(t("ui.add.componentFetchFailed", { name: resolvedNames[i], reason: String(result.reason) }));
475
517
  hasFailure = true;
476
518
  continue;
477
519
  }
@@ -479,31 +521,31 @@ async function addCommand(names, options) {
479
521
  if (helperFailed) hasFailure = true;
480
522
  }
481
523
  if (hasFailure) {
482
- logger.error("\u4E00\u90E8\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8 / helper \u306E\u8FFD\u52A0\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002");
524
+ logger.error(t("ui.add.someFailed"));
483
525
  process.exit(1);
484
526
  }
485
- logger.success("\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002");
527
+ logger.success(t("common.done"));
486
528
  }
487
529
  async function askOverwritePolicy() {
488
530
  return select2({
489
- message: "\u65E2\u5B58\u30D5\u30A1\u30A4\u30EB\u306E\u4E0A\u66F8\u304D\u65B9\u91DD\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044:",
531
+ message: t("ui.add.promptOverwritePolicy"),
490
532
  choices: [
491
- { name: "\u5168\u3066\u4E0A\u66F8\u304D", value: "all" },
492
- { name: "\u5168\u3066\u30B9\u30AD\u30C3\u30D7", value: "none" },
493
- { name: "\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3054\u3068\u306B\u78BA\u8A8D", value: "per-component" }
533
+ { name: t("ui.add.policyAll"), value: "all" },
534
+ { name: t("ui.add.policyNone"), value: "none" },
535
+ { name: t("ui.add.policyPerComponent"), value: "per-component" }
494
536
  ]
495
537
  });
496
538
  }
497
539
  function writeFile(filePath, content) {
498
540
  fs3.mkdirSync(path4.dirname(filePath), { recursive: true });
499
541
  fs3.writeFileSync(filePath, content);
500
- logger.log(` \u4F5C\u6210: ${path4.relative(process.cwd(), filePath)}`);
542
+ logger.log(t("ui.add.created", { path: path4.relative(process.cwd(), filePath) }));
501
543
  }
502
544
  function hasExistingFiles(files, baseDir) {
503
545
  return files.some((f) => fs3.existsSync(path4.join(baseDir, f.path)));
504
546
  }
505
547
  async function writeComponent(component, config, overwriteAll, policy, installedHelpers, fetchOpts) {
506
- logger.info(`${component.name} \u3092\u5C55\u958B\u4E2D...`);
548
+ logger.info(t("ui.add.deploying", { name: component.name }));
507
549
  const filesToWrite = [...component.files.shared, ...component.files[config.framework]];
508
550
  const componentDirName = component.name;
509
551
  const componentDir = path4.resolve(process.cwd(), config.componentsDir, componentDirName);
@@ -518,14 +560,14 @@ async function writeComponent(component, config, overwriteAll, policy, installed
518
560
  shouldWrite = false;
519
561
  } else if (policy === "per-component") {
520
562
  shouldWrite = await confirm({
521
- message: `${componentDirName} \u306F\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u4E0A\u66F8\u304D\u3057\u307E\u3059\u304B\uFF1F`,
563
+ message: t("ui.add.confirmOverwriteComponent", { name: componentDirName }),
522
564
  default: false
523
565
  });
524
566
  } else {
525
567
  shouldWrite = true;
526
568
  }
527
569
  if (!shouldWrite) {
528
- logger.log(` \u30B9\u30AD\u30C3\u30D7: ${componentDirName}`);
570
+ logger.log(t("ui.add.skippedComponent", { name: componentDirName }));
529
571
  } else {
530
572
  for (const file of filesToWrite) {
531
573
  const filePath = path4.join(componentDir, file.path);
@@ -541,7 +583,7 @@ async function writeComponent(component, config, overwriteAll, policy, installed
541
583
  for (let i = 0; i < helpersToInstall.length; i++) {
542
584
  const result = helperResults[i];
543
585
  if (result.status === "rejected") {
544
- logger.error(` helper "${helpersToInstall[i]}" \u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F: ${String(result.reason)}`);
586
+ logger.error(t("ui.add.helperFetchFailed", { name: helpersToInstall[i], reason: String(result.reason) }));
545
587
  helperFailed = true;
546
588
  continue;
547
589
  }
@@ -549,16 +591,16 @@ async function writeComponent(component, config, overwriteAll, policy, installed
549
591
  const filePath = path4.join(helperDir, file.path);
550
592
  if (fs3.existsSync(filePath) && !overwriteAll) {
551
593
  if (policy === "none") {
552
- logger.log(` \u30B9\u30AD\u30C3\u30D7: ${file.path}`);
594
+ logger.log(t("ui.add.skippedFile", { path: file.path }));
553
595
  continue;
554
596
  }
555
597
  if (policy === "per-component") {
556
598
  const shouldOverwrite = await confirm({
557
- message: `${path4.relative(process.cwd(), filePath)} \u306F\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u4E0A\u66F8\u304D\u3057\u307E\u3059\u304B\uFF1F`,
599
+ message: t("ui.add.confirmOverwriteFile", { path: path4.relative(process.cwd(), filePath) }),
558
600
  default: false
559
601
  });
560
602
  if (!shouldOverwrite) {
561
- logger.log(` \u30B9\u30AD\u30C3\u30D7: ${file.path}`);
603
+ logger.log(t("ui.add.skippedFile", { path: file.path }));
562
604
  continue;
563
605
  }
564
606
  }
@@ -572,7 +614,7 @@ async function writeComponent(component, config, overwriteAll, policy, installed
572
614
 
573
615
  // src/commands/ui/list.ts
574
616
  async function listCommand(options = {}) {
575
- logger.info("\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u4E2D...");
617
+ logger.info(t("ui.list.fetching"));
576
618
  const fetchOpts = { ref: options.ref };
577
619
  let catalog;
578
620
  try {
@@ -580,27 +622,27 @@ async function listCommand(options = {}) {
580
622
  } catch (err) {
581
623
  const refInfo = options.ref ? ` (ref: ${options.ref})` : "";
582
624
  const reason = err instanceof Error ? err.message : String(err);
583
- logger.error(`\u30AB\u30BF\u30ED\u30B0\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F${refInfo}: ${reason}`);
625
+ logger.error(t("ui.catalogFailed", { refInfo, reason }));
584
626
  process.exit(1);
585
627
  }
586
628
  logger.log(`
587
629
  Lism UI v${catalog.version}
588
630
  `);
589
- logger.log("\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8:");
631
+ logger.log(t("ui.list.header"));
590
632
  for (const component of catalog.components) {
591
633
  const helpers = component.helpers.length > 0 ? ` (helpers: ${component.helpers.join(", ")})` : "";
592
634
  logger.log(` - ${component.name}${helpers}`);
593
635
  }
594
636
  logger.log(`
595
- \u5408\u8A08: ${catalog.components.length} \u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8`);
637
+ ${t("ui.list.total", { count: catalog.components.length })}`);
596
638
  }
597
639
 
598
640
  // src/commands/ui/index.ts
599
641
  function createUiCommand() {
600
- const ui = new Command("ui").description("Lism UI \u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u8FFD\u52A0\u30FB\u7BA1\u7406");
601
- ui.command("init").description("lism.config.js \u306E cli \u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u751F\u6210\u3059\u308B").addOption(new Option("--framework <name>", "\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF").choices(["react", "astro"])).option("--components-dir <path>", "\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA").option("--helper-dir <path>", "helper \u306E\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA").option("-f, --force", "\u65E2\u5B58\u306E cli \u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u4E0A\u66F8\u304D", false).action(initCommand);
602
- ui.command("add").description("\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3092\u8FFD\u52A0\u3059\u308B").argument("[names...]", "\u8FFD\u52A0\u3059\u308B\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u540D").option("-o, --overwrite", "\u65E2\u5B58\u30D5\u30A1\u30A4\u30EB\u3092\u78BA\u8A8D\u306A\u3057\u3067\u4E0A\u66F8\u304D", false).option("-a, --all", "\u5168\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3092\u8FFD\u52A0", false).option("--ref <ref>", "\u53D6\u5F97\u5143\u306E Git ref\uFF08\u30D6\u30E9\u30F3\u30C1 / \u30BF\u30B0 / \u30B3\u30DF\u30C3\u30C8\uFF09").action(addCommand);
603
- ui.command("list").description("\u5229\u7528\u53EF\u80FD\u306A\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u4E00\u89A7\u3092\u8868\u793A\u3059\u308B").option("--ref <ref>", "\u53D6\u5F97\u5143\u306E Git ref\uFF08\u30D6\u30E9\u30F3\u30C1 / \u30BF\u30B0 / \u30B3\u30DF\u30C3\u30C8\uFF09").action(listCommand);
642
+ const ui = new Command("ui").description(t("cli.ui.description"));
643
+ 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);
644
+ 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);
645
+ ui.command("list").description(t("cli.ui.list.description")).option("--ref <ref>", t("cli.ui.opt.ref")).action(listCommand);
604
646
  return ui;
605
647
  }
606
648
 
@@ -717,7 +759,7 @@ function copyDirRecursive(src, dest) {
717
759
  // src/commands/skill/add.ts
718
760
  function resolveExplicitTools(options) {
719
761
  if (options.all) return [...ALL_SKILL_TOOLS];
720
- const explicit = ALL_SKILL_TOOLS.filter((t) => options[t]);
762
+ const explicit = ALL_SKILL_TOOLS.filter((t2) => options[t2]);
721
763
  return explicit;
722
764
  }
723
765
  function autoDetectTools(cwd) {
@@ -729,29 +771,29 @@ async function skillAddCommand(options) {
729
771
  if (targets.length === 0) {
730
772
  const detected = autoDetectTools(cwd);
731
773
  if (detected.length > 0) {
732
- logger.info(`\u691C\u51FA\u3057\u305F AI \u30C4\u30FC\u30EB: ${detected.join(", ")}`);
774
+ logger.info(t("skill.add.detected", { list: detected.join(", ") }));
733
775
  }
734
776
  targets = await checkbox({
735
- message: "\u914D\u7F6E\u5148\u306E\u30C4\u30FC\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u30B9\u30DA\u30FC\u30B9\u3067\u9078\u629E\u3001Enter \u3067\u78BA\u5B9A\uFF09:",
736
- choices: ALL_SKILL_TOOLS.map((t) => ({
737
- name: `${t} \u2192 ${SKILL_PATHS[t]}`,
738
- value: t,
739
- checked: detected.includes(t)
777
+ message: t("skill.add.promptTools"),
778
+ choices: ALL_SKILL_TOOLS.map((tool) => ({
779
+ name: `${tool} \u2192 ${SKILL_PATHS[tool]}`,
780
+ value: tool,
781
+ checked: detected.includes(tool)
740
782
  }))
741
783
  });
742
784
  }
743
785
  if (targets.length === 0) {
744
- logger.warn("\u914D\u7F6E\u5148\u304C\u9078\u629E\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002");
786
+ logger.warn(t("skill.add.noTargets"));
745
787
  return;
746
788
  }
747
789
  const ref = options.ref ?? DEFAULT_SKILL_REF;
748
- logger.info(`\u30B9\u30AD\u30EB\u3092\u53D6\u5F97\u4E2D\uFF08ref: ${ref}\uFF09...`);
790
+ logger.info(t("skill.add.fetching", { ref }));
749
791
  const { dir: srcDir } = await fetchSkillSource(ref);
750
792
  try {
751
793
  for (const tool of targets) {
752
794
  await deploySkillTo(srcDir, tool, options);
753
795
  }
754
- logger.success("\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002");
796
+ logger.success(t("common.done"));
755
797
  } finally {
756
798
  cleanupTempDir(srcDir);
757
799
  }
@@ -763,29 +805,29 @@ async function deploySkillTo(srcDir, tool, options) {
763
805
  const diff = compareSkillDirs(destDir, srcDir);
764
806
  const label = `${tool} (${SKILL_PATHS[tool]})`;
765
807
  if (!hasDiff(diff)) {
766
- logger.log(` \u30B9\u30AD\u30C3\u30D7\uFF08\u5DEE\u5206\u306A\u3057\uFF09: ${label}`);
808
+ logger.log(t("skill.add.skippedSame", { label }));
767
809
  return;
768
810
  }
769
811
  logger.log("");
770
- logger.log(` ${label} \u306B\u5DEE\u5206\u304C\u3042\u308A\u307E\u3059:`);
771
- if (diff.modified.length > 0) logger.log(` \u5909\u66F4: ${diff.modified.length} \u30D5\u30A1\u30A4\u30EB`);
772
- if (diff.added.length > 0) logger.log(` \u8FFD\u52A0: ${diff.added.length} \u30D5\u30A1\u30A4\u30EB`);
812
+ logger.log(t("skill.add.hasDiff", { label }));
813
+ if (diff.modified.length > 0) logger.log(t("skill.add.modifiedFiles", { count: diff.modified.length }));
814
+ if (diff.added.length > 0) logger.log(t("skill.add.addedFiles", { count: diff.added.length }));
773
815
  if (diff.localOnly.length > 0) {
774
- logger.log(` \u524A\u9664: ${diff.localOnly.length} \u30D5\u30A1\u30A4\u30EB\uFF08\u30ED\u30FC\u30AB\u30EB\u306E\u307F\u306B\u5B58\u5728\u3001\u4E0A\u66F8\u304D\u6642\u306B\u524A\u9664\u3055\u308C\u307E\u3059\uFF09`);
816
+ logger.log(t("skill.add.localOnlyFiles", { count: diff.localOnly.length }));
775
817
  for (const rel of diff.localOnly) logger.log(` - ${rel}`);
776
818
  }
777
819
  const go = await confirm2({
778
- message: `${SKILL_PATHS[tool]} \u3092\u4E0A\u66F8\u304D\u3057\u307E\u3059\u304B\uFF1F`,
820
+ message: t("skill.add.confirmOverwrite", { path: SKILL_PATHS[tool] }),
779
821
  default: false
780
822
  });
781
823
  if (!go) {
782
- logger.log(` \u30B9\u30AD\u30C3\u30D7: ${tool}`);
824
+ logger.log(t("skill.add.skippedTool", { tool }));
783
825
  return;
784
826
  }
785
827
  }
786
828
  if (existing) fs5.rmSync(destDir, { recursive: true, force: true });
787
829
  copyDirRecursive(srcDir, destDir);
788
- logger.log(` \u914D\u7F6E: ${tool} \u2192 ${path6.relative(process.cwd(), destDir)}`);
830
+ logger.log(t("skill.add.deployed", { tool, path: path6.relative(process.cwd(), destDir) }));
789
831
  }
790
832
 
791
833
  // src/commands/skill/check.ts
@@ -795,11 +837,11 @@ async function skillCheckCommand(options = {}) {
795
837
  const cwd = process.cwd();
796
838
  const installed = ALL_SKILL_TOOLS.filter((tool) => fs6.existsSync(path7.join(cwd, SKILL_PATHS[tool], "SKILL.md")));
797
839
  if (installed.length === 0) {
798
- logger.info("\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u6E08\u307F\u306E\u30B9\u30AD\u30EB\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002`lism skill add` \u3067\u914D\u7F6E\u3067\u304D\u307E\u3059\u3002");
840
+ logger.info(t("skill.check.noneInstalled", { invoke: getInvokeCommand() }));
799
841
  return;
800
842
  }
801
843
  const ref = options.ref ?? DEFAULT_SKILL_REF;
802
- logger.info(`\u30EA\u30E2\u30FC\u30C8\u30B9\u30AD\u30EB\u3092\u53D6\u5F97\u4E2D\uFF08ref: ${ref}\uFF09...`);
844
+ logger.info(t("skill.check.fetching", { ref }));
803
845
  const { dir: remoteDir } = await fetchSkillSource(ref);
804
846
  try {
805
847
  let outdatedCount = 0;
@@ -808,7 +850,7 @@ async function skillCheckCommand(options = {}) {
808
850
  const diff = compareSkillDirs(localDir, remoteDir);
809
851
  const label = `${tool.padEnd(9)} ${SKILL_PATHS[tool]}`;
810
852
  if (!hasDiff(diff)) {
811
- logger.log(` \u2713 ${label} (\u6700\u65B0)`);
853
+ logger.log(t("skill.check.upToDate", { label }));
812
854
  continue;
813
855
  }
814
856
  outdatedCount += 1;
@@ -818,9 +860,9 @@ async function skillCheckCommand(options = {}) {
818
860
  }
819
861
  logger.log("");
820
862
  if (outdatedCount === 0) {
821
- logger.success("\u3059\u3079\u3066\u306E\u30B9\u30AD\u30EB\u304C\u6700\u65B0\u3067\u3059\u3002");
863
+ logger.success(t("skill.check.allLatest"));
822
864
  } else {
823
- logger.info(`${outdatedCount} \u4EF6\u306E\u30C4\u30FC\u30EB\u306B\u5DEE\u5206\u304C\u3042\u308A\u307E\u3059\u3002\`lism skill update\` \u3067\u6700\u65B0\u306B\u66F4\u65B0\u3067\u304D\u307E\u3059\u3002`);
865
+ logger.info(t("skill.check.outdated", { count: outdatedCount, invoke: getInvokeCommand() }));
824
866
  }
825
867
  } finally {
826
868
  cleanupTempDir(remoteDir);
@@ -828,9 +870,9 @@ async function skillCheckCommand(options = {}) {
828
870
  }
829
871
  function formatDiffSummary(diff) {
830
872
  const parts = [];
831
- if (diff.modified.length > 0) parts.push(`\u5909\u66F4 ${diff.modified.length}`);
832
- if (diff.added.length > 0) parts.push(`\u8FFD\u52A0 ${diff.added.length}`);
833
- if (diff.localOnly.length > 0) parts.push(`\u524A\u9664 ${diff.localOnly.length}`);
873
+ if (diff.modified.length > 0) parts.push(t("skill.check.diffModified", { count: diff.modified.length }));
874
+ if (diff.added.length > 0) parts.push(t("skill.check.diffAdded", { count: diff.added.length }));
875
+ if (diff.localOnly.length > 0) parts.push(t("skill.check.diffDeleted", { count: diff.localOnly.length }));
834
876
  return ` ${parts.join(" / ")}`;
835
877
  }
836
878
  function formatDiffDetails(diff) {
@@ -848,28 +890,35 @@ async function skillUpdateCommand(options) {
848
890
 
849
891
  // src/commands/skill/index.ts
850
892
  function createSkillCommand() {
851
- const skill = new Command2("skill").description("AI \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u5411\u3051\u30B9\u30AD\u30EB\uFF08SKILL.md\uFF09\u306E\u914D\u7F6E\u3068\u7BA1\u7406");
852
- const toolFlags = (cmd) => cmd.option("--all", "\u5168\u30C4\u30FC\u30EB\u306B\u914D\u7F6E").option("--claude", ".claude/skills/ \u306B\u914D\u7F6E").option("--codex", ".agents/skills/ \u306B\u914D\u7F6E").option("--cursor", ".cursor/skills/ \u306B\u914D\u7F6E").option("--windsurf", ".windsurf/skills/ \u306B\u914D\u7F6E").option("--cline", ".cline/skills/ \u306B\u914D\u7F6E").option("--copilot", ".github/skills/ \u306B\u914D\u7F6E").option("--gemini", ".gemini/skills/ \u306B\u914D\u7F6E").option("--junie", ".junie/skills/ \u306B\u914D\u7F6E");
893
+ const skill = new Command2("skill").description(t("cli.skill.description"));
894
+ const toolOptDescription = (tool) => t("cli.skill.opt.toolPath", { path: SKILL_PATHS[tool] });
895
+ 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
896
  toolFlags(
854
- skill.command("add").description("\u30B9\u30AD\u30EB\u3092\u914D\u7F6E\u3059\u308B").option("-o, --overwrite", "\u78BA\u8A8D\u306A\u3057\u3067\u4E0A\u66F8\u304D", false).option("--ref <ref>", "GitHub \u306E\u53D6\u5F97\u5143 ref\uFF08\u30D6\u30E9\u30F3\u30C1\uFF0F\u30BF\u30B0\uFF0F\u30B3\u30DF\u30C3\u30C8\uFF09")
897
+ 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
898
  ).action(skillAddCommand);
856
- skill.command("check").description("\u914D\u7F6E\u6E08\u307F\u30B9\u30AD\u30EB\u3068\u30EA\u30E2\u30FC\u30C8\u306E\u5DEE\u5206\u3092\u78BA\u8A8D\u3059\u308B").option("--ref <ref>", "GitHub \u306E\u53D6\u5F97\u5143 ref\uFF08\u30D6\u30E9\u30F3\u30C1\uFF0F\u30BF\u30B0\uFF0F\u30B3\u30DF\u30C3\u30C8\uFF09").option("-v, --verbose", "\u30D5\u30A1\u30A4\u30EB\u5358\u4F4D\u306E\u5DEE\u5206\u3092\u8868\u793A").action(skillCheckCommand);
857
- toolFlags(
858
- skill.command("update").description("\u914D\u7F6E\u6E08\u307F\u30B9\u30AD\u30EB\u3092\u6700\u65B0\u7248\u3067\u4E0A\u66F8\u304D\u3059\u308B\uFF08--overwrite \u540C\u7B49\uFF09").option("--ref <ref>", "GitHub \u306E\u53D6\u5F97\u5143 ref\uFF08\u30D6\u30E9\u30F3\u30C1\uFF0F\u30BF\u30B0\uFF0F\u30B3\u30DF\u30C3\u30C8\uFF09")
859
- ).action(skillUpdateCommand);
899
+ 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);
900
+ toolFlags(skill.command("update").description(t("cli.skill.update.description")).option("--ref <ref>", t("cli.skill.opt.ref"))).action(
901
+ skillUpdateCommand
902
+ );
860
903
  return skill;
861
904
  }
862
905
 
863
906
  // src/createProgram.ts
864
907
  function createLismProgram() {
865
908
  const program2 = new Command3();
866
- program2.name("lism").description("Lism CSS / UI \u5411\u3051 CLI").version(CLI_VERSION);
867
- program2.command("create").description("examples \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u304B\u3089\u65B0\u898F\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u751F\u6210\u3059\u308B").argument("[targetDir]", "\u51FA\u529B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA").option("-t, --template <name>", "\u4F7F\u7528\u3059\u308B\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u540D\uFF08\u4F8B: astro-minimal\uFF09").option("-f, --force", "\u65E2\u5B58\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u5F37\u5236\u4E0A\u66F8\u304D", false).action(createCommand);
909
+ program2.name("lism").description(t("cli.description")).version(CLI_VERSION).option("--lang <code>", t("cli.opt.lang"));
910
+ program2.hook("preAction", (thisCommand) => {
911
+ const opts = thisCommand.optsWithGlobals();
912
+ const lang = opts.lang;
913
+ if (typeof lang === "string") setLang(lang);
914
+ });
915
+ 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
916
  program2.addCommand(createUiCommand());
869
917
  program2.addCommand(createSkillCommand());
870
918
  return program2;
871
919
  }
872
920
 
873
921
  // src/index.ts
922
+ preScanLang(process.argv.slice(2));
874
923
  var program = createLismProgram();
875
924
  program.parse();