ai-project-manage-cli 8.1.24 → 8.1.26

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
@@ -568,8 +568,6 @@ async function runLogin(opts) {
568
568
 
569
569
  // src/commands/update.ts
570
570
  import { spawnSync } from "child_process";
571
- import { existsSync as existsSync3 } from "fs";
572
- import { join as join5 } from "path";
573
571
 
574
572
  // src/version.ts
575
573
  import { readFileSync as readFileSync3 } from "fs";
@@ -588,7 +586,6 @@ function readCliVersion() {
588
586
  }
589
587
 
590
588
  // src/commands/update.ts
591
- var APM_SKIP_SELF_UPDATE_ENV = "APM_SKIP_SELF_UPDATE";
592
589
  var useNpmShell = process.platform === "win32";
593
590
  function runNpm(args, options = {}) {
594
591
  return spawnSync(useNpmShell ? "npm.cmd" : "npm", args, {
@@ -681,17 +678,10 @@ function npmAvailable() {
681
678
  return !r.error && r.status === 0;
682
679
  }
683
680
  async function runUpdate(options = {}) {
684
- if (process.env[APM_SKIP_SELF_UPDATE_ENV] === "1") {
685
- return { didUpdate: false };
686
- }
687
681
  const current = readCliVersion();
688
682
  const currentMajor = parseMajorVersion(current);
689
683
  const globalLatest = await fetchLatestPublishedVersion();
690
684
  const latestInMajor = options.allowMajorUpgrade ? null : await fetchLatestPublishedVersionInMajor(currentMajor);
691
- if (options.quietIfCurrent && !options.allowMajorUpgrade && !latestInMajor && !globalLatest) {
692
- console.warn(`[apm] \u65E0\u6CD5\u68C0\u6D4B\u6700\u65B0\u7248\u672C\uFF0C\u7EE7\u7EED\u4F7F\u7528\u5F53\u524D ${current}`);
693
- return { didUpdate: false };
694
- }
695
685
  const resolved = resolveUpdateTarget({
696
686
  current,
697
687
  allowMajorUpgrade: options.allowMajorUpgrade,
@@ -699,10 +689,8 @@ async function runUpdate(options = {}) {
699
689
  globalLatest
700
690
  });
701
691
  if (resolved.action === "skip") {
702
- if (!options.quietIfCurrent) {
703
- console.log(`[apm] \u5DF2\u662F\u6700\u65B0\u7248\u672C ${current}`);
704
- }
705
- return { didUpdate: false };
692
+ console.log(`[apm] \u5DF2\u662F\u6700\u65B0\u7248\u672C ${current}`);
693
+ return;
706
694
  }
707
695
  if (resolved.majorUpgradeAvailable) {
708
696
  console.log(
@@ -739,61 +727,14 @@ async function runUpdate(options = {}) {
739
727
  } else {
740
728
  console.log(`[apm] \u5DF2\u662F\u6700\u65B0\u7248\u672C ${current}`);
741
729
  }
742
- return { didUpdate: expectedBump };
743
- }
744
- function resolveApmEntryPath(entryArg = process.argv[1]) {
745
- const npmResult = runNpm(["root", "-g"], {
746
- encoding: "utf8",
747
- stdio: ["ignore", "pipe", "pipe"]
748
- });
749
- if (npmResult.status === 0) {
750
- const globalRoot = npmResult.stdout?.toString().trim();
751
- if (globalRoot) {
752
- const candidate = join5(globalRoot, CLI_PACKAGE_NAME, "dist", "index.js");
753
- if (existsSync3(candidate)) {
754
- return candidate;
755
- }
756
- }
757
- }
758
- const fromArgv = entryArg?.trim();
759
- if (fromArgv && existsSync3(fromArgv)) {
760
- return fromArgv;
761
- }
762
- if (fromArgv) {
763
- return fromArgv;
764
- }
765
- console.error("[apm] \u65E0\u6CD5\u89E3\u6790 apm \u5165\u53E3\u8DEF\u5F84");
766
- process.exit(1);
767
- }
768
- function reexecConnectAfterUpdate(options) {
769
- console.log("[apm] \u66F4\u65B0\u5B8C\u6210\uFF0C\u6B63\u5728\u4EE5\u65B0\u7248\u672C\u91CD\u65B0\u8FDE\u63A5\u2026");
770
- const apmScript = resolveApmEntryPath();
771
- const args = [apmScript, "connect"];
772
- const server = options.server?.trim();
773
- if (server) {
774
- args.push("--server", server);
775
- }
776
- const socketServer = options.socketServer?.trim();
777
- if (socketServer) {
778
- args.push("--socket-server", socketServer);
779
- }
780
- const result = spawnSync(process.execPath, args, {
781
- stdio: "inherit",
782
- env: { ...process.env, [APM_SKIP_SELF_UPDATE_ENV]: "1" }
783
- });
784
- if (result.error) {
785
- console.error("[apm] \u91CD\u542F connect \u5931\u8D25:", result.error.message);
786
- process.exit(1);
787
- }
788
- process.exit(result.status ?? 0);
789
730
  }
790
731
 
791
732
  // src/commands/update-skills.ts
792
- import { existsSync as existsSync4, statSync as statSync2 } from "fs";
733
+ import { existsSync as existsSync3, statSync as statSync2 } from "fs";
793
734
  async function syncWorkspaceSkills(workdir) {
794
735
  const apmDir = workspaceApmDir(workdir);
795
736
  const fsApmDir = toFsPath(apmDir);
796
- if (!existsSync4(fsApmDir)) {
737
+ if (!existsSync3(fsApmDir)) {
797
738
  throw new Error("[apm] \u672A\u627E\u5230 .apm \u76EE\u5F55\uFF0C\u8BF7\u5148\u6267\u884C apm init");
798
739
  }
799
740
  const apmStat = statSync2(fsApmDir);
@@ -808,7 +749,7 @@ async function syncWorkspaceSkills(workdir) {
808
749
  }
809
750
  async function runUpdateSkills() {
810
751
  const apmDir = workspaceApmDir();
811
- if (!existsSync4(apmDir)) {
752
+ if (!existsSync3(apmDir)) {
812
753
  console.error("[apm] \u672A\u627E\u5230 .apm \u76EE\u5F55\uFF0C\u8BF7\u5148\u6267\u884C apm init");
813
754
  process.exit(1);
814
755
  }
@@ -961,7 +902,7 @@ function handleSteerAction(payload, ctx) {
961
902
  }
962
903
 
963
904
  // src/commands/connect/core/worker/worker.ts
964
- import { dirname as dirname2, join as join6 } from "path";
905
+ import { dirname as dirname2, join as join5 } from "path";
965
906
  import { fileURLToPath as fileURLToPath2 } from "url";
966
907
  import { Worker } from "node:worker_threads";
967
908
 
@@ -987,7 +928,7 @@ function resolveWebIdeWorkerHeapMb(env = process.env, totalMemoryBytes = totalme
987
928
  }
988
929
 
989
930
  // src/commands/connect/core/worker/worker.ts
990
- var workerFile = join6(
931
+ var workerFile = join5(
991
932
  dirname2(fileURLToPath2(import.meta.url)),
992
933
  "worker-script.js"
993
934
  );
@@ -1153,15 +1094,15 @@ function dispatchConnectAction(payload, ctx) {
1153
1094
 
1154
1095
  // src/commands/connect-lock.ts
1155
1096
  import {
1156
- existsSync as existsSync5,
1097
+ existsSync as existsSync4,
1157
1098
  mkdirSync as mkdirSync4,
1158
1099
  readFileSync as readFileSync4,
1159
1100
  unlinkSync as unlinkSync2,
1160
1101
  writeFileSync as writeFileSync3
1161
1102
  } from "fs";
1162
1103
  import { setTimeout as delay } from "node:timers/promises";
1163
- import { join as join7 } from "path";
1164
- var CONNECT_LOCK_PATH = join7(APM_CONFIG_DIR, "connect.lock");
1104
+ import { join as join6 } from "path";
1105
+ var CONNECT_LOCK_PATH = join6(APM_CONFIG_DIR, "connect.lock");
1165
1106
  var ACQUIRE_RETRY_MS = 5e3;
1166
1107
  var ACQUIRE_RETRY_INTERVAL_MS = 200;
1167
1108
  function isProcessAlive(pid) {
@@ -1174,7 +1115,7 @@ function isProcessAlive(pid) {
1174
1115
  }
1175
1116
  }
1176
1117
  function readConnectLock() {
1177
- if (!existsSync5(CONNECT_LOCK_PATH)) return null;
1118
+ if (!existsSync4(CONNECT_LOCK_PATH)) return null;
1178
1119
  try {
1179
1120
  const raw = readFileSync4(CONNECT_LOCK_PATH, "utf8");
1180
1121
  const parsed = JSON.parse(raw);
@@ -1322,10 +1263,6 @@ function connectOnce(url, ctx, connectionAbort, onConnected) {
1322
1263
  });
1323
1264
  }
1324
1265
  async function runConnect(options) {
1325
- const { didUpdate } = await runUpdate({ quietIfCurrent: true });
1326
- if (didUpdate) {
1327
- reexecConnectAfterUpdate(options);
1328
- }
1329
1266
  const cfg = await ensureLoggedConfig();
1330
1267
  const endpoints = resolveApmEndpoints({
1331
1268
  server: options.server,
@@ -1431,8 +1368,8 @@ async function runConnect(options) {
1431
1368
  }
1432
1369
 
1433
1370
  // src/utils/home-repository.ts
1434
- import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
1435
- import { join as join8, resolve as resolve3 } from "path";
1371
+ import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
1372
+ import { join as join7, resolve as resolve3 } from "path";
1436
1373
  var DEFAULT_REPOS_MANIFEST = "/home/repository.json";
1437
1374
  function isSimpleChildDirName(name) {
1438
1375
  if (!name || name === "." || name === "..") return false;
@@ -1455,7 +1392,7 @@ function loadHomeRepositoryEntries(manifestPath2) {
1455
1392
  throw new Error("[apm] \u591A\u4ED3\u6E05\u5355\u8DEF\u5F84\u4E3A\u7A7A");
1456
1393
  }
1457
1394
  const path = toFsPath(label);
1458
- if (!existsSync6(path)) {
1395
+ if (!existsSync5(path)) {
1459
1396
  throw new Error(`[apm] \u672A\u627E\u5230\u591A\u4ED3\u6E05\u5355 ${label}`);
1460
1397
  }
1461
1398
  let parsed;
@@ -1495,12 +1432,12 @@ function loadHomeRepositoryEntries(manifestPath2) {
1495
1432
  }
1496
1433
  function resolveHomeRepositoryAbsolutePaths(workdirInput, entries) {
1497
1434
  const workdir = resolveWorkdirPath(workdirInput);
1498
- return entries.map((entry) => resolve3(join8(workdir, entry.path)));
1435
+ return entries.map((entry) => resolve3(join7(workdir, entry.path)));
1499
1436
  }
1500
1437
 
1501
1438
  // src/utils/git.ts
1502
1439
  import { execFile } from "child_process";
1503
- import { dirname as dirname3, join as join9 } from "path";
1440
+ import { dirname as dirname3, join as join8 } from "path";
1504
1441
  import { fileURLToPath as fileURLToPath3 } from "url";
1505
1442
  import { promisify } from "util";
1506
1443
  var execFileAsync = promisify(execFile);
@@ -1584,7 +1521,7 @@ async function resolveGitRepoRoot(cwd) {
1584
1521
  return (await execGit(cwd, ["rev-parse", "--show-toplevel"], true)).trim();
1585
1522
  }
1586
1523
  function resolveGitScript(name) {
1587
- return join9(dirname3(fileURLToPath3(import.meta.url)), "scripts", name);
1524
+ return join8(dirname3(fileURLToPath3(import.meta.url)), "scripts", name);
1588
1525
  }
1589
1526
  async function runGitScript(name, options) {
1590
1527
  const skipCode = options.skipCode ?? 2;
@@ -1641,16 +1578,19 @@ async function pushCurrentBranch(cwd) {
1641
1578
  });
1642
1579
  }
1643
1580
 
1581
+ // src/commands/branch.ts
1582
+ import { basename as basename2 } from "path";
1583
+
1644
1584
  // src/utils/workspace-repos.ts
1645
1585
  import {
1646
- existsSync as existsSync7,
1586
+ existsSync as existsSync6,
1647
1587
  mkdirSync as mkdirSync5,
1648
1588
  readFileSync as readFileSync6,
1649
1589
  readdirSync as readdirSync3,
1650
1590
  statSync as statSync3,
1651
1591
  writeFileSync as writeFileSync4
1652
1592
  } from "fs";
1653
- import { basename, dirname as dirname4, join as join10, relative, resolve as resolve4 } from "path";
1593
+ import { basename, dirname as dirname4, join as join9, relative, resolve as resolve4 } from "path";
1654
1594
 
1655
1595
  // src/utils/git-remote.ts
1656
1596
  import { execFile as execFile2 } from "child_process";
@@ -1661,7 +1601,7 @@ var execFileAsync2 = promisify2(execFile2);
1661
1601
  var WORKSPACE_REPOS_MANIFEST = "workspace-repos.json";
1662
1602
  var WORKSPACE_REPOS_VERSION = 1;
1663
1603
  function manifestPath(workdir) {
1664
- return join10(workspaceApmDir(workdir), WORKSPACE_REPOS_MANIFEST);
1604
+ return join9(workspaceApmDir(workdir), WORKSPACE_REPOS_MANIFEST);
1665
1605
  }
1666
1606
  function absoluteRepoPath(workdir, entry) {
1667
1607
  return resolve4(workdir, entry.path);
@@ -1685,7 +1625,7 @@ function normalizeRepoEntry(raw) {
1685
1625
  }
1686
1626
  function readManifest(workdir) {
1687
1627
  const path = toFsPath(manifestPath(workdir));
1688
- if (!existsSync7(path)) {
1628
+ if (!existsSync6(path)) {
1689
1629
  return null;
1690
1630
  }
1691
1631
  try {
@@ -1754,6 +1694,7 @@ function formatRepoLabel(workdir, repoAbs) {
1754
1694
  }
1755
1695
 
1756
1696
  // src/commands/branch.ts
1697
+ import { existsSync as existsSync7 } from "fs";
1757
1698
  var TASK_BRANCH_PREFIX = "feat/task-";
1758
1699
  async function syncTaskRepos(workdir, options = {}) {
1759
1700
  const opts = typeof options === "string" ? { message: options } : options;
@@ -1825,9 +1766,12 @@ async function ensureTaskFeatureBranch(branch, projectId, options) {
1825
1766
  await ensureFeatureBranch(gitRoot, branch, projectId);
1826
1767
  return branch;
1827
1768
  }
1769
+ function isWorkspaceReposManifestFile(manifestPath2) {
1770
+ return basename2(manifestPath2.replace(/\\/g, "/")) === WORKSPACE_REPOS_MANIFEST;
1771
+ }
1828
1772
  function resolveTaskBranchRepoRoots(workdirPath, reposManifest) {
1829
1773
  const manifestPath2 = resolveReposManifestPath(reposManifest);
1830
- if (manifestPath2) {
1774
+ if (manifestPath2 && !isWorkspaceReposManifestFile(manifestPath2)) {
1831
1775
  const entries = loadHomeRepositoryEntries(manifestPath2);
1832
1776
  const roots2 = resolveHomeRepositoryAbsolutePaths(workdirPath, entries);
1833
1777
  console.log(
@@ -1835,6 +1779,13 @@ function resolveTaskBranchRepoRoots(workdirPath, reposManifest) {
1835
1779
  );
1836
1780
  return roots2;
1837
1781
  }
1782
+ if (manifestPath2 && isWorkspaceReposManifestFile(manifestPath2)) {
1783
+ const fsPath = toFsPath(manifestPath2);
1784
+ if (!existsSync7(fsPath)) {
1785
+ throw new Error(`[apm] \u672A\u627E\u5230\u5DE5\u4F5C\u533A\u4ED3\u5E93\u6E05\u5355 ${manifestPath2}`);
1786
+ }
1787
+ console.log(`[apm] \u4F7F\u7528\u663E\u5F0F\u5DE5\u4F5C\u533A\u4ED3\u5E93\u6E05\u5355 ${manifestPath2}`);
1788
+ }
1838
1789
  const workspace = loadWorkspaceReposCache(workdirPath);
1839
1790
  const roots = resolveWorkspaceRepoAbsolutePaths(workspace);
1840
1791
  console.log(
@@ -1920,9 +1871,9 @@ async function runEnsureTaskBranchCli(options = {}) {
1920
1871
  // src/utils/user-prompt-cache.ts
1921
1872
  import { createHash } from "crypto";
1922
1873
  import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
1923
- import { join as join11 } from "path";
1874
+ import { join as join10 } from "path";
1924
1875
  import { tmpdir } from "os";
1925
- var CACHE_ROOT = join11(tmpdir(), "apm-hooks");
1876
+ var CACHE_ROOT = join10(tmpdir(), "apm-hooks");
1926
1877
  var PROMPT_FILE = "user-prompt.txt";
1927
1878
  var COMMIT_SUBJECT_MAX_LEN = 100;
1928
1879
  function workdirKey(workdir) {
@@ -1930,7 +1881,7 @@ function workdirKey(workdir) {
1930
1881
  }
1931
1882
  function userPromptCachePath(workdirInput) {
1932
1883
  const workdir = resolveWorkdirPath(workdirInput);
1933
- return join11(CACHE_ROOT, workdirKey(workdir), PROMPT_FILE);
1884
+ return join10(CACHE_ROOT, workdirKey(workdir), PROMPT_FILE);
1934
1885
  }
1935
1886
  function formatUserPromptAsCommitMessage(prompt) {
1936
1887
  const oneLine = prompt.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n").map((l) => l.trim()).find((l) => l.length > 0);
@@ -1991,7 +1942,7 @@ async function runCommitTaskReposCli(options = {}) {
1991
1942
  );
1992
1943
  if (result.failed.length > 0) {
1993
1944
  throw new Error(
1994
- `[apm] \u4EE5\u4E0B\u4ED3\u5E93 commit/push \u5931\u8D25: ${result.failed.join(", ")}`
1945
+ `[apm] \u591A\u4ED3\u6536\u5C3E\u90E8\u5206\u5931\u8D25: ${result.failed.join(", ")}`
1995
1946
  );
1996
1947
  }
1997
1948
  }
@@ -2066,7 +2017,7 @@ function buildProgram() {
2066
2017
  });
2067
2018
  });
2068
2019
  program.command("connect").description(
2069
- "\u8FDE\u63A5\u524D\u68C0\u6D4B\u5E76\u66F4\u65B0\u5230\u5F53\u524D\u5927\u7248\u672C\u6700\u65B0 CLI\uFF0C\u518D\u8FDE\u63A5\u5E73\u53F0 WebSocket\uFF08/ws/agent\uFF09"
2020
+ "\u8FDE\u63A5\u5E73\u53F0 WebSocket\uFF08/ws/agent\uFF09\uFF0C\u63A5\u624B WebIDE \u5DE5\u4F5C\u6D41\u6D88\u606F\uFF1B\u4E0D\u81EA\u52A8\u5347\u7EA7 CLI"
2070
2021
  ).option(
2071
2022
  "--server <url>",
2072
2023
  "API \u6839\u5730\u5740\uFF1B\u82E5\u53EA\u4F20\u6B64\u9879\u4E14\u5E26\u7AEF\u53E3\uFF0C\u5219\u7AEF\u53E3\u89C6\u4E3A Socket \u7AEF\u53E3\uFF08\u8986\u76D6 config / APM_SERVER\uFF09"
@@ -579,6 +579,9 @@ function resolveHomeRepositoryAbsolutePaths(workdirInput, entries) {
579
579
  return entries.map((entry) => resolve3(join4(workdir, entry.path)));
580
580
  }
581
581
 
582
+ // src/commands/branch.ts
583
+ import { basename as basename2 } from "path";
584
+
582
585
  // src/utils/workspace-repos.ts
583
586
  import {
584
587
  existsSync as existsSync3,
@@ -861,6 +864,7 @@ function formatRepoLabel(workdir, repoAbs) {
861
864
  }
862
865
 
863
866
  // src/commands/branch.ts
867
+ import { existsSync as existsSync4 } from "fs";
864
868
  var TASK_BRANCH_PREFIX = "feat/task-";
865
869
  async function commitWorkspaceReposIfDirty(workdir, message, reposManifest) {
866
870
  const result = await commitTaskReposIfDirty(workdir, message, reposManifest);
@@ -970,9 +974,12 @@ async function resolveProjectIdForTask(taskId) {
970
974
  }
971
975
  return projectId;
972
976
  }
977
+ function isWorkspaceReposManifestFile(manifestPath2) {
978
+ return basename2(manifestPath2.replace(/\\/g, "/")) === WORKSPACE_REPOS_MANIFEST;
979
+ }
973
980
  function resolveTaskBranchRepoRoots(workdirPath, reposManifest) {
974
981
  const manifestPath2 = resolveReposManifestPath(reposManifest);
975
- if (manifestPath2) {
982
+ if (manifestPath2 && !isWorkspaceReposManifestFile(manifestPath2)) {
976
983
  const entries = loadHomeRepositoryEntries(manifestPath2);
977
984
  const roots2 = resolveHomeRepositoryAbsolutePaths(workdirPath, entries);
978
985
  console.log(
@@ -980,6 +987,13 @@ function resolveTaskBranchRepoRoots(workdirPath, reposManifest) {
980
987
  );
981
988
  return roots2;
982
989
  }
990
+ if (manifestPath2 && isWorkspaceReposManifestFile(manifestPath2)) {
991
+ const fsPath = toFsPath(manifestPath2);
992
+ if (!existsSync4(fsPath)) {
993
+ throw new Error(`[apm] \u672A\u627E\u5230\u5DE5\u4F5C\u533A\u4ED3\u5E93\u6E05\u5355 ${manifestPath2}`);
994
+ }
995
+ console.log(`[apm] \u4F7F\u7528\u663E\u5F0F\u5DE5\u4F5C\u533A\u4ED3\u5E93\u6E05\u5355 ${manifestPath2}`);
996
+ }
983
997
  const workspace = loadWorkspaceReposCache(workdirPath);
984
998
  const roots = resolveWorkspaceRepoAbsolutePaths(workspace);
985
999
  console.log(
@@ -1690,7 +1704,7 @@ function createUpsertWebIdeTestCasesTool(options) {
1690
1704
  }
1691
1705
 
1692
1706
  // src/commands/connect/tools/mysql-tools.ts
1693
- import { existsSync as existsSync4, readFileSync as readFileSync4, statSync as statSync3 } from "node:fs";
1707
+ import { existsSync as existsSync5, readFileSync as readFileSync4, statSync as statSync3 } from "node:fs";
1694
1708
  import { isAbsolute, relative as relative2, resolve as resolve5 } from "node:path";
1695
1709
  import mysql from "mysql2/promise";
1696
1710
  var MAX_RESULT_ROWS = 100;
@@ -1769,7 +1783,7 @@ function resolveSqlArtifactPath(workdir, absolutePath) {
1769
1783
  return { ok: false, error: "path \u5FC5\u987B\u4F4D\u4E8E\u5F53\u524D\u5DE5\u4F5C\u533A\u5185" };
1770
1784
  }
1771
1785
  const fsPath = toFsPath(targetAbs);
1772
- if (!existsSync4(fsPath)) {
1786
+ if (!existsSync5(fsPath)) {
1773
1787
  return { ok: false, error: `\u6587\u4EF6\u4E0D\u5B58\u5728: ${absolutePath}` };
1774
1788
  }
1775
1789
  let st;
@@ -2644,14 +2658,14 @@ async function runCursorAgent(cfg2, ctx, options) {
2644
2658
  }
2645
2659
 
2646
2660
  // src/commands/connect/webide-agent-registry.ts
2647
- import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
2661
+ import { existsSync as existsSync6, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
2648
2662
  import { dirname as dirname3, resolve as resolve6 } from "node:path";
2649
2663
  function registryPath(workdir, taskId, fileName = "cursor-agent.json") {
2650
2664
  return resolve6(workdir, ".apm", "webide", taskId, fileName);
2651
2665
  }
2652
2666
  var DESIGN_AGENT_FILE = "design-agent.json";
2653
2667
  function readRegistry(path) {
2654
- if (!existsSync5(path)) {
2668
+ if (!existsSync6(path)) {
2655
2669
  return {};
2656
2670
  }
2657
2671
  try {
@@ -2726,7 +2740,7 @@ function saveWebIdeAgentId(workdir, taskId, agentId) {
2726
2740
  }
2727
2741
  function clearWebIdeAgentId(workdir, taskId) {
2728
2742
  const path = registryPath(workdir, taskId);
2729
- if (!existsSync5(path)) return;
2743
+ if (!existsSync6(path)) return;
2730
2744
  syncWebIdeTaskState(workdir, taskId, { agentId: "" });
2731
2745
  }
2732
2746
  function loadWebIdeDesignAgentId(workdir, taskId) {
@@ -2746,7 +2760,7 @@ function saveWebIdeDesignAgentId(workdir, taskId, agentId) {
2746
2760
  }
2747
2761
  function clearWebIdeDesignAgentId(workdir, taskId) {
2748
2762
  const path = registryPath(workdir, taskId, DESIGN_AGENT_FILE);
2749
- if (!existsSync5(path)) return;
2763
+ if (!existsSync6(path)) return;
2750
2764
  const current = readRegistry(path);
2751
2765
  const next = { ...current };
2752
2766
  delete next.agentId;
@@ -2802,24 +2816,27 @@ async function fetchAssumptionAnswersAndContinueAssessment(options) {
2802
2816
  if (ids.length === 0) {
2803
2817
  throw new Error("\u6CA1\u6709\u5DF2\u786E\u8BA4\u7684\u5047\u8BBE");
2804
2818
  }
2805
- const answers = [];
2819
+ const lines = [];
2820
+ if (title?.trim()) {
2821
+ lines.push(title.trim(), "");
2822
+ }
2823
+ let index = 0;
2806
2824
  for (const id of ids) {
2807
2825
  const row = byId.get(id);
2808
2826
  if (!row || row.status !== "RESOLVED") {
2809
2827
  throw new Error(`\u5047\u8BBE\u5C1A\u672A\u5168\u90E8\u786E\u8BA4: ${id}`);
2810
2828
  }
2811
- answers.push({
2812
- questionId: id,
2813
- prompt: row.prompt,
2814
- selectedOptionId: row.selectedOptionId,
2815
- customAnswer: row.customAnswer,
2816
- resolution: row.resolution
2817
- });
2829
+ const text = asString4(row.resolution) || asString4(row.customAnswer) || asString4(row.selectedOptionId);
2830
+ if (!text) {
2831
+ throw new Error(`\u5047\u8BBE\u7B54\u6848\u4E3A\u7A7A: ${id}`);
2832
+ }
2833
+ index += 1;
2834
+ lines.push(`${index}. ${text}`);
2818
2835
  }
2819
2836
  console.log(
2820
- `[apm] \u5047\u8BBE\u7ED3\u679C\u5DF2\u62C9\u53D6 taskId=${taskId} count=${answers.length}`
2837
+ `[apm] \u5047\u8BBE\u7ED3\u679C\u5DF2\u62C9\u53D6 taskId=${taskId} count=${index}`
2821
2838
  );
2822
- return JSON.stringify({ title, answers }, null, 2);
2839
+ return lines.join("\n");
2823
2840
  }
2824
2841
  function createWebIdeAskQuestionExecute(options) {
2825
2842
  const { cfg: cfg2, taskId, onAwaitingAssumptions } = options;
@@ -3083,7 +3100,7 @@ function resolveMessageReplyFallback(fallback) {
3083
3100
 
3084
3101
  // src/commands/sync-webide-agent.ts
3085
3102
  import {
3086
- existsSync as existsSync6,
3103
+ existsSync as existsSync7,
3087
3104
  mkdirSync as mkdirSync5,
3088
3105
  readdirSync as readdirSync3,
3089
3106
  readFileSync as readFileSync6,
@@ -3099,7 +3116,7 @@ function withTrailingNewline(text) {
3099
3116
  }
3100
3117
  function readRevision(apmDir) {
3101
3118
  const path = toFsPath(join6(apmDir, REVISION_FILE));
3102
- if (!existsSync6(path)) return null;
3119
+ if (!existsSync7(path)) return null;
3103
3120
  try {
3104
3121
  const parsed = JSON.parse(readFileSync6(path, "utf8"));
3105
3122
  if (parsed?.version === 1 && parsed.revision?.trim()) {
@@ -3400,7 +3417,7 @@ async function ensureWebIdePullRequests(cfg2, taskId, workdir) {
3400
3417
  }
3401
3418
 
3402
3419
  // src/commands/sync-webide-attachments.ts
3403
- import { existsSync as existsSync7, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
3420
+ import { existsSync as existsSync8, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
3404
3421
  import { join as join7 } from "path";
3405
3422
  var MANIFEST_FILE = ".sync-manifest.json";
3406
3423
  async function downloadAttachment(cfg2, attachmentId) {
@@ -3418,7 +3435,7 @@ async function downloadAttachment(cfg2, attachmentId) {
3418
3435
  }
3419
3436
  function loadManifest(dir) {
3420
3437
  const path = join7(dir, MANIFEST_FILE);
3421
- if (!existsSync7(path)) {
3438
+ if (!existsSync8(path)) {
3422
3439
  return { version: 1, attachments: {} };
3423
3440
  }
3424
3441
  try {
@@ -3441,7 +3458,7 @@ function saveManifest(dir, manifest) {
3441
3458
  );
3442
3459
  }
3443
3460
  function isAttachmentUpToDate(entry, item, dest) {
3444
- if (!entry || !existsSync7(dest)) return false;
3461
+ if (!entry || !existsSync8(dest)) return false;
3445
3462
  if (entry.name !== item.name) return false;
3446
3463
  const createdAt = item.createdAt ?? "";
3447
3464
  return entry.createdAt === createdAt;
@@ -3488,7 +3505,7 @@ async function syncWebIdeAttachments(cfg2, taskId, workdir, attachments) {
3488
3505
 
3489
3506
  // src/commands/sync-webide-design.ts
3490
3507
  import { createHash } from "crypto";
3491
- import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8, statSync as statSync4, writeFileSync as writeFileSync6 } from "fs";
3508
+ import { existsSync as existsSync9, readdirSync as readdirSync4, readFileSync as readFileSync8, statSync as statSync4, writeFileSync as writeFileSync6 } from "fs";
3492
3509
  import { join as join8 } from "path";
3493
3510
 
3494
3511
  // src/opc-shared-types.ts
@@ -3511,7 +3528,7 @@ function hashBuffer(buf) {
3511
3528
  }
3512
3529
  function loadManifest2(dir) {
3513
3530
  const path = join8(dir, MANIFEST_FILE2);
3514
- if (!existsSync8(path)) {
3531
+ if (!existsSync9(path)) {
3515
3532
  return { version: 1, files: {} };
3516
3533
  }
3517
3534
  try {
@@ -3555,7 +3572,7 @@ async function syncWebIdeDesign(cfg2, taskId, workdir, artifacts) {
3555
3572
  if (!name || !isWebIdeDesignArtifactName(name)) continue;
3556
3573
  const localPath = join8(dir, name);
3557
3574
  const entry = manifest.files[name];
3558
- if (entry?.contentHash === art.contentHash && existsSync8(localPath)) {
3575
+ if (entry?.contentHash === art.contentHash && existsSync9(localPath)) {
3559
3576
  continue;
3560
3577
  }
3561
3578
  const buf = await downloadDesignFile(cfg2, taskId, name);
@@ -3568,7 +3585,7 @@ async function syncWebIdeDesign(cfg2, taskId, workdir, artifacts) {
3568
3585
  }
3569
3586
  function listLocalDesignArtifactFiles(taskId, workdir) {
3570
3587
  const dir = webideDesignDir(taskId, workdir);
3571
- if (!existsSync8(dir)) return [];
3588
+ if (!existsSync9(dir)) return [];
3572
3589
  const out = [];
3573
3590
  for (const name of readdirSync4(dir)) {
3574
3591
  if (!isWebIdeDesignArtifactName(name)) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "8.1.24",
3
+ "version": "8.1.26",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,