@wrongstack/plugins 0.292.1 → 0.295.0
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/README.md +7 -71
- package/dist/accessibility-auditor/index.d.ts +1 -1
- package/dist/accessibility-auditor/index.d.ts.map +1 -1
- package/dist/accessibility-auditor.js +31 -31
- package/dist/agent-handoff/index.d.ts +1 -1
- package/dist/agent-handoff/index.d.ts.map +1 -1
- package/dist/api-compatibility-gate/index.d.ts +1 -1
- package/dist/api-compatibility-gate/index.d.ts.map +1 -1
- package/dist/api-compatibility-gate.js +21 -16
- package/dist/audit/index.d.ts +386 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit.d.ts +1 -0
- package/dist/audit.js +454 -0
- package/dist/auto-doc/index.d.ts +1 -1
- package/dist/auto-doc/index.d.ts.map +1 -1
- package/dist/auto-escalate/index.d.ts +1 -1
- package/dist/auto-escalate/index.d.ts.map +1 -1
- package/dist/auto-i18n-extractor/index.d.ts +1 -1
- package/dist/auto-i18n-extractor/index.d.ts.map +1 -1
- package/dist/auto-i18n-extractor.js +2 -1
- package/dist/branch-guard/index.d.ts +1 -1
- package/dist/branch-guard/index.d.ts.map +1 -1
- package/dist/branch-guard.js +9 -1
- package/dist/catalog.d.ts +5 -30
- package/dist/catalog.d.ts.map +1 -1
- package/dist/changelog-writer/index.d.ts +1 -1
- package/dist/changelog-writer/index.d.ts.map +1 -1
- package/dist/checkpoint/index.d.ts +1 -1
- package/dist/checkpoint/index.d.ts.map +1 -1
- package/dist/checkpoint.js +7 -8
- package/dist/code-metrics/index.d.ts +1 -1
- package/dist/code-metrics/index.d.ts.map +1 -1
- package/dist/code-metrics.js +29 -29
- package/dist/commit-validator/index.d.ts +1 -1
- package/dist/commit-validator/index.d.ts.map +1 -1
- package/dist/config-validator/index.d.ts +1 -1
- package/dist/config-validator/index.d.ts.map +1 -1
- package/dist/context-pins/index.d.ts +1 -1
- package/dist/context-pins/index.d.ts.map +1 -1
- package/dist/cost-tracker/index.d.ts +1 -1
- package/dist/cost-tracker/index.d.ts.map +1 -1
- package/dist/cost-tracker.js +9 -2
- package/dist/cron/index.d.ts +1 -1
- package/dist/cron/index.d.ts.map +1 -1
- package/dist/dead-code-detector/index.d.ts +1 -1
- package/dist/dead-code-detector/index.d.ts.map +1 -1
- package/dist/dead-code-detector.js +26 -18
- package/dist/dep-guard/index.d.ts +1 -1
- package/dist/dep-guard/index.d.ts.map +1 -1
- package/dist/dependency-vulnerability-gate/index.d.ts +1 -1
- package/dist/dependency-vulnerability-gate/index.d.ts.map +1 -1
- package/dist/dependency-vulnerability-gate.js +34 -22
- package/dist/diff-summary/index.d.ts +1 -1
- package/dist/diff-summary/index.d.ts.map +1 -1
- package/dist/diff-summary.js +28 -29
- package/dist/doc-sync-guard/index.d.ts +1 -1
- package/dist/doc-sync-guard/index.d.ts.map +1 -1
- package/dist/doc-sync-guard.js +2 -1
- package/dist/duplicate-code-detector/index.d.ts +26 -1
- package/dist/duplicate-code-detector/index.d.ts.map +1 -1
- package/dist/duplicate-code-detector.js +178 -67
- package/dist/error-lens/index.d.ts +1 -1
- package/dist/error-lens/index.d.ts.map +1 -1
- package/dist/factories/index.d.ts +4 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories.d.ts +1 -0
- package/dist/factories.js +74 -0
- package/dist/feature-flag-tracker/index.d.ts +1 -1
- package/dist/feature-flag-tracker/index.d.ts.map +1 -1
- package/dist/feature-flag-tracker.js +29 -29
- package/dist/file-watcher/index.d.ts +1 -1
- package/dist/file-watcher/index.d.ts.map +1 -1
- package/dist/format-on-save/index.d.ts +1 -1
- package/dist/format-on-save/index.d.ts.map +1 -1
- package/dist/format-on-save.js +2 -1
- package/dist/generated-plugin-exports.d.ts +65 -0
- package/dist/generated-plugin-exports.d.ts.map +1 -0
- package/dist/git-autocommit/index.d.ts +1 -1
- package/dist/git-autocommit/index.d.ts.map +1 -1
- package/dist/import-organizer/index.d.ts +1 -1
- package/dist/import-organizer/index.d.ts.map +1 -1
- package/dist/import-organizer.js +2 -1
- package/dist/index.d.ts +4 -183
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17675 -17377
- package/dist/injection-shield/index.d.ts +1 -1
- package/dist/injection-shield/index.d.ts.map +1 -1
- package/dist/interface-contract-guard/index.d.ts +1 -1
- package/dist/interface-contract-guard/index.d.ts.map +1 -1
- package/dist/interface-contract-guard.js +29 -29
- package/dist/knowledge-graph/index.d.ts +1 -1
- package/dist/knowledge-graph/index.d.ts.map +1 -1
- package/dist/license-audit-gate/index.d.ts +1 -1
- package/dist/license-audit-gate/index.d.ts.map +1 -1
- package/dist/lint-gate/index.d.ts +1 -1
- package/dist/lint-gate/index.d.ts.map +1 -1
- package/dist/lint-gate.js +10 -1
- package/dist/llm-cache/index.d.ts +5 -1
- package/dist/llm-cache/index.d.ts.map +1 -1
- package/dist/llm-cache.js +16 -8
- package/dist/loop-breaker/index.d.ts +1 -1
- package/dist/loop-breaker/index.d.ts.map +1 -1
- package/dist/loop-breaker.js +10 -4
- package/dist/manifest/index.d.ts +16 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest.d.ts +1 -0
- package/dist/manifest.js +152 -0
- package/dist/migration-planner/index.d.ts +1 -1
- package/dist/migration-planner/index.d.ts.map +1 -1
- package/dist/migration-planner.js +2 -1
- package/dist/model-router/index.d.ts +1 -1
- package/dist/model-router/index.d.ts.map +1 -1
- package/dist/notify-hub/index.d.ts +1 -1
- package/dist/notify-hub/index.d.ts.map +1 -1
- package/dist/notify-hub/webhook-channel.d.ts +1 -1
- package/dist/notify-hub/webhook-channel.d.ts.map +1 -1
- package/dist/path-guard/index.d.ts +1 -1
- package/dist/path-guard/index.d.ts.map +1 -1
- package/dist/performance-regression-gate/index.d.ts +1 -1
- package/dist/performance-regression-gate/index.d.ts.map +1 -1
- package/dist/plugin-stack-observer/index.d.ts +1 -1
- package/dist/plugin-stack-observer/index.d.ts.map +1 -1
- package/dist/pr-drafter/index.d.ts +1 -1
- package/dist/pr-drafter/index.d.ts.map +1 -1
- package/dist/pr-drafter.js +28 -29
- package/dist/process-guard/index.d.ts +1 -1
- package/dist/process-guard/index.d.ts.map +1 -1
- package/dist/prompt-firewall/index.d.ts +1 -1
- package/dist/prompt-firewall/index.d.ts.map +1 -1
- package/dist/refactor-suggester/index.d.ts +1 -1
- package/dist/refactor-suggester/index.d.ts.map +1 -1
- package/dist/refactor-suggester.js +29 -29
- package/dist/release-notes-generator/index.d.ts +1 -1
- package/dist/release-notes-generator/index.d.ts.map +1 -1
- package/dist/release-notes-generator.js +29 -22
- package/dist/runtime/index.d.ts +15 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/llm.d.ts +1 -1
- package/dist/runtime/llm.d.ts.map +1 -1
- package/dist/runtime.js +43 -2
- package/dist/schema-evolution-guard/index.d.ts +1 -1
- package/dist/schema-evolution-guard/index.d.ts.map +1 -1
- package/dist/schema-evolution-guard.js +2 -1
- package/dist/secret-scanner/index.d.ts +1 -1
- package/dist/secret-scanner/index.d.ts.map +1 -1
- package/dist/secret-scanner.js +7 -1
- package/dist/security-hotspot-scanner/index.d.ts +1 -1
- package/dist/security-hotspot-scanner/index.d.ts.map +1 -1
- package/dist/security-hotspot-scanner.js +26 -19
- package/dist/semantic-search-indexer/index.d.ts +1 -1
- package/dist/semantic-search-indexer/index.d.ts.map +1 -1
- package/dist/semver-bump/index.d.ts +1 -1
- package/dist/semver-bump/index.d.ts.map +1 -1
- package/dist/semver-bump.js +78 -43
- package/dist/session-recap/index.d.ts +1 -1
- package/dist/session-recap/index.d.ts.map +1 -1
- package/dist/shell-check/index.d.ts +1 -1
- package/dist/shell-check/index.d.ts.map +1 -1
- package/dist/smart-rename/index.d.ts +1 -1
- package/dist/smart-rename/index.d.ts.map +1 -1
- package/dist/spec-linker/index.d.ts +1 -1
- package/dist/spec-linker/index.d.ts.map +1 -1
- package/dist/spec-linker.js +222 -20772
- package/dist/template-engine/index.d.ts +1 -1
- package/dist/template-engine/index.d.ts.map +1 -1
- package/dist/template-engine.js +4 -6
- package/dist/test-coverage-gate/index.d.ts +1 -1
- package/dist/test-coverage-gate/index.d.ts.map +1 -1
- package/dist/test-coverage-gate.js +29 -14
- package/dist/test-flake-detector/index.d.ts +1 -1
- package/dist/test-flake-detector/index.d.ts.map +1 -1
- package/dist/test-flake-detector.js +31 -20
- package/dist/test-generator/index.d.ts +1 -1
- package/dist/test-generator/index.d.ts.map +1 -1
- package/dist/test-runner-gate/index.d.ts +1 -1
- package/dist/test-runner-gate/index.d.ts.map +1 -1
- package/dist/test-runner-gate.js +2 -1
- package/dist/todo-listener/index.d.ts +1 -32
- package/dist/todo-listener/index.d.ts.map +1 -1
- package/dist/todo-tracker/index.d.ts +1 -1
- package/dist/todo-tracker/index.d.ts.map +1 -1
- package/dist/token-budget/index.d.ts +1 -1
- package/dist/token-budget/index.d.ts.map +1 -1
- package/dist/token-throttle/index.d.ts +1 -1
- package/dist/token-throttle/index.d.ts.map +1 -1
- package/dist/type-gate/index.d.ts +1 -1
- package/dist/type-gate/index.d.ts.map +1 -1
- package/dist/type-gate.js +11 -4
- package/package.json +80 -68
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/performance-regression-gate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/performance-regression-gate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAwOrD,QAAA,MAAM,MAAM,EAAE,MA8Mb,CAAC;eAEa,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin-stack-observer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin-stack-observer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAqCrD,QAAA,MAAM,MAAM,EAAE,MAyIb,CAAC;eAoBa,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pr-drafter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pr-drafter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,wBAAwB,CAAC;AA4MhE,QAAA,MAAM,MAAM,EAAE,MAyNb,CAAC;eAEa,MAAM"}
|
package/dist/pr-drafter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/pr-drafter/index.ts
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
4
|
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
5
5
|
var API_VERSION = "^0.1.10";
|
|
6
6
|
var state = {
|
|
@@ -46,34 +46,33 @@ function resolveProjectPath(rawPath, cwd = process.cwd()) {
|
|
|
46
46
|
if (rel === "" || !rel.startsWith("..") && !isAbsolute(rel)) return resolved;
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
+
function runGit(args, timeout) {
|
|
50
|
+
return new Promise((resolveOutput) => {
|
|
51
|
+
execFile(
|
|
52
|
+
"git",
|
|
53
|
+
args,
|
|
54
|
+
{
|
|
55
|
+
encoding: "utf8",
|
|
56
|
+
cwd: process.cwd(),
|
|
57
|
+
windowsHide: true,
|
|
58
|
+
timeout,
|
|
59
|
+
maxBuffer: 5 * 1024 * 1024
|
|
60
|
+
},
|
|
61
|
+
(error, stdout) => resolveOutput(error ? null : stdout.trim())
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
49
65
|
function gitBranch() {
|
|
50
|
-
|
|
51
|
-
const out = execFileSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
52
|
-
encoding: "utf-8",
|
|
53
|
-
cwd: process.cwd(),
|
|
54
|
-
stdio: ["pipe", "pipe", "ignore"],
|
|
55
|
-
timeout: 5e3
|
|
56
|
-
});
|
|
57
|
-
return out.trim();
|
|
58
|
-
} catch {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
66
|
+
return runGit(["rev-parse", "--abbrev-ref", "HEAD"], 5e3);
|
|
61
67
|
}
|
|
62
68
|
function gitDiff() {
|
|
63
|
-
|
|
64
|
-
return execFileSync("git", ["diff", "--stat"], {
|
|
65
|
-
encoding: "utf-8",
|
|
66
|
-
cwd: process.cwd(),
|
|
67
|
-
stdio: ["pipe", "pipe", "ignore"],
|
|
68
|
-
timeout: 1e4
|
|
69
|
-
}).trim();
|
|
70
|
-
} catch {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
69
|
+
return runGit(["diff", "--stat"], 1e4);
|
|
73
70
|
}
|
|
74
71
|
async function buildDraft(cfg, llm) {
|
|
75
|
-
const branch =
|
|
76
|
-
|
|
72
|
+
const [branch, diffStat] = await Promise.all([
|
|
73
|
+
gitBranch(),
|
|
74
|
+
cfg.includeDiff ? gitDiff() : Promise.resolve(null)
|
|
75
|
+
]);
|
|
77
76
|
const lines = [];
|
|
78
77
|
lines.push("# PR Draft");
|
|
79
78
|
if (branch) lines.push(`**Branch:** \`${branch}\``);
|
|
@@ -130,8 +129,8 @@ async function writeDraft(cfg, llm) {
|
|
|
130
129
|
}
|
|
131
130
|
const draft = await buildDraft(cfg, llm);
|
|
132
131
|
try {
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
await mkdir(dirname(resolved), { recursive: true });
|
|
133
|
+
await writeFile(resolved, draft.body);
|
|
135
134
|
state.draftsWritten += 1;
|
|
136
135
|
} catch {
|
|
137
136
|
state.draftErrors += 1;
|
|
@@ -257,8 +256,8 @@ var plugin = {
|
|
|
257
256
|
const resolved = resolveProjectPath(cfg.outputPath);
|
|
258
257
|
if (!resolved) return { ok: false, error: "outputPath resolves outside project" };
|
|
259
258
|
try {
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
await mkdir(dirname(resolved), { recursive: true });
|
|
260
|
+
await writeFile(resolved, draft.body);
|
|
262
261
|
state.draftsWritten += 1;
|
|
263
262
|
return {
|
|
264
263
|
ok: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/process-guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/process-guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAiDrD,QAAA,MAAM,MAAM,EAAE,MAoKb,CAAC;eAEa,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompt-firewall/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompt-firewall/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,wBAAwB,CAAC;AA+BhE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAcxE;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAWjG;AA0CD,KAAK,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhD,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,YAAY,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CA0B7D;AAgCD,QAAA,MAAM,MAAM,EAAE,MAkNb,CAAC;eAEa,MAAM"}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* @public
|
|
25
25
|
*/
|
|
26
|
-
import type { Plugin } from '@wrongstack/core';
|
|
26
|
+
import type { Plugin } from '@wrongstack/core/types';
|
|
27
27
|
export type SmellType = 'long-function' | 'deep-nesting' | 'many-parameters' | 'magic-number' | 'console-log';
|
|
28
28
|
export interface RefactorSuggestion {
|
|
29
29
|
file: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/refactor-suggester/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/refactor-suggester/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AASrD,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,aAAa,CAAC;AAElB,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAgOD,QAAA,MAAM,MAAM,EAAE,MAoOb,CAAC;eAEa,MAAM"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// src/refactor-suggester/index.ts
|
|
2
|
-
import {
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve2 } from "node:path";
|
|
4
4
|
|
|
5
5
|
// src/runtime/index.ts
|
|
6
|
-
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
7
6
|
import { basename, extname, isAbsolute, relative, resolve } from "node:path";
|
|
8
7
|
var MAX_BUFFER_BYTES = 16 * 1024 * 1024;
|
|
9
8
|
function hasLeadingDash(arg) {
|
|
@@ -17,44 +16,45 @@ function withinProjectPath(projectRoot, candidate) {
|
|
|
17
16
|
return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
|
|
18
17
|
}
|
|
19
18
|
function withinProject(p) {
|
|
20
|
-
|
|
19
|
+
const cwd = process.cwd();
|
|
20
|
+
return withinProjectPath(cwd, p) || relative(cwd, p) === ".";
|
|
21
21
|
}
|
|
22
22
|
var DEFAULT_EXCLUDE_DIRS = ["node_modules", "dist", ".git", "coverage"];
|
|
23
|
-
function
|
|
23
|
+
async function collectSourceFilesAsync(root, opts) {
|
|
24
|
+
const { readdir, stat } = await import("node:fs/promises");
|
|
24
25
|
const files = [];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
try {
|
|
27
|
+
const s = await stat(root);
|
|
28
|
+
if (s.isFile()) {
|
|
29
|
+
if (matchesExtension(root, opts.extensions)) files.push(root);
|
|
30
|
+
return files;
|
|
31
|
+
}
|
|
32
|
+
if (!s.isDirectory()) return files;
|
|
33
|
+
} catch {
|
|
29
34
|
return files;
|
|
30
35
|
}
|
|
31
|
-
if (!s.isDirectory()) return files;
|
|
32
36
|
const exclude = opts.excludeDirs ?? DEFAULT_EXCLUDE_DIRS;
|
|
33
|
-
|
|
37
|
+
const excludeSet = new Set(exclude);
|
|
38
|
+
async function walk(dir, depth) {
|
|
34
39
|
if (opts.maxDepth !== void 0 && depth > opts.maxDepth) return;
|
|
35
40
|
let entries;
|
|
36
41
|
try {
|
|
37
|
-
entries =
|
|
42
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
38
43
|
} catch {
|
|
39
44
|
return;
|
|
40
45
|
}
|
|
46
|
+
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
41
47
|
for (const entry of entries) {
|
|
42
|
-
if (
|
|
43
|
-
const full = resolve(dir, entry);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} catch {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (st.isDirectory()) {
|
|
51
|
-
walk(full, depth + 1);
|
|
52
|
-
} else if (st.isFile() && matchesExtension(full, opts.extensions)) {
|
|
48
|
+
if (excludeSet.has(entry.name)) continue;
|
|
49
|
+
const full = resolve(dir, entry.name);
|
|
50
|
+
if (entry.isDirectory()) {
|
|
51
|
+
await walk(full, depth + 1);
|
|
52
|
+
} else if (entry.isFile() && matchesExtension(full, opts.extensions)) {
|
|
53
53
|
files.push(full);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
walk(root, 0);
|
|
57
|
+
await walk(root, 0);
|
|
58
58
|
return files;
|
|
59
59
|
}
|
|
60
60
|
function matchesExtension(p, exts) {
|
|
@@ -189,15 +189,15 @@ function detectSmells(filePath, content, rules) {
|
|
|
189
189
|
}
|
|
190
190
|
return suggestions;
|
|
191
191
|
}
|
|
192
|
-
function scanPath(rawPath, cfg) {
|
|
192
|
+
async function scanPath(rawPath, cfg) {
|
|
193
193
|
const root = process.cwd();
|
|
194
194
|
const resolved = isAbsolute2(rawPath) ? resolve2(rawPath) : resolve2(root, rawPath);
|
|
195
195
|
const exts = normalizeExtensions(cfg.extensions);
|
|
196
|
-
const files =
|
|
196
|
+
const files = await collectSourceFilesAsync(resolved, { extensions: exts });
|
|
197
197
|
const suggestions = [];
|
|
198
198
|
for (const p of files) {
|
|
199
199
|
try {
|
|
200
|
-
const content =
|
|
200
|
+
const content = await readFile(p, "utf-8");
|
|
201
201
|
suggestions.push(...detectSmells(p, content, cfg.rules));
|
|
202
202
|
if (suggestions.length >= cfg.maxSuggestions) break;
|
|
203
203
|
} catch {
|
|
@@ -254,7 +254,7 @@ var plugin = {
|
|
|
254
254
|
state.hookUnregister = null;
|
|
255
255
|
}
|
|
256
256
|
const cfg = readConfig(api.config.extensions?.["refactor-suggester"]);
|
|
257
|
-
const hook = (input) => {
|
|
257
|
+
const hook = async (input) => {
|
|
258
258
|
if (!cfg.enabled) return;
|
|
259
259
|
if (input.toolResult?.isError) return;
|
|
260
260
|
const inp = input.toolInput ?? {};
|
|
@@ -270,7 +270,7 @@ var plugin = {
|
|
|
270
270
|
const resolved = resolve2(process.cwd(), sourcePath);
|
|
271
271
|
let content;
|
|
272
272
|
try {
|
|
273
|
-
content =
|
|
273
|
+
content = await readFile(resolved, "utf-8");
|
|
274
274
|
} catch {
|
|
275
275
|
state.errorCount += 1;
|
|
276
276
|
return;
|
|
@@ -306,7 +306,7 @@ var plugin = {
|
|
|
306
306
|
state.scanCount += 1;
|
|
307
307
|
let result;
|
|
308
308
|
try {
|
|
309
|
-
result = scanPath(rawPath, cfg);
|
|
309
|
+
result = await scanPath(rawPath, cfg);
|
|
310
310
|
} catch (err) {
|
|
311
311
|
state.errorCount += 1;
|
|
312
312
|
return { ok: false, error: String(err) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/release-notes-generator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/release-notes-generator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAsPrD,QAAA,MAAM,MAAM,EAAE,MAwLb,CAAC;eAEa,MAAM"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/release-notes-generator/index.ts
|
|
2
|
-
import {
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
3
|
|
|
4
4
|
// src/runtime/llm.ts
|
|
5
5
|
function stripOuterMarkdownFence(text) {
|
|
@@ -88,40 +88,47 @@ function formatCommit(c, includeScope) {
|
|
|
88
88
|
line += ` ${c.description}`;
|
|
89
89
|
return line;
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
function runGit(args, signal) {
|
|
92
|
+
return new Promise((resolveOutput, reject) => {
|
|
93
|
+
execFile(
|
|
94
|
+
"git",
|
|
95
|
+
args,
|
|
96
|
+
{
|
|
97
|
+
encoding: "utf8",
|
|
98
|
+
shell: false,
|
|
99
|
+
windowsHide: true,
|
|
100
|
+
timeout: 1e4,
|
|
101
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
102
|
+
signal
|
|
103
|
+
},
|
|
104
|
+
(error, stdout) => error ? reject(error) : resolveOutput(stdout)
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async function resolveFromRef(defaultFrom, inputFrom, signal) {
|
|
97
109
|
if (inputFrom) return inputFrom;
|
|
98
110
|
if (defaultFrom === "latest-tag") {
|
|
99
111
|
try {
|
|
100
|
-
return
|
|
112
|
+
return (await runGit(["describe", "--tags", "--abbrev=0"], signal)).trim();
|
|
101
113
|
} catch {
|
|
102
114
|
return "";
|
|
103
115
|
}
|
|
104
116
|
}
|
|
105
117
|
return defaultFrom;
|
|
106
118
|
}
|
|
107
|
-
function resolveCommit(ref) {
|
|
108
|
-
const resolved =
|
|
109
|
-
"git",
|
|
110
|
-
["rev-parse", "--verify", "--end-of-options", `${ref}^{commit}`],
|
|
111
|
-
GIT_OPTIONS
|
|
112
|
-
).trim();
|
|
119
|
+
async function resolveCommit(ref, signal) {
|
|
120
|
+
const resolved = (await runGit(["rev-parse", "--verify", "--end-of-options", `${ref}^{commit}`], signal)).trim();
|
|
113
121
|
if (!/^[0-9a-f]{40,64}$/i.test(resolved)) {
|
|
114
122
|
throw new Error(`git returned an invalid commit id for ref ${JSON.stringify(ref)}`);
|
|
115
123
|
}
|
|
116
124
|
return resolved;
|
|
117
125
|
}
|
|
118
|
-
function getCommits(from, to) {
|
|
119
|
-
const toCommit = resolveCommit(to);
|
|
120
|
-
const range = from ? `${resolveCommit(from)}..${toCommit}` : toCommit;
|
|
121
|
-
const output =
|
|
122
|
-
"git",
|
|
126
|
+
async function getCommits(from, to, signal) {
|
|
127
|
+
const toCommit = await resolveCommit(to, signal);
|
|
128
|
+
const range = from ? `${await resolveCommit(from, signal)}..${toCommit}` : toCommit;
|
|
129
|
+
const output = await runGit(
|
|
123
130
|
["log", "--pretty=format:%H%x09%s", "--end-of-options", range],
|
|
124
|
-
|
|
131
|
+
signal
|
|
125
132
|
);
|
|
126
133
|
if (!output.trim()) return [];
|
|
127
134
|
const commits = [];
|
|
@@ -277,11 +284,11 @@ var plugin = {
|
|
|
277
284
|
if (!cfg.enabled) return { ok: false, error: "release-notes-generator is disabled" };
|
|
278
285
|
execOpts?.signal?.throwIfAborted();
|
|
279
286
|
const toRef = typeof input.to === "string" ? input.to : "HEAD";
|
|
280
|
-
const fromRef = resolveFromRef(cfg.defaultFrom, input.from);
|
|
287
|
+
const fromRef = await resolveFromRef(cfg.defaultFrom, input.from, execOpts?.signal);
|
|
281
288
|
state.generateCount += 1;
|
|
282
289
|
let commits;
|
|
283
290
|
try {
|
|
284
|
-
commits = getCommits(fromRef, toRef);
|
|
291
|
+
commits = await getCommits(fromRef, toRef, execOpts?.signal);
|
|
285
292
|
} catch (err) {
|
|
286
293
|
state.errorCount += 1;
|
|
287
294
|
return { ok: false, error: String(err) };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -126,6 +126,9 @@ export declare function probeRunner(runtime: LanguageRuntime, probeArg: string |
|
|
|
126
126
|
* This is the canonical sandbox check that every file-mutating or
|
|
127
127
|
* file-reading plugin should call before touching a path supplied
|
|
128
128
|
* by tool input. It replaces 27 identical copies across plugins.
|
|
129
|
+
*
|
|
130
|
+
* Performance: caches `process.cwd()` per call to avoid redundant
|
|
131
|
+
* syscalls when checking multiple paths in the same tick.
|
|
129
132
|
*/
|
|
130
133
|
export declare function withinProject(p: string): boolean;
|
|
131
134
|
/**
|
|
@@ -149,8 +152,20 @@ export interface CollectOptions {
|
|
|
149
152
|
*
|
|
150
153
|
* Shared by 6+ plugin source-scan tools that previously duplicated
|
|
151
154
|
* this implementation identically.
|
|
155
|
+
*
|
|
156
|
+
* Determinism: returns files in sorted order (locale-aware) so
|
|
157
|
+
* scan results are reproducible across platforms and file systems.
|
|
152
158
|
*/
|
|
153
159
|
export declare function collectSourceFiles(root: string, opts: CollectOptions): string[];
|
|
160
|
+
/**
|
|
161
|
+
* Async version of `collectSourceFiles` for non-blocking file collection.
|
|
162
|
+
* Uses `fs.promises` to avoid blocking the event loop on large directory trees.
|
|
163
|
+
*
|
|
164
|
+
* Performance: prefer this in hooks and tools that run on every write/edit
|
|
165
|
+
* (e.g., dead-code-detector, duplicate-code-detector) to keep the agent loop
|
|
166
|
+
* responsive during large scans.
|
|
167
|
+
*/
|
|
168
|
+
export declare function collectSourceFilesAsync(root: string, opts: CollectOptions): Promise<string[]>;
|
|
154
169
|
/**
|
|
155
170
|
* Check whether `p` has one of the given extensions (case-insensitive).
|
|
156
171
|
* Replaces a 6-copy helper that was duplicated identically across
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAMH,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,UAAU,GAClB,YAAY,GACZ,YAAY,GACZ,QAAQ,GACR,IAAI,GACJ,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,KAAK,GACL,QAAQ,GACR,IAAI,GACJ,OAAO,GACP,KAAK,GACL,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,MAAM,CAAC;AAEX,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,EAAE,EAAE,UAAU,CAAC;IACf;;;;OAIG;IACH,cAAc,EAAE,gBAAgB,CAAC;IACjC;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;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M,GAAG,SAAS,CAAC;CAC/B;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,EAAE,CAyC/E;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,MAAM,EAAE,CAAC,CAwCnB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAEnE"}
|
package/dist/runtime/llm.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* bounded prompts, cancellation, defensive response parsing, and an explicit
|
|
7
7
|
* deterministic fallback when no provider is wired or generation fails.
|
|
8
8
|
*/
|
|
9
|
-
import type { PluginAPI, PluginLLMOptions } from '@wrongstack/core';
|
|
9
|
+
import type { PluginAPI, PluginLLMOptions } from '@wrongstack/core/types';
|
|
10
10
|
export interface OptionalLlmResult<T> {
|
|
11
11
|
used: boolean;
|
|
12
12
|
value: T | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/runtime/llm.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/runtime/llm.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1E,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAChB,cAAc,EACV,eAAe,GACf,aAAa,GACb,WAAW,GACX,gBAAgB,GAChB,kBAAkB,GAClB,IAAI,CAAC;CACV;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACvC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC;IAC9B,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,2EAA2E;AAC3E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAU/E;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CA8B/B"}
|
package/dist/runtime.js
CHANGED
|
@@ -240,7 +240,8 @@ async function probeRunner(runtime, probeArg = "--version", options) {
|
|
|
240
240
|
return result.code === 0;
|
|
241
241
|
}
|
|
242
242
|
function withinProject(p) {
|
|
243
|
-
|
|
243
|
+
const cwd = process.cwd();
|
|
244
|
+
return withinProjectPath(cwd, p) || relative(cwd, p) === ".";
|
|
244
245
|
}
|
|
245
246
|
function locateRunnerEntry(runtime, projectRoot) {
|
|
246
247
|
const root = resolve(projectRoot);
|
|
@@ -265,6 +266,7 @@ function collectSourceFiles(root, opts) {
|
|
|
265
266
|
}
|
|
266
267
|
if (!s.isDirectory()) return files;
|
|
267
268
|
const exclude = opts.excludeDirs ?? DEFAULT_EXCLUDE_DIRS;
|
|
269
|
+
const excludeSet = new Set(exclude);
|
|
268
270
|
function walk(dir, depth) {
|
|
269
271
|
if (opts.maxDepth !== void 0 && depth > opts.maxDepth) return;
|
|
270
272
|
let entries;
|
|
@@ -273,8 +275,9 @@ function collectSourceFiles(root, opts) {
|
|
|
273
275
|
} catch {
|
|
274
276
|
return;
|
|
275
277
|
}
|
|
278
|
+
entries.sort();
|
|
276
279
|
for (const entry of entries) {
|
|
277
|
-
if (
|
|
280
|
+
if (excludeSet.has(entry)) continue;
|
|
278
281
|
const full = resolve(dir, entry);
|
|
279
282
|
let st;
|
|
280
283
|
try {
|
|
@@ -292,11 +295,49 @@ function collectSourceFiles(root, opts) {
|
|
|
292
295
|
walk(root, 0);
|
|
293
296
|
return files;
|
|
294
297
|
}
|
|
298
|
+
async function collectSourceFilesAsync(root, opts) {
|
|
299
|
+
const { readdir, stat } = await import("node:fs/promises");
|
|
300
|
+
const files = [];
|
|
301
|
+
try {
|
|
302
|
+
const s = await stat(root);
|
|
303
|
+
if (s.isFile()) {
|
|
304
|
+
if (matchesExtension(root, opts.extensions)) files.push(root);
|
|
305
|
+
return files;
|
|
306
|
+
}
|
|
307
|
+
if (!s.isDirectory()) return files;
|
|
308
|
+
} catch {
|
|
309
|
+
return files;
|
|
310
|
+
}
|
|
311
|
+
const exclude = opts.excludeDirs ?? DEFAULT_EXCLUDE_DIRS;
|
|
312
|
+
const excludeSet = new Set(exclude);
|
|
313
|
+
async function walk(dir, depth) {
|
|
314
|
+
if (opts.maxDepth !== void 0 && depth > opts.maxDepth) return;
|
|
315
|
+
let entries;
|
|
316
|
+
try {
|
|
317
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
318
|
+
} catch {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
322
|
+
for (const entry of entries) {
|
|
323
|
+
if (excludeSet.has(entry.name)) continue;
|
|
324
|
+
const full = resolve(dir, entry.name);
|
|
325
|
+
if (entry.isDirectory()) {
|
|
326
|
+
await walk(full, depth + 1);
|
|
327
|
+
} else if (entry.isFile() && matchesExtension(full, opts.extensions)) {
|
|
328
|
+
files.push(full);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
await walk(root, 0);
|
|
333
|
+
return files;
|
|
334
|
+
}
|
|
295
335
|
function matchesExtension(p, exts) {
|
|
296
336
|
return exts.includes(extname(p).toLowerCase());
|
|
297
337
|
}
|
|
298
338
|
export {
|
|
299
339
|
collectSourceFiles,
|
|
340
|
+
collectSourceFilesAsync,
|
|
300
341
|
locateRunnerEntry,
|
|
301
342
|
matchesExtension,
|
|
302
343
|
parseLlmJsonObject,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema-evolution-guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema-evolution-guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AA0MrD,QAAA,MAAM,MAAM,EAAE,MAgNb,CAAC;eAEa,MAAM"}
|
|
@@ -16,7 +16,8 @@ function withinProjectPath(projectRoot, candidate) {
|
|
|
16
16
|
return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
|
|
17
17
|
}
|
|
18
18
|
function withinProject(p) {
|
|
19
|
-
|
|
19
|
+
const cwd = process.cwd();
|
|
20
|
+
return withinProjectPath(cwd, p) || relative(cwd, p) === ".";
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
// src/schema-evolution-guard/index.ts
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* They share the same threat model but act at different points in the
|
|
27
27
|
* pipeline.
|
|
28
28
|
*/
|
|
29
|
-
import type { Plugin } from '@wrongstack/core';
|
|
29
|
+
import type { Plugin } from '@wrongstack/core/types';
|
|
30
30
|
declare const plugin: Plugin;
|
|
31
31
|
export default plugin;
|
|
32
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/secret-scanner/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/secret-scanner/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AA6erD,QAAA,MAAM,MAAM,EAAE,MAgOb,CAAC;eAEa,MAAM"}
|
package/dist/secret-scanner.js
CHANGED
|
@@ -54,10 +54,16 @@ var BASE_PATTERNS = [
|
|
|
54
54
|
{ type: "redis_uri", regex: /redis:\/\/[^\s"'`]+/g }
|
|
55
55
|
];
|
|
56
56
|
var PATTERNS = [...BASE_PATTERNS];
|
|
57
|
+
var patternCacheKey = "";
|
|
57
58
|
var COMBINED_REGEX = buildCombinedRegex(PATTERNS);
|
|
58
59
|
var RE_DOS_MAX_SCAN_LENGTH = 1e5;
|
|
59
60
|
var RE_DOS_TIMEOUT_MS = 100;
|
|
60
61
|
function buildCombinedRegex(patterns) {
|
|
62
|
+
const newCacheKey = JSON.stringify(patterns.map((p) => p.type));
|
|
63
|
+
if (newCacheKey === patternCacheKey && COMBINED_REGEX) {
|
|
64
|
+
return COMBINED_REGEX;
|
|
65
|
+
}
|
|
66
|
+
patternCacheKey = newCacheKey;
|
|
61
67
|
return new RegExp(patterns.map((p) => `(${p.regex.source})`).join("|"), "g");
|
|
62
68
|
}
|
|
63
69
|
var state = {
|
|
@@ -98,7 +104,7 @@ function findMatches(text) {
|
|
|
98
104
|
COMBINED_REGEX.lastIndex += 1;
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
|
-
return Array.from(found);
|
|
107
|
+
return Array.from(found).sort();
|
|
102
108
|
}
|
|
103
109
|
function scanInput(input, depth = 0) {
|
|
104
110
|
if (input === null || input === void 0) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security-hotspot-scanner/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security-hotspot-scanner/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AA6QrD,QAAA,MAAM,MAAM,EAAE,MAkQb,CAAC;eAEa,MAAM"}
|