ai-project-manage-cli 6.0.76 → 6.0.79
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 +79 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3274,10 +3274,6 @@ async function handleInboundMessage(cfg, msg, signal, ctx) {
|
|
|
3274
3274
|
if (!didInit) {
|
|
3275
3275
|
assertApmGitignoredInRepo(workdir);
|
|
3276
3276
|
}
|
|
3277
|
-
await runStep(
|
|
3278
|
-
"status-typing",
|
|
3279
|
-
() => updateMessageStatus(cfg, messageId, "TYPING")
|
|
3280
|
-
);
|
|
3281
3277
|
if (shouldRunBranch(msg.sessionId, workdir)) {
|
|
3282
3278
|
if (signal.aborted) return;
|
|
3283
3279
|
await runStep("branch", () => runBranch(msg.sessionId, { cwd: workdir }));
|
|
@@ -3535,6 +3531,30 @@ async function runConnect(options) {
|
|
|
3535
3531
|
const task = (async () => {
|
|
3536
3532
|
await runSlots.acquire();
|
|
3537
3533
|
try {
|
|
3534
|
+
if (signal.aborted || isUserCancelled(ctx)) return;
|
|
3535
|
+
try {
|
|
3536
|
+
await updateMessageStatus(cfg, msg.messageId, "TYPING");
|
|
3537
|
+
} catch (typingErr) {
|
|
3538
|
+
if (isUserCancelled(ctx)) return;
|
|
3539
|
+
console.error(
|
|
3540
|
+
"[apm] \u66F4\u65B0 TYPING \u72B6\u6001\u5931\u8D25:",
|
|
3541
|
+
typingErr instanceof Error ? typingErr.message : typingErr
|
|
3542
|
+
);
|
|
3543
|
+
try {
|
|
3544
|
+
await setMessageError(
|
|
3545
|
+
cfg,
|
|
3546
|
+
msg.messageId,
|
|
3547
|
+
typingErr instanceof Error ? typingErr.message : String(typingErr)
|
|
3548
|
+
);
|
|
3549
|
+
await updateMessageStatus(cfg, msg.messageId, "FAILED");
|
|
3550
|
+
} catch (statusErr) {
|
|
3551
|
+
console.error(
|
|
3552
|
+
"[apm] \u66F4\u65B0 FAILED \u72B6\u6001\u5931\u8D25:",
|
|
3553
|
+
statusErr instanceof Error ? statusErr.message : statusErr
|
|
3554
|
+
);
|
|
3555
|
+
}
|
|
3556
|
+
return;
|
|
3557
|
+
}
|
|
3538
3558
|
await handleInboundMessage(cfg, msg, signal, ctx);
|
|
3539
3559
|
} finally {
|
|
3540
3560
|
runSlots.release();
|
|
@@ -3833,6 +3853,19 @@ function resolveMavenLocalRepoWithSource() {
|
|
|
3833
3853
|
sourceDetail: "~/.m2/repository"
|
|
3834
3854
|
};
|
|
3835
3855
|
}
|
|
3856
|
+
function resolveWisdomDeployMode(raw) {
|
|
3857
|
+
if (raw === void 0 || raw === null || raw === "") {
|
|
3858
|
+
return "default";
|
|
3859
|
+
}
|
|
3860
|
+
const mode = String(raw).trim().toLowerCase();
|
|
3861
|
+
if (mode === "default" || mode === "full") {
|
|
3862
|
+
return mode;
|
|
3863
|
+
}
|
|
3864
|
+
console.error(
|
|
3865
|
+
`apm.config.json \u4E2D wisdomDeploy.mode \u53EA\u80FD\u4E3A default \u6216 full\uFF0C\u5F53\u524D\u503C: ${raw}`
|
|
3866
|
+
);
|
|
3867
|
+
process.exit(1);
|
|
3868
|
+
}
|
|
3836
3869
|
function resolveWisdomBackendDeployFromApmConfig(cfg) {
|
|
3837
3870
|
const projectName = reqTopLevelName(cfg);
|
|
3838
3871
|
const w = cfg.wisdomDeploy ?? {};
|
|
@@ -3866,7 +3899,8 @@ function resolveWisdomBackendDeployFromApmConfig(cfg) {
|
|
|
3866
3899
|
mavenLocalRepoSourceDetail: mavenLocalRepo.sourceDetail,
|
|
3867
3900
|
healthCheckPort: healthPort,
|
|
3868
3901
|
healthCheckContext: reqHc(h.context, "context").trim(),
|
|
3869
|
-
healthCheckTimeout: healthTimeout
|
|
3902
|
+
healthCheckTimeout: healthTimeout,
|
|
3903
|
+
mode: resolveWisdomDeployMode(w.mode)
|
|
3870
3904
|
};
|
|
3871
3905
|
}
|
|
3872
3906
|
function posixDirname(p) {
|
|
@@ -4243,6 +4277,19 @@ function locateLibDir(projectRoot) {
|
|
|
4243
4277
|
log(`\u5B9A\u4F4D lib \u4EA7\u7269: ${libJars.length} \u4E2A`);
|
|
4244
4278
|
return libDir;
|
|
4245
4279
|
}
|
|
4280
|
+
function locateMainJar(projectRoot) {
|
|
4281
|
+
const targetDir = getTargetDir(projectRoot);
|
|
4282
|
+
if (!existsSync14(targetDir)) {
|
|
4283
|
+
fail(`\u6784\u5EFA\u4EA7\u7269\u76EE\u5F55\u4E0D\u5B58\u5728: ${targetDir}`);
|
|
4284
|
+
}
|
|
4285
|
+
const jarFiles = readdirSync5(targetDir).filter((name) => name.endsWith(".jar") && !name.endsWith(".jar.original")).map((name) => path2.join(targetDir, name)).sort((a, b) => statSync5(b).mtimeMs - statSync5(a).mtimeMs);
|
|
4286
|
+
if (jarFiles.length === 0) {
|
|
4287
|
+
fail(`target \u76EE\u5F55\u4E0B\u6CA1\u6709\u4E3B JAR: ${targetDir}`);
|
|
4288
|
+
}
|
|
4289
|
+
const mainJar = jarFiles[0];
|
|
4290
|
+
log(`\u5B9A\u4F4D\u4E3B JAR \u4EA7\u7269: ${path2.basename(mainJar)}`);
|
|
4291
|
+
return mainJar;
|
|
4292
|
+
}
|
|
4246
4293
|
async function connectSsh(config) {
|
|
4247
4294
|
const client = new Client();
|
|
4248
4295
|
log(`\u8FDE\u63A5\u670D\u52A1\u5668 ${config.username}@${config.host}:${config.port}`);
|
|
@@ -4299,6 +4346,18 @@ async function uploadUpdatePackage(sftp, zipPath, config) {
|
|
|
4299
4346
|
}
|
|
4300
4347
|
return remotePath;
|
|
4301
4348
|
}
|
|
4349
|
+
async function uploadFullJar(sftp, localJarPath, config) {
|
|
4350
|
+
const remoteDir = config.remoteAppDir.replace(/\/$/, "");
|
|
4351
|
+
const remotePath = `${remoteDir}/${config.startupJar}`;
|
|
4352
|
+
log(`\u4E0A\u4F20\u5168\u91CF JAR (${path2.basename(localJarPath)}) -> ${remotePath}`);
|
|
4353
|
+
try {
|
|
4354
|
+
await sftp.mkdir(remoteDir, true);
|
|
4355
|
+
await sftp.fastPut(localJarPath, remotePath);
|
|
4356
|
+
log("\u5168\u91CF JAR \u4E0A\u4F20\u6210\u529F");
|
|
4357
|
+
} catch (err) {
|
|
4358
|
+
fail(`\u5168\u91CF JAR \u4E0A\u4F20\u5931\u8D25: ${err instanceof Error ? err.message : err}`);
|
|
4359
|
+
}
|
|
4360
|
+
}
|
|
4302
4361
|
async function runRemoteCommand(client, command, options) {
|
|
4303
4362
|
const check = options?.check ?? true;
|
|
4304
4363
|
const stream = options?.stream ?? false;
|
|
@@ -4554,14 +4613,26 @@ async function runWisdomBackendDeploy(options) {
|
|
|
4554
4613
|
log(`=== \u81EA\u52A8\u90E8\u7F72: ${config.projectName} ===`);
|
|
4555
4614
|
log(`\u914D\u7F6E\u6587\u4EF6: ${path2.join(workspaceApmDir(), "apm.config.json")}`);
|
|
4556
4615
|
log(`\u9879\u76EE\u6839\u76EE\u5F55: ${projectRoot}`);
|
|
4616
|
+
log(
|
|
4617
|
+
`\u90E8\u7F72\u6A21\u5F0F: ${config.mode}${config.mode === "full" ? "\uFF08\u5168\u91CF JAR\uFF0C\u8DF3\u8FC7 lib \u68C0\u67E5\uFF09" : "\uFF08\u589E\u91CF lib \u66F4\u65B0\uFF09"}`
|
|
4618
|
+
);
|
|
4557
4619
|
runMavenBuild(projectRoot, config.mavenLocalRepo, {
|
|
4558
4620
|
source: config.mavenLocalRepoSource,
|
|
4559
4621
|
sourceDetail: config.mavenLocalRepoSourceDetail
|
|
4560
4622
|
});
|
|
4561
|
-
const libDir = locateLibDir(projectRoot);
|
|
4562
|
-
let manifest = loadManifest4();
|
|
4563
4623
|
const conn = await connectSsh(config);
|
|
4564
4624
|
try {
|
|
4625
|
+
if (config.mode === "full") {
|
|
4626
|
+
const mainJar = locateMainJar(projectRoot);
|
|
4627
|
+
await uploadFullJar(conn.sftp, mainJar, config);
|
|
4628
|
+
log("\u91CD\u542F\u670D\u52A1...");
|
|
4629
|
+
await restartRemoteService(conn.client, config);
|
|
4630
|
+
await healthCheckService(conn.client, config);
|
|
4631
|
+
log("\u90E8\u7F72\u5B8C\u6210");
|
|
4632
|
+
return;
|
|
4633
|
+
}
|
|
4634
|
+
const libDir = locateLibDir(projectRoot);
|
|
4635
|
+
let manifest = loadManifest4();
|
|
4565
4636
|
const remoteLibStats = await getRemoteFileStats(
|
|
4566
4637
|
conn.sftp,
|
|
4567
4638
|
config.remoteLibDir
|
|
@@ -5628,7 +5699,7 @@ function registerDeploySftpCommands(program) {
|
|
|
5628
5699
|
// src/commands/deploy/wisdom-backend.ts
|
|
5629
5700
|
function registerDeployWisdomBackendCommands(program) {
|
|
5630
5701
|
program.command("deploy-wisdom-backend").description(
|
|
5631
|
-
"Maven \u6784\u5EFA\u540E\
|
|
5702
|
+
"Maven \u6784\u5EFA\u540E\u90E8\u7F72 Spring Boot \u670D\u52A1\uFF08\u914D\u7F6E\u89C1 apm.config.json \u7684 wisdomDeploy \u4E0E healthCheck\uFF1Bmode=default \u589E\u91CF\u66F4\u65B0 lib\uFF0Cmode=full \u53D1\u5E03\u5168\u91CF JAR\uFF09"
|
|
5632
5703
|
).option(
|
|
5633
5704
|
"--config <path>",
|
|
5634
5705
|
"apm.config.json \u8DEF\u5F84\uFF08\u9ED8\u8BA4 .apm/apm.config.json\uFF09"
|