@wrongstack/plugins 0.319.0 → 0.319.1
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/accessibility-auditor.js +21 -4
- package/dist/api-compatibility-gate.js +3 -1
- package/dist/auto-i18n-extractor.js +9 -3
- package/dist/changelog-writer.js +1 -4
- package/dist/code-metrics.js +3 -1
- package/dist/config-validator.js +6 -2
- package/dist/context-pins.js +4 -1
- package/dist/cost-tracker.js +3 -1
- package/dist/cron.js +8 -2
- package/dist/dep-guard.js +3 -1
- package/dist/dependency-vulnerability-gate.js +3 -1
- package/dist/diff-summary.js +9 -3
- package/dist/doc-sync-guard.js +6 -2
- package/dist/feature-flag-tracker.js +3 -1
- package/dist/format-on-save.js +3 -1
- package/dist/import-organizer.js +3 -1
- package/dist/index.js +261 -117
- package/dist/interface-contract-guard.js +3 -1
- package/dist/knowledge-graph.js +9 -4
- package/dist/license-audit-gate.js +15 -3
- package/dist/path-guard.js +8 -2
- package/dist/pr-drafter.js +3 -1
- package/dist/process-guard.js +3 -1
- package/dist/prompt-firewall.js +14 -4
- package/dist/refactor-suggester.js +3 -1
- package/dist/security-hotspot-scanner.js +21 -3
- package/dist/semantic-search-indexer.js +12 -7
- package/dist/semver-bump.js +17 -12
- package/dist/shell-check.js +7 -10
- package/dist/smart-rename.js +8 -6
- package/dist/spec-linker.js +3 -1
- package/dist/template-engine.js +18 -12
- package/dist/test-flake-detector.js +1 -4
- package/dist/test-generator.js +3 -1
- package/dist/test-runner-gate.js +27 -15
- package/dist/type-gate.js +3 -1
- package/package.json +5 -5
|
@@ -200,7 +200,9 @@ var plugin = {
|
|
|
200
200
|
If you changed member shapes, search the project for implementers/\`satisfies\`/\`as\` usages and update them accordingly.`
|
|
201
201
|
};
|
|
202
202
|
};
|
|
203
|
-
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
203
|
+
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
204
|
+
background: true
|
|
205
|
+
});
|
|
204
206
|
api.tools.register({
|
|
205
207
|
name: "check_interface_contracts",
|
|
206
208
|
description: "Scan TypeScript files for interface declarations that have no visible implementer (implements / as / satisfies).",
|
package/dist/knowledge-graph.js
CHANGED
|
@@ -240,9 +240,12 @@ var plugin = {
|
|
|
240
240
|
const hasMatch = f.subject.toLowerCase().includes(q) || f.relation.toLowerCase().includes(q) || f.object.toLowerCase().includes(q);
|
|
241
241
|
if (!hasMatch) return false;
|
|
242
242
|
}
|
|
243
|
-
if (input.subject && !f.subject.toLowerCase().includes(input.subject.toLowerCase()))
|
|
244
|
-
|
|
245
|
-
if (input.
|
|
243
|
+
if (input.subject && !f.subject.toLowerCase().includes(input.subject.toLowerCase()))
|
|
244
|
+
return false;
|
|
245
|
+
if (input.relation && !f.relation.toLowerCase().includes(input.relation.toLowerCase()))
|
|
246
|
+
return false;
|
|
247
|
+
if (input.object && !f.object.toLowerCase().includes(input.object.toLowerCase()))
|
|
248
|
+
return false;
|
|
246
249
|
if (filterConf && f.confidence.toLowerCase() !== filterConf) return false;
|
|
247
250
|
return true;
|
|
248
251
|
});
|
|
@@ -274,7 +277,9 @@ var plugin = {
|
|
|
274
277
|
const raw = input ?? {};
|
|
275
278
|
const rawId = String(input.id ?? raw["factId"] ?? raw["fact_id"] ?? "").trim();
|
|
276
279
|
const normalized = rawId.toLowerCase().startsWith("kg-") ? rawId.toLowerCase() : `kg-${rawId.toLowerCase()}`;
|
|
277
|
-
state.facts = state.facts.filter(
|
|
280
|
+
state.facts = state.facts.filter(
|
|
281
|
+
(f) => f.id.toLowerCase() !== normalized && f.id !== rawId
|
|
282
|
+
);
|
|
278
283
|
const removed = before - state.facts.length;
|
|
279
284
|
if (removed === 0) return { ok: false, error: `no fact matches "${input.id ?? rawId}"` };
|
|
280
285
|
state.removals += removed;
|
|
@@ -52,7 +52,9 @@ function parseInstallCommands(command) {
|
|
|
52
52
|
if (!cleaned) continue;
|
|
53
53
|
let name = cleaned;
|
|
54
54
|
let version = null;
|
|
55
|
-
const pipMatch = /^([A-Za-z0-9_.-]+(?:\[[^\]]+\])?)\s*(==|>=|<=|~=|!=|>|<)\s*(.+)$/.exec(
|
|
55
|
+
const pipMatch = /^([A-Za-z0-9_.-]+(?:\[[^\]]+\])?)\s*(==|>=|<=|~=|!=|>|<)\s*(.+)$/.exec(
|
|
56
|
+
cleaned
|
|
57
|
+
);
|
|
56
58
|
if (pipMatch?.[1]) {
|
|
57
59
|
name = pipMatch[1];
|
|
58
60
|
const op = pipMatch[2] ?? "";
|
|
@@ -391,7 +393,15 @@ var state2 = {
|
|
|
391
393
|
};
|
|
392
394
|
var DEFAULTS2 = {
|
|
393
395
|
enabled: true,
|
|
394
|
-
allowedLicenses: [
|
|
396
|
+
allowedLicenses: [
|
|
397
|
+
"MIT",
|
|
398
|
+
"Apache-2.0",
|
|
399
|
+
"BSD-2-Clause",
|
|
400
|
+
"BSD-3-Clause",
|
|
401
|
+
"ISC",
|
|
402
|
+
"0BSD",
|
|
403
|
+
"Unlicense"
|
|
404
|
+
],
|
|
395
405
|
block: true
|
|
396
406
|
};
|
|
397
407
|
function normalizeStrings(v) {
|
|
@@ -430,7 +440,9 @@ function extractLicenseStrings(pkg) {
|
|
|
430
440
|
}
|
|
431
441
|
function parsePackageNames(command) {
|
|
432
442
|
return [
|
|
433
|
-
...new Set(
|
|
443
|
+
...new Set(
|
|
444
|
+
parseInstallCommands(command).flatMap((entry) => entry.packages.map((pkg) => pkg.name))
|
|
445
|
+
)
|
|
434
446
|
];
|
|
435
447
|
}
|
|
436
448
|
function splitTopLevel(expr, separator) {
|
package/dist/path-guard.js
CHANGED
|
@@ -1469,9 +1469,15 @@ var plugin = {
|
|
|
1469
1469
|
kind: isRootPathScope(path) && deletesImplicitScope || isUnresolvedPathScope(path) || recursivelyDeletes && (isDirectoryAmbiguousPath(path) || hasConfiguredProtectedDescendant(path, cfg.protect)) ? "deletion-scope" : "file"
|
|
1470
1470
|
};
|
|
1471
1471
|
if (targetFullyAllowed(target, cfg.allow, allowRes)) return null;
|
|
1472
|
-
const protectedShellTarget = await targetIntersectsPatternsGuarded(target, cfg.protect, protectRes, {
|
|
1472
|
+
const protectedShellTarget = await targetIntersectsPatternsGuarded(target, cfg.protect, protectRes, {
|
|
1473
1473
|
onTimeout: bumpRedos
|
|
1474
|
-
})
|
|
1474
|
+
}) || await matchesAnyGuarded(
|
|
1475
|
+
`${target.path.replace(/\/$/, "")}/.path-guard-probe`,
|
|
1476
|
+
protectRes,
|
|
1477
|
+
{
|
|
1478
|
+
onTimeout: bumpRedos
|
|
1479
|
+
}
|
|
1480
|
+
);
|
|
1475
1481
|
return protectedShellTarget ? target : null;
|
|
1476
1482
|
})
|
|
1477
1483
|
);
|
package/dist/pr-drafter.js
CHANGED
|
@@ -286,7 +286,9 @@ var plugin = {
|
|
|
286
286
|
async execute(input = {}) {
|
|
287
287
|
if (!cfg.enabled) return { ok: false, error: "pr-drafter is disabled" };
|
|
288
288
|
const raw = input ?? {};
|
|
289
|
-
const preview = Boolean(
|
|
289
|
+
const preview = Boolean(
|
|
290
|
+
input?.preview ?? raw["dryRun"] ?? raw["dry_run"] ?? raw["dry"] ?? raw["previewOnly"]
|
|
291
|
+
);
|
|
290
292
|
const rawOutputPath = raw["outputPath"] ?? raw["output_path"] ?? raw["path"] ?? raw["filePath"] ?? raw["file"] ?? raw["TargetFile"] ?? raw["targetFile"] ?? cfg.outputPath;
|
|
291
293
|
const outputPathStr = typeof rawOutputPath === "string" && rawOutputPath.trim().length > 0 ? rawOutputPath.trim() : cfg.outputPath;
|
|
292
294
|
const draft = await buildDraft(cfg, api.llm);
|
package/dist/process-guard.js
CHANGED
|
@@ -64,7 +64,9 @@ var plugin = {
|
|
|
64
64
|
const rawCmd = ti["command"] ?? ti["CommandLine"] ?? ti["cmd"] ?? ti["script"] ?? ti["input"];
|
|
65
65
|
const command = typeof rawCmd === "string" ? rawCmd : "";
|
|
66
66
|
if (!command) return;
|
|
67
|
-
const isKillRelated = /\b(?:kill|taskkill|stop-process|tskill|pkill|killall|wmic)\b/i.test(
|
|
67
|
+
const isKillRelated = /\b(?:kill|taskkill|stop-process|tskill|pkill|killall|wmic)\b/i.test(
|
|
68
|
+
command
|
|
69
|
+
);
|
|
68
70
|
if (!isKillRelated) return;
|
|
69
71
|
state.detections += 1;
|
|
70
72
|
state.lastDetection = {
|
package/dist/prompt-firewall.js
CHANGED
|
@@ -293,9 +293,12 @@ function surfaceScanTrips(api, tripped) {
|
|
|
293
293
|
}
|
|
294
294
|
state.timeoutCount += 1;
|
|
295
295
|
api.metrics.counter("redos_skips", 1);
|
|
296
|
-
api.log.warn(
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
api.log.warn(
|
|
297
|
+
"prompt-firewall: scan-pass budget exceeded \u2014 patterns skipped mid-pass (issue #370)",
|
|
298
|
+
{
|
|
299
|
+
skipped: [...tripped]
|
|
300
|
+
}
|
|
301
|
+
);
|
|
299
302
|
}
|
|
300
303
|
var plugin = {
|
|
301
304
|
name: "prompt-firewall",
|
|
@@ -397,7 +400,14 @@ var plugin = {
|
|
|
397
400
|
if (cfg.mode === "redact") {
|
|
398
401
|
const counter = { n: 0 };
|
|
399
402
|
const deadline = createScanDeadline();
|
|
400
|
-
const redactedReq = redactDeep(
|
|
403
|
+
const redactedReq = redactDeep(
|
|
404
|
+
req,
|
|
405
|
+
cfg.allow,
|
|
406
|
+
counter,
|
|
407
|
+
skipSet,
|
|
408
|
+
void 0,
|
|
409
|
+
deadline
|
|
410
|
+
);
|
|
401
411
|
state.requestRedactions += counter.n;
|
|
402
412
|
api.metrics.counter("request_redactions", counter.n);
|
|
403
413
|
if (deadline.tripped.size > 0) surfaceScanTrips(api, deadline.tripped);
|
|
@@ -295,7 +295,9 @@ var plugin = {
|
|
|
295
295
|
contextAs: "separate"
|
|
296
296
|
};
|
|
297
297
|
};
|
|
298
|
-
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
298
|
+
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
299
|
+
background: true
|
|
300
|
+
});
|
|
299
301
|
api.tools.register({
|
|
300
302
|
name: "suggest_refactors",
|
|
301
303
|
description: "Scan source files for refactoring smells: long functions, deep nesting, many parameters, magic numbers, and console logging.",
|
|
@@ -38,7 +38,19 @@ var DEFAULTS = {
|
|
|
38
38
|
enabled: false,
|
|
39
39
|
severity: "warn",
|
|
40
40
|
maxFindings: 10,
|
|
41
|
-
scanOnChange: [
|
|
41
|
+
scanOnChange: [
|
|
42
|
+
".js",
|
|
43
|
+
".jsx",
|
|
44
|
+
".ts",
|
|
45
|
+
".tsx",
|
|
46
|
+
".mjs",
|
|
47
|
+
".cjs",
|
|
48
|
+
".py",
|
|
49
|
+
".java",
|
|
50
|
+
".go",
|
|
51
|
+
".rb",
|
|
52
|
+
".php"
|
|
53
|
+
]
|
|
42
54
|
};
|
|
43
55
|
var scanOnChangeSet = new Set(DEFAULTS.scanOnChange);
|
|
44
56
|
function readConfig(raw) {
|
|
@@ -61,7 +73,11 @@ function readConfig(raw) {
|
|
|
61
73
|
}
|
|
62
74
|
var PATTERNS = [
|
|
63
75
|
{ type: "eval_call", severity: "high", regex: /\beval\s*\(/i },
|
|
64
|
-
{
|
|
76
|
+
{
|
|
77
|
+
type: "function_constructor",
|
|
78
|
+
severity: "high",
|
|
79
|
+
regex: /\bnew\s+Function\s*\(|\bFunction\s*\(/i
|
|
80
|
+
},
|
|
65
81
|
{
|
|
66
82
|
type: "unsafe_html",
|
|
67
83
|
severity: "high",
|
|
@@ -299,7 +315,9 @@ Review or remove the risky pattern(s).`;
|
|
|
299
315
|
}
|
|
300
316
|
return { additionalContext: message };
|
|
301
317
|
};
|
|
302
|
-
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
318
|
+
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
319
|
+
background: true
|
|
320
|
+
});
|
|
303
321
|
api.tools.register({
|
|
304
322
|
name: "security_hotspot_scan",
|
|
305
323
|
description: "Scan a file or directory for security anti-patterns (eval, Function constructor, innerHTML, SQL concatenation, http URLs, credential logging, variable exec commands).",
|
|
@@ -52,11 +52,7 @@ var DEFAULTS = {
|
|
|
52
52
|
".scss",
|
|
53
53
|
".html"
|
|
54
54
|
],
|
|
55
|
-
excludePatterns: [
|
|
56
|
-
...DEFAULT_WALK_IGNORE_DIRS.map(escapeRegex),
|
|
57
|
-
"\\.wrongstack",
|
|
58
|
-
"\\.temp_files"
|
|
59
|
-
],
|
|
55
|
+
excludePatterns: [...DEFAULT_WALK_IGNORE_DIRS.map(escapeRegex), "\\.wrongstack", "\\.temp_files"],
|
|
60
56
|
maxFileBytes: 1e6,
|
|
61
57
|
defaultLimit: 10,
|
|
62
58
|
minTokenLength: 2,
|
|
@@ -64,7 +60,12 @@ var DEFAULTS = {
|
|
|
64
60
|
maxFiles: 5e3
|
|
65
61
|
};
|
|
66
62
|
function readConfig(raw) {
|
|
67
|
-
if (!raw || typeof raw !== "object")
|
|
63
|
+
if (!raw || typeof raw !== "object")
|
|
64
|
+
return {
|
|
65
|
+
...DEFAULTS,
|
|
66
|
+
includeExtensions: [...DEFAULTS.includeExtensions],
|
|
67
|
+
excludePatterns: [...DEFAULTS.excludePatterns]
|
|
68
|
+
};
|
|
68
69
|
const r = raw;
|
|
69
70
|
const rawExts = r["includeExtensions"] ?? r["include_extensions"] ?? r["extensions"] ?? r["file_extensions"];
|
|
70
71
|
const includeExtensions = Array.isArray(rawExts) ? rawExts.filter((x) => typeof x === "string") : [...DEFAULTS.includeExtensions];
|
|
@@ -375,7 +376,11 @@ var plugin = {
|
|
|
375
376
|
description: "Builds an in-memory keyword index over project source files and answers ranked search queries",
|
|
376
377
|
apiVersion: API_VERSION,
|
|
377
378
|
capabilities: { tools: true },
|
|
378
|
-
defaultConfig: {
|
|
379
|
+
defaultConfig: {
|
|
380
|
+
...DEFAULTS,
|
|
381
|
+
includeExtensions: [...DEFAULTS.includeExtensions],
|
|
382
|
+
excludePatterns: [...DEFAULTS.excludePatterns]
|
|
383
|
+
},
|
|
379
384
|
configSchema: {
|
|
380
385
|
type: "object",
|
|
381
386
|
properties: {
|
package/dist/semver-bump.js
CHANGED
|
@@ -23,19 +23,24 @@ var state = {
|
|
|
23
23
|
};
|
|
24
24
|
function runCommand(command, args, cwd) {
|
|
25
25
|
return new Promise((resolve2, reject) => {
|
|
26
|
-
execFile(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
execFile(
|
|
27
|
+
command,
|
|
28
|
+
args,
|
|
29
|
+
{
|
|
30
|
+
encoding: "utf-8",
|
|
31
|
+
cwd,
|
|
32
|
+
timeout: 3e4,
|
|
33
|
+
windowsHide: true
|
|
34
|
+
},
|
|
35
|
+
(err, stdout, stderr) => {
|
|
36
|
+
if (!err) {
|
|
37
|
+
resolve2(stdout.trim());
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const failure = err;
|
|
41
|
+
reject(Object.assign(failure, { stderr: stderr || void 0 }));
|
|
35
42
|
}
|
|
36
|
-
|
|
37
|
-
reject(Object.assign(failure, { stderr: stderr || void 0 }));
|
|
38
|
-
});
|
|
43
|
+
);
|
|
39
44
|
});
|
|
40
45
|
}
|
|
41
46
|
async function runGit(args, cwd) {
|
package/dist/shell-check.js
CHANGED
|
@@ -26,15 +26,10 @@ var state = {
|
|
|
26
26
|
async function runShellCheck(files, severity, cwd) {
|
|
27
27
|
try {
|
|
28
28
|
await new Promise((resolvePromise, rejectPromise) => {
|
|
29
|
-
execFile(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(err) => {
|
|
34
|
-
if (err) rejectPromise(err);
|
|
35
|
-
else resolvePromise();
|
|
36
|
-
}
|
|
37
|
-
);
|
|
29
|
+
execFile("shellcheck", ["--version"], { encoding: "utf-8", windowsHide: true }, (err) => {
|
|
30
|
+
if (err) rejectPromise(err);
|
|
31
|
+
else resolvePromise();
|
|
32
|
+
});
|
|
38
33
|
});
|
|
39
34
|
} catch {
|
|
40
35
|
throw new Error(
|
|
@@ -195,7 +190,9 @@ var plugin = {
|
|
|
195
190
|
if (typeof rawFiles === "string" && rawFiles.trim().length > 0) {
|
|
196
191
|
files = [rawFiles.trim()];
|
|
197
192
|
} else if (Array.isArray(rawFiles)) {
|
|
198
|
-
files = rawFiles.filter(
|
|
193
|
+
files = rawFiles.filter(
|
|
194
|
+
(f) => typeof f === "string" && f.trim().length > 0
|
|
195
|
+
);
|
|
199
196
|
}
|
|
200
197
|
}
|
|
201
198
|
const rawDirectory = inp.directory ?? input["dir"] ?? input["SearchDirectory"];
|
package/dist/smart-rename.js
CHANGED
|
@@ -15,7 +15,8 @@ function normalizeExtensions(exts) {
|
|
|
15
15
|
return exts.map((e) => e.startsWith(".") ? e.toLowerCase() : `.${e.toLowerCase()}`);
|
|
16
16
|
}
|
|
17
17
|
function readConfig(raw) {
|
|
18
|
-
if (!raw || typeof raw !== "object")
|
|
18
|
+
if (!raw || typeof raw !== "object")
|
|
19
|
+
return { ...DEFAULTS, extensions: normalizeExtensions(DEFAULTS.extensions) };
|
|
19
20
|
const r = raw;
|
|
20
21
|
const rawExts = r["extensions"] ?? r["file_extensions"] ?? r["fileExtensions"];
|
|
21
22
|
const exts = Array.isArray(rawExts) ? rawExts.filter((x) => typeof x === "string") : DEFAULTS.extensions;
|
|
@@ -48,10 +49,7 @@ function isIdentifier(name) {
|
|
|
48
49
|
return IDENTIFIER_RE.test(name);
|
|
49
50
|
}
|
|
50
51
|
function renameInContent(content, oldName, newName) {
|
|
51
|
-
const re = new RegExp(
|
|
52
|
-
`(?<![A-Za-z0-9_$])${escapeRegex(oldName)}(?![A-Za-z0-9_$])`,
|
|
53
|
-
"g"
|
|
54
|
-
);
|
|
52
|
+
const re = new RegExp(`(?<![A-Za-z0-9_$])${escapeRegex(oldName)}(?![A-Za-z0-9_$])`, "g");
|
|
55
53
|
let replacements = 0;
|
|
56
54
|
const preview = content.replace(re, () => {
|
|
57
55
|
replacements++;
|
|
@@ -92,7 +90,11 @@ var plugin = {
|
|
|
92
90
|
path: { type: "string", description: "Source file path (relative to project root)." },
|
|
93
91
|
oldName: { type: "string", description: "Identifier to replace." },
|
|
94
92
|
newName: { type: "string", description: "New identifier." },
|
|
95
|
-
apply: {
|
|
93
|
+
apply: {
|
|
94
|
+
type: "boolean",
|
|
95
|
+
default: false,
|
|
96
|
+
description: "When true, write the preview back to disk."
|
|
97
|
+
}
|
|
96
98
|
},
|
|
97
99
|
required: ["path", "oldName", "newName"]
|
|
98
100
|
},
|
package/dist/spec-linker.js
CHANGED
|
@@ -434,7 +434,9 @@ var plugin = {
|
|
|
434
434
|
${lines}${overflowNote}`
|
|
435
435
|
};
|
|
436
436
|
};
|
|
437
|
-
state.postHookUnregister = api.registerHook("PostToolUse", "write|edit", postHook, {
|
|
437
|
+
state.postHookUnregister = api.registerHook("PostToolUse", "write|edit", postHook, {
|
|
438
|
+
background: true
|
|
439
|
+
});
|
|
438
440
|
if (cfg.autoFix) {
|
|
439
441
|
const preHook = async (input) => {
|
|
440
442
|
if (!cfg.enabled) return;
|
package/dist/template-engine.js
CHANGED
|
@@ -43,21 +43,27 @@ function expandTemplate(template, variables) {
|
|
|
43
43
|
return result;
|
|
44
44
|
}
|
|
45
45
|
function expandConditionals(template, variables) {
|
|
46
|
-
return template.replace(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
return template.replace(
|
|
47
|
+
/\{\{#if\s+([\w.-]+)\s*\}\}([\s\S]*?)\{\{\/if\}\}/g,
|
|
48
|
+
(_, key, content) => {
|
|
49
|
+
const val = variables[key];
|
|
50
|
+
return val !== void 0 && val !== "" && val !== "false" && val !== "0" ? content : "";
|
|
51
|
+
}
|
|
52
|
+
);
|
|
50
53
|
}
|
|
51
54
|
function expandLoops(template, variables) {
|
|
52
|
-
return template.replace(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
return template.replace(
|
|
56
|
+
/\{\{#each\s+([\w.-]+)\s*\}\}([\s\S]*?)\{\{\/each\}\}/g,
|
|
57
|
+
(_, key, content) => {
|
|
58
|
+
const val = variables[key];
|
|
59
|
+
if (!val) return "";
|
|
60
|
+
if (typeof val === "string" && val.includes(",")) {
|
|
61
|
+
const items = val.split(",").map((s) => s.trim());
|
|
62
|
+
return items.map((item) => expandTemplate(content, { ...variables, [key]: item, item })).join("\n");
|
|
63
|
+
}
|
|
64
|
+
return expandTemplate(content, variables);
|
|
58
65
|
}
|
|
59
|
-
|
|
60
|
-
});
|
|
66
|
+
);
|
|
61
67
|
}
|
|
62
68
|
function renderTemplate(template, variables, escapeHtml = true) {
|
|
63
69
|
let result = template;
|
|
@@ -283,10 +283,7 @@ var plugin = {
|
|
|
283
283
|
const commandString = typeof rawCommand === "string" && rawCommand.trim().length > 0 ? rawCommand.trim() : cfg.defaultCommand;
|
|
284
284
|
const rawRuns = input.runs ?? raw["runsRequested"] ?? raw["count"] ?? raw["repeat"] ?? raw["times"];
|
|
285
285
|
const requestedRuns = typeof rawRuns === "number" && rawRuns >= 1 ? Math.min(Math.floor(rawRuns), cfg.maxRuns) : 5;
|
|
286
|
-
const command = resolveTestCommand(
|
|
287
|
-
commandString,
|
|
288
|
-
testPattern
|
|
289
|
-
);
|
|
286
|
+
const command = resolveTestCommand(commandString, testPattern);
|
|
290
287
|
if (!command) {
|
|
291
288
|
return {
|
|
292
289
|
ok: false,
|
package/dist/test-generator.js
CHANGED
|
@@ -180,7 +180,9 @@ function generateTestContent(sourcePath, sourceModule, detected, cfg) {
|
|
|
180
180
|
}
|
|
181
181
|
if (detected.length === 0) {
|
|
182
182
|
lines.push(` it('has no exported symbols to test', () => {`);
|
|
183
|
-
lines.push(
|
|
183
|
+
lines.push(
|
|
184
|
+
cfg.framework === "node:test" ? ` assert.ok(true);` : ` expect(true).toBe(true);`
|
|
185
|
+
);
|
|
184
186
|
lines.push(` });`);
|
|
185
187
|
}
|
|
186
188
|
lines.push(`});`);
|
package/dist/test-runner-gate.js
CHANGED
|
@@ -153,13 +153,18 @@ async function detectRunner(requested) {
|
|
|
153
153
|
try {
|
|
154
154
|
await new Promise((resolve, reject) => {
|
|
155
155
|
const ex = resolveExec("npx", [`${match.name}`, "--version"]);
|
|
156
|
-
execFile(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
execFile(
|
|
157
|
+
ex.cmd,
|
|
158
|
+
ex.args,
|
|
159
|
+
{
|
|
160
|
+
encoding: "utf-8",
|
|
161
|
+
timeout: 5e3,
|
|
162
|
+
cwd: process.cwd(),
|
|
163
|
+
windowsHide: true,
|
|
164
|
+
...ex.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
165
|
+
},
|
|
166
|
+
(err) => err ? reject(err) : resolve()
|
|
167
|
+
);
|
|
163
168
|
});
|
|
164
169
|
return match;
|
|
165
170
|
} catch {
|
|
@@ -170,13 +175,18 @@ async function detectRunner(requested) {
|
|
|
170
175
|
try {
|
|
171
176
|
await new Promise((resolve, reject) => {
|
|
172
177
|
const ex = resolveExec("npx", [`${candidate.name}`, "--version"]);
|
|
173
|
-
execFile(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
execFile(
|
|
179
|
+
ex.cmd,
|
|
180
|
+
ex.args,
|
|
181
|
+
{
|
|
182
|
+
encoding: "utf-8",
|
|
183
|
+
timeout: 5e3,
|
|
184
|
+
cwd: process.cwd(),
|
|
185
|
+
windowsHide: true,
|
|
186
|
+
...ex.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
187
|
+
},
|
|
188
|
+
(err) => err ? reject(err) : resolve()
|
|
189
|
+
);
|
|
180
190
|
});
|
|
181
191
|
return candidate;
|
|
182
192
|
} catch {
|
|
@@ -444,7 +454,9 @@ var plugin = {
|
|
|
444
454
|
Fix the failing tests or revert the change if it broke something.`
|
|
445
455
|
};
|
|
446
456
|
};
|
|
447
|
-
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
457
|
+
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
458
|
+
background: true
|
|
459
|
+
});
|
|
448
460
|
api.tools.register({
|
|
449
461
|
name: "test_gate_status",
|
|
450
462
|
description: "Reports test-runner-gate state: command, patterns, and per-session pass/fail/error/no-test counters.",
|
package/dist/type-gate.js
CHANGED
|
@@ -242,7 +242,9 @@ Fix the type error(s) or adjust the change.`;
|
|
|
242
242
|
}
|
|
243
243
|
return { additionalContext: message };
|
|
244
244
|
};
|
|
245
|
-
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
245
|
+
state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, {
|
|
246
|
+
background: true
|
|
247
|
+
});
|
|
246
248
|
api.tools.register({
|
|
247
249
|
name: "type_gate_status",
|
|
248
250
|
description: "Reports type-gate state: command, tsconfig, severity, and per-session pass/fail/error counters.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/plugins",
|
|
3
|
-
"version": "0.319.
|
|
3
|
+
"version": "0.319.1",
|
|
4
4
|
"description": "Official WrongStack collection of focused plugins for code quality, security, observability, planning, and agent coordination",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ECOSTACK TECHNOLOGY OÜ",
|
|
@@ -303,10 +303,10 @@
|
|
|
303
303
|
"vitest": "^4.1.11"
|
|
304
304
|
},
|
|
305
305
|
"dependencies": {
|
|
306
|
-
"@wrongstack/core": "0.319.
|
|
307
|
-
"@wrongstack/primitives": "0.319.
|
|
308
|
-
"@wrongstack/plugin-sdk": "0.319.
|
|
309
|
-
"@wrongstack/tools": "0.319.
|
|
306
|
+
"@wrongstack/core": "0.319.1",
|
|
307
|
+
"@wrongstack/primitives": "0.319.1",
|
|
308
|
+
"@wrongstack/plugin-sdk": "0.319.1",
|
|
309
|
+
"@wrongstack/tools": "0.319.1"
|
|
310
310
|
},
|
|
311
311
|
"scripts": {
|
|
312
312
|
"build": "node ../../scripts/build-package.mjs",
|