@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
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* plugin-stack-observer — observability over the providerRunner wrap stack.
|
|
5
|
-
*
|
|
6
|
-
* Several official plugins (llm-cache, model-router, prompt-firewall,
|
|
7
|
-
* token-throttle) register `AgentExtension.wrapProviderRunner` to
|
|
8
|
-
* intercept every provider call. The runtime composes them in
|
|
9
|
-
* registration order — but until now there was no way for an operator
|
|
10
|
-
* (or the LLM itself) to see WHICH wraps are active in what order.
|
|
11
|
-
*
|
|
12
|
-
* Each wrap plugin emits `customEvent('provider.wrap:loaded', …)` on
|
|
13
|
-
* setup. This plugin subscribes via `onPattern('provider.wrap:loaded')`
|
|
14
|
-
* and:
|
|
15
|
-
*
|
|
16
|
-
* 1. Builds an in-memory stack (preserves emission order)
|
|
17
|
-
* 2. Registers a system-prompt contributor that, when any wraps are
|
|
18
|
-
* present, emits a compact one-line block listing them. The LLM
|
|
19
|
-
* sees who is wrapping what, in registration order — making the
|
|
20
|
-
* stack visible without /diag round-trips.
|
|
21
|
-
*
|
|
22
|
-
* Disabled by default (enabled=false) because not every user wants
|
|
23
|
-
* the LLM to be aware of the wrap stack. The plugin_stack tool is
|
|
24
|
-
* always registered so operators can read the stack at runtime
|
|
25
|
-
* regardless of the contributor setting.
|
|
26
|
-
*
|
|
27
|
-
* Tools registered:
|
|
28
|
-
* - plugin_stack_status : Read the active wrap stack + load order
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
declare const PLUGIN: Plugin;
|
|
34
|
-
|
|
35
|
-
export { PLUGIN as default };
|
|
1
|
+
export * from './plugin-stack-observer/index.js';
|
|
2
|
+
export { default } from './plugin-stack-observer/index.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pr-drafter plugin — collects work done during a session and drafts a
|
|
3
|
+
* pull-request description.
|
|
4
|
+
*
|
|
5
|
+
* As the session runs, the plugin listens to:
|
|
6
|
+
* - `tool.completed` events for `git_autocommit` (records commit messages)
|
|
7
|
+
* - `tool.completed` events for `write`/`edit` (records changed files)
|
|
8
|
+
* - `provider.response` events (records model usage)
|
|
9
|
+
*
|
|
10
|
+
* On `Stop` it composes a markdown PR body and writes it to a configurable
|
|
11
|
+
* file (default: `.wrongstack/PR_DRAFT.md`). A `pr_draft` tool lets the
|
|
12
|
+
* agent request the draft on demand.
|
|
13
|
+
*
|
|
14
|
+
* Config (`config.extensions['pr-drafter']`):
|
|
15
|
+
*
|
|
16
|
+
* ```jsonc
|
|
17
|
+
* {
|
|
18
|
+
* "enabled": true,
|
|
19
|
+
* "outputPath": ".wrongstack/PR_DRAFT.md",
|
|
20
|
+
* "writeOnStop": true,
|
|
21
|
+
* "includeDiff": true,
|
|
22
|
+
* "includeCommits": true,
|
|
23
|
+
* "includeFiles": true,
|
|
24
|
+
* "aiSummary": false
|
|
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/pr-drafter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,kBAAkB,CAAC;AA4M1D,QAAA,MAAM,MAAM,EAAE,MAyNb,CAAC;eAEa,MAAM"}
|
package/dist/pr-drafter.d.ts
CHANGED
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* pr-drafter plugin — collects work done during a session and drafts a
|
|
5
|
-
* pull-request description.
|
|
6
|
-
*
|
|
7
|
-
* As the session runs, the plugin listens to:
|
|
8
|
-
* - `tool.completed` events for `git_autocommit` (records commit messages)
|
|
9
|
-
* - `tool.completed` events for `write`/`edit` (records changed files)
|
|
10
|
-
* - `provider.response` events (records model usage)
|
|
11
|
-
*
|
|
12
|
-
* On `Stop` it composes a markdown PR body and writes it to a configurable
|
|
13
|
-
* file (default: `.wrongstack/PR_DRAFT.md`). A `pr_draft` tool lets the
|
|
14
|
-
* agent request the draft on demand.
|
|
15
|
-
*
|
|
16
|
-
* Config (`config.extensions['pr-drafter']`):
|
|
17
|
-
*
|
|
18
|
-
* ```jsonc
|
|
19
|
-
* {
|
|
20
|
-
* "enabled": true,
|
|
21
|
-
* "outputPath": ".wrongstack/PR_DRAFT.md",
|
|
22
|
-
* "writeOnStop": true,
|
|
23
|
-
* "includeDiff": true,
|
|
24
|
-
* "includeCommits": true,
|
|
25
|
-
* "includeFiles": true,
|
|
26
|
-
* "aiSummary": false
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
declare const plugin: Plugin;
|
|
34
|
-
|
|
35
|
-
export { plugin as default };
|
|
1
|
+
export * from './pr-drafter/index.js';
|
|
2
|
+
export { default } from './pr-drafter/index.js';
|
package/dist/pr-drafter.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { execFileSync } from 'child_process';
|
|
2
|
-
import { mkdirSync, writeFileSync } from 'fs';
|
|
3
|
-
import { dirname, resolve, isAbsolute, relative } from 'path';
|
|
4
|
-
|
|
5
1
|
// src/pr-drafter/index.ts
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
6
5
|
var API_VERSION = "^0.1.10";
|
|
7
6
|
var state = {
|
|
8
7
|
commits: [],
|
|
@@ -330,5 +329,6 @@ var plugin = {
|
|
|
330
329
|
}
|
|
331
330
|
};
|
|
332
331
|
var pr_drafter_default = plugin;
|
|
333
|
-
|
|
334
|
-
|
|
332
|
+
export {
|
|
333
|
+
pr_drafter_default as default
|
|
334
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prompt-firewall plugin — inspects and redacts secrets on the provider
|
|
3
|
+
* wire, before context leaves for the LLM API and as it returns.
|
|
4
|
+
*
|
|
5
|
+
* Distinct from `secret-scanner` (which guards the TOOL boundary): this
|
|
6
|
+
* sits on `AgentExtension.wrapProviderRunner`, so it sees the FULL
|
|
7
|
+
* request that is about to be sent to a third-party LLM provider —
|
|
8
|
+
* regardless of how a secret entered the conversation. It scans the
|
|
9
|
+
* outgoing request's system + message text for high-confidence
|
|
10
|
+
* credential patterns and, depending on `mode`:
|
|
11
|
+
*
|
|
12
|
+
* - `warn` (default) — logs + counts + emits a `prompt-firewall:leak`
|
|
13
|
+
* event; the request goes through unchanged
|
|
14
|
+
* - `redact` — replaces each match with `[REDACTED:<kind>]` in a CLONE
|
|
15
|
+
* of the request before sending, and also redacts secrets echoed back
|
|
16
|
+
* in the response
|
|
17
|
+
* - `block` — throws before the request is sent (the agent's error
|
|
18
|
+
* path surfaces it), so the secret never reaches the provider
|
|
19
|
+
*
|
|
20
|
+
* Safety posture: opt-in — loads inert until
|
|
21
|
+
* `config.extensions['prompt-firewall'].enabled = true`. `warn` is the
|
|
22
|
+
* default so it can never corrupt context until you deliberately choose
|
|
23
|
+
* `redact`/`block`.
|
|
24
|
+
*
|
|
25
|
+
* Config (`config.extensions['prompt-firewall']`):
|
|
26
|
+
*
|
|
27
|
+
* ```jsonc
|
|
28
|
+
* {
|
|
29
|
+
* "enabled": false,
|
|
30
|
+
* "mode": "warn", // "warn" | "redact" | "block"
|
|
31
|
+
* "scanResponse": true, // redact secrets echoed back (redact mode)
|
|
32
|
+
* "allow": [] // regex source strings to exempt (false positives)
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* Tools:
|
|
37
|
+
* - `prompt_firewall_status` — mode, pattern names, detection counters
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
import type { Plugin } from '@wrongstack/core';
|
|
42
|
+
export interface Detection {
|
|
43
|
+
kind: string;
|
|
44
|
+
count: number;
|
|
45
|
+
}
|
|
46
|
+
/** Detect secret matches in text. Returns per-kind counts (no values). */
|
|
47
|
+
export declare function detectSecrets(text: string, allow: RegExp[]): Detection[];
|
|
48
|
+
/** Redact secret matches in text, replacing each with `[REDACTED:<kind>]`. */
|
|
49
|
+
export declare function redactSecrets(text: string, allow: RegExp[]): {
|
|
50
|
+
text: string;
|
|
51
|
+
redactions: number;
|
|
52
|
+
};
|
|
53
|
+
declare const plugin: Plugin;
|
|
54
|
+
export default plugin;
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,kBAAkB,CAAC;AA+B1D,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;AA6GD,QAAA,MAAM,MAAM,EAAE,MAkNb,CAAC;eAEa,MAAM"}
|
|
@@ -1,57 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* prompt-firewall plugin — inspects and redacts secrets on the provider
|
|
5
|
-
* wire, before context leaves for the LLM API and as it returns.
|
|
6
|
-
*
|
|
7
|
-
* Distinct from `secret-scanner` (which guards the TOOL boundary): this
|
|
8
|
-
* sits on `AgentExtension.wrapProviderRunner`, so it sees the FULL
|
|
9
|
-
* request that is about to be sent to a third-party LLM provider —
|
|
10
|
-
* regardless of how a secret entered the conversation. It scans the
|
|
11
|
-
* outgoing request's system + message text for high-confidence
|
|
12
|
-
* credential patterns and, depending on `mode`:
|
|
13
|
-
*
|
|
14
|
-
* - `warn` (default) — logs + counts + emits a `prompt-firewall:leak`
|
|
15
|
-
* event; the request goes through unchanged
|
|
16
|
-
* - `redact` — replaces each match with `[REDACTED:<kind>]` in a CLONE
|
|
17
|
-
* of the request before sending, and also redacts secrets echoed back
|
|
18
|
-
* in the response
|
|
19
|
-
* - `block` — throws before the request is sent (the agent's error
|
|
20
|
-
* path surfaces it), so the secret never reaches the provider
|
|
21
|
-
*
|
|
22
|
-
* Safety posture: opt-in — loads inert until
|
|
23
|
-
* `config.extensions['prompt-firewall'].enabled = true`. `warn` is the
|
|
24
|
-
* default so it can never corrupt context until you deliberately choose
|
|
25
|
-
* `redact`/`block`.
|
|
26
|
-
*
|
|
27
|
-
* Config (`config.extensions['prompt-firewall']`):
|
|
28
|
-
*
|
|
29
|
-
* ```jsonc
|
|
30
|
-
* {
|
|
31
|
-
* "enabled": false,
|
|
32
|
-
* "mode": "warn", // "warn" | "redact" | "block"
|
|
33
|
-
* "scanResponse": true, // redact secrets echoed back (redact mode)
|
|
34
|
-
* "allow": [] // regex source strings to exempt (false positives)
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* Tools:
|
|
39
|
-
* - `prompt_firewall_status` — mode, pattern names, detection counters
|
|
40
|
-
*
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
interface Detection {
|
|
45
|
-
kind: string;
|
|
46
|
-
count: number;
|
|
47
|
-
}
|
|
48
|
-
/** Detect secret matches in text. Returns per-kind counts (no values). */
|
|
49
|
-
declare function detectSecrets(text: string, allow: RegExp[]): Detection[];
|
|
50
|
-
/** Redact secret matches in text, replacing each with `[REDACTED:<kind>]`. */
|
|
51
|
-
declare function redactSecrets(text: string, allow: RegExp[]): {
|
|
52
|
-
text: string;
|
|
53
|
-
redactions: number;
|
|
54
|
-
};
|
|
55
|
-
declare const plugin: Plugin;
|
|
56
|
-
|
|
57
|
-
export { type Detection, plugin as default, detectSecrets, redactSecrets };
|
|
1
|
+
export * from './prompt-firewall/index.js';
|
|
2
|
+
export { default } from './prompt-firewall/index.js';
|
package/dist/prompt-firewall.js
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* refactor-suggester plugin — regex-based smell detector that suggests
|
|
3
|
+
* refactoring opportunities in source files.
|
|
4
|
+
*
|
|
5
|
+
* Tools registered:
|
|
6
|
+
* - suggest_refactors : Scan a file or directory for smells.
|
|
7
|
+
* - refactor_status : Report config + counters.
|
|
8
|
+
*
|
|
9
|
+
* Hooks registered:
|
|
10
|
+
* - PostToolUse with matcher `write|edit` to source files, injecting
|
|
11
|
+
* suggestions for the changed file.
|
|
12
|
+
*
|
|
13
|
+
* Config (`config.extensions['refactor-suggester']`):
|
|
14
|
+
*
|
|
15
|
+
* ```jsonc
|
|
16
|
+
* {
|
|
17
|
+
* "enabled": true,
|
|
18
|
+
* "extensions": [".ts", ".tsx", ".js", ".jsx"],
|
|
19
|
+
* "maxSuggestions": 20,
|
|
20
|
+
* "rules": { "longFunctionLines": 50, "maxParams": 5, "maxNesting": 3 }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
import type { Plugin } from '@wrongstack/core';
|
|
27
|
+
export type SmellType = 'long-function' | 'deep-nesting' | 'many-parameters' | 'magic-number' | 'console-log';
|
|
28
|
+
export interface RefactorSuggestion {
|
|
29
|
+
file: string;
|
|
30
|
+
line: number;
|
|
31
|
+
type: SmellType;
|
|
32
|
+
message: string;
|
|
33
|
+
}
|
|
34
|
+
declare const plugin: Plugin;
|
|
35
|
+
export default plugin;
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,kBAAkB,CAAC;AAQ/C,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;AAgRD,QAAA,MAAM,MAAM,EAAE,MA4Nb,CAAC;eAEa,MAAM"}
|
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* refactor-suggester plugin — regex-based smell detector that suggests
|
|
5
|
-
* refactoring opportunities in source files.
|
|
6
|
-
*
|
|
7
|
-
* Tools registered:
|
|
8
|
-
* - suggest_refactors : Scan a file or directory for smells.
|
|
9
|
-
* - refactor_status : Report config + counters.
|
|
10
|
-
*
|
|
11
|
-
* Hooks registered:
|
|
12
|
-
* - PostToolUse with matcher `write|edit` to source files, injecting
|
|
13
|
-
* suggestions for the changed file.
|
|
14
|
-
*
|
|
15
|
-
* Config (`config.extensions['refactor-suggester']`):
|
|
16
|
-
*
|
|
17
|
-
* ```jsonc
|
|
18
|
-
* {
|
|
19
|
-
* "enabled": true,
|
|
20
|
-
* "extensions": [".ts", ".tsx", ".js", ".jsx"],
|
|
21
|
-
* "maxSuggestions": 20,
|
|
22
|
-
* "rules": { "longFunctionLines": 50, "maxParams": 5, "maxNesting": 3 }
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
type SmellType = 'long-function' | 'deep-nesting' | 'many-parameters' | 'magic-number' | 'console-log';
|
|
30
|
-
interface RefactorSuggestion {
|
|
31
|
-
file: string;
|
|
32
|
-
line: number;
|
|
33
|
-
type: SmellType;
|
|
34
|
-
message: string;
|
|
35
|
-
}
|
|
36
|
-
declare const plugin: Plugin;
|
|
37
|
-
|
|
38
|
-
export { type RefactorSuggestion, type SmellType, plugin as default };
|
|
1
|
+
export * from './refactor-suggester/index.js';
|
|
2
|
+
export { default } from './refactor-suggester/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/refactor-suggester/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,
|
|
@@ -105,21 +104,20 @@ function detectSmells(filePath, content, rules) {
|
|
|
105
104
|
const lines = content.split(/\r?\n/);
|
|
106
105
|
const stripped = content.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, " ");
|
|
107
106
|
const functionLikeRe = /(?:export\s+)?(?:async\s+)?(?:function\s+)?([A-Za-z_$][A-Za-z0-9_$]*)\s*\(([^)]*)\)\s*\{/g;
|
|
108
|
-
let m;
|
|
109
107
|
functionLikeRe.lastIndex = 0;
|
|
110
|
-
|
|
111
|
-
const name =
|
|
112
|
-
const paramsRaw =
|
|
108
|
+
for (const match of stripped.matchAll(functionLikeRe)) {
|
|
109
|
+
const name = match[1];
|
|
110
|
+
const paramsRaw = match[2];
|
|
113
111
|
const params = paramsRaw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
114
112
|
if (params.length > rules.maxParams) {
|
|
115
113
|
suggestions.push({
|
|
116
114
|
file: relativePath(filePath),
|
|
117
|
-
line: content.slice(0,
|
|
115
|
+
line: content.slice(0, match.index).split(/\r?\n/).length,
|
|
118
116
|
type: "many-parameters",
|
|
119
117
|
message: `${name} has ${params.length} parameters (limit ${rules.maxParams})`
|
|
120
118
|
});
|
|
121
119
|
}
|
|
122
|
-
const bodyStart =
|
|
120
|
+
const bodyStart = match.index + match[0].length;
|
|
123
121
|
let depth = 1;
|
|
124
122
|
let lineEnd = bodyStart;
|
|
125
123
|
for (let i = bodyStart; i < stripped.length && depth > 0; i++) {
|
|
@@ -132,7 +130,7 @@ function detectSmells(filePath, content, rules) {
|
|
|
132
130
|
if (bodyLines > rules.longFunctionLines) {
|
|
133
131
|
suggestions.push({
|
|
134
132
|
file: relativePath(filePath),
|
|
135
|
-
line: content.slice(0,
|
|
133
|
+
line: content.slice(0, match.index).split(/\r?\n/).length,
|
|
136
134
|
type: "long-function",
|
|
137
135
|
message: `${name} spans ~${bodyLines} lines (limit ${rules.longFunctionLines})`
|
|
138
136
|
});
|
|
@@ -163,15 +161,15 @@ function detectSmells(filePath, content, rules) {
|
|
|
163
161
|
const magicRe = /\b-?\d+(?:\.\d+)?\b/g;
|
|
164
162
|
const allowed = /* @__PURE__ */ new Set(["0", "1", "-1", "2"]);
|
|
165
163
|
magicRe.lastIndex = 0;
|
|
166
|
-
|
|
167
|
-
const match =
|
|
164
|
+
for (const magicNumberMatch of content.matchAll(magicRe)) {
|
|
165
|
+
const match = magicNumberMatch[0];
|
|
168
166
|
if (allowed.has(match)) continue;
|
|
169
|
-
const before = content[
|
|
170
|
-
const after = content[
|
|
167
|
+
const before = content[magicNumberMatch.index - 1];
|
|
168
|
+
const after = content[magicNumberMatch.index + match.length];
|
|
171
169
|
if (before === "[" && after === "]") continue;
|
|
172
170
|
suggestions.push({
|
|
173
171
|
file: relativePath(filePath),
|
|
174
|
-
line: content.slice(0,
|
|
172
|
+
line: content.slice(0, magicNumberMatch.index).split(/\r?\n/).length,
|
|
175
173
|
type: "magic-number",
|
|
176
174
|
message: `magic number ${match} should be a named constant`
|
|
177
175
|
});
|
|
@@ -378,5 +376,6 @@ var plugin = {
|
|
|
378
376
|
}
|
|
379
377
|
};
|
|
380
378
|
var refactor_suggester_default = plugin;
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
export {
|
|
380
|
+
refactor_suggester_default as default
|
|
381
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* release-notes-generator plugin — generates grouped release notes from git
|
|
3
|
+
* history using conventional-commit parsing.
|
|
4
|
+
*
|
|
5
|
+
* Tool registered:
|
|
6
|
+
* - generate_release_notes : Produce grouped notes between two refs.
|
|
7
|
+
*
|
|
8
|
+
* No hooks are registered.
|
|
9
|
+
*
|
|
10
|
+
* Config (`config.extensions['release-notes-generator']`):
|
|
11
|
+
*
|
|
12
|
+
* ```jsonc
|
|
13
|
+
* {
|
|
14
|
+
* "enabled": true,
|
|
15
|
+
* "includeScope": true,
|
|
16
|
+
* "defaultFrom": "latest-tag"
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
import type { Plugin } from '@wrongstack/core';
|
|
23
|
+
declare const plugin: Plugin;
|
|
24
|
+
export default plugin;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/release-notes-generator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAmL/C,QAAA,MAAM,MAAM,EAAE,MA+Gb,CAAC;eAEa,MAAM"}
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* release-notes-generator plugin — generates grouped release notes from git
|
|
5
|
-
* history using conventional-commit parsing.
|
|
6
|
-
*
|
|
7
|
-
* Tool registered:
|
|
8
|
-
* - generate_release_notes : Produce grouped notes between two refs.
|
|
9
|
-
*
|
|
10
|
-
* No hooks are registered.
|
|
11
|
-
*
|
|
12
|
-
* Config (`config.extensions['release-notes-generator']`):
|
|
13
|
-
*
|
|
14
|
-
* ```jsonc
|
|
15
|
-
* {
|
|
16
|
-
* "enabled": true,
|
|
17
|
-
* "includeScope": true,
|
|
18
|
-
* "defaultFrom": "latest-tag"
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
declare const plugin: Plugin;
|
|
26
|
-
|
|
27
|
-
export { plugin as default };
|
|
1
|
+
export * from './release-notes-generator/index.js';
|
|
2
|
+
export { default } from './release-notes-generator/index.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
|
|
3
1
|
// src/release-notes-generator/index.ts
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
4
3
|
var API_VERSION = "^0.1.10";
|
|
5
4
|
var state = {
|
|
6
5
|
generateCount: 0,
|
|
@@ -41,23 +40,41 @@ function formatCommit(c, includeScope) {
|
|
|
41
40
|
line += ` ${c.description}`;
|
|
42
41
|
return line;
|
|
43
42
|
}
|
|
43
|
+
var GIT_OPTIONS = {
|
|
44
|
+
encoding: "utf-8",
|
|
45
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
46
|
+
shell: false
|
|
47
|
+
};
|
|
44
48
|
function resolveFromRef(defaultFrom, inputFrom) {
|
|
45
49
|
if (inputFrom) return inputFrom;
|
|
46
50
|
if (defaultFrom === "latest-tag") {
|
|
47
51
|
try {
|
|
48
|
-
return
|
|
52
|
+
return execFileSync("git", ["describe", "--tags", "--abbrev=0"], GIT_OPTIONS).trim();
|
|
49
53
|
} catch {
|
|
50
54
|
return "";
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
return defaultFrom;
|
|
54
58
|
}
|
|
59
|
+
function resolveCommit(ref) {
|
|
60
|
+
const resolved = execFileSync(
|
|
61
|
+
"git",
|
|
62
|
+
["rev-parse", "--verify", "--end-of-options", `${ref}^{commit}`],
|
|
63
|
+
GIT_OPTIONS
|
|
64
|
+
).trim();
|
|
65
|
+
if (!/^[0-9a-f]{40,64}$/i.test(resolved)) {
|
|
66
|
+
throw new Error(`git returned an invalid commit id for ref ${JSON.stringify(ref)}`);
|
|
67
|
+
}
|
|
68
|
+
return resolved;
|
|
69
|
+
}
|
|
55
70
|
function getCommits(from, to) {
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
const toCommit = resolveCommit(to);
|
|
72
|
+
const range = from ? `${resolveCommit(from)}..${toCommit}` : toCommit;
|
|
73
|
+
const output = execFileSync(
|
|
74
|
+
"git",
|
|
75
|
+
["log", "--pretty=format:%H%x09%s", "--end-of-options", range],
|
|
76
|
+
GIT_OPTIONS
|
|
77
|
+
);
|
|
61
78
|
if (!output.trim()) return [];
|
|
62
79
|
const commits = [];
|
|
63
80
|
for (const line of output.split(/\r?\n/)) {
|
|
@@ -205,5 +222,6 @@ var plugin = {
|
|
|
205
222
|
}
|
|
206
223
|
};
|
|
207
224
|
var release_notes_generator_default = plugin;
|
|
208
|
-
|
|
209
|
-
|
|
225
|
+
export {
|
|
226
|
+
release_notes_generator_default as default
|
|
227
|
+
};
|