ai-project-manage-cli 8.1.9 → 8.1.10

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
@@ -80,7 +80,14 @@ function buildAgentWsUrl(httpBase, apiKey) {
80
80
  }
81
81
 
82
82
  // src/commands/sync-webide-agent.ts
83
- import { existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
83
+ import {
84
+ existsSync as existsSync2,
85
+ mkdirSync as mkdirSync3,
86
+ readdirSync as readdirSync2,
87
+ readFileSync as readFileSync2,
88
+ unlinkSync,
89
+ writeFileSync as writeFileSync2
90
+ } from "fs";
84
91
  import { join as join3 } from "path";
85
92
 
86
93
  // src/api/client.ts
@@ -368,7 +375,7 @@ async function ensureWorkspaceApmDirForInit(cwd = resolveWorkdirPath()) {
368
375
 
369
376
  // src/commands/sync-webide-agent.ts
370
377
  var REVISION_FILE = ".webide-agent.json";
371
- var RULE_KEY = /^webide_[a-z0-9_]+$/;
378
+ var RULE_KEY = /^[a-z0-9_]+$/;
372
379
  function withTrailingNewline(text) {
373
380
  return text.endsWith("\n") ? text : `${text}
374
381
  `;
@@ -413,17 +420,24 @@ async function syncWebIdeAgentFiles(workdir, cfg) {
413
420
  withTrailingNewline(bundle.guide ?? ""),
414
421
  "utf8"
415
422
  );
423
+ const keep = /* @__PURE__ */ new Set();
416
424
  for (const rule of bundle.rules ?? []) {
417
425
  const key = rule.key?.trim() ?? "";
418
426
  if (!RULE_KEY.test(key)) {
419
427
  throw new Error(`[apm] \u975E\u6CD5\u89C4\u5219\u540D: ${key || "(\u7A7A)"}`);
420
428
  }
429
+ keep.add(`${key}.md`);
421
430
  writeFileSync2(
422
431
  toFsPath(join3(rulesDir, `${key}.md`)),
423
432
  withTrailingNewline(rule.body ?? ""),
424
433
  "utf8"
425
434
  );
426
435
  }
436
+ for (const name of readdirSync2(toFsPath(rulesDir))) {
437
+ if (!name.endsWith(".md")) continue;
438
+ if (keep.has(name)) continue;
439
+ unlinkSync(toFsPath(join3(rulesDir, name)));
440
+ }
427
441
  writeRevision(apmDir, revision);
428
442
  return {
429
443
  revision,
@@ -754,7 +768,7 @@ async function runUpdateSkills() {
754
768
  // src/utils/project-documents.ts
755
769
  import {
756
770
  existsSync as existsSync5,
757
- readdirSync as readdirSync2,
771
+ readdirSync as readdirSync3,
758
772
  readFileSync as readFileSync4,
759
773
  rmSync,
760
774
  writeFileSync as writeFileSync3
@@ -880,7 +894,7 @@ function listLocalDocumentPaths(apmRoot, projectId) {
880
894
  }
881
895
  const paths = [];
882
896
  const walk = (dir) => {
883
- for (const entry of readdirSync2(dir, { withFileTypes: true })) {
897
+ for (const entry of readdirSync3(dir, { withFileTypes: true })) {
884
898
  const abs = join6(dir, entry.name);
885
899
  if (entry.isDirectory()) {
886
900
  walk(abs);
@@ -1716,7 +1730,7 @@ import {
1716
1730
  existsSync as existsSync6,
1717
1731
  mkdirSync as mkdirSync4,
1718
1732
  readFileSync as readFileSync5,
1719
- unlinkSync,
1733
+ unlinkSync as unlinkSync2,
1720
1734
  writeFileSync as writeFileSync4
1721
1735
  } from "fs";
1722
1736
  import { join as join8 } from "path";
@@ -1751,7 +1765,7 @@ function pruneStaleConnectLock() {
1751
1765
  if (!lock) return;
1752
1766
  if (isProcessAlive(lock.pid)) return;
1753
1767
  try {
1754
- unlinkSync(CONNECT_LOCK_PATH);
1768
+ unlinkSync2(CONNECT_LOCK_PATH);
1755
1769
  } catch {
1756
1770
  }
1757
1771
  }
@@ -1780,7 +1794,7 @@ function releaseConnectLock() {
1780
1794
  const lock = readConnectLock();
1781
1795
  if (lock?.pid !== process.pid) return;
1782
1796
  try {
1783
- unlinkSync(CONNECT_LOCK_PATH);
1797
+ unlinkSync2(CONNECT_LOCK_PATH);
1784
1798
  } catch {
1785
1799
  }
1786
1800
  }
@@ -3138,10 +3138,17 @@ function createThrottledWebIdeMessageLogSync(cfg2, ctx, onError, options) {
3138
3138
  }
3139
3139
 
3140
3140
  // src/commands/sync-webide-agent.ts
3141
- import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
3141
+ import {
3142
+ existsSync as existsSync5,
3143
+ mkdirSync as mkdirSync4,
3144
+ readdirSync as readdirSync3,
3145
+ readFileSync as readFileSync4,
3146
+ unlinkSync,
3147
+ writeFileSync as writeFileSync3
3148
+ } from "fs";
3142
3149
  import { join as join4 } from "path";
3143
3150
  var REVISION_FILE = ".webide-agent.json";
3144
- var RULE_KEY = /^webide_[a-z0-9_]+$/;
3151
+ var RULE_KEY = /^[a-z0-9_]+$/;
3145
3152
  function withTrailingNewline(text) {
3146
3153
  return text.endsWith("\n") ? text : `${text}
3147
3154
  `;
@@ -3186,17 +3193,24 @@ async function syncWebIdeAgentFiles(workdir, cfg2) {
3186
3193
  withTrailingNewline(bundle.guide ?? ""),
3187
3194
  "utf8"
3188
3195
  );
3196
+ const keep = /* @__PURE__ */ new Set();
3189
3197
  for (const rule of bundle.rules ?? []) {
3190
3198
  const key = rule.key?.trim() ?? "";
3191
3199
  if (!RULE_KEY.test(key)) {
3192
3200
  throw new Error(`[apm] \u975E\u6CD5\u89C4\u5219\u540D: ${key || "(\u7A7A)"}`);
3193
3201
  }
3202
+ keep.add(`${key}.md`);
3194
3203
  writeFileSync3(
3195
3204
  toFsPath(join4(rulesDir, `${key}.md`)),
3196
3205
  withTrailingNewline(rule.body ?? ""),
3197
3206
  "utf8"
3198
3207
  );
3199
3208
  }
3209
+ for (const name of readdirSync3(toFsPath(rulesDir))) {
3210
+ if (!name.endsWith(".md")) continue;
3211
+ if (keep.has(name)) continue;
3212
+ unlinkSync(toFsPath(join4(rulesDir, name)));
3213
+ }
3200
3214
  writeRevision(apmDir, revision);
3201
3215
  return {
3202
3216
  revision,
@@ -3221,7 +3235,7 @@ async function ensureWorkspaceInitialized(workdir) {
3221
3235
  // src/utils/project-documents.ts
3222
3236
  import {
3223
3237
  existsSync as existsSync6,
3224
- readdirSync as readdirSync3,
3238
+ readdirSync as readdirSync4,
3225
3239
  readFileSync as readFileSync5,
3226
3240
  rmSync,
3227
3241
  writeFileSync as writeFileSync4
@@ -3287,7 +3301,7 @@ function listLocalDocumentPaths(apmRoot, projectId) {
3287
3301
  }
3288
3302
  const paths = [];
3289
3303
  const walk = (dir) => {
3290
- for (const entry of readdirSync3(dir, { withFileTypes: true })) {
3304
+ for (const entry of readdirSync4(dir, { withFileTypes: true })) {
3291
3305
  const abs = join5(dir, entry.name);
3292
3306
  if (entry.isDirectory()) {
3293
3307
  walk(abs);
@@ -4531,7 +4545,7 @@ async function syncWebIdeAttachments(cfg2, taskId, workdir, attachments) {
4531
4545
 
4532
4546
  // src/commands/sync-webide-design.ts
4533
4547
  import { createHash as createHash3 } from "crypto";
4534
- import { existsSync as existsSync10, readdirSync as readdirSync4, readFileSync as readFileSync8, statSync as statSync5, writeFileSync as writeFileSync7 } from "fs";
4548
+ import { existsSync as existsSync10, readdirSync as readdirSync5, readFileSync as readFileSync8, statSync as statSync5, writeFileSync as writeFileSync7 } from "fs";
4535
4549
  import { join as join7 } from "path";
4536
4550
 
4537
4551
  // src/opc-shared-types.ts
@@ -4613,7 +4627,7 @@ function listLocalDesignArtifactFiles(taskId, workdir) {
4613
4627
  const dir = webideDesignDir(taskId, workdir);
4614
4628
  if (!existsSync10(dir)) return [];
4615
4629
  const out = [];
4616
- for (const name of readdirSync4(dir)) {
4630
+ for (const name of readdirSync5(dir)) {
4617
4631
  if (!isWebIdeDesignArtifactName(name)) continue;
4618
4632
  const absPath = join7(dir, name);
4619
4633
  if (!statSync5(absPath).isFile()) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "8.1.9",
3
+ "version": "8.1.10",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,