@lark-apaas/fullstack-cli 1.1.40-alpha.3 → 1.1.40-alpha.4

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.
Files changed (2) hide show
  1. package/dist/index.js +335 -251
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/index.ts
2
- import fs27 from "fs";
3
- import path23 from "path";
2
+ import fs28 from "fs";
3
+ import path24 from "path";
4
4
  import { fileURLToPath as fileURLToPath5 } from "url";
5
5
  import { config as dotenvConfig } from "dotenv";
6
6
 
@@ -3105,6 +3105,8 @@ async function run3(options = {}) {
3105
3105
 
3106
3106
  // src/commands/upgrade/deps/run.handler.ts
3107
3107
  import { spawnSync as spawnSync3 } from "child_process";
3108
+ import fs11 from "fs";
3109
+ import path9 from "path";
3108
3110
 
3109
3111
  // src/utils/grayscale/config.ts
3110
3112
  function getGrayscaleConfig(configJson) {
@@ -3116,10 +3118,11 @@ function getGrayscaleConfig(configJson) {
3116
3118
  const parsed = JSON.parse(raw);
3117
3119
  const config = parsed.config || parsed;
3118
3120
  const tenantId = parsed.tenant_id != null ? String(parsed.tenant_id) : void 0;
3121
+ const xTtEnv = parsed.x_tt_env || void 0;
3119
3122
  if (!config.enabled) {
3120
3123
  return null;
3121
3124
  }
3122
- return { config, tenantId };
3125
+ return { config, tenantId, xTtEnv };
3123
3126
  } catch {
3124
3127
  console.warn("[grayscale] Failed to parse grayscale config");
3125
3128
  return null;
@@ -3132,7 +3135,8 @@ import path8 from "path";
3132
3135
  function readFromEnvVars() {
3133
3136
  const appId = process.env.app_id || process.env.APP_ID;
3134
3137
  const tenantId = process.env.tenant_id || process.env.TENANT_ID;
3135
- return { appId, tenantId };
3138
+ const xTtEnv = process.env.FORCE_FRAMEWORK_CLI_CANARY_ENV || process.env.x_tt_env;
3139
+ return { appId, tenantId, xTtEnv };
3136
3140
  }
3137
3141
  function parseEnvFile(filePath) {
3138
3142
  const result = {};
@@ -3161,7 +3165,8 @@ function readFromForceEnvFile(cwd) {
3161
3165
  const vars = parseEnvFile(envPath2);
3162
3166
  return {
3163
3167
  appId: vars.app_id || vars.APP_ID,
3164
- tenantId: vars.tenant_id || vars.TENANT_ID
3168
+ tenantId: vars.tenant_id || vars.TENANT_ID,
3169
+ xTtEnv: vars.FORCE_FRAMEWORK_CLI_CANARY_ENV || vars.x_tt_env
3165
3170
  };
3166
3171
  }
3167
3172
  function readFromClientBasePath() {
@@ -3184,7 +3189,8 @@ function readFromDotEnv(cwd) {
3184
3189
  const vars = parseEnvFile(envPath2);
3185
3190
  return {
3186
3191
  appId: vars.app_id || vars.APP_ID,
3187
- tenantId: vars.tenant_id || vars.TENANT_ID
3192
+ tenantId: vars.tenant_id || vars.TENANT_ID,
3193
+ xTtEnv: vars.FORCE_FRAMEWORK_CLI_CANARY_ENV || vars.x_tt_env
3188
3194
  };
3189
3195
  }
3190
3196
  function readFromPackageJson(cwd) {
@@ -3218,8 +3224,8 @@ function readProjectIdentity(cwd) {
3218
3224
  if (!merged.tenantId && identity.tenantId) {
3219
3225
  merged.tenantId = identity.tenantId;
3220
3226
  }
3221
- if (merged.appId && merged.tenantId) {
3222
- break;
3227
+ if (!merged.xTtEnv && identity.xTtEnv) {
3228
+ merged.xTtEnv = identity.xTtEnv;
3223
3229
  }
3224
3230
  }
3225
3231
  return merged;
@@ -3233,63 +3239,78 @@ function isInPercentage(tenantId, percentage) {
3233
3239
  if (isNaN(id)) return false;
3234
3240
  return id % 100 < percentage;
3235
3241
  }
3236
- function matchConditions(rule, identity) {
3237
- const { conditions } = rule;
3238
- if (conditions.tenant_ids && conditions.tenant_ids.length > 0) {
3239
- if (identity.tenantId && conditions.tenant_ids.includes(identity.tenantId)) {
3240
- return true;
3242
+ function matchRule(rule, identity) {
3243
+ let hasAnyCondition = false;
3244
+ if (rule.tenant_ids && rule.tenant_ids.length > 0) {
3245
+ hasAnyCondition = true;
3246
+ if (!identity.tenantId || !rule.tenant_ids.includes(identity.tenantId)) {
3247
+ return false;
3241
3248
  }
3242
3249
  }
3243
- if (conditions.app_ids && conditions.app_ids.length > 0) {
3244
- if (identity.appId && conditions.app_ids.includes(identity.appId)) {
3245
- return true;
3250
+ if (rule.app_ids && rule.app_ids.length > 0) {
3251
+ hasAnyCondition = true;
3252
+ if (!identity.appId || !rule.app_ids.includes(identity.appId)) {
3253
+ return false;
3246
3254
  }
3247
3255
  }
3248
- if (conditions.percentage != null && conditions.percentage > 0) {
3249
- if (conditions.percentage >= 100) return true;
3250
- if (identity.tenantId && isInPercentage(identity.tenantId, conditions.percentage)) {
3251
- return true;
3256
+ if (rule.percentage != null && rule.percentage > 0) {
3257
+ hasAnyCondition = true;
3258
+ if (rule.percentage < 100) {
3259
+ if (!identity.tenantId || !isInPercentage(identity.tenantId, rule.percentage)) {
3260
+ return false;
3261
+ }
3252
3262
  }
3253
3263
  }
3254
- const hasConditions = conditions.tenant_ids && conditions.tenant_ids.length > 0 || conditions.app_ids && conditions.app_ids.length > 0 || conditions.percentage != null && conditions.percentage > 0;
3255
- return !hasConditions;
3256
- }
3257
- function evaluateRules(config, identity) {
3258
- const enabledRules = config.rules.filter((rule) => rule.enabled).sort((a, b) => b.priority - a.priority);
3259
- for (const rule of enabledRules) {
3260
- if (matchConditions(rule, identity)) {
3261
- return rule;
3264
+ if (rule.x_tt_env) {
3265
+ hasAnyCondition = true;
3266
+ if (identity.xTtEnv !== rule.x_tt_env) {
3267
+ return false;
3262
3268
  }
3263
3269
  }
3264
- return null;
3270
+ return hasAnyCondition;
3271
+ }
3272
+ function matchChannel(channel, identity) {
3273
+ if (!channel.rules || channel.rules.length === 0) return false;
3274
+ return channel.rules.some((rule) => matchRule(rule, identity));
3275
+ }
3276
+ function isBlocked(config, identity) {
3277
+ if (identity.tenantId && config.blocked_tenant_ids?.includes(identity.tenantId)) {
3278
+ return true;
3279
+ }
3280
+ if (identity.appId && config.blocked_app_ids?.includes(identity.appId)) {
3281
+ return true;
3282
+ }
3283
+ return false;
3265
3284
  }
3266
3285
  function resolveTargetVersions(config, identity) {
3267
- const matchedRule = evaluateRules(config, identity);
3268
- const channelName = matchedRule?.channel || config.default_channel;
3269
- const channel = config.channels[channelName];
3270
- if (!channel) {
3271
- console.warn(`[grayscale] Channel "${channelName}" not found in config`);
3272
- return null;
3286
+ const stableVersions = config.stable?.versions || {};
3287
+ let matchedChannel;
3288
+ if (isBlocked(config, identity)) {
3289
+ console.log("[grayscale] Tenant/app is in blocklist, use stable");
3290
+ } else {
3291
+ matchedChannel = (config.channels || []).find((ch) => matchChannel(ch, identity));
3273
3292
  }
3274
- const versions = /* @__PURE__ */ new Map();
3275
- for (const [pkgName, version] of Object.entries(channel.versions)) {
3293
+ const merged = /* @__PURE__ */ new Map();
3294
+ for (const [pkg2, version] of Object.entries(stableVersions)) {
3276
3295
  if (config.blocked_versions?.includes(version)) {
3277
- console.warn(`[grayscale] Version ${version} of ${pkgName} is blocked, skipping`);
3296
+ console.warn(`[grayscale] stable version ${version} of ${pkg2} is blocked, skipping`);
3278
3297
  continue;
3279
3298
  }
3280
- versions.set(pkgName, version);
3299
+ merged.set(pkg2, version);
3281
3300
  }
3282
- if (config.force_versions) {
3283
- for (const [pkgName, version] of Object.entries(config.force_versions)) {
3284
- versions.set(pkgName, version);
3301
+ if (matchedChannel) {
3302
+ console.log(`[grayscale] Matched channel: ${matchedChannel.name}`);
3303
+ for (const [pkg2, version] of Object.entries(matchedChannel.versions || {})) {
3304
+ if (config.blocked_versions?.includes(version)) {
3305
+ console.warn(`[grayscale] channel version ${version} of ${pkg2} is blocked, skipping`);
3306
+ continue;
3307
+ }
3308
+ merged.set(pkg2, version);
3285
3309
  }
3310
+ } else if (!isBlocked(config, identity)) {
3311
+ console.log("[grayscale] No channel matched, use stable");
3286
3312
  }
3287
- if (matchedRule) {
3288
- console.log(`[grayscale] Matched rule: "${matchedRule.name}" (id: ${matchedRule.id}), channel: ${channelName}`);
3289
- } else {
3290
- console.log(`[grayscale] No rule matched, using default channel: ${channelName}`);
3291
- }
3292
- return versions;
3313
+ return merged.size > 0 ? merged : null;
3293
3314
  }
3294
3315
 
3295
3316
  // src/utils/grayscale/index.ts
@@ -3299,12 +3320,17 @@ function resolveGrayscaleVersions(cwd, configJson) {
3299
3320
  console.log("[grayscale] Config not available, skipping grayscale");
3300
3321
  return null;
3301
3322
  }
3302
- const { config, tenantId: payloadTenantId } = result;
3323
+ const { config, tenantId: payloadTenantId, xTtEnv: payloadXTtEnv } = result;
3303
3324
  const identity = readProjectIdentity(cwd);
3304
3325
  if (payloadTenantId) {
3305
3326
  identity.tenantId = payloadTenantId;
3306
3327
  }
3307
- console.log(`[grayscale] Project identity: appId=${identity.appId || "N/A"}, tenantId=${identity.tenantId || "N/A"}`);
3328
+ if (payloadXTtEnv) {
3329
+ identity.xTtEnv = payloadXTtEnv;
3330
+ }
3331
+ console.log(
3332
+ `[grayscale] Project identity: appId=${identity.appId || "N/A"}, tenantId=${identity.tenantId || "N/A"}, xTtEnv=${identity.xTtEnv || "N/A"}`
3333
+ );
3308
3334
  const versions = resolveTargetVersions(config, identity);
3309
3335
  if (!versions || versions.size === 0) {
3310
3336
  console.log("[grayscale] No target versions resolved");
@@ -3318,6 +3344,33 @@ function resolveGrayscaleVersions(cwd, configJson) {
3318
3344
  }
3319
3345
 
3320
3346
  // src/commands/upgrade/deps/run.handler.ts
3347
+ function parseSemver(version) {
3348
+ const match = version.match(/^(\d+)\.(\d+)\.(\d+)/);
3349
+ if (!match) return null;
3350
+ return [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10)];
3351
+ }
3352
+ function compareSemver(a, b) {
3353
+ const va = parseSemver(a);
3354
+ const vb = parseSemver(b);
3355
+ if (!va || !vb) return 0;
3356
+ for (let i = 0; i < 3; i++) {
3357
+ if (va[i] < vb[i]) return -1;
3358
+ if (va[i] > vb[i]) return 1;
3359
+ }
3360
+ return 0;
3361
+ }
3362
+ function satisfiesCaret(installed, range) {
3363
+ const baseVersion = range.slice(1);
3364
+ const base = parseSemver(baseVersion);
3365
+ const inst = parseSemver(installed);
3366
+ if (!base || !inst) return false;
3367
+ if (compareSemver(installed, baseVersion) < 0) return false;
3368
+ if (inst[0] > base[0]) return false;
3369
+ return true;
3370
+ }
3371
+ function isRangeVersion(version) {
3372
+ return version.startsWith("^");
3373
+ }
3321
3374
  function findLarkAapaasPackages(cwd, filterPackages) {
3322
3375
  const pkg2 = readPackageJson(cwd);
3323
3376
  const allPackages = /* @__PURE__ */ new Set();
@@ -3370,12 +3423,37 @@ function upgradePackages(packages, version, cwd) {
3370
3423
  });
3371
3424
  }
3372
3425
  }
3373
- function installGrayscaleVersions(packages, grayscaleVersions, cwd, dryRun) {
3426
+ function installGrayscaleVersions(packages, grayscaleVersions, cwd, dryRun, mode) {
3374
3427
  const upgradePlan = [];
3375
3428
  for (const pkg2 of packages) {
3376
3429
  const version = grayscaleVersions.get(pkg2);
3377
3430
  if (version) {
3378
- upgradePlan.push({ pkg: pkg2, version });
3431
+ let current = "";
3432
+ try {
3433
+ const installedPkgPath = path9.join(cwd, "node_modules", pkg2, "package.json");
3434
+ const installedPkg = JSON.parse(fs11.readFileSync(installedPkgPath, "utf-8"));
3435
+ current = installedPkg.version || "";
3436
+ } catch {
3437
+ }
3438
+ if (mode === "destroy") {
3439
+ if (!isRangeVersion(version) && current === version) {
3440
+ console.log(`[fullstack-cli] ${pkg2}@${version} (already installed, skip)`);
3441
+ continue;
3442
+ }
3443
+ } else {
3444
+ if (isRangeVersion(version)) {
3445
+ if (current && satisfiesCaret(current, version)) {
3446
+ console.log(`[fullstack-cli] ${pkg2}@${current} satisfies ${version} (skip)`);
3447
+ continue;
3448
+ }
3449
+ } else {
3450
+ if (current === version) {
3451
+ console.log(`[fullstack-cli] ${pkg2}@${version} (already installed, skip)`);
3452
+ continue;
3453
+ }
3454
+ }
3455
+ }
3456
+ upgradePlan.push({ pkg: pkg2, version, current });
3379
3457
  }
3380
3458
  }
3381
3459
  if (upgradePlan.length === 0) {
@@ -3383,23 +3461,21 @@ function installGrayscaleVersions(packages, grayscaleVersions, cwd, dryRun) {
3383
3461
  return;
3384
3462
  }
3385
3463
  console.log(`[fullstack-cli] Grayscale upgrade plan (${upgradePlan.length} package(s)):`);
3386
- upgradePlan.forEach(({ pkg: pkg2, version }) => {
3387
- console.log(` - ${pkg2} -> ${version}`);
3464
+ upgradePlan.forEach(({ pkg: pkg2, version, current }) => {
3465
+ console.log(` - ${pkg2} ${current} -> ${version}`);
3388
3466
  });
3389
3467
  if (dryRun) {
3390
3468
  console.log("[fullstack-cli] Dry run mode, skipping actual installation");
3391
3469
  return;
3392
3470
  }
3393
- for (const { pkg: pkg2, version } of upgradePlan) {
3394
- const target = `${pkg2}@${version}`;
3395
- console.log(`[fullstack-cli] Installing ${target}...`);
3396
- const result = spawnSync3("npm", ["install", target], {
3397
- cwd,
3398
- stdio: "inherit"
3399
- });
3400
- if (result.error || result.status !== 0) {
3401
- throw new Error(`Failed to install ${target}`);
3402
- }
3471
+ const targets = upgradePlan.map(({ pkg: pkg2, version }) => `${pkg2}@${version}`);
3472
+ console.log(`[fullstack-cli] Installing ${targets.join(" ")}...`);
3473
+ const result = spawnSync3("npm", ["install", ...targets], {
3474
+ cwd,
3475
+ stdio: "inherit"
3476
+ });
3477
+ if (result.error || result.status !== 0) {
3478
+ console.warn(`[fullstack-cli] npm install failed`);
3403
3479
  }
3404
3480
  }
3405
3481
  async function run4(options = {}) {
@@ -3420,16 +3496,24 @@ async function run4(options = {}) {
3420
3496
  const grayscaleVersions = resolveGrayscaleVersions(cwd, options.grayscaleConfig);
3421
3497
  if (grayscaleVersions) {
3422
3498
  console.log("[fullstack-cli] Step 3/3: Applying grayscale versions...");
3423
- installGrayscaleVersions(packages, grayscaleVersions, cwd, !!options.dryRun);
3499
+ installGrayscaleVersions(packages, grayscaleVersions, cwd, !!options.dryRun, options.mode || "rebuild");
3424
3500
  if (!options.dryRun) {
3425
3501
  console.log(`[fullstack-cli] \u2713 Successfully upgraded ${packages.length} package(s) via grayscale`);
3426
3502
  console.log("[fullstack-cli] Dependencies upgrade completed successfully \u2705");
3427
3503
  }
3428
3504
  return;
3429
3505
  }
3506
+ if (options.grayscaleConfig) {
3507
+ console.log("[fullstack-cli] Grayscale config provided but not available, skip upgrade");
3508
+ return;
3509
+ }
3430
3510
  console.log("[fullstack-cli] Grayscale not available, falling back to default upgrade");
3431
3511
  } catch (error) {
3432
3512
  const msg = error instanceof Error ? error.message : String(error);
3513
+ if (options.grayscaleConfig) {
3514
+ console.warn(`[fullstack-cli] Grayscale check failed: ${msg}, skip upgrade`);
3515
+ return;
3516
+ }
3433
3517
  console.warn(`[fullstack-cli] Grayscale check failed: ${msg}, falling back to default upgrade`);
3434
3518
  }
3435
3519
  } else if (options.skipGrayscale) {
@@ -3458,7 +3542,7 @@ var depsCommand = {
3458
3542
  name: "deps",
3459
3543
  description: "Upgrade @lark-apaas dependencies",
3460
3544
  register(parentCommand) {
3461
- parentCommand.command(this.name).description(this.description).option("--version <version>", "Upgrade to specific version").option("--packages <packages>", "Only upgrade specific packages (comma-separated)").option("--skip-grayscale", "Skip grayscale version check").option("--grayscale-config <json>", "Grayscale config JSON (injected by sandbox_console)").option("--dry-run", "Show upgrade plan without executing").action(async (options) => {
3545
+ parentCommand.command(this.name).description(this.description).option("--version <version>", "Upgrade to specific version").option("--packages <packages>", "Only upgrade specific packages (comma-separated)").option("--skip-grayscale", "Skip grayscale version check").option("--grayscale-config <json>", "Grayscale config JSON (injected by sandbox_console)").option("--dry-run", "Show upgrade plan without executing").option("--mode <mode>", "Execution mode: rebuild (default) or destroy", "rebuild").action(async (options) => {
3462
3546
  await run4(options);
3463
3547
  });
3464
3548
  }
@@ -3477,8 +3561,8 @@ var upgradeCommand = {
3477
3561
  };
3478
3562
 
3479
3563
  // src/commands/action-plugin/utils.ts
3480
- import fs11 from "fs";
3481
- import path9 from "path";
3564
+ import fs12 from "fs";
3565
+ import path10 from "path";
3482
3566
  import { spawnSync as spawnSync4, execSync as execSync2 } from "child_process";
3483
3567
  function parsePluginName(input) {
3484
3568
  const match = input.match(/^(@[^/]+\/[^@]+)(?:@(.+))?$/);
@@ -3496,18 +3580,18 @@ function getProjectRoot() {
3496
3580
  return process.cwd();
3497
3581
  }
3498
3582
  function getPackageJsonPath() {
3499
- return path9.join(getProjectRoot(), "package.json");
3583
+ return path10.join(getProjectRoot(), "package.json");
3500
3584
  }
3501
3585
  function getPluginPath(pluginName) {
3502
- return path9.join(getProjectRoot(), "node_modules", pluginName);
3586
+ return path10.join(getProjectRoot(), "node_modules", pluginName);
3503
3587
  }
3504
3588
  function readPackageJson2() {
3505
3589
  const pkgPath = getPackageJsonPath();
3506
- if (!fs11.existsSync(pkgPath)) {
3590
+ if (!fs12.existsSync(pkgPath)) {
3507
3591
  throw new Error("package.json not found in current directory");
3508
3592
  }
3509
3593
  try {
3510
- const content = fs11.readFileSync(pkgPath, "utf-8");
3594
+ const content = fs12.readFileSync(pkgPath, "utf-8");
3511
3595
  return JSON.parse(content);
3512
3596
  } catch {
3513
3597
  throw new Error("Failed to parse package.json");
@@ -3515,7 +3599,7 @@ function readPackageJson2() {
3515
3599
  }
3516
3600
  function writePackageJson2(pkg2) {
3517
3601
  const pkgPath = getPackageJsonPath();
3518
- fs11.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
3602
+ fs12.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
3519
3603
  }
3520
3604
  function readActionPlugins() {
3521
3605
  const pkg2 = readPackageJson2();
@@ -3548,12 +3632,12 @@ function npmInstall(tgzPath) {
3548
3632
  }
3549
3633
  }
3550
3634
  function getPackageVersion(pluginName) {
3551
- const pkgJsonPath = path9.join(getPluginPath(pluginName), "package.json");
3552
- if (!fs11.existsSync(pkgJsonPath)) {
3635
+ const pkgJsonPath = path10.join(getPluginPath(pluginName), "package.json");
3636
+ if (!fs12.existsSync(pkgJsonPath)) {
3553
3637
  return null;
3554
3638
  }
3555
3639
  try {
3556
- const content = fs11.readFileSync(pkgJsonPath, "utf-8");
3640
+ const content = fs12.readFileSync(pkgJsonPath, "utf-8");
3557
3641
  const pkg2 = JSON.parse(content);
3558
3642
  return pkg2.version || null;
3559
3643
  } catch {
@@ -3561,49 +3645,49 @@ function getPackageVersion(pluginName) {
3561
3645
  }
3562
3646
  }
3563
3647
  function readPluginPackageJson(pluginPath) {
3564
- const pkgJsonPath = path9.join(pluginPath, "package.json");
3565
- if (!fs11.existsSync(pkgJsonPath)) {
3648
+ const pkgJsonPath = path10.join(pluginPath, "package.json");
3649
+ if (!fs12.existsSync(pkgJsonPath)) {
3566
3650
  return null;
3567
3651
  }
3568
3652
  try {
3569
- const content = fs11.readFileSync(pkgJsonPath, "utf-8");
3653
+ const content = fs12.readFileSync(pkgJsonPath, "utf-8");
3570
3654
  return JSON.parse(content);
3571
3655
  } catch {
3572
3656
  return null;
3573
3657
  }
3574
3658
  }
3575
3659
  function extractTgzToNodeModules(tgzPath, pluginName) {
3576
- const nodeModulesPath = path9.join(getProjectRoot(), "node_modules");
3577
- const targetDir = path9.join(nodeModulesPath, pluginName);
3578
- const scopeDir = path9.dirname(targetDir);
3579
- if (!fs11.existsSync(scopeDir)) {
3580
- fs11.mkdirSync(scopeDir, { recursive: true });
3660
+ const nodeModulesPath = path10.join(getProjectRoot(), "node_modules");
3661
+ const targetDir = path10.join(nodeModulesPath, pluginName);
3662
+ const scopeDir = path10.dirname(targetDir);
3663
+ if (!fs12.existsSync(scopeDir)) {
3664
+ fs12.mkdirSync(scopeDir, { recursive: true });
3581
3665
  }
3582
- if (fs11.existsSync(targetDir)) {
3583
- fs11.rmSync(targetDir, { recursive: true });
3666
+ if (fs12.existsSync(targetDir)) {
3667
+ fs12.rmSync(targetDir, { recursive: true });
3584
3668
  }
3585
- const tempDir = path9.join(nodeModulesPath, ".cache", "fullstack-cli", "extract-temp");
3586
- if (fs11.existsSync(tempDir)) {
3587
- fs11.rmSync(tempDir, { recursive: true });
3669
+ const tempDir = path10.join(nodeModulesPath, ".cache", "fullstack-cli", "extract-temp");
3670
+ if (fs12.existsSync(tempDir)) {
3671
+ fs12.rmSync(tempDir, { recursive: true });
3588
3672
  }
3589
- fs11.mkdirSync(tempDir, { recursive: true });
3673
+ fs12.mkdirSync(tempDir, { recursive: true });
3590
3674
  try {
3591
3675
  execSync2(`tar -xzf "${tgzPath}" -C "${tempDir}"`, { stdio: "pipe" });
3592
- const extractedDir = path9.join(tempDir, "package");
3593
- if (fs11.existsSync(extractedDir)) {
3594
- fs11.renameSync(extractedDir, targetDir);
3676
+ const extractedDir = path10.join(tempDir, "package");
3677
+ if (fs12.existsSync(extractedDir)) {
3678
+ fs12.renameSync(extractedDir, targetDir);
3595
3679
  } else {
3596
- const files = fs11.readdirSync(tempDir);
3680
+ const files = fs12.readdirSync(tempDir);
3597
3681
  if (files.length === 1) {
3598
- fs11.renameSync(path9.join(tempDir, files[0]), targetDir);
3682
+ fs12.renameSync(path10.join(tempDir, files[0]), targetDir);
3599
3683
  } else {
3600
3684
  throw new Error("Unexpected tgz structure");
3601
3685
  }
3602
3686
  }
3603
3687
  return targetDir;
3604
3688
  } finally {
3605
- if (fs11.existsSync(tempDir)) {
3606
- fs11.rmSync(tempDir, { recursive: true });
3689
+ if (fs12.existsSync(tempDir)) {
3690
+ fs12.rmSync(tempDir, { recursive: true });
3607
3691
  }
3608
3692
  }
3609
3693
  }
@@ -3612,10 +3696,10 @@ function checkMissingPeerDeps(peerDeps) {
3612
3696
  return [];
3613
3697
  }
3614
3698
  const missing = [];
3615
- const nodeModulesPath = path9.join(getProjectRoot(), "node_modules");
3699
+ const nodeModulesPath = path10.join(getProjectRoot(), "node_modules");
3616
3700
  for (const [depName, _version] of Object.entries(peerDeps)) {
3617
- const depPath = path9.join(nodeModulesPath, depName);
3618
- if (!fs11.existsSync(depPath)) {
3701
+ const depPath = path10.join(nodeModulesPath, depName);
3702
+ if (!fs12.existsSync(depPath)) {
3619
3703
  missing.push(depName);
3620
3704
  }
3621
3705
  }
@@ -3639,16 +3723,16 @@ function installMissingDeps(deps) {
3639
3723
  }
3640
3724
  function removePluginDirectory(pluginName) {
3641
3725
  const pluginPath = getPluginPath(pluginName);
3642
- if (fs11.existsSync(pluginPath)) {
3643
- fs11.rmSync(pluginPath, { recursive: true });
3726
+ if (fs12.existsSync(pluginPath)) {
3727
+ fs12.rmSync(pluginPath, { recursive: true });
3644
3728
  console.log(`[action-plugin] Removed ${pluginName}`);
3645
3729
  }
3646
3730
  }
3647
3731
 
3648
3732
  // src/commands/action-plugin/api-client.ts
3649
3733
  import { HttpClient as HttpClient2 } from "@lark-apaas/http-client";
3650
- import fs12 from "fs";
3651
- import path10 from "path";
3734
+ import fs13 from "fs";
3735
+ import path11 from "path";
3652
3736
  var PLUGIN_CACHE_DIR = "node_modules/.cache/fullstack-cli/plugins";
3653
3737
  async function getPluginVersions(keys, latestOnly = true) {
3654
3738
  const client = getHttpClient();
@@ -3712,19 +3796,19 @@ async function downloadFromPublic(downloadURL) {
3712
3796
  return Buffer.from(arrayBuffer);
3713
3797
  }
3714
3798
  function getPluginCacheDir() {
3715
- return path10.join(process.cwd(), PLUGIN_CACHE_DIR);
3799
+ return path11.join(process.cwd(), PLUGIN_CACHE_DIR);
3716
3800
  }
3717
3801
  function ensureCacheDir() {
3718
3802
  const cacheDir = getPluginCacheDir();
3719
- if (!fs12.existsSync(cacheDir)) {
3720
- fs12.mkdirSync(cacheDir, { recursive: true });
3803
+ if (!fs13.existsSync(cacheDir)) {
3804
+ fs13.mkdirSync(cacheDir, { recursive: true });
3721
3805
  }
3722
3806
  }
3723
3807
  function getTempFilePath(pluginKey, version) {
3724
3808
  ensureCacheDir();
3725
3809
  const safeKey = pluginKey.replace(/[/@]/g, "_");
3726
3810
  const filename = `${safeKey}@${version}.tgz`;
3727
- return path10.join(getPluginCacheDir(), filename);
3811
+ return path11.join(getPluginCacheDir(), filename);
3728
3812
  }
3729
3813
  var MAX_RETRIES = 2;
3730
3814
  async function withRetry(operation, description, maxRetries = MAX_RETRIES) {
@@ -3761,7 +3845,7 @@ async function downloadPlugin(pluginKey, requestedVersion) {
3761
3845
  );
3762
3846
  }
3763
3847
  const tgzPath = getTempFilePath(pluginKey, pluginInfo.version);
3764
- fs12.writeFileSync(tgzPath, tgzBuffer);
3848
+ fs13.writeFileSync(tgzPath, tgzBuffer);
3765
3849
  console.log(`[action-plugin] Downloaded to ${tgzPath} (${(tgzBuffer.length / 1024).toFixed(2)} KB)`);
3766
3850
  return {
3767
3851
  tgzPath,
@@ -3775,18 +3859,18 @@ function getCachePath(pluginKey, version) {
3775
3859
  ensureCacheDir();
3776
3860
  const safeKey = pluginKey.replace(/[/@]/g, "_");
3777
3861
  const filename = `${safeKey}@${version}.tgz`;
3778
- return path10.join(getPluginCacheDir(), filename);
3862
+ return path11.join(getPluginCacheDir(), filename);
3779
3863
  }
3780
3864
  function hasCachedPlugin(pluginKey, version) {
3781
3865
  const cachePath = getCachePath(pluginKey, version);
3782
- return fs12.existsSync(cachePath);
3866
+ return fs13.existsSync(cachePath);
3783
3867
  }
3784
3868
  function listCachedPlugins() {
3785
3869
  const cacheDir = getPluginCacheDir();
3786
- if (!fs12.existsSync(cacheDir)) {
3870
+ if (!fs13.existsSync(cacheDir)) {
3787
3871
  return [];
3788
3872
  }
3789
- const files = fs12.readdirSync(cacheDir);
3873
+ const files = fs13.readdirSync(cacheDir);
3790
3874
  const result = [];
3791
3875
  for (const file of files) {
3792
3876
  if (!file.endsWith(".tgz")) continue;
@@ -3794,8 +3878,8 @@ function listCachedPlugins() {
3794
3878
  if (!match) continue;
3795
3879
  const [, rawName, version] = match;
3796
3880
  const name = rawName.replace(/^_/, "@").replace(/_/, "/");
3797
- const filePath = path10.join(cacheDir, file);
3798
- const stat = fs12.statSync(filePath);
3881
+ const filePath = path11.join(cacheDir, file);
3882
+ const stat = fs13.statSync(filePath);
3799
3883
  result.push({
3800
3884
  name,
3801
3885
  version,
@@ -3808,14 +3892,14 @@ function listCachedPlugins() {
3808
3892
  }
3809
3893
  function cleanAllCache() {
3810
3894
  const cacheDir = getPluginCacheDir();
3811
- if (!fs12.existsSync(cacheDir)) {
3895
+ if (!fs13.existsSync(cacheDir)) {
3812
3896
  return 0;
3813
3897
  }
3814
- const files = fs12.readdirSync(cacheDir);
3898
+ const files = fs13.readdirSync(cacheDir);
3815
3899
  let count = 0;
3816
3900
  for (const file of files) {
3817
3901
  if (file.endsWith(".tgz")) {
3818
- fs12.unlinkSync(path10.join(cacheDir, file));
3902
+ fs13.unlinkSync(path11.join(cacheDir, file));
3819
3903
  count++;
3820
3904
  }
3821
3905
  }
@@ -3823,21 +3907,21 @@ function cleanAllCache() {
3823
3907
  }
3824
3908
  function cleanPluginCache(pluginKey, version) {
3825
3909
  const cacheDir = getPluginCacheDir();
3826
- if (!fs12.existsSync(cacheDir)) {
3910
+ if (!fs13.existsSync(cacheDir)) {
3827
3911
  return 0;
3828
3912
  }
3829
3913
  const safeKey = pluginKey.replace(/[/@]/g, "_");
3830
- const files = fs12.readdirSync(cacheDir);
3914
+ const files = fs13.readdirSync(cacheDir);
3831
3915
  let count = 0;
3832
3916
  for (const file of files) {
3833
3917
  if (version) {
3834
3918
  if (file === `${safeKey}@${version}.tgz`) {
3835
- fs12.unlinkSync(path10.join(cacheDir, file));
3919
+ fs13.unlinkSync(path11.join(cacheDir, file));
3836
3920
  count++;
3837
3921
  }
3838
3922
  } else {
3839
3923
  if (file.startsWith(`${safeKey}@`) && file.endsWith(".tgz")) {
3840
- fs12.unlinkSync(path10.join(cacheDir, file));
3924
+ fs13.unlinkSync(path11.join(cacheDir, file));
3841
3925
  count++;
3842
3926
  }
3843
3927
  }
@@ -4264,40 +4348,40 @@ var actionPluginCommandGroup = {
4264
4348
  };
4265
4349
 
4266
4350
  // src/commands/capability/utils.ts
4267
- import fs13 from "fs";
4351
+ import fs14 from "fs";
4268
4352
  import { createRequire as createRequire2 } from "module";
4269
- import path11 from "path";
4353
+ import path12 from "path";
4270
4354
  var CAPABILITIES_DIR = "server/capabilities";
4271
4355
  function getProjectRoot2() {
4272
4356
  return process.cwd();
4273
4357
  }
4274
4358
  function getCapabilitiesDir() {
4275
- return path11.join(getProjectRoot2(), CAPABILITIES_DIR);
4359
+ return path12.join(getProjectRoot2(), CAPABILITIES_DIR);
4276
4360
  }
4277
4361
  function getCapabilityPath(id) {
4278
- return path11.join(getCapabilitiesDir(), `${id}.json`);
4362
+ return path12.join(getCapabilitiesDir(), `${id}.json`);
4279
4363
  }
4280
4364
  function getPluginManifestPath(pluginKey) {
4281
- return path11.join(getProjectRoot2(), "node_modules", pluginKey, "manifest.json");
4365
+ return path12.join(getProjectRoot2(), "node_modules", pluginKey, "manifest.json");
4282
4366
  }
4283
4367
  function capabilitiesDirExists() {
4284
- return fs13.existsSync(getCapabilitiesDir());
4368
+ return fs14.existsSync(getCapabilitiesDir());
4285
4369
  }
4286
4370
  function listCapabilityIds() {
4287
4371
  const dir = getCapabilitiesDir();
4288
- if (!fs13.existsSync(dir)) {
4372
+ if (!fs14.existsSync(dir)) {
4289
4373
  return [];
4290
4374
  }
4291
- const files = fs13.readdirSync(dir);
4375
+ const files = fs14.readdirSync(dir);
4292
4376
  return files.filter((f) => f.endsWith(".json") && f !== "capabilities.json").map((f) => f.replace(/\.json$/, ""));
4293
4377
  }
4294
4378
  function readCapability(id) {
4295
4379
  const filePath = getCapabilityPath(id);
4296
- if (!fs13.existsSync(filePath)) {
4380
+ if (!fs14.existsSync(filePath)) {
4297
4381
  throw new Error(`Capability not found: ${id}`);
4298
4382
  }
4299
4383
  try {
4300
- const content = fs13.readFileSync(filePath, "utf-8");
4384
+ const content = fs14.readFileSync(filePath, "utf-8");
4301
4385
  return JSON.parse(content);
4302
4386
  } catch (error) {
4303
4387
  if (error instanceof SyntaxError) {
@@ -4324,11 +4408,11 @@ function readAllCapabilities() {
4324
4408
  }
4325
4409
  function readPluginManifest(pluginKey) {
4326
4410
  const manifestPath = getPluginManifestPath(pluginKey);
4327
- if (!fs13.existsSync(manifestPath)) {
4411
+ if (!fs14.existsSync(manifestPath)) {
4328
4412
  throw new Error(`Plugin not installed: ${pluginKey} (manifest.json not found)`);
4329
4413
  }
4330
4414
  try {
4331
- const content = fs13.readFileSync(manifestPath, "utf-8");
4415
+ const content = fs14.readFileSync(manifestPath, "utf-8");
4332
4416
  return JSON.parse(content);
4333
4417
  } catch (error) {
4334
4418
  if (error instanceof SyntaxError) {
@@ -4345,7 +4429,7 @@ function hasValidParamsSchema(paramsSchema) {
4345
4429
  }
4346
4430
  async function loadPlugin(pluginKey) {
4347
4431
  try {
4348
- const userRequire = createRequire2(path11.join(getProjectRoot2(), "package.json"));
4432
+ const userRequire = createRequire2(path12.join(getProjectRoot2(), "package.json"));
4349
4433
  const resolvedPath = userRequire.resolve(pluginKey);
4350
4434
  const pluginModule = await import(resolvedPath);
4351
4435
  const pluginPackage = pluginModule.default ?? pluginModule;
@@ -4508,8 +4592,8 @@ var capabilityCommandGroup = {
4508
4592
  import { execFile } from "child_process";
4509
4593
 
4510
4594
  // src/commands/component/registry-preparer.ts
4511
- import fs14 from "fs";
4512
- import path12 from "path";
4595
+ import fs15 from "fs";
4596
+ import path13 from "path";
4513
4597
  import os from "os";
4514
4598
 
4515
4599
  // src/commands/component/service.ts
@@ -4565,7 +4649,7 @@ async function sendInstallEvent(key) {
4565
4649
  }
4566
4650
 
4567
4651
  // src/commands/component/registry-preparer.ts
4568
- var REGISTRY_TEMP_DIR = path12.join(os.tmpdir(), "miaoda-registry");
4652
+ var REGISTRY_TEMP_DIR = path13.join(os.tmpdir(), "miaoda-registry");
4569
4653
  function parseComponentKey(key) {
4570
4654
  const match = key.match(/^@([^/]+)\/(.+)$/);
4571
4655
  if (!match) {
@@ -4577,11 +4661,11 @@ function parseComponentKey(key) {
4577
4661
  }
4578
4662
  function getLocalRegistryPath(key) {
4579
4663
  const { scope, name } = parseComponentKey(key);
4580
- return path12.join(REGISTRY_TEMP_DIR, scope, `${name}.json`);
4664
+ return path13.join(REGISTRY_TEMP_DIR, scope, `${name}.json`);
4581
4665
  }
4582
4666
  function ensureDir(dirPath) {
4583
- if (!fs14.existsSync(dirPath)) {
4584
- fs14.mkdirSync(dirPath, { recursive: true });
4667
+ if (!fs15.existsSync(dirPath)) {
4668
+ fs15.mkdirSync(dirPath, { recursive: true });
4585
4669
  }
4586
4670
  }
4587
4671
  async function prepareRecursive(key, visited) {
@@ -4614,8 +4698,8 @@ async function prepareRecursive(key, visited) {
4614
4698
  registryDependencies: deps.map((dep) => getLocalRegistryPath(dep))
4615
4699
  };
4616
4700
  const localPath = getLocalRegistryPath(key);
4617
- ensureDir(path12.dirname(localPath));
4618
- fs14.writeFileSync(localPath, JSON.stringify(rewrittenItem, null, 2), "utf-8");
4701
+ ensureDir(path13.dirname(localPath));
4702
+ fs15.writeFileSync(localPath, JSON.stringify(rewrittenItem, null, 2), "utf-8");
4619
4703
  debug("\u4FDD\u5B58\u5230: %s", localPath);
4620
4704
  }
4621
4705
  async function prepareComponentRegistryItems(id) {
@@ -4625,18 +4709,18 @@ async function prepareComponentRegistryItems(id) {
4625
4709
  }
4626
4710
  function cleanupTempDir() {
4627
4711
  try {
4628
- if (fs14.existsSync(REGISTRY_TEMP_DIR)) {
4629
- fs14.rmSync(REGISTRY_TEMP_DIR, { recursive: true, force: true });
4712
+ if (fs15.existsSync(REGISTRY_TEMP_DIR)) {
4713
+ fs15.rmSync(REGISTRY_TEMP_DIR, { recursive: true, force: true });
4630
4714
  }
4631
4715
  } catch {
4632
4716
  }
4633
4717
  }
4634
4718
  function getDownloadedRegistryItem(itemId) {
4635
4719
  const localPath = getLocalRegistryPath(itemId);
4636
- if (!fs14.existsSync(localPath)) {
4720
+ if (!fs15.existsSync(localPath)) {
4637
4721
  return null;
4638
4722
  }
4639
- const content = fs14.readFileSync(localPath, "utf-8");
4723
+ const content = fs15.readFileSync(localPath, "utf-8");
4640
4724
  return JSON.parse(content);
4641
4725
  }
4642
4726
 
@@ -4804,58 +4888,58 @@ var componentCommandGroup = {
4804
4888
  };
4805
4889
 
4806
4890
  // src/commands/migration/version-manager.ts
4807
- import fs15 from "fs";
4808
- import path13 from "path";
4891
+ import fs16 from "fs";
4892
+ import path14 from "path";
4809
4893
  var PACKAGE_JSON = "package.json";
4810
4894
  var VERSION_FIELD = "migrationVersion";
4811
4895
  function getPackageJsonPath2() {
4812
- return path13.join(process.cwd(), PACKAGE_JSON);
4896
+ return path14.join(process.cwd(), PACKAGE_JSON);
4813
4897
  }
4814
4898
  function getCurrentVersion() {
4815
4899
  const pkgPath = getPackageJsonPath2();
4816
- if (!fs15.existsSync(pkgPath)) {
4900
+ if (!fs16.existsSync(pkgPath)) {
4817
4901
  throw new Error("package.json not found");
4818
4902
  }
4819
- const pkg2 = JSON.parse(fs15.readFileSync(pkgPath, "utf-8"));
4903
+ const pkg2 = JSON.parse(fs16.readFileSync(pkgPath, "utf-8"));
4820
4904
  return pkg2[VERSION_FIELD] ?? 0;
4821
4905
  }
4822
4906
  function setCurrentVersion(version) {
4823
4907
  const pkgPath = getPackageJsonPath2();
4824
- const pkg2 = JSON.parse(fs15.readFileSync(pkgPath, "utf-8"));
4908
+ const pkg2 = JSON.parse(fs16.readFileSync(pkgPath, "utf-8"));
4825
4909
  pkg2[VERSION_FIELD] = version;
4826
- fs15.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
4910
+ fs16.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
4827
4911
  }
4828
4912
 
4829
4913
  // src/commands/migration/versions/v001_capability/json-migrator/detector.ts
4830
- import fs17 from "fs";
4831
- import path15 from "path";
4914
+ import fs18 from "fs";
4915
+ import path16 from "path";
4832
4916
 
4833
4917
  // src/commands/migration/versions/v001_capability/utils.ts
4834
- import fs16 from "fs";
4835
- import path14 from "path";
4918
+ import fs17 from "fs";
4919
+ import path15 from "path";
4836
4920
  var CAPABILITIES_DIR2 = "server/capabilities";
4837
4921
  function getProjectRoot3() {
4838
4922
  return process.cwd();
4839
4923
  }
4840
4924
  function getCapabilitiesDir2() {
4841
- return path14.join(getProjectRoot3(), CAPABILITIES_DIR2);
4925
+ return path15.join(getProjectRoot3(), CAPABILITIES_DIR2);
4842
4926
  }
4843
4927
  function getPluginManifestPath2(pluginKey) {
4844
- return path14.join(getProjectRoot3(), "node_modules", pluginKey, "manifest.json");
4928
+ return path15.join(getProjectRoot3(), "node_modules", pluginKey, "manifest.json");
4845
4929
  }
4846
4930
 
4847
4931
  // src/commands/migration/versions/v001_capability/json-migrator/detector.ts
4848
4932
  function detectJsonMigration() {
4849
4933
  const capabilitiesDir = getCapabilitiesDir2();
4850
- const oldFilePath = path15.join(capabilitiesDir, "capabilities.json");
4851
- if (!fs17.existsSync(oldFilePath)) {
4934
+ const oldFilePath = path16.join(capabilitiesDir, "capabilities.json");
4935
+ if (!fs18.existsSync(oldFilePath)) {
4852
4936
  return {
4853
4937
  needsMigration: false,
4854
4938
  reason: "capabilities.json not found"
4855
4939
  };
4856
4940
  }
4857
4941
  try {
4858
- const content = fs17.readFileSync(oldFilePath, "utf-8");
4942
+ const content = fs18.readFileSync(oldFilePath, "utf-8");
4859
4943
  const parsed = JSON.parse(content);
4860
4944
  if (!Array.isArray(parsed)) {
4861
4945
  return {
@@ -4906,8 +4990,8 @@ async function check(options) {
4906
4990
  }
4907
4991
 
4908
4992
  // src/commands/migration/versions/v001_capability/json-migrator/index.ts
4909
- import fs18 from "fs";
4910
- import path16 from "path";
4993
+ import fs19 from "fs";
4994
+ import path17 from "path";
4911
4995
 
4912
4996
  // src/commands/migration/versions/v001_capability/mapping.ts
4913
4997
  var DEFAULT_PLUGIN_VERSION = "1.0.0";
@@ -5137,18 +5221,18 @@ function transformCapabilities(oldCapabilities) {
5137
5221
  // src/commands/migration/versions/v001_capability/json-migrator/index.ts
5138
5222
  function loadExistingCapabilities() {
5139
5223
  const capabilitiesDir = getCapabilitiesDir2();
5140
- if (!fs18.existsSync(capabilitiesDir)) {
5224
+ if (!fs19.existsSync(capabilitiesDir)) {
5141
5225
  return [];
5142
5226
  }
5143
- const files = fs18.readdirSync(capabilitiesDir);
5227
+ const files = fs19.readdirSync(capabilitiesDir);
5144
5228
  const capabilities = [];
5145
5229
  for (const file of files) {
5146
5230
  if (file === "capabilities.json" || !file.endsWith(".json")) {
5147
5231
  continue;
5148
5232
  }
5149
5233
  try {
5150
- const filePath = path16.join(capabilitiesDir, file);
5151
- const content = fs18.readFileSync(filePath, "utf-8");
5234
+ const filePath = path17.join(capabilitiesDir, file);
5235
+ const content = fs19.readFileSync(filePath, "utf-8");
5152
5236
  const capability = JSON.parse(content);
5153
5237
  if (capability.id && capability.pluginKey) {
5154
5238
  capabilities.push(capability);
@@ -5206,9 +5290,9 @@ async function migrateJsonFiles(options) {
5206
5290
  }
5207
5291
  const capabilitiesDir = getCapabilitiesDir2();
5208
5292
  for (const cap of newCapabilities) {
5209
- const filePath = path16.join(capabilitiesDir, `${cap.id}.json`);
5293
+ const filePath = path17.join(capabilitiesDir, `${cap.id}.json`);
5210
5294
  const content = JSON.stringify(cap, null, 2);
5211
- fs18.writeFileSync(filePath, content, "utf-8");
5295
+ fs19.writeFileSync(filePath, content, "utf-8");
5212
5296
  console.log(` \u2713 Created: ${cap.id}.json`);
5213
5297
  }
5214
5298
  return {
@@ -5220,11 +5304,11 @@ async function migrateJsonFiles(options) {
5220
5304
  }
5221
5305
 
5222
5306
  // src/commands/migration/versions/v001_capability/plugin-installer/detector.ts
5223
- import fs19 from "fs";
5307
+ import fs20 from "fs";
5224
5308
  function isPluginInstalled2(pluginKey) {
5225
5309
  const actionPlugins = readActionPlugins();
5226
5310
  const manifestPath = getPluginManifestPath2(pluginKey);
5227
- return fs19.existsSync(manifestPath) && !!actionPlugins[pluginKey];
5311
+ return fs20.existsSync(manifestPath) && !!actionPlugins[pluginKey];
5228
5312
  }
5229
5313
  function detectPluginsToInstall(capabilities) {
5230
5314
  const pluginKeys = /* @__PURE__ */ new Set();
@@ -5300,12 +5384,12 @@ async function installPlugins(capabilities, options) {
5300
5384
  }
5301
5385
 
5302
5386
  // src/commands/migration/versions/v001_capability/code-migrator/index.ts
5303
- import path18 from "path";
5387
+ import path19 from "path";
5304
5388
  import { Project as Project3 } from "ts-morph";
5305
5389
 
5306
5390
  // src/commands/migration/versions/v001_capability/code-migrator/scanner.ts
5307
- import fs20 from "fs";
5308
- import path17 from "path";
5391
+ import fs21 from "fs";
5392
+ import path18 from "path";
5309
5393
  var EXCLUDED_DIRS = [
5310
5394
  "node_modules",
5311
5395
  "dist",
@@ -5320,9 +5404,9 @@ var EXCLUDED_PATTERNS = [
5320
5404
  /\.d\.ts$/
5321
5405
  ];
5322
5406
  function scanDirectory(dir, files = []) {
5323
- const entries = fs20.readdirSync(dir, { withFileTypes: true });
5407
+ const entries = fs21.readdirSync(dir, { withFileTypes: true });
5324
5408
  for (const entry of entries) {
5325
- const fullPath = path17.join(dir, entry.name);
5409
+ const fullPath = path18.join(dir, entry.name);
5326
5410
  if (entry.isDirectory()) {
5327
5411
  if (EXCLUDED_DIRS.includes(entry.name)) {
5328
5412
  continue;
@@ -5338,14 +5422,14 @@ function scanDirectory(dir, files = []) {
5338
5422
  return files;
5339
5423
  }
5340
5424
  function scanServerFiles() {
5341
- const serverDir = path17.join(getProjectRoot3(), "server");
5342
- if (!fs20.existsSync(serverDir)) {
5425
+ const serverDir = path18.join(getProjectRoot3(), "server");
5426
+ if (!fs21.existsSync(serverDir)) {
5343
5427
  return [];
5344
5428
  }
5345
5429
  return scanDirectory(serverDir);
5346
5430
  }
5347
5431
  function hasCapabilityImport(filePath) {
5348
- const content = fs20.readFileSync(filePath, "utf-8");
5432
+ const content = fs21.readFileSync(filePath, "utf-8");
5349
5433
  return /import\s+.*from\s+['"][^'"]*capabilities[^'"]*['"]/.test(content);
5350
5434
  }
5351
5435
  function scanFilesToMigrate() {
@@ -5722,7 +5806,7 @@ function analyzeFile(project, filePath, actionNameMap) {
5722
5806
  const callSites = analyzeCallSites(sourceFile, imports);
5723
5807
  const classInfo = analyzeClass(sourceFile);
5724
5808
  const { canMigrate, reason } = canAutoMigrate(classInfo);
5725
- const relativePath = path18.relative(getProjectRoot3(), filePath);
5809
+ const relativePath = path19.relative(getProjectRoot3(), filePath);
5726
5810
  return {
5727
5811
  filePath: relativePath,
5728
5812
  imports,
@@ -5733,7 +5817,7 @@ function analyzeFile(project, filePath, actionNameMap) {
5733
5817
  };
5734
5818
  }
5735
5819
  function migrateFile(project, analysis, dryRun) {
5736
- const absolutePath = path18.join(getProjectRoot3(), analysis.filePath);
5820
+ const absolutePath = path19.join(getProjectRoot3(), analysis.filePath);
5737
5821
  if (!analysis.canAutoMigrate) {
5738
5822
  return {
5739
5823
  filePath: analysis.filePath,
@@ -5836,17 +5920,17 @@ function getSuggestion(analysis) {
5836
5920
  }
5837
5921
 
5838
5922
  // src/commands/migration/versions/v001_capability/cleanup.ts
5839
- import fs21 from "fs";
5840
- import path19 from "path";
5923
+ import fs22 from "fs";
5924
+ import path20 from "path";
5841
5925
  function cleanupOldFiles(capabilities, dryRun) {
5842
5926
  const deletedFiles = [];
5843
5927
  const errors = [];
5844
5928
  const capabilitiesDir = getCapabilitiesDir2();
5845
- const oldJsonPath = path19.join(capabilitiesDir, "capabilities.json");
5846
- if (fs21.existsSync(oldJsonPath)) {
5929
+ const oldJsonPath = path20.join(capabilitiesDir, "capabilities.json");
5930
+ if (fs22.existsSync(oldJsonPath)) {
5847
5931
  try {
5848
5932
  if (!dryRun) {
5849
- fs21.unlinkSync(oldJsonPath);
5933
+ fs22.unlinkSync(oldJsonPath);
5850
5934
  }
5851
5935
  deletedFiles.push("capabilities.json");
5852
5936
  } catch (error) {
@@ -5854,11 +5938,11 @@ function cleanupOldFiles(capabilities, dryRun) {
5854
5938
  }
5855
5939
  }
5856
5940
  for (const cap of capabilities) {
5857
- const tsFilePath = path19.join(capabilitiesDir, `${cap.id}.ts`);
5858
- if (fs21.existsSync(tsFilePath)) {
5941
+ const tsFilePath = path20.join(capabilitiesDir, `${cap.id}.ts`);
5942
+ if (fs22.existsSync(tsFilePath)) {
5859
5943
  try {
5860
5944
  if (!dryRun) {
5861
- fs21.unlinkSync(tsFilePath);
5945
+ fs22.unlinkSync(tsFilePath);
5862
5946
  }
5863
5947
  deletedFiles.push(`${cap.id}.ts`);
5864
5948
  } catch (error) {
@@ -5874,8 +5958,8 @@ function cleanupOldFiles(capabilities, dryRun) {
5874
5958
  }
5875
5959
 
5876
5960
  // src/commands/migration/versions/v001_capability/report-generator.ts
5877
- import fs22 from "fs";
5878
- import path20 from "path";
5961
+ import fs23 from "fs";
5962
+ import path21 from "path";
5879
5963
  var REPORT_FILE = "capability-migration-report.md";
5880
5964
  function printSummary(result) {
5881
5965
  const { jsonMigration, pluginInstallation, codeMigration, cleanup } = result;
@@ -6038,15 +6122,15 @@ async function generateReport(result) {
6038
6122
  }
6039
6123
  lines.push("");
6040
6124
  const logDir = process.env.LOG_DIR || "logs";
6041
- if (!fs22.existsSync(logDir)) {
6125
+ if (!fs23.existsSync(logDir)) {
6042
6126
  return;
6043
6127
  }
6044
- const reportDir = path20.join(logDir, "migration");
6045
- if (!fs22.existsSync(reportDir)) {
6046
- fs22.mkdirSync(reportDir, { recursive: true });
6128
+ const reportDir = path21.join(logDir, "migration");
6129
+ if (!fs23.existsSync(reportDir)) {
6130
+ fs23.mkdirSync(reportDir, { recursive: true });
6047
6131
  }
6048
- const reportPath = path20.join(reportDir, REPORT_FILE);
6049
- fs22.writeFileSync(reportPath, lines.join("\n"), "utf-8");
6132
+ const reportPath = path21.join(reportDir, REPORT_FILE);
6133
+ fs23.writeFileSync(reportPath, lines.join("\n"), "utf-8");
6050
6134
  console.log(`\u{1F4C4} Report generated: ${reportPath}`);
6051
6135
  }
6052
6136
 
@@ -6578,10 +6662,10 @@ var migrationCommand = {
6578
6662
  };
6579
6663
 
6580
6664
  // src/commands/read-logs/index.ts
6581
- import path21 from "path";
6665
+ import path22 from "path";
6582
6666
 
6583
6667
  // src/commands/read-logs/std-utils.ts
6584
- import fs23 from "fs";
6668
+ import fs24 from "fs";
6585
6669
  function formatStdPrefixTime(localTime) {
6586
6670
  const match = localTime.match(/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/);
6587
6671
  if (!match) return localTime;
@@ -6611,11 +6695,11 @@ function stripPrefixFromStdLine(line) {
6611
6695
  return `[${time}] ${content}`;
6612
6696
  }
6613
6697
  function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarker) {
6614
- const stat = fs23.statSync(filePath);
6698
+ const stat = fs24.statSync(filePath);
6615
6699
  if (stat.size === 0) {
6616
6700
  return { lines: [], markerFound: false, totalLinesCount: 0 };
6617
6701
  }
6618
- const fd = fs23.openSync(filePath, "r");
6702
+ const fd = fs24.openSync(filePath, "r");
6619
6703
  const chunkSize = 64 * 1024;
6620
6704
  let position = stat.size;
6621
6705
  let remainder = "";
@@ -6629,7 +6713,7 @@ function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarke
6629
6713
  const length = Math.min(chunkSize, position);
6630
6714
  position -= length;
6631
6715
  const buffer = Buffer.alloc(length);
6632
- fs23.readSync(fd, buffer, 0, length, position);
6716
+ fs24.readSync(fd, buffer, 0, length, position);
6633
6717
  let chunk = buffer.toString("utf8");
6634
6718
  if (remainder) {
6635
6719
  chunk += remainder;
@@ -6671,7 +6755,7 @@ function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarke
6671
6755
  }
6672
6756
  }
6673
6757
  } finally {
6674
- fs23.closeSync(fd);
6758
+ fs24.closeSync(fd);
6675
6759
  }
6676
6760
  return { lines: collected.reverse(), markerFound, totalLinesCount };
6677
6761
  }
@@ -6692,21 +6776,21 @@ function readServerStdSegment(filePath, maxLines, offset) {
6692
6776
  }
6693
6777
 
6694
6778
  // src/commands/read-logs/tail.ts
6695
- import fs24 from "fs";
6779
+ import fs25 from "fs";
6696
6780
  function fileExists(filePath) {
6697
6781
  try {
6698
- fs24.accessSync(filePath, fs24.constants.F_OK | fs24.constants.R_OK);
6782
+ fs25.accessSync(filePath, fs25.constants.F_OK | fs25.constants.R_OK);
6699
6783
  return true;
6700
6784
  } catch {
6701
6785
  return false;
6702
6786
  }
6703
6787
  }
6704
6788
  function readFileTailLines(filePath, maxLines) {
6705
- const stat = fs24.statSync(filePath);
6789
+ const stat = fs25.statSync(filePath);
6706
6790
  if (stat.size === 0) {
6707
6791
  return [];
6708
6792
  }
6709
- const fd = fs24.openSync(filePath, "r");
6793
+ const fd = fs25.openSync(filePath, "r");
6710
6794
  const chunkSize = 64 * 1024;
6711
6795
  const chunks = [];
6712
6796
  let position = stat.size;
@@ -6716,13 +6800,13 @@ function readFileTailLines(filePath, maxLines) {
6716
6800
  const length = Math.min(chunkSize, position);
6717
6801
  position -= length;
6718
6802
  const buffer = Buffer.alloc(length);
6719
- fs24.readSync(fd, buffer, 0, length, position);
6803
+ fs25.readSync(fd, buffer, 0, length, position);
6720
6804
  chunks.unshift(buffer.toString("utf8"));
6721
6805
  const chunkLines = buffer.toString("utf8").split("\n").length - 1;
6722
6806
  collectedLines += chunkLines;
6723
6807
  }
6724
6808
  } finally {
6725
- fs24.closeSync(fd);
6809
+ fs25.closeSync(fd);
6726
6810
  }
6727
6811
  const content = chunks.join("");
6728
6812
  const allLines = content.split("\n");
@@ -6738,11 +6822,11 @@ function readFileTailLines(filePath, maxLines) {
6738
6822
  return allLines.slice(allLines.length - maxLines);
6739
6823
  }
6740
6824
  function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
6741
- const stat = fs24.statSync(filePath);
6825
+ const stat = fs25.statSync(filePath);
6742
6826
  if (stat.size === 0) {
6743
6827
  return { lines: [], totalLinesCount: 0 };
6744
6828
  }
6745
- const fd = fs24.openSync(filePath, "r");
6829
+ const fd = fs25.openSync(filePath, "r");
6746
6830
  const chunkSize = 64 * 1024;
6747
6831
  let position = stat.size;
6748
6832
  let remainder = "";
@@ -6754,7 +6838,7 @@ function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
6754
6838
  const length = Math.min(chunkSize, position);
6755
6839
  position -= length;
6756
6840
  const buffer = Buffer.alloc(length);
6757
- fs24.readSync(fd, buffer, 0, length, position);
6841
+ fs25.readSync(fd, buffer, 0, length, position);
6758
6842
  let chunk = buffer.toString("utf8");
6759
6843
  if (remainder) {
6760
6844
  chunk += remainder;
@@ -6785,7 +6869,7 @@ function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
6785
6869
  }
6786
6870
  }
6787
6871
  } finally {
6788
- fs24.closeSync(fd);
6872
+ fs25.closeSync(fd);
6789
6873
  }
6790
6874
  return { lines: collected.reverse(), totalLinesCount };
6791
6875
  }
@@ -6927,7 +7011,7 @@ function readDevStdSegment(filePath, maxLines, offset) {
6927
7011
  }
6928
7012
 
6929
7013
  // src/commands/read-logs/json-lines.ts
6930
- import fs25 from "fs";
7014
+ import fs26 from "fs";
6931
7015
  function normalizePid(value) {
6932
7016
  if (typeof value === "number") {
6933
7017
  return String(value);
@@ -6978,11 +7062,11 @@ function buildWantedLevelSet(levels) {
6978
7062
  return set.size > 0 ? set : null;
6979
7063
  }
6980
7064
  function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
6981
- const stat = fs25.statSync(filePath);
7065
+ const stat = fs26.statSync(filePath);
6982
7066
  if (stat.size === 0) {
6983
7067
  return { lines: [], totalLinesCount: 0 };
6984
7068
  }
6985
- const fd = fs25.openSync(filePath, "r");
7069
+ const fd = fs26.openSync(filePath, "r");
6986
7070
  const chunkSize = 64 * 1024;
6987
7071
  let position = stat.size;
6988
7072
  let remainder = "";
@@ -6997,7 +7081,7 @@ function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
6997
7081
  const length = Math.min(chunkSize, position);
6998
7082
  position -= length;
6999
7083
  const buffer = Buffer.alloc(length);
7000
- fs25.readSync(fd, buffer, 0, length, position);
7084
+ fs26.readSync(fd, buffer, 0, length, position);
7001
7085
  let chunk = buffer.toString("utf8");
7002
7086
  if (remainder) {
7003
7087
  chunk += remainder;
@@ -7059,7 +7143,7 @@ function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
7059
7143
  }
7060
7144
  }
7061
7145
  } finally {
7062
- fs25.closeSync(fd);
7146
+ fs26.closeSync(fd);
7063
7147
  }
7064
7148
  return { lines: collected.reverse(), totalLinesCount };
7065
7149
  }
@@ -7102,11 +7186,11 @@ function extractTraceId(obj) {
7102
7186
  function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
7103
7187
  const wanted = traceId.trim();
7104
7188
  if (!wanted) return { lines: [], totalLinesCount: 0 };
7105
- const stat = fs25.statSync(filePath);
7189
+ const stat = fs26.statSync(filePath);
7106
7190
  if (stat.size === 0) {
7107
7191
  return { lines: [], totalLinesCount: 0 };
7108
7192
  }
7109
- const fd = fs25.openSync(filePath, "r");
7193
+ const fd = fs26.openSync(filePath, "r");
7110
7194
  const chunkSize = 64 * 1024;
7111
7195
  let position = stat.size;
7112
7196
  let remainder = "";
@@ -7119,7 +7203,7 @@ function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
7119
7203
  const length = Math.min(chunkSize, position);
7120
7204
  position -= length;
7121
7205
  const buffer = Buffer.alloc(length);
7122
- fs25.readSync(fd, buffer, 0, length, position);
7206
+ fs26.readSync(fd, buffer, 0, length, position);
7123
7207
  let chunk = buffer.toString("utf8");
7124
7208
  if (remainder) {
7125
7209
  chunk += remainder;
@@ -7172,7 +7256,7 @@ function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
7172
7256
  }
7173
7257
  }
7174
7258
  } finally {
7175
- fs25.closeSync(fd);
7259
+ fs26.closeSync(fd);
7176
7260
  }
7177
7261
  return { lines: collected.reverse(), totalLinesCount };
7178
7262
  }
@@ -7181,11 +7265,11 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
7181
7265
  if (!wantedLevelSet) {
7182
7266
  return { lines: [], totalLinesCount: 0 };
7183
7267
  }
7184
- const stat = fs25.statSync(filePath);
7268
+ const stat = fs26.statSync(filePath);
7185
7269
  if (stat.size === 0) {
7186
7270
  return { lines: [], totalLinesCount: 0 };
7187
7271
  }
7188
- const fd = fs25.openSync(filePath, "r");
7272
+ const fd = fs26.openSync(filePath, "r");
7189
7273
  const chunkSize = 64 * 1024;
7190
7274
  let position = stat.size;
7191
7275
  let remainder = "";
@@ -7197,7 +7281,7 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
7197
7281
  const length = Math.min(chunkSize, position);
7198
7282
  position -= length;
7199
7283
  const buffer = Buffer.alloc(length);
7200
- fs25.readSync(fd, buffer, 0, length, position);
7284
+ fs26.readSync(fd, buffer, 0, length, position);
7201
7285
  let chunk = buffer.toString("utf8");
7202
7286
  if (remainder) {
7203
7287
  chunk += remainder;
@@ -7244,7 +7328,7 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
7244
7328
  }
7245
7329
  }
7246
7330
  } finally {
7247
- fs25.closeSync(fd);
7331
+ fs26.closeSync(fd);
7248
7332
  }
7249
7333
  return { lines: collected.reverse(), totalLinesCount };
7250
7334
  }
@@ -7478,30 +7562,30 @@ async function readLogsJsonResult(options) {
7478
7562
  };
7479
7563
  }
7480
7564
  function resolveLogFilePath(logDir, type) {
7481
- const base = path21.isAbsolute(logDir) ? logDir : path21.join(process.cwd(), logDir);
7565
+ const base = path22.isAbsolute(logDir) ? logDir : path22.join(process.cwd(), logDir);
7482
7566
  if (type === "server") {
7483
- return path21.join(base, "server.log");
7567
+ return path22.join(base, "server.log");
7484
7568
  }
7485
7569
  if (type === "trace") {
7486
- return path21.join(base, "trace.log");
7570
+ return path22.join(base, "trace.log");
7487
7571
  }
7488
7572
  if (type === "server-std") {
7489
- return path21.join(base, "server.std.log");
7573
+ return path22.join(base, "server.std.log");
7490
7574
  }
7491
7575
  if (type === "client-std") {
7492
- return path21.join(base, "client.std.log");
7576
+ return path22.join(base, "client.std.log");
7493
7577
  }
7494
7578
  if (type === "dev") {
7495
- return path21.join(base, "dev.log");
7579
+ return path22.join(base, "dev.log");
7496
7580
  }
7497
7581
  if (type === "dev-std") {
7498
- return path21.join(base, "dev.std.log");
7582
+ return path22.join(base, "dev.std.log");
7499
7583
  }
7500
7584
  if (type === "install-dep-std") {
7501
- return path21.join(base, "install-dep.std.log");
7585
+ return path22.join(base, "install-dep.std.log");
7502
7586
  }
7503
7587
  if (type === "browser") {
7504
- return path21.join(base, "browser.log");
7588
+ return path22.join(base, "browser.log");
7505
7589
  }
7506
7590
  throw new Error(`Unsupported log type: ${type}`);
7507
7591
  }
@@ -7678,9 +7762,9 @@ function camelToKebab(str) {
7678
7762
  }
7679
7763
 
7680
7764
  // src/commands/build/upload-static.handler.ts
7681
- import * as fs26 from "fs";
7765
+ import * as fs27 from "fs";
7682
7766
  import * as os2 from "os";
7683
- import * as path22 from "path";
7767
+ import * as path23 from "path";
7684
7768
  import { execFileSync } from "child_process";
7685
7769
  function readCredentialsFromEnv() {
7686
7770
  const uploadPrefix = process.env.STATIC_UPLOAD_PREFIX;
@@ -7704,8 +7788,8 @@ async function uploadStatic(options) {
7704
7788
  endpoint = UPLOAD_STATIC_DEFAULTS.endpoint,
7705
7789
  region = UPLOAD_STATIC_DEFAULTS.region
7706
7790
  } = options;
7707
- const resolvedStaticDir = path22.resolve(staticDir);
7708
- if (!fs26.existsSync(resolvedStaticDir)) {
7791
+ const resolvedStaticDir = path23.resolve(staticDir);
7792
+ if (!fs27.existsSync(resolvedStaticDir)) {
7709
7793
  console.error(`${LOG_PREFIX} \u76EE\u5F55\u4E0D\u5B58\u5728: ${resolvedStaticDir}\uFF0C\u8DF3\u8FC7\u4E0A\u4F20`);
7710
7794
  return;
7711
7795
  }
@@ -7738,8 +7822,8 @@ async function uploadStatic(options) {
7738
7822
  ({ AccessKeyID: accessKeyID, SecretAccessKey: secretAccessKey, SessionToken: sessionToken } = uploadCredential);
7739
7823
  }
7740
7824
  console.error(`${LOG_PREFIX} \u4E0A\u4F20\u76EE\u6807: ${uploadPrefix}`);
7741
- const confPath = path22.join(os2.tmpdir(), `.tosutilconfig-static-${process.pid}`);
7742
- fs26.writeFileSync(confPath, "");
7825
+ const confPath = path23.join(os2.tmpdir(), `.tosutilconfig-static-${process.pid}`);
7826
+ fs27.writeFileSync(confPath, "");
7743
7827
  try {
7744
7828
  console.error(`${LOG_PREFIX} \u914D\u7F6E tosutil...`);
7745
7829
  configureTosutil(resolvedTosutil, confPath, {
@@ -7753,7 +7837,7 @@ async function uploadStatic(options) {
7753
7837
  uploadToTos(resolvedTosutil, confPath, resolvedStaticDir, uploadPrefix);
7754
7838
  } finally {
7755
7839
  try {
7756
- fs26.unlinkSync(confPath);
7840
+ fs27.unlinkSync(confPath);
7757
7841
  } catch {
7758
7842
  }
7759
7843
  }
@@ -7773,8 +7857,8 @@ async function uploadStatic(options) {
7773
7857
  }
7774
7858
  }
7775
7859
  function resolveTosutilPath(tosutilPath) {
7776
- if (path22.isAbsolute(tosutilPath)) {
7777
- return fs26.existsSync(tosutilPath) ? tosutilPath : null;
7860
+ if (path23.isAbsolute(tosutilPath)) {
7861
+ return fs27.existsSync(tosutilPath) ? tosutilPath : null;
7778
7862
  }
7779
7863
  try {
7780
7864
  const resolved = execFileSync("which", [tosutilPath], { encoding: "utf-8" }).trim();
@@ -7819,7 +7903,7 @@ async function resolveBucketId(appId) {
7819
7903
  return bucketId;
7820
7904
  }
7821
7905
  function isDirEmpty(dirPath) {
7822
- const entries = fs26.readdirSync(dirPath);
7906
+ const entries = fs27.readdirSync(dirPath);
7823
7907
  return entries.length === 0;
7824
7908
  }
7825
7909
 
@@ -7914,12 +7998,12 @@ var commands = [
7914
7998
  ];
7915
7999
 
7916
8000
  // src/index.ts
7917
- var envPath = path23.join(process.cwd(), ".env");
7918
- if (fs27.existsSync(envPath)) {
8001
+ var envPath = path24.join(process.cwd(), ".env");
8002
+ if (fs28.existsSync(envPath)) {
7919
8003
  dotenvConfig({ path: envPath });
7920
8004
  }
7921
- var __dirname = path23.dirname(fileURLToPath5(import.meta.url));
7922
- var pkg = JSON.parse(fs27.readFileSync(path23.join(__dirname, "../package.json"), "utf-8"));
8005
+ var __dirname = path24.dirname(fileURLToPath5(import.meta.url));
8006
+ var pkg = JSON.parse(fs28.readFileSync(path24.join(__dirname, "../package.json"), "utf-8"));
7923
8007
  var cli = new FullstackCLI(pkg.version);
7924
8008
  cli.useAll(commands);
7925
8009
  cli.run();