@foundrykit/cli 3.0.0 → 3.1.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
@@ -1,10 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { readFileSync } from "fs";
5
- import { dirname, join } from "path";
6
- import { fileURLToPath } from "url";
7
- import { Command as Command10 } from "commander";
4
+ import { Command as Command11 } from "commander";
8
5
 
9
6
  // src/commands/add.ts
10
7
  import path5 from "path";
@@ -21,7 +18,7 @@ import fs3 from "fs-extra";
21
18
  import inquirer from "inquirer";
22
19
 
23
20
  // src/lib/constants.ts
24
- var DEFAULT_REGISTRY_URL = "https://foundry.umiflow.com";
21
+ var DEFAULT_REGISTRY_URL = "https://foundrykit.dokploy.umisites.com";
25
22
  var NPM_REGISTRY_URL = "https://registry.npmjs.org";
26
23
  var CACHE_TTL = 24 * 60 * 60 * 1e3;
27
24
  var CACHE_DIR = ".foundrykit";
@@ -54,7 +51,7 @@ var LOCK_FILE = "foundrykit.lock.json";
54
51
  var LEGACY_CONFIG_FILE = "foundrykit.config.json";
55
52
  var SCHEMA_URL = "https://unpkg.com/@foundrykit/cli@3/schema.json";
56
53
  var LEGACY_DEFAULT_REGISTRY_URL = "https://foundry.umiflow.com";
57
- var DEFAULT_HUB_URL = "http://localhost:3003";
54
+ var DEFAULT_HUB_URL = "https://foundrykit.dokploy.umisites.com";
58
55
  var CREDENTIALS_FILE = "credentials.json";
59
56
 
60
57
  // src/lib/project/files.ts
@@ -106,7 +103,8 @@ import path2 from "path";
106
103
  import chalk from "chalk";
107
104
  import fs2 from "fs-extra";
108
105
  function resolveRegistryUrl(settings) {
109
- return process.env.FOUNDRYKIT_REGISTRY_URL || settings?.registry || DEFAULT_REGISTRY_URL;
106
+ const url = process.env.FOUNDRYKIT_REGISTRY_URL || settings?.registry || DEFAULT_REGISTRY_URL;
107
+ return url === LEGACY_DEFAULT_REGISTRY_URL ? DEFAULT_REGISTRY_URL : url;
110
108
  }
111
109
  var DEFAULT_CONFIG = {
112
110
  cacheDir: path2.join(os.homedir(), CACHE_DIR, "cache"),
@@ -294,11 +292,11 @@ export function cn(...inputs: ClassValue[]) {
294
292
  if (!await fs2.pathExists(packageJsonPath)) {
295
293
  return false;
296
294
  }
297
- const packageJson2 = await fs2.readJson(packageJsonPath);
295
+ const packageJson = await fs2.readJson(packageJsonPath);
298
296
  const allDeps = {
299
- ...packageJson2.dependencies,
300
- ...packageJson2.devDependencies,
301
- ...packageJson2.peerDependencies
297
+ ...packageJson.dependencies,
298
+ ...packageJson.devDependencies,
299
+ ...packageJson.peerDependencies
302
300
  };
303
301
  return packageName in allDeps;
304
302
  } catch {
@@ -674,6 +672,81 @@ function interactivePrompt() {
674
672
  };
675
673
  }
676
674
 
675
+ // src/lib/banner.ts
676
+ import { readFileSync } from "fs";
677
+ import { dirname, join } from "path";
678
+ import { fileURLToPath } from "url";
679
+ var KIT = [
680
+ "\u2584\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588",
681
+ "\u2588\u2588\u2588\u2588 \u2580\u2580\u2580\u2580\u2580",
682
+ "\u2588\u2588\u2588\u2588 \u2584\u2584\u2584 ",
683
+ "\u2588\u2588\u2588\u2588 \u2580\u2580\u2580 ",
684
+ "\u2588\u2588\u2588\u2588 ",
685
+ "\u2588\u2588\u2588\u2588 "
686
+ ];
687
+ var PLAIN = [
688
+ ".#########",
689
+ "#### ",
690
+ "######## ",
691
+ "#### ",
692
+ "#### ####",
693
+ "#### ####"
694
+ ];
695
+ function renderBanner(version, info, { isTTY, columns, env: env2, argv }) {
696
+ if (!isTTY || argv.includes("--json")) return null;
697
+ const color = !("NO_COLOR" in env2);
698
+ const locale = env2.LC_ALL || env2.LC_CTYPE || env2.LANG || "UTF-8";
699
+ const unicode = color && !env2.CI && /UTF-?8/i.test(locale);
700
+ const truecolor = /truecolor|24bit/.test(env2.COLORTERM ?? "");
701
+ const pour = (s) => !color ? s : truecolor ? `\x1B[38;2;240;122;58m${s}\x1B[39m` : `\x1B[38;5;208m${s}\x1B[39m`;
702
+ const dim = (s) => color ? `\x1B[2m${s}\x1B[22m` : s;
703
+ if ((columns ?? 80) < 60) {
704
+ return `${pour(unicode ? "\u2584\u2588" : "[F]")} FoundryKit ${dim(version)}`;
705
+ }
706
+ const mark = unicode ? KIT : PLAIN;
707
+ const text = [
708
+ `FoundryKit CLI ${dim(version)}`,
709
+ dim("parts for Payload + Next.js"),
710
+ "",
711
+ ...info.map(([label, value]) => `${dim(label.padEnd(10))}${value}`)
712
+ ];
713
+ const rows = mark.map((m, i) => `${pour(m)} ${text[i] ?? ""}`.trimEnd());
714
+ return `
715
+ ${rows.join("\n")}
716
+ `;
717
+ }
718
+ function printBanner(info) {
719
+ const text = renderBanner(cliVersion(), info, {
720
+ isTTY: Boolean(process.stdout.isTTY),
721
+ columns: process.stdout.columns,
722
+ env: process.env,
723
+ argv: process.argv
724
+ });
725
+ if (text) console.log(text);
726
+ }
727
+ function cliVersion() {
728
+ const dir = dirname(fileURLToPath(import.meta.url));
729
+ for (const rel of ["..", "../.."]) {
730
+ try {
731
+ const pkg = JSON.parse(
732
+ readFileSync(join(dir, rel, "package.json"), "utf8")
733
+ );
734
+ if (pkg.name === "@foundrykit/cli") return pkg.version;
735
+ } catch {
736
+ }
737
+ }
738
+ return "";
739
+ }
740
+ function projectSummary(pkg) {
741
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
742
+ const ver = (n) => deps[n]?.replace(/^[^\d]*/, "");
743
+ return [
744
+ pkg.name,
745
+ deps.next && `Next ${ver("next")}`,
746
+ deps.payload && `Payload ${ver("payload")}`
747
+ ].filter(Boolean).join(" \xB7 ");
748
+ }
749
+
677
750
  // src/lib/project/index.ts
678
751
  import path4 from "path";
679
752
  import fs4 from "fs-extra";
@@ -743,8 +816,8 @@ var KNOWN_TOP_LEVEL = new Set(RULES.map(([p]) => p.split(".")[0]));
743
816
  var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
744
817
  function validateSettings(raw) {
745
818
  if (!isObject(raw)) throw new SettingsError("(root)", "an object");
746
- for (const [path10, type, required, pattern] of RULES) {
747
- const [parent, child] = path10.includes(".") ? [path10.slice(0, path10.indexOf(".")), path10.slice(path10.indexOf(".") + 1)] : [void 0, path10];
819
+ for (const [path12, type, required, pattern] of RULES) {
820
+ const [parent, child] = path12.includes(".") ? [path12.slice(0, path12.indexOf(".")), path12.slice(path12.indexOf(".") + 1)] : [void 0, path12];
748
821
  let holder = raw;
749
822
  if (parent) {
750
823
  holder = raw[parent];
@@ -752,7 +825,7 @@ function validateSettings(raw) {
752
825
  if (!isObject(holder)) {
753
826
  if (required)
754
827
  throw new SettingsError(
755
- path10,
828
+ path12,
756
829
  `${type} (parent "${parent}" must be an object)`
757
830
  );
758
831
  throw new SettingsError(parent, "an object");
@@ -760,12 +833,12 @@ function validateSettings(raw) {
760
833
  }
761
834
  const value = holder[child];
762
835
  if (value === void 0) {
763
- if (required) throw new SettingsError(path10, `a ${type} (missing)`);
836
+ if (required) throw new SettingsError(path12, `a ${type} (missing)`);
764
837
  continue;
765
838
  }
766
- if (typeof value !== type) throw new SettingsError(path10, `a ${type}`);
839
+ if (typeof value !== type) throw new SettingsError(path12, `a ${type}`);
767
840
  if (pattern && !pattern.test(value))
768
- throw new SettingsError(path10, `a string matching ${pattern.source}`);
841
+ throw new SettingsError(path12, `a string matching ${pattern.source}`);
769
842
  }
770
843
  const warnings = Object.keys(raw).filter((k) => !KNOWN_TOP_LEVEL.has(k)).map((k) => `foundrykit.json: unknown key "${k}" (ignored)`);
771
844
  return { settings: raw, warnings };
@@ -963,6 +1036,13 @@ function addCommand() {
963
1036
  try {
964
1037
  const project = await loadProject(process.cwd());
965
1038
  process.chdir(project.root);
1039
+ printBanner([
1040
+ [
1041
+ "project",
1042
+ projectSummary(await fs5.readJson("package.json").catch(() => ({})))
1043
+ ],
1044
+ ["registry", resolveRegistryUrl(project.settings)]
1045
+ ]);
966
1046
  validateProject(project, options);
967
1047
  const ids = id ? [id] : await selectComponentsInteractively(project);
968
1048
  if (ids.length === 0) {
@@ -1211,10 +1291,10 @@ function getPackageInstallSpec(packageName, version) {
1211
1291
  async function getMissingPackages(packages) {
1212
1292
  const packageJsonPath = path5.join(process.cwd(), "package.json");
1213
1293
  try {
1214
- const packageJson2 = await fs5.readJson(packageJsonPath);
1294
+ const packageJson = await fs5.readJson(packageJsonPath);
1215
1295
  const installedPackages = {
1216
- ...packageJson2.dependencies,
1217
- ...packageJson2.devDependencies
1296
+ ...packageJson.dependencies,
1297
+ ...packageJson.devDependencies
1218
1298
  };
1219
1299
  return packages.filter((pkg) => !installedPackages[pkg]);
1220
1300
  } catch {
@@ -1722,10 +1802,10 @@ async function deleteCredential(hubUrl, home) {
1722
1802
  // src/lib/hub/client.ts
1723
1803
  var isTimeout = (e) => e?.name === "TimeoutError";
1724
1804
  var timedOut = (hubUrl) => new HubError(0, "timeout", `The hub at ${hubUrl} didn't answer in time.`);
1725
- async function hubFetch(hubUrl, token, method, path10, body, opts = {}) {
1805
+ async function hubFetch(hubUrl, token, method, path12, body, opts = {}) {
1726
1806
  let res;
1727
1807
  try {
1728
- res = await fetch(`${hubUrl}${path10}`, {
1808
+ res = await fetch(`${hubUrl}${path12}`, {
1729
1809
  method,
1730
1810
  // A 307/308 would resend the body (tokens, secrets) to wherever it points.
1731
1811
  redirect: "error",
@@ -2104,8 +2184,8 @@ async function collectBasicChecks(cwd) {
2104
2184
  ok: hasPackageJson,
2105
2185
  detail: hasPackageJson ? "Project manifest found" : "Run this command in a project root"
2106
2186
  });
2107
- const packageJson2 = hasPackageJson ? await fs7.readJson(packageJsonPath) : null;
2108
- const hasNext = !!(packageJson2?.dependencies?.next || packageJson2?.devDependencies?.next);
2187
+ const packageJson = hasPackageJson ? await fs7.readJson(packageJsonPath) : null;
2188
+ const hasNext = !!(packageJson?.dependencies?.next || packageJson?.devDependencies?.next);
2109
2189
  results.push({
2110
2190
  name: "Framework",
2111
2191
  ok: hasNext,
@@ -2171,6 +2251,14 @@ import inquirer4 from "inquirer";
2171
2251
  function initCommand() {
2172
2252
  return new Command4("init").description("Initialize FoundryKit in your project").option("-f, --force", "overwrite existing files").option("--skip-install", "skip installing dependencies").option("--skip-prompts", "use default paths without prompting").action(async (options) => {
2173
2253
  try {
2254
+ const pkgPath = path8.join(process.cwd(), "package.json");
2255
+ printBanner([
2256
+ [
2257
+ "project",
2258
+ fs8.existsSync(pkgPath) ? projectSummary(await fs8.readJson(pkgPath).catch(() => ({}))) : path8.basename(process.cwd())
2259
+ ],
2260
+ ["registry", resolveRegistryUrl()]
2261
+ ]);
2174
2262
  console.log(chalk6.blue("\u{1F680} Initializing FoundryKit..."));
2175
2263
  await validateProject2();
2176
2264
  if (!options.force && await isFoundryKitInitialized()) {
@@ -2244,10 +2332,10 @@ async function validateProject2() {
2244
2332
  "No package.json found. Please run this command in a project directory."
2245
2333
  );
2246
2334
  }
2247
- const packageJson2 = await fs8.readJson(packageJsonPath);
2335
+ const packageJson = await fs8.readJson(packageJsonPath);
2248
2336
  const deps = {
2249
- ...packageJson2.dependencies,
2250
- ...packageJson2.devDependencies
2337
+ ...packageJson.dependencies,
2338
+ ...packageJson.devDependencies
2251
2339
  };
2252
2340
  if (!deps.next) {
2253
2341
  throw new Error(
@@ -2791,13 +2879,13 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
2791
2879
  async function updatePackageScripts() {
2792
2880
  console.log(chalk6.blue("\u{1F4DD} Updating package.json scripts..."));
2793
2881
  const packageJsonPath = path8.join(process.cwd(), "package.json");
2794
- const packageJson2 = await fs8.readJson(packageJsonPath);
2795
- packageJson2.scripts = {
2796
- ...packageJson2.scripts,
2882
+ const packageJson = await fs8.readJson(packageJsonPath);
2883
+ packageJson.scripts = {
2884
+ ...packageJson.scripts,
2797
2885
  "foundrykit:add": "pnpm dlx @foundrykit/cli add",
2798
2886
  "foundrykit:update": "pnpm dlx @foundrykit/cli update"
2799
2887
  };
2800
- await fs8.writeJson(packageJsonPath, packageJson2, { spaces: 2 });
2888
+ await fs8.writeJson(packageJsonPath, packageJson, { spaces: 2 });
2801
2889
  console.log(chalk6.green("\u2705 Package scripts updated"));
2802
2890
  }
2803
2891
  async function createConfigFile(options, structure, pathConfig) {
@@ -3075,10 +3163,10 @@ import inquirer5 from "inquirer";
3075
3163
  // src/lib/hub/device.ts
3076
3164
  var CLIENT_ID = "foundrykit-cli";
3077
3165
  var str = (v) => typeof v === "string";
3078
- async function post(hubUrl, path10, body) {
3166
+ async function post(hubUrl, path12, body) {
3079
3167
  let res;
3080
3168
  try {
3081
- res = await fetch(`${hubUrl}${path10}`, {
3169
+ res = await fetch(`${hubUrl}${path12}`, {
3082
3170
  method: "POST",
3083
3171
  redirect: "error",
3084
3172
  headers: {
@@ -3733,11 +3821,11 @@ async function getInstalledFoundryKitPackageVersions(root) {
3733
3821
  if (!fs9.existsSync(packageJsonPath)) {
3734
3822
  return {};
3735
3823
  }
3736
- const packageJson2 = await fs9.readJson(packageJsonPath);
3824
+ const packageJson = await fs9.readJson(packageJsonPath);
3737
3825
  const dependencies = {
3738
- ...packageJson2.dependencies,
3739
- ...packageJson2.devDependencies,
3740
- ...packageJson2.optionalDependencies
3826
+ ...packageJson.dependencies,
3827
+ ...packageJson.devDependencies,
3828
+ ...packageJson.optionalDependencies
3741
3829
  };
3742
3830
  return Object.fromEntries(
3743
3831
  Object.entries(dependencies).filter(([name]) => name.startsWith("@foundrykit/")).map(([name, version]) => [
@@ -3763,18 +3851,215 @@ function normalizeVersionSpec(version) {
3763
3851
  return version.replace(/^[^\d]*/, "").split("-")[0]?.replace(/[^\d.]/g, "") || "0";
3764
3852
  }
3765
3853
 
3854
+ // src/commands/upgrade.ts
3855
+ import { execFile as execFile3 } from "child_process";
3856
+ import path11 from "path";
3857
+ import { promisify as promisify2 } from "util";
3858
+ import chalk10 from "chalk";
3859
+ import { Command as Command10 } from "commander";
3860
+ import fs11 from "fs-extra";
3861
+ import inquirer8 from "inquirer";
3862
+
3863
+ // src/lib/codemods.ts
3864
+ import path10 from "path";
3865
+ import fs10 from "fs-extra";
3866
+ import { glob } from "glob";
3867
+ var DEP_FIELDS = [
3868
+ "dependencies",
3869
+ "devDependencies",
3870
+ "peerDependencies",
3871
+ "optionalDependencies"
3872
+ ];
3873
+ var SOURCE_GLOB = "**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs,json,md,mdx,css,scss}";
3874
+ var IGNORE = [
3875
+ "**/node_modules/**",
3876
+ "**/.next/**",
3877
+ "**/dist/**",
3878
+ "**/build/**",
3879
+ "**/.git/**",
3880
+ "**/package-lock.json",
3881
+ "**/CHANGELOG.md"
3882
+ ];
3883
+ var escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3884
+ function renameDependency(pkg, from, to, range) {
3885
+ let changed = false;
3886
+ for (const field of DEP_FIELDS) {
3887
+ const deps = pkg[field];
3888
+ if (!deps || !(from in deps)) continue;
3889
+ pkg[field] = Object.fromEntries(
3890
+ Object.entries(deps).map(([k, v]) => k === from ? [to, range] : [k, v])
3891
+ );
3892
+ changed = true;
3893
+ }
3894
+ return changed;
3895
+ }
3896
+ function renamePackage(from, to, range) {
3897
+ const specifier = new RegExp(`${escapeRe(from)}(?![a-z0-9._~-])`, "g");
3898
+ return {
3899
+ id: `rename:${from}`,
3900
+ detect(pkg) {
3901
+ for (const field of DEP_FIELDS) {
3902
+ const version = pkg[field]?.[from];
3903
+ if (version) return `${from}@${version} \u2192 ${to}@${range}`;
3904
+ }
3905
+ return null;
3906
+ },
3907
+ async run(root, opts = {}) {
3908
+ const files = await glob(SOURCE_GLOB, {
3909
+ cwd: root,
3910
+ ignore: IGNORE,
3911
+ nodir: true
3912
+ });
3913
+ const changed = [];
3914
+ for (const rel of files.sort()) {
3915
+ const file = path10.join(root, rel);
3916
+ const text = await fs10.readFile(file, "utf8");
3917
+ if (!text.includes(from)) continue;
3918
+ let next = text;
3919
+ if (path10.basename(rel) === "package.json") {
3920
+ const pkg = JSON.parse(text);
3921
+ if (renameDependency(pkg, from, to, range)) {
3922
+ const indent = text.match(/^[ \t]+(?=")/m)?.[0] ?? " ";
3923
+ next = `${JSON.stringify(pkg, null, indent)}
3924
+ `;
3925
+ }
3926
+ }
3927
+ next = next.replace(specifier, to);
3928
+ if (next === text) continue;
3929
+ if (!opts.dryRun) await fs10.writeFile(file, next);
3930
+ changed.push(rel);
3931
+ }
3932
+ return changed;
3933
+ }
3934
+ };
3935
+ }
3936
+ var CODEMODS = [
3937
+ renamePackage(
3938
+ "@foundrykit/advanced-forms-plugin",
3939
+ "@foundrykit/form-plugin",
3940
+ "^1.16.4"
3941
+ ),
3942
+ renamePackage(
3943
+ "@foundrykit/advanced-seo-plugin",
3944
+ "@foundrykit/seo-plugin",
3945
+ "^0.3.1"
3946
+ )
3947
+ ];
3948
+
3949
+ // src/commands/upgrade.ts
3950
+ async function hasUncommittedChanges(cwd) {
3951
+ try {
3952
+ const { stdout } = await promisify2(execFile3)(
3953
+ "git",
3954
+ ["status", "--porcelain"],
3955
+ { cwd }
3956
+ );
3957
+ return stdout.trim() !== "";
3958
+ } catch {
3959
+ return false;
3960
+ }
3961
+ }
3962
+ async function runUpgrade(opts, cwd, prompt = inquirer8.prompt) {
3963
+ const pkgPath = path11.join(cwd, "package.json");
3964
+ if (!await fs11.pathExists(pkgPath)) {
3965
+ console.error(
3966
+ chalk10.red("No package.json here. Run this in your project root.")
3967
+ );
3968
+ return 1;
3969
+ }
3970
+ const pkg = await fs11.readJson(pkgPath);
3971
+ const found = CODEMODS.map((mod) => ({ mod, summary: mod.detect(pkg) })).filter(
3972
+ (f) => f.summary !== null
3973
+ );
3974
+ if (found.length === 0) {
3975
+ console.log(
3976
+ chalk10.green("Nothing to upgrade. No codemods apply to this project.")
3977
+ );
3978
+ return 0;
3979
+ }
3980
+ console.log(chalk10.bold("These codemods apply to this project:"));
3981
+ for (const f of found) console.log(` \u2022 ${f.summary}`);
3982
+ let selected = found;
3983
+ if (!opts.yes && !opts.dryRun) {
3984
+ if (await hasUncommittedChanges(cwd)) {
3985
+ const { go } = await prompt([
3986
+ {
3987
+ type: "confirm",
3988
+ name: "go",
3989
+ message: "You have uncommitted changes. Codemods edit files in place; continue anyway?",
3990
+ default: false
3991
+ }
3992
+ ]);
3993
+ if (!go) return 1;
3994
+ }
3995
+ const { ids } = await prompt([
3996
+ {
3997
+ type: "checkbox",
3998
+ name: "ids",
3999
+ message: "Run which codemods?",
4000
+ choices: found.map((f) => ({
4001
+ name: f.summary,
4002
+ value: f.mod.id,
4003
+ checked: true
4004
+ }))
4005
+ }
4006
+ ]);
4007
+ selected = found.filter((f) => ids.includes(f.mod.id));
4008
+ if (selected.length === 0) return 0;
4009
+ }
4010
+ const changed = /* @__PURE__ */ new Set();
4011
+ for (const { mod, summary } of selected) {
4012
+ const files = await mod.run(cwd, { dryRun: opts.dryRun });
4013
+ console.log(`
4014
+ ${chalk10.cyan(summary)}: ${files.length} file(s)`);
4015
+ for (const file of files) {
4016
+ console.log(` ${file}`);
4017
+ changed.add(file);
4018
+ }
4019
+ }
4020
+ if (opts.dryRun) {
4021
+ console.log(chalk10.yellow("\nDry run: nothing was written."));
4022
+ return 0;
4023
+ }
4024
+ const pm = await detectPackageManager();
4025
+ if (opts.install !== false) {
4026
+ console.log(chalk10.blue(`
4027
+ Running ${pm} install...`));
4028
+ try {
4029
+ await runPackageManager(pm, ["install"], { cwd });
4030
+ } catch (e) {
4031
+ console.error(chalk10.red(e.message));
4032
+ console.log(`Run \`${pm} install\` yourself to finish.`);
4033
+ return 1;
4034
+ }
4035
+ }
4036
+ console.log(chalk10.green(`
4037
+ Done. ${changed.size} file(s) changed.`));
4038
+ console.log("Next:");
4039
+ console.log(
4040
+ ` \u2022 Payload site? Run \`${pm} payload generate:importmap\` to regenerate the admin import map.`
4041
+ );
4042
+ console.log(
4043
+ " \u2022 Review with `git diff`, then build and test before committing."
4044
+ );
4045
+ return 0;
4046
+ }
4047
+ function upgradeCommand() {
4048
+ return new Command10("upgrade").description(
4049
+ "Find and run codemods for renamed or changed FoundryKit packages"
4050
+ ).option("-y, --yes", "run every applicable codemod without asking").option("--dry-run", "list the files that would change and stop").option("--no-install", "skip the package manager install afterwards").action(async (opts) => {
4051
+ process.exitCode = await runUpgrade(opts, process.cwd());
4052
+ });
4053
+ }
4054
+
3766
4055
  // src/index.ts
3767
- var __filename = fileURLToPath(import.meta.url);
3768
- var __dirname = dirname(__filename);
3769
- var packageJson = JSON.parse(
3770
- readFileSync(join(__dirname, "..", "package.json"), "utf-8")
3771
- );
3772
- var program = new Command10();
3773
- program.name("foundrykit").description("FoundryKit CLI - Component library management tool").version(packageJson.version);
4056
+ var program = new Command11();
4057
+ program.name("foundrykit").description("FoundryKit CLI - Component library management tool").version(cliVersion());
3774
4058
  program.addCommand(initCommand());
3775
4059
  program.addCommand(listCommand());
3776
4060
  program.addCommand(addCommand());
3777
4061
  program.addCommand(updateCommand());
4062
+ program.addCommand(upgradeCommand());
3778
4063
  program.addCommand(doctorCommand());
3779
4064
  program.addCommand(loginCommand());
3780
4065
  program.addCommand(logoutCommand());