ai-project-manage-cli 6.0.46 → 6.0.48
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
|
@@ -369,6 +369,10 @@ var requestConfig = {
|
|
|
369
369
|
listRules: defineEndpoint({
|
|
370
370
|
method: "GET",
|
|
371
371
|
path: "/cli/rules"
|
|
372
|
+
}),
|
|
373
|
+
createPullRequest: defineEndpoint({
|
|
374
|
+
method: "POST",
|
|
375
|
+
path: "/cli/pull-requests"
|
|
372
376
|
})
|
|
373
377
|
}
|
|
374
378
|
};
|
|
@@ -414,7 +418,9 @@ async function resolveRepositoryIdForSync(api, workdirPath) {
|
|
|
414
418
|
if (gitUrl) {
|
|
415
419
|
const matched = await api.cli.matchRepository({ url: gitUrl });
|
|
416
420
|
if (matched.repositoryId) {
|
|
417
|
-
console.log(
|
|
421
|
+
console.log(
|
|
422
|
+
`[apm] \u5DE5\u4F5C\u7A7A\u95F4\u8DEF\u5F84\u672A\u5339\u914D\uFF0C\u5DF2\u901A\u8FC7 git remote \u5173\u8054\u4ED3\u5E93: ${gitUrl}`
|
|
423
|
+
);
|
|
418
424
|
return { repositoryId: matched.repositoryId, diagnostic: null };
|
|
419
425
|
}
|
|
420
426
|
}
|
|
@@ -1122,6 +1128,13 @@ function readCliVersion() {
|
|
|
1122
1128
|
}
|
|
1123
1129
|
|
|
1124
1130
|
// src/commands/update.ts
|
|
1131
|
+
var useNpmShell = process.platform === "win32";
|
|
1132
|
+
function runNpm(args, options = {}) {
|
|
1133
|
+
return spawnSync(useNpmShell ? "npm.cmd" : "npm", args, {
|
|
1134
|
+
...options,
|
|
1135
|
+
shell: useNpmShell
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1125
1138
|
function registryBaseUrl() {
|
|
1126
1139
|
const fromEnv = process.env.npm_config_registry?.trim() || process.env.NPM_CONFIG_REGISTRY?.trim();
|
|
1127
1140
|
return (fromEnv || "https://registry.npmjs.org").replace(/\/+$/, "");
|
|
@@ -1138,7 +1151,7 @@ async function fetchLatestPublishedVersion() {
|
|
|
1138
1151
|
}
|
|
1139
1152
|
}
|
|
1140
1153
|
function npmAvailable() {
|
|
1141
|
-
const r =
|
|
1154
|
+
const r = runNpm(["--version"], { encoding: "utf8" });
|
|
1142
1155
|
return !r.error && r.status === 0;
|
|
1143
1156
|
}
|
|
1144
1157
|
async function runUpdate() {
|
|
@@ -1158,11 +1171,9 @@ async function runUpdate() {
|
|
|
1158
1171
|
console.error(
|
|
1159
1172
|
`[apm] \u5F53\u524D\u7248\u672C ${current}\uFF0C\u6B63\u5728\u5B89\u88C5 ${CLI_PACKAGE_NAME}@${targetLabel} \u2026`
|
|
1160
1173
|
);
|
|
1161
|
-
const install =
|
|
1162
|
-
"
|
|
1163
|
-
|
|
1164
|
-
{ stdio: "inherit", shell: process.platform === "win32" }
|
|
1165
|
-
);
|
|
1174
|
+
const install = runNpm(["install", "-g", `${CLI_PACKAGE_NAME}@latest`], {
|
|
1175
|
+
stdio: "inherit"
|
|
1176
|
+
});
|
|
1166
1177
|
if (install.error) {
|
|
1167
1178
|
console.error("[apm] \u66F4\u65B0\u5931\u8D25:", install.error.message);
|
|
1168
1179
|
process.exit(1);
|
|
@@ -2372,6 +2383,30 @@ async function runConnect(options) {
|
|
|
2372
2383
|
});
|
|
2373
2384
|
}
|
|
2374
2385
|
|
|
2386
|
+
// src/commands/create-pr.ts
|
|
2387
|
+
async function runCreatePr(options) {
|
|
2388
|
+
const sessionId = options.sessionId.trim();
|
|
2389
|
+
if (!sessionId) {
|
|
2390
|
+
console.error("[apm] sessionId \u4E0D\u80FD\u4E3A\u7A7A");
|
|
2391
|
+
process.exit(1);
|
|
2392
|
+
}
|
|
2393
|
+
const title = options.title.trim();
|
|
2394
|
+
if (!title) {
|
|
2395
|
+
console.error("[apm] \u8BF7\u901A\u8FC7 --title \u6307\u5B9A PR \u6807\u9898");
|
|
2396
|
+
process.exit(1);
|
|
2397
|
+
}
|
|
2398
|
+
const cfg = await ensureLoggedConfig();
|
|
2399
|
+
const api = createApmApiClient(cfg);
|
|
2400
|
+
const workdir = resolveWorkdirPath(options.cwd ?? process.cwd());
|
|
2401
|
+
const pr = await api.cli.createPullRequest({
|
|
2402
|
+
sessionId,
|
|
2403
|
+
workdir,
|
|
2404
|
+
title,
|
|
2405
|
+
content: options.content ?? ""
|
|
2406
|
+
});
|
|
2407
|
+
console.log(`[apm] PR \u5DF2\u5C31\u7EEA #${pr.number} (${pr.state}): ${pr.url}`);
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2375
2410
|
// src/commands/deploy/backend.ts
|
|
2376
2411
|
import path5 from "node:path";
|
|
2377
2412
|
|
|
@@ -3589,6 +3624,17 @@ function buildProgram() {
|
|
|
3589
3624
|
).action(async (sessionId, opts) => {
|
|
3590
3625
|
await runBranch(sessionId, { message: opts.message });
|
|
3591
3626
|
});
|
|
3627
|
+
program.command("create-pr").description(
|
|
3628
|
+
"\u4E3A\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u7684\u4F1A\u8BDD\u7279\u6027\u5206\u652F\u521B\u5EFA PR\uFF08\u6807\u9898\u81EA\u52A8\u52A0 [AI] \u6807\u8BC6\uFF1B\u8FDC\u7A0B\u521B\u5EFA\u5931\u8D25\u65F6\u5E73\u53F0\u6570\u636E\u56DE\u6EDA\uFF09"
|
|
3629
|
+
).requiredOption("--session <sessionId>", "\u6C9F\u901A\u7FA4 ID").requiredOption("--title <title>", "PR \u6807\u9898").option("--content <content>", "PR \u6B63\u6587\uFF08Markdown\uFF09", "").action(
|
|
3630
|
+
async (opts) => {
|
|
3631
|
+
await runCreatePr({
|
|
3632
|
+
sessionId: opts.session,
|
|
3633
|
+
title: opts.title,
|
|
3634
|
+
content: opts.content ?? ""
|
|
3635
|
+
});
|
|
3636
|
+
}
|
|
3637
|
+
);
|
|
3592
3638
|
registerDeployCommands(program);
|
|
3593
3639
|
return program;
|
|
3594
3640
|
}
|
package/package.json
CHANGED
|
@@ -29,13 +29,26 @@
|
|
|
29
29
|
- 锚定计划和需求原文做判断,不要凭个人偏好挑剔代码风格。
|
|
30
30
|
- 改动是否「无关」拿不准时,倾向放过,但在回复中提示验收人留意。
|
|
31
31
|
|
|
32
|
-
### 步骤 3
|
|
32
|
+
### 步骤 3:评审通过后创建 PR
|
|
33
|
+
|
|
34
|
+
评审**通过**后,先在工作目录执行(创建/更新本会话特性分支对应的 PR):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
apm create-pr --session <会话ID> --title "<需求摘要>" --content "<计划摘要 + 白名单对账 + 评审结论 + 测试环境地址>"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- 标题会自动加上 `[AI]` 标识,表明该 PR 由 AI 创建;同一分支已有开启的 PR 时会改为更新,不会重复创建。
|
|
41
|
+
- 命令输出的 PR 链接用于下一步回复中引用。
|
|
42
|
+
- 若创建失败(如客户机未配置 GitHub/Gitee API Key),**不要阻断交付**:记录失败原因,在回复中 `@项目经理` 说明需人工处理。
|
|
43
|
+
|
|
44
|
+
### 步骤 4:输出结论
|
|
33
45
|
|
|
34
46
|
**通过**:用 `append_message` 回复评审结论,并 `@项目经理` 交人验收,回复中必须包含:
|
|
35
47
|
|
|
36
48
|
1. 「diff 评审通过」+ 一句话改动概述;
|
|
37
|
-
2.
|
|
38
|
-
3.
|
|
49
|
+
2. **PR 链接**(上一步 `apm create-pr` 输出;创建失败则注明原因);
|
|
50
|
+
3. 测试环境地址(从开发的回复或工作日志中获取);
|
|
51
|
+
4. 提示按 `CHECKLIST.md` 逐条验收。
|
|
39
52
|
|
|
40
53
|
**不通过**:用 `append_message` 输出问题清单(每条注明文件 + 问题 + 依据哪条计划/需求),`@` 对应工程师打回修改。**禁止自己动手改。**
|
|
41
54
|
|