@lark-apaas/fullstack-cli 1.1.38 → 1.1.40-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/index.ts
2
- import fs26 from "fs";
3
- import path22 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
 
@@ -2438,13 +2438,6 @@ var syncConfig = {
2438
2438
  to: ".spark_project",
2439
2439
  type: "file",
2440
2440
  overwrite: true
2441
- },
2442
- // 9. 确保 tsconfig.app.json 排除 shared/static 目录(避免 TSC 严格校验 JSON 导致编译失败)
2443
- {
2444
- type: "ensure-json-array-item",
2445
- to: "tsconfig.app.json",
2446
- jsonPath: "exclude",
2447
- items: ["shared/static"]
2448
2441
  }
2449
2442
  ],
2450
2443
  // 文件权限设置
@@ -2699,11 +2692,6 @@ async function syncRule(rule, pluginRoot, userProjectRoot) {
2699
2692
  mergeJsonFile(srcPath2, destPath2, rule.arrayMerge);
2700
2693
  return;
2701
2694
  }
2702
- if (rule.type === "ensure-json-array-item") {
2703
- const destPath2 = path5.join(userProjectRoot, rule.to);
2704
- ensureJsonArrayItem(destPath2, rule.jsonPath, rule.items);
2705
- return;
2706
- }
2707
2695
  if (!("from" in rule)) {
2708
2696
  return;
2709
2697
  }
@@ -2846,41 +2834,6 @@ function addLineToFile(filePath, line) {
2846
2834
  fs7.appendFileSync(filePath, appendContent);
2847
2835
  console.log(`[fullstack-cli] \u2713 ${fileName} (added: ${line})`);
2848
2836
  }
2849
- function ensureJsonArrayItem(filePath, jsonPath, items) {
2850
- const fileName = path5.basename(filePath);
2851
- if (!fs7.existsSync(filePath)) {
2852
- console.log(`[fullstack-cli] \u25CB ${fileName} (not found, skipped)`);
2853
- return;
2854
- }
2855
- const content = JSON.parse(fs7.readFileSync(filePath, "utf-8"));
2856
- const parts = jsonPath.split(".");
2857
- let current = content;
2858
- for (let i = 0; i < parts.length - 1; i++) {
2859
- const part = parts[i];
2860
- if (current[part] == null || typeof current[part] !== "object") {
2861
- current[part] = {};
2862
- }
2863
- current = current[part];
2864
- }
2865
- const lastKey = parts[parts.length - 1];
2866
- if (!Array.isArray(current[lastKey])) {
2867
- current[lastKey] = [];
2868
- }
2869
- const arr = current[lastKey];
2870
- const added = [];
2871
- for (const item of items) {
2872
- if (!arr.includes(item)) {
2873
- arr.push(item);
2874
- added.push(item);
2875
- }
2876
- }
2877
- if (added.length === 0) {
2878
- console.log(`[fullstack-cli] \u25CB ${fileName} ${jsonPath} (already contains all items)`);
2879
- return;
2880
- }
2881
- fs7.writeFileSync(filePath, JSON.stringify(content, null, 2) + "\n");
2882
- console.log(`[fullstack-cli] \u2713 ${fileName} ${jsonPath} (added: ${added.join(", ")})`);
2883
- }
2884
2837
  function mergeJsonFile(src, dest, arrayMerge) {
2885
2838
  const fileName = path5.basename(dest);
2886
2839
  if (!fs7.existsSync(src)) {
@@ -3152,6 +3105,309 @@ async function run3(options = {}) {
3152
3105
 
3153
3106
  // src/commands/upgrade/deps/run.handler.ts
3154
3107
  import { spawnSync as spawnSync3 } from "child_process";
3108
+
3109
+ // src/utils/grayscale/cache.ts
3110
+ import fs10 from "fs";
3111
+ import path8 from "path";
3112
+ import os from "os";
3113
+ var CACHE_PATH = path8.join(os.homedir(), ".fullstack", "grayscale-cache.json");
3114
+ var NORMAL_TTL_MS = 30 * 60 * 1e3;
3115
+ var FALLBACK_TTL_MS = 24 * 60 * 60 * 1e3;
3116
+ function readLocalCache(fallback = false) {
3117
+ try {
3118
+ if (!fs10.existsSync(CACHE_PATH)) {
3119
+ return null;
3120
+ }
3121
+ const content = fs10.readFileSync(CACHE_PATH, "utf-8");
3122
+ const entry = JSON.parse(content);
3123
+ if (!entry.config || !entry.timestamp) {
3124
+ return null;
3125
+ }
3126
+ const ttl = fallback ? FALLBACK_TTL_MS : NORMAL_TTL_MS;
3127
+ const age = Date.now() - entry.timestamp;
3128
+ if (age > ttl) {
3129
+ return null;
3130
+ }
3131
+ return entry.config;
3132
+ } catch {
3133
+ return null;
3134
+ }
3135
+ }
3136
+ function writeLocalCache(config) {
3137
+ try {
3138
+ const dir = path8.dirname(CACHE_PATH);
3139
+ if (!fs10.existsSync(dir)) {
3140
+ fs10.mkdirSync(dir, { recursive: true });
3141
+ }
3142
+ const entry = {
3143
+ config,
3144
+ timestamp: Date.now()
3145
+ };
3146
+ fs10.writeFileSync(CACHE_PATH, JSON.stringify(entry, null, 2), "utf-8");
3147
+ } catch {
3148
+ }
3149
+ }
3150
+
3151
+ // src/utils/grayscale/config.ts
3152
+ var memoryCache = null;
3153
+ var MEMORY_TTL_MS = 60 * 1e3;
3154
+ var API_TIMEOUT_MS = 3e3;
3155
+ async function fetchFromApi() {
3156
+ try {
3157
+ const client = getHttpClient();
3158
+ const controller = new AbortController();
3159
+ const timer = setTimeout(() => controller.abort(), API_TIMEOUT_MS);
3160
+ try {
3161
+ const response = await client.post(
3162
+ "/api/v1/studio/innerapi/get_grayscale_config",
3163
+ {},
3164
+ { signal: controller.signal }
3165
+ );
3166
+ if (!response.ok) {
3167
+ console.warn(`[grayscale] API request failed: ${response.status} ${response.statusText}`);
3168
+ return null;
3169
+ }
3170
+ const result = await response.json();
3171
+ if (result.status_code !== "0") {
3172
+ console.warn(`[grayscale] API error: ${result.message}`);
3173
+ return null;
3174
+ }
3175
+ return result.data?.config ?? null;
3176
+ } finally {
3177
+ clearTimeout(timer);
3178
+ }
3179
+ } catch (error) {
3180
+ const message = error instanceof Error ? error.message : String(error);
3181
+ console.warn(`[grayscale] Failed to fetch config from API: ${message}`);
3182
+ return null;
3183
+ }
3184
+ }
3185
+ async function getGrayscaleConfig() {
3186
+ if (memoryCache) {
3187
+ const age = Date.now() - memoryCache.timestamp;
3188
+ if (age <= MEMORY_TTL_MS) {
3189
+ return memoryCache.config;
3190
+ }
3191
+ memoryCache = null;
3192
+ }
3193
+ const localNormal = readLocalCache(false);
3194
+ if (localNormal) {
3195
+ memoryCache = { config: localNormal, timestamp: Date.now() };
3196
+ return localNormal;
3197
+ }
3198
+ const apiConfig = await fetchFromApi();
3199
+ if (apiConfig) {
3200
+ memoryCache = { config: apiConfig, timestamp: Date.now() };
3201
+ writeLocalCache(apiConfig);
3202
+ return apiConfig;
3203
+ }
3204
+ const localFallback = readLocalCache(true);
3205
+ if (localFallback) {
3206
+ memoryCache = { config: localFallback, timestamp: Date.now() };
3207
+ return localFallback;
3208
+ }
3209
+ return null;
3210
+ }
3211
+
3212
+ // src/utils/grayscale/identity.ts
3213
+ import fs11 from "fs";
3214
+ import path9 from "path";
3215
+ function readFromEnvVars() {
3216
+ const appId = process.env.app_id || process.env.APP_ID;
3217
+ const tenantId = process.env.tenant_id || process.env.TENANT_ID;
3218
+ return { appId, tenantId };
3219
+ }
3220
+ function parseEnvFile(filePath) {
3221
+ const result = {};
3222
+ if (!fs11.existsSync(filePath)) {
3223
+ return result;
3224
+ }
3225
+ try {
3226
+ const content = fs11.readFileSync(filePath, "utf-8");
3227
+ const lines = content.split("\n");
3228
+ for (const line of lines) {
3229
+ const trimmed = line.trim();
3230
+ if (!trimmed || trimmed.startsWith("#")) {
3231
+ continue;
3232
+ }
3233
+ const match = trimmed.match(/^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=["']?(.+?)["']?$/);
3234
+ if (match) {
3235
+ result[match[1]] = match[2];
3236
+ }
3237
+ }
3238
+ } catch {
3239
+ }
3240
+ return result;
3241
+ }
3242
+ function readFromForceEnvFile(cwd) {
3243
+ const envPath2 = path9.join(cwd, ".force", "environment", "env");
3244
+ const vars = parseEnvFile(envPath2);
3245
+ return {
3246
+ appId: vars.app_id || vars.APP_ID,
3247
+ tenantId: vars.tenant_id || vars.TENANT_ID
3248
+ };
3249
+ }
3250
+ function readFromClientBasePath() {
3251
+ const basePath = process.env.CLIENT_BASE_PATH;
3252
+ if (!basePath) {
3253
+ return {};
3254
+ }
3255
+ const afMatch = basePath.match(/\/af\/p\/([^/]+)/);
3256
+ if (afMatch) {
3257
+ return { appId: afMatch[1] };
3258
+ }
3259
+ const appMatch = basePath.match(/\/app\/([^/]+)/);
3260
+ if (appMatch) {
3261
+ return { appId: appMatch[1] };
3262
+ }
3263
+ return {};
3264
+ }
3265
+ function readFromDotEnv(cwd) {
3266
+ const envPath2 = path9.join(cwd, ".env");
3267
+ const vars = parseEnvFile(envPath2);
3268
+ return {
3269
+ appId: vars.app_id || vars.APP_ID,
3270
+ tenantId: vars.tenant_id || vars.TENANT_ID
3271
+ };
3272
+ }
3273
+ function readFromPackageJson(cwd) {
3274
+ const pkgPath = path9.join(cwd, "package.json");
3275
+ if (!fs11.existsSync(pkgPath)) {
3276
+ return {};
3277
+ }
3278
+ try {
3279
+ const content = fs11.readFileSync(pkgPath, "utf-8");
3280
+ const pkg2 = JSON.parse(content);
3281
+ const appId = pkg2?.fullstack?.appId;
3282
+ return appId ? { appId } : {};
3283
+ } catch {
3284
+ return {};
3285
+ }
3286
+ }
3287
+ function readProjectIdentity(cwd) {
3288
+ const sources = [
3289
+ () => readFromEnvVars(),
3290
+ () => readFromForceEnvFile(cwd),
3291
+ () => readFromClientBasePath(),
3292
+ () => readFromDotEnv(cwd),
3293
+ () => readFromPackageJson(cwd)
3294
+ ];
3295
+ const merged = {};
3296
+ for (const source of sources) {
3297
+ const identity = source();
3298
+ if (!merged.appId && identity.appId) {
3299
+ merged.appId = identity.appId;
3300
+ }
3301
+ if (!merged.tenantId && identity.tenantId) {
3302
+ merged.tenantId = identity.tenantId;
3303
+ }
3304
+ if (merged.appId && merged.tenantId) {
3305
+ break;
3306
+ }
3307
+ }
3308
+ return merged;
3309
+ }
3310
+
3311
+ // src/utils/grayscale/rules.ts
3312
+ import { createHash } from "crypto";
3313
+ function isInPercentage(key, percentage) {
3314
+ if (percentage <= 0) return false;
3315
+ if (percentage >= 100) return true;
3316
+ const hash = createHash("md5").update(`grayscale:${key}`).digest("hex");
3317
+ const value = parseInt(hash.substring(0, 8), 16) % 1e4;
3318
+ const threshold = Math.floor(percentage * 100);
3319
+ return value < threshold;
3320
+ }
3321
+ function matchConditions(rule, identity) {
3322
+ const { conditions } = rule;
3323
+ if (conditions.tenant_ids && conditions.tenant_ids.length > 0) {
3324
+ if (identity.tenantId && conditions.tenant_ids.includes(identity.tenantId)) {
3325
+ return true;
3326
+ }
3327
+ }
3328
+ if (conditions.app_ids && conditions.app_ids.length > 0) {
3329
+ if (identity.appId && conditions.app_ids.includes(identity.appId)) {
3330
+ return true;
3331
+ }
3332
+ }
3333
+ if (conditions.percentage != null && conditions.percentage > 0) {
3334
+ const hashKey = conditions.hash_key || "app_id";
3335
+ const hashValue = hashKey === "tenant_id" ? identity.tenantId : identity.appId;
3336
+ if (hashValue && isInPercentage(hashValue, conditions.percentage)) {
3337
+ return true;
3338
+ }
3339
+ }
3340
+ const hasConditions = conditions.tenant_ids && conditions.tenant_ids.length > 0 || conditions.app_ids && conditions.app_ids.length > 0 || conditions.percentage != null && conditions.percentage > 0;
3341
+ return !hasConditions;
3342
+ }
3343
+ function evaluateRules(config, identity) {
3344
+ const enabledRules = config.rules.filter((rule) => rule.enabled).sort((a, b) => b.priority - a.priority);
3345
+ for (const rule of enabledRules) {
3346
+ if (matchConditions(rule, identity)) {
3347
+ return rule;
3348
+ }
3349
+ }
3350
+ return null;
3351
+ }
3352
+ function resolveTargetVersions(config, identity) {
3353
+ const matchedRule = evaluateRules(config, identity);
3354
+ const channelName = matchedRule?.channel || config.default_channel;
3355
+ const channel = config.channels[channelName];
3356
+ if (!channel) {
3357
+ console.warn(`[grayscale] Channel "${channelName}" not found in config`);
3358
+ return null;
3359
+ }
3360
+ const versions = /* @__PURE__ */ new Map();
3361
+ for (const [pkgName, version] of Object.entries(channel.versions)) {
3362
+ if (config.blocked_versions?.includes(version)) {
3363
+ console.warn(`[grayscale] Version ${version} of ${pkgName} is blocked, skipping`);
3364
+ continue;
3365
+ }
3366
+ versions.set(pkgName, version);
3367
+ }
3368
+ if (config.force_versions) {
3369
+ for (const [pkgName, version] of Object.entries(config.force_versions)) {
3370
+ versions.set(pkgName, version);
3371
+ }
3372
+ }
3373
+ if (matchedRule) {
3374
+ console.log(`[grayscale] Matched rule: "${matchedRule.name}" (id: ${matchedRule.id}), channel: ${channelName}`);
3375
+ } else {
3376
+ console.log(`[grayscale] No rule matched, using default channel: ${channelName}`);
3377
+ }
3378
+ return versions;
3379
+ }
3380
+
3381
+ // src/utils/grayscale/index.ts
3382
+ async function resolveGrayscaleVersions(cwd) {
3383
+ const config = await getGrayscaleConfig();
3384
+ if (!config) {
3385
+ console.log("[grayscale] Config not available, skipping grayscale");
3386
+ return null;
3387
+ }
3388
+ if (!config.enabled) {
3389
+ console.log("[grayscale] Grayscale is disabled");
3390
+ return null;
3391
+ }
3392
+ const identity = readProjectIdentity(cwd);
3393
+ if (!identity.appId && !identity.tenantId) {
3394
+ console.log("[grayscale] No app_id or tenant_id found, skipping grayscale");
3395
+ return null;
3396
+ }
3397
+ console.log(`[grayscale] Project identity: appId=${identity.appId || "N/A"}, tenantId=${identity.tenantId || "N/A"}`);
3398
+ const versions = resolveTargetVersions(config, identity);
3399
+ if (!versions || versions.size === 0) {
3400
+ console.log("[grayscale] No target versions resolved");
3401
+ return null;
3402
+ }
3403
+ console.log(`[grayscale] Resolved ${versions.size} package version(s):`);
3404
+ for (const [pkg2, ver] of versions) {
3405
+ console.log(`[grayscale] ${pkg2} -> ${ver}`);
3406
+ }
3407
+ return versions;
3408
+ }
3409
+
3410
+ // src/commands/upgrade/deps/run.handler.ts
3155
3411
  function findLarkAapaasPackages(cwd, filterPackages) {
3156
3412
  const pkg2 = readPackageJson(cwd);
3157
3413
  const allPackages = /* @__PURE__ */ new Set();
@@ -3204,11 +3460,43 @@ function upgradePackages(packages, version, cwd) {
3204
3460
  });
3205
3461
  }
3206
3462
  }
3463
+ function installGrayscaleVersions(packages, grayscaleVersions, cwd, dryRun) {
3464
+ const upgradePlan = [];
3465
+ for (const pkg2 of packages) {
3466
+ const version = grayscaleVersions.get(pkg2);
3467
+ if (version) {
3468
+ upgradePlan.push({ pkg: pkg2, version });
3469
+ }
3470
+ }
3471
+ if (upgradePlan.length === 0) {
3472
+ console.log("[fullstack-cli] No grayscale versions matched current packages");
3473
+ return;
3474
+ }
3475
+ console.log(`[fullstack-cli] Grayscale upgrade plan (${upgradePlan.length} package(s)):`);
3476
+ upgradePlan.forEach(({ pkg: pkg2, version }) => {
3477
+ console.log(` - ${pkg2} -> ${version}`);
3478
+ });
3479
+ if (dryRun) {
3480
+ console.log("[fullstack-cli] Dry run mode, skipping actual installation");
3481
+ return;
3482
+ }
3483
+ for (const { pkg: pkg2, version } of upgradePlan) {
3484
+ const target = `${pkg2}@${version}`;
3485
+ console.log(`[fullstack-cli] Installing ${target}...`);
3486
+ const result = spawnSync3("npm", ["install", target], {
3487
+ cwd,
3488
+ stdio: "inherit"
3489
+ });
3490
+ if (result.error || result.status !== 0) {
3491
+ throw new Error(`Failed to install ${target}`);
3492
+ }
3493
+ }
3494
+ }
3207
3495
  async function run4(options = {}) {
3208
3496
  const cwd = process.env.INIT_CWD || process.cwd();
3209
3497
  console.log("[fullstack-cli] Starting dependencies upgrade...");
3210
3498
  try {
3211
- console.log("[fullstack-cli] Step 1/2: Scanning @lark-apaas dependencies...");
3499
+ console.log("[fullstack-cli] Step 1/3: Scanning @lark-apaas dependencies...");
3212
3500
  const packages = findLarkAapaasPackages(cwd, options.packages);
3213
3501
  if (packages.length === 0) {
3214
3502
  console.log("[fullstack-cli] No @lark-apaas packages found");
@@ -3216,7 +3504,35 @@ async function run4(options = {}) {
3216
3504
  }
3217
3505
  console.log(`[fullstack-cli] Found ${packages.length} @lark-apaas package(s):`);
3218
3506
  packages.forEach((p) => console.log(` - ${p}`));
3219
- console.log("[fullstack-cli] Step 2/2: Upgrading packages...");
3507
+ if (!options.skipGrayscale && !options.version) {
3508
+ console.log("[fullstack-cli] Step 2/3: Checking grayscale config...");
3509
+ try {
3510
+ const grayscaleVersions = await resolveGrayscaleVersions(cwd);
3511
+ if (grayscaleVersions) {
3512
+ console.log("[fullstack-cli] Step 3/3: Applying grayscale versions...");
3513
+ installGrayscaleVersions(packages, grayscaleVersions, cwd, !!options.dryRun);
3514
+ if (!options.dryRun) {
3515
+ console.log(`[fullstack-cli] \u2713 Successfully upgraded ${packages.length} package(s) via grayscale`);
3516
+ console.log("[fullstack-cli] Dependencies upgrade completed successfully \u2705");
3517
+ }
3518
+ return;
3519
+ }
3520
+ console.log("[fullstack-cli] Grayscale not available, falling back to default upgrade");
3521
+ } catch (error) {
3522
+ const msg = error instanceof Error ? error.message : String(error);
3523
+ console.warn(`[fullstack-cli] Grayscale check failed: ${msg}, falling back to default upgrade`);
3524
+ }
3525
+ } else if (options.skipGrayscale) {
3526
+ console.log("[fullstack-cli] Step 2/3: Skipping grayscale check (--skip-grayscale)");
3527
+ } else {
3528
+ console.log("[fullstack-cli] Step 2/3: Skipping grayscale check (explicit --version provided)");
3529
+ }
3530
+ if (options.dryRun) {
3531
+ console.log("[fullstack-cli] Dry run mode: would upgrade via npm update (no grayscale)");
3532
+ packages.forEach((p) => console.log(` - ${p} -> ${options.version || "latest compatible"}`));
3533
+ return;
3534
+ }
3535
+ console.log("[fullstack-cli] Step 3/3: Upgrading packages...");
3220
3536
  upgradePackages(packages, options.version, cwd);
3221
3537
  console.log(`[fullstack-cli] \u2713 Successfully upgraded ${packages.length} package(s)`);
3222
3538
  console.log("[fullstack-cli] Dependencies upgrade completed successfully \u2705");
@@ -3232,7 +3548,7 @@ var depsCommand = {
3232
3548
  name: "deps",
3233
3549
  description: "Upgrade @lark-apaas dependencies",
3234
3550
  register(parentCommand) {
3235
- parentCommand.command(this.name).description(this.description).option("--version <version>", "Upgrade to specific version").option("--packages <packages>", "Only upgrade specific packages (comma-separated)").action(async (options) => {
3551
+ 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("--dry-run", "Show upgrade plan without executing").action(async (options) => {
3236
3552
  await run4(options);
3237
3553
  });
3238
3554
  }
@@ -3251,8 +3567,8 @@ var upgradeCommand = {
3251
3567
  };
3252
3568
 
3253
3569
  // src/commands/action-plugin/utils.ts
3254
- import fs10 from "fs";
3255
- import path8 from "path";
3570
+ import fs12 from "fs";
3571
+ import path10 from "path";
3256
3572
  import { spawnSync as spawnSync4, execSync as execSync2 } from "child_process";
3257
3573
  function parsePluginName(input) {
3258
3574
  const match = input.match(/^(@[^/]+\/[^@]+)(?:@(.+))?$/);
@@ -3270,18 +3586,18 @@ function getProjectRoot() {
3270
3586
  return process.cwd();
3271
3587
  }
3272
3588
  function getPackageJsonPath() {
3273
- return path8.join(getProjectRoot(), "package.json");
3589
+ return path10.join(getProjectRoot(), "package.json");
3274
3590
  }
3275
3591
  function getPluginPath(pluginName) {
3276
- return path8.join(getProjectRoot(), "node_modules", pluginName);
3592
+ return path10.join(getProjectRoot(), "node_modules", pluginName);
3277
3593
  }
3278
3594
  function readPackageJson2() {
3279
3595
  const pkgPath = getPackageJsonPath();
3280
- if (!fs10.existsSync(pkgPath)) {
3596
+ if (!fs12.existsSync(pkgPath)) {
3281
3597
  throw new Error("package.json not found in current directory");
3282
3598
  }
3283
3599
  try {
3284
- const content = fs10.readFileSync(pkgPath, "utf-8");
3600
+ const content = fs12.readFileSync(pkgPath, "utf-8");
3285
3601
  return JSON.parse(content);
3286
3602
  } catch {
3287
3603
  throw new Error("Failed to parse package.json");
@@ -3289,7 +3605,7 @@ function readPackageJson2() {
3289
3605
  }
3290
3606
  function writePackageJson2(pkg2) {
3291
3607
  const pkgPath = getPackageJsonPath();
3292
- fs10.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
3608
+ fs12.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
3293
3609
  }
3294
3610
  function readActionPlugins() {
3295
3611
  const pkg2 = readPackageJson2();
@@ -3322,12 +3638,12 @@ function npmInstall(tgzPath) {
3322
3638
  }
3323
3639
  }
3324
3640
  function getPackageVersion(pluginName) {
3325
- const pkgJsonPath = path8.join(getPluginPath(pluginName), "package.json");
3326
- if (!fs10.existsSync(pkgJsonPath)) {
3641
+ const pkgJsonPath = path10.join(getPluginPath(pluginName), "package.json");
3642
+ if (!fs12.existsSync(pkgJsonPath)) {
3327
3643
  return null;
3328
3644
  }
3329
3645
  try {
3330
- const content = fs10.readFileSync(pkgJsonPath, "utf-8");
3646
+ const content = fs12.readFileSync(pkgJsonPath, "utf-8");
3331
3647
  const pkg2 = JSON.parse(content);
3332
3648
  return pkg2.version || null;
3333
3649
  } catch {
@@ -3335,49 +3651,49 @@ function getPackageVersion(pluginName) {
3335
3651
  }
3336
3652
  }
3337
3653
  function readPluginPackageJson(pluginPath) {
3338
- const pkgJsonPath = path8.join(pluginPath, "package.json");
3339
- if (!fs10.existsSync(pkgJsonPath)) {
3654
+ const pkgJsonPath = path10.join(pluginPath, "package.json");
3655
+ if (!fs12.existsSync(pkgJsonPath)) {
3340
3656
  return null;
3341
3657
  }
3342
3658
  try {
3343
- const content = fs10.readFileSync(pkgJsonPath, "utf-8");
3659
+ const content = fs12.readFileSync(pkgJsonPath, "utf-8");
3344
3660
  return JSON.parse(content);
3345
3661
  } catch {
3346
3662
  return null;
3347
3663
  }
3348
3664
  }
3349
3665
  function extractTgzToNodeModules(tgzPath, pluginName) {
3350
- const nodeModulesPath = path8.join(getProjectRoot(), "node_modules");
3351
- const targetDir = path8.join(nodeModulesPath, pluginName);
3352
- const scopeDir = path8.dirname(targetDir);
3353
- if (!fs10.existsSync(scopeDir)) {
3354
- fs10.mkdirSync(scopeDir, { recursive: true });
3666
+ const nodeModulesPath = path10.join(getProjectRoot(), "node_modules");
3667
+ const targetDir = path10.join(nodeModulesPath, pluginName);
3668
+ const scopeDir = path10.dirname(targetDir);
3669
+ if (!fs12.existsSync(scopeDir)) {
3670
+ fs12.mkdirSync(scopeDir, { recursive: true });
3355
3671
  }
3356
- if (fs10.existsSync(targetDir)) {
3357
- fs10.rmSync(targetDir, { recursive: true });
3672
+ if (fs12.existsSync(targetDir)) {
3673
+ fs12.rmSync(targetDir, { recursive: true });
3358
3674
  }
3359
- const tempDir = path8.join(nodeModulesPath, ".cache", "fullstack-cli", "extract-temp");
3360
- if (fs10.existsSync(tempDir)) {
3361
- fs10.rmSync(tempDir, { recursive: true });
3675
+ const tempDir = path10.join(nodeModulesPath, ".cache", "fullstack-cli", "extract-temp");
3676
+ if (fs12.existsSync(tempDir)) {
3677
+ fs12.rmSync(tempDir, { recursive: true });
3362
3678
  }
3363
- fs10.mkdirSync(tempDir, { recursive: true });
3679
+ fs12.mkdirSync(tempDir, { recursive: true });
3364
3680
  try {
3365
3681
  execSync2(`tar -xzf "${tgzPath}" -C "${tempDir}"`, { stdio: "pipe" });
3366
- const extractedDir = path8.join(tempDir, "package");
3367
- if (fs10.existsSync(extractedDir)) {
3368
- fs10.renameSync(extractedDir, targetDir);
3682
+ const extractedDir = path10.join(tempDir, "package");
3683
+ if (fs12.existsSync(extractedDir)) {
3684
+ fs12.renameSync(extractedDir, targetDir);
3369
3685
  } else {
3370
- const files = fs10.readdirSync(tempDir);
3686
+ const files = fs12.readdirSync(tempDir);
3371
3687
  if (files.length === 1) {
3372
- fs10.renameSync(path8.join(tempDir, files[0]), targetDir);
3688
+ fs12.renameSync(path10.join(tempDir, files[0]), targetDir);
3373
3689
  } else {
3374
3690
  throw new Error("Unexpected tgz structure");
3375
3691
  }
3376
3692
  }
3377
3693
  return targetDir;
3378
3694
  } finally {
3379
- if (fs10.existsSync(tempDir)) {
3380
- fs10.rmSync(tempDir, { recursive: true });
3695
+ if (fs12.existsSync(tempDir)) {
3696
+ fs12.rmSync(tempDir, { recursive: true });
3381
3697
  }
3382
3698
  }
3383
3699
  }
@@ -3386,10 +3702,10 @@ function checkMissingPeerDeps(peerDeps) {
3386
3702
  return [];
3387
3703
  }
3388
3704
  const missing = [];
3389
- const nodeModulesPath = path8.join(getProjectRoot(), "node_modules");
3705
+ const nodeModulesPath = path10.join(getProjectRoot(), "node_modules");
3390
3706
  for (const [depName, _version] of Object.entries(peerDeps)) {
3391
- const depPath = path8.join(nodeModulesPath, depName);
3392
- if (!fs10.existsSync(depPath)) {
3707
+ const depPath = path10.join(nodeModulesPath, depName);
3708
+ if (!fs12.existsSync(depPath)) {
3393
3709
  missing.push(depName);
3394
3710
  }
3395
3711
  }
@@ -3413,16 +3729,16 @@ function installMissingDeps(deps) {
3413
3729
  }
3414
3730
  function removePluginDirectory(pluginName) {
3415
3731
  const pluginPath = getPluginPath(pluginName);
3416
- if (fs10.existsSync(pluginPath)) {
3417
- fs10.rmSync(pluginPath, { recursive: true });
3732
+ if (fs12.existsSync(pluginPath)) {
3733
+ fs12.rmSync(pluginPath, { recursive: true });
3418
3734
  console.log(`[action-plugin] Removed ${pluginName}`);
3419
3735
  }
3420
3736
  }
3421
3737
 
3422
3738
  // src/commands/action-plugin/api-client.ts
3423
3739
  import { HttpClient as HttpClient2 } from "@lark-apaas/http-client";
3424
- import fs11 from "fs";
3425
- import path9 from "path";
3740
+ import fs13 from "fs";
3741
+ import path11 from "path";
3426
3742
  var PLUGIN_CACHE_DIR = "node_modules/.cache/fullstack-cli/plugins";
3427
3743
  async function getPluginVersions(keys, latestOnly = true) {
3428
3744
  const client = getHttpClient();
@@ -3486,19 +3802,19 @@ async function downloadFromPublic(downloadURL) {
3486
3802
  return Buffer.from(arrayBuffer);
3487
3803
  }
3488
3804
  function getPluginCacheDir() {
3489
- return path9.join(process.cwd(), PLUGIN_CACHE_DIR);
3805
+ return path11.join(process.cwd(), PLUGIN_CACHE_DIR);
3490
3806
  }
3491
3807
  function ensureCacheDir() {
3492
3808
  const cacheDir = getPluginCacheDir();
3493
- if (!fs11.existsSync(cacheDir)) {
3494
- fs11.mkdirSync(cacheDir, { recursive: true });
3809
+ if (!fs13.existsSync(cacheDir)) {
3810
+ fs13.mkdirSync(cacheDir, { recursive: true });
3495
3811
  }
3496
3812
  }
3497
3813
  function getTempFilePath(pluginKey, version) {
3498
3814
  ensureCacheDir();
3499
3815
  const safeKey = pluginKey.replace(/[/@]/g, "_");
3500
3816
  const filename = `${safeKey}@${version}.tgz`;
3501
- return path9.join(getPluginCacheDir(), filename);
3817
+ return path11.join(getPluginCacheDir(), filename);
3502
3818
  }
3503
3819
  var MAX_RETRIES = 2;
3504
3820
  async function withRetry(operation, description, maxRetries = MAX_RETRIES) {
@@ -3535,7 +3851,7 @@ async function downloadPlugin(pluginKey, requestedVersion) {
3535
3851
  );
3536
3852
  }
3537
3853
  const tgzPath = getTempFilePath(pluginKey, pluginInfo.version);
3538
- fs11.writeFileSync(tgzPath, tgzBuffer);
3854
+ fs13.writeFileSync(tgzPath, tgzBuffer);
3539
3855
  console.log(`[action-plugin] Downloaded to ${tgzPath} (${(tgzBuffer.length / 1024).toFixed(2)} KB)`);
3540
3856
  return {
3541
3857
  tgzPath,
@@ -3549,18 +3865,18 @@ function getCachePath(pluginKey, version) {
3549
3865
  ensureCacheDir();
3550
3866
  const safeKey = pluginKey.replace(/[/@]/g, "_");
3551
3867
  const filename = `${safeKey}@${version}.tgz`;
3552
- return path9.join(getPluginCacheDir(), filename);
3868
+ return path11.join(getPluginCacheDir(), filename);
3553
3869
  }
3554
3870
  function hasCachedPlugin(pluginKey, version) {
3555
3871
  const cachePath = getCachePath(pluginKey, version);
3556
- return fs11.existsSync(cachePath);
3872
+ return fs13.existsSync(cachePath);
3557
3873
  }
3558
3874
  function listCachedPlugins() {
3559
3875
  const cacheDir = getPluginCacheDir();
3560
- if (!fs11.existsSync(cacheDir)) {
3876
+ if (!fs13.existsSync(cacheDir)) {
3561
3877
  return [];
3562
3878
  }
3563
- const files = fs11.readdirSync(cacheDir);
3879
+ const files = fs13.readdirSync(cacheDir);
3564
3880
  const result = [];
3565
3881
  for (const file of files) {
3566
3882
  if (!file.endsWith(".tgz")) continue;
@@ -3568,8 +3884,8 @@ function listCachedPlugins() {
3568
3884
  if (!match) continue;
3569
3885
  const [, rawName, version] = match;
3570
3886
  const name = rawName.replace(/^_/, "@").replace(/_/, "/");
3571
- const filePath = path9.join(cacheDir, file);
3572
- const stat = fs11.statSync(filePath);
3887
+ const filePath = path11.join(cacheDir, file);
3888
+ const stat = fs13.statSync(filePath);
3573
3889
  result.push({
3574
3890
  name,
3575
3891
  version,
@@ -3582,14 +3898,14 @@ function listCachedPlugins() {
3582
3898
  }
3583
3899
  function cleanAllCache() {
3584
3900
  const cacheDir = getPluginCacheDir();
3585
- if (!fs11.existsSync(cacheDir)) {
3901
+ if (!fs13.existsSync(cacheDir)) {
3586
3902
  return 0;
3587
3903
  }
3588
- const files = fs11.readdirSync(cacheDir);
3904
+ const files = fs13.readdirSync(cacheDir);
3589
3905
  let count = 0;
3590
3906
  for (const file of files) {
3591
3907
  if (file.endsWith(".tgz")) {
3592
- fs11.unlinkSync(path9.join(cacheDir, file));
3908
+ fs13.unlinkSync(path11.join(cacheDir, file));
3593
3909
  count++;
3594
3910
  }
3595
3911
  }
@@ -3597,21 +3913,21 @@ function cleanAllCache() {
3597
3913
  }
3598
3914
  function cleanPluginCache(pluginKey, version) {
3599
3915
  const cacheDir = getPluginCacheDir();
3600
- if (!fs11.existsSync(cacheDir)) {
3916
+ if (!fs13.existsSync(cacheDir)) {
3601
3917
  return 0;
3602
3918
  }
3603
3919
  const safeKey = pluginKey.replace(/[/@]/g, "_");
3604
- const files = fs11.readdirSync(cacheDir);
3920
+ const files = fs13.readdirSync(cacheDir);
3605
3921
  let count = 0;
3606
3922
  for (const file of files) {
3607
3923
  if (version) {
3608
3924
  if (file === `${safeKey}@${version}.tgz`) {
3609
- fs11.unlinkSync(path9.join(cacheDir, file));
3925
+ fs13.unlinkSync(path11.join(cacheDir, file));
3610
3926
  count++;
3611
3927
  }
3612
3928
  } else {
3613
3929
  if (file.startsWith(`${safeKey}@`) && file.endsWith(".tgz")) {
3614
- fs11.unlinkSync(path9.join(cacheDir, file));
3930
+ fs13.unlinkSync(path11.join(cacheDir, file));
3615
3931
  count++;
3616
3932
  }
3617
3933
  }
@@ -4038,40 +4354,40 @@ var actionPluginCommandGroup = {
4038
4354
  };
4039
4355
 
4040
4356
  // src/commands/capability/utils.ts
4041
- import fs12 from "fs";
4357
+ import fs14 from "fs";
4042
4358
  import { createRequire as createRequire2 } from "module";
4043
- import path10 from "path";
4359
+ import path12 from "path";
4044
4360
  var CAPABILITIES_DIR = "server/capabilities";
4045
4361
  function getProjectRoot2() {
4046
4362
  return process.cwd();
4047
4363
  }
4048
4364
  function getCapabilitiesDir() {
4049
- return path10.join(getProjectRoot2(), CAPABILITIES_DIR);
4365
+ return path12.join(getProjectRoot2(), CAPABILITIES_DIR);
4050
4366
  }
4051
4367
  function getCapabilityPath(id) {
4052
- return path10.join(getCapabilitiesDir(), `${id}.json`);
4368
+ return path12.join(getCapabilitiesDir(), `${id}.json`);
4053
4369
  }
4054
4370
  function getPluginManifestPath(pluginKey) {
4055
- return path10.join(getProjectRoot2(), "node_modules", pluginKey, "manifest.json");
4371
+ return path12.join(getProjectRoot2(), "node_modules", pluginKey, "manifest.json");
4056
4372
  }
4057
4373
  function capabilitiesDirExists() {
4058
- return fs12.existsSync(getCapabilitiesDir());
4374
+ return fs14.existsSync(getCapabilitiesDir());
4059
4375
  }
4060
4376
  function listCapabilityIds() {
4061
4377
  const dir = getCapabilitiesDir();
4062
- if (!fs12.existsSync(dir)) {
4378
+ if (!fs14.existsSync(dir)) {
4063
4379
  return [];
4064
4380
  }
4065
- const files = fs12.readdirSync(dir);
4381
+ const files = fs14.readdirSync(dir);
4066
4382
  return files.filter((f) => f.endsWith(".json") && f !== "capabilities.json").map((f) => f.replace(/\.json$/, ""));
4067
4383
  }
4068
4384
  function readCapability(id) {
4069
4385
  const filePath = getCapabilityPath(id);
4070
- if (!fs12.existsSync(filePath)) {
4386
+ if (!fs14.existsSync(filePath)) {
4071
4387
  throw new Error(`Capability not found: ${id}`);
4072
4388
  }
4073
4389
  try {
4074
- const content = fs12.readFileSync(filePath, "utf-8");
4390
+ const content = fs14.readFileSync(filePath, "utf-8");
4075
4391
  return JSON.parse(content);
4076
4392
  } catch (error) {
4077
4393
  if (error instanceof SyntaxError) {
@@ -4098,11 +4414,11 @@ function readAllCapabilities() {
4098
4414
  }
4099
4415
  function readPluginManifest(pluginKey) {
4100
4416
  const manifestPath = getPluginManifestPath(pluginKey);
4101
- if (!fs12.existsSync(manifestPath)) {
4417
+ if (!fs14.existsSync(manifestPath)) {
4102
4418
  throw new Error(`Plugin not installed: ${pluginKey} (manifest.json not found)`);
4103
4419
  }
4104
4420
  try {
4105
- const content = fs12.readFileSync(manifestPath, "utf-8");
4421
+ const content = fs14.readFileSync(manifestPath, "utf-8");
4106
4422
  return JSON.parse(content);
4107
4423
  } catch (error) {
4108
4424
  if (error instanceof SyntaxError) {
@@ -4119,7 +4435,7 @@ function hasValidParamsSchema(paramsSchema) {
4119
4435
  }
4120
4436
  async function loadPlugin(pluginKey) {
4121
4437
  try {
4122
- const userRequire = createRequire2(path10.join(getProjectRoot2(), "package.json"));
4438
+ const userRequire = createRequire2(path12.join(getProjectRoot2(), "package.json"));
4123
4439
  const resolvedPath = userRequire.resolve(pluginKey);
4124
4440
  const pluginModule = await import(resolvedPath);
4125
4441
  const pluginPackage = pluginModule.default ?? pluginModule;
@@ -4282,9 +4598,9 @@ var capabilityCommandGroup = {
4282
4598
  import { execFile } from "child_process";
4283
4599
 
4284
4600
  // src/commands/component/registry-preparer.ts
4285
- import fs13 from "fs";
4286
- import path11 from "path";
4287
- import os from "os";
4601
+ import fs15 from "fs";
4602
+ import path13 from "path";
4603
+ import os2 from "os";
4288
4604
 
4289
4605
  // src/commands/component/service.ts
4290
4606
  import { mapValues } from "es-toolkit";
@@ -4339,7 +4655,7 @@ async function sendInstallEvent(key) {
4339
4655
  }
4340
4656
 
4341
4657
  // src/commands/component/registry-preparer.ts
4342
- var REGISTRY_TEMP_DIR = path11.join(os.tmpdir(), "miaoda-registry");
4658
+ var REGISTRY_TEMP_DIR = path13.join(os2.tmpdir(), "miaoda-registry");
4343
4659
  function parseComponentKey(key) {
4344
4660
  const match = key.match(/^@([^/]+)\/(.+)$/);
4345
4661
  if (!match) {
@@ -4351,11 +4667,11 @@ function parseComponentKey(key) {
4351
4667
  }
4352
4668
  function getLocalRegistryPath(key) {
4353
4669
  const { scope, name } = parseComponentKey(key);
4354
- return path11.join(REGISTRY_TEMP_DIR, scope, `${name}.json`);
4670
+ return path13.join(REGISTRY_TEMP_DIR, scope, `${name}.json`);
4355
4671
  }
4356
4672
  function ensureDir(dirPath) {
4357
- if (!fs13.existsSync(dirPath)) {
4358
- fs13.mkdirSync(dirPath, { recursive: true });
4673
+ if (!fs15.existsSync(dirPath)) {
4674
+ fs15.mkdirSync(dirPath, { recursive: true });
4359
4675
  }
4360
4676
  }
4361
4677
  async function prepareRecursive(key, visited) {
@@ -4388,8 +4704,8 @@ async function prepareRecursive(key, visited) {
4388
4704
  registryDependencies: deps.map((dep) => getLocalRegistryPath(dep))
4389
4705
  };
4390
4706
  const localPath = getLocalRegistryPath(key);
4391
- ensureDir(path11.dirname(localPath));
4392
- fs13.writeFileSync(localPath, JSON.stringify(rewrittenItem, null, 2), "utf-8");
4707
+ ensureDir(path13.dirname(localPath));
4708
+ fs15.writeFileSync(localPath, JSON.stringify(rewrittenItem, null, 2), "utf-8");
4393
4709
  debug("\u4FDD\u5B58\u5230: %s", localPath);
4394
4710
  }
4395
4711
  async function prepareComponentRegistryItems(id) {
@@ -4399,18 +4715,18 @@ async function prepareComponentRegistryItems(id) {
4399
4715
  }
4400
4716
  function cleanupTempDir() {
4401
4717
  try {
4402
- if (fs13.existsSync(REGISTRY_TEMP_DIR)) {
4403
- fs13.rmSync(REGISTRY_TEMP_DIR, { recursive: true, force: true });
4718
+ if (fs15.existsSync(REGISTRY_TEMP_DIR)) {
4719
+ fs15.rmSync(REGISTRY_TEMP_DIR, { recursive: true, force: true });
4404
4720
  }
4405
4721
  } catch {
4406
4722
  }
4407
4723
  }
4408
4724
  function getDownloadedRegistryItem(itemId) {
4409
4725
  const localPath = getLocalRegistryPath(itemId);
4410
- if (!fs13.existsSync(localPath)) {
4726
+ if (!fs15.existsSync(localPath)) {
4411
4727
  return null;
4412
4728
  }
4413
- const content = fs13.readFileSync(localPath, "utf-8");
4729
+ const content = fs15.readFileSync(localPath, "utf-8");
4414
4730
  return JSON.parse(content);
4415
4731
  }
4416
4732
 
@@ -4578,58 +4894,58 @@ var componentCommandGroup = {
4578
4894
  };
4579
4895
 
4580
4896
  // src/commands/migration/version-manager.ts
4581
- import fs14 from "fs";
4582
- import path12 from "path";
4897
+ import fs16 from "fs";
4898
+ import path14 from "path";
4583
4899
  var PACKAGE_JSON = "package.json";
4584
4900
  var VERSION_FIELD = "migrationVersion";
4585
4901
  function getPackageJsonPath2() {
4586
- return path12.join(process.cwd(), PACKAGE_JSON);
4902
+ return path14.join(process.cwd(), PACKAGE_JSON);
4587
4903
  }
4588
4904
  function getCurrentVersion() {
4589
4905
  const pkgPath = getPackageJsonPath2();
4590
- if (!fs14.existsSync(pkgPath)) {
4906
+ if (!fs16.existsSync(pkgPath)) {
4591
4907
  throw new Error("package.json not found");
4592
4908
  }
4593
- const pkg2 = JSON.parse(fs14.readFileSync(pkgPath, "utf-8"));
4909
+ const pkg2 = JSON.parse(fs16.readFileSync(pkgPath, "utf-8"));
4594
4910
  return pkg2[VERSION_FIELD] ?? 0;
4595
4911
  }
4596
4912
  function setCurrentVersion(version) {
4597
4913
  const pkgPath = getPackageJsonPath2();
4598
- const pkg2 = JSON.parse(fs14.readFileSync(pkgPath, "utf-8"));
4914
+ const pkg2 = JSON.parse(fs16.readFileSync(pkgPath, "utf-8"));
4599
4915
  pkg2[VERSION_FIELD] = version;
4600
- fs14.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
4916
+ fs16.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
4601
4917
  }
4602
4918
 
4603
4919
  // src/commands/migration/versions/v001_capability/json-migrator/detector.ts
4604
- import fs16 from "fs";
4605
- import path14 from "path";
4920
+ import fs18 from "fs";
4921
+ import path16 from "path";
4606
4922
 
4607
4923
  // src/commands/migration/versions/v001_capability/utils.ts
4608
- import fs15 from "fs";
4609
- import path13 from "path";
4924
+ import fs17 from "fs";
4925
+ import path15 from "path";
4610
4926
  var CAPABILITIES_DIR2 = "server/capabilities";
4611
4927
  function getProjectRoot3() {
4612
4928
  return process.cwd();
4613
4929
  }
4614
4930
  function getCapabilitiesDir2() {
4615
- return path13.join(getProjectRoot3(), CAPABILITIES_DIR2);
4931
+ return path15.join(getProjectRoot3(), CAPABILITIES_DIR2);
4616
4932
  }
4617
4933
  function getPluginManifestPath2(pluginKey) {
4618
- return path13.join(getProjectRoot3(), "node_modules", pluginKey, "manifest.json");
4934
+ return path15.join(getProjectRoot3(), "node_modules", pluginKey, "manifest.json");
4619
4935
  }
4620
4936
 
4621
4937
  // src/commands/migration/versions/v001_capability/json-migrator/detector.ts
4622
4938
  function detectJsonMigration() {
4623
4939
  const capabilitiesDir = getCapabilitiesDir2();
4624
- const oldFilePath = path14.join(capabilitiesDir, "capabilities.json");
4625
- if (!fs16.existsSync(oldFilePath)) {
4940
+ const oldFilePath = path16.join(capabilitiesDir, "capabilities.json");
4941
+ if (!fs18.existsSync(oldFilePath)) {
4626
4942
  return {
4627
4943
  needsMigration: false,
4628
4944
  reason: "capabilities.json not found"
4629
4945
  };
4630
4946
  }
4631
4947
  try {
4632
- const content = fs16.readFileSync(oldFilePath, "utf-8");
4948
+ const content = fs18.readFileSync(oldFilePath, "utf-8");
4633
4949
  const parsed = JSON.parse(content);
4634
4950
  if (!Array.isArray(parsed)) {
4635
4951
  return {
@@ -4680,8 +4996,8 @@ async function check(options) {
4680
4996
  }
4681
4997
 
4682
4998
  // src/commands/migration/versions/v001_capability/json-migrator/index.ts
4683
- import fs17 from "fs";
4684
- import path15 from "path";
4999
+ import fs19 from "fs";
5000
+ import path17 from "path";
4685
5001
 
4686
5002
  // src/commands/migration/versions/v001_capability/mapping.ts
4687
5003
  var DEFAULT_PLUGIN_VERSION = "1.0.0";
@@ -4911,18 +5227,18 @@ function transformCapabilities(oldCapabilities) {
4911
5227
  // src/commands/migration/versions/v001_capability/json-migrator/index.ts
4912
5228
  function loadExistingCapabilities() {
4913
5229
  const capabilitiesDir = getCapabilitiesDir2();
4914
- if (!fs17.existsSync(capabilitiesDir)) {
5230
+ if (!fs19.existsSync(capabilitiesDir)) {
4915
5231
  return [];
4916
5232
  }
4917
- const files = fs17.readdirSync(capabilitiesDir);
5233
+ const files = fs19.readdirSync(capabilitiesDir);
4918
5234
  const capabilities = [];
4919
5235
  for (const file of files) {
4920
5236
  if (file === "capabilities.json" || !file.endsWith(".json")) {
4921
5237
  continue;
4922
5238
  }
4923
5239
  try {
4924
- const filePath = path15.join(capabilitiesDir, file);
4925
- const content = fs17.readFileSync(filePath, "utf-8");
5240
+ const filePath = path17.join(capabilitiesDir, file);
5241
+ const content = fs19.readFileSync(filePath, "utf-8");
4926
5242
  const capability = JSON.parse(content);
4927
5243
  if (capability.id && capability.pluginKey) {
4928
5244
  capabilities.push(capability);
@@ -4980,9 +5296,9 @@ async function migrateJsonFiles(options) {
4980
5296
  }
4981
5297
  const capabilitiesDir = getCapabilitiesDir2();
4982
5298
  for (const cap of newCapabilities) {
4983
- const filePath = path15.join(capabilitiesDir, `${cap.id}.json`);
5299
+ const filePath = path17.join(capabilitiesDir, `${cap.id}.json`);
4984
5300
  const content = JSON.stringify(cap, null, 2);
4985
- fs17.writeFileSync(filePath, content, "utf-8");
5301
+ fs19.writeFileSync(filePath, content, "utf-8");
4986
5302
  console.log(` \u2713 Created: ${cap.id}.json`);
4987
5303
  }
4988
5304
  return {
@@ -4994,11 +5310,11 @@ async function migrateJsonFiles(options) {
4994
5310
  }
4995
5311
 
4996
5312
  // src/commands/migration/versions/v001_capability/plugin-installer/detector.ts
4997
- import fs18 from "fs";
5313
+ import fs20 from "fs";
4998
5314
  function isPluginInstalled2(pluginKey) {
4999
5315
  const actionPlugins = readActionPlugins();
5000
5316
  const manifestPath = getPluginManifestPath2(pluginKey);
5001
- return fs18.existsSync(manifestPath) && !!actionPlugins[pluginKey];
5317
+ return fs20.existsSync(manifestPath) && !!actionPlugins[pluginKey];
5002
5318
  }
5003
5319
  function detectPluginsToInstall(capabilities) {
5004
5320
  const pluginKeys = /* @__PURE__ */ new Set();
@@ -5074,12 +5390,12 @@ async function installPlugins(capabilities, options) {
5074
5390
  }
5075
5391
 
5076
5392
  // src/commands/migration/versions/v001_capability/code-migrator/index.ts
5077
- import path17 from "path";
5393
+ import path19 from "path";
5078
5394
  import { Project as Project3 } from "ts-morph";
5079
5395
 
5080
5396
  // src/commands/migration/versions/v001_capability/code-migrator/scanner.ts
5081
- import fs19 from "fs";
5082
- import path16 from "path";
5397
+ import fs21 from "fs";
5398
+ import path18 from "path";
5083
5399
  var EXCLUDED_DIRS = [
5084
5400
  "node_modules",
5085
5401
  "dist",
@@ -5094,9 +5410,9 @@ var EXCLUDED_PATTERNS = [
5094
5410
  /\.d\.ts$/
5095
5411
  ];
5096
5412
  function scanDirectory(dir, files = []) {
5097
- const entries = fs19.readdirSync(dir, { withFileTypes: true });
5413
+ const entries = fs21.readdirSync(dir, { withFileTypes: true });
5098
5414
  for (const entry of entries) {
5099
- const fullPath = path16.join(dir, entry.name);
5415
+ const fullPath = path18.join(dir, entry.name);
5100
5416
  if (entry.isDirectory()) {
5101
5417
  if (EXCLUDED_DIRS.includes(entry.name)) {
5102
5418
  continue;
@@ -5112,14 +5428,14 @@ function scanDirectory(dir, files = []) {
5112
5428
  return files;
5113
5429
  }
5114
5430
  function scanServerFiles() {
5115
- const serverDir = path16.join(getProjectRoot3(), "server");
5116
- if (!fs19.existsSync(serverDir)) {
5431
+ const serverDir = path18.join(getProjectRoot3(), "server");
5432
+ if (!fs21.existsSync(serverDir)) {
5117
5433
  return [];
5118
5434
  }
5119
5435
  return scanDirectory(serverDir);
5120
5436
  }
5121
5437
  function hasCapabilityImport(filePath) {
5122
- const content = fs19.readFileSync(filePath, "utf-8");
5438
+ const content = fs21.readFileSync(filePath, "utf-8");
5123
5439
  return /import\s+.*from\s+['"][^'"]*capabilities[^'"]*['"]/.test(content);
5124
5440
  }
5125
5441
  function scanFilesToMigrate() {
@@ -5496,7 +5812,7 @@ function analyzeFile(project, filePath, actionNameMap) {
5496
5812
  const callSites = analyzeCallSites(sourceFile, imports);
5497
5813
  const classInfo = analyzeClass(sourceFile);
5498
5814
  const { canMigrate, reason } = canAutoMigrate(classInfo);
5499
- const relativePath = path17.relative(getProjectRoot3(), filePath);
5815
+ const relativePath = path19.relative(getProjectRoot3(), filePath);
5500
5816
  return {
5501
5817
  filePath: relativePath,
5502
5818
  imports,
@@ -5507,7 +5823,7 @@ function analyzeFile(project, filePath, actionNameMap) {
5507
5823
  };
5508
5824
  }
5509
5825
  function migrateFile(project, analysis, dryRun) {
5510
- const absolutePath = path17.join(getProjectRoot3(), analysis.filePath);
5826
+ const absolutePath = path19.join(getProjectRoot3(), analysis.filePath);
5511
5827
  if (!analysis.canAutoMigrate) {
5512
5828
  return {
5513
5829
  filePath: analysis.filePath,
@@ -5610,17 +5926,17 @@ function getSuggestion(analysis) {
5610
5926
  }
5611
5927
 
5612
5928
  // src/commands/migration/versions/v001_capability/cleanup.ts
5613
- import fs20 from "fs";
5614
- import path18 from "path";
5929
+ import fs22 from "fs";
5930
+ import path20 from "path";
5615
5931
  function cleanupOldFiles(capabilities, dryRun) {
5616
5932
  const deletedFiles = [];
5617
5933
  const errors = [];
5618
5934
  const capabilitiesDir = getCapabilitiesDir2();
5619
- const oldJsonPath = path18.join(capabilitiesDir, "capabilities.json");
5620
- if (fs20.existsSync(oldJsonPath)) {
5935
+ const oldJsonPath = path20.join(capabilitiesDir, "capabilities.json");
5936
+ if (fs22.existsSync(oldJsonPath)) {
5621
5937
  try {
5622
5938
  if (!dryRun) {
5623
- fs20.unlinkSync(oldJsonPath);
5939
+ fs22.unlinkSync(oldJsonPath);
5624
5940
  }
5625
5941
  deletedFiles.push("capabilities.json");
5626
5942
  } catch (error) {
@@ -5628,11 +5944,11 @@ function cleanupOldFiles(capabilities, dryRun) {
5628
5944
  }
5629
5945
  }
5630
5946
  for (const cap of capabilities) {
5631
- const tsFilePath = path18.join(capabilitiesDir, `${cap.id}.ts`);
5632
- if (fs20.existsSync(tsFilePath)) {
5947
+ const tsFilePath = path20.join(capabilitiesDir, `${cap.id}.ts`);
5948
+ if (fs22.existsSync(tsFilePath)) {
5633
5949
  try {
5634
5950
  if (!dryRun) {
5635
- fs20.unlinkSync(tsFilePath);
5951
+ fs22.unlinkSync(tsFilePath);
5636
5952
  }
5637
5953
  deletedFiles.push(`${cap.id}.ts`);
5638
5954
  } catch (error) {
@@ -5648,8 +5964,8 @@ function cleanupOldFiles(capabilities, dryRun) {
5648
5964
  }
5649
5965
 
5650
5966
  // src/commands/migration/versions/v001_capability/report-generator.ts
5651
- import fs21 from "fs";
5652
- import path19 from "path";
5967
+ import fs23 from "fs";
5968
+ import path21 from "path";
5653
5969
  var REPORT_FILE = "capability-migration-report.md";
5654
5970
  function printSummary(result) {
5655
5971
  const { jsonMigration, pluginInstallation, codeMigration, cleanup } = result;
@@ -5812,15 +6128,15 @@ async function generateReport(result) {
5812
6128
  }
5813
6129
  lines.push("");
5814
6130
  const logDir = process.env.LOG_DIR || "logs";
5815
- if (!fs21.existsSync(logDir)) {
6131
+ if (!fs23.existsSync(logDir)) {
5816
6132
  return;
5817
6133
  }
5818
- const reportDir = path19.join(logDir, "migration");
5819
- if (!fs21.existsSync(reportDir)) {
5820
- fs21.mkdirSync(reportDir, { recursive: true });
6134
+ const reportDir = path21.join(logDir, "migration");
6135
+ if (!fs23.existsSync(reportDir)) {
6136
+ fs23.mkdirSync(reportDir, { recursive: true });
5821
6137
  }
5822
- const reportPath = path19.join(reportDir, REPORT_FILE);
5823
- fs21.writeFileSync(reportPath, lines.join("\n"), "utf-8");
6138
+ const reportPath = path21.join(reportDir, REPORT_FILE);
6139
+ fs23.writeFileSync(reportPath, lines.join("\n"), "utf-8");
5824
6140
  console.log(`\u{1F4C4} Report generated: ${reportPath}`);
5825
6141
  }
5826
6142
 
@@ -6352,10 +6668,10 @@ var migrationCommand = {
6352
6668
  };
6353
6669
 
6354
6670
  // src/commands/read-logs/index.ts
6355
- import path20 from "path";
6671
+ import path22 from "path";
6356
6672
 
6357
6673
  // src/commands/read-logs/std-utils.ts
6358
- import fs22 from "fs";
6674
+ import fs24 from "fs";
6359
6675
  function formatStdPrefixTime(localTime) {
6360
6676
  const match = localTime.match(/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/);
6361
6677
  if (!match) return localTime;
@@ -6385,11 +6701,11 @@ function stripPrefixFromStdLine(line) {
6385
6701
  return `[${time}] ${content}`;
6386
6702
  }
6387
6703
  function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarker) {
6388
- const stat = fs22.statSync(filePath);
6704
+ const stat = fs24.statSync(filePath);
6389
6705
  if (stat.size === 0) {
6390
6706
  return { lines: [], markerFound: false, totalLinesCount: 0 };
6391
6707
  }
6392
- const fd = fs22.openSync(filePath, "r");
6708
+ const fd = fs24.openSync(filePath, "r");
6393
6709
  const chunkSize = 64 * 1024;
6394
6710
  let position = stat.size;
6395
6711
  let remainder = "";
@@ -6403,7 +6719,7 @@ function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarke
6403
6719
  const length = Math.min(chunkSize, position);
6404
6720
  position -= length;
6405
6721
  const buffer = Buffer.alloc(length);
6406
- fs22.readSync(fd, buffer, 0, length, position);
6722
+ fs24.readSync(fd, buffer, 0, length, position);
6407
6723
  let chunk = buffer.toString("utf8");
6408
6724
  if (remainder) {
6409
6725
  chunk += remainder;
@@ -6445,7 +6761,7 @@ function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarke
6445
6761
  }
6446
6762
  }
6447
6763
  } finally {
6448
- fs22.closeSync(fd);
6764
+ fs24.closeSync(fd);
6449
6765
  }
6450
6766
  return { lines: collected.reverse(), markerFound, totalLinesCount };
6451
6767
  }
@@ -6466,21 +6782,21 @@ function readServerStdSegment(filePath, maxLines, offset) {
6466
6782
  }
6467
6783
 
6468
6784
  // src/commands/read-logs/tail.ts
6469
- import fs23 from "fs";
6785
+ import fs25 from "fs";
6470
6786
  function fileExists(filePath) {
6471
6787
  try {
6472
- fs23.accessSync(filePath, fs23.constants.F_OK | fs23.constants.R_OK);
6788
+ fs25.accessSync(filePath, fs25.constants.F_OK | fs25.constants.R_OK);
6473
6789
  return true;
6474
6790
  } catch {
6475
6791
  return false;
6476
6792
  }
6477
6793
  }
6478
6794
  function readFileTailLines(filePath, maxLines) {
6479
- const stat = fs23.statSync(filePath);
6795
+ const stat = fs25.statSync(filePath);
6480
6796
  if (stat.size === 0) {
6481
6797
  return [];
6482
6798
  }
6483
- const fd = fs23.openSync(filePath, "r");
6799
+ const fd = fs25.openSync(filePath, "r");
6484
6800
  const chunkSize = 64 * 1024;
6485
6801
  const chunks = [];
6486
6802
  let position = stat.size;
@@ -6490,13 +6806,13 @@ function readFileTailLines(filePath, maxLines) {
6490
6806
  const length = Math.min(chunkSize, position);
6491
6807
  position -= length;
6492
6808
  const buffer = Buffer.alloc(length);
6493
- fs23.readSync(fd, buffer, 0, length, position);
6809
+ fs25.readSync(fd, buffer, 0, length, position);
6494
6810
  chunks.unshift(buffer.toString("utf8"));
6495
6811
  const chunkLines = buffer.toString("utf8").split("\n").length - 1;
6496
6812
  collectedLines += chunkLines;
6497
6813
  }
6498
6814
  } finally {
6499
- fs23.closeSync(fd);
6815
+ fs25.closeSync(fd);
6500
6816
  }
6501
6817
  const content = chunks.join("");
6502
6818
  const allLines = content.split("\n");
@@ -6512,11 +6828,11 @@ function readFileTailLines(filePath, maxLines) {
6512
6828
  return allLines.slice(allLines.length - maxLines);
6513
6829
  }
6514
6830
  function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
6515
- const stat = fs23.statSync(filePath);
6831
+ const stat = fs25.statSync(filePath);
6516
6832
  if (stat.size === 0) {
6517
6833
  return { lines: [], totalLinesCount: 0 };
6518
6834
  }
6519
- const fd = fs23.openSync(filePath, "r");
6835
+ const fd = fs25.openSync(filePath, "r");
6520
6836
  const chunkSize = 64 * 1024;
6521
6837
  let position = stat.size;
6522
6838
  let remainder = "";
@@ -6528,7 +6844,7 @@ function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
6528
6844
  const length = Math.min(chunkSize, position);
6529
6845
  position -= length;
6530
6846
  const buffer = Buffer.alloc(length);
6531
- fs23.readSync(fd, buffer, 0, length, position);
6847
+ fs25.readSync(fd, buffer, 0, length, position);
6532
6848
  let chunk = buffer.toString("utf8");
6533
6849
  if (remainder) {
6534
6850
  chunk += remainder;
@@ -6559,7 +6875,7 @@ function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
6559
6875
  }
6560
6876
  }
6561
6877
  } finally {
6562
- fs23.closeSync(fd);
6878
+ fs25.closeSync(fd);
6563
6879
  }
6564
6880
  return { lines: collected.reverse(), totalLinesCount };
6565
6881
  }
@@ -6701,7 +7017,7 @@ function readDevStdSegment(filePath, maxLines, offset) {
6701
7017
  }
6702
7018
 
6703
7019
  // src/commands/read-logs/json-lines.ts
6704
- import fs24 from "fs";
7020
+ import fs26 from "fs";
6705
7021
  function normalizePid(value) {
6706
7022
  if (typeof value === "number") {
6707
7023
  return String(value);
@@ -6752,11 +7068,11 @@ function buildWantedLevelSet(levels) {
6752
7068
  return set.size > 0 ? set : null;
6753
7069
  }
6754
7070
  function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
6755
- const stat = fs24.statSync(filePath);
7071
+ const stat = fs26.statSync(filePath);
6756
7072
  if (stat.size === 0) {
6757
7073
  return { lines: [], totalLinesCount: 0 };
6758
7074
  }
6759
- const fd = fs24.openSync(filePath, "r");
7075
+ const fd = fs26.openSync(filePath, "r");
6760
7076
  const chunkSize = 64 * 1024;
6761
7077
  let position = stat.size;
6762
7078
  let remainder = "";
@@ -6771,7 +7087,7 @@ function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
6771
7087
  const length = Math.min(chunkSize, position);
6772
7088
  position -= length;
6773
7089
  const buffer = Buffer.alloc(length);
6774
- fs24.readSync(fd, buffer, 0, length, position);
7090
+ fs26.readSync(fd, buffer, 0, length, position);
6775
7091
  let chunk = buffer.toString("utf8");
6776
7092
  if (remainder) {
6777
7093
  chunk += remainder;
@@ -6833,7 +7149,7 @@ function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
6833
7149
  }
6834
7150
  }
6835
7151
  } finally {
6836
- fs24.closeSync(fd);
7152
+ fs26.closeSync(fd);
6837
7153
  }
6838
7154
  return { lines: collected.reverse(), totalLinesCount };
6839
7155
  }
@@ -6876,11 +7192,11 @@ function extractTraceId(obj) {
6876
7192
  function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
6877
7193
  const wanted = traceId.trim();
6878
7194
  if (!wanted) return { lines: [], totalLinesCount: 0 };
6879
- const stat = fs24.statSync(filePath);
7195
+ const stat = fs26.statSync(filePath);
6880
7196
  if (stat.size === 0) {
6881
7197
  return { lines: [], totalLinesCount: 0 };
6882
7198
  }
6883
- const fd = fs24.openSync(filePath, "r");
7199
+ const fd = fs26.openSync(filePath, "r");
6884
7200
  const chunkSize = 64 * 1024;
6885
7201
  let position = stat.size;
6886
7202
  let remainder = "";
@@ -6893,7 +7209,7 @@ function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
6893
7209
  const length = Math.min(chunkSize, position);
6894
7210
  position -= length;
6895
7211
  const buffer = Buffer.alloc(length);
6896
- fs24.readSync(fd, buffer, 0, length, position);
7212
+ fs26.readSync(fd, buffer, 0, length, position);
6897
7213
  let chunk = buffer.toString("utf8");
6898
7214
  if (remainder) {
6899
7215
  chunk += remainder;
@@ -6946,7 +7262,7 @@ function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
6946
7262
  }
6947
7263
  }
6948
7264
  } finally {
6949
- fs24.closeSync(fd);
7265
+ fs26.closeSync(fd);
6950
7266
  }
6951
7267
  return { lines: collected.reverse(), totalLinesCount };
6952
7268
  }
@@ -6955,11 +7271,11 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
6955
7271
  if (!wantedLevelSet) {
6956
7272
  return { lines: [], totalLinesCount: 0 };
6957
7273
  }
6958
- const stat = fs24.statSync(filePath);
7274
+ const stat = fs26.statSync(filePath);
6959
7275
  if (stat.size === 0) {
6960
7276
  return { lines: [], totalLinesCount: 0 };
6961
7277
  }
6962
- const fd = fs24.openSync(filePath, "r");
7278
+ const fd = fs26.openSync(filePath, "r");
6963
7279
  const chunkSize = 64 * 1024;
6964
7280
  let position = stat.size;
6965
7281
  let remainder = "";
@@ -6971,7 +7287,7 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
6971
7287
  const length = Math.min(chunkSize, position);
6972
7288
  position -= length;
6973
7289
  const buffer = Buffer.alloc(length);
6974
- fs24.readSync(fd, buffer, 0, length, position);
7290
+ fs26.readSync(fd, buffer, 0, length, position);
6975
7291
  let chunk = buffer.toString("utf8");
6976
7292
  if (remainder) {
6977
7293
  chunk += remainder;
@@ -7018,7 +7334,7 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
7018
7334
  }
7019
7335
  }
7020
7336
  } finally {
7021
- fs24.closeSync(fd);
7337
+ fs26.closeSync(fd);
7022
7338
  }
7023
7339
  return { lines: collected.reverse(), totalLinesCount };
7024
7340
  }
@@ -7252,30 +7568,30 @@ async function readLogsJsonResult(options) {
7252
7568
  };
7253
7569
  }
7254
7570
  function resolveLogFilePath(logDir, type) {
7255
- const base = path20.isAbsolute(logDir) ? logDir : path20.join(process.cwd(), logDir);
7571
+ const base = path22.isAbsolute(logDir) ? logDir : path22.join(process.cwd(), logDir);
7256
7572
  if (type === "server") {
7257
- return path20.join(base, "server.log");
7573
+ return path22.join(base, "server.log");
7258
7574
  }
7259
7575
  if (type === "trace") {
7260
- return path20.join(base, "trace.log");
7576
+ return path22.join(base, "trace.log");
7261
7577
  }
7262
7578
  if (type === "server-std") {
7263
- return path20.join(base, "server.std.log");
7579
+ return path22.join(base, "server.std.log");
7264
7580
  }
7265
7581
  if (type === "client-std") {
7266
- return path20.join(base, "client.std.log");
7582
+ return path22.join(base, "client.std.log");
7267
7583
  }
7268
7584
  if (type === "dev") {
7269
- return path20.join(base, "dev.log");
7585
+ return path22.join(base, "dev.log");
7270
7586
  }
7271
7587
  if (type === "dev-std") {
7272
- return path20.join(base, "dev.std.log");
7588
+ return path22.join(base, "dev.std.log");
7273
7589
  }
7274
7590
  if (type === "install-dep-std") {
7275
- return path20.join(base, "install-dep.std.log");
7591
+ return path22.join(base, "install-dep.std.log");
7276
7592
  }
7277
7593
  if (type === "browser") {
7278
- return path20.join(base, "browser.log");
7594
+ return path22.join(base, "browser.log");
7279
7595
  }
7280
7596
  throw new Error(`Unsupported log type: ${type}`);
7281
7597
  }
@@ -7452,9 +7768,9 @@ function camelToKebab(str) {
7452
7768
  }
7453
7769
 
7454
7770
  // src/commands/build/upload-static.handler.ts
7455
- import * as fs25 from "fs";
7456
- import * as os2 from "os";
7457
- import * as path21 from "path";
7771
+ import * as fs27 from "fs";
7772
+ import * as os3 from "os";
7773
+ import * as path23 from "path";
7458
7774
  import { execFileSync } from "child_process";
7459
7775
  function readCredentialsFromEnv() {
7460
7776
  const uploadPrefix = process.env.STATIC_UPLOAD_PREFIX;
@@ -7478,8 +7794,8 @@ async function uploadStatic(options) {
7478
7794
  endpoint = UPLOAD_STATIC_DEFAULTS.endpoint,
7479
7795
  region = UPLOAD_STATIC_DEFAULTS.region
7480
7796
  } = options;
7481
- const resolvedStaticDir = path21.resolve(staticDir);
7482
- if (!fs25.existsSync(resolvedStaticDir)) {
7797
+ const resolvedStaticDir = path23.resolve(staticDir);
7798
+ if (!fs27.existsSync(resolvedStaticDir)) {
7483
7799
  console.error(`${LOG_PREFIX} \u76EE\u5F55\u4E0D\u5B58\u5728: ${resolvedStaticDir}\uFF0C\u8DF3\u8FC7\u4E0A\u4F20`);
7484
7800
  return;
7485
7801
  }
@@ -7512,8 +7828,8 @@ async function uploadStatic(options) {
7512
7828
  ({ AccessKeyID: accessKeyID, SecretAccessKey: secretAccessKey, SessionToken: sessionToken } = uploadCredential);
7513
7829
  }
7514
7830
  console.error(`${LOG_PREFIX} \u4E0A\u4F20\u76EE\u6807: ${uploadPrefix}`);
7515
- const confPath = path21.join(os2.tmpdir(), `.tosutilconfig-static-${process.pid}`);
7516
- fs25.writeFileSync(confPath, "");
7831
+ const confPath = path23.join(os3.tmpdir(), `.tosutilconfig-static-${process.pid}`);
7832
+ fs27.writeFileSync(confPath, "");
7517
7833
  try {
7518
7834
  console.error(`${LOG_PREFIX} \u914D\u7F6E tosutil...`);
7519
7835
  configureTosutil(resolvedTosutil, confPath, {
@@ -7527,7 +7843,7 @@ async function uploadStatic(options) {
7527
7843
  uploadToTos(resolvedTosutil, confPath, resolvedStaticDir, uploadPrefix);
7528
7844
  } finally {
7529
7845
  try {
7530
- fs25.unlinkSync(confPath);
7846
+ fs27.unlinkSync(confPath);
7531
7847
  } catch {
7532
7848
  }
7533
7849
  }
@@ -7547,8 +7863,8 @@ async function uploadStatic(options) {
7547
7863
  }
7548
7864
  }
7549
7865
  function resolveTosutilPath(tosutilPath) {
7550
- if (path21.isAbsolute(tosutilPath)) {
7551
- return fs25.existsSync(tosutilPath) ? tosutilPath : null;
7866
+ if (path23.isAbsolute(tosutilPath)) {
7867
+ return fs27.existsSync(tosutilPath) ? tosutilPath : null;
7552
7868
  }
7553
7869
  try {
7554
7870
  const resolved = execFileSync("which", [tosutilPath], { encoding: "utf-8" }).trim();
@@ -7593,7 +7909,7 @@ async function resolveBucketId(appId) {
7593
7909
  return bucketId;
7594
7910
  }
7595
7911
  function isDirEmpty(dirPath) {
7596
- const entries = fs25.readdirSync(dirPath);
7912
+ const entries = fs27.readdirSync(dirPath);
7597
7913
  return entries.length === 0;
7598
7914
  }
7599
7915
 
@@ -7688,12 +8004,12 @@ var commands = [
7688
8004
  ];
7689
8005
 
7690
8006
  // src/index.ts
7691
- var envPath = path22.join(process.cwd(), ".env");
7692
- if (fs26.existsSync(envPath)) {
8007
+ var envPath = path24.join(process.cwd(), ".env");
8008
+ if (fs28.existsSync(envPath)) {
7693
8009
  dotenvConfig({ path: envPath });
7694
8010
  }
7695
- var __dirname = path22.dirname(fileURLToPath5(import.meta.url));
7696
- var pkg = JSON.parse(fs26.readFileSync(path22.join(__dirname, "../package.json"), "utf-8"));
8011
+ var __dirname = path24.dirname(fileURLToPath5(import.meta.url));
8012
+ var pkg = JSON.parse(fs28.readFileSync(path24.join(__dirname, "../package.json"), "utf-8"));
7697
8013
  var cli = new FullstackCLI(pkg.version);
7698
8014
  cli.useAll(commands);
7699
8015
  cli.run();