ai-project-manage-cli 4.0.1 → 4.0.2
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/README.md +19 -0
- package/dist/index.js +28 -56
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## 前置安装
|
|
2
|
+
|
|
3
|
+
``
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
`npm install ai-project-manage-cli@latest`
|
|
8
|
+
|
|
9
|
+
## 登录
|
|
10
|
+
|
|
11
|
+
`apm login --email=xxxxxxx@whbillion.com --password=123456 --server=http://192.168.10.217:3000`
|
|
12
|
+
|
|
13
|
+
## 初始化
|
|
14
|
+
|
|
15
|
+
`apm init`
|
|
16
|
+
|
|
17
|
+
## 连接服务器
|
|
18
|
+
|
|
19
|
+
`apm connect`
|
package/dist/index.js
CHANGED
|
@@ -125,6 +125,10 @@ var requestConfig = {
|
|
|
125
125
|
method: "POST",
|
|
126
126
|
path: "/requirement-artifacts/create"
|
|
127
127
|
}),
|
|
128
|
+
upsert: defineEndpoint({
|
|
129
|
+
method: "POST",
|
|
130
|
+
path: "/requirement-artifacts/upsert"
|
|
131
|
+
}),
|
|
128
132
|
update: defineEndpoint({
|
|
129
133
|
method: "POST",
|
|
130
134
|
path: "/requirement-artifacts/update"
|
|
@@ -409,25 +413,6 @@ function* walkMarkdownFiles(dir) {
|
|
|
409
413
|
yield full;
|
|
410
414
|
}
|
|
411
415
|
}
|
|
412
|
-
async function deleteAllArtifactsForRequirement(api, requirementId) {
|
|
413
|
-
const pageSize = 500;
|
|
414
|
-
let page = 1;
|
|
415
|
-
const rows = [];
|
|
416
|
-
while (true) {
|
|
417
|
-
const batch = await api.requirementArtifact.list({
|
|
418
|
-
requirementId,
|
|
419
|
-
page,
|
|
420
|
-
pageSize
|
|
421
|
-
});
|
|
422
|
-
rows.push(...batch.items);
|
|
423
|
-
if (batch.total === 0 || rows.length >= batch.total) break;
|
|
424
|
-
page += 1;
|
|
425
|
-
}
|
|
426
|
-
for (const row of rows) {
|
|
427
|
-
await api.requirementArtifact.delete({ artifactId: row.id });
|
|
428
|
-
}
|
|
429
|
-
return rows.length;
|
|
430
|
-
}
|
|
431
416
|
async function runUploadArtifact(requirementId, workspaceDir) {
|
|
432
417
|
const cfg = await ensureLoggedConfig();
|
|
433
418
|
const api = createApmApiClient(cfg);
|
|
@@ -439,32 +424,19 @@ async function runUploadArtifact(requirementId, workspaceDir) {
|
|
|
439
424
|
);
|
|
440
425
|
process.exit(1);
|
|
441
426
|
}
|
|
442
|
-
const
|
|
443
|
-
console.log(`[apm] \u5DF2\u6E05\u7A7A\u9700\u6C42\u4EA7\u7269\u6587\u6863 ${deleted} \u6761`);
|
|
444
|
-
const paths = [...walkMarkdownFiles(root)];
|
|
445
|
-
let created = 0;
|
|
446
|
-
let skipped = 0;
|
|
447
|
-
for (const abs of paths) {
|
|
427
|
+
for (const abs of walkMarkdownFiles(root)) {
|
|
448
428
|
const relPosix = toPosixRelative(root, abs);
|
|
449
|
-
if (EXCLUDED_RELATIVE_PATHS.has(relPosix))
|
|
450
|
-
skipped += 1;
|
|
451
|
-
console.log(`[apm] \u8DF3\u8FC7\uFF08\u6392\u9664\u5217\u8868\uFF09: ${relPosix}`);
|
|
452
|
-
continue;
|
|
453
|
-
}
|
|
429
|
+
if (EXCLUDED_RELATIVE_PATHS.has(relPosix)) continue;
|
|
454
430
|
const content = readFileSync3(abs, "utf8");
|
|
455
431
|
const tag = artifactTagFromRelPath(relPosix);
|
|
456
|
-
await api.requirementArtifact.
|
|
432
|
+
await api.requirementArtifact.upsert({
|
|
457
433
|
requirementId,
|
|
458
434
|
tag,
|
|
459
435
|
fileName: relPosix,
|
|
460
436
|
content
|
|
461
437
|
});
|
|
462
|
-
|
|
463
|
-
console.log(`[apm] \u5DF2\u4E0A\u4F20\u4EA7\u7269: ${relPosix} (tag=${tag})`);
|
|
438
|
+
console.log(`[apm] \u5DF2\u540C\u6B65\u4EA7\u7269: ${relPosix}`);
|
|
464
439
|
}
|
|
465
|
-
console.log(
|
|
466
|
-
`[apm] \u5B8C\u6210\uFF1A\u5220\u9664 ${deleted}\uFF0C\u65B0\u5EFA ${created}\uFF0C\u8DF3\u8FC7\uFF08\u6392\u9664\uFF09 ${skipped}\uFF0C\u5171\u626B\u63CF ${paths.length} \u4E2A Markdown \u6587\u4EF6`
|
|
467
|
-
);
|
|
468
440
|
}
|
|
469
441
|
|
|
470
442
|
// src/commands/pull.ts
|
|
@@ -960,7 +932,7 @@ async function runUpdateStatus(requirementId, status) {
|
|
|
960
932
|
// src/commands/deploy/backend.ts
|
|
961
933
|
import path5 from "node:path";
|
|
962
934
|
|
|
963
|
-
// src/commands/deploy/
|
|
935
|
+
// src/commands/deploy/internal/apm-config.ts
|
|
964
936
|
import { existsSync as existsSync3, readFileSync as readFileSync6 } from "node:fs";
|
|
965
937
|
import { resolve as resolve4 } from "node:path";
|
|
966
938
|
function loadApmConfig(options) {
|
|
@@ -1065,13 +1037,13 @@ function resolveFrontendDeployFromApmConfig(cfg) {
|
|
|
1065
1037
|
};
|
|
1066
1038
|
}
|
|
1067
1039
|
|
|
1068
|
-
// src/commands/deploy/
|
|
1040
|
+
// src/commands/deploy/internal/backend-deploy/backend-deploy-workflow.ts
|
|
1069
1041
|
import path4 from "node:path";
|
|
1070
1042
|
|
|
1071
|
-
// src/commands/deploy/
|
|
1043
|
+
// src/commands/deploy/internal/backend-deploy/dockerode-client/client.ts
|
|
1072
1044
|
import Docker from "dockerode";
|
|
1073
1045
|
|
|
1074
|
-
// src/commands/deploy/
|
|
1046
|
+
// src/commands/deploy/internal/backend-deploy/dockerode-client/connection-options.ts
|
|
1075
1047
|
import { existsSync as existsSync4, readFileSync as readFileSync7 } from "node:fs";
|
|
1076
1048
|
import path from "node:path";
|
|
1077
1049
|
function asOptionalTlsBuffer(value) {
|
|
@@ -1125,7 +1097,7 @@ function toDockerConnectionOptions(config) {
|
|
|
1125
1097
|
return options;
|
|
1126
1098
|
}
|
|
1127
1099
|
|
|
1128
|
-
// src/commands/deploy/
|
|
1100
|
+
// src/commands/deploy/internal/backend-deploy/dockerode-client/container-inspect-format.ts
|
|
1129
1101
|
function formatPortMappings(inspectInfo) {
|
|
1130
1102
|
const ports = inspectInfo?.NetworkSettings?.Ports;
|
|
1131
1103
|
if (!ports || typeof ports !== "object") {
|
|
@@ -1146,7 +1118,7 @@ function formatPortMappings(inspectInfo) {
|
|
|
1146
1118
|
return mappings.length > 0 ? mappings : void 0;
|
|
1147
1119
|
}
|
|
1148
1120
|
|
|
1149
|
-
// src/commands/deploy/
|
|
1121
|
+
// src/commands/deploy/internal/backend-deploy/dockerode-client/container-options.ts
|
|
1150
1122
|
function toContainerCreateOptions(input) {
|
|
1151
1123
|
const hostConfig = {};
|
|
1152
1124
|
let hasHostConfig = false;
|
|
@@ -1188,7 +1160,7 @@ function toContainerCreateOptions(input) {
|
|
|
1188
1160
|
return payload;
|
|
1189
1161
|
}
|
|
1190
1162
|
|
|
1191
|
-
// src/commands/deploy/
|
|
1163
|
+
// src/commands/deploy/internal/backend-deploy/dockerode-client/client.ts
|
|
1192
1164
|
var DockerodeClient = class {
|
|
1193
1165
|
client;
|
|
1194
1166
|
constructor(config) {
|
|
@@ -1294,7 +1266,7 @@ var DockerodeClient = class {
|
|
|
1294
1266
|
};
|
|
1295
1267
|
var createDockerodeClient = (config) => new DockerodeClient(config);
|
|
1296
1268
|
|
|
1297
|
-
// src/commands/deploy/
|
|
1269
|
+
// src/commands/deploy/internal/backend-deploy/dockerode-client/env.ts
|
|
1298
1270
|
import { existsSync as existsSync5, readFileSync as readFileSync8, statSync as statSync3 } from "node:fs";
|
|
1299
1271
|
import path2 from "node:path";
|
|
1300
1272
|
function stripSurroundingQuotes(value) {
|
|
@@ -1338,7 +1310,7 @@ function toEnvArray(env) {
|
|
|
1338
1310
|
return Object.entries(env).map(([key, value]) => `${key}=${value}`);
|
|
1339
1311
|
}
|
|
1340
1312
|
|
|
1341
|
-
// src/commands/deploy/
|
|
1313
|
+
// src/commands/deploy/internal/backend-deploy/dockerode-client/ports.ts
|
|
1342
1314
|
function parsePorts(ports) {
|
|
1343
1315
|
if (!ports || ports.length === 0) {
|
|
1344
1316
|
return {};
|
|
@@ -1368,7 +1340,7 @@ function parsePorts(ports) {
|
|
|
1368
1340
|
};
|
|
1369
1341
|
}
|
|
1370
1342
|
|
|
1371
|
-
// src/commands/deploy/
|
|
1343
|
+
// src/commands/deploy/internal/backend-deploy/image-tag.ts
|
|
1372
1344
|
var DEPLOY_IMAGE_TAG = /^(?!\.|-)[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/;
|
|
1373
1345
|
function assertDeployImageTag(tag) {
|
|
1374
1346
|
const t = tag.trim();
|
|
@@ -1379,13 +1351,13 @@ function assertDeployImageTag(tag) {
|
|
|
1379
1351
|
}
|
|
1380
1352
|
}
|
|
1381
1353
|
|
|
1382
|
-
// src/commands/deploy/
|
|
1354
|
+
// src/commands/deploy/internal/backend-deploy/local-docker-build.ts
|
|
1383
1355
|
import { platform } from "node:os";
|
|
1384
1356
|
|
|
1385
|
-
// src/commands/deploy/
|
|
1357
|
+
// src/commands/deploy/internal/backend-deploy/command-runner.ts
|
|
1386
1358
|
import { execSync } from "child_process";
|
|
1387
1359
|
|
|
1388
|
-
// src/commands/deploy/
|
|
1360
|
+
// src/commands/deploy/internal/backend-deploy/logger.ts
|
|
1389
1361
|
var Logger = class {
|
|
1390
1362
|
static info(message) {
|
|
1391
1363
|
console.log(`\x1B[36m[INFO]\x1B[0m ${message}`);
|
|
@@ -1401,7 +1373,7 @@ var Logger = class {
|
|
|
1401
1373
|
}
|
|
1402
1374
|
};
|
|
1403
1375
|
|
|
1404
|
-
// src/commands/deploy/
|
|
1376
|
+
// src/commands/deploy/internal/backend-deploy/command-runner.ts
|
|
1405
1377
|
var CommandRunner = class {
|
|
1406
1378
|
/**
|
|
1407
1379
|
* 执行命令
|
|
@@ -1438,7 +1410,7 @@ var CommandRunner = class {
|
|
|
1438
1410
|
}
|
|
1439
1411
|
};
|
|
1440
1412
|
|
|
1441
|
-
// src/commands/deploy/
|
|
1413
|
+
// src/commands/deploy/internal/backend-deploy/local-docker-build.ts
|
|
1442
1414
|
function dockerBuildPlatformFlags() {
|
|
1443
1415
|
return platform() === "darwin" ? ["--platform", "linux/amd64"] : [];
|
|
1444
1416
|
}
|
|
@@ -1451,7 +1423,7 @@ function buildDockerImageLocally(params, cwd) {
|
|
|
1451
1423
|
Logger.info("\u2713 \u955C\u50CF\u6784\u5EFA\u6210\u529F");
|
|
1452
1424
|
}
|
|
1453
1425
|
|
|
1454
|
-
// src/commands/deploy/
|
|
1426
|
+
// src/commands/deploy/internal/backend-deploy/registry-login-push.ts
|
|
1455
1427
|
function dockerLoginPrivateRegistry(params, cwd) {
|
|
1456
1428
|
const { registryUser, registryPassword, registryHost } = params;
|
|
1457
1429
|
Logger.info("\u68C0\u67E5\u914D\u7F6E\u53C2\u6570...");
|
|
@@ -1485,7 +1457,7 @@ function dockerPushImage(params, cwd) {
|
|
|
1485
1457
|
Logger.info("\u2713 \u955C\u50CF\u63A8\u9001\u6210\u529F");
|
|
1486
1458
|
}
|
|
1487
1459
|
|
|
1488
|
-
// src/commands/deploy/
|
|
1460
|
+
// src/commands/deploy/internal/backend-deploy/resolve-dockerfile.ts
|
|
1489
1461
|
import { existsSync as existsSync6 } from "node:fs";
|
|
1490
1462
|
import path3 from "node:path";
|
|
1491
1463
|
function resolveDockerBuildPaths(cwd) {
|
|
@@ -1498,7 +1470,7 @@ function resolveDockerBuildPaths(cwd) {
|
|
|
1498
1470
|
return dockerfilePath;
|
|
1499
1471
|
}
|
|
1500
1472
|
|
|
1501
|
-
// src/commands/deploy/
|
|
1473
|
+
// src/commands/deploy/internal/backend-deploy/backend-deploy-workflow.ts
|
|
1502
1474
|
var BackendDeployWorkflow = class {
|
|
1503
1475
|
constructor(params) {
|
|
1504
1476
|
this.params = params;
|
|
@@ -1619,7 +1591,7 @@ function registerDeployBackendCommands(program) {
|
|
|
1619
1591
|
import { copyFile, readdir as readdir2, stat } from "node:fs/promises";
|
|
1620
1592
|
import path7 from "node:path";
|
|
1621
1593
|
|
|
1622
|
-
// src/commands/deploy/
|
|
1594
|
+
// src/commands/deploy/internal/load-apm-dotenv.ts
|
|
1623
1595
|
import { existsSync as existsSync7, readFileSync as readFileSync9 } from "node:fs";
|
|
1624
1596
|
import { join as join8 } from "node:path";
|
|
1625
1597
|
function loadApmDotEnvIfPresent() {
|
|
@@ -1653,7 +1625,7 @@ function loadApmDotEnvIfPresent() {
|
|
|
1653
1625
|
}
|
|
1654
1626
|
}
|
|
1655
1627
|
|
|
1656
|
-
// src/commands/deploy/
|
|
1628
|
+
// src/commands/deploy/internal/minio.ts
|
|
1657
1629
|
import { statSync as statSync4 } from "node:fs";
|
|
1658
1630
|
import { readdir } from "node:fs/promises";
|
|
1659
1631
|
import path6 from "node:path";
|