@d5render/cli 0.1.87 → 0.1.89
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/.skills/code-review/SKILL.md +37 -38
- package/bin/d5cli +12 -11
- package/bin/mcpServer.js +1 -2
- package/package.json +40 -40
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-review
|
|
3
|
-
description: code-review task process.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
For all review-related tasks, the subagent and main-agent can confirm with each other without user confirmation; they can be executed directly. However, it is important to note that all executed tasks must be listed at the end and only main-agent can execute report tasks. And obtain as much context as possible, including but not limited to the following:
|
|
7
|
-
|
|
8
|
-
- Use tools to locate files related to the changes. However, commits that explicitly request a merge, such as those with the title "Merge", do not require processing.
|
|
9
|
-
- Use toolchains to build complete call relationships and flowcharts for diff code, ensure the relevant graphs are as complete as possible (use `LSP` tool as a first-choice solution, and try other toolchain only if encounter problems). And use other tools mentioned in related documents to construct a data flow graph of the changes, ensure the relevant graphs are as complete as possible.
|
|
10
|
-
|
|
11
|
-
Then,
|
|
12
|
-
|
|
13
|
-
- Launch parallel subagents to independently code review the change (Unless there are special requirements, only the main-agent needs to call the report mcp tools,
|
|
14
|
-
- One of:
|
|
15
|
-
- Read README.md, AGENTS.md, .github/**.md, .cursor/**.md files in the **same directory** as the changes and the **root directory**.
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
- Executes the report-related processes, must use chinese(中文) to report
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: code-review task process for main-agent, subagent please not call report tools.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
For all review-related tasks, the subagent and main-agent can confirm with each other without user confirmation; they can be executed directly. However, it is important to note that all executed tasks must be listed at the end and only main-agent can execute report tasks. And obtain as much context as possible, including but not limited to the following:
|
|
7
|
+
|
|
8
|
+
- Use tools to locate files related to the changes. However, commits that explicitly request a merge, such as those with the title "Merge", do not require processing.
|
|
9
|
+
- Use toolchains to build complete call relationships and flowcharts for diff code, ensure the relevant graphs are as complete as possible (use `LSP` tool as a first-choice solution, and try other toolchain only if encounter problems). And use other tools mentioned in related documents to construct a data flow graph of the changes, ensure the relevant graphs are as complete as possible.
|
|
10
|
+
|
|
11
|
+
Then,
|
|
12
|
+
|
|
13
|
+
- Launch parallel subagents to independently code review the change (Unless there are special requirements, only the main-agent needs to call the report mcp tools, subagents do not call.). Information can be communicated between the subagents and main-agent, Subagents should do the following, then return a list of issues and the reason each issue was flagged (eg. .md adherence, issue, historical git context, etc.):
|
|
14
|
+
- One of:
|
|
15
|
+
- Read README.md, AGENTS.md, .github/**.md, .cursor/**.md files in the **same directory** as the changes and the **root directory**.
|
|
16
|
+
- Read code comments in the modified files, and make sure the changes in the pull request comply with any guidance in the comments.
|
|
17
|
+
- Determining whether documents contain related content requires additional loading and returning to the main agent.
|
|
18
|
+
- Check [severity.instructions.md](./severity.instructions.md) to clarify error severity levels, Please follow the project requirements regarding the redefinition of error levels in the relevant documentation.
|
|
19
|
+
- Another of:
|
|
20
|
+
- Read all modified codes block, build a complete data flow and call relationship graph about the codes to review logic
|
|
21
|
+
- Consider whether there is a better implementation for the current logic.
|
|
22
|
+
- One more of: Read the Git messages and modification history chronologically
|
|
23
|
+
- Identify issues by incorporating commit history.
|
|
24
|
+
- Consider other related aspects of the current function and provide corresponding suggestions.
|
|
25
|
+
- Parallel subagents have the following additions.
|
|
26
|
+
- The subagents **should not** perform any report-related tasks.
|
|
27
|
+
- For each issue found returns a score to indicate the agent's level of confidence for whether the issue is real or false positive. To do that, the agent should score each issue on a scale from 0-100, indicating its level of confidence. For issues that were flagged due to CLAUDE.md instructions, the agent should double check that the CLAUDE.md actually calls out that issue specifically. The scale is (give this rubric to the agent verbatim):
|
|
28
|
+
- 0: Not confident at all. This is a false positive that doesn't stand up to light scrutiny, or is a pre-existing issue.
|
|
29
|
+
- 25: Somewhat confident. This might be a real issue, but may also be a false positive. The agent wasn't able to verify that it's a real issue. If the issue is stylistic, it is one that was not explicitly called out in the relevant CLAUDE.md.
|
|
30
|
+
- 50: Moderately confident. The agent was able to verify this is a real issue, but it might be a nitpick or not happen very often in practice. Relative to the rest of the PR, it's not very important.
|
|
31
|
+
- 75: Highly confident. The agent double checked the issue, and verified that it is very likely it is a real issue that will be hit in practice. The existing approach in the PR is insufficient. The issue is very important and will directly impact the code's functionality, or it is an issue that is directly mentioned in the relevant CLAUDE.md.
|
|
32
|
+
- 100: Absolutely certain. The agent double checked the issue, and confirmed that it is definitely a real issue, that will happen frequently in practice. The evidence directly confirms this.
|
|
33
|
+
- List the task plan and output the task completion status to main-agent. Then, main-agent performs the following actions
|
|
34
|
+
- First, based on the report, relevant tools were used again to supplement the context, them evaluate codes self.
|
|
35
|
+
- Then, compare and organize the issue scores in self and subagent, refine the context of projects scoring below 60, and re-perform the review. And final score is the average of the three scores.
|
|
36
|
+
- List all the task status
|
|
37
|
+
- Executes the report-related processes, must use chinese(中文) to report
|
package/bin/d5cli
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { argv, env, platform } from "node:process";
|
|
2
|
+
import { argv, cwd, env, platform } from "node:process";
|
|
3
3
|
import { execSync, spawn } from "node:child_process";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
6
7
|
import { dirname, join } from "node:path";
|
|
7
8
|
import { fileURLToPath } from "node:url";
|
|
8
9
|
|
|
9
10
|
//#region package.json
|
|
10
11
|
var name$1 = "@d5render/cli";
|
|
11
|
-
var version = "0.1.
|
|
12
|
+
var version = "0.1.89";
|
|
12
13
|
|
|
13
14
|
//#endregion
|
|
14
15
|
//#region packages/env.ts
|
|
@@ -29,7 +30,6 @@ const envConfigKeys = [
|
|
|
29
30
|
"CI_MERGE_REQUEST_IID",
|
|
30
31
|
"CI_MERGE_REQUEST_TITLE",
|
|
31
32
|
"CI_MERGE_REQUEST_DESCRIPTION",
|
|
32
|
-
"JIRA_BASE_URL",
|
|
33
33
|
"DINGTALK_WEBHOOK",
|
|
34
34
|
"GITLAB_TOKEN",
|
|
35
35
|
"JIRA_PAT",
|
|
@@ -39,7 +39,7 @@ const envConfigKeys = [
|
|
|
39
39
|
"TOKEN_USAGE"
|
|
40
40
|
];
|
|
41
41
|
const envUsed = Object.defineProperty({}, "JIRA_BASE_URL", {
|
|
42
|
-
get: () => toEnv("
|
|
42
|
+
get: () => toEnv("JIRA_BASE_URL", "http://jira.d5techs.com.cn"),
|
|
43
43
|
enumerable: true,
|
|
44
44
|
configurable: true
|
|
45
45
|
});
|
|
@@ -126,16 +126,17 @@ async function sendding(title, text) {
|
|
|
126
126
|
//#region review/helper.ts
|
|
127
127
|
const NAME = name$1.replaceAll("/", "_");
|
|
128
128
|
const VERSION = version;
|
|
129
|
-
const
|
|
129
|
+
const CWD = env.CI_PROJECT_DIR || cwd();
|
|
130
|
+
const TEMP = join(tmpdir(), `.${NAME}`);
|
|
130
131
|
const common_review_prompt = `Load code-review skills, then call the mcp tool '${name}-${getHash}' to load code-review commits.
|
|
131
132
|
Then use chinese(中文) to call the mcp tool '${name}-${report}', only main agent can call the tool '${name}-${report}', **prevent** subagent from calling tool '${name}-${report}`;
|
|
132
133
|
async function changelog() {
|
|
133
|
-
const changelog = readFileSync(join(RUNTIME_CWD, "README.md"), "utf8");
|
|
134
|
-
const cachepath = join(TEMP, "CHANGELOG_" + createHash("md5").update(env.DINGTALK_WEBHOOK || env.CI_RUNNER_ID || env.CI_PROJECT_ID || "").digest("hex"));
|
|
135
|
-
if (changelog === (existsSync(cachepath) ? readFileSync(cachepath, "utf8") : "")) return;
|
|
136
134
|
if (!existsSync(TEMP)) mkdirSync(TEMP, { recursive: true });
|
|
135
|
+
const changelog = readFileSync(join(RUNTIME_CWD, "README.md"), "utf8");
|
|
136
|
+
const cachepath = join(TEMP, "CHANGELOG_" + createHash("md5").update(env.DINGTALK_WEBHOOK || env.CI_RUNNER_ID || env.CI_PROJECT_ID || "").digest("hex")), feedback_cachepath = join(env.CI_PROJECT_DIR || "", `../../.${NAME}`);
|
|
137
|
+
if (changelog === (existsSync(cachepath) ? readFileSync(cachepath, "utf8") : existsSync(feedback_cachepath) ? readFileSync(feedback_cachepath, "utf8") : "")) return;
|
|
137
138
|
writeFileSync(cachepath, changelog, "utf8");
|
|
138
|
-
console.log("updated CHANGELOG cache
|
|
139
|
+
console.log("updated CHANGELOG cache...");
|
|
139
140
|
let matched = changelog.match(/CHANGELOG[\s\S]*?(#+[^\n]*\n+([\s\S]*?))(?=#+|$)/)?.[1] ?? "";
|
|
140
141
|
const matcheds = matched.split("\n");
|
|
141
142
|
matcheds.shift();
|
|
@@ -325,7 +326,7 @@ async function cli() {
|
|
|
325
326
|
];
|
|
326
327
|
let child;
|
|
327
328
|
if (platform === "win32") child = spawn(bin, args, {
|
|
328
|
-
cwd:
|
|
329
|
+
cwd: CWD,
|
|
329
330
|
stdio: [
|
|
330
331
|
"inherit",
|
|
331
332
|
"pipe",
|
|
@@ -334,7 +335,7 @@ async function cli() {
|
|
|
334
335
|
shell: true
|
|
335
336
|
});
|
|
336
337
|
else child = spawn("sh", ["-c", `export GH_TOKEN=${shellEscape(env.GH_TOKEN)}; exec ${bin} ${args.map((a) => shellEscape(a)).join(" ")}`], {
|
|
337
|
-
cwd:
|
|
338
|
+
cwd: CWD,
|
|
338
339
|
stdio: [
|
|
339
340
|
"inherit",
|
|
340
341
|
"pipe",
|
package/bin/mcpServer.js
CHANGED
|
@@ -18961,7 +18961,6 @@ const envConfigKeys = [
|
|
|
18961
18961
|
"CI_MERGE_REQUEST_IID",
|
|
18962
18962
|
"CI_MERGE_REQUEST_TITLE",
|
|
18963
18963
|
"CI_MERGE_REQUEST_DESCRIPTION",
|
|
18964
|
-
"JIRA_BASE_URL",
|
|
18965
18964
|
"DINGTALK_WEBHOOK",
|
|
18966
18965
|
"GITLAB_TOKEN",
|
|
18967
18966
|
"JIRA_PAT",
|
|
@@ -18971,7 +18970,7 @@ const envConfigKeys = [
|
|
|
18971
18970
|
"TOKEN_USAGE"
|
|
18972
18971
|
];
|
|
18973
18972
|
const envUsed = Object.defineProperty({}, "JIRA_BASE_URL", {
|
|
18974
|
-
get: () => toEnv("
|
|
18973
|
+
get: () => toEnv("JIRA_BASE_URL", "http://jira.d5techs.com.cn"),
|
|
18975
18974
|
enumerable: true,
|
|
18976
18975
|
configurable: true
|
|
18977
18976
|
});
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@d5render/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"author": "jasirou",
|
|
6
|
-
"bin": {
|
|
7
|
-
"d5cli": "bin/d5cli"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"CHANGELOG.md",
|
|
11
|
-
".skills/code-review",
|
|
12
|
-
".skills/devops",
|
|
13
|
-
"bin/d5cli",
|
|
14
|
-
"bin/mcpServer.js",
|
|
15
|
-
".github/instructions/severity.instructions.md"
|
|
16
|
-
],
|
|
17
|
-
"type": "module",
|
|
18
|
-
"main": "./bin/d5cli",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@d5render/cli",
|
|
3
|
+
"version": "0.1.89",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "jasirou",
|
|
6
|
+
"bin": {
|
|
7
|
+
"d5cli": "bin/d5cli"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"CHANGELOG.md",
|
|
11
|
+
".skills/code-review",
|
|
12
|
+
".skills/devops",
|
|
13
|
+
"bin/d5cli",
|
|
14
|
+
"bin/mcpServer.js",
|
|
15
|
+
".github/instructions/severity.instructions.md"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "./bin/d5cli",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "node ./setup.js build",
|
|
21
|
+
"release": "node ./setup.js publish",
|
|
22
|
+
"setup": "node ./setup.js",
|
|
23
|
+
"test": "node ./setup.js build:development"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"vscode-languageserver-protocol": "^3.17.5"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
30
|
+
"@types/node": "^25.1.0",
|
|
31
|
+
"@types/vscode": "^1.108.1",
|
|
32
|
+
"@vscode/vsce": "^3.7.1",
|
|
33
|
+
"json5": "^2.2.3",
|
|
34
|
+
"oxfmt": "^0.21.0",
|
|
35
|
+
"oxlint": "^1.42.0",
|
|
36
|
+
"rolldown": "1.0.0-rc.2",
|
|
37
|
+
"vitest": "^4.0.18",
|
|
38
|
+
"zod": "^4.3.6"
|
|
39
|
+
}
|
|
40
|
+
}
|