ai-project-manage-cli 5.0.4 → 5.0.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.
- package/dist/index.js +18 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -669,24 +669,17 @@ async function runSyncDocument(sessionId, options) {
|
|
|
669
669
|
}
|
|
670
670
|
|
|
671
671
|
// src/commands/append-message.ts
|
|
672
|
-
import { existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
|
|
673
672
|
async function runAppendMessage(options) {
|
|
674
673
|
const messageId = options.id?.trim();
|
|
675
674
|
if (!messageId) {
|
|
676
675
|
console.error("[apm] \u8BF7\u6307\u5B9A --id <messageId>");
|
|
677
676
|
process.exit(1);
|
|
678
677
|
}
|
|
679
|
-
const
|
|
680
|
-
if (!
|
|
681
|
-
console.error("[apm] \u8BF7\u6307\u5B9A --
|
|
682
|
-
process.exit(1);
|
|
683
|
-
}
|
|
684
|
-
const absPath = resolveCwdPath(fileArg);
|
|
685
|
-
if (!existsSync4(absPath)) {
|
|
686
|
-
console.error(`[apm] \u6587\u4EF6\u4E0D\u5B58\u5728: ${absPath}`);
|
|
678
|
+
const content = options.content ?? "";
|
|
679
|
+
if (!content) {
|
|
680
|
+
console.error("[apm] \u8BF7\u6307\u5B9A --content <\u5185\u5BB9>");
|
|
687
681
|
process.exit(1);
|
|
688
682
|
}
|
|
689
|
-
const content = readFileSync5(absPath, "utf8");
|
|
690
683
|
const cfg = await ensureLoggedConfig();
|
|
691
684
|
const api = createApmApiClient(cfg);
|
|
692
685
|
await api.cli.appendMessageContent({ id: messageId, content });
|
|
@@ -723,19 +716,19 @@ async function runUpdateMessageStatus(options) {
|
|
|
723
716
|
import path5 from "node:path";
|
|
724
717
|
|
|
725
718
|
// src/commands/deploy/internal/apm-config.ts
|
|
726
|
-
import { existsSync as
|
|
719
|
+
import { existsSync as existsSync4, readFileSync as readFileSync5 } from "node:fs";
|
|
727
720
|
import { resolve as resolve3 } from "node:path";
|
|
728
721
|
function loadApmConfig(options) {
|
|
729
722
|
const p = resolve3(
|
|
730
723
|
process.cwd(),
|
|
731
724
|
options?.configPath ?? resolve3(workspaceApmDir(), "apm.config.json")
|
|
732
725
|
);
|
|
733
|
-
if (!
|
|
726
|
+
if (!existsSync4(p)) {
|
|
734
727
|
console.error(`\u672A\u627E\u5230\u914D\u7F6E\u6587\u4EF6\uFF1A${p}`);
|
|
735
728
|
process.exit(1);
|
|
736
729
|
}
|
|
737
730
|
try {
|
|
738
|
-
const raw =
|
|
731
|
+
const raw = readFileSync5(p, "utf8");
|
|
739
732
|
return JSON.parse(raw);
|
|
740
733
|
} catch (e) {
|
|
741
734
|
console.error(`\u65E0\u6CD5\u89E3\u6790 apm.config.json\uFF1A${p}`, e);
|
|
@@ -832,7 +825,7 @@ import path4 from "node:path";
|
|
|
832
825
|
import Docker from "dockerode";
|
|
833
826
|
|
|
834
827
|
// src/commands/deploy/internal/backend-deploy/dockerode-client/connection-options.ts
|
|
835
|
-
import { existsSync as
|
|
828
|
+
import { existsSync as existsSync5, readFileSync as readFileSync6 } from "node:fs";
|
|
836
829
|
import path from "node:path";
|
|
837
830
|
function asOptionalTlsBuffer(value) {
|
|
838
831
|
if (typeof value !== "string") {
|
|
@@ -844,8 +837,8 @@ function asOptionalTlsBuffer(value) {
|
|
|
844
837
|
if (normalized === "") {
|
|
845
838
|
return void 0;
|
|
846
839
|
}
|
|
847
|
-
if (
|
|
848
|
-
return
|
|
840
|
+
if (existsSync5(normalized)) {
|
|
841
|
+
return readFileSync6(normalized);
|
|
849
842
|
}
|
|
850
843
|
const looksLikePath = /[\\/]/.test(normalized) || normalized.endsWith(".pem");
|
|
851
844
|
if (looksLikePath) {
|
|
@@ -1055,7 +1048,7 @@ var DockerodeClient = class {
|
|
|
1055
1048
|
var createDockerodeClient = (config) => new DockerodeClient(config);
|
|
1056
1049
|
|
|
1057
1050
|
// src/commands/deploy/internal/backend-deploy/dockerode-client/env.ts
|
|
1058
|
-
import { existsSync as
|
|
1051
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7, statSync as statSync3 } from "node:fs";
|
|
1059
1052
|
import path2 from "node:path";
|
|
1060
1053
|
function stripSurroundingQuotes(value) {
|
|
1061
1054
|
const t = value.trim();
|
|
@@ -1072,10 +1065,10 @@ function loadEnvFromFile(envFilePath) {
|
|
|
1072
1065
|
return {};
|
|
1073
1066
|
}
|
|
1074
1067
|
const targetPath = path2.resolve(envFilePath);
|
|
1075
|
-
if (!
|
|
1068
|
+
if (!existsSync6(targetPath) || !statSync3(targetPath).isFile()) {
|
|
1076
1069
|
return {};
|
|
1077
1070
|
}
|
|
1078
|
-
const raw =
|
|
1071
|
+
const raw = readFileSync7(targetPath, "utf-8");
|
|
1079
1072
|
const result = {};
|
|
1080
1073
|
for (const line of raw.split(/\r?\n/)) {
|
|
1081
1074
|
const normalized = line.trim();
|
|
@@ -1246,12 +1239,12 @@ function dockerPushImage(params, cwd) {
|
|
|
1246
1239
|
}
|
|
1247
1240
|
|
|
1248
1241
|
// src/commands/deploy/internal/backend-deploy/resolve-dockerfile.ts
|
|
1249
|
-
import { existsSync as
|
|
1242
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
1250
1243
|
import path3 from "node:path";
|
|
1251
1244
|
function resolveDockerBuildPaths(cwd) {
|
|
1252
1245
|
const dockerfilePath = path3.join(cwd, "Dockerfile");
|
|
1253
1246
|
Logger.info(`\u67E5\u627EDockerfile\u6587\u4EF6\uFF0C\u8DEF\u5F84: ${dockerfilePath}`);
|
|
1254
|
-
if (!
|
|
1247
|
+
if (!existsSync7(dockerfilePath)) {
|
|
1255
1248
|
throw new Error(`Dockerfile \u4E0D\u5B58\u5728\uFF1A${dockerfilePath}`);
|
|
1256
1249
|
}
|
|
1257
1250
|
Logger.info("\u2713 Dockerfile \u5B58\u5728");
|
|
@@ -1380,16 +1373,16 @@ import { copyFile, readdir as readdir2, stat } from "node:fs/promises";
|
|
|
1380
1373
|
import path7 from "node:path";
|
|
1381
1374
|
|
|
1382
1375
|
// src/commands/deploy/internal/load-apm-dotenv.ts
|
|
1383
|
-
import { existsSync as
|
|
1376
|
+
import { existsSync as existsSync8, readFileSync as readFileSync8 } from "node:fs";
|
|
1384
1377
|
import { join as join8 } from "node:path";
|
|
1385
1378
|
function loadApmDotEnvIfPresent() {
|
|
1386
1379
|
const p = join8(workspaceApmDir(), ".env");
|
|
1387
|
-
if (!
|
|
1380
|
+
if (!existsSync8(p)) {
|
|
1388
1381
|
return;
|
|
1389
1382
|
}
|
|
1390
1383
|
let text;
|
|
1391
1384
|
try {
|
|
1392
|
-
text =
|
|
1385
|
+
text = readFileSync8(p, "utf8");
|
|
1393
1386
|
} catch {
|
|
1394
1387
|
return;
|
|
1395
1388
|
}
|
|
@@ -1776,7 +1769,7 @@ function buildProgram() {
|
|
|
1776
1769
|
program.command("sync-document").description("\u5C06\u672C\u5730 Markdown \u8986\u76D6\u5F0F upsert \u5230\u5E73\u53F0\u9700\u6C42\u6587\u6863").argument("<sessionId>", "\u6C9F\u901A\u7FA4 ID").requiredOption("--file <path>", "\u672C\u5730\u6587\u4EF6\u8DEF\u5F84").action(async (sessionId, opts) => {
|
|
1777
1770
|
await runSyncDocument(sessionId, { file: opts.file });
|
|
1778
1771
|
});
|
|
1779
|
-
program.command("append-message").description("\u5411\u5E73\u53F0\u4F1A\u8BDD\u6D88\u606F\u8FFD\u52A0\u5185\u5BB9\uFF08PUT /api/cli/messages/content\uFF09").requiredOption("--id <messageId>", "\u6D88\u606F ID").requiredOption("--
|
|
1772
|
+
program.command("append-message").description("\u5411\u5E73\u53F0\u4F1A\u8BDD\u6D88\u606F\u8FFD\u52A0\u5185\u5BB9\uFF08PUT /api/cli/messages/content\uFF09").requiredOption("--id <messageId>", "\u6D88\u606F ID").requiredOption("--content <content>", "\u8981\u8FFD\u52A0\u7684\u6D88\u606F\u5185\u5BB9").action(async (opts) => {
|
|
1780
1773
|
await runAppendMessage(opts);
|
|
1781
1774
|
});
|
|
1782
1775
|
program.command("update-message-status").description("\u66F4\u65B0\u5E73\u53F0\u4F1A\u8BDD\u6D88\u606F\u72B6\u6001").requiredOption("--id <messageId>", "\u6D88\u606F ID").requiredOption("--status <status>", "CREATED | TYPING | SUCCESS | FAILED").action(async (opts) => {
|