lism-cli 0.5.0 → 0.7.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/README.md CHANGED
@@ -27,9 +27,14 @@ pnpm dlx lism-cli create --template minimal-astro ./my-app
27
27
 
28
28
  # カテゴリ名を指定(stack 以下の選択を対話で続行)
29
29
  pnpm dlx lism-cli create --template minimal ./my-app
30
+
31
+ # 言語を指定(CLI 表示 + 生成テンプレートの言語)
32
+ pnpm dlx lism-cli create --template blog-astro-minimal --lang en ./my-blog
30
33
  ```
31
34
 
32
- 同じ動作は `pnpm create lism` / `npm create lism@latest` でも呼び出せます(`create-lism` パッケージ経由)。
35
+ 同じ動作は `pnpm create lism` / `npm create lism@latest` でも呼び出せます(`create-lism` パッケージ経由)。挙動は両者で共通です。
36
+
37
+ `--lang <ja|en>` は CLI の表示言語に加えて、**生成されるテンプレート本体の言語**にも反映されます。`--lang` を指定しない場合は、対話端末(TTY)ではほかのどの選択よりも先に言語選択プロンプトが表示され、選んだ言語で以降の表示とテンプレート生成が確定します(非対話環境・CI 等では `en` にフォールバック)。対応言語版を持つテンプレート(`blog-astro-minimal` / `blog-astro-personal` / `blog-astro-techlog` / `lp-astro-corporate` / `lp-astro-interior`)では、指定言語のサイト文言・サンプルコンテンツで生成されます。言語版が無いテンプレートは、指定言語に関わらず既存(ベース)の内容で生成されます。
33
38
 
34
39
  ### UI コンポーネントの追加
35
40
 
@@ -111,7 +116,7 @@ export default {
111
116
 
112
117
  `lism.config.mjs` も同様に読み込まれます。旧 `lism-ui.json` は廃止予定(互換ロードのみ。起動時に deprecation 警告)。
113
118
 
114
- > **Note:** TypeScript の `lism.config.ts` は現在未対応です。`lism-css` 本体の SCSS ビルド(`vite-plugin-lism-css` / `lism-css build`)も `.ts` を読み込まない設計のため、設定ファイルは `.js` / `.mjs` で記述してください。
119
+ > **Note:** TypeScript の `lism.config.ts` は現在未対応です。`lism-css` 本体の設定読込(`@lism-css/plugin` / `lism-css build`)も `.ts` を読み込まない設計のため、設定ファイルは `.js` / `.mjs` で記述してください。
115
120
 
116
121
  ## パッケージが見つからないエラーが出る場合
117
122
 
@@ -1,3 +1,9 @@
1
+ // <define:__LISM_PACKAGE_VERSIONS__>
2
+ var define_LISM_PACKAGE_VERSIONS_default = { "lism-css": "0.23.0", "@lism-css/ui": "0.23.0", "@lism-css/plugin": "0.3.0" };
3
+
4
+ // src/i18n.ts
5
+ import { execFileSync } from "child_process";
6
+
1
7
  // src/messages.ts
2
8
  var messages = {
3
9
  // ---------------------------------------------------------------------------
@@ -8,8 +14,8 @@ var messages = {
8
14
  en: "CLI for Lism CSS / UI"
9
15
  },
10
16
  "cli.opt.lang": {
11
- ja: "CLI \u306E\u8868\u793A\u8A00\u8A9E\u3092\u6307\u5B9A\uFF08ja | en\uFF09",
12
- en: "Display language for the CLI (ja | en)"
17
+ ja: "CLI \u8868\u793A\u3068\u751F\u6210\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u8A00\u8A9E\uFF08ja | en\u3001\u672A\u6307\u5B9A\u306A\u3089\u5BFE\u8A71\u6642\u306B\u9078\u629E\uFF09",
18
+ en: "Language for the CLI and generated template (ja | en; prompted when omitted)"
13
19
  },
14
20
  // create
15
21
  "cli.create.description": {
@@ -198,8 +204,8 @@ var messages = {
198
204
  en: "Failed to rewrite package.json name: {reason}"
199
205
  },
200
206
  "create.workspaceReplaced": {
201
- ja: " package.json \u306E workspace:* \u3092 ^{version} \u306B\u7F6E\u63DB\u3057\u307E\u3057\u305F\u3002",
202
- en: " Replaced workspace:* in package.json with ^{version}."
207
+ ja: " package.json \u306E workspace:* \u3092\u516C\u958B\u30D0\u30FC\u30B8\u30E7\u30F3\u306B\u7F6E\u63DB\u3057\u307E\u3057\u305F\u3002",
208
+ en: " Replaced workspace:* in package.json with published versions."
203
209
  },
204
210
  "create.workspaceFailed": {
205
211
  ja: "package.json \u306E\u66F8\u304D\u63DB\u3048\u306B\u5931\u6557\u3057\u307E\u3057\u305F: {reason}",
@@ -466,10 +472,25 @@ var messages = {
466
472
  };
467
473
 
468
474
  // src/i18n.ts
475
+ function detectAppleLanguage() {
476
+ if (process.platform !== "darwin") return null;
477
+ try {
478
+ const out = execFileSync("/usr/bin/defaults", ["read", "-g", "AppleLanguages"], {
479
+ encoding: "utf8",
480
+ timeout: 1e3,
481
+ stdio: ["ignore", "pipe", "ignore"]
482
+ });
483
+ const match = out.match(/"?([A-Za-z]{2,}[-_A-Za-z]*)"?/);
484
+ return match ? match[1].toLowerCase() : null;
485
+ } catch {
486
+ return null;
487
+ }
488
+ }
469
489
  function detectLang(override) {
470
490
  if (override === "ja" || override === "en") return override;
471
491
  const raw = (process.env.LC_ALL || process.env.LANG || "").toLowerCase();
472
492
  if (raw.startsWith("ja")) return "ja";
493
+ if (detectAppleLanguage()?.startsWith("ja")) return "ja";
473
494
  try {
474
495
  const locale = Intl.DateTimeFormat().resolvedOptions().locale.toLowerCase();
475
496
  if (locale.startsWith("ja")) return "ja";
@@ -547,12 +568,16 @@ var logger = {
547
568
  };
548
569
 
549
570
  // src/version.ts
550
- var LISM_CSS_VERSION = "0.21.0" ? "0.21.0" : "unknown";
551
- var CLI_VERSION = "0.5.0" ? "0.5.0" : "unknown";
571
+ var LISM_CSS_VERSION = "0.23.0" ? "0.23.0" : "unknown";
572
+ var LISM_PACKAGE_VERSIONS = typeof define_LISM_PACKAGE_VERSIONS_default !== "undefined" && define_LISM_PACKAGE_VERSIONS_default ? define_LISM_PACKAGE_VERSIONS_default : {
573
+ "lism-css": LISM_CSS_VERSION
574
+ };
575
+ var CLI_VERSION = "0.7.0" ? "0.7.0" : "unknown";
552
576
 
553
577
  // src/constants.ts
554
578
  var SOURCE_REPO = "lism-css/lism-css";
555
579
  var RAW_GITHUB_BASE = "https://raw.githubusercontent.com";
580
+ var NPM_REGISTRY_BASE = "https://registry.npmjs.org";
556
581
  var DEFAULT_UI_REF = "main";
557
582
  var DEFAULT_SKILL_REF = "main";
558
583
  var DEFAULT_TEMPLATES_REF = "main";
@@ -563,6 +588,7 @@ var SKILL_SOURCE_PATH = "skills/lism-css-guide";
563
588
  var TEMPLATES_PATH = "templates";
564
589
 
565
590
  // ../../templates/manifest.ts
591
+ var PREVIEW_ORIGIN = "https://templates.lism-css.com";
566
592
  var TEMPLATES = [
567
593
  {
568
594
  slug: "minimal-astro",
@@ -581,7 +607,18 @@ var TEMPLATES = [
581
607
  sourcePath: "minimal/vite",
582
608
  title: { ja: "Minimal Vite", en: "Minimal Vite" },
583
609
  description: { ja: "Vite + React \u30D9\u30FC\u30B9\u306E\u6700\u5C0F\u69CB\u6210", en: "Minimal Vite + React setup" },
584
- previewUrl: "https://lism-minimal-vite.pages.dev/"
610
+ previewUrl: `${PREVIEW_ORIGIN}/minimal-vite/`
611
+ },
612
+ {
613
+ slug: "minimal-next",
614
+ kind: "project",
615
+ category: "minimal",
616
+ stack: "next",
617
+ sourcePath: "minimal/next",
618
+ title: { ja: "Minimal Next", en: "Minimal Next" },
619
+ description: { ja: "Next.js (App Router) \u30D9\u30FC\u30B9\u306E\u6700\u5C0F\u69CB\u6210", en: "Minimal Next.js (App Router) setup" },
620
+ // preview サイト未配信・docs カード未整備のため draft(CLI 一覧・docs 本番ビルドから除外)
621
+ draft: true
585
622
  },
586
623
  {
587
624
  slug: "blog-astro-minimal",
@@ -591,9 +628,13 @@ var TEMPLATES = [
591
628
  variantLabel: { ja: "Minimal", en: "Minimal" },
592
629
  stack: "astro",
593
630
  sourcePath: "blog/astro/minimal",
631
+ langOverlays: {
632
+ en: "blog/astro/minimal/.lang/en"
633
+ },
594
634
  title: { ja: "Blog Minimal", en: "Blog Minimal" },
595
635
  description: { ja: "\u8A18\u4E8B\u4E00\u89A7 / \u8A73\u7D30 / Tags \u306E\u307F\u306E\u6700\u5C0F\u69CB\u6210\u306E Astro \u30D6\u30ED\u30B0", en: "Minimal Astro blog with posts and tags only" },
596
- previewUrl: "https://lism-blog-astro-minimal.pages.dev/",
636
+ previewUrl: `${PREVIEW_ORIGIN}/blog-astro-minimal/`,
637
+ previewUrlEn: `${PREVIEW_ORIGIN}/blog-astro-minimal/en/`,
597
638
  features: {
598
639
  ja: ["\u30BF\u30B0", "sitemap"],
599
640
  en: ["Tags", "sitemap"]
@@ -607,12 +648,16 @@ var TEMPLATES = [
607
648
  variantLabel: { ja: "Personal", en: "Personal" },
608
649
  stack: "astro",
609
650
  sourcePath: "blog/astro/personal",
651
+ langOverlays: {
652
+ en: "blog/astro/personal/.lang/en"
653
+ },
610
654
  title: { ja: "Blog Personal", en: "Blog Personal" },
611
655
  description: {
612
656
  ja: "\u500B\u4EBA\u30D6\u30ED\u30B0\u30FB\u30A8\u30C3\u30BB\u30A4\u5411\u3051\u3002\u5E74\u6708\u30A2\u30FC\u30AB\u30A4\u30D6\u3064\u304D\u306E\u843D\u3061\u7740\u3044\u305F Astro \u30D6\u30ED\u30B0",
613
657
  en: "Personal / essay-style Astro blog with monthly archives"
614
658
  },
615
- previewUrl: "https://lism-blog-astro-personal.pages.dev/",
659
+ previewUrl: `${PREVIEW_ORIGIN}/blog-astro-personal/`,
660
+ previewUrlEn: `${PREVIEW_ORIGIN}/blog-astro-personal/en/`,
616
661
  features: {
617
662
  ja: ["\u30BF\u30B0", "\u5E74\u6708\u30A2\u30FC\u30AB\u30A4\u30D6", "\u30B7\u30A7\u30A2\u30DC\u30BF\u30F3", "OGP\u753B\u50CF\u81EA\u52D5\u751F\u6210", "sitemap\uFF08lastmod \u5BFE\u5FDC\uFF09"],
618
663
  en: ["Tags", "Monthly archives", "Share buttons", "Auto-generated OG images", "sitemap (with lastmod)"]
@@ -626,12 +671,16 @@ var TEMPLATES = [
626
671
  variantLabel: { ja: "Tech Log", en: "Tech Log" },
627
672
  stack: "astro",
628
673
  sourcePath: "blog/astro/techlog",
674
+ langOverlays: {
675
+ en: "blog/astro/techlog/.lang/en"
676
+ },
629
677
  title: { ja: "Blog Tech Log", en: "Blog Tech Log" },
630
678
  description: {
631
679
  ja: "\u6280\u8853\u30D6\u30ED\u30B0\u5411\u3051\u3002\u30B3\u30FC\u30C9\u30CF\u30A4\u30E9\u30A4\u30C8\u30FB\u30AB\u30C6\u30B4\u30EA\u30FB\u30BF\u30B0\u30FBTOC\u30FB\u5E74\u6708\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u691C\u7D22\u3092\u88C5\u5099\u3057\u305F Astro \u30D6\u30ED\u30B0",
632
680
  en: "Tech blog with code highlighting, categories, tags, TOC, monthly archives and search"
633
681
  },
634
- previewUrl: "https://lism-blog-astro-techlog.pages.dev/",
682
+ previewUrl: `${PREVIEW_ORIGIN}/blog-astro-techlog/`,
683
+ previewUrlEn: `${PREVIEW_ORIGIN}/blog-astro-techlog/en/`,
635
684
  features: {
636
685
  ja: [
637
686
  "\u30AB\u30C6\u30B4\u30EA / \u30BF\u30B0",
@@ -667,7 +716,8 @@ var TEMPLATES = [
667
716
  sourcePath: "lp/astro",
668
717
  title: { ja: "LP Corporate", en: "LP Corporate" },
669
718
  description: { ja: "\u30B3\u30FC\u30DD\u30EC\u30FC\u30C8\u30B5\u30A4\u30C8\u5411\u3051\u306E Astro \u30E9\u30F3\u30C7\u30A3\u30F3\u30B0\u30DA\u30FC\u30B8", en: "Astro landing page for corporate sites" },
670
- previewUrl: "https://lism-lp-astro.pages.dev/corporate/"
719
+ previewUrl: `${PREVIEW_ORIGIN}/lp-astro/corporate/`,
720
+ previewUrlEn: `${PREVIEW_ORIGIN}/lp-astro/en/corporate/`
671
721
  },
672
722
  {
673
723
  slug: "lp-astro-interior",
@@ -679,7 +729,8 @@ var TEMPLATES = [
679
729
  sourcePath: "lp/astro",
680
730
  title: { ja: "LP Interior", en: "LP Interior" },
681
731
  description: { ja: "\u30A4\u30F3\u30C6\u30EA\u30A2\u30FB\u66AE\u3089\u3057\u7CFB\u30B5\u30FC\u30D3\u30B9\u5411\u3051\u306E Astro \u30E9\u30F3\u30C7\u30A3\u30F3\u30B0\u30DA\u30FC\u30B8", en: "Astro landing page for interior / lifestyle services" },
682
- previewUrl: "https://lism-lp-astro.pages.dev/interior/"
732
+ previewUrl: `${PREVIEW_ORIGIN}/lp-astro/interior/`,
733
+ previewUrlEn: `${PREVIEW_ORIGIN}/lp-astro/en/interior/`
683
734
  },
684
735
  {
685
736
  slug: "lp-astro-ryokan",
@@ -714,7 +765,7 @@ var CATEGORIES = [
714
765
  },
715
766
  {
716
767
  id: "lp",
717
- label: { ja: "Landing Page", en: "Landing Page" },
768
+ label: { ja: "LP", en: "LP" },
718
769
  variantPromptKey: "create.promptSelectVariant.lp"
719
770
  },
720
771
  {
@@ -723,10 +774,12 @@ var CATEGORIES = [
723
774
  variantPromptKey: "create.promptSelectVariant.web"
724
775
  }
725
776
  ];
726
- async function runCreate({ template, targetDir, force = false }) {
727
- await runCreateWithTemplates({ template, targetDir, force }, TEMPLATES);
777
+ async function runCreate({ template, targetDir, force = false, lang }) {
778
+ await runCreateWithTemplates({ template, targetDir, force, lang }, TEMPLATES);
728
779
  }
729
- async function runCreateWithTemplates({ template, targetDir, force = false }, templates) {
780
+ async function runCreateWithTemplates({ template, targetDir, force = false, lang }, templates) {
781
+ const resolvedLang = await resolveLang(lang);
782
+ setLang(resolvedLang);
730
783
  const availableTemplates = templates.filter((tpl2) => !tpl2.draft);
731
784
  const tpl = await resolveTemplate(template, availableTemplates);
732
785
  const outDir = path.resolve(process.cwd(), await resolveTargetDir(targetDir, tpl.slug));
@@ -743,13 +796,27 @@ async function runCreateWithTemplates({ template, targetDir, force = false }, te
743
796
  const ref = DEFAULT_TEMPLATES_REF;
744
797
  logger.info(t("create.fetching", { name: tpl.slug, ref }));
745
798
  await downloadTemplateSource(tpl, outDir, ref, force);
799
+ await applyLangOverlay(tpl, outDir, ref, resolvedLang);
746
800
  ensureTemplateDownloaded(outDir, tpl);
747
- postProcessTemplate(outDir, tpl);
801
+ await postProcessTemplate(outDir, tpl, resolvedLang);
748
802
  logger.success(t("create.created", { dir: outDir }));
749
803
  printNextSteps(outDir, tpl);
750
804
  }
751
- async function createCommand(targetDir, options) {
752
- await runCreate({ template: options.template, targetDir, force: options.force });
805
+ async function createCommand(targetDir, options, command) {
806
+ const langOpt = command?.optsWithGlobals().lang;
807
+ const lang = typeof langOpt === "string" ? langOpt : void 0;
808
+ await runCreate({ template: options.template, targetDir, force: options.force, lang });
809
+ }
810
+ async function resolveLang(explicit) {
811
+ if (explicit === "ja" || explicit === "en") return explicit;
812
+ if (!process.stdin.isTTY) return "en";
813
+ return select({
814
+ message: "Select language / \u8A00\u8A9E\u3092\u9078\u629E:",
815
+ choices: [
816
+ { name: "English", value: "en" },
817
+ { name: "\u65E5\u672C\u8A9E", value: "ja" }
818
+ ]
819
+ });
753
820
  }
754
821
  async function resolveTemplate(requested, templates) {
755
822
  if (requested) {
@@ -850,17 +917,29 @@ async function downloadTemplatePath(sourcePath, outDir, ref, forceClean) {
850
917
  forceClean
851
918
  });
852
919
  }
853
- function postProcessTemplate(projectDir, tpl) {
920
+ async function applyLangOverlay(tpl, outDir, ref, lang) {
921
+ if (tpl.kind !== "project") return;
922
+ const overlayPath = tpl.langOverlays?.[lang];
923
+ if (!overlayPath) return;
924
+ const overlayDir = fs.mkdtempSync(path.join(os.tmpdir(), "lism-template-lang-"));
925
+ try {
926
+ await downloadTemplatePath(overlayPath, overlayDir, ref, true);
927
+ mergeDirectory(overlayDir, outDir);
928
+ } finally {
929
+ fs.rmSync(overlayDir, { recursive: true, force: true });
930
+ }
931
+ }
932
+ async function postProcessTemplate(projectDir, tpl, lang) {
854
933
  if (tpl.kind === "static-html") return;
855
934
  if (tpl.kind === "base-overlay" && tpl.rewritePackageName !== false) {
856
935
  rewritePackageName(projectDir, tpl.slug);
857
936
  }
858
937
  if (tpl.kind === "single-project-variant") {
859
- extractVariantFiles(projectDir, tpl);
938
+ extractVariantFiles(projectDir, tpl, lang);
860
939
  rewritePackageName(projectDir, tpl.packageName ?? tpl.slug);
861
940
  }
862
941
  cleanupDevArtifacts(projectDir);
863
- rewriteWorkspaceDeps(projectDir);
942
+ await rewriteWorkspaceDeps(projectDir);
864
943
  }
865
944
  function cleanupDevArtifacts(projectDir) {
866
945
  const screenshotsDir = path.join(projectDir, "screenshots");
@@ -871,10 +950,19 @@ function cleanupDevArtifacts(projectDir) {
871
950
  if (fs.existsSync(screenshotsConfig)) {
872
951
  fs.rmSync(screenshotsConfig, { force: true });
873
952
  }
953
+ const langDir = path.join(projectDir, ".lang");
954
+ if (fs.existsSync(langDir)) {
955
+ fs.rmSync(langDir, { recursive: true, force: true });
956
+ }
874
957
  }
875
- function extractVariantFiles(projectDir, tpl) {
958
+ function resolveVariantDir(srcDir, variant, lang) {
959
+ const langVariant = `${lang}/${variant}`;
960
+ const hasLangVariant = fs.existsSync(path.join(srcDir, "pages", langVariant, "index.astro"));
961
+ return hasLangVariant ? langVariant : variant;
962
+ }
963
+ function extractVariantFiles(projectDir, tpl, lang) {
876
964
  const srcDir = path.join(projectDir, "src");
877
- const variant = tpl.variant;
965
+ const variant = resolveVariantDir(srcDir, tpl.variant, lang);
878
966
  const pagesVariantIndex = path.join(srcDir, "pages", variant, "index.astro");
879
967
  if (!fs.existsSync(pagesVariantIndex)) {
880
968
  throw new Error(
@@ -1008,31 +1096,69 @@ function rewritePackageName(projectDir, name) {
1008
1096
  logger.warn(t("create.packageNameFailed", { reason: String(err) }));
1009
1097
  }
1010
1098
  }
1011
- function rewriteWorkspaceDeps(projectDir) {
1099
+ var DEP_SECTIONS = ["dependencies", "devDependencies", "peerDependencies"];
1100
+ var REGISTRY_TIMEOUT_MS = 5e3;
1101
+ async function rewriteWorkspaceDeps(projectDir) {
1012
1102
  const pkgPath = path.join(projectDir, "package.json");
1013
1103
  if (!fs.existsSync(pkgPath)) return;
1014
1104
  try {
1015
1105
  const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
1106
+ const names = /* @__PURE__ */ new Set();
1107
+ for (const section of DEP_SECTIONS) {
1108
+ const deps = pkg[section];
1109
+ if (!deps) continue;
1110
+ for (const [name, value] of Object.entries(deps)) {
1111
+ if (typeof value === "string" && value.startsWith("workspace:")) names.add(name);
1112
+ }
1113
+ }
1114
+ if (names.size === 0) return;
1115
+ const versions = await resolveWorkspaceVersions([...names]);
1016
1116
  let touched = false;
1017
- for (const key of ["dependencies", "devDependencies", "peerDependencies"]) {
1018
- const deps = pkg[key];
1117
+ for (const section of DEP_SECTIONS) {
1118
+ const deps = pkg[section];
1019
1119
  if (!deps) continue;
1020
1120
  for (const [name, value] of Object.entries(deps)) {
1021
- if (typeof value !== "string") continue;
1022
- if (value.startsWith("workspace:")) {
1023
- deps[name] = `^${LISM_CSS_VERSION}`;
1121
+ if (typeof value === "string" && value.startsWith("workspace:")) {
1122
+ deps[name] = `^${versions[name]}`;
1024
1123
  touched = true;
1025
1124
  }
1026
1125
  }
1027
1126
  }
1028
1127
  if (touched) {
1029
1128
  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
1030
- logger.log(t("create.workspaceReplaced", { version: LISM_CSS_VERSION }));
1129
+ logger.log(t("create.workspaceReplaced"));
1031
1130
  }
1032
1131
  } catch (err) {
1033
1132
  logger.warn(t("create.workspaceFailed", { reason: String(err) }));
1034
1133
  }
1035
1134
  }
1135
+ async function resolveWorkspaceVersions(names) {
1136
+ const entries = await Promise.all(names.map(async (name) => [name, await resolveDepVersion(name)]));
1137
+ return Object.fromEntries(entries);
1138
+ }
1139
+ function bakedVersion(name) {
1140
+ return LISM_PACKAGE_VERSIONS[name] ?? LISM_PACKAGE_VERSIONS["lism-css"] ?? "unknown";
1141
+ }
1142
+ async function resolveDepVersion(name) {
1143
+ const baked = bakedVersion(name);
1144
+ if (!LISM_PACKAGE_VERSIONS[name]) return baked;
1145
+ const latest = await fetchLatestVersion(name);
1146
+ return latest ?? baked;
1147
+ }
1148
+ async function fetchLatestVersion(name) {
1149
+ const url = `${NPM_REGISTRY_BASE}/${name.replace(/\//g, "%2F")}/latest`;
1150
+ try {
1151
+ const res = await fetch(url, {
1152
+ headers: { accept: "application/json" },
1153
+ signal: AbortSignal.timeout(REGISTRY_TIMEOUT_MS)
1154
+ });
1155
+ if (!res.ok) return null;
1156
+ const data = await res.json();
1157
+ return typeof data.version === "string" ? data.version : null;
1158
+ } catch {
1159
+ return null;
1160
+ }
1161
+ }
1036
1162
 
1037
1163
  export {
1038
1164
  logger,
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  preScanLang,
14
14
  setLang,
15
15
  t
16
- } from "./chunk-USFIDRTL.js";
16
+ } from "./chunk-6E4LIZPL.js";
17
17
 
18
18
  // src/createProgram.ts
19
19
  import { Command as Command3 } from "commander";
@@ -322,10 +322,11 @@ function isExcludedComponentFile(rel, excludeRootFiles) {
322
322
  if (/(^|\/)[^/]+\.test\.[a-z]+$/.test(rel)) return true;
323
323
  return false;
324
324
  }
325
+ var FETCH_TIMEOUT_MS = 5e3;
325
326
  async function fetchCatalog(options = {}) {
326
327
  const ref = options.ref ?? DEFAULT_UI_REF;
327
328
  const url = `${RAW_GITHUB_BASE}/${SOURCE_REPO}/${ref}/${UI_REGISTRY_INDEX_PATH}`;
328
- const res = await fetch(url);
329
+ const res = await fetch(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
329
330
  if (!res.ok) {
330
331
  throw new Error(`Failed to fetch registry-index.json (${res.status} ${res.statusText}): ${url}`);
331
332
  }
package/dist/lib.d.ts CHANGED
@@ -2,9 +2,15 @@ interface RunCreateArgs {
2
2
  template?: string;
3
3
  targetDir?: string;
4
4
  force?: boolean;
5
+ /**
6
+ * 明示指定された言語(`--lang`)。`ja` / `en` のときその言語で CLI 表示・テンプレ生成を確定する。
7
+ * 未指定(undefined / 不正値)の場合は、対話端末では最初に言語選択プロンプトを出し、
8
+ * 非対話端末(CI・パイプ等)では `en` にフォールバックする。
9
+ */
10
+ lang?: string;
5
11
  }
6
12
  /** `lism create` / `create-lism` から共通で使える実体関数 */
7
- declare function runCreate({ template, targetDir, force }: RunCreateArgs): Promise<void>;
13
+ declare function runCreate({ template, targetDir, force, lang }: RunCreateArgs): Promise<void>;
8
14
 
9
15
  /**
10
16
  * CLI 表示用のメッセージ辞書(ja / en)。
@@ -25,8 +31,8 @@ declare const messages: {
25
31
  readonly en: "CLI for Lism CSS / UI";
26
32
  };
27
33
  readonly 'cli.opt.lang': {
28
- readonly ja: "CLI の表示言語を指定(ja | en";
29
- readonly en: "Display language for the CLI (ja | en)";
34
+ readonly ja: "CLI 表示と生成テンプレートの言語(ja | en、未指定なら対話時に選択)";
35
+ readonly en: "Language for the CLI and generated template (ja | en; prompted when omitted)";
30
36
  };
31
37
  readonly 'cli.create.description': {
32
38
  readonly ja: "templates から新規プロジェクトを生成する";
@@ -209,8 +215,8 @@ declare const messages: {
209
215
  readonly en: "Failed to rewrite package.json name: {reason}";
210
216
  };
211
217
  readonly 'create.workspaceReplaced': {
212
- readonly ja: " package.json の workspace:* を ^{version} に置換しました。";
213
- readonly en: " Replaced workspace:* in package.json with ^{version}.";
218
+ readonly ja: " package.json の workspace:* を公開バージョンに置換しました。";
219
+ readonly en: " Replaced workspace:* in package.json with published versions.";
214
220
  };
215
221
  readonly 'create.workspaceFailed': {
216
222
  readonly ja: "package.json の書き換えに失敗しました: {reason}";
@@ -459,14 +465,6 @@ declare const messages: {
459
465
  };
460
466
  type MessageKey = keyof typeof messages;
461
467
 
462
- /**
463
- * CLI の i18n(多言語化)基盤。
464
- *
465
- * - 既定は英語(`en`)。環境ロケールが `ja*` のときのみ日本語(`ja`)に切り替わる。
466
- * - `--lang <code>` オプションで明示上書き可能。
467
- * - メッセージ辞書は `messages.ts` に集約。
468
- */
469
-
470
468
  type Lang = 'ja' | 'en';
471
469
  /** 現在の言語を設定する(未知の値は無視) */
472
470
  declare function setLang(lang: string | undefined): void;
package/dist/lib.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  setLang,
4
4
  t,
5
5
  tOf
6
- } from "./chunk-USFIDRTL.js";
6
+ } from "./chunk-6E4LIZPL.js";
7
7
  export {
8
8
  runCreate,
9
9
  setLang,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lism-cli",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "CLI for scaffolding projects and adding UI components for Lism CSS / Lism UI.",
5
5
  "author": {
6
6
  "name": "ddryo",