@lark-apaas/fullstack-cli 1.1.22-alpha.3 → 1.1.22-alpha.5

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 (3) hide show
  1. package/README.md +3 -41
  2. package/dist/index.js +521 -329
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/index.ts
2
- import fs22 from "fs";
3
- import path18 from "path";
4
- import { fileURLToPath as fileURLToPath4 } from "url";
2
+ import fs25 from "fs";
3
+ import path21 from "path";
4
+ import { fileURLToPath as fileURLToPath5 } from "url";
5
5
  import { config as dotenvConfig } from "dotenv";
6
6
 
7
7
  // src/cli.ts
@@ -2419,10 +2419,339 @@ var syncCommand = {
2419
2419
  }
2420
2420
  };
2421
2421
 
2422
- // src/commands/action-plugin/utils.ts
2422
+ // src/utils/http-client.ts
2423
+ import { HttpClient } from "@lark-apaas/http-client";
2424
+ var clientInstance = null;
2425
+ function getHttpClient() {
2426
+ if (!clientInstance) {
2427
+ clientInstance = new HttpClient({
2428
+ timeout: 3e4,
2429
+ platform: {
2430
+ enabled: true
2431
+ }
2432
+ });
2433
+ const canaryEnv = process.env.FORCE_FRAMEWORK_CLI_CANARY_ENV;
2434
+ if (canaryEnv) {
2435
+ clientInstance.interceptors.request.use((req) => {
2436
+ req.headers["x-tt-env"] = canaryEnv;
2437
+ return req;
2438
+ });
2439
+ }
2440
+ }
2441
+ return clientInstance;
2442
+ }
2443
+
2444
+ // src/utils/git.ts
2445
+ import { execSync, spawnSync as spawnSync2 } from "child_process";
2423
2446
  import fs7 from "fs";
2424
2447
  import path5 from "path";
2425
- import { spawnSync as spawnSync2, execSync } from "child_process";
2448
+ function isGitRepository(cwd = process.cwd()) {
2449
+ try {
2450
+ const gitDir = path5.join(cwd, ".git");
2451
+ if (fs7.existsSync(gitDir)) {
2452
+ return true;
2453
+ }
2454
+ const result = spawnSync2("git", ["rev-parse", "--git-dir"], {
2455
+ cwd,
2456
+ stdio: "pipe",
2457
+ encoding: "utf-8"
2458
+ });
2459
+ return result.status === 0;
2460
+ } catch {
2461
+ return false;
2462
+ }
2463
+ }
2464
+ function getChangedFiles(cwd = process.cwd()) {
2465
+ try {
2466
+ const output = execSync("git status --porcelain", {
2467
+ cwd,
2468
+ stdio: "pipe",
2469
+ encoding: "utf-8"
2470
+ });
2471
+ return output.split("\n").filter((line) => line.trim()).map((line) => line.substring(3));
2472
+ } catch (error) {
2473
+ const message = error instanceof Error ? error.message : String(error);
2474
+ throw new Error(`Failed to get changed files: ${message}`);
2475
+ }
2476
+ }
2477
+ function gitAddUpgradeFiles(cwd = process.cwd(), filesToStage) {
2478
+ const result = spawnSync2("git", ["add", "--ignore-missing", "--", ...filesToStage], {
2479
+ cwd,
2480
+ stdio: "pipe",
2481
+ encoding: "utf-8"
2482
+ });
2483
+ if (result.error || result.status !== 0) {
2484
+ const errorMsg = result.stderr || result.error?.message || "Unknown error";
2485
+ throw new Error(`git add failed: ${errorMsg}`);
2486
+ }
2487
+ }
2488
+ function gitCommit(message, cwd = process.cwd()) {
2489
+ const result = spawnSync2("git", ["commit", "-m", message], {
2490
+ cwd,
2491
+ stdio: "pipe",
2492
+ encoding: "utf-8"
2493
+ });
2494
+ if (result.error || result.status !== 0) {
2495
+ const errorMsg = result.stderr || result.error?.message || "Unknown error";
2496
+ throw new Error(`git commit failed: ${errorMsg}`);
2497
+ }
2498
+ }
2499
+ function autoCommitUpgradeChanges(version, cwd, filesToStage, commitMessage) {
2500
+ if (!isGitRepository(cwd)) {
2501
+ console.log("[fullstack-cli] \u26A0 Not a git repository, skipping auto-commit");
2502
+ return false;
2503
+ }
2504
+ const changedFiles = getChangedFiles(cwd);
2505
+ if (changedFiles.length === 0) {
2506
+ console.log("[fullstack-cli] No changes to commit");
2507
+ return false;
2508
+ }
2509
+ try {
2510
+ gitAddUpgradeFiles(cwd, filesToStage);
2511
+ const message = commitMessage || `chore(upgrade): auto-upgrade by fullstack-cli
2512
+
2513
+ - Sync template files
2514
+ - Cleanup package.json config
2515
+ - Upgrade @lark-apaas dependencies (if any)
2516
+
2517
+ Auto-committed by fullstack-cli v${version}`;
2518
+ gitCommit(message, cwd);
2519
+ console.log(`[fullstack-cli] \u2713 Auto-committed ${changedFiles.length} changed file(s)`);
2520
+ return true;
2521
+ } catch (error) {
2522
+ const message = error instanceof Error ? error.message : String(error);
2523
+ throw new Error(`Failed to auto-commit changes: ${message}`);
2524
+ }
2525
+ }
2526
+
2527
+ // src/utils/package-json.ts
2528
+ import fs8 from "fs";
2529
+ import path6 from "path";
2530
+ function readPackageJson(cwd = process.cwd()) {
2531
+ const pkgPath = path6.join(cwd, "package.json");
2532
+ if (!fs8.existsSync(pkgPath)) {
2533
+ throw new Error(`package.json not found at ${pkgPath}`);
2534
+ }
2535
+ const content = fs8.readFileSync(pkgPath, "utf-8");
2536
+ return JSON.parse(content);
2537
+ }
2538
+ function writePackageJson(pkg2, cwd = process.cwd()) {
2539
+ const pkgPath = path6.join(cwd, "package.json");
2540
+ const content = JSON.stringify(pkg2, null, 2) + "\n";
2541
+ fs8.writeFileSync(pkgPath, content, "utf-8");
2542
+ }
2543
+ function removeUpgradeScript(pkg2) {
2544
+ if (!pkg2.scripts?.upgrade) {
2545
+ return false;
2546
+ }
2547
+ delete pkg2.scripts.upgrade;
2548
+ return true;
2549
+ }
2550
+ function cleanDevScript(pkg2) {
2551
+ if (!pkg2.scripts?.dev) {
2552
+ return false;
2553
+ }
2554
+ const originalDev = pkg2.scripts.dev;
2555
+ const cleanedDev = originalDev.replace(/npm\s+run\s+upgrade\s*&&\s*/g, "").replace(/npm\s+run\s+upgrade\s*$/g, "").trim();
2556
+ if (cleanedDev !== originalDev) {
2557
+ pkg2.scripts.dev = cleanedDev;
2558
+ return true;
2559
+ }
2560
+ return false;
2561
+ }
2562
+ function cleanupPackageJson(cwd = process.cwd()) {
2563
+ try {
2564
+ const pkg2 = readPackageJson(cwd);
2565
+ let changed = false;
2566
+ if (removeUpgradeScript(pkg2)) {
2567
+ console.log("[fullstack-cli] \u2713 Removed scripts.upgrade");
2568
+ changed = true;
2569
+ }
2570
+ if (cleanDevScript(pkg2)) {
2571
+ console.log("[fullstack-cli] \u2713 Cleaned scripts.dev (removed npm run upgrade)");
2572
+ changed = true;
2573
+ }
2574
+ if (changed) {
2575
+ writePackageJson(pkg2, cwd);
2576
+ }
2577
+ return changed;
2578
+ } catch (error) {
2579
+ const message = error instanceof Error ? error.message : String(error);
2580
+ console.log(`[fullstack-cli] \u26A0 Could not cleanup package.json: ${message}`);
2581
+ return false;
2582
+ }
2583
+ }
2584
+
2585
+ // src/commands/upgrade/shared/utils.ts
2586
+ import path7 from "path";
2587
+ import fs9 from "fs";
2588
+ import { fileURLToPath as fileURLToPath4 } from "url";
2589
+ function getCliVersion() {
2590
+ try {
2591
+ const __filename = fileURLToPath4(import.meta.url);
2592
+ const __dirname2 = path7.dirname(__filename);
2593
+ const pkgPath = path7.resolve(__dirname2, "../../../package.json");
2594
+ const pkgContent = fs9.readFileSync(pkgPath, "utf-8");
2595
+ const pkg2 = JSON.parse(pkgContent);
2596
+ return pkg2.version || "unknown";
2597
+ } catch {
2598
+ return "unknown";
2599
+ }
2600
+ }
2601
+
2602
+ // src/commands/upgrade/get-upgrade-files.ts
2603
+ function getUpgradeFilesToStage(disableGenOpenapi = true) {
2604
+ const syncConfig2 = genSyncConfig({ disableGenOpenapi });
2605
+ const filesToStage = /* @__PURE__ */ new Set();
2606
+ syncConfig2.sync.forEach((rule) => {
2607
+ if (rule.type === "file" || rule.type === "directory") {
2608
+ filesToStage.add(rule.to);
2609
+ } else if (rule.type === "remove-line" || rule.type === "add-line") {
2610
+ filesToStage.add(rule.to);
2611
+ } else if (rule.type === "add-script") {
2612
+ filesToStage.add("package.json");
2613
+ } else if (rule.type === "delete-file" || rule.type === "delete-directory") {
2614
+ filesToStage.add(rule.to);
2615
+ }
2616
+ });
2617
+ filesToStage.add("package.json");
2618
+ filesToStage.add("package-lock.json");
2619
+ return Array.from(filesToStage);
2620
+ }
2621
+
2622
+ // src/commands/upgrade/run.handler.ts
2623
+ async function run3(options = {}) {
2624
+ const userProjectRoot = process.env.INIT_CWD || process.cwd();
2625
+ console.log("[fullstack-cli] Starting upgrade...");
2626
+ try {
2627
+ console.log("[fullstack-cli] Step 1/3: Syncing template files...");
2628
+ await run2({ disableGenOpenapi: options.disableGenOpenapi ?? true });
2629
+ console.log("[fullstack-cli] Step 2/3: Cleaning up package.json...");
2630
+ const cleaned = cleanupPackageJson(userProjectRoot);
2631
+ if (!cleaned) {
2632
+ console.log("[fullstack-cli] \u25CB No cleanup needed");
2633
+ }
2634
+ const shouldCommit = options.commit ?? true;
2635
+ if (shouldCommit) {
2636
+ console.log("[fullstack-cli] Step 3/3: Committing changes...");
2637
+ const version = getCliVersion();
2638
+ const filesToStage = getUpgradeFilesToStage(options.disableGenOpenapi ?? true);
2639
+ autoCommitUpgradeChanges(version, userProjectRoot, filesToStage);
2640
+ } else {
2641
+ console.log("[fullstack-cli] Step 3/3: Skipping commit (--no-commit flag)");
2642
+ }
2643
+ console.log("[fullstack-cli] Upgrade completed successfully \u2705");
2644
+ } catch (error) {
2645
+ const message = error instanceof Error ? error.message : String(error);
2646
+ console.error("[fullstack-cli] Failed to upgrade:", message);
2647
+ process.exit(1);
2648
+ }
2649
+ }
2650
+
2651
+ // src/commands/upgrade/deps/run.handler.ts
2652
+ import { spawnSync as spawnSync3 } from "child_process";
2653
+ function findLarkAapaasPackages(cwd, filterPackages) {
2654
+ const pkg2 = readPackageJson(cwd);
2655
+ const allPackages = /* @__PURE__ */ new Set();
2656
+ if (pkg2.dependencies) {
2657
+ Object.keys(pkg2.dependencies).forEach((name) => {
2658
+ if (name.startsWith("@lark-apaas/")) {
2659
+ allPackages.add(name);
2660
+ }
2661
+ });
2662
+ }
2663
+ if (pkg2.devDependencies) {
2664
+ Object.keys(pkg2.devDependencies).forEach((name) => {
2665
+ if (name.startsWith("@lark-apaas/")) {
2666
+ allPackages.add(name);
2667
+ }
2668
+ });
2669
+ }
2670
+ const packages = Array.from(allPackages);
2671
+ if (filterPackages) {
2672
+ const filter = new Set(filterPackages.split(",").map((p) => p.trim()));
2673
+ return packages.filter((p) => filter.has(p));
2674
+ }
2675
+ return packages;
2676
+ }
2677
+ function upgradePackages(packages, version, cwd) {
2678
+ if (version) {
2679
+ console.log(`[fullstack-cli] Upgrading to version ${version}...`);
2680
+ packages.forEach((pkg2) => {
2681
+ const target = `${pkg2}@${version}`;
2682
+ console.log(`[fullstack-cli] Installing ${target}...`);
2683
+ const result = spawnSync3("npm", ["install", target], {
2684
+ cwd,
2685
+ stdio: "inherit"
2686
+ });
2687
+ if (result.error || result.status !== 0) {
2688
+ throw new Error(`Failed to install ${target}`);
2689
+ }
2690
+ });
2691
+ } else {
2692
+ console.log("[fullstack-cli] Upgrading to latest compatible versions...");
2693
+ packages.forEach((pkg2) => {
2694
+ console.log(`[fullstack-cli] Updating ${pkg2}...`);
2695
+ const result = spawnSync3("npm", ["update", pkg2], {
2696
+ cwd,
2697
+ stdio: "inherit"
2698
+ });
2699
+ if (result.error || result.status !== 0) {
2700
+ throw new Error(`Failed to update ${pkg2}`);
2701
+ }
2702
+ });
2703
+ }
2704
+ }
2705
+ async function run4(options = {}) {
2706
+ const cwd = process.env.INIT_CWD || process.cwd();
2707
+ console.log("[fullstack-cli] Starting dependencies upgrade...");
2708
+ try {
2709
+ console.log("[fullstack-cli] Step 1/2: Scanning @lark-apaas dependencies...");
2710
+ const packages = findLarkAapaasPackages(cwd, options.packages);
2711
+ if (packages.length === 0) {
2712
+ console.log("[fullstack-cli] No @lark-apaas packages found");
2713
+ return;
2714
+ }
2715
+ console.log(`[fullstack-cli] Found ${packages.length} @lark-apaas package(s):`);
2716
+ packages.forEach((p) => console.log(` - ${p}`));
2717
+ console.log("[fullstack-cli] Step 2/2: Upgrading packages...");
2718
+ upgradePackages(packages, options.version, cwd);
2719
+ console.log(`[fullstack-cli] \u2713 Successfully upgraded ${packages.length} package(s)`);
2720
+ console.log("[fullstack-cli] Dependencies upgrade completed successfully \u2705");
2721
+ } catch (error) {
2722
+ const message = error instanceof Error ? error.message : String(error);
2723
+ console.error("[fullstack-cli] Failed to upgrade dependencies:", message);
2724
+ process.exit(1);
2725
+ }
2726
+ }
2727
+
2728
+ // src/commands/upgrade/deps/index.ts
2729
+ var depsCommand = {
2730
+ name: "deps",
2731
+ description: "Upgrade @lark-apaas dependencies",
2732
+ register(parentCommand) {
2733
+ 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) => {
2734
+ await run4(options);
2735
+ });
2736
+ }
2737
+ };
2738
+
2739
+ // src/commands/upgrade/index.ts
2740
+ var upgradeCommand = {
2741
+ name: "upgrade",
2742
+ description: "Upgrade template files and auto-commit changes",
2743
+ register(program) {
2744
+ const upgradeCmd = program.command(this.name).description(this.description).option("--disable-gen-openapi", "Disable generating openapi.ts").option("--no-commit", "Skip auto-commit changes").action(async (options) => {
2745
+ await run3(options);
2746
+ });
2747
+ depsCommand.register(upgradeCmd);
2748
+ }
2749
+ };
2750
+
2751
+ // src/commands/action-plugin/utils.ts
2752
+ import fs10 from "fs";
2753
+ import path8 from "path";
2754
+ import { spawnSync as spawnSync4, execSync as execSync2 } from "child_process";
2426
2755
  function parsePluginName(input) {
2427
2756
  const match = input.match(/^(@[^/]+\/[^@]+)(?:@(.+))?$/);
2428
2757
  if (!match) {
@@ -2439,35 +2768,35 @@ function getProjectRoot() {
2439
2768
  return process.cwd();
2440
2769
  }
2441
2770
  function getPackageJsonPath() {
2442
- return path5.join(getProjectRoot(), "package.json");
2771
+ return path8.join(getProjectRoot(), "package.json");
2443
2772
  }
2444
2773
  function getPluginPath(pluginName) {
2445
- return path5.join(getProjectRoot(), "node_modules", pluginName);
2774
+ return path8.join(getProjectRoot(), "node_modules", pluginName);
2446
2775
  }
2447
- function readPackageJson() {
2776
+ function readPackageJson2() {
2448
2777
  const pkgPath = getPackageJsonPath();
2449
- if (!fs7.existsSync(pkgPath)) {
2778
+ if (!fs10.existsSync(pkgPath)) {
2450
2779
  throw new Error("package.json not found in current directory");
2451
2780
  }
2452
2781
  try {
2453
- const content = fs7.readFileSync(pkgPath, "utf-8");
2782
+ const content = fs10.readFileSync(pkgPath, "utf-8");
2454
2783
  return JSON.parse(content);
2455
2784
  } catch {
2456
2785
  throw new Error("Failed to parse package.json");
2457
2786
  }
2458
2787
  }
2459
- function writePackageJson(pkg2) {
2788
+ function writePackageJson2(pkg2) {
2460
2789
  const pkgPath = getPackageJsonPath();
2461
- fs7.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
2790
+ fs10.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
2462
2791
  }
2463
2792
  function readActionPlugins() {
2464
- const pkg2 = readPackageJson();
2793
+ const pkg2 = readPackageJson2();
2465
2794
  return pkg2.actionPlugins || {};
2466
2795
  }
2467
2796
  function writeActionPlugins(plugins) {
2468
- const pkg2 = readPackageJson();
2797
+ const pkg2 = readPackageJson2();
2469
2798
  pkg2.actionPlugins = plugins;
2470
- writePackageJson(pkg2);
2799
+ writePackageJson2(pkg2);
2471
2800
  }
2472
2801
  function isPluginInstalled(pluginName) {
2473
2802
  const plugins = readActionPlugins();
@@ -2479,7 +2808,7 @@ function getInstalledPluginVersion(pluginName) {
2479
2808
  }
2480
2809
  function npmInstall(tgzPath) {
2481
2810
  console.log(`[action-plugin] Running npm install ${tgzPath}...`);
2482
- const result = spawnSync2("npm", ["install", tgzPath, "--no-save", "--no-package-lock", "--ignore-scripts"], {
2811
+ const result = spawnSync4("npm", ["install", tgzPath, "--no-save", "--no-package-lock", "--ignore-scripts"], {
2483
2812
  cwd: getProjectRoot(),
2484
2813
  stdio: "inherit"
2485
2814
  });
@@ -2491,12 +2820,12 @@ function npmInstall(tgzPath) {
2491
2820
  }
2492
2821
  }
2493
2822
  function getPackageVersion(pluginName) {
2494
- const pkgJsonPath = path5.join(getPluginPath(pluginName), "package.json");
2495
- if (!fs7.existsSync(pkgJsonPath)) {
2823
+ const pkgJsonPath = path8.join(getPluginPath(pluginName), "package.json");
2824
+ if (!fs10.existsSync(pkgJsonPath)) {
2496
2825
  return null;
2497
2826
  }
2498
2827
  try {
2499
- const content = fs7.readFileSync(pkgJsonPath, "utf-8");
2828
+ const content = fs10.readFileSync(pkgJsonPath, "utf-8");
2500
2829
  const pkg2 = JSON.parse(content);
2501
2830
  return pkg2.version || null;
2502
2831
  } catch {
@@ -2504,49 +2833,49 @@ function getPackageVersion(pluginName) {
2504
2833
  }
2505
2834
  }
2506
2835
  function readPluginPackageJson(pluginPath) {
2507
- const pkgJsonPath = path5.join(pluginPath, "package.json");
2508
- if (!fs7.existsSync(pkgJsonPath)) {
2836
+ const pkgJsonPath = path8.join(pluginPath, "package.json");
2837
+ if (!fs10.existsSync(pkgJsonPath)) {
2509
2838
  return null;
2510
2839
  }
2511
2840
  try {
2512
- const content = fs7.readFileSync(pkgJsonPath, "utf-8");
2841
+ const content = fs10.readFileSync(pkgJsonPath, "utf-8");
2513
2842
  return JSON.parse(content);
2514
2843
  } catch {
2515
2844
  return null;
2516
2845
  }
2517
2846
  }
2518
2847
  function extractTgzToNodeModules(tgzPath, pluginName) {
2519
- const nodeModulesPath = path5.join(getProjectRoot(), "node_modules");
2520
- const targetDir = path5.join(nodeModulesPath, pluginName);
2521
- const scopeDir = path5.dirname(targetDir);
2522
- if (!fs7.existsSync(scopeDir)) {
2523
- fs7.mkdirSync(scopeDir, { recursive: true });
2848
+ const nodeModulesPath = path8.join(getProjectRoot(), "node_modules");
2849
+ const targetDir = path8.join(nodeModulesPath, pluginName);
2850
+ const scopeDir = path8.dirname(targetDir);
2851
+ if (!fs10.existsSync(scopeDir)) {
2852
+ fs10.mkdirSync(scopeDir, { recursive: true });
2524
2853
  }
2525
- if (fs7.existsSync(targetDir)) {
2526
- fs7.rmSync(targetDir, { recursive: true });
2854
+ if (fs10.existsSync(targetDir)) {
2855
+ fs10.rmSync(targetDir, { recursive: true });
2527
2856
  }
2528
- const tempDir = path5.join(nodeModulesPath, ".cache", "fullstack-cli", "extract-temp");
2529
- if (fs7.existsSync(tempDir)) {
2530
- fs7.rmSync(tempDir, { recursive: true });
2857
+ const tempDir = path8.join(nodeModulesPath, ".cache", "fullstack-cli", "extract-temp");
2858
+ if (fs10.existsSync(tempDir)) {
2859
+ fs10.rmSync(tempDir, { recursive: true });
2531
2860
  }
2532
- fs7.mkdirSync(tempDir, { recursive: true });
2861
+ fs10.mkdirSync(tempDir, { recursive: true });
2533
2862
  try {
2534
- execSync(`tar -xzf "${tgzPath}" -C "${tempDir}"`, { stdio: "pipe" });
2535
- const extractedDir = path5.join(tempDir, "package");
2536
- if (fs7.existsSync(extractedDir)) {
2537
- fs7.renameSync(extractedDir, targetDir);
2863
+ execSync2(`tar -xzf "${tgzPath}" -C "${tempDir}"`, { stdio: "pipe" });
2864
+ const extractedDir = path8.join(tempDir, "package");
2865
+ if (fs10.existsSync(extractedDir)) {
2866
+ fs10.renameSync(extractedDir, targetDir);
2538
2867
  } else {
2539
- const files = fs7.readdirSync(tempDir);
2868
+ const files = fs10.readdirSync(tempDir);
2540
2869
  if (files.length === 1) {
2541
- fs7.renameSync(path5.join(tempDir, files[0]), targetDir);
2870
+ fs10.renameSync(path8.join(tempDir, files[0]), targetDir);
2542
2871
  } else {
2543
2872
  throw new Error("Unexpected tgz structure");
2544
2873
  }
2545
2874
  }
2546
2875
  return targetDir;
2547
2876
  } finally {
2548
- if (fs7.existsSync(tempDir)) {
2549
- fs7.rmSync(tempDir, { recursive: true });
2877
+ if (fs10.existsSync(tempDir)) {
2878
+ fs10.rmSync(tempDir, { recursive: true });
2550
2879
  }
2551
2880
  }
2552
2881
  }
@@ -2555,10 +2884,10 @@ function checkMissingPeerDeps(peerDeps) {
2555
2884
  return [];
2556
2885
  }
2557
2886
  const missing = [];
2558
- const nodeModulesPath = path5.join(getProjectRoot(), "node_modules");
2887
+ const nodeModulesPath = path8.join(getProjectRoot(), "node_modules");
2559
2888
  for (const [depName, _version] of Object.entries(peerDeps)) {
2560
- const depPath = path5.join(nodeModulesPath, depName);
2561
- if (!fs7.existsSync(depPath)) {
2889
+ const depPath = path8.join(nodeModulesPath, depName);
2890
+ if (!fs10.existsSync(depPath)) {
2562
2891
  missing.push(depName);
2563
2892
  }
2564
2893
  }
@@ -2569,7 +2898,7 @@ function installMissingDeps(deps) {
2569
2898
  return;
2570
2899
  }
2571
2900
  console.log(`[action-plugin] Installing missing dependencies: ${deps.join(", ")}`);
2572
- const result = spawnSync2("npm", ["install", ...deps, "--no-save", "--no-package-lock"], {
2901
+ const result = spawnSync4("npm", ["install", ...deps, "--no-save", "--no-package-lock"], {
2573
2902
  cwd: getProjectRoot(),
2574
2903
  stdio: "inherit"
2575
2904
  });
@@ -2582,76 +2911,16 @@ function installMissingDeps(deps) {
2582
2911
  }
2583
2912
  function removePluginDirectory(pluginName) {
2584
2913
  const pluginPath = getPluginPath(pluginName);
2585
- if (fs7.existsSync(pluginPath)) {
2586
- fs7.rmSync(pluginPath, { recursive: true });
2914
+ if (fs10.existsSync(pluginPath)) {
2915
+ fs10.rmSync(pluginPath, { recursive: true });
2587
2916
  console.log(`[action-plugin] Removed ${pluginName}`);
2588
2917
  }
2589
2918
  }
2590
2919
 
2591
2920
  // src/commands/action-plugin/api-client.ts
2592
2921
  import { HttpClient as HttpClient2 } from "@lark-apaas/http-client";
2593
- import fs8 from "fs";
2594
- import path6 from "path";
2595
-
2596
- // src/utils/http-client.ts
2597
- import { HttpClient } from "@lark-apaas/http-client";
2598
- var clientInstance = null;
2599
- function getHttpClient() {
2600
- if (!clientInstance) {
2601
- clientInstance = new HttpClient({
2602
- timeout: 3e4,
2603
- platform: {
2604
- enabled: true
2605
- }
2606
- });
2607
- const canaryEnv = process.env.FORCE_FRAMEWORK_CLI_CANARY_ENV;
2608
- if (canaryEnv) {
2609
- clientInstance.interceptors.request.use((req) => {
2610
- req.headers["x-tt-env"] = canaryEnv;
2611
- return req;
2612
- });
2613
- }
2614
- }
2615
- return clientInstance;
2616
- }
2617
-
2618
- // src/utils/telemetry.ts
2619
- async function reportEvents(events) {
2620
- if (events.length === 0) {
2621
- return true;
2622
- }
2623
- try {
2624
- const client = getHttpClient();
2625
- const response = await client.post("/resource_events", {
2626
- body: JSON.stringify({ events })
2627
- });
2628
- if (!response.ok) {
2629
- console.warn(`[telemetry] Failed to report events: ${response.status} ${response.statusText}`);
2630
- return false;
2631
- }
2632
- const result = await response.json();
2633
- if (result.status_code !== "0") {
2634
- console.warn(`[telemetry] API error: ${result.message}`);
2635
- return false;
2636
- }
2637
- return true;
2638
- } catch (error) {
2639
- console.warn(`[telemetry] Failed to report events: ${error instanceof Error ? error.message : error}`);
2640
- return false;
2641
- }
2642
- }
2643
- async function reportInstallEvent(pluginKey, version) {
2644
- await reportEvents([
2645
- {
2646
- resourceType: "plugin",
2647
- resourceKey: pluginKey,
2648
- eventType: "install",
2649
- details: { version }
2650
- }
2651
- ]);
2652
- }
2653
-
2654
- // src/commands/action-plugin/api-client.ts
2922
+ import fs11 from "fs";
2923
+ import path9 from "path";
2655
2924
  var PLUGIN_CACHE_DIR = "node_modules/.cache/fullstack-cli/plugins";
2656
2925
  async function getPluginVersions(keys, latestOnly = true) {
2657
2926
  const client = getHttpClient();
@@ -2715,19 +2984,19 @@ async function downloadFromPublic(downloadURL) {
2715
2984
  return Buffer.from(arrayBuffer);
2716
2985
  }
2717
2986
  function getPluginCacheDir() {
2718
- return path6.join(process.cwd(), PLUGIN_CACHE_DIR);
2987
+ return path9.join(process.cwd(), PLUGIN_CACHE_DIR);
2719
2988
  }
2720
2989
  function ensureCacheDir() {
2721
2990
  const cacheDir = getPluginCacheDir();
2722
- if (!fs8.existsSync(cacheDir)) {
2723
- fs8.mkdirSync(cacheDir, { recursive: true });
2991
+ if (!fs11.existsSync(cacheDir)) {
2992
+ fs11.mkdirSync(cacheDir, { recursive: true });
2724
2993
  }
2725
2994
  }
2726
2995
  function getTempFilePath(pluginKey, version) {
2727
2996
  ensureCacheDir();
2728
2997
  const safeKey = pluginKey.replace(/[/@]/g, "_");
2729
2998
  const filename = `${safeKey}@${version}.tgz`;
2730
- return path6.join(getPluginCacheDir(), filename);
2999
+ return path9.join(getPluginCacheDir(), filename);
2731
3000
  }
2732
3001
  var MAX_RETRIES = 2;
2733
3002
  async function withRetry(operation, description, maxRetries = MAX_RETRIES) {
@@ -2764,7 +3033,7 @@ async function downloadPlugin(pluginKey, requestedVersion) {
2764
3033
  );
2765
3034
  }
2766
3035
  const tgzPath = getTempFilePath(pluginKey, pluginInfo.version);
2767
- fs8.writeFileSync(tgzPath, tgzBuffer);
3036
+ fs11.writeFileSync(tgzPath, tgzBuffer);
2768
3037
  console.log(`[action-plugin] Downloaded to ${tgzPath} (${(tgzBuffer.length / 1024).toFixed(2)} KB)`);
2769
3038
  return {
2770
3039
  tgzPath,
@@ -2778,18 +3047,18 @@ function getCachePath(pluginKey, version) {
2778
3047
  ensureCacheDir();
2779
3048
  const safeKey = pluginKey.replace(/[/@]/g, "_");
2780
3049
  const filename = `${safeKey}@${version}.tgz`;
2781
- return path6.join(getPluginCacheDir(), filename);
3050
+ return path9.join(getPluginCacheDir(), filename);
2782
3051
  }
2783
3052
  function hasCachedPlugin(pluginKey, version) {
2784
3053
  const cachePath = getCachePath(pluginKey, version);
2785
- return fs8.existsSync(cachePath);
3054
+ return fs11.existsSync(cachePath);
2786
3055
  }
2787
3056
  function listCachedPlugins() {
2788
3057
  const cacheDir = getPluginCacheDir();
2789
- if (!fs8.existsSync(cacheDir)) {
3058
+ if (!fs11.existsSync(cacheDir)) {
2790
3059
  return [];
2791
3060
  }
2792
- const files = fs8.readdirSync(cacheDir);
3061
+ const files = fs11.readdirSync(cacheDir);
2793
3062
  const result = [];
2794
3063
  for (const file of files) {
2795
3064
  if (!file.endsWith(".tgz")) continue;
@@ -2797,8 +3066,8 @@ function listCachedPlugins() {
2797
3066
  if (!match) continue;
2798
3067
  const [, rawName, version] = match;
2799
3068
  const name = rawName.replace(/^_/, "@").replace(/_/, "/");
2800
- const filePath = path6.join(cacheDir, file);
2801
- const stat = fs8.statSync(filePath);
3069
+ const filePath = path9.join(cacheDir, file);
3070
+ const stat = fs11.statSync(filePath);
2802
3071
  result.push({
2803
3072
  name,
2804
3073
  version,
@@ -2811,14 +3080,14 @@ function listCachedPlugins() {
2811
3080
  }
2812
3081
  function cleanAllCache() {
2813
3082
  const cacheDir = getPluginCacheDir();
2814
- if (!fs8.existsSync(cacheDir)) {
3083
+ if (!fs11.existsSync(cacheDir)) {
2815
3084
  return 0;
2816
3085
  }
2817
- const files = fs8.readdirSync(cacheDir);
3086
+ const files = fs11.readdirSync(cacheDir);
2818
3087
  let count = 0;
2819
3088
  for (const file of files) {
2820
3089
  if (file.endsWith(".tgz")) {
2821
- fs8.unlinkSync(path6.join(cacheDir, file));
3090
+ fs11.unlinkSync(path9.join(cacheDir, file));
2822
3091
  count++;
2823
3092
  }
2824
3093
  }
@@ -2826,21 +3095,21 @@ function cleanAllCache() {
2826
3095
  }
2827
3096
  function cleanPluginCache(pluginKey, version) {
2828
3097
  const cacheDir = getPluginCacheDir();
2829
- if (!fs8.existsSync(cacheDir)) {
3098
+ if (!fs11.existsSync(cacheDir)) {
2830
3099
  return 0;
2831
3100
  }
2832
3101
  const safeKey = pluginKey.replace(/[/@]/g, "_");
2833
- const files = fs8.readdirSync(cacheDir);
3102
+ const files = fs11.readdirSync(cacheDir);
2834
3103
  let count = 0;
2835
3104
  for (const file of files) {
2836
3105
  if (version) {
2837
3106
  if (file === `${safeKey}@${version}.tgz`) {
2838
- fs8.unlinkSync(path6.join(cacheDir, file));
3107
+ fs11.unlinkSync(path9.join(cacheDir, file));
2839
3108
  count++;
2840
3109
  }
2841
3110
  } else {
2842
3111
  if (file.startsWith(`${safeKey}@`) && file.endsWith(".tgz")) {
2843
- fs8.unlinkSync(path6.join(cacheDir, file));
3112
+ fs11.unlinkSync(path9.join(cacheDir, file));
2844
3113
  count++;
2845
3114
  }
2846
3115
  }
@@ -2974,8 +3243,6 @@ async function installOne(nameWithVersion) {
2974
3243
  writeActionPlugins(plugins);
2975
3244
  const source = fromCache ? "from cache" : "downloaded";
2976
3245
  console.log(`[action-plugin] Successfully installed ${name}@${installedVersion} (${source})`);
2977
- reportInstallEvent(name, installedVersion).catch(() => {
2978
- });
2979
3246
  return { name, version: installedVersion, success: true };
2980
3247
  } catch (error) {
2981
3248
  const message = error instanceof Error ? error.message : String(error);
@@ -3261,40 +3528,40 @@ var actionPluginCommandGroup = {
3261
3528
  };
3262
3529
 
3263
3530
  // src/commands/capability/utils.ts
3264
- import fs9 from "fs";
3531
+ import fs12 from "fs";
3265
3532
  import { createRequire as createRequire2 } from "module";
3266
- import path7 from "path";
3533
+ import path10 from "path";
3267
3534
  var CAPABILITIES_DIR = "server/capabilities";
3268
3535
  function getProjectRoot2() {
3269
3536
  return process.cwd();
3270
3537
  }
3271
3538
  function getCapabilitiesDir() {
3272
- return path7.join(getProjectRoot2(), CAPABILITIES_DIR);
3539
+ return path10.join(getProjectRoot2(), CAPABILITIES_DIR);
3273
3540
  }
3274
3541
  function getCapabilityPath(id) {
3275
- return path7.join(getCapabilitiesDir(), `${id}.json`);
3542
+ return path10.join(getCapabilitiesDir(), `${id}.json`);
3276
3543
  }
3277
3544
  function getPluginManifestPath(pluginKey) {
3278
- return path7.join(getProjectRoot2(), "node_modules", pluginKey, "manifest.json");
3545
+ return path10.join(getProjectRoot2(), "node_modules", pluginKey, "manifest.json");
3279
3546
  }
3280
3547
  function capabilitiesDirExists() {
3281
- return fs9.existsSync(getCapabilitiesDir());
3548
+ return fs12.existsSync(getCapabilitiesDir());
3282
3549
  }
3283
3550
  function listCapabilityIds() {
3284
3551
  const dir = getCapabilitiesDir();
3285
- if (!fs9.existsSync(dir)) {
3552
+ if (!fs12.existsSync(dir)) {
3286
3553
  return [];
3287
3554
  }
3288
- const files = fs9.readdirSync(dir);
3555
+ const files = fs12.readdirSync(dir);
3289
3556
  return files.filter((f) => f.endsWith(".json") && f !== "capabilities.json").map((f) => f.replace(/\.json$/, ""));
3290
3557
  }
3291
3558
  function readCapability(id) {
3292
3559
  const filePath = getCapabilityPath(id);
3293
- if (!fs9.existsSync(filePath)) {
3560
+ if (!fs12.existsSync(filePath)) {
3294
3561
  throw new Error(`Capability not found: ${id}`);
3295
3562
  }
3296
3563
  try {
3297
- const content = fs9.readFileSync(filePath, "utf-8");
3564
+ const content = fs12.readFileSync(filePath, "utf-8");
3298
3565
  return JSON.parse(content);
3299
3566
  } catch (error) {
3300
3567
  if (error instanceof SyntaxError) {
@@ -3321,11 +3588,11 @@ function readAllCapabilities() {
3321
3588
  }
3322
3589
  function readPluginManifest(pluginKey) {
3323
3590
  const manifestPath = getPluginManifestPath(pluginKey);
3324
- if (!fs9.existsSync(manifestPath)) {
3591
+ if (!fs12.existsSync(manifestPath)) {
3325
3592
  throw new Error(`Plugin not installed: ${pluginKey} (manifest.json not found)`);
3326
3593
  }
3327
3594
  try {
3328
- const content = fs9.readFileSync(manifestPath, "utf-8");
3595
+ const content = fs12.readFileSync(manifestPath, "utf-8");
3329
3596
  return JSON.parse(content);
3330
3597
  } catch (error) {
3331
3598
  if (error instanceof SyntaxError) {
@@ -3342,7 +3609,7 @@ function hasValidParamsSchema(paramsSchema) {
3342
3609
  }
3343
3610
  async function loadPlugin(pluginKey) {
3344
3611
  try {
3345
- const userRequire = createRequire2(path7.join(getProjectRoot2(), "package.json"));
3612
+ const userRequire = createRequire2(path10.join(getProjectRoot2(), "package.json"));
3346
3613
  const resolvedPath = userRequire.resolve(pluginKey);
3347
3614
  const pluginModule = await import(resolvedPath);
3348
3615
  const pluginPackage = pluginModule.default ?? pluginModule;
@@ -3502,8 +3769,8 @@ var capabilityCommandGroup = {
3502
3769
  };
3503
3770
 
3504
3771
  // src/commands/component/registry-preparer.ts
3505
- import fs10 from "fs";
3506
- import path8 from "path";
3772
+ import fs13 from "fs";
3773
+ import path11 from "path";
3507
3774
  import os from "os";
3508
3775
 
3509
3776
  // src/commands/component/service.ts
@@ -3559,7 +3826,7 @@ async function sendInstallEvent(key) {
3559
3826
  }
3560
3827
 
3561
3828
  // src/commands/component/registry-preparer.ts
3562
- var REGISTRY_TEMP_DIR = path8.join(os.tmpdir(), "miaoda-registry");
3829
+ var REGISTRY_TEMP_DIR = path11.join(os.tmpdir(), "miaoda-registry");
3563
3830
  function parseComponentKey(key) {
3564
3831
  const match = key.match(/^@([^/]+)\/(.+)$/);
3565
3832
  if (!match) {
@@ -3571,11 +3838,11 @@ function parseComponentKey(key) {
3571
3838
  }
3572
3839
  function getLocalRegistryPath(key) {
3573
3840
  const { scope, name } = parseComponentKey(key);
3574
- return path8.join(REGISTRY_TEMP_DIR, scope, `${name}.json`);
3841
+ return path11.join(REGISTRY_TEMP_DIR, scope, `${name}.json`);
3575
3842
  }
3576
3843
  function ensureDir(dirPath) {
3577
- if (!fs10.existsSync(dirPath)) {
3578
- fs10.mkdirSync(dirPath, { recursive: true });
3844
+ if (!fs13.existsSync(dirPath)) {
3845
+ fs13.mkdirSync(dirPath, { recursive: true });
3579
3846
  }
3580
3847
  }
3581
3848
  async function prepareRecursive(key, visited) {
@@ -3608,8 +3875,8 @@ async function prepareRecursive(key, visited) {
3608
3875
  registryDependencies: deps.map((dep) => getLocalRegistryPath(dep))
3609
3876
  };
3610
3877
  const localPath = getLocalRegistryPath(key);
3611
- ensureDir(path8.dirname(localPath));
3612
- fs10.writeFileSync(localPath, JSON.stringify(rewrittenItem, null, 2), "utf-8");
3878
+ ensureDir(path11.dirname(localPath));
3879
+ fs13.writeFileSync(localPath, JSON.stringify(rewrittenItem, null, 2), "utf-8");
3613
3880
  debug("\u4FDD\u5B58\u5230: %s", localPath);
3614
3881
  }
3615
3882
  async function prepareComponentRegistryItems(id) {
@@ -3619,18 +3886,18 @@ async function prepareComponentRegistryItems(id) {
3619
3886
  }
3620
3887
  function cleanupTempDir() {
3621
3888
  try {
3622
- if (fs10.existsSync(REGISTRY_TEMP_DIR)) {
3623
- fs10.rmSync(REGISTRY_TEMP_DIR, { recursive: true, force: true });
3889
+ if (fs13.existsSync(REGISTRY_TEMP_DIR)) {
3890
+ fs13.rmSync(REGISTRY_TEMP_DIR, { recursive: true, force: true });
3624
3891
  }
3625
3892
  } catch {
3626
3893
  }
3627
3894
  }
3628
3895
  function getDownloadedRegistryItem(itemId) {
3629
3896
  const localPath = getLocalRegistryPath(itemId);
3630
- if (!fs10.existsSync(localPath)) {
3897
+ if (!fs13.existsSync(localPath)) {
3631
3898
  return null;
3632
3899
  }
3633
- const content = fs10.readFileSync(localPath, "utf-8");
3900
+ const content = fs13.readFileSync(localPath, "utf-8");
3634
3901
  return JSON.parse(content);
3635
3902
  }
3636
3903
 
@@ -3787,58 +4054,58 @@ var componentCommandGroup = {
3787
4054
  };
3788
4055
 
3789
4056
  // src/commands/migration/version-manager.ts
3790
- import fs11 from "fs";
3791
- import path9 from "path";
4057
+ import fs14 from "fs";
4058
+ import path12 from "path";
3792
4059
  var PACKAGE_JSON = "package.json";
3793
4060
  var VERSION_FIELD = "migrationVersion";
3794
4061
  function getPackageJsonPath2() {
3795
- return path9.join(process.cwd(), PACKAGE_JSON);
4062
+ return path12.join(process.cwd(), PACKAGE_JSON);
3796
4063
  }
3797
4064
  function getCurrentVersion() {
3798
4065
  const pkgPath = getPackageJsonPath2();
3799
- if (!fs11.existsSync(pkgPath)) {
4066
+ if (!fs14.existsSync(pkgPath)) {
3800
4067
  throw new Error("package.json not found");
3801
4068
  }
3802
- const pkg2 = JSON.parse(fs11.readFileSync(pkgPath, "utf-8"));
4069
+ const pkg2 = JSON.parse(fs14.readFileSync(pkgPath, "utf-8"));
3803
4070
  return pkg2[VERSION_FIELD] ?? 0;
3804
4071
  }
3805
4072
  function setCurrentVersion(version) {
3806
4073
  const pkgPath = getPackageJsonPath2();
3807
- const pkg2 = JSON.parse(fs11.readFileSync(pkgPath, "utf-8"));
4074
+ const pkg2 = JSON.parse(fs14.readFileSync(pkgPath, "utf-8"));
3808
4075
  pkg2[VERSION_FIELD] = version;
3809
- fs11.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
4076
+ fs14.writeFileSync(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
3810
4077
  }
3811
4078
 
3812
4079
  // src/commands/migration/versions/v001_capability/json-migrator/detector.ts
3813
- import fs13 from "fs";
3814
- import path11 from "path";
4080
+ import fs16 from "fs";
4081
+ import path14 from "path";
3815
4082
 
3816
4083
  // src/commands/migration/versions/v001_capability/utils.ts
3817
- import fs12 from "fs";
3818
- import path10 from "path";
4084
+ import fs15 from "fs";
4085
+ import path13 from "path";
3819
4086
  var CAPABILITIES_DIR2 = "server/capabilities";
3820
4087
  function getProjectRoot3() {
3821
4088
  return process.cwd();
3822
4089
  }
3823
4090
  function getCapabilitiesDir2() {
3824
- return path10.join(getProjectRoot3(), CAPABILITIES_DIR2);
4091
+ return path13.join(getProjectRoot3(), CAPABILITIES_DIR2);
3825
4092
  }
3826
4093
  function getPluginManifestPath2(pluginKey) {
3827
- return path10.join(getProjectRoot3(), "node_modules", pluginKey, "manifest.json");
4094
+ return path13.join(getProjectRoot3(), "node_modules", pluginKey, "manifest.json");
3828
4095
  }
3829
4096
 
3830
4097
  // src/commands/migration/versions/v001_capability/json-migrator/detector.ts
3831
4098
  function detectJsonMigration() {
3832
4099
  const capabilitiesDir = getCapabilitiesDir2();
3833
- const oldFilePath = path11.join(capabilitiesDir, "capabilities.json");
3834
- if (!fs13.existsSync(oldFilePath)) {
4100
+ const oldFilePath = path14.join(capabilitiesDir, "capabilities.json");
4101
+ if (!fs16.existsSync(oldFilePath)) {
3835
4102
  return {
3836
4103
  needsMigration: false,
3837
4104
  reason: "capabilities.json not found"
3838
4105
  };
3839
4106
  }
3840
4107
  try {
3841
- const content = fs13.readFileSync(oldFilePath, "utf-8");
4108
+ const content = fs16.readFileSync(oldFilePath, "utf-8");
3842
4109
  const parsed = JSON.parse(content);
3843
4110
  if (!Array.isArray(parsed)) {
3844
4111
  return {
@@ -3889,8 +4156,8 @@ async function check(options) {
3889
4156
  }
3890
4157
 
3891
4158
  // src/commands/migration/versions/v001_capability/json-migrator/index.ts
3892
- import fs14 from "fs";
3893
- import path12 from "path";
4159
+ import fs17 from "fs";
4160
+ import path15 from "path";
3894
4161
 
3895
4162
  // src/commands/migration/versions/v001_capability/mapping.ts
3896
4163
  var DEFAULT_PLUGIN_VERSION = "1.0.0";
@@ -4120,18 +4387,18 @@ function transformCapabilities(oldCapabilities) {
4120
4387
  // src/commands/migration/versions/v001_capability/json-migrator/index.ts
4121
4388
  function loadExistingCapabilities() {
4122
4389
  const capabilitiesDir = getCapabilitiesDir2();
4123
- if (!fs14.existsSync(capabilitiesDir)) {
4390
+ if (!fs17.existsSync(capabilitiesDir)) {
4124
4391
  return [];
4125
4392
  }
4126
- const files = fs14.readdirSync(capabilitiesDir);
4393
+ const files = fs17.readdirSync(capabilitiesDir);
4127
4394
  const capabilities = [];
4128
4395
  for (const file of files) {
4129
4396
  if (file === "capabilities.json" || !file.endsWith(".json")) {
4130
4397
  continue;
4131
4398
  }
4132
4399
  try {
4133
- const filePath = path12.join(capabilitiesDir, file);
4134
- const content = fs14.readFileSync(filePath, "utf-8");
4400
+ const filePath = path15.join(capabilitiesDir, file);
4401
+ const content = fs17.readFileSync(filePath, "utf-8");
4135
4402
  const capability = JSON.parse(content);
4136
4403
  if (capability.id && capability.pluginKey) {
4137
4404
  capabilities.push(capability);
@@ -4189,9 +4456,9 @@ async function migrateJsonFiles(options) {
4189
4456
  }
4190
4457
  const capabilitiesDir = getCapabilitiesDir2();
4191
4458
  for (const cap of newCapabilities) {
4192
- const filePath = path12.join(capabilitiesDir, `${cap.id}.json`);
4459
+ const filePath = path15.join(capabilitiesDir, `${cap.id}.json`);
4193
4460
  const content = JSON.stringify(cap, null, 2);
4194
- fs14.writeFileSync(filePath, content, "utf-8");
4461
+ fs17.writeFileSync(filePath, content, "utf-8");
4195
4462
  console.log(` \u2713 Created: ${cap.id}.json`);
4196
4463
  }
4197
4464
  return {
@@ -4203,11 +4470,11 @@ async function migrateJsonFiles(options) {
4203
4470
  }
4204
4471
 
4205
4472
  // src/commands/migration/versions/v001_capability/plugin-installer/detector.ts
4206
- import fs15 from "fs";
4473
+ import fs18 from "fs";
4207
4474
  function isPluginInstalled2(pluginKey) {
4208
4475
  const actionPlugins = readActionPlugins();
4209
4476
  const manifestPath = getPluginManifestPath2(pluginKey);
4210
- return fs15.existsSync(manifestPath) && !!actionPlugins[pluginKey];
4477
+ return fs18.existsSync(manifestPath) && !!actionPlugins[pluginKey];
4211
4478
  }
4212
4479
  function detectPluginsToInstall(capabilities) {
4213
4480
  const pluginKeys = /* @__PURE__ */ new Set();
@@ -4283,12 +4550,12 @@ async function installPlugins(capabilities, options) {
4283
4550
  }
4284
4551
 
4285
4552
  // src/commands/migration/versions/v001_capability/code-migrator/index.ts
4286
- import path14 from "path";
4553
+ import path17 from "path";
4287
4554
  import { Project as Project3 } from "ts-morph";
4288
4555
 
4289
4556
  // src/commands/migration/versions/v001_capability/code-migrator/scanner.ts
4290
- import fs16 from "fs";
4291
- import path13 from "path";
4557
+ import fs19 from "fs";
4558
+ import path16 from "path";
4292
4559
  var EXCLUDED_DIRS = [
4293
4560
  "node_modules",
4294
4561
  "dist",
@@ -4303,9 +4570,9 @@ var EXCLUDED_PATTERNS = [
4303
4570
  /\.d\.ts$/
4304
4571
  ];
4305
4572
  function scanDirectory(dir, files = []) {
4306
- const entries = fs16.readdirSync(dir, { withFileTypes: true });
4573
+ const entries = fs19.readdirSync(dir, { withFileTypes: true });
4307
4574
  for (const entry of entries) {
4308
- const fullPath = path13.join(dir, entry.name);
4575
+ const fullPath = path16.join(dir, entry.name);
4309
4576
  if (entry.isDirectory()) {
4310
4577
  if (EXCLUDED_DIRS.includes(entry.name)) {
4311
4578
  continue;
@@ -4321,14 +4588,14 @@ function scanDirectory(dir, files = []) {
4321
4588
  return files;
4322
4589
  }
4323
4590
  function scanServerFiles() {
4324
- const serverDir = path13.join(getProjectRoot3(), "server");
4325
- if (!fs16.existsSync(serverDir)) {
4591
+ const serverDir = path16.join(getProjectRoot3(), "server");
4592
+ if (!fs19.existsSync(serverDir)) {
4326
4593
  return [];
4327
4594
  }
4328
4595
  return scanDirectory(serverDir);
4329
4596
  }
4330
4597
  function hasCapabilityImport(filePath) {
4331
- const content = fs16.readFileSync(filePath, "utf-8");
4598
+ const content = fs19.readFileSync(filePath, "utf-8");
4332
4599
  return /import\s+.*from\s+['"][^'"]*capabilities[^'"]*['"]/.test(content);
4333
4600
  }
4334
4601
  function scanFilesToMigrate() {
@@ -4705,7 +4972,7 @@ function analyzeFile(project, filePath, actionNameMap) {
4705
4972
  const callSites = analyzeCallSites(sourceFile, imports);
4706
4973
  const classInfo = analyzeClass(sourceFile);
4707
4974
  const { canMigrate, reason } = canAutoMigrate(classInfo);
4708
- const relativePath = path14.relative(getProjectRoot3(), filePath);
4975
+ const relativePath = path17.relative(getProjectRoot3(), filePath);
4709
4976
  return {
4710
4977
  filePath: relativePath,
4711
4978
  imports,
@@ -4716,7 +4983,7 @@ function analyzeFile(project, filePath, actionNameMap) {
4716
4983
  };
4717
4984
  }
4718
4985
  function migrateFile(project, analysis, dryRun) {
4719
- const absolutePath = path14.join(getProjectRoot3(), analysis.filePath);
4986
+ const absolutePath = path17.join(getProjectRoot3(), analysis.filePath);
4720
4987
  if (!analysis.canAutoMigrate) {
4721
4988
  return {
4722
4989
  filePath: analysis.filePath,
@@ -4819,17 +5086,17 @@ function getSuggestion(analysis) {
4819
5086
  }
4820
5087
 
4821
5088
  // src/commands/migration/versions/v001_capability/cleanup.ts
4822
- import fs17 from "fs";
4823
- import path15 from "path";
5089
+ import fs20 from "fs";
5090
+ import path18 from "path";
4824
5091
  function cleanupOldFiles(capabilities, dryRun) {
4825
5092
  const deletedFiles = [];
4826
5093
  const errors = [];
4827
5094
  const capabilitiesDir = getCapabilitiesDir2();
4828
- const oldJsonPath = path15.join(capabilitiesDir, "capabilities.json");
4829
- if (fs17.existsSync(oldJsonPath)) {
5095
+ const oldJsonPath = path18.join(capabilitiesDir, "capabilities.json");
5096
+ if (fs20.existsSync(oldJsonPath)) {
4830
5097
  try {
4831
5098
  if (!dryRun) {
4832
- fs17.unlinkSync(oldJsonPath);
5099
+ fs20.unlinkSync(oldJsonPath);
4833
5100
  }
4834
5101
  deletedFiles.push("capabilities.json");
4835
5102
  } catch (error) {
@@ -4837,11 +5104,11 @@ function cleanupOldFiles(capabilities, dryRun) {
4837
5104
  }
4838
5105
  }
4839
5106
  for (const cap of capabilities) {
4840
- const tsFilePath = path15.join(capabilitiesDir, `${cap.id}.ts`);
4841
- if (fs17.existsSync(tsFilePath)) {
5107
+ const tsFilePath = path18.join(capabilitiesDir, `${cap.id}.ts`);
5108
+ if (fs20.existsSync(tsFilePath)) {
4842
5109
  try {
4843
5110
  if (!dryRun) {
4844
- fs17.unlinkSync(tsFilePath);
5111
+ fs20.unlinkSync(tsFilePath);
4845
5112
  }
4846
5113
  deletedFiles.push(`${cap.id}.ts`);
4847
5114
  } catch (error) {
@@ -4857,8 +5124,8 @@ function cleanupOldFiles(capabilities, dryRun) {
4857
5124
  }
4858
5125
 
4859
5126
  // src/commands/migration/versions/v001_capability/report-generator.ts
4860
- import fs18 from "fs";
4861
- import path16 from "path";
5127
+ import fs21 from "fs";
5128
+ import path19 from "path";
4862
5129
  var REPORT_FILE = "capability-migration-report.md";
4863
5130
  function printSummary(result) {
4864
5131
  const { jsonMigration, pluginInstallation, codeMigration, cleanup } = result;
@@ -5021,15 +5288,15 @@ async function generateReport(result) {
5021
5288
  }
5022
5289
  lines.push("");
5023
5290
  const logDir = process.env.LOG_DIR || "logs";
5024
- if (!fs18.existsSync(logDir)) {
5291
+ if (!fs21.existsSync(logDir)) {
5025
5292
  return;
5026
5293
  }
5027
- const reportDir = path16.join(logDir, "migration");
5028
- if (!fs18.existsSync(reportDir)) {
5029
- fs18.mkdirSync(reportDir, { recursive: true });
5294
+ const reportDir = path19.join(logDir, "migration");
5295
+ if (!fs21.existsSync(reportDir)) {
5296
+ fs21.mkdirSync(reportDir, { recursive: true });
5030
5297
  }
5031
- const reportPath = path16.join(reportDir, REPORT_FILE);
5032
- fs18.writeFileSync(reportPath, lines.join("\n"), "utf-8");
5298
+ const reportPath = path19.join(reportDir, REPORT_FILE);
5299
+ fs21.writeFileSync(reportPath, lines.join("\n"), "utf-8");
5033
5300
  console.log(`\u{1F4C4} Report generated: ${reportPath}`);
5034
5301
  }
5035
5302
 
@@ -5206,7 +5473,7 @@ function buildResult(jsonMigration, pluginInstallation, codeMigration, cleanup)
5206
5473
  }
5207
5474
 
5208
5475
  // src/commands/migration/versions/v001_capability/run.ts
5209
- async function run3(options) {
5476
+ async function run5(options) {
5210
5477
  try {
5211
5478
  const migrationOptions = {
5212
5479
  dryRun: options.dryRun ?? false
@@ -5271,7 +5538,7 @@ var v001CapabilityMigration = {
5271
5538
  name: "capability",
5272
5539
  description: "Migrate capability configurations from old format (capabilities.json array) to new format (individual JSON files)",
5273
5540
  check,
5274
- run: run3
5541
+ run: run5
5275
5542
  };
5276
5543
 
5277
5544
  // src/commands/migration/versions/index.ts
@@ -5561,10 +5828,10 @@ var migrationCommand = {
5561
5828
  };
5562
5829
 
5563
5830
  // src/commands/read-logs/index.ts
5564
- import path17 from "path";
5831
+ import path20 from "path";
5565
5832
 
5566
5833
  // src/commands/read-logs/std-utils.ts
5567
- import fs19 from "fs";
5834
+ import fs22 from "fs";
5568
5835
  function formatStdPrefixTime(localTime) {
5569
5836
  const match = localTime.match(/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/);
5570
5837
  if (!match) return localTime;
@@ -5594,11 +5861,11 @@ function stripPrefixFromStdLine(line) {
5594
5861
  return `[${time}] ${content}`;
5595
5862
  }
5596
5863
  function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarker) {
5597
- const stat = fs19.statSync(filePath);
5864
+ const stat = fs22.statSync(filePath);
5598
5865
  if (stat.size === 0) {
5599
5866
  return { lines: [], markerFound: false, totalLinesCount: 0 };
5600
5867
  }
5601
- const fd = fs19.openSync(filePath, "r");
5868
+ const fd = fs22.openSync(filePath, "r");
5602
5869
  const chunkSize = 64 * 1024;
5603
5870
  let position = stat.size;
5604
5871
  let remainder = "";
@@ -5612,7 +5879,7 @@ function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarke
5612
5879
  const length = Math.min(chunkSize, position);
5613
5880
  position -= length;
5614
5881
  const buffer = Buffer.alloc(length);
5615
- fs19.readSync(fd, buffer, 0, length, position);
5882
+ fs22.readSync(fd, buffer, 0, length, position);
5616
5883
  let chunk = buffer.toString("utf8");
5617
5884
  if (remainder) {
5618
5885
  chunk += remainder;
@@ -5654,7 +5921,7 @@ function readStdLinesTailFromLastMarkerPaged(filePath, maxLines, offset, isMarke
5654
5921
  }
5655
5922
  }
5656
5923
  } finally {
5657
- fs19.closeSync(fd);
5924
+ fs22.closeSync(fd);
5658
5925
  }
5659
5926
  return { lines: collected.reverse(), markerFound, totalLinesCount };
5660
5927
  }
@@ -5675,21 +5942,21 @@ function readServerStdSegment(filePath, maxLines, offset) {
5675
5942
  }
5676
5943
 
5677
5944
  // src/commands/read-logs/tail.ts
5678
- import fs20 from "fs";
5945
+ import fs23 from "fs";
5679
5946
  function fileExists(filePath) {
5680
5947
  try {
5681
- fs20.accessSync(filePath, fs20.constants.F_OK | fs20.constants.R_OK);
5948
+ fs23.accessSync(filePath, fs23.constants.F_OK | fs23.constants.R_OK);
5682
5949
  return true;
5683
5950
  } catch {
5684
5951
  return false;
5685
5952
  }
5686
5953
  }
5687
5954
  function readFileTailLines(filePath, maxLines) {
5688
- const stat = fs20.statSync(filePath);
5955
+ const stat = fs23.statSync(filePath);
5689
5956
  if (stat.size === 0) {
5690
5957
  return [];
5691
5958
  }
5692
- const fd = fs20.openSync(filePath, "r");
5959
+ const fd = fs23.openSync(filePath, "r");
5693
5960
  const chunkSize = 64 * 1024;
5694
5961
  const chunks = [];
5695
5962
  let position = stat.size;
@@ -5699,13 +5966,13 @@ function readFileTailLines(filePath, maxLines) {
5699
5966
  const length = Math.min(chunkSize, position);
5700
5967
  position -= length;
5701
5968
  const buffer = Buffer.alloc(length);
5702
- fs20.readSync(fd, buffer, 0, length, position);
5969
+ fs23.readSync(fd, buffer, 0, length, position);
5703
5970
  chunks.unshift(buffer.toString("utf8"));
5704
5971
  const chunkLines = buffer.toString("utf8").split("\n").length - 1;
5705
5972
  collectedLines += chunkLines;
5706
5973
  }
5707
5974
  } finally {
5708
- fs20.closeSync(fd);
5975
+ fs23.closeSync(fd);
5709
5976
  }
5710
5977
  const content = chunks.join("");
5711
5978
  const allLines = content.split("\n");
@@ -5721,11 +5988,11 @@ function readFileTailLines(filePath, maxLines) {
5721
5988
  return allLines.slice(allLines.length - maxLines);
5722
5989
  }
5723
5990
  function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
5724
- const stat = fs20.statSync(filePath);
5991
+ const stat = fs23.statSync(filePath);
5725
5992
  if (stat.size === 0) {
5726
5993
  return { lines: [], totalLinesCount: 0 };
5727
5994
  }
5728
- const fd = fs20.openSync(filePath, "r");
5995
+ const fd = fs23.openSync(filePath, "r");
5729
5996
  const chunkSize = 64 * 1024;
5730
5997
  let position = stat.size;
5731
5998
  let remainder = "";
@@ -5737,7 +6004,7 @@ function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
5737
6004
  const length = Math.min(chunkSize, position);
5738
6005
  position -= length;
5739
6006
  const buffer = Buffer.alloc(length);
5740
- fs20.readSync(fd, buffer, 0, length, position);
6007
+ fs23.readSync(fd, buffer, 0, length, position);
5741
6008
  let chunk = buffer.toString("utf8");
5742
6009
  if (remainder) {
5743
6010
  chunk += remainder;
@@ -5768,7 +6035,7 @@ function readFileTailNonEmptyLinesWithOffset(filePath, maxLines, offset) {
5768
6035
  }
5769
6036
  }
5770
6037
  } finally {
5771
- fs20.closeSync(fd);
6038
+ fs23.closeSync(fd);
5772
6039
  }
5773
6040
  return { lines: collected.reverse(), totalLinesCount };
5774
6041
  }
@@ -5910,7 +6177,7 @@ function readDevStdSegment(filePath, maxLines, offset) {
5910
6177
  }
5911
6178
 
5912
6179
  // src/commands/read-logs/json-lines.ts
5913
- import fs21 from "fs";
6180
+ import fs24 from "fs";
5914
6181
  function normalizePid(value) {
5915
6182
  if (typeof value === "number") {
5916
6183
  return String(value);
@@ -5961,11 +6228,11 @@ function buildWantedLevelSet(levels) {
5961
6228
  return set.size > 0 ? set : null;
5962
6229
  }
5963
6230
  function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
5964
- const stat = fs21.statSync(filePath);
6231
+ const stat = fs24.statSync(filePath);
5965
6232
  if (stat.size === 0) {
5966
6233
  return { lines: [], totalLinesCount: 0 };
5967
6234
  }
5968
- const fd = fs21.openSync(filePath, "r");
6235
+ const fd = fs24.openSync(filePath, "r");
5969
6236
  const chunkSize = 64 * 1024;
5970
6237
  let position = stat.size;
5971
6238
  let remainder = "";
@@ -5980,7 +6247,7 @@ function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
5980
6247
  const length = Math.min(chunkSize, position);
5981
6248
  position -= length;
5982
6249
  const buffer = Buffer.alloc(length);
5983
- fs21.readSync(fd, buffer, 0, length, position);
6250
+ fs24.readSync(fd, buffer, 0, length, position);
5984
6251
  let chunk = buffer.toString("utf8");
5985
6252
  if (remainder) {
5986
6253
  chunk += remainder;
@@ -6042,7 +6309,7 @@ function readJsonLinesLastPid(filePath, maxLines, offset, levels) {
6042
6309
  }
6043
6310
  }
6044
6311
  } finally {
6045
- fs21.closeSync(fd);
6312
+ fs24.closeSync(fd);
6046
6313
  }
6047
6314
  return { lines: collected.reverse(), totalLinesCount };
6048
6315
  }
@@ -6085,11 +6352,11 @@ function extractTraceId(obj) {
6085
6352
  function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
6086
6353
  const wanted = traceId.trim();
6087
6354
  if (!wanted) return { lines: [], totalLinesCount: 0 };
6088
- const stat = fs21.statSync(filePath);
6355
+ const stat = fs24.statSync(filePath);
6089
6356
  if (stat.size === 0) {
6090
6357
  return { lines: [], totalLinesCount: 0 };
6091
6358
  }
6092
- const fd = fs21.openSync(filePath, "r");
6359
+ const fd = fs24.openSync(filePath, "r");
6093
6360
  const chunkSize = 64 * 1024;
6094
6361
  let position = stat.size;
6095
6362
  let remainder = "";
@@ -6102,7 +6369,7 @@ function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
6102
6369
  const length = Math.min(chunkSize, position);
6103
6370
  position -= length;
6104
6371
  const buffer = Buffer.alloc(length);
6105
- fs21.readSync(fd, buffer, 0, length, position);
6372
+ fs24.readSync(fd, buffer, 0, length, position);
6106
6373
  let chunk = buffer.toString("utf8");
6107
6374
  if (remainder) {
6108
6375
  chunk += remainder;
@@ -6155,7 +6422,7 @@ function readJsonLinesByTraceId(filePath, traceId, maxLines, offset, levels) {
6155
6422
  }
6156
6423
  }
6157
6424
  } finally {
6158
- fs21.closeSync(fd);
6425
+ fs24.closeSync(fd);
6159
6426
  }
6160
6427
  return { lines: collected.reverse(), totalLinesCount };
6161
6428
  }
@@ -6164,11 +6431,11 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
6164
6431
  if (!wantedLevelSet) {
6165
6432
  return { lines: [], totalLinesCount: 0 };
6166
6433
  }
6167
- const stat = fs21.statSync(filePath);
6434
+ const stat = fs24.statSync(filePath);
6168
6435
  if (stat.size === 0) {
6169
6436
  return { lines: [], totalLinesCount: 0 };
6170
6437
  }
6171
- const fd = fs21.openSync(filePath, "r");
6438
+ const fd = fs24.openSync(filePath, "r");
6172
6439
  const chunkSize = 64 * 1024;
6173
6440
  let position = stat.size;
6174
6441
  let remainder = "";
@@ -6180,7 +6447,7 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
6180
6447
  const length = Math.min(chunkSize, position);
6181
6448
  position -= length;
6182
6449
  const buffer = Buffer.alloc(length);
6183
- fs21.readSync(fd, buffer, 0, length, position);
6450
+ fs24.readSync(fd, buffer, 0, length, position);
6184
6451
  let chunk = buffer.toString("utf8");
6185
6452
  if (remainder) {
6186
6453
  chunk += remainder;
@@ -6227,7 +6494,7 @@ function readJsonLinesTailByLevel(filePath, maxLines, offset, levels) {
6227
6494
  }
6228
6495
  }
6229
6496
  } finally {
6230
- fs21.closeSync(fd);
6497
+ fs24.closeSync(fd);
6231
6498
  }
6232
6499
  return { lines: collected.reverse(), totalLinesCount };
6233
6500
  }
@@ -6461,34 +6728,34 @@ async function readLogsJsonResult(options) {
6461
6728
  };
6462
6729
  }
6463
6730
  function resolveLogFilePath(logDir, type) {
6464
- const base = path17.isAbsolute(logDir) ? logDir : path17.join(process.cwd(), logDir);
6731
+ const base = path20.isAbsolute(logDir) ? logDir : path20.join(process.cwd(), logDir);
6465
6732
  if (type === "server") {
6466
- return path17.join(base, "server.log");
6733
+ return path20.join(base, "server.log");
6467
6734
  }
6468
6735
  if (type === "trace") {
6469
- return path17.join(base, "trace.log");
6736
+ return path20.join(base, "trace.log");
6470
6737
  }
6471
6738
  if (type === "server-std") {
6472
- return path17.join(base, "server.std.log");
6739
+ return path20.join(base, "server.std.log");
6473
6740
  }
6474
6741
  if (type === "client-std") {
6475
- return path17.join(base, "client.std.log");
6742
+ return path20.join(base, "client.std.log");
6476
6743
  }
6477
6744
  if (type === "dev") {
6478
- return path17.join(base, "dev.log");
6745
+ return path20.join(base, "dev.log");
6479
6746
  }
6480
6747
  if (type === "dev-std") {
6481
- return path17.join(base, "dev.std.log");
6748
+ return path20.join(base, "dev.std.log");
6482
6749
  }
6483
6750
  if (type === "install-dep-std") {
6484
- return path17.join(base, "install-dep.std.log");
6751
+ return path20.join(base, "install-dep.std.log");
6485
6752
  }
6486
6753
  if (type === "browser") {
6487
- return path17.join(base, "browser.log");
6754
+ return path20.join(base, "browser.log");
6488
6755
  }
6489
6756
  throw new Error(`Unsupported log type: ${type}`);
6490
6757
  }
6491
- async function run4(options) {
6758
+ async function run6(options) {
6492
6759
  const result = await readLogsJsonResult(options);
6493
6760
  process.stdout.write(JSON.stringify(result) + "\n");
6494
6761
  }
@@ -6530,7 +6797,7 @@ var readLogsCommand = {
6530
6797
  const offset = parseNonNegativeInt(rawOptions.offset, "--offset");
6531
6798
  const traceId = typeof rawOptions.traceId === "string" ? rawOptions.traceId : void 0;
6532
6799
  const levels = parseCommaSeparatedList(rawOptions.level);
6533
- await run4({ logDir, type, maxLines, offset, traceId, levels });
6800
+ await run6({ logDir, type, maxLines, offset, traceId, levels });
6534
6801
  } catch (error) {
6535
6802
  const message = error instanceof Error ? error.message : String(error);
6536
6803
  process.stderr.write(message + "\n");
@@ -6540,100 +6807,25 @@ var readLogsCommand = {
6540
6807
  }
6541
6808
  };
6542
6809
 
6543
- // src/commands/build/types.ts
6544
- var SCENE_CONFIGS = {
6545
- pipeline: {
6546
- name: "pipeline",
6547
- requiredOptions: ["commitId"],
6548
- buildRequestBody: (opts) => ({ commitID: opts.commitId })
6549
- },
6550
- static: {
6551
- name: "static",
6552
- requiredOptions: [],
6553
- buildRequestBody: () => ({ commitID: "" })
6554
- }
6555
- };
6556
-
6557
- // src/commands/build/api-client.ts
6558
- async function genArtifactUploadCredential(appId, body) {
6559
- const client = getHttpClient();
6560
- const url = `/v1/app/${appId}/pipeline/gen_artifact_upload_credential`;
6561
- const response = await client.post(url, body);
6562
- if (!response.ok || response.status !== 200) {
6563
- throw new Error(
6564
- `API request failed: ${response.status} ${response.statusText}`
6565
- );
6566
- }
6567
- return response.json();
6568
- }
6569
-
6570
- // src/commands/build/get-token.handler.ts
6571
- async function getToken(options) {
6572
- try {
6573
- const sceneConfig = SCENE_CONFIGS[options.scene];
6574
- if (!sceneConfig) {
6575
- const available = Object.keys(SCENE_CONFIGS).join(", ");
6576
- console.error(
6577
- `[build] Error: invalid scene "${options.scene}". Available scenes: ${available}`
6578
- );
6579
- process.exit(1);
6580
- }
6581
- for (const key of sceneConfig.requiredOptions) {
6582
- if (!options[key]) {
6583
- console.error(
6584
- `[build] Error: --${camelToKebab(key)} is required for scene "${options.scene}"`
6585
- );
6586
- process.exit(1);
6587
- }
6588
- }
6589
- const body = sceneConfig.buildRequestBody(options);
6590
- const response = await genArtifactUploadCredential(options.appId, body);
6591
- console.log(JSON.stringify(response));
6592
- } catch (error) {
6593
- const message = error instanceof Error ? error.message : String(error);
6594
- console.error(`[build] Error: ${message}`);
6595
- process.exit(1);
6596
- }
6597
- }
6598
- function camelToKebab(str) {
6599
- return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
6600
- }
6601
-
6602
- // src/commands/build/index.ts
6603
- var getTokenCommand = {
6604
- name: "get-token",
6605
- description: "Get artifact upload credential (STI token)",
6606
- register(program) {
6607
- program.command(this.name).description(this.description).requiredOption("--app-id <id>", "Application ID").requiredOption("--scene <scene>", "Build scene (pipeline, static)").option("--commit-id <id>", "Git commit ID (required for pipeline scene)").action(async (options) => {
6608
- await getToken(options);
6609
- });
6610
- }
6611
- };
6612
- var buildCommandGroup = {
6613
- name: "build",
6614
- description: "Build related commands",
6615
- commands: [getTokenCommand]
6616
- };
6617
-
6618
6810
  // src/commands/index.ts
6619
6811
  var commands = [
6620
6812
  genDbSchemaCommand,
6621
6813
  syncCommand,
6814
+ upgradeCommand,
6622
6815
  actionPluginCommandGroup,
6623
6816
  capabilityCommandGroup,
6624
6817
  componentCommandGroup,
6625
6818
  migrationCommand,
6626
- readLogsCommand,
6627
- buildCommandGroup
6819
+ readLogsCommand
6628
6820
  ];
6629
6821
 
6630
6822
  // src/index.ts
6631
- var envPath = path18.join(process.cwd(), ".env");
6632
- if (fs22.existsSync(envPath)) {
6823
+ var envPath = path21.join(process.cwd(), ".env");
6824
+ if (fs25.existsSync(envPath)) {
6633
6825
  dotenvConfig({ path: envPath });
6634
6826
  }
6635
- var __dirname = path18.dirname(fileURLToPath4(import.meta.url));
6636
- var pkg = JSON.parse(fs22.readFileSync(path18.join(__dirname, "../package.json"), "utf-8"));
6827
+ var __dirname = path21.dirname(fileURLToPath5(import.meta.url));
6828
+ var pkg = JSON.parse(fs25.readFileSync(path21.join(__dirname, "../package.json"), "utf-8"));
6637
6829
  var cli = new FullstackCLI(pkg.version);
6638
6830
  cli.useAll(commands);
6639
6831
  cli.run();