@wrongstack/plugins 0.284.1 → 0.286.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 +18 -14
- package/dist/accessibility-auditor/index.d.ts +38 -0
- package/dist/accessibility-auditor/index.d.ts.map +1 -0
- package/dist/accessibility-auditor.d.ts +2 -40
- package/dist/accessibility-auditor.js +10 -15
- package/dist/agent-handoff/index.d.ts +35 -0
- package/dist/agent-handoff/index.d.ts.map +1 -0
- package/dist/agent-handoff.d.ts +2 -37
- package/dist/agent-handoff.js +3 -2
- package/dist/api-compatibility-gate/index.d.ts +36 -0
- package/dist/api-compatibility-gate/index.d.ts.map +1 -0
- package/dist/api-compatibility-gate.d.ts +2 -38
- package/dist/api-compatibility-gate.js +6 -6
- package/dist/auto-doc/index.d.ts +20 -0
- package/dist/auto-doc/index.d.ts.map +1 -0
- package/dist/auto-doc.d.ts +2 -22
- package/dist/auto-doc.js +5 -5
- package/dist/auto-escalate/index.d.ts +43 -0
- package/dist/auto-escalate/index.d.ts.map +1 -0
- package/dist/auto-escalate.d.ts +2 -45
- package/dist/auto-escalate.js +5 -2
- package/dist/auto-i18n-extractor/index.d.ts +34 -0
- package/dist/auto-i18n-extractor/index.d.ts.map +1 -0
- package/dist/auto-i18n-extractor.d.ts +2 -36
- package/dist/auto-i18n-extractor.js +6 -7
- package/dist/branch-guard/index.d.ts +32 -0
- package/dist/branch-guard/index.d.ts.map +1 -0
- package/dist/branch-guard.d.ts +2 -34
- package/dist/branch-guard.js +4 -4
- package/dist/catalog.d.ts +39 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/changelog-writer/index.d.ts +71 -0
- package/dist/changelog-writer/index.d.ts.map +1 -0
- package/dist/changelog-writer.d.ts +2 -73
- package/dist/changelog-writer.js +9 -5
- package/dist/checkpoint/index.d.ts +53 -0
- package/dist/checkpoint/index.d.ts.map +1 -0
- package/dist/checkpoint.d.ts +2 -55
- package/dist/checkpoint.js +6 -6
- package/dist/code-metrics/index.d.ts +29 -0
- package/dist/code-metrics/index.d.ts.map +1 -0
- package/dist/code-metrics.d.ts +2 -31
- package/dist/code-metrics.js +13 -15
- package/dist/commit-validator/index.d.ts +31 -0
- package/dist/commit-validator/index.d.ts.map +1 -0
- package/dist/commit-validator.d.ts +2 -33
- package/dist/commit-validator.js +5 -3
- package/dist/config-validator/index.d.ts +46 -0
- package/dist/config-validator/index.d.ts.map +1 -0
- package/dist/config-validator.d.ts +2 -48
- package/dist/config-validator.js +8 -4
- package/dist/context-pins/index.d.ts +43 -0
- package/dist/context-pins/index.d.ts.map +1 -0
- package/dist/context-pins.d.ts +2 -45
- package/dist/context-pins.js +5 -5
- package/dist/cost-tracker/index.d.ts +51 -0
- package/dist/cost-tracker/index.d.ts.map +1 -0
- package/dist/cost-tracker.d.ts +2 -53
- package/dist/cost-tracker.js +4 -4
- package/dist/cron/index.d.ts +12 -0
- package/dist/cron/index.d.ts.map +1 -0
- package/dist/cron.d.ts +2 -14
- package/dist/cron.js +3 -2
- package/dist/dead-code-detector/index.d.ts +32 -0
- package/dist/dead-code-detector/index.d.ts.map +1 -0
- package/dist/dead-code-detector.d.ts +2 -34
- package/dist/dead-code-detector.js +8 -9
- package/dist/dep-guard/index.d.ts +63 -0
- package/dist/dep-guard/index.d.ts.map +1 -0
- package/dist/dep-guard.d.ts +2 -65
- package/dist/dep-guard.js +6 -2
- package/dist/dependency-vulnerability-gate/index.d.ts +33 -0
- package/dist/dependency-vulnerability-gate/index.d.ts.map +1 -0
- package/dist/dependency-vulnerability-gate.d.ts +2 -35
- package/dist/dependency-vulnerability-gate.js +5 -5
- package/dist/diff-summary/index.d.ts +34 -0
- package/dist/diff-summary/index.d.ts.map +1 -0
- package/dist/diff-summary.d.ts +2 -36
- package/dist/diff-summary.js +5 -5
- package/dist/doc-sync-guard/index.d.ts +31 -0
- package/dist/doc-sync-guard/index.d.ts.map +1 -0
- package/dist/doc-sync-guard.d.ts +2 -33
- package/dist/doc-sync-guard.js +4 -4
- package/dist/duplicate-code-detector/index.d.ts +31 -0
- package/dist/duplicate-code-detector/index.d.ts.map +1 -0
- package/dist/duplicate-code-detector.d.ts +2 -33
- package/dist/duplicate-code-detector.js +5 -5
- package/dist/error-lens/index.d.ts +65 -0
- package/dist/error-lens/index.d.ts.map +1 -0
- package/dist/error-lens.d.ts +2 -67
- package/dist/error-lens.js +5 -2
- package/dist/feature-flag-tracker/index.d.ts +36 -0
- package/dist/feature-flag-tracker/index.d.ts.map +1 -0
- package/dist/feature-flag-tracker.d.ts +2 -38
- package/dist/feature-flag-tracker.js +6 -7
- package/dist/file-watcher/index.d.ts +12 -0
- package/dist/file-watcher/index.d.ts.map +1 -0
- package/dist/file-watcher.d.ts +2 -14
- package/dist/file-watcher.js +7 -7
- package/dist/format-on-save/index.d.ts +33 -0
- package/dist/format-on-save/index.d.ts.map +1 -0
- package/dist/format-on-save.d.ts +2 -35
- package/dist/format-on-save.js +6 -6
- package/dist/git-autocommit/index.d.ts +15 -0
- package/dist/git-autocommit/index.d.ts.map +1 -0
- package/dist/git-autocommit.d.ts +2 -17
- package/dist/git-autocommit.js +5 -5
- package/dist/import-organizer/index.d.ts +50 -0
- package/dist/import-organizer/index.d.ts.map +1 -0
- package/dist/import-organizer.d.ts +2 -52
- package/dist/import-organizer.js +6 -6
- package/dist/index.d.ts +186 -64
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +992 -454
- package/dist/injection-shield/index.d.ts +47 -0
- package/dist/injection-shield/index.d.ts.map +1 -0
- package/dist/injection-shield.d.ts +2 -49
- package/dist/injection-shield.js +4 -2
- package/dist/interface-contract-guard/index.d.ts +35 -0
- package/dist/interface-contract-guard/index.d.ts.map +1 -0
- package/dist/interface-contract-guard.d.ts +2 -37
- package/dist/interface-contract-guard.js +6 -7
- package/dist/knowledge-graph/index.d.ts +43 -0
- package/dist/knowledge-graph/index.d.ts.map +1 -0
- package/dist/knowledge-graph.d.ts +2 -45
- package/dist/knowledge-graph.js +5 -5
- package/dist/license-audit-gate/index.d.ts +32 -0
- package/dist/license-audit-gate/index.d.ts.map +1 -0
- package/dist/license-audit-gate.d.ts +2 -34
- package/dist/license-audit-gate.js +6 -7
- package/dist/lint-gate/index.d.ts +31 -0
- package/dist/lint-gate/index.d.ts.map +1 -0
- package/dist/lint-gate.d.ts +2 -33
- package/dist/lint-gate.js +7 -7
- package/dist/llm-cache/index.d.ts +54 -0
- package/dist/llm-cache/index.d.ts.map +1 -0
- package/dist/llm-cache.d.ts +2 -56
- package/dist/llm-cache.js +6 -4
- package/dist/loop-breaker/index.d.ts +4 -0
- package/dist/loop-breaker/index.d.ts.map +1 -0
- package/dist/loop-breaker.d.ts +2 -5
- package/dist/loop-breaker.js +4 -4
- package/dist/migration-planner/index.d.ts +28 -0
- package/dist/migration-planner/index.d.ts.map +1 -0
- package/dist/migration-planner.d.ts +2 -30
- package/dist/migration-planner.js +5 -5
- package/dist/model-router/index.d.ts +67 -0
- package/dist/model-router/index.d.ts.map +1 -0
- package/dist/model-router.d.ts +2 -69
- package/dist/model-router.js +5 -2
- package/dist/notify-hub/index.d.ts +43 -0
- package/dist/notify-hub/index.d.ts.map +1 -0
- package/dist/notify-hub.d.ts +2 -45
- package/dist/notify-hub.js +3 -2
- package/dist/path-guard/index.d.ts +52 -0
- package/dist/path-guard/index.d.ts.map +1 -0
- package/dist/path-guard.d.ts +2 -54
- package/dist/path-guard.js +5 -2
- package/dist/performance-regression-gate/index.d.ts +31 -0
- package/dist/performance-regression-gate/index.d.ts.map +1 -0
- package/dist/performance-regression-gate.d.ts +2 -33
- package/dist/performance-regression-gate.js +5 -5
- package/dist/plugin-stack-observer/index.d.ts +33 -0
- package/dist/plugin-stack-observer/index.d.ts.map +1 -0
- package/dist/plugin-stack-observer.d.ts +2 -35
- package/dist/plugin-stack-observer.js +3 -2
- package/dist/pr-drafter/index.d.ts +33 -0
- package/dist/pr-drafter/index.d.ts.map +1 -0
- package/dist/pr-drafter.d.ts +2 -35
- package/dist/pr-drafter.js +6 -6
- package/dist/prompt-firewall/index.d.ts +55 -0
- package/dist/prompt-firewall/index.d.ts.map +1 -0
- package/dist/prompt-firewall.d.ts +2 -57
- package/dist/prompt-firewall.js +5 -2
- package/dist/refactor-suggester/index.d.ts +36 -0
- package/dist/refactor-suggester/index.d.ts.map +1 -0
- package/dist/refactor-suggester.d.ts +2 -38
- package/dist/refactor-suggester.js +16 -17
- package/dist/release-notes-generator/index.d.ts +25 -0
- package/dist/release-notes-generator/index.d.ts.map +1 -0
- package/dist/release-notes-generator.d.ts +2 -27
- package/dist/release-notes-generator.js +28 -10
- package/dist/runtime/index.d.ts +124 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +216 -0
- package/dist/schema-evolution-guard/index.d.ts +40 -0
- package/dist/schema-evolution-guard/index.d.ts.map +1 -0
- package/dist/schema-evolution-guard.d.ts +2 -42
- package/dist/schema-evolution-guard.js +5 -5
- package/dist/secret-scanner/index.d.ts +32 -0
- package/dist/secret-scanner/index.d.ts.map +1 -0
- package/dist/secret-scanner.d.ts +2 -34
- package/dist/secret-scanner.js +3 -2
- package/dist/security-hotspot-scanner/index.d.ts +28 -0
- package/dist/security-hotspot-scanner/index.d.ts.map +1 -0
- package/dist/security-hotspot-scanner.d.ts +2 -30
- package/dist/security-hotspot-scanner.js +6 -6
- package/dist/semantic-search-indexer/index.d.ts +36 -0
- package/dist/semantic-search-indexer/index.d.ts.map +1 -0
- package/dist/semantic-search-indexer.d.ts +2 -38
- package/dist/semantic-search-indexer.js +22 -6
- package/dist/semver-bump/index.d.ts +24 -0
- package/dist/semver-bump/index.d.ts.map +1 -0
- package/dist/semver-bump.d.ts +2 -26
- package/dist/semver-bump.js +10 -8
- package/dist/session-recap/index.d.ts +48 -0
- package/dist/session-recap/index.d.ts.map +1 -0
- package/dist/session-recap.d.ts +2 -50
- package/dist/session-recap.js +6 -4
- package/dist/shell-check/index.d.ts +14 -0
- package/dist/shell-check/index.d.ts.map +1 -0
- package/dist/shell-check.d.ts +2 -16
- package/dist/shell-check.js +6 -6
- package/dist/smart-rename/index.d.ts +24 -0
- package/dist/smart-rename/index.d.ts.map +1 -0
- package/dist/smart-rename.d.ts +2 -26
- package/dist/smart-rename.js +5 -5
- package/dist/spec-linker/index.d.ts +49 -0
- package/dist/spec-linker/index.d.ts.map +1 -0
- package/dist/spec-linker.d.ts +2 -51
- package/dist/spec-linker.js +20086 -244
- package/dist/template-engine/index.d.ts +13 -0
- package/dist/template-engine/index.d.ts.map +1 -0
- package/dist/template-engine.d.ts +2 -15
- package/dist/template-engine.js +7 -7
- package/dist/test-coverage-gate/index.d.ts +35 -0
- package/dist/test-coverage-gate/index.d.ts.map +1 -0
- package/dist/test-coverage-gate.d.ts +2 -37
- package/dist/test-coverage-gate.js +5 -5
- package/dist/test-flake-detector/index.d.ts +25 -0
- package/dist/test-flake-detector/index.d.ts.map +1 -0
- package/dist/test-flake-detector.d.ts +2 -27
- package/dist/test-flake-detector.js +98 -13
- package/dist/test-generator/index.d.ts +30 -0
- package/dist/test-generator/index.d.ts.map +1 -0
- package/dist/test-generator.d.ts +2 -32
- package/dist/test-generator.js +19 -20
- package/dist/test-runner-gate/index.d.ts +35 -0
- package/dist/test-runner-gate/index.d.ts.map +1 -0
- package/dist/test-runner-gate.d.ts +2 -37
- package/dist/test-runner-gate.js +6 -6
- package/dist/todo-listener/index.d.ts +35 -0
- package/dist/todo-listener/index.d.ts.map +1 -0
- package/dist/todo-listener.d.ts +2 -37
- package/dist/todo-listener.js +3 -2
- package/dist/todo-tracker/index.d.ts +4 -0
- package/dist/todo-tracker/index.d.ts.map +1 -0
- package/dist/todo-tracker.d.ts +2 -5
- package/dist/todo-tracker.js +5 -5
- package/dist/token-budget/index.d.ts +38 -0
- package/dist/token-budget/index.d.ts.map +1 -0
- package/dist/token-budget.d.ts +2 -40
- package/dist/token-budget.js +3 -2
- package/dist/token-throttle/index.d.ts +52 -0
- package/dist/token-throttle/index.d.ts.map +1 -0
- package/dist/token-throttle.d.ts +2 -54
- package/dist/token-throttle.js +6 -2
- package/dist/type-gate/index.d.ts +35 -0
- package/dist/type-gate/index.d.ts.map +1 -0
- package/dist/type-gate.d.ts +2 -37
- package/dist/type-gate.js +236 -43
- package/package.json +10 -7
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dep-guard plugin — supervises dependency-install commands.
|
|
3
|
+
*
|
|
4
|
+
* Supply-chain safety at the point of no return: a `PreToolUse` hook
|
|
5
|
+
* on `bash|exec` parses package-manager install commands
|
|
6
|
+
* (`npm i`, `pnpm add`, `yarn add`, `bun add`, `pip install`,
|
|
7
|
+
* `cargo add`) and extracts the package names being added:
|
|
8
|
+
*
|
|
9
|
+
* - packages on the `deny` list → blocked (or warned in
|
|
10
|
+
* warn mode) with the configured reason
|
|
11
|
+
* - typosquat lookalikes of `popular` → warned ("did you mean
|
|
12
|
+
* react? you typed raect") via Levenshtein distance 1
|
|
13
|
+
* - unpinned installs (no version) → optional warning when
|
|
14
|
+
* `warnOnUnpinned` is set
|
|
15
|
+
* - every install → a compact context note so
|
|
16
|
+
* the model consciously confirms new dependencies
|
|
17
|
+
*
|
|
18
|
+
* Non-install commands pass through untouched.
|
|
19
|
+
*
|
|
20
|
+
* Config (`config.extensions['dep-guard']`):
|
|
21
|
+
*
|
|
22
|
+
* ```jsonc
|
|
23
|
+
* {
|
|
24
|
+
* "enabled": true,
|
|
25
|
+
* "mode": "block", // "block" | "warn" (deny-list handling)
|
|
26
|
+
* "deny": [], // exact names or prefix globs ("left-pad", "@evil/*")
|
|
27
|
+
* "allow": [], // exemptions from deny
|
|
28
|
+
* "warnOnUnpinned": false, // warn when no version is specified
|
|
29
|
+
* "typosquatCheck": true // warn on 1-edit lookalikes of popular packages
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* Toggle off with `{ "name": "dep-guard", "enabled": false }` in
|
|
34
|
+
* `config.plugins`, or `"enabled": false` in the options above.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
import type { Plugin } from '@wrongstack/core';
|
|
39
|
+
export interface ParsedInstall {
|
|
40
|
+
manager: string;
|
|
41
|
+
packages: Array<{
|
|
42
|
+
name: string;
|
|
43
|
+
version: string | null;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Parse a shell command for dependency installs. Returns one entry
|
|
48
|
+
* per install segment found (compound commands can contain several).
|
|
49
|
+
* Bare `npm install` (restore from lockfile, no packages) yields an
|
|
50
|
+
* empty package list and is NOT treated as adding dependencies.
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseInstallCommands(command: string): ParsedInstall[];
|
|
53
|
+
/**
|
|
54
|
+
* Optimal-string-alignment distance (Levenshtein + adjacent
|
|
55
|
+
* transposition). Transpositions count as ONE edit because they are
|
|
56
|
+
* the classic typosquat vector: `lodahs` → `lodash`, `raect` → `react`.
|
|
57
|
+
* Package names are short, so the full matrix is cheap.
|
|
58
|
+
*/
|
|
59
|
+
export declare function editDistance(a: string, b: string): number;
|
|
60
|
+
export declare function typosquatOf(name: string): string | null;
|
|
61
|
+
declare const plugin: Plugin;
|
|
62
|
+
export default plugin;
|
|
63
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dep-guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAmF/C,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CAC3D;AAKD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAmCrE;AA0CD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAyBzD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOvD;AAMD,QAAA,MAAM,MAAM,EAAE,MAwPb,CAAC;eAEa,MAAM"}
|
package/dist/dep-guard.d.ts
CHANGED
|
@@ -1,65 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* dep-guard plugin — supervises dependency-install commands.
|
|
5
|
-
*
|
|
6
|
-
* Supply-chain safety at the point of no return: a `PreToolUse` hook
|
|
7
|
-
* on `bash|exec` parses package-manager install commands
|
|
8
|
-
* (`npm i`, `pnpm add`, `yarn add`, `bun add`, `pip install`,
|
|
9
|
-
* `cargo add`) and extracts the package names being added:
|
|
10
|
-
*
|
|
11
|
-
* - packages on the `deny` list → blocked (or warned in
|
|
12
|
-
* warn mode) with the configured reason
|
|
13
|
-
* - typosquat lookalikes of `popular` → warned ("did you mean
|
|
14
|
-
* react? you typed raect") via Levenshtein distance 1
|
|
15
|
-
* - unpinned installs (no version) → optional warning when
|
|
16
|
-
* `warnOnUnpinned` is set
|
|
17
|
-
* - every install → a compact context note so
|
|
18
|
-
* the model consciously confirms new dependencies
|
|
19
|
-
*
|
|
20
|
-
* Non-install commands pass through untouched.
|
|
21
|
-
*
|
|
22
|
-
* Config (`config.extensions['dep-guard']`):
|
|
23
|
-
*
|
|
24
|
-
* ```jsonc
|
|
25
|
-
* {
|
|
26
|
-
* "enabled": true,
|
|
27
|
-
* "mode": "block", // "block" | "warn" (deny-list handling)
|
|
28
|
-
* "deny": [], // exact names or prefix globs ("left-pad", "@evil/*")
|
|
29
|
-
* "allow": [], // exemptions from deny
|
|
30
|
-
* "warnOnUnpinned": false, // warn when no version is specified
|
|
31
|
-
* "typosquatCheck": true // warn on 1-edit lookalikes of popular packages
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* Toggle off with `{ "name": "dep-guard", "enabled": false }` in
|
|
36
|
-
* `config.plugins`, or `"enabled": false` in the options above.
|
|
37
|
-
*
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
interface ParsedInstall {
|
|
42
|
-
manager: string;
|
|
43
|
-
packages: Array<{
|
|
44
|
-
name: string;
|
|
45
|
-
version: string | null;
|
|
46
|
-
}>;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Parse a shell command for dependency installs. Returns one entry
|
|
50
|
-
* per install segment found (compound commands can contain several).
|
|
51
|
-
* Bare `npm install` (restore from lockfile, no packages) yields an
|
|
52
|
-
* empty package list and is NOT treated as adding dependencies.
|
|
53
|
-
*/
|
|
54
|
-
declare function parseInstallCommands(command: string): ParsedInstall[];
|
|
55
|
-
/**
|
|
56
|
-
* Optimal-string-alignment distance (Levenshtein + adjacent
|
|
57
|
-
* transposition). Transpositions count as ONE edit because they are
|
|
58
|
-
* the classic typosquat vector: `lodahs` → `lodash`, `raect` → `react`.
|
|
59
|
-
* Package names are short, so the full matrix is cheap.
|
|
60
|
-
*/
|
|
61
|
-
declare function editDistance(a: string, b: string): number;
|
|
62
|
-
declare function typosquatOf(name: string): string | null;
|
|
63
|
-
declare const plugin: Plugin;
|
|
64
|
-
|
|
65
|
-
export { type ParsedInstall, plugin as default, editDistance, parseInstallCommands, typosquatOf };
|
|
1
|
+
export * from './dep-guard/index.js';
|
|
2
|
+
export { default } from './dep-guard/index.js';
|
package/dist/dep-guard.js
CHANGED
|
@@ -358,5 +358,9 @@ ${notes.map((n) => ` - ${n}`).join("\n")}`
|
|
|
358
358
|
}
|
|
359
359
|
};
|
|
360
360
|
var dep_guard_default = plugin;
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
export {
|
|
362
|
+
dep_guard_default as default,
|
|
363
|
+
editDistance,
|
|
364
|
+
parseInstallCommands,
|
|
365
|
+
typosquatOf
|
|
366
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dependency-vulnerability-gate plugin — PostToolUse hook that audits
|
|
3
|
+
* dependencies after install commands.
|
|
4
|
+
*
|
|
5
|
+
* Runs `npm audit --json` (or `pnpm audit --json` when pnpm-lock.yaml is
|
|
6
|
+
* present) after the `install` tool or bash/exec commands containing
|
|
7
|
+
* `npm install`/`pnpm add`/`yarn add`. Parses the audit report and blocks
|
|
8
|
+
* or warns when any vulnerability severity meets or exceeds the configured
|
|
9
|
+
* threshold.
|
|
10
|
+
*
|
|
11
|
+
* Tool registered:
|
|
12
|
+
* - dependency_audit_status : Show config + per-session counters.
|
|
13
|
+
*
|
|
14
|
+
* Hooks registered:
|
|
15
|
+
* - PostToolUse with matcher `install|bash|exec`.
|
|
16
|
+
*
|
|
17
|
+
* Config (`config.extensions['dependency-vulnerability-gate']`):
|
|
18
|
+
*
|
|
19
|
+
* ```jsonc
|
|
20
|
+
* {
|
|
21
|
+
* "enabled": true,
|
|
22
|
+
* "severityThreshold": "high", // "low" | "moderate" | "high" | "critical"
|
|
23
|
+
* "block": true, // true = block, false = warn
|
|
24
|
+
* "timeoutMs": 120000
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
import type { Plugin } from '@wrongstack/core';
|
|
31
|
+
declare const plugin: Plugin;
|
|
32
|
+
export default plugin;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dependency-vulnerability-gate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAuO/C,QAAA,MAAM,MAAM,EAAE,MAwMb,CAAC;eAEa,MAAM"}
|
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* dependency-vulnerability-gate plugin — PostToolUse hook that audits
|
|
5
|
-
* dependencies after install commands.
|
|
6
|
-
*
|
|
7
|
-
* Runs `npm audit --json` (or `pnpm audit --json` when pnpm-lock.yaml is
|
|
8
|
-
* present) after the `install` tool or bash/exec commands containing
|
|
9
|
-
* `npm install`/`pnpm add`/`yarn add`. Parses the audit report and blocks
|
|
10
|
-
* or warns when any vulnerability severity meets or exceeds the configured
|
|
11
|
-
* threshold.
|
|
12
|
-
*
|
|
13
|
-
* Tool registered:
|
|
14
|
-
* - dependency_audit_status : Show config + per-session counters.
|
|
15
|
-
*
|
|
16
|
-
* Hooks registered:
|
|
17
|
-
* - PostToolUse with matcher `install|bash|exec`.
|
|
18
|
-
*
|
|
19
|
-
* Config (`config.extensions['dependency-vulnerability-gate']`):
|
|
20
|
-
*
|
|
21
|
-
* ```jsonc
|
|
22
|
-
* {
|
|
23
|
-
* "enabled": true,
|
|
24
|
-
* "severityThreshold": "high", // "low" | "moderate" | "high" | "critical"
|
|
25
|
-
* "block": true, // true = block, false = warn
|
|
26
|
-
* "timeoutMs": 120000
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
declare const plugin: Plugin;
|
|
34
|
-
|
|
35
|
-
export { plugin as default };
|
|
1
|
+
export * from './dependency-vulnerability-gate/index.js';
|
|
2
|
+
export { default } from './dependency-vulnerability-gate/index.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { execFileSync } from 'child_process';
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
|
|
4
1
|
// src/dependency-vulnerability-gate/index.ts
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
5
4
|
var API_VERSION = "^0.1.10";
|
|
6
5
|
var state = {
|
|
7
6
|
invocations: 0,
|
|
@@ -304,5 +303,6 @@ Review the audit output or adjust the dependency choice.`;
|
|
|
304
303
|
}
|
|
305
304
|
};
|
|
306
305
|
var dependency_vulnerability_gate_default = plugin;
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
export {
|
|
307
|
+
dependency_vulnerability_gate_default as default
|
|
308
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* diff-summary plugin — PostToolUse hook that injects a compact diff
|
|
3
|
+
* into the LLM's context after every `write` or `edit`.
|
|
4
|
+
*
|
|
5
|
+
* Tools registered:
|
|
6
|
+
* - diff_summary_status : Show config + per-session counters.
|
|
7
|
+
*
|
|
8
|
+
* Hooks registered:
|
|
9
|
+
* - PostToolUse with matcher `write|edit`. After the tool completes,
|
|
10
|
+
* runs `git diff -- <path>` to capture what changed and injects a
|
|
11
|
+
* capped unified diff (or stat summary) as `additionalContext`.
|
|
12
|
+
*
|
|
13
|
+
* Config (`config.extensions['diff-summary']`):
|
|
14
|
+
*
|
|
15
|
+
* ```jsonc
|
|
16
|
+
* {
|
|
17
|
+
* "maxLines": 50, // cap diff context at N lines
|
|
18
|
+
* "showStat": true, // include "+N -M" summary line
|
|
19
|
+
* "mode": "diff" // "diff" (unified diff) | "stat" (counts only) | "off"
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Why: The `write` tool's result doesn't include a diff. The `edit`
|
|
24
|
+
* tool shows the replacement but not the full file context. This
|
|
25
|
+
* plugin gives the LLM consistent, compact visibility into what its
|
|
26
|
+
* change actually did to the file — confirming the edit applied
|
|
27
|
+
* correctly and showing surrounding context.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
import type { Plugin } from '@wrongstack/core';
|
|
32
|
+
declare const plugin: Plugin;
|
|
33
|
+
export default plugin;
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/diff-summary/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAgQ/C,QAAA,MAAM,MAAM,EAAE,MA4Pb,CAAC;eAEa,MAAM"}
|
package/dist/diff-summary.d.ts
CHANGED
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* diff-summary plugin — PostToolUse hook that injects a compact diff
|
|
5
|
-
* into the LLM's context after every `write` or `edit`.
|
|
6
|
-
*
|
|
7
|
-
* Tools registered:
|
|
8
|
-
* - diff_summary_status : Show config + per-session counters.
|
|
9
|
-
*
|
|
10
|
-
* Hooks registered:
|
|
11
|
-
* - PostToolUse with matcher `write|edit`. After the tool completes,
|
|
12
|
-
* runs `git diff -- <path>` to capture what changed and injects a
|
|
13
|
-
* capped unified diff (or stat summary) as `additionalContext`.
|
|
14
|
-
*
|
|
15
|
-
* Config (`config.extensions['diff-summary']`):
|
|
16
|
-
*
|
|
17
|
-
* ```jsonc
|
|
18
|
-
* {
|
|
19
|
-
* "maxLines": 50, // cap diff context at N lines
|
|
20
|
-
* "showStat": true, // include "+N -M" summary line
|
|
21
|
-
* "mode": "diff" // "diff" (unified diff) | "stat" (counts only) | "off"
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* Why: The `write` tool's result doesn't include a diff. The `edit`
|
|
26
|
-
* tool shows the replacement but not the full file context. This
|
|
27
|
-
* plugin gives the LLM consistent, compact visibility into what its
|
|
28
|
-
* change actually did to the file — confirming the edit applied
|
|
29
|
-
* correctly and showing surrounding context.
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
declare const plugin: Plugin;
|
|
35
|
-
|
|
36
|
-
export { plugin as default };
|
|
1
|
+
export * from './diff-summary/index.js';
|
|
2
|
+
export { default } from './diff-summary/index.js';
|
package/dist/diff-summary.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { execFileSync } from 'child_process';
|
|
2
|
-
import { isAbsolute, resolve, relative } from 'path';
|
|
3
|
-
|
|
4
1
|
// src/diff-summary/index.ts
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { isAbsolute, relative, resolve } from "node:path";
|
|
5
4
|
var API_VERSION = "^0.1.10";
|
|
6
5
|
function withinProject(p) {
|
|
7
6
|
if (typeof p !== "string" || p.length === 0 || p.length > 4096) return false;
|
|
@@ -318,5 +317,6 @@ var plugin = {
|
|
|
318
317
|
}
|
|
319
318
|
};
|
|
320
319
|
var diff_summary_default = plugin;
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
export {
|
|
321
|
+
diff_summary_default as default
|
|
322
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* doc-sync-guard plugin — warns when documentation is edited without
|
|
3
|
+
* referencing recently changed public source files.
|
|
4
|
+
*
|
|
5
|
+
* Tracks public source files changed by `write` or `edit`. When a README or
|
|
6
|
+
* docs file is written, checks whether the recently changed source files are
|
|
7
|
+
* mentioned and injects an `additionalContext` warning if any are missing.
|
|
8
|
+
*
|
|
9
|
+
* Tools registered:
|
|
10
|
+
* - doc_sync_status : Show tracked changed files and counters.
|
|
11
|
+
*
|
|
12
|
+
* Hooks registered:
|
|
13
|
+
* - PostToolUse with matcher `write|edit`.
|
|
14
|
+
*
|
|
15
|
+
* Config (`config.extensions['doc-sync-guard']`):
|
|
16
|
+
*
|
|
17
|
+
* ```jsonc
|
|
18
|
+
* {
|
|
19
|
+
* "enabled": true,
|
|
20
|
+
* "sourceExtensions": [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts"],
|
|
21
|
+
* "docNames": ["README.md", "README", "CONTRIBUTING.md", "CHANGELOG.md"],
|
|
22
|
+
* "maxTrackedFiles": 20
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
import type { Plugin } from '@wrongstack/core';
|
|
29
|
+
declare const plugin: Plugin;
|
|
30
|
+
export default plugin;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/doc-sync-guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAkJ/C,QAAA,MAAM,MAAM,EAAE,MAuJb,CAAC;eAEa,MAAM"}
|
package/dist/doc-sync-guard.d.ts
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* doc-sync-guard plugin — warns when documentation is edited without
|
|
5
|
-
* referencing recently changed public source files.
|
|
6
|
-
*
|
|
7
|
-
* Tracks public source files changed by `write` or `edit`. When a README or
|
|
8
|
-
* docs file is written, checks whether the recently changed source files are
|
|
9
|
-
* mentioned and injects an `additionalContext` warning if any are missing.
|
|
10
|
-
*
|
|
11
|
-
* Tools registered:
|
|
12
|
-
* - doc_sync_status : Show tracked changed files and counters.
|
|
13
|
-
*
|
|
14
|
-
* Hooks registered:
|
|
15
|
-
* - PostToolUse with matcher `write|edit`.
|
|
16
|
-
*
|
|
17
|
-
* Config (`config.extensions['doc-sync-guard']`):
|
|
18
|
-
*
|
|
19
|
-
* ```jsonc
|
|
20
|
-
* {
|
|
21
|
-
* "enabled": true,
|
|
22
|
-
* "sourceExtensions": [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts"],
|
|
23
|
-
* "docNames": ["README.md", "README", "CONTRIBUTING.md", "CHANGELOG.md"],
|
|
24
|
-
* "maxTrackedFiles": 20
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
declare const plugin: Plugin;
|
|
32
|
-
|
|
33
|
-
export { plugin as default };
|
|
1
|
+
export * from './doc-sync-guard/index.js';
|
|
2
|
+
export { default } from './doc-sync-guard/index.js';
|
package/dist/doc-sync-guard.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { isAbsolute, resolve, relative, basename, extname } from 'path';
|
|
2
|
-
|
|
3
1
|
// src/doc-sync-guard/index.ts
|
|
2
|
+
import { isAbsolute, relative, resolve, basename, extname } from "node:path";
|
|
4
3
|
var API_VERSION = "^0.1.10";
|
|
5
4
|
var state = {
|
|
6
5
|
changedFiles: [],
|
|
@@ -219,5 +218,6 @@ Consider mentioning these changes in the documentation.`;
|
|
|
219
218
|
}
|
|
220
219
|
};
|
|
221
220
|
var doc_sync_guard_default = plugin;
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
export {
|
|
222
|
+
doc_sync_guard_default as default
|
|
223
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* duplicate-code-detector plugin — finds duplicated code blocks across source
|
|
3
|
+
* files using normalized-line fingerprinting.
|
|
4
|
+
*
|
|
5
|
+
* Tools registered:
|
|
6
|
+
* - detect_duplicate_code : Scan a path for duplicated blocks.
|
|
7
|
+
* - duplicate_code_status : Report config + counters.
|
|
8
|
+
*
|
|
9
|
+
* Hooks registered:
|
|
10
|
+
* - PostToolUse with matcher `write|edit` to source files, warning when the
|
|
11
|
+
* changed file introduces blocks that duplicate existing code elsewhere.
|
|
12
|
+
*
|
|
13
|
+
* Config (`config.extensions['duplicate-code-detector']`):
|
|
14
|
+
*
|
|
15
|
+
* ```jsonc
|
|
16
|
+
* {
|
|
17
|
+
* "enabled": true,
|
|
18
|
+
* "minLines": 5,
|
|
19
|
+
* "threshold": 0.8,
|
|
20
|
+
* "extensions": [".ts", ".tsx", ".js", ".jsx"],
|
|
21
|
+
* "excludeDirs": ["node_modules", "dist", ".git", "coverage"],
|
|
22
|
+
* "maxFindings": 20
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
import type { Plugin } from '@wrongstack/core';
|
|
29
|
+
declare const plugin: Plugin;
|
|
30
|
+
export default plugin;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/duplicate-code-detector/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAsP/C,QAAA,MAAM,MAAM,EAAE,MA8Qb,CAAC;eAEa,MAAM"}
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* duplicate-code-detector plugin — finds duplicated code blocks across source
|
|
5
|
-
* files using normalized-line fingerprinting.
|
|
6
|
-
*
|
|
7
|
-
* Tools registered:
|
|
8
|
-
* - detect_duplicate_code : Scan a path for duplicated blocks.
|
|
9
|
-
* - duplicate_code_status : Report config + counters.
|
|
10
|
-
*
|
|
11
|
-
* Hooks registered:
|
|
12
|
-
* - PostToolUse with matcher `write|edit` to source files, warning when the
|
|
13
|
-
* changed file introduces blocks that duplicate existing code elsewhere.
|
|
14
|
-
*
|
|
15
|
-
* Config (`config.extensions['duplicate-code-detector']`):
|
|
16
|
-
*
|
|
17
|
-
* ```jsonc
|
|
18
|
-
* {
|
|
19
|
-
* "enabled": true,
|
|
20
|
-
* "minLines": 5,
|
|
21
|
-
* "threshold": 0.8,
|
|
22
|
-
* "extensions": [".ts", ".tsx", ".js", ".jsx"],
|
|
23
|
-
* "excludeDirs": ["node_modules", "dist", ".git", "coverage"],
|
|
24
|
-
* "maxFindings": 20
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
declare const plugin: Plugin;
|
|
32
|
-
|
|
33
|
-
export { plugin as default };
|
|
1
|
+
export * from './duplicate-code-detector/index.js';
|
|
2
|
+
export { default } from './duplicate-code-detector/index.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { readFileSync, existsSync, statSync, readdirSync } from 'fs';
|
|
2
|
-
import { resolve, isAbsolute, relative, extname } from 'path';
|
|
3
|
-
|
|
4
1
|
// src/duplicate-code-detector/index.ts
|
|
2
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
3
|
+
import { extname, isAbsolute, relative, resolve } from "node:path";
|
|
5
4
|
var API_VERSION = "^0.1.10";
|
|
6
5
|
var state = {
|
|
7
6
|
scanCount: 0,
|
|
@@ -380,5 +379,6 @@ var plugin = {
|
|
|
380
379
|
}
|
|
381
380
|
};
|
|
382
381
|
var duplicate_code_detector_default = plugin;
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
export {
|
|
383
|
+
duplicate_code_detector_default as default
|
|
384
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* error-lens plugin — turns noisy failure output into a compact,
|
|
3
|
+
* actionable digest.
|
|
4
|
+
*
|
|
5
|
+
* When a shell command fails, the model gets a wall of stderr: full
|
|
6
|
+
* stack traces, npm noise, repeated frames. A `PostToolUse` hook on
|
|
7
|
+
* `bash|exec` parses the failure and injects a short digest via
|
|
8
|
+
* `additionalContext`:
|
|
9
|
+
*
|
|
10
|
+
* - the error type + message line (TypeError, ENOENT, AssertionError…)
|
|
11
|
+
* - up to `maxFrames` source locations (`file:line`), *project frames
|
|
12
|
+
* first* (node_modules/internal frames are de-prioritized)
|
|
13
|
+
* - a repeat marker when the same failure was already seen, so the
|
|
14
|
+
* model notices "this is the SAME error as before"
|
|
15
|
+
*
|
|
16
|
+
* Recognized trace formats: Node/V8 (`at fn (file:line:col)`), Python
|
|
17
|
+
* (`File "x.py", line 12`), tsc/vitest (`file.ts:12:5`), Rust
|
|
18
|
+
* (`--> src/main.rs:4:5`), Go (`file.go:12 +0x…`).
|
|
19
|
+
*
|
|
20
|
+
* A ring of recent failures is queryable via `error_lens_history` —
|
|
21
|
+
* useful for "what have we broken so far this session?".
|
|
22
|
+
*
|
|
23
|
+
* Config (`config.extensions['error-lens']`):
|
|
24
|
+
*
|
|
25
|
+
* ```jsonc
|
|
26
|
+
* {
|
|
27
|
+
* "enabled": true,
|
|
28
|
+
* "maxFrames": 5, // source locations per digest
|
|
29
|
+
* "historySize": 20, // failures kept for error_lens_history
|
|
30
|
+
* "minOutputChars": 200, // don't digest tiny outputs (already readable)
|
|
31
|
+
* "aiHints": false, // ask the LLM (api.llm) for a one-line fix hint
|
|
32
|
+
* "llm": { "provider": "", "model": "" } // optional override for the hint model
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* With `aiHints: true` and a host that wires `api.llm`, each NEW failure
|
|
37
|
+
* digest is enriched with a one-line fix hint from the configured LLM
|
|
38
|
+
* (per-plugin `llm.provider`/`llm.model` override the session default).
|
|
39
|
+
* Hint failures are swallowed — the digest always lands.
|
|
40
|
+
*
|
|
41
|
+
* Toggle off with `{ "name": "error-lens", "enabled": false }` in
|
|
42
|
+
* `config.plugins`, or `"enabled": false` in the options above.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
import type { Plugin } from '@wrongstack/core';
|
|
47
|
+
export interface FailureRecord {
|
|
48
|
+
when: string;
|
|
49
|
+
tool: string;
|
|
50
|
+
command: string | null;
|
|
51
|
+
errorLine: string | null;
|
|
52
|
+
frames: string[];
|
|
53
|
+
repeats: number;
|
|
54
|
+
}
|
|
55
|
+
/** Extract the first recognizable error line from tool output. */
|
|
56
|
+
export declare function extractErrorLine(output: string): string | null;
|
|
57
|
+
/**
|
|
58
|
+
* Extract source locations (`file:line`) from tool output.
|
|
59
|
+
* Project frames (not node_modules / internal) are ordered first,
|
|
60
|
+
* duplicates removed, capped at `maxFrames`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function extractFrames(output: string, maxFrames: number): string[];
|
|
63
|
+
declare const plugin: Plugin;
|
|
64
|
+
export default plugin;
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error-lens/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAM/C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AA6FD,kEAAkE;AAClE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM9D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBzE;AAUD,QAAA,MAAM,MAAM,EAAE,MAoOb,CAAC;eAEa,MAAM"}
|
package/dist/error-lens.d.ts
CHANGED
|
@@ -1,67 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* error-lens plugin — turns noisy failure output into a compact,
|
|
5
|
-
* actionable digest.
|
|
6
|
-
*
|
|
7
|
-
* When a shell command fails, the model gets a wall of stderr: full
|
|
8
|
-
* stack traces, npm noise, repeated frames. A `PostToolUse` hook on
|
|
9
|
-
* `bash|exec` parses the failure and injects a short digest via
|
|
10
|
-
* `additionalContext`:
|
|
11
|
-
*
|
|
12
|
-
* - the error type + message line (TypeError, ENOENT, AssertionError…)
|
|
13
|
-
* - up to `maxFrames` source locations (`file:line`), *project frames
|
|
14
|
-
* first* (node_modules/internal frames are de-prioritized)
|
|
15
|
-
* - a repeat marker when the same failure was already seen, so the
|
|
16
|
-
* model notices "this is the SAME error as before"
|
|
17
|
-
*
|
|
18
|
-
* Recognized trace formats: Node/V8 (`at fn (file:line:col)`), Python
|
|
19
|
-
* (`File "x.py", line 12`), tsc/vitest (`file.ts:12:5`), Rust
|
|
20
|
-
* (`--> src/main.rs:4:5`), Go (`file.go:12 +0x…`).
|
|
21
|
-
*
|
|
22
|
-
* A ring of recent failures is queryable via `error_lens_history` —
|
|
23
|
-
* useful for "what have we broken so far this session?".
|
|
24
|
-
*
|
|
25
|
-
* Config (`config.extensions['error-lens']`):
|
|
26
|
-
*
|
|
27
|
-
* ```jsonc
|
|
28
|
-
* {
|
|
29
|
-
* "enabled": true,
|
|
30
|
-
* "maxFrames": 5, // source locations per digest
|
|
31
|
-
* "historySize": 20, // failures kept for error_lens_history
|
|
32
|
-
* "minOutputChars": 200, // don't digest tiny outputs (already readable)
|
|
33
|
-
* "aiHints": false, // ask the LLM (api.llm) for a one-line fix hint
|
|
34
|
-
* "llm": { "provider": "", "model": "" } // optional override for the hint model
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* With `aiHints: true` and a host that wires `api.llm`, each NEW failure
|
|
39
|
-
* digest is enriched with a one-line fix hint from the configured LLM
|
|
40
|
-
* (per-plugin `llm.provider`/`llm.model` override the session default).
|
|
41
|
-
* Hint failures are swallowed — the digest always lands.
|
|
42
|
-
*
|
|
43
|
-
* Toggle off with `{ "name": "error-lens", "enabled": false }` in
|
|
44
|
-
* `config.plugins`, or `"enabled": false` in the options above.
|
|
45
|
-
*
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
interface FailureRecord {
|
|
50
|
-
when: string;
|
|
51
|
-
tool: string;
|
|
52
|
-
command: string | null;
|
|
53
|
-
errorLine: string | null;
|
|
54
|
-
frames: string[];
|
|
55
|
-
repeats: number;
|
|
56
|
-
}
|
|
57
|
-
/** Extract the first recognizable error line from tool output. */
|
|
58
|
-
declare function extractErrorLine(output: string): string | null;
|
|
59
|
-
/**
|
|
60
|
-
* Extract source locations (`file:line`) from tool output.
|
|
61
|
-
* Project frames (not node_modules / internal) are ordered first,
|
|
62
|
-
* duplicates removed, capped at `maxFrames`.
|
|
63
|
-
*/
|
|
64
|
-
declare function extractFrames(output: string, maxFrames: number): string[];
|
|
65
|
-
declare const plugin: Plugin;
|
|
66
|
-
|
|
67
|
-
export { type FailureRecord, plugin as default, extractErrorLine, extractFrames };
|
|
1
|
+
export * from './error-lens/index.js';
|
|
2
|
+
export { default } from './error-lens/index.js';
|