@aipanel/dsh-plugin 1.3.5 → 1.3.7
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 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -113,6 +113,9 @@ function checkRunsInPhase(check, phase) {
|
|
|
113
113
|
const run = check.run ?? "both";
|
|
114
114
|
return run === "both" || run === phase;
|
|
115
115
|
}
|
|
116
|
+
function checkRunsOnTarget(check, kind) {
|
|
117
|
+
return check.targets === void 0 || check.targets.includes(kind);
|
|
118
|
+
}
|
|
116
119
|
var FORMATS = [
|
|
117
120
|
"text",
|
|
118
121
|
"tsc",
|
|
@@ -122,6 +125,7 @@ var FORMATS = [
|
|
|
122
125
|
"aipanel-json"
|
|
123
126
|
];
|
|
124
127
|
var RUNS = ["edit", "manual", "both"];
|
|
128
|
+
var TARGET_KINDS = ["edited", "file", "project"];
|
|
125
129
|
function normalizeExtensions(raw) {
|
|
126
130
|
if (!Array.isArray(raw)) return void 0;
|
|
127
131
|
const extensions = raw.filter((item) => typeof item === "string" && item.trim() !== "").map((item) => {
|
|
@@ -130,6 +134,13 @@ function normalizeExtensions(raw) {
|
|
|
130
134
|
});
|
|
131
135
|
return extensions.length > 0 ? [...new Set(extensions)] : void 0;
|
|
132
136
|
}
|
|
137
|
+
function normalizeTargets(raw) {
|
|
138
|
+
if (!Array.isArray(raw)) return void 0;
|
|
139
|
+
const targets = raw.filter(
|
|
140
|
+
(item) => TARGET_KINDS.includes(item)
|
|
141
|
+
);
|
|
142
|
+
return targets.length > 0 ? [...new Set(targets)] : void 0;
|
|
143
|
+
}
|
|
133
144
|
function normalizeArgs(raw) {
|
|
134
145
|
if (!Array.isArray(raw)) return void 0;
|
|
135
146
|
const args = raw.filter((item) => typeof item === "string");
|
|
@@ -140,6 +151,7 @@ function normalizeCheck(raw) {
|
|
|
140
151
|
const value = raw;
|
|
141
152
|
const run = RUNS.includes(value.run) ? value.run : void 0;
|
|
142
153
|
const extensions = normalizeExtensions(value.extensions);
|
|
154
|
+
const targets = normalizeTargets(value.targets);
|
|
143
155
|
const cwd = typeof value.cwd === "string" && value.cwd ? { cwd: value.cwd } : {};
|
|
144
156
|
const timeout = typeof value.timeoutMs === "number" && Number.isFinite(value.timeoutMs) && value.timeoutMs > 0 ? { timeoutMs: Math.floor(value.timeoutMs) } : {};
|
|
145
157
|
const format = FORMATS.includes(value.format) ? { format: value.format } : {};
|
|
@@ -148,6 +160,7 @@ function normalizeCheck(raw) {
|
|
|
148
160
|
return {
|
|
149
161
|
builtin: "typecheck",
|
|
150
162
|
...run ? { run } : {},
|
|
163
|
+
...targets ? { targets } : {},
|
|
151
164
|
...extensions ? { extensions } : {}
|
|
152
165
|
};
|
|
153
166
|
}
|
|
@@ -159,6 +172,7 @@ function normalizeCheck(raw) {
|
|
|
159
172
|
...presetArgs ? { args: presetArgs } : {},
|
|
160
173
|
...presetProjectArgs ? { projectArgs: presetProjectArgs } : {},
|
|
161
174
|
...extensions ? { extensions } : {},
|
|
175
|
+
...targets ? { targets } : {},
|
|
162
176
|
...run ? { run } : {},
|
|
163
177
|
...format,
|
|
164
178
|
...cwd,
|
|
@@ -180,6 +194,7 @@ function normalizeCheck(raw) {
|
|
|
180
194
|
...args ? { args } : {},
|
|
181
195
|
...projectArgs ? { projectArgs } : {},
|
|
182
196
|
...extensions ? { extensions } : {},
|
|
197
|
+
...targets ? { targets } : {},
|
|
183
198
|
...cwd,
|
|
184
199
|
...run ? { run } : {},
|
|
185
200
|
...format,
|
|
@@ -1347,7 +1362,9 @@ async function runTypecheckCheck(check, target, phase, severity) {
|
|
|
1347
1362
|
];
|
|
1348
1363
|
}
|
|
1349
1364
|
async function runDiagnostics(target, policy, phase) {
|
|
1350
|
-
const checks = policy.checks.filter(
|
|
1365
|
+
const checks = policy.checks.filter(
|
|
1366
|
+
(check) => checkRunsInPhase(check, phase) && checkRunsOnTarget(check, target.kind)
|
|
1367
|
+
);
|
|
1351
1368
|
log2.debug("runDiagnostics", { phase, target: target.kind, checks: checks.length });
|
|
1352
1369
|
const results = await Promise.all(
|
|
1353
1370
|
checks.map((check) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aipanel/dsh-plugin",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AIPanel for DeepSeek Harness (dsh):注入审查工具 run_diagnostics、编辑后自动诊断。",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"vue-tsc": "^3.3.9"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@aipanel/core": "1.3.
|
|
19
|
+
"@aipanel/core": "1.3.7",
|
|
20
20
|
"@deepseek-ai/cordis": "~4.0.4",
|
|
21
21
|
"@deepseek-ai/dsh-agent": "^0.1.7-alpha.2",
|
|
22
22
|
"@deepseek-ai/dsh-llm": "^0.1.7-alpha.2",
|