@lark-apaas/fullstack-cli 1.1.71-beta.0 → 1.1.72-alpha.20261114063639

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,7 +1,7 @@
1
1
  // src/index.ts
2
- import fs34 from "fs";
3
- import path27 from "path";
4
- import { fileURLToPath as fileURLToPath5 } from "url";
2
+ import fs35 from "fs";
3
+ import path28 from "path";
4
+ import { fileURLToPath as fileURLToPath6 } from "url";
5
5
  import { config as dotenvConfig } from "dotenv";
6
6
 
7
7
  // src/cli.ts
@@ -3458,7 +3458,7 @@ function getCliVersion() {
3458
3458
  }
3459
3459
 
3460
3460
  // src/commands/upgrade/get-upgrade-files.ts
3461
- function getUpgradeFilesToStage(disableGenOpenapi = true, userProjectRoot = process.env.INIT_CWD || process.cwd()) {
3461
+ function getUpgradeFilesToStage(disableGenOpenapi = true, userProjectRoot = process.env.INIT_CWD || process.cwd(), includeOxlintConfig = false) {
3462
3462
  const stack = resolveStack(userProjectRoot);
3463
3463
  const isNestjs = isNestjsProject(userProjectRoot, stack);
3464
3464
  const syncConfig = genSyncConfig(stack, { disableGenOpenapi });
@@ -3475,11 +3475,63 @@ function getUpgradeFilesToStage(disableGenOpenapi = true, userProjectRoot = proc
3475
3475
  filesToStage.add(rule.to);
3476
3476
  }
3477
3477
  });
3478
+ if (isNestjs && includeOxlintConfig) filesToStage.add("oxlint.config.ts");
3478
3479
  filesToStage.add("package.json");
3479
3480
  filesToStage.add("package-lock.json");
3480
3481
  return Array.from(filesToStage);
3481
3482
  }
3482
3483
 
3484
+ // src/commands/upgrade/oxlint-config.ts
3485
+ import fs13 from "fs";
3486
+ import path10 from "path";
3487
+ import { createRequire as createRequire2 } from "module";
3488
+ import { fileURLToPath as fileURLToPath5 } from "url";
3489
+ async function prepareOxlintConfig(projectRoot) {
3490
+ if (!isNestjsProject(projectRoot, resolveStack(projectRoot)))
3491
+ return "not-nestjs";
3492
+ const existing = [
3493
+ "oxlint.config.ts",
3494
+ "oxlint.config.mts",
3495
+ "oxlint.config.cts",
3496
+ "oxlint.config.js",
3497
+ "oxlint.config.mjs",
3498
+ "oxlint.config.cjs",
3499
+ ".oxlintrc.json"
3500
+ ];
3501
+ if (existing.some((name) => fs13.existsSync(path10.join(projectRoot, name))))
3502
+ return "existing";
3503
+ const request = createRequire2(path10.join(projectRoot, "package.json"));
3504
+ const pluginRoot = path10.resolve(
3505
+ path10.dirname(fileURLToPath5(import.meta.url)),
3506
+ ".."
3507
+ );
3508
+ const bundled = path10.join(pluginRoot, "templates/oxlint");
3509
+ const assets = fs13.existsSync(bundled) ? bundled : path10.resolve(
3510
+ path10.dirname(fileURLToPath5(import.meta.url)),
3511
+ "../../..",
3512
+ "templates/oxlint"
3513
+ );
3514
+ const eslintFile = path10.join(projectRoot, "eslint.config.js");
3515
+ const normalize = (text) => text.replace(/^\uFEFF/, "").replace(/\r\n/g, "\n");
3516
+ const current = normalize(fs13.readFileSync(eslintFile, "utf8"));
3517
+ const original = normalize(
3518
+ fs13.readFileSync(path10.join(assets, "eslint.config.js.reference"), "utf8")
3519
+ );
3520
+ if (current === original) {
3521
+ fs13.copyFileSync(
3522
+ path10.join(assets, "oxlint.config.ts"),
3523
+ path10.join(projectRoot, "oxlint.config.ts"),
3524
+ fs13.constants.COPYFILE_EXCL
3525
+ );
3526
+ return "template";
3527
+ }
3528
+ const { generateOxlintConfig } = request(
3529
+ "@lark-apaas/fullstack-presets/lib/oxlint/upgrade.js"
3530
+ );
3531
+ await generateOxlintConfig({ projectRoot });
3532
+ return "generated";
3533
+ }
3534
+
3483
3535
  // src/commands/upgrade/run.handler.ts
3484
3536
  async function run3(options = {}) {
3485
3537
  const userProjectRoot = process.env.INIT_CWD || process.cwd();
@@ -3487,6 +3539,7 @@ async function run3(options = {}) {
3487
3539
  try {
3488
3540
  console.log("[fullstack-cli] Step 1/3: Syncing template files...");
3489
3541
  await run2({ disableGenOpenapi: options.disableGenOpenapi ?? true });
3542
+ const oxlintStatus = await prepareOxlintConfig(userProjectRoot);
3490
3543
  console.log("[fullstack-cli] Step 2/3: Cleaning up package.json...");
3491
3544
  const cleaned = cleanupPackageJson(userProjectRoot);
3492
3545
  if (!cleaned) {
@@ -3496,10 +3549,16 @@ async function run3(options = {}) {
3496
3549
  if (shouldCommit) {
3497
3550
  console.log("[fullstack-cli] Step 3/3: Committing changes...");
3498
3551
  const version = getCliVersion();
3499
- const filesToStage = getUpgradeFilesToStage(options.disableGenOpenapi ?? true, userProjectRoot);
3552
+ const filesToStage = getUpgradeFilesToStage(
3553
+ options.disableGenOpenapi ?? true,
3554
+ userProjectRoot,
3555
+ oxlintStatus === "template" || oxlintStatus === "generated"
3556
+ );
3500
3557
  autoCommitUpgradeChanges(version, userProjectRoot, filesToStage);
3501
3558
  } else {
3502
- console.log("[fullstack-cli] Step 3/3: Skipping commit (--no-commit flag)");
3559
+ console.log(
3560
+ "[fullstack-cli] Step 3/3: Skipping commit (--no-commit flag)"
3561
+ );
3503
3562
  }
3504
3563
  console.log("[fullstack-cli] Upgrade completed successfully \u2705");
3505
3564
  } catch (error) {
@@ -3511,8 +3570,8 @@ async function run3(options = {}) {
3511
3570
 
3512
3571
  // src/commands/upgrade/deps/run.handler.ts
3513
3572
  import { spawnSync as spawnSync4 } from "child_process";
3514
- import fs13 from "fs";
3515
- import path10 from "path";
3573
+ import fs14 from "fs";
3574
+ import path11 from "path";
3516
3575
 
3517
3576
  // src/utils/grayscale/config.ts
3518
3577
  function getGrayscaleConfig(configJson) {
@@ -3760,8 +3819,8 @@ function installGrayscaleVersions(packages, grayscaleVersions, cwd, dryRun, mode
3760
3819
  if (version) {
3761
3820
  let current = "";
3762
3821
  try {
3763
- const installedPkgPath = path10.join(cwd, "node_modules", pkg2, "package.json");
3764
- const installedPkg = JSON.parse(fs13.readFileSync(installedPkgPath, "utf-8"));
3822
+ const installedPkgPath = path11.join(cwd, "node_modules", pkg2, "package.json");
3823
+ const installedPkg = JSON.parse(fs14.readFileSync(installedPkgPath, "utf-8"));
3765
3824
  current = installedPkg.version || "";
3766
3825
  } catch (err) {
3767
3826
  const code = err?.code;
@@ -3879,8 +3938,8 @@ var depsCommand = {
3879
3938
 
3880
3939
  // src/commands/upgrade/global-deps/run.handler.ts
3881
3940
  import { spawnSync as spawnSync5 } from "child_process";
3882
- import fs14 from "fs";
3883
- import path11 from "path";
3941
+ import fs15 from "fs";
3942
+ import path12 from "path";
3884
3943
  var MANAGED_GLOBAL_CLIS = [
3885
3944
  "@lark-apaas/fullstack-cli",
3886
3945
  "@lark-apaas/miaoda-cli"
@@ -3891,15 +3950,15 @@ function readGlobalInstalledVersion(pkg2) {
3891
3950
  if (process.env.NPM_CONFIG_PREFIX) candidates.push(process.env.NPM_CONFIG_PREFIX);
3892
3951
  candidates.push("/usr");
3893
3952
  candidates.push("/usr/local");
3894
- if (process.env.HOME) candidates.push(path11.join(process.env.HOME, ".npm-global"));
3953
+ if (process.env.HOME) candidates.push(path12.join(process.env.HOME, ".npm-global"));
3895
3954
  const seen = /* @__PURE__ */ new Set();
3896
3955
  for (const prefix of candidates) {
3897
3956
  if (seen.has(prefix)) continue;
3898
3957
  seen.add(prefix);
3899
3958
  try {
3900
- const pkgPath = path11.join(prefix, "lib", "node_modules", pkg2, "package.json");
3901
- if (fs14.existsSync(pkgPath)) {
3902
- const meta = JSON.parse(fs14.readFileSync(pkgPath, "utf-8"));
3959
+ const pkgPath = path12.join(prefix, "lib", "node_modules", pkg2, "package.json");
3960
+ if (fs15.existsSync(pkgPath)) {
3961
+ const meta = JSON.parse(fs15.readFileSync(pkgPath, "utf-8"));
3903
3962
  if (meta && typeof meta.version === "string") return meta.version;
3904
3963
  }
3905
3964
  } catch (err) {
@@ -3996,8 +4055,8 @@ var upgradeCommand = {
3996
4055
  };
3997
4056
 
3998
4057
  // src/commands/action-plugin/utils.ts
3999
- import fs15 from "fs";
4000
- import path12 from "path";
4058
+ import fs16 from "fs";
4059
+ import path13 from "path";
4001
4060
  import { spawnSync as spawnSync6, execSync as execSync2 } from "child_process";
4002
4061
  function parsePluginName(input) {
4003
4062
  const match = input.match(/^(@[^/]+\/[^@]+)(?:@(.+))?$/);
@@ -4015,18 +4074,18 @@ function getProjectRoot() {
4015
4074
  return process.cwd();
4016
4075
  }
4017
4076
  function getPackageJsonPath() {
4018
- return path12.join(getProjectRoot(), "package.json");
4077
+ return path13.join(getProjectRoot(), "package.json");
4019
4078
  }
4020
4079
  function getPluginPath(pluginName) {
4021
- return path12.join(getProjectRoot(), "node_modules", pluginName);
4080
+ return path13.join(getProjectRoot(), "node_modules", pluginName);
4022
4081
  }
4023
4082
  function readPackageJson2() {
4024
4083
  const pkgPath = getPackageJsonPath();
4025
- if (!fs15.existsSync(pkgPath)) {
4084
+ if (!fs16.existsSync(pkgPath)) {
4026
4085
  throw new Error("package.json not found in current directory");
4027
4086
  }
4028
4087
  try {
4029
- const content = fs15.readFileSync(pkgPath, "utf-8");
4088
+ const content = fs16.readFileSync(pkgPath, "utf-8");
4030
4089
  return JSON.parse(content);
4031
4090
  } catch {
4032
4091
  throw new Error("Failed to parse package.json");
@@ -4034,7 +4093,7 @@ function readPackageJson2() {
4034
4093
  }
4035
4094
  function writePackageJson2(pkg2) {
4036
4095
  const pkgPath = getPackageJsonPath();
4037
- fs15.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
4096
+ fs16.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
4038
4097
  }
4039
4098
  function readActionPlugins() {
4040
4099
  const pkg2 = readPackageJson2();
@@ -4067,12 +4126,12 @@ function npmInstall(tgzPath) {
4067
4126
  }
4068
4127
  }
4069
4128
  function getPackageVersion(pluginName) {
4070
- const pkgJsonPath = path12.join(getPluginPath(pluginName), "package.json");
4071
- if (!fs15.existsSync(pkgJsonPath)) {
4129
+ const pkgJsonPath = path13.join(getPluginPath(pluginName), "package.json");
4130
+ if (!fs16.existsSync(pkgJsonPath)) {
4072
4131
  return null;
4073
4132
  }
4074
4133
  try {
4075
- const content = fs15.readFileSync(pkgJsonPath, "utf-8");
4134
+ const content = fs16.readFileSync(pkgJsonPath, "utf-8");
4076
4135
  const pkg2 = JSON.parse(content);
4077
4136
  return pkg2.version || null;
4078
4137
  } catch {
@@ -4080,49 +4139,49 @@ function getPackageVersion(pluginName) {
4080
4139
  }
4081
4140
  }
4082
4141
  function readPluginPackageJson(pluginPath) {
4083
- const pkgJsonPath = path12.join(pluginPath, "package.json");
4084
- if (!fs15.existsSync(pkgJsonPath)) {
4142
+ const pkgJsonPath = path13.join(pluginPath, "package.json");
4143
+ if (!fs16.existsSync(pkgJsonPath)) {
4085
4144
  return null;
4086
4145
  }
4087
4146
  try {
4088
- const content = fs15.readFileSync(pkgJsonPath, "utf-8");
4147
+ const content = fs16.readFileSync(pkgJsonPath, "utf-8");
4089
4148
  return JSON.parse(content);
4090
4149
  } catch {
4091
4150
  return null;
4092
4151
  }
4093
4152
  }
4094
4153
  function extractTgzToNodeModules(tgzPath, pluginName) {
4095
- const nodeModulesPath = path12.join(getProjectRoot(), "node_modules");
4096
- const targetDir = path12.join(nodeModulesPath, pluginName);
4097
- const scopeDir = path12.dirname(targetDir);
4098
- if (!fs15.existsSync(scopeDir)) {
4099
- fs15.mkdirSync(scopeDir, { recursive: true });
4154
+ const nodeModulesPath = path13.join(getProjectRoot(), "node_modules");
4155
+ const targetDir = path13.join(nodeModulesPath, pluginName);
4156
+ const scopeDir = path13.dirname(targetDir);
4157
+ if (!fs16.existsSync(scopeDir)) {
4158
+ fs16.mkdirSync(scopeDir, { recursive: true });
4100
4159
  }
4101
- if (fs15.existsSync(targetDir)) {
4102
- fs15.rmSync(targetDir, { recursive: true });
4160
+ if (fs16.existsSync(targetDir)) {
4161
+ fs16.rmSync(targetDir, { recursive: true });
4103
4162
  }
4104
- const tempDir = path12.join(nodeModulesPath, ".cache", "fullstack-cli", "extract-temp");
4105
- if (fs15.existsSync(tempDir)) {
4106
- fs15.rmSync(tempDir, { recursive: true });
4163
+ const tempDir = path13.join(nodeModulesPath, ".cache", "fullstack-cli", "extract-temp");
4164
+ if (fs16.existsSync(tempDir)) {
4165
+ fs16.rmSync(tempDir, { recursive: true });
4107
4166
  }
4108
- fs15.mkdirSync(tempDir, { recursive: true });
4167
+ fs16.mkdirSync(tempDir, { recursive: true });
4109
4168
  try {
4110
4169
  execSync2(`tar -xzf "${tgzPath}" -C "${tempDir}"`, { stdio: "pipe" });
4111
- const extractedDir = path12.join(tempDir, "package");
4112
- if (fs15.existsSync(extractedDir)) {
4113
- fs15.renameSync(extractedDir, targetDir);
4170
+ const extractedDir = path13.join(tempDir, "package");
4171
+ if (fs16.existsSync(extractedDir)) {
4172
+ fs16.renameSync(extractedDir, targetDir);
4114
4173
  } else {
4115
- const files = fs15.readdirSync(tempDir);
4174
+ const files = fs16.readdirSync(tempDir);
4116
4175
  if (files.length === 1) {
4117
- fs15.renameSync(path12.join(tempDir, files[0]), targetDir);
4176
+ fs16.renameSync(path13.join(tempDir, files[0]), targetDir);
4118
4177
  } else {
4119
4178
  throw new Error("Unexpected tgz structure");
4120
4179
  }
4121
4180
  }
4122
4181
  return targetDir;
4123
4182
  } finally {
4124
- if (fs15.existsSync(tempDir)) {
4125
- fs15.rmSync(tempDir, { recursive: true });
4183
+ if (fs16.existsSync(tempDir)) {
4184
+ fs16.rmSync(tempDir, { recursive: true });
4126
4185
  }
4127
4186
  }
4128
4187
  }
@@ -4131,10 +4190,10 @@ function checkMissingPeerDeps(peerDeps) {
4131
4190
  return [];
4132
4191
  }
4133
4192
  const missing = [];
4134
- const nodeModulesPath = path12.join(getProjectRoot(), "node_modules");
4193
+ const nodeModulesPath = path13.join(getProjectRoot(), "node_modules");
4135
4194
  for (const [depName, _version] of Object.entries(peerDeps)) {
4136
- const depPath = path12.join(nodeModulesPath, depName);
4137
- if (!fs15.existsSync(depPath)) {
4195
+ const depPath = path13.join(nodeModulesPath, depName);
4196
+ if (!fs16.existsSync(depPath)) {
4138
4197
  missing.push(depName);
4139
4198
  }
4140
4199
  }
@@ -4158,16 +4217,16 @@ function installMissingDeps(deps) {
4158
4217
  }
4159
4218
  function removePluginDirectory(pluginName) {
4160
4219
  const pluginPath = getPluginPath(pluginName);
4161
- if (fs15.existsSync(pluginPath)) {
4162
- fs15.rmSync(pluginPath, { recursive: true });
4220
+ if (fs16.existsSync(pluginPath)) {
4221
+ fs16.rmSync(pluginPath, { recursive: true });
4163
4222
  console.log(`[action-plugin] Removed ${pluginName}`);
4164
4223
  }
4165
4224
  }
4166
4225
 
4167
4226
  // src/commands/action-plugin/api-client.ts
4168
4227
  import { HttpClient as HttpClient2 } from "@lark-apaas/http-client";
4169
- import fs16 from "fs";
4170
- import path13 from "path";
4228
+ import fs17 from "fs";
4229
+ import path14 from "path";
4171
4230
  var PLUGIN_CACHE_DIR = "node_modules/.cache/fullstack-cli/plugins";
4172
4231
  async function getPluginVersions(keys, latestOnly = true) {
4173
4232
  const client = getHttpClient();
@@ -4232,19 +4291,19 @@ async function downloadFromPublic(downloadURL) {
4232
4291
  return Buffer.from(arrayBuffer);
4233
4292
  }
4234
4293
  function getPluginCacheDir() {
4235
- return path13.join(process.cwd(), PLUGIN_CACHE_DIR);
4294
+ return path14.join(process.cwd(), PLUGIN_CACHE_DIR);
4236
4295
  }
4237
4296
  function ensureCacheDir() {
4238
4297
  const cacheDir = getPluginCacheDir();
4239
- if (!fs16.existsSync(cacheDir)) {
4240
- fs16.mkdirSync(cacheDir, { recursive: true });
4298
+ if (!fs17.existsSync(cacheDir)) {
4299
+ fs17.mkdirSync(cacheDir, { recursive: true });
4241
4300
  }
4242
4301
  }
4243
4302
  function getTempFilePath(pluginKey, version) {
4244
4303
  ensureCacheDir();
4245
4304
  const safeKey = pluginKey.replace(/[/@]/g, "_");
4246
4305
  const filename = `${safeKey}@${version}.tgz`;
4247
- return path13.join(getPluginCacheDir(), filename);
4306
+ return path14.join(getPluginCacheDir(), filename);
4248
4307
  }
4249
4308
  var MAX_RETRIES = 2;
4250
4309
  async function withRetry(operation, description, maxRetries = MAX_RETRIES) {
@@ -4281,7 +4340,7 @@ async function downloadPlugin(pluginKey, requestedVersion) {
4281
4340
  );
4282
4341
  }
4283
4342
  const tgzPath = getTempFilePath(pluginKey, pluginInfo.version);
4284
- fs16.writeFileSync(tgzPath, tgzBuffer);
4343
+ fs17.writeFileSync(tgzPath, tgzBuffer);
4285
4344
  console.log(`[action-plugin] Downloaded to ${tgzPath} (${(tgzBuffer.length / 1024).toFixed(2)} KB)`);
4286
4345
  return {
4287
4346
  tgzPath,
@@ -4295,18 +4354,18 @@ function getCachePath(pluginKey, version) {
4295
4354
  ensureCacheDir();
4296
4355
  const safeKey = pluginKey.replace(/[/@]/g, "_");
4297
4356
  const filename = `${safeKey}@${version}.tgz`;
4298
- return path13.join(getPluginCacheDir(), filename);
4357
+ return path14.join(getPluginCacheDir(), filename);
4299
4358
  }
4300
4359
  function hasCachedPlugin(pluginKey, version) {
4301
4360
  const cachePath = getCachePath(pluginKey, version);
4302
- return fs16.existsSync(cachePath);
4361
+ return fs17.existsSync(cachePath);
4303
4362
  }
4304
4363
  function listCachedPlugins() {
4305
4364
  const cacheDir = getPluginCacheDir();
4306
- if (!fs16.existsSync(cacheDir)) {
4365
+ if (!fs17.existsSync(cacheDir)) {
4307
4366
  return [];
4308
4367
  }
4309
- const files = fs16.readdirSync(cacheDir);
4368
+ const files = fs17.readdirSync(cacheDir);
4310
4369
  const result = [];
4311
4370
  for (const file of files) {
4312
4371
  if (!file.endsWith(".tgz")) continue;
@@ -4314,8 +4373,8 @@ function listCachedPlugins() {
4314
4373
  if (!match) continue;
4315
4374
  const [, rawName, version] = match;
4316
4375
  const name = rawName.replace(/^_/, "@").replace(/_/, "/");
4317
- const filePath = path13.join(cacheDir, file);
4318
- const stat = fs16.statSync(filePath);
4376
+ const filePath = path14.join(cacheDir, file);
4377
+ const stat = fs17.statSync(filePath);
4319
4378
  result.push({
4320
4379
  name,
4321
4380
  version,
@@ -4328,14 +4387,14 @@ function listCachedPlugins() {
4328
4387
  }
4329
4388
  function cleanAllCache() {
4330
4389
  const cacheDir = getPluginCacheDir();
4331
- if (!fs16.existsSync(cacheDir)) {
4390
+ if (!fs17.existsSync(cacheDir)) {
4332
4391
  return 0;
4333
4392
  }
4334
- const files = fs16.readdirSync(cacheDir);
4393
+ const files = fs17.readdirSync(cacheDir);
4335
4394
  let count = 0;
4336
4395
  for (const file of files) {
4337
4396
  if (file.endsWith(".tgz")) {
4338
- fs16.unlinkSync(path13.join(cacheDir, file));
4397
+ fs17.unlinkSync(path14.join(cacheDir, file));
4339
4398
  count++;
4340
4399
  }
4341
4400
  }
@@ -4343,21 +4402,21 @@ function cleanAllCache() {
4343
4402
  }
4344
4403
  function cleanPluginCache(pluginKey, version) {
4345
4404
  const cacheDir = getPluginCacheDir();
4346
- if (!fs16.existsSync(cacheDir)) {
4405
+ if (!fs17.existsSync(cacheDir)) {
4347
4406
  return 0;
4348
4407
  }
4349
4408
  const safeKey = pluginKey.replace(/[/@]/g, "_");
4350
- const files = fs16.readdirSync(cacheDir);
4409
+ const files = fs17.readdirSync(cacheDir);
4351
4410
  let count = 0;
4352
4411
  for (const file of files) {
4353
4412
  if (version) {
4354
4413
  if (file === `${safeKey}@${version}.tgz`) {
4355
- fs16.unlinkSync(path13.join(cacheDir, file));
4414
+ fs17.unlinkSync(path14.join(cacheDir, file));
4356
4415
  count++;
4357
4416
  }
4358
4417
  } else {
4359
4418
  if (file.startsWith(`${safeKey}@`) && file.endsWith(".tgz")) {
4360
- fs16.unlinkSync(path13.join(cacheDir, file));
4419
+ fs17.unlinkSync(path14.join(cacheDir, file));
4361
4420
  count++;
4362
4421
  }
4363
4422
  }
@@ -4628,9 +4687,9 @@ async function remove(nameWithVersion) {
4628
4687
  }
4629
4688
 
4630
4689
  // src/commands/capability/utils.ts
4631
- import fs17 from "fs";
4632
- import { createRequire as createRequire2 } from "module";
4633
- import path14 from "path";
4690
+ import fs18 from "fs";
4691
+ import { createRequire as createRequire3 } from "module";
4692
+ import path15 from "path";
4634
4693
  var CAPABILITIES_DIR = "server/capabilities";
4635
4694
  var SHARED_CAPABILITIES_DIR = "shared/capabilities";
4636
4695
  var CAPABILITIES_DIR_ENV = "CAPABILITIES_DIR";
@@ -4640,38 +4699,38 @@ function getProjectRoot2() {
4640
4699
  function getCapabilitiesDir() {
4641
4700
  const fromEnv = process.env[CAPABILITIES_DIR_ENV]?.trim();
4642
4701
  if (fromEnv) {
4643
- return path14.resolve(getProjectRoot2(), fromEnv.replace(/\/+$/, ""));
4702
+ return path15.resolve(getProjectRoot2(), fromEnv.replace(/\/+$/, ""));
4644
4703
  }
4645
- const sharedDir = path14.join(getProjectRoot2(), SHARED_CAPABILITIES_DIR);
4646
- if (fs17.existsSync(sharedDir)) {
4704
+ const sharedDir = path15.join(getProjectRoot2(), SHARED_CAPABILITIES_DIR);
4705
+ if (fs18.existsSync(sharedDir)) {
4647
4706
  return sharedDir;
4648
4707
  }
4649
- return path14.join(getProjectRoot2(), CAPABILITIES_DIR);
4708
+ return path15.join(getProjectRoot2(), CAPABILITIES_DIR);
4650
4709
  }
4651
4710
  function getCapabilityPath(id) {
4652
- return path14.join(getCapabilitiesDir(), `${id}.json`);
4711
+ return path15.join(getCapabilitiesDir(), `${id}.json`);
4653
4712
  }
4654
4713
  function getPluginManifestPath(pluginKey) {
4655
- return path14.join(getProjectRoot2(), "node_modules", pluginKey, "manifest.json");
4714
+ return path15.join(getProjectRoot2(), "node_modules", pluginKey, "manifest.json");
4656
4715
  }
4657
4716
  function capabilitiesDirExists() {
4658
- return fs17.existsSync(getCapabilitiesDir());
4717
+ return fs18.existsSync(getCapabilitiesDir());
4659
4718
  }
4660
4719
  function listCapabilityIds() {
4661
4720
  const dir = getCapabilitiesDir();
4662
- if (!fs17.existsSync(dir)) {
4721
+ if (!fs18.existsSync(dir)) {
4663
4722
  return [];
4664
4723
  }
4665
- const files = fs17.readdirSync(dir);
4724
+ const files = fs18.readdirSync(dir);
4666
4725
  return files.filter((f) => f.endsWith(".json") && f !== "capabilities.json").map((f) => f.replace(/\.json$/, ""));
4667
4726
  }
4668
4727
  function readCapability(id) {
4669
4728
  const filePath = getCapabilityPath(id);
4670
- if (!fs17.existsSync(filePath)) {
4729
+ if (!fs18.existsSync(filePath)) {
4671
4730
  throw new Error(`Capability not found: ${id}`);
4672
4731
  }
4673
4732
  try {
4674
- const content = fs17.readFileSync(filePath, "utf-8");
4733
+ const content = fs18.readFileSync(filePath, "utf-8");
4675
4734
  return JSON.parse(content);
4676
4735
  } catch (error) {
4677
4736
  if (error instanceof SyntaxError) {
@@ -4698,11 +4757,11 @@ function readAllCapabilities() {
4698
4757
  }
4699
4758
  function readPluginManifest(pluginKey) {
4700
4759
  const manifestPath = getPluginManifestPath(pluginKey);
4701
- if (!fs17.existsSync(manifestPath)) {
4760
+ if (!fs18.existsSync(manifestPath)) {
4702
4761
  throw new Error(`Plugin not installed: ${pluginKey} (manifest.json not found)`);
4703
4762
  }
4704
4763
  try {
4705
- const content = fs17.readFileSync(manifestPath, "utf-8");
4764
+ const content = fs18.readFileSync(manifestPath, "utf-8");
4706
4765
  return JSON.parse(content);
4707
4766
  } catch (error) {
4708
4767
  if (error instanceof SyntaxError) {
@@ -4719,7 +4778,7 @@ function hasValidParamsSchema(paramsSchema) {
4719
4778
  }
4720
4779
  async function loadPlugin(pluginKey) {
4721
4780
  try {
4722
- const userRequire = createRequire2(path14.join(getProjectRoot2(), "package.json"));
4781
+ const userRequire = createRequire3(path15.join(getProjectRoot2(), "package.json"));
4723
4782
  const resolvedPath = userRequire.resolve(pluginKey);
4724
4783
  const pluginModule = await import(resolvedPath);
4725
4784
  const pluginPackage = pluginModule.default ?? pluginModule;
@@ -4817,10 +4876,10 @@ function logError(message) {
4817
4876
  }
4818
4877
 
4819
4878
  // src/commands/action-plugin/form-context.ts
4820
- import fs19 from "fs";
4879
+ import fs20 from "fs";
4821
4880
 
4822
4881
  // src/commands/action-plugin/form-errors.ts
4823
- import fs18 from "fs";
4882
+ import fs19 from "fs";
4824
4883
  var FormCliErrorCode = {
4825
4884
  PLUGIN_NOT_INSTALLED: "PLUGIN_NOT_INSTALLED",
4826
4885
  PLUGIN_SDK_TOO_OLD: "PLUGIN_SDK_TOO_OLD",
@@ -4932,7 +4991,7 @@ function parseTimeout(raw) {
4932
4991
  return value;
4933
4992
  }
4934
4993
  function readJsonFile(filePath, label) {
4935
- if (!fs18.existsSync(filePath)) {
4994
+ if (!fs19.existsSync(filePath)) {
4936
4995
  throw new FormCliError(
4937
4996
  FormCliErrorCode.INVALID_INPUT,
4938
4997
  `${label} not found: ${filePath}`
@@ -4940,7 +4999,7 @@ function readJsonFile(filePath, label) {
4940
4999
  }
4941
5000
  let content;
4942
5001
  try {
4943
- content = fs18.readFileSync(filePath, "utf-8");
5002
+ content = fs19.readFileSync(filePath, "utf-8");
4944
5003
  } catch (error) {
4945
5004
  throw new FormCliError(
4946
5005
  FormCliErrorCode.INVALID_INPUT,
@@ -4979,7 +5038,7 @@ function readJsonArg(raw, flag) {
4979
5038
  if (raw === "-") {
4980
5039
  let content;
4981
5040
  try {
4982
- content = fs18.readFileSync(0, "utf-8");
5041
+ content = fs19.readFileSync(0, "utf-8");
4983
5042
  } catch (error) {
4984
5043
  throw new FormCliError(
4985
5044
  FormCliErrorCode.INVALID_INPUT,
@@ -5015,7 +5074,7 @@ function outputParseErrorsAsJson(command) {
5015
5074
  message: str.replace(/^error:\s*/, "").trim(),
5016
5075
  hint: `Run "fullstack-cli ${usage} --help" for usage.`
5017
5076
  };
5018
- fs18.writeSync(1, `${JSON.stringify(output, null, 2)}
5077
+ fs19.writeSync(1, `${JSON.stringify(output, null, 2)}
5019
5078
  `);
5020
5079
  }
5021
5080
  });
@@ -5082,7 +5141,7 @@ function createStderrLogger(prefix) {
5082
5141
  };
5083
5142
  }
5084
5143
  function readMatchingCapability(instanceId, pluginKey) {
5085
- if (!fs19.existsSync(getCapabilityPath(instanceId))) {
5144
+ if (!fs20.existsSync(getCapabilityPath(instanceId))) {
5086
5145
  throw new FormCliError(
5087
5146
  FormCliErrorCode.INSTANCE_NOT_FOUND,
5088
5147
  `Capability instance ${instanceId} not found`,
@@ -5750,26 +5809,26 @@ var TemplateIssueCode = {
5750
5809
  /** paramsSchema 声明的变量表单值里没有引用(提醒,不阻塞) */
5751
5810
  UNUSED_INPUT_PARAM: "UNUSED_INPUT_PARAM"
5752
5811
  };
5753
- function toJsonPointer(path28) {
5754
- if (path28.length === 0) {
5812
+ function toJsonPointer(path29) {
5813
+ if (path29.length === 0) {
5755
5814
  return "";
5756
5815
  }
5757
- return "/" + path28.map((segment) => String(segment).replace(/~/g, "~0").replace(/\//g, "~1")).join("/");
5816
+ return "/" + path29.map((segment) => String(segment).replace(/~/g, "~0").replace(/\//g, "~1")).join("/");
5758
5817
  }
5759
- function forEachString(value, path28, visit) {
5818
+ function forEachString(value, path29, visit) {
5760
5819
  if (typeof value === "string") {
5761
- visit(value, path28);
5820
+ visit(value, path29);
5762
5821
  return;
5763
5822
  }
5764
5823
  if (Array.isArray(value)) {
5765
5824
  value.forEach(
5766
- (item, index) => forEachString(item, [...path28, index], visit)
5825
+ (item, index) => forEachString(item, [...path29, index], visit)
5767
5826
  );
5768
5827
  return;
5769
5828
  }
5770
5829
  if (value && typeof value === "object") {
5771
5830
  for (const [key, item] of Object.entries(value)) {
5772
- forEachString(item, [...path28, key], visit);
5831
+ forEachString(item, [...path29, key], visit);
5773
5832
  }
5774
5833
  }
5775
5834
  }
@@ -5785,8 +5844,8 @@ function checkTemplateRefs(formValue, paramsSchema) {
5785
5844
  const reminders = [];
5786
5845
  const declared = new Set(declaredParams(paramsSchema));
5787
5846
  const referenced = /* @__PURE__ */ new Set();
5788
- forEachString(formValue, [], (str, path28) => {
5789
- const pointer = toJsonPointer(path28);
5847
+ forEachString(formValue, [], (str, path29) => {
5848
+ const pointer = toJsonPointer(path29);
5790
5849
  for (const match of str.matchAll(INPUT_REF_REGEX)) {
5791
5850
  const name = match[1];
5792
5851
  referenced.add(name);
@@ -5831,20 +5890,20 @@ function normalizeIssue(issue) {
5831
5890
  if (!isRecord(issue)) {
5832
5891
  return void 0;
5833
5892
  }
5834
- const { code, message, path: path28 } = issue;
5893
+ const { code, message, path: path29 } = issue;
5835
5894
  if (typeof message !== "string" || message === "") {
5836
5895
  return void 0;
5837
5896
  }
5838
5897
  if (code !== void 0 && (typeof code !== "string" || code === "")) {
5839
5898
  return void 0;
5840
5899
  }
5841
- if (path28 !== void 0 && typeof path28 !== "string") {
5900
+ if (path29 !== void 0 && typeof path29 !== "string") {
5842
5901
  return void 0;
5843
5902
  }
5844
5903
  return {
5845
5904
  message,
5846
5905
  ...code === void 0 ? {} : { code },
5847
- ...path28 === void 0 ? {} : { path: path28 }
5906
+ ...path29 === void 0 ? {} : { path: path29 }
5848
5907
  };
5849
5908
  }
5850
5909
  function normalizeResult(raw) {
@@ -6013,8 +6072,8 @@ async function validate(options) {
6013
6072
  }
6014
6073
 
6015
6074
  // src/commands/capability/write.handler.ts
6016
- import fs20 from "fs";
6017
- import path15 from "path";
6075
+ import fs21 from "fs";
6076
+ import path16 from "path";
6018
6077
  var CAPABILITY_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
6019
6078
  var CREATED_BY_PLACEHOLDER = "__fullstack_cli_created_by__";
6020
6079
  function assertValidId(id) {
@@ -6027,23 +6086,23 @@ function assertValidId(id) {
6027
6086
  }
6028
6087
  function capabilityFilePath(id) {
6029
6088
  const dir = getCapabilitiesDir();
6030
- const relative = path15.relative(getProjectRoot2(), dir);
6031
- if (relative === ".." || relative.startsWith(`..${path15.sep}`) || path15.isAbsolute(relative)) {
6089
+ const relative = path16.relative(getProjectRoot2(), dir);
6090
+ if (relative === ".." || relative.startsWith(`..${path16.sep}`) || path16.isAbsolute(relative)) {
6032
6091
  throw new FormCliError(
6033
6092
  FormCliErrorCode.INVALID_INPUT,
6034
6093
  `Capabilities directory ${dir} is outside the project root ${getProjectRoot2()}; check ${CAPABILITIES_DIR_ENV}`
6035
6094
  );
6036
6095
  }
6037
- return path15.join(dir, `${id}.json`);
6096
+ return path16.join(dir, `${id}.json`);
6038
6097
  }
6039
6098
  function toProjectRelative(absolutePath) {
6040
- return path15.relative(getProjectRoot2(), absolutePath).split(path15.sep).join("/");
6099
+ return path16.relative(getProjectRoot2(), absolutePath).split(path16.sep).join("/");
6041
6100
  }
6042
6101
  function readPluginIcon(pluginKey) {
6043
6102
  try {
6044
6103
  const pkg2 = JSON.parse(
6045
- fs20.readFileSync(
6046
- path15.join(getPluginPath(pluginKey), "package.json"),
6104
+ fs21.readFileSync(
6105
+ path16.join(getPluginPath(pluginKey), "package.json"),
6047
6106
  "utf-8"
6048
6107
  )
6049
6108
  );
@@ -6060,17 +6119,17 @@ function serializeCapability(record, createdByToken) {
6060
6119
  return createdByToken === void 0 ? json : json.replace(`"${CREATED_BY_PLACEHOLDER}"`, createdByToken);
6061
6120
  }
6062
6121
  function writeAtomically(filePath, content, options) {
6063
- const dir = path15.dirname(filePath);
6064
- fs20.mkdirSync(dir, { recursive: true });
6065
- const tmp = path15.join(
6122
+ const dir = path16.dirname(filePath);
6123
+ fs21.mkdirSync(dir, { recursive: true });
6124
+ const tmp = path16.join(
6066
6125
  dir,
6067
- `.${path15.basename(filePath)}.${process.pid}.${Date.now()}.tmp`
6126
+ `.${path16.basename(filePath)}.${process.pid}.${Date.now()}.tmp`
6068
6127
  );
6069
- fs20.writeFileSync(tmp, content);
6128
+ fs21.writeFileSync(tmp, content);
6070
6129
  try {
6071
6130
  if (options.exclusive) {
6072
6131
  try {
6073
- fs20.linkSync(tmp, filePath);
6132
+ fs21.linkSync(tmp, filePath);
6074
6133
  } catch (error) {
6075
6134
  if (error.code === "EEXIST") {
6076
6135
  throw new FormCliError(
@@ -6084,10 +6143,10 @@ function writeAtomically(filePath, content, options) {
6084
6143
  throw error;
6085
6144
  }
6086
6145
  } else {
6087
- fs20.renameSync(tmp, filePath);
6146
+ fs21.renameSync(tmp, filePath);
6088
6147
  }
6089
6148
  } finally {
6090
- fs20.rmSync(tmp, { force: true });
6149
+ fs21.rmSync(tmp, { force: true });
6091
6150
  }
6092
6151
  }
6093
6152
  function readParamsSchema(raw) {
@@ -6114,7 +6173,7 @@ async function runCreate(options) {
6114
6173
  );
6115
6174
  }
6116
6175
  const filePath = capabilityFilePath(options.id);
6117
- if (fs20.existsSync(filePath)) {
6176
+ if (fs21.existsSync(filePath)) {
6118
6177
  throw new FormCliError(
6119
6178
  FormCliErrorCode.INSTANCE_EXISTS,
6120
6179
  `Capability ${options.id} already exists at ${toProjectRelative(filePath)}`,
@@ -6161,7 +6220,7 @@ async function runCreate(options) {
6161
6220
  async function runUpdate(options) {
6162
6221
  assertValidId(options.id);
6163
6222
  const filePath = capabilityFilePath(options.id);
6164
- if (!fs20.existsSync(filePath)) {
6223
+ if (!fs21.existsSync(filePath)) {
6165
6224
  throw new FormCliError(
6166
6225
  FormCliErrorCode.INSTANCE_NOT_FOUND,
6167
6226
  `Capability ${options.id} not found at ${toProjectRelative(filePath)}`,
@@ -6170,7 +6229,7 @@ async function runUpdate(options) {
6170
6229
  }
6171
6230
  );
6172
6231
  }
6173
- const rawText = fs20.readFileSync(filePath, "utf-8");
6232
+ const rawText = fs21.readFileSync(filePath, "utf-8");
6174
6233
  let existing;
6175
6234
  try {
6176
6235
  const parsed = JSON.parse(rawText);
@@ -6228,7 +6287,7 @@ async function runUpdate(options) {
6228
6287
  }
6229
6288
  function readPluginKeyOf(filePath) {
6230
6289
  try {
6231
- const parsed = JSON.parse(fs20.readFileSync(filePath, "utf-8"));
6290
+ const parsed = JSON.parse(fs21.readFileSync(filePath, "utf-8"));
6232
6291
  return typeof parsed?.pluginKey === "string" && parsed.pluginKey ? parsed.pluginKey : void 0;
6233
6292
  } catch {
6234
6293
  return void 0;
@@ -6245,12 +6304,12 @@ function runDelete(options) {
6245
6304
  hint: 'Check the id with "fullstack-cli capability list --summary".'
6246
6305
  }
6247
6306
  );
6248
- if (!fs20.existsSync(filePath)) {
6307
+ if (!fs21.existsSync(filePath)) {
6249
6308
  throw notFound();
6250
6309
  }
6251
6310
  const pluginKey = readPluginKeyOf(filePath);
6252
6311
  try {
6253
- fs20.unlinkSync(filePath);
6312
+ fs21.unlinkSync(filePath);
6254
6313
  } catch (error) {
6255
6314
  if (error.code === "ENOENT") {
6256
6315
  throw notFound();
@@ -6438,8 +6497,8 @@ var capabilityCommandGroup = {
6438
6497
  import { execFile } from "child_process";
6439
6498
 
6440
6499
  // src/commands/component/registry-preparer.ts
6441
- import fs21 from "fs";
6442
- import path16 from "path";
6500
+ import fs22 from "fs";
6501
+ import path17 from "path";
6443
6502
  import os from "os";
6444
6503
 
6445
6504
  // src/commands/component/service.ts
@@ -6499,7 +6558,7 @@ async function sendInstallEvent(key) {
6499
6558
  }
6500
6559
 
6501
6560
  // src/commands/component/registry-preparer.ts
6502
- var REGISTRY_TEMP_DIR = path16.join(os.tmpdir(), "miaoda-registry");
6561
+ var REGISTRY_TEMP_DIR = path17.join(os.tmpdir(), "miaoda-registry");
6503
6562
  function parseComponentKey(key) {
6504
6563
  const match = key.match(/^@([^/]+)\/(.+)$/);
6505
6564
  if (!match) {
@@ -6511,11 +6570,11 @@ function parseComponentKey(key) {
6511
6570
  }
6512
6571
  function getLocalRegistryPath(key) {
6513
6572
  const { scope, name } = parseComponentKey(key);
6514
- return path16.join(REGISTRY_TEMP_DIR, scope, `${name}.json`);
6573
+ return path17.join(REGISTRY_TEMP_DIR, scope, `${name}.json`);
6515
6574
  }
6516
6575
  function ensureDir(dirPath) {
6517
- if (!fs21.existsSync(dirPath)) {
6518
- fs21.mkdirSync(dirPath, { recursive: true });
6576
+ if (!fs22.existsSync(dirPath)) {
6577
+ fs22.mkdirSync(dirPath, { recursive: true });
6519
6578
  }
6520
6579
  }
6521
6580
  async function prepareRecursive(key, visited) {
@@ -6548,8 +6607,8 @@ async function prepareRecursive(key, visited) {
6548
6607
  registryDependencies: deps.map((dep) => getLocalRegistryPath(dep))
6549
6608
  };
6550
6609
  const localPath = getLocalRegistryPath(key);
6551
- ensureDir(path16.dirname(localPath));
6552
- fs21.writeFileSync(localPath, JSON.stringify(rewrittenItem, null, 2), "utf-8");
6610
+ ensureDir(path17.dirname(localPath));
6611
+ fs22.writeFileSync(localPath, JSON.stringify(rewrittenItem, null, 2), "utf-8");
6553
6612
  debug("\u4FDD\u5B58\u5230: %s", localPath);
6554
6613
  }
6555
6614
  async function prepareComponentRegistryItems(id) {
@@ -6559,18 +6618,18 @@ async function prepareComponentRegistryItems(id) {
6559
6618
  }
6560
6619
  function cleanupTempDir() {
6561
6620
  try {
6562
- if (fs21.existsSync(REGISTRY_TEMP_DIR)) {
6563
- fs21.rmSync(REGISTRY_TEMP_DIR, { recursive: true, force: true });
6621
+ if (fs22.existsSync(REGISTRY_TEMP_DIR)) {
6622
+ fs22.rmSync(REGISTRY_TEMP_DIR, { recursive: true, force: true });
6564
6623
  }
6565
6624
  } catch {
6566
6625
  }
6567
6626
  }
6568
6627
  function getDownloadedRegistryItem(itemId) {
6569
6628
  const localPath = getLocalRegistryPath(itemId);
6570
- if (!fs21.existsSync(localPath)) {
6629
+ if (!fs22.existsSync(localPath)) {
6571
6630
  return null;
6572
6631
  }
6573
- const content = fs21.readFileSync(localPath, "utf-8");
6632
+ const content = fs22.readFileSync(localPath, "utf-8");
6574
6633
  return JSON.parse(content);
6575
6634
  }
6576
6635
 
@@ -6738,58 +6797,58 @@ var componentCommandGroup = {
6738
6797
  };
6739
6798
 
6740
6799
  // src/commands/migration/version-manager.ts
6741
- import fs22 from "fs";
6742
- import path17 from "path";
6800
+ import fs23 from "fs";
6801
+ import path18 from "path";
6743
6802
  var PACKAGE_JSON = "package.json";
6744
6803
  var VERSION_FIELD = "migrationVersion";
6745
6804
  function getPackageJsonPath2() {
6746
- return path17.join(process.cwd(), PACKAGE_JSON);
6805
+ return path18.join(process.cwd(), PACKAGE_JSON);
6747
6806
  }
6748
6807
  function getCurrentVersion() {
6749
6808
  const pkgPath = getPackageJsonPath2();
6750
- if (!fs22.existsSync(pkgPath)) {
6809
+ if (!fs23.existsSync(pkgPath)) {
6751
6810
  throw new Error("package.json not found");
6752
6811
  }
6753
- const pkg2 = JSON.parse(fs22.readFileSync(pkgPath, "utf-8"));
6812
+ const pkg2 = JSON.parse(fs23.readFileSync(pkgPath, "utf-8"));
6754
6813
  return pkg2[VERSION_FIELD] ?? 0;
6755
6814
  }
6756
6815
  function setCurrentVersion(version) {
6757
6816
  const pkgPath = getPackageJsonPath2();
6758
- const pkg2 = JSON.parse(fs22.readFileSync(pkgPath, "utf-8"));
6817
+ const pkg2 = JSON.parse(fs23.readFileSync(pkgPath, "utf-8"));
6759
6818
  pkg2[VERSION_FIELD] = version;
6760
- fs22.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
6819
+ fs23.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
6761
6820
  }
6762
6821
 
6763
6822
  // src/commands/migration/versions/v001_capability/json-migrator/detector.ts
6764
- import fs24 from "fs";
6765
- import path19 from "path";
6823
+ import fs25 from "fs";
6824
+ import path20 from "path";
6766
6825
 
6767
6826
  // src/commands/migration/versions/v001_capability/utils.ts
6768
- import fs23 from "fs";
6769
- import path18 from "path";
6827
+ import fs24 from "fs";
6828
+ import path19 from "path";
6770
6829
  var CAPABILITIES_DIR2 = "server/capabilities";
6771
6830
  function getProjectRoot3() {
6772
6831
  return process.cwd();
6773
6832
  }
6774
6833
  function getCapabilitiesDir2() {
6775
- return path18.join(getProjectRoot3(), CAPABILITIES_DIR2);
6834
+ return path19.join(getProjectRoot3(), CAPABILITIES_DIR2);
6776
6835
  }
6777
6836
  function getPluginManifestPath2(pluginKey) {
6778
- return path18.join(getProjectRoot3(), "node_modules", pluginKey, "manifest.json");
6837
+ return path19.join(getProjectRoot3(), "node_modules", pluginKey, "manifest.json");
6779
6838
  }
6780
6839
 
6781
6840
  // src/commands/migration/versions/v001_capability/json-migrator/detector.ts
6782
6841
  function detectJsonMigration() {
6783
6842
  const capabilitiesDir = getCapabilitiesDir2();
6784
- const oldFilePath = path19.join(capabilitiesDir, "capabilities.json");
6785
- if (!fs24.existsSync(oldFilePath)) {
6843
+ const oldFilePath = path20.join(capabilitiesDir, "capabilities.json");
6844
+ if (!fs25.existsSync(oldFilePath)) {
6786
6845
  return {
6787
6846
  needsMigration: false,
6788
6847
  reason: "capabilities.json not found"
6789
6848
  };
6790
6849
  }
6791
6850
  try {
6792
- const content = fs24.readFileSync(oldFilePath, "utf-8");
6851
+ const content = fs25.readFileSync(oldFilePath, "utf-8");
6793
6852
  const parsed = JSON.parse(content);
6794
6853
  if (!Array.isArray(parsed)) {
6795
6854
  return {
@@ -6840,8 +6899,8 @@ async function check(options) {
6840
6899
  }
6841
6900
 
6842
6901
  // src/commands/migration/versions/v001_capability/json-migrator/index.ts
6843
- import fs25 from "fs";
6844
- import path20 from "path";
6902
+ import fs26 from "fs";
6903
+ import path21 from "path";
6845
6904
 
6846
6905
  // src/commands/migration/versions/v001_capability/mapping.ts
6847
6906
  var DEFAULT_PLUGIN_VERSION = "1.0.0";
@@ -7071,18 +7130,18 @@ function transformCapabilities(oldCapabilities) {
7071
7130
  // src/commands/migration/versions/v001_capability/json-migrator/index.ts
7072
7131
  function loadExistingCapabilities() {
7073
7132
  const capabilitiesDir = getCapabilitiesDir2();
7074
- if (!fs25.existsSync(capabilitiesDir)) {
7133
+ if (!fs26.existsSync(capabilitiesDir)) {
7075
7134
  return [];
7076
7135
  }
7077
- const files = fs25.readdirSync(capabilitiesDir);
7136
+ const files = fs26.readdirSync(capabilitiesDir);
7078
7137
  const capabilities = [];
7079
7138
  for (const file of files) {
7080
7139
  if (file === "capabilities.json" || !file.endsWith(".json")) {
7081
7140
  continue;
7082
7141
  }
7083
7142
  try {
7084
- const filePath = path20.join(capabilitiesDir, file);
7085
- const content = fs25.readFileSync(filePath, "utf-8");
7143
+ const filePath = path21.join(capabilitiesDir, file);
7144
+ const content = fs26.readFileSync(filePath, "utf-8");
7086
7145
  const capability = JSON.parse(content);
7087
7146
  if (capability.id && capability.pluginKey) {
7088
7147
  capabilities.push(capability);
@@ -7140,9 +7199,9 @@ async function migrateJsonFiles(options) {
7140
7199
  }
7141
7200
  const capabilitiesDir = getCapabilitiesDir2();
7142
7201
  for (const cap of newCapabilities) {
7143
- const filePath = path20.join(capabilitiesDir, `${cap.id}.json`);
7202
+ const filePath = path21.join(capabilitiesDir, `${cap.id}.json`);
7144
7203
  const content = JSON.stringify(cap, null, 2);
7145
- fs25.writeFileSync(filePath, content, "utf-8");
7204
+ fs26.writeFileSync(filePath, content, "utf-8");
7146
7205
  console.log(` \u2713 Created: ${cap.id}.json`);
7147
7206
  }
7148
7207
  return {
@@ -7154,11 +7213,11 @@ async function migrateJsonFiles(options) {
7154
7213
  }
7155
7214
 
7156
7215
  // src/commands/migration/versions/v001_capability/plugin-installer/detector.ts
7157
- import fs26 from "fs";
7216
+ import fs27 from "fs";
7158
7217
  function isPluginInstalled2(pluginKey) {
7159
7218
  const actionPlugins = readActionPlugins();
7160
7219
  const manifestPath = getPluginManifestPath2(pluginKey);
7161
- return fs26.existsSync(manifestPath) && !!actionPlugins[pluginKey];
7220
+ return fs27.existsSync(manifestPath) && !!actionPlugins[pluginKey];
7162
7221
  }
7163
7222
  function detectPluginsToInstall(capabilities) {
7164
7223
  const pluginKeys = /* @__PURE__ */ new Set();
@@ -7234,12 +7293,12 @@ async function installPlugins(capabilities, options) {
7234
7293
  }
7235
7294
 
7236
7295
  // src/commands/migration/versions/v001_capability/code-migrator/index.ts
7237
- import path22 from "path";
7296
+ import path23 from "path";
7238
7297
  import { Project as Project3 } from "ts-morph";
7239
7298
 
7240
7299
  // src/commands/migration/versions/v001_capability/code-migrator/scanner.ts
7241
- import fs27 from "fs";
7242
- import path21 from "path";
7300
+ import fs28 from "fs";
7301
+ import path22 from "path";
7243
7302
  var EXCLUDED_DIRS = [
7244
7303
  "node_modules",
7245
7304
  "dist",
@@ -7254,9 +7313,9 @@ var EXCLUDED_PATTERNS = [
7254
7313
  /\.d\.ts$/
7255
7314
  ];
7256
7315
  function scanDirectory(dir, files = []) {
7257
- const entries = fs27.readdirSync(dir, { withFileTypes: true });
7316
+ const entries = fs28.readdirSync(dir, { withFileTypes: true });
7258
7317
  for (const entry of entries) {
7259
- const fullPath = path21.join(dir, entry.name);
7318
+ const fullPath = path22.join(dir, entry.name);
7260
7319
  if (entry.isDirectory()) {
7261
7320
  if (EXCLUDED_DIRS.includes(entry.name)) {
7262
7321
  continue;
@@ -7272,14 +7331,14 @@ function scanDirectory(dir, files = []) {
7272
7331
  return files;
7273
7332
  }
7274
7333
  function scanServerFiles() {
7275
- const serverDir = path21.join(getProjectRoot3(), "server");
7276
- if (!fs27.existsSync(serverDir)) {
7334
+ const serverDir = path22.join(getProjectRoot3(), "server");
7335
+ if (!fs28.existsSync(serverDir)) {
7277
7336
  return [];
7278
7337
  }
7279
7338
  return scanDirectory(serverDir);
7280
7339
  }
7281
7340
  function hasCapabilityImport(filePath) {
7282
- const content = fs27.readFileSync(filePath, "utf-8");
7341
+ const content = fs28.readFileSync(filePath, "utf-8");
7283
7342
  return /import\s+.*from\s+['"][^'"]*capabilities[^'"]*['"]/.test(content);
7284
7343
  }
7285
7344
  function scanFilesToMigrate() {
@@ -7656,7 +7715,7 @@ function analyzeFile(project, filePath, actionNameMap) {
7656
7715
  const callSites = analyzeCallSites(sourceFile, imports);
7657
7716
  const classInfo = analyzeClass(sourceFile);
7658
7717
  const { canMigrate, reason } = canAutoMigrate(classInfo);
7659
- const relativePath = path22.relative(getProjectRoot3(), filePath);
7718
+ const relativePath = path23.relative(getProjectRoot3(), filePath);
7660
7719
  return {
7661
7720
  filePath: relativePath,
7662
7721
  imports,
@@ -7667,7 +7726,7 @@ function analyzeFile(project, filePath, actionNameMap) {
7667
7726
  };
7668
7727
  }
7669
7728
  function migrateFile(project, analysis, dryRun) {
7670
- const absolutePath = path22.join(getProjectRoot3(), analysis.filePath);
7729
+ const absolutePath = path23.join(getProjectRoot3(), analysis.filePath);
7671
7730
  if (!analysis.canAutoMigrate) {
7672
7731
  return {
7673
7732
  filePath: analysis.filePath,
@@ -7770,17 +7829,17 @@ function getSuggestion(analysis) {
7770
7829
  }
7771
7830
 
7772
7831
  // src/commands/migration/versions/v001_capability/cleanup.ts
7773
- import fs28 from "fs";
7774
- import path23 from "path";
7832
+ import fs29 from "fs";
7833
+ import path24 from "path";
7775
7834
  function cleanupOldFiles(capabilities, dryRun) {
7776
7835
  const deletedFiles = [];
7777
7836
  const errors = [];
7778
7837
  const capabilitiesDir = getCapabilitiesDir2();
7779
- const oldJsonPath = path23.join(capabilitiesDir, "capabilities.json");
7780
- if (fs28.existsSync(oldJsonPath)) {
7838
+ const oldJsonPath = path24.join(capabilitiesDir, "capabilities.json");
7839
+ if (fs29.existsSync(oldJsonPath)) {
7781
7840
  try {
7782
7841
  if (!dryRun) {
7783
- fs28.unlinkSync(oldJsonPath);
7842
+ fs29.unlinkSync(oldJsonPath);
7784
7843
  }
7785
7844
  deletedFiles.push("capabilities.json");
7786
7845
  } catch (error) {
@@ -7788,11 +7847,11 @@ function cleanupOldFiles(capabilities, dryRun) {
7788
7847
  }
7789
7848
  }
7790
7849
  for (const cap of capabilities) {
7791
- const tsFilePath = path23.join(capabilitiesDir, `${cap.id}.ts`);
7792
- if (fs28.existsSync(tsFilePath)) {
7850
+ const tsFilePath = path24.join(capabilitiesDir, `${cap.id}.ts`);
7851
+ if (fs29.existsSync(tsFilePath)) {
7793
7852
  try {
7794
7853
  if (!dryRun) {
7795
- fs28.unlinkSync(tsFilePath);
7854
+ fs29.unlinkSync(tsFilePath);
7796
7855
  }
7797
7856
  deletedFiles.push(`${cap.id}.ts`);
7798
7857
  } catch (error) {
@@ -7808,8 +7867,8 @@ function cleanupOldFiles(capabilities, dryRun) {
7808
7867
  }
7809
7868
 
7810
7869
  // src/commands/migration/versions/v001_capability/report-generator.ts
7811
- import fs29 from "fs";
7812
- import path24 from "path";
7870
+ import fs30 from "fs";
7871
+ import path25 from "path";
7813
7872
  var REPORT_FILE = "capability-migration-report.md";
7814
7873
  function printSummary(result) {
7815
7874
  const { jsonMigration, pluginInstallation, codeMigration, cleanup } = result;
@@ -7972,15 +8031,15 @@ async function generateReport(result) {
7972
8031
  }
7973
8032
  lines.push("");
7974
8033
  const logDir = process.env.LOG_DIR || "logs";
7975
- if (!fs29.existsSync(logDir)) {
8034
+ if (!fs30.existsSync(logDir)) {
7976
8035
  return;
7977
8036
  }
7978
- const reportDir = path24.join(logDir, "migration");
7979
- if (!fs29.existsSync(reportDir)) {
7980
- fs29.mkdirSync(reportDir, { recursive: true });
8037
+ const reportDir = path25.join(logDir, "migration");
8038
+ if (!fs30.existsSync(reportDir)) {
8039
+ fs30.mkdirSync(reportDir, { recursive: true });
7981
8040
  }
7982
- const reportPath = path24.join(reportDir, REPORT_FILE);
7983
- fs29.writeFileSync(reportPath, lines.join("\n"), "utf-8");
8041
+ const reportPath = path25.join(reportDir, REPORT_FILE);
8042
+ fs30.writeFileSync(reportPath, lines.join("\n"), "utf-8");
7984
8043
  console.log(`\u{1F4C4} Report generated: ${reportPath}`);
7985
8044
  }
7986
8045
 
@@ -8512,10 +8571,10 @@ var migrationCommand = {
8512
8571
  };
8513
8572
 
8514
8573
  // src/commands/read-logs/index.ts
8515
- import path25 from "path";
8574
+ import path26 from "path";
8516
8575
 
8517
8576
  // src/commands/read-logs/std-utils.ts
8518
- import fs30 from "fs";
8577
+ import fs31 from "fs";
8519
8578
  function formatStdPrefixTime(localTime) {
8520
8579
  const match = localTime.match(/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/);
8521
8580
  if (!match) return localTime;
@@ -8545,11 +8604,11 @@ function stripPrefixFromStdLine(line) {
8545
8604
  return `[${time}] ${content}`;
8546
8605
  }
8547
8606
  function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarker) {
8548
- const stat = fs30.statSync(filePath);
8607
+ const stat = fs31.statSync(filePath);
8549
8608
  if (stat.size === 0) {
8550
8609
  return { lines: [], markerFound: false, totalLinesCount: 0 };
8551
8610
  }
8552
- const fd = fs30.openSync(filePath, "r");
8611
+ const fd = fs31.openSync(filePath, "r");
8553
8612
  const chunkSize = 64 * 1024;
8554
8613
  let position = stat.size;
8555
8614
  let remainder = "";
@@ -8563,7 +8622,7 @@ function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarke
8563
8622
  const length = Math.min(chunkSize, position);
8564
8623
  position -= length;
8565
8624
  const buffer = Buffer.alloc(length);
8566
- fs30.readSync(fd, buffer, 0, length, position);
8625
+ fs31.readSync(fd, buffer, 0, length, position);
8567
8626
  let chunk = buffer.toString("utf8");
8568
8627
  if (remainder) {
8569
8628
  chunk += remainder;
@@ -8605,7 +8664,7 @@ function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarke
8605
8664
  }
8606
8665
  }
8607
8666
  } finally {
8608
- fs30.closeSync(fd);
8667
+ fs31.closeSync(fd);
8609
8668
  }
8610
8669
  return { lines: collected.reverse(), markerFound, totalLinesCount };
8611
8670
  }
@@ -8626,21 +8685,21 @@ function readServerStdSegment(filePath, maxLines, offset) {
8626
8685
  }
8627
8686
 
8628
8687
  // src/commands/read-logs/tail.ts
8629
- import fs31 from "fs";
8688
+ import fs32 from "fs";
8630
8689
  function fileExists(filePath) {
8631
8690
  try {
8632
- fs31.accessSync(filePath, fs31.constants.F_OK | fs31.constants.R_OK);
8691
+ fs32.accessSync(filePath, fs32.constants.F_OK | fs32.constants.R_OK);
8633
8692
  return true;
8634
8693
  } catch {
8635
8694
  return false;
8636
8695
  }
8637
8696
  }
8638
8697
  function readFileTailLines(filePath, maxLines) {
8639
- const stat = fs31.statSync(filePath);
8698
+ const stat = fs32.statSync(filePath);
8640
8699
  if (stat.size === 0) {
8641
8700
  return [];
8642
8701
  }
8643
- const fd = fs31.openSync(filePath, "r");
8702
+ const fd = fs32.openSync(filePath, "r");
8644
8703
  const chunkSize = 64 * 1024;
8645
8704
  const chunks = [];
8646
8705
  let position = stat.size;
@@ -8650,13 +8709,13 @@ function readFileTailLines(filePath, maxLines) {
8650
8709
  const length = Math.min(chunkSize, position);
8651
8710
  position -= length;
8652
8711
  const buffer = Buffer.alloc(length);
8653
- fs31.readSync(fd, buffer, 0, length, position);
8712
+ fs32.readSync(fd, buffer, 0, length, position);
8654
8713
  chunks.unshift(buffer.toString("utf8"));
8655
8714
  const chunkLines = buffer.toString("utf8").split("\n").length - 1;
8656
8715
  collectedLines += chunkLines;
8657
8716
  }
8658
8717
  } finally {
8659
- fs31.closeSync(fd);
8718
+ fs32.closeSync(fd);
8660
8719
  }
8661
8720
  const content = chunks.join("");
8662
8721
  const allLines = content.split("\n");
@@ -8672,11 +8731,11 @@ function readFileTailLines(filePath, maxLines) {
8672
8731
  return allLines.slice(allLines.length - maxLines);
8673
8732
  }
8674
8733
  function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
8675
- const stat = fs31.statSync(filePath);
8734
+ const stat = fs32.statSync(filePath);
8676
8735
  if (stat.size === 0) {
8677
8736
  return { lines: [], totalLinesCount: 0 };
8678
8737
  }
8679
- const fd = fs31.openSync(filePath, "r");
8738
+ const fd = fs32.openSync(filePath, "r");
8680
8739
  const chunkSize = 64 * 1024;
8681
8740
  let position = stat.size;
8682
8741
  let remainder = "";
@@ -8688,7 +8747,7 @@ function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
8688
8747
  const length = Math.min(chunkSize, position);
8689
8748
  position -= length;
8690
8749
  const buffer = Buffer.alloc(length);
8691
- fs31.readSync(fd, buffer, 0, length, position);
8750
+ fs32.readSync(fd, buffer, 0, length, position);
8692
8751
  let chunk = buffer.toString("utf8");
8693
8752
  if (remainder) {
8694
8753
  chunk += remainder;
@@ -8719,7 +8778,7 @@ function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
8719
8778
  }
8720
8779
  }
8721
8780
  } finally {
8722
- fs31.closeSync(fd);
8781
+ fs32.closeSync(fd);
8723
8782
  }
8724
8783
  return { lines: collected.reverse(), totalLinesCount };
8725
8784
  }
@@ -8861,7 +8920,7 @@ function readDevStdSegment(filePath, maxLines, offset) {
8861
8920
  }
8862
8921
 
8863
8922
  // src/commands/read-logs/json-lines.ts
8864
- import fs32 from "fs";
8923
+ import fs33 from "fs";
8865
8924
 
8866
8925
  // src/commands/read-logs/structured-log.ts
8867
8926
  function normalizeLevelName(value) {
@@ -8937,11 +8996,11 @@ function buildWantedLevelSet(levels) {
8937
8996
  return set.size > 0 ? set : null;
8938
8997
  }
8939
8998
  function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
8940
- const stat = fs32.statSync(filePath);
8999
+ const stat = fs33.statSync(filePath);
8941
9000
  if (stat.size === 0) {
8942
9001
  return { lines: [], totalLinesCount: 0 };
8943
9002
  }
8944
- const fd = fs32.openSync(filePath, "r");
9003
+ const fd = fs33.openSync(filePath, "r");
8945
9004
  const chunkSize = 64 * 1024;
8946
9005
  let position = stat.size;
8947
9006
  let remainder = "";
@@ -8956,7 +9015,7 @@ function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
8956
9015
  const length = Math.min(chunkSize, position);
8957
9016
  position -= length;
8958
9017
  const buffer = Buffer.alloc(length);
8959
- fs32.readSync(fd, buffer, 0, length, position);
9018
+ fs33.readSync(fd, buffer, 0, length, position);
8960
9019
  let chunk = buffer.toString("utf8");
8961
9020
  if (remainder) {
8962
9021
  chunk += remainder;
@@ -9018,7 +9077,7 @@ function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
9018
9077
  }
9019
9078
  }
9020
9079
  } finally {
9021
- fs32.closeSync(fd);
9080
+ fs33.closeSync(fd);
9022
9081
  }
9023
9082
  return { lines: collected.reverse(), totalLinesCount };
9024
9083
  }
@@ -9061,11 +9120,11 @@ function extractTraceId(obj) {
9061
9120
  function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
9062
9121
  const wanted = traceId.trim();
9063
9122
  if (!wanted) return { lines: [], totalLinesCount: 0 };
9064
- const stat = fs32.statSync(filePath);
9123
+ const stat = fs33.statSync(filePath);
9065
9124
  if (stat.size === 0) {
9066
9125
  return { lines: [], totalLinesCount: 0 };
9067
9126
  }
9068
- const fd = fs32.openSync(filePath, "r");
9127
+ const fd = fs33.openSync(filePath, "r");
9069
9128
  const chunkSize = 64 * 1024;
9070
9129
  let position = stat.size;
9071
9130
  let remainder = "";
@@ -9078,7 +9137,7 @@ function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
9078
9137
  const length = Math.min(chunkSize, position);
9079
9138
  position -= length;
9080
9139
  const buffer = Buffer.alloc(length);
9081
- fs32.readSync(fd, buffer, 0, length, position);
9140
+ fs33.readSync(fd, buffer, 0, length, position);
9082
9141
  let chunk = buffer.toString("utf8");
9083
9142
  if (remainder) {
9084
9143
  chunk += remainder;
@@ -9131,7 +9190,7 @@ function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
9131
9190
  }
9132
9191
  }
9133
9192
  } finally {
9134
- fs32.closeSync(fd);
9193
+ fs33.closeSync(fd);
9135
9194
  }
9136
9195
  return { lines: collected.reverse(), totalLinesCount };
9137
9196
  }
@@ -9140,11 +9199,11 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
9140
9199
  if (!wantedLevelSet) {
9141
9200
  return { lines: [], totalLinesCount: 0 };
9142
9201
  }
9143
- const stat = fs32.statSync(filePath);
9202
+ const stat = fs33.statSync(filePath);
9144
9203
  if (stat.size === 0) {
9145
9204
  return { lines: [], totalLinesCount: 0 };
9146
9205
  }
9147
- const fd = fs32.openSync(filePath, "r");
9206
+ const fd = fs33.openSync(filePath, "r");
9148
9207
  const chunkSize = 64 * 1024;
9149
9208
  let position = stat.size;
9150
9209
  let remainder = "";
@@ -9156,7 +9215,7 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
9156
9215
  const length = Math.min(chunkSize, position);
9157
9216
  position -= length;
9158
9217
  const buffer = Buffer.alloc(length);
9159
- fs32.readSync(fd, buffer, 0, length, position);
9218
+ fs33.readSync(fd, buffer, 0, length, position);
9160
9219
  let chunk = buffer.toString("utf8");
9161
9220
  if (remainder) {
9162
9221
  chunk += remainder;
@@ -9203,7 +9262,7 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
9203
9262
  }
9204
9263
  }
9205
9264
  } finally {
9206
- fs32.closeSync(fd);
9265
+ fs33.closeSync(fd);
9207
9266
  }
9208
9267
  return { lines: collected.reverse(), totalLinesCount };
9209
9268
  }
@@ -9696,30 +9755,30 @@ async function readLogsJsonResult(options) {
9696
9755
  };
9697
9756
  }
9698
9757
  function resolveLogFilePath(logDir, type) {
9699
- const base = path25.isAbsolute(logDir) ? logDir : path25.join(process.cwd(), logDir);
9758
+ const base = path26.isAbsolute(logDir) ? logDir : path26.join(process.cwd(), logDir);
9700
9759
  if (type === "server") {
9701
- return path25.join(base, "server.log");
9760
+ return path26.join(base, "server.log");
9702
9761
  }
9703
9762
  if (type === "trace") {
9704
- return path25.join(base, "trace.log");
9763
+ return path26.join(base, "trace.log");
9705
9764
  }
9706
9765
  if (type === "server-std") {
9707
- return path25.join(base, "server.std.log");
9766
+ return path26.join(base, "server.std.log");
9708
9767
  }
9709
9768
  if (type === "client-std") {
9710
- return path25.join(base, "client.std.log");
9769
+ return path26.join(base, "client.std.log");
9711
9770
  }
9712
9771
  if (type === "dev") {
9713
- return path25.join(base, "dev.log");
9772
+ return path26.join(base, "dev.log");
9714
9773
  }
9715
9774
  if (type === "dev-std") {
9716
- return path25.join(base, "dev.std.log");
9775
+ return path26.join(base, "dev.std.log");
9717
9776
  }
9718
9777
  if (type === "install-dep-std") {
9719
- return path25.join(base, "install-dep.std.log");
9778
+ return path26.join(base, "install-dep.std.log");
9720
9779
  }
9721
9780
  if (type === "browser") {
9722
- return path25.join(base, "browser.log");
9781
+ return path26.join(base, "browser.log");
9723
9782
  }
9724
9783
  throw new Error(`Unsupported log type: ${type}`);
9725
9784
  }
@@ -9889,9 +9948,9 @@ function camelToKebab2(str) {
9889
9948
  }
9890
9949
 
9891
9950
  // src/commands/build/upload-static.handler.ts
9892
- import * as fs33 from "fs";
9951
+ import * as fs34 from "fs";
9893
9952
  import * as os2 from "os";
9894
- import * as path26 from "path";
9953
+ import * as path27 from "path";
9895
9954
  import { execFileSync } from "child_process";
9896
9955
  function readCredentialsFromEnv() {
9897
9956
  const uploadPrefix = process.env.STATIC_UPLOAD_PREFIX;
@@ -9915,8 +9974,8 @@ async function uploadStatic(options) {
9915
9974
  endpoint = UPLOAD_STATIC_DEFAULTS.endpoint,
9916
9975
  region = UPLOAD_STATIC_DEFAULTS.region
9917
9976
  } = options;
9918
- const resolvedStaticDir = path26.resolve(staticDir);
9919
- if (!fs33.existsSync(resolvedStaticDir)) {
9977
+ const resolvedStaticDir = path27.resolve(staticDir);
9978
+ if (!fs34.existsSync(resolvedStaticDir)) {
9920
9979
  console.error(`${LOG_PREFIX} \u76EE\u5F55\u4E0D\u5B58\u5728: ${resolvedStaticDir}\uFF0C\u8DF3\u8FC7\u4E0A\u4F20`);
9921
9980
  return;
9922
9981
  }
@@ -9949,8 +10008,8 @@ async function uploadStatic(options) {
9949
10008
  ({ AccessKeyID: accessKeyID, SecretAccessKey: secretAccessKey, SessionToken: sessionToken } = uploadCredential);
9950
10009
  }
9951
10010
  console.error(`${LOG_PREFIX} \u4E0A\u4F20\u76EE\u6807: ${uploadPrefix}`);
9952
- const confPath = path26.join(os2.tmpdir(), `.tosutilconfig-static-${process.pid}`);
9953
- fs33.writeFileSync(confPath, "");
10011
+ const confPath = path27.join(os2.tmpdir(), `.tosutilconfig-static-${process.pid}`);
10012
+ fs34.writeFileSync(confPath, "");
9954
10013
  try {
9955
10014
  console.error(`${LOG_PREFIX} \u914D\u7F6E tosutil...`);
9956
10015
  configureTosutil(resolvedTosutil, confPath, {
@@ -9964,7 +10023,7 @@ async function uploadStatic(options) {
9964
10023
  uploadToTos(resolvedTosutil, confPath, resolvedStaticDir, uploadPrefix);
9965
10024
  } finally {
9966
10025
  try {
9967
- fs33.unlinkSync(confPath);
10026
+ fs34.unlinkSync(confPath);
9968
10027
  } catch {
9969
10028
  }
9970
10029
  }
@@ -9984,8 +10043,8 @@ async function uploadStatic(options) {
9984
10043
  }
9985
10044
  }
9986
10045
  function resolveTosutilPath(tosutilPath) {
9987
- if (path26.isAbsolute(tosutilPath)) {
9988
- return fs33.existsSync(tosutilPath) ? tosutilPath : null;
10046
+ if (path27.isAbsolute(tosutilPath)) {
10047
+ return fs34.existsSync(tosutilPath) ? tosutilPath : null;
9989
10048
  }
9990
10049
  try {
9991
10050
  const resolved = execFileSync("which", [tosutilPath], { encoding: "utf-8" }).trim();
@@ -10030,7 +10089,7 @@ async function resolveBucketId(appId) {
10030
10089
  return bucketId;
10031
10090
  }
10032
10091
  function isDirEmpty(dirPath) {
10033
- const entries = fs33.readdirSync(dirPath);
10092
+ const entries = fs34.readdirSync(dirPath);
10034
10093
  return entries.length === 0;
10035
10094
  }
10036
10095
 
@@ -10126,13 +10185,13 @@ var commands = [
10126
10185
 
10127
10186
  // src/index.ts
10128
10187
  for (const filename of [".env.local", ".env"]) {
10129
- const envPath = path27.join(process.cwd(), filename);
10130
- if (fs34.existsSync(envPath)) {
10188
+ const envPath = path28.join(process.cwd(), filename);
10189
+ if (fs35.existsSync(envPath)) {
10131
10190
  dotenvConfig({ path: envPath });
10132
10191
  }
10133
10192
  }
10134
- var __dirname = path27.dirname(fileURLToPath5(import.meta.url));
10135
- var pkg = JSON.parse(fs34.readFileSync(path27.join(__dirname, "../package.json"), "utf-8"));
10193
+ var __dirname = path28.dirname(fileURLToPath6(import.meta.url));
10194
+ var pkg = JSON.parse(fs35.readFileSync(path28.join(__dirname, "../package.json"), "utf-8"));
10136
10195
  var cli = new FullstackCLI(pkg.version);
10137
10196
  cli.useAll(commands);
10138
10197
  cli.run();