ai-project-manage-cli 4.0.11 → 4.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +52 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1206,6 +1206,38 @@ async function runUpdate() {
1206
1206
  }
1207
1207
  }
1208
1208
 
1209
+ // src/commands/update-skills.ts
1210
+ import { cpSync as cpSync2, existsSync as existsSync4, rmSync, statSync as statSync3 } from "fs";
1211
+ import { join as join10 } from "path";
1212
+ var TEMPLATE_SKILLS_DIR = join10(CLI_TEMPLATE_DIR, "skills");
1213
+ async function runUpdateSkills() {
1214
+ const apmDir = WORKSPACE_APM_DIR;
1215
+ if (!existsSync4(apmDir)) {
1216
+ console.error("[apm] \u672A\u627E\u5230 .apm \u76EE\u5F55\uFF0C\u8BF7\u5148\u6267\u884C apm init");
1217
+ process.exit(1);
1218
+ }
1219
+ const apmStat = statSync3(apmDir);
1220
+ if (!apmStat.isDirectory()) {
1221
+ throw new Error(`[apm] \u8DEF\u5F84\u5DF2\u5B58\u5728\u4F46\u4E0D\u662F\u76EE\u5F55: ${apmDir}`);
1222
+ }
1223
+ let templateStat;
1224
+ try {
1225
+ templateStat = statSync3(TEMPLATE_SKILLS_DIR);
1226
+ } catch {
1227
+ throw new Error(`[apm] \u5185\u7F6E\u6280\u80FD\u6A21\u677F\u4E0D\u5B58\u5728: ${TEMPLATE_SKILLS_DIR}`);
1228
+ }
1229
+ if (!templateStat.isDirectory()) {
1230
+ throw new Error(`[apm] \u5185\u7F6E\u6280\u80FD\u6A21\u677F\u4E0D\u662F\u76EE\u5F55: ${TEMPLATE_SKILLS_DIR}`);
1231
+ }
1232
+ const skillsDir = join10(apmDir, "skills");
1233
+ if (existsSync4(skillsDir)) {
1234
+ rmSync(skillsDir, { recursive: true, force: true });
1235
+ }
1236
+ await ensureDirExists(apmDir);
1237
+ cpSync2(TEMPLATE_SKILLS_DIR, skillsDir, { recursive: true });
1238
+ console.log("[apm] \u5DF2\u66F4\u65B0 .apm/skills");
1239
+ }
1240
+
1209
1241
  // src/commands/update-dev-status.ts
1210
1242
  async function runUpdateDevStatus(requirementId, status) {
1211
1243
  const cfg = await ensureLoggedConfig();
@@ -1232,14 +1264,14 @@ async function runUpdateStatus(requirementId, status) {
1232
1264
  import path5 from "node:path";
1233
1265
 
1234
1266
  // src/commands/deploy/internal/apm-config.ts
1235
- import { existsSync as existsSync4, readFileSync as readFileSync7 } from "node:fs";
1267
+ import { existsSync as existsSync5, readFileSync as readFileSync7 } from "node:fs";
1236
1268
  import { resolve as resolve4 } from "node:path";
1237
1269
  function loadApmConfig(options) {
1238
1270
  const p = resolve4(
1239
1271
  process.cwd(),
1240
1272
  options?.configPath ?? resolve4(WORKSPACE_APM_DIR, "apm.config.json")
1241
1273
  );
1242
- if (!existsSync4(p)) {
1274
+ if (!existsSync5(p)) {
1243
1275
  console.error(`\u672A\u627E\u5230\u914D\u7F6E\u6587\u4EF6\uFF1A${p}`);
1244
1276
  process.exit(1);
1245
1277
  }
@@ -1343,7 +1375,7 @@ import path4 from "node:path";
1343
1375
  import Docker from "dockerode";
1344
1376
 
1345
1377
  // src/commands/deploy/internal/backend-deploy/dockerode-client/connection-options.ts
1346
- import { existsSync as existsSync5, readFileSync as readFileSync8 } from "node:fs";
1378
+ import { existsSync as existsSync6, readFileSync as readFileSync8 } from "node:fs";
1347
1379
  import path from "node:path";
1348
1380
  function asOptionalTlsBuffer(value) {
1349
1381
  if (typeof value !== "string") {
@@ -1355,7 +1387,7 @@ function asOptionalTlsBuffer(value) {
1355
1387
  if (normalized === "") {
1356
1388
  return void 0;
1357
1389
  }
1358
- if (existsSync5(normalized)) {
1390
+ if (existsSync6(normalized)) {
1359
1391
  return readFileSync8(normalized);
1360
1392
  }
1361
1393
  const looksLikePath = /[\\/]/.test(normalized) || normalized.endsWith(".pem");
@@ -1566,7 +1598,7 @@ var DockerodeClient = class {
1566
1598
  var createDockerodeClient = (config) => new DockerodeClient(config);
1567
1599
 
1568
1600
  // src/commands/deploy/internal/backend-deploy/dockerode-client/env.ts
1569
- import { existsSync as existsSync6, readFileSync as readFileSync9, statSync as statSync3 } from "node:fs";
1601
+ import { existsSync as existsSync7, readFileSync as readFileSync9, statSync as statSync4 } from "node:fs";
1570
1602
  import path2 from "node:path";
1571
1603
  function stripSurroundingQuotes(value) {
1572
1604
  const t = value.trim();
@@ -1583,7 +1615,7 @@ function loadEnvFromFile(envFilePath) {
1583
1615
  return {};
1584
1616
  }
1585
1617
  const targetPath = path2.resolve(envFilePath);
1586
- if (!existsSync6(targetPath) || !statSync3(targetPath).isFile()) {
1618
+ if (!existsSync7(targetPath) || !statSync4(targetPath).isFile()) {
1587
1619
  return {};
1588
1620
  }
1589
1621
  const raw = readFileSync9(targetPath, "utf-8");
@@ -1757,12 +1789,12 @@ function dockerPushImage(params, cwd) {
1757
1789
  }
1758
1790
 
1759
1791
  // src/commands/deploy/internal/backend-deploy/resolve-dockerfile.ts
1760
- import { existsSync as existsSync7 } from "node:fs";
1792
+ import { existsSync as existsSync8 } from "node:fs";
1761
1793
  import path3 from "node:path";
1762
1794
  function resolveDockerBuildPaths(cwd) {
1763
1795
  const dockerfilePath = path3.join(cwd, "Dockerfile");
1764
1796
  Logger.info(`\u67E5\u627EDockerfile\u6587\u4EF6\uFF0C\u8DEF\u5F84: ${dockerfilePath}`);
1765
- if (!existsSync7(dockerfilePath)) {
1797
+ if (!existsSync8(dockerfilePath)) {
1766
1798
  throw new Error(`Dockerfile \u4E0D\u5B58\u5728\uFF1A${dockerfilePath}`);
1767
1799
  }
1768
1800
  Logger.info("\u2713 Dockerfile \u5B58\u5728");
@@ -1891,11 +1923,11 @@ import { copyFile, readdir as readdir2, stat } from "node:fs/promises";
1891
1923
  import path7 from "node:path";
1892
1924
 
1893
1925
  // src/commands/deploy/internal/load-apm-dotenv.ts
1894
- import { existsSync as existsSync8, readFileSync as readFileSync10 } from "node:fs";
1895
- import { join as join10 } from "node:path";
1926
+ import { existsSync as existsSync9, readFileSync as readFileSync10 } from "node:fs";
1927
+ import { join as join11 } from "node:path";
1896
1928
  function loadApmDotEnvIfPresent() {
1897
- const p = join10(WORKSPACE_APM_DIR, ".env");
1898
- if (!existsSync8(p)) {
1929
+ const p = join11(WORKSPACE_APM_DIR, ".env");
1930
+ if (!existsSync9(p)) {
1899
1931
  return;
1900
1932
  }
1901
1933
  let text;
@@ -1925,14 +1957,14 @@ function loadApmDotEnvIfPresent() {
1925
1957
  }
1926
1958
 
1927
1959
  // src/commands/deploy/internal/minio.ts
1928
- import { statSync as statSync4 } from "node:fs";
1960
+ import { statSync as statSync5 } from "node:fs";
1929
1961
  import { readdir } from "node:fs/promises";
1930
1962
  import path6 from "node:path";
1931
1963
  import * as Minio from "minio";
1932
1964
  var DEFAULT_MAX_FILE_SIZE_MB = 50;
1933
1965
  async function isDirectoryPath(dir) {
1934
1966
  try {
1935
- const st = statSync4(dir);
1967
+ const st = statSync5(dir);
1936
1968
  return st.isDirectory();
1937
1969
  } catch {
1938
1970
  return false;
@@ -1962,7 +1994,7 @@ async function collectFiles(root) {
1962
1994
  if (e.isDirectory()) {
1963
1995
  await walk(abs, rel);
1964
1996
  } else if (e.isFile()) {
1965
- const st = statSync4(abs);
1997
+ const st = statSync5(abs);
1966
1998
  out.push({
1967
1999
  absPath: abs,
1968
2000
  relativePath: rel.replace(/\\/g, "/"),
@@ -2280,6 +2312,11 @@ function buildProgram() {
2280
2312
  ).action(async () => {
2281
2313
  await runUpdate();
2282
2314
  });
2315
+ program.command("update-skills").description(
2316
+ "\u5220\u9664\u5DE5\u4F5C\u533A .apm/skills \u540E\uFF0C\u4ECE\u5F53\u524D CLI \u5185\u7F6E\u6A21\u677F\u91CD\u65B0\u590D\u5236\u6280\u80FD\u76EE\u5F55"
2317
+ ).action(async () => {
2318
+ await runUpdateSkills();
2319
+ });
2283
2320
  program.command("pull").description(
2284
2321
  "GET /api/cli/requirements/pull\uFF0C\u540C\u6B65\u6570\u636E\u4E0E\u9644\u4EF6\u5230 .apm/workitems/<\u9700\u6C42ID>"
2285
2322
  ).argument("<requirementId>", "\u9700\u6C42 ID").action(async (requirementId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "4.0.11",
3
+ "version": "4.0.12",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,