@wrongstack/plugins 0.293.0 → 0.295.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +50 -33
- package/dist/agent-handoff/index.d.ts +1 -1
- package/dist/agent-handoff/index.d.ts.map +1 -1
- package/dist/agent-handoff.js +30 -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-doc.js +3 -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 +7 -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 +111 -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/changelog-writer.js +137 -3
- package/dist/checkpoint/index.d.ts +3 -1
- package/dist/checkpoint/index.d.ts.map +1 -1
- package/dist/checkpoint.js +41 -16
- package/dist/code-metrics/index.d.ts +1 -1
- package/dist/code-metrics/index.d.ts.map +1 -1
- package/dist/code-metrics.js +34 -29
- package/dist/commit-validator/index.d.ts +1 -1
- package/dist/commit-validator/index.d.ts.map +1 -1
- package/dist/commit-validator.js +17 -7
- 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/context-pins.js +6 -5
- package/dist/cost-tracker/index.d.ts +1 -1
- package/dist/cost-tracker/index.d.ts.map +1 -1
- package/dist/cost-tracker.js +109 -2
- package/dist/cron/index.d.ts +1 -1
- package/dist/cron/index.d.ts.map +1 -1
- package/dist/cron.js +1 -0
- 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 +31 -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 +67 -20
- package/dist/diff-summary/index.d.ts +1 -1
- package/dist/diff-summary/index.d.ts.map +1 -1
- package/dist/diff-summary.js +128 -30
- 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 +7 -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 +280 -69
- 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 +59 -33
- package/dist/file-watcher/index.d.ts +1 -1
- package/dist/file-watcher/index.d.ts.map +1 -1
- package/dist/file-watcher.js +6 -7
- package/dist/format-on-save/index.d.ts +3 -1
- package/dist/format-on-save/index.d.ts.map +1 -1
- package/dist/format-on-save.js +289 -59
- 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 +141 -20
- package/dist/index.d.ts +4 -183
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18298 -17279
- 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 +87 -53
- package/dist/knowledge-graph/index.d.ts +1 -1
- package/dist/knowledge-graph/index.d.ts.map +1 -1
- package/dist/knowledge-graph.js +7 -6
- 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 +112 -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 +25 -9
- 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 +5 -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/notify-hub.js +41 -4
- 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/prompt-firewall.js +140 -11
- package/dist/refactor-suggester/index.d.ts +1 -1
- package/dist/refactor-suggester/index.d.ts.map +1 -1
- package/dist/refactor-suggester.js +148 -33
- 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/bounded-map.d.ts +86 -0
- package/dist/runtime/bounded-map.d.ts.map +1 -0
- package/dist/runtime/credential-patterns.d.ts +42 -0
- package/dist/runtime/credential-patterns.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +18 -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/local-bin.d.ts +120 -0
- package/dist/runtime/local-bin.d.ts.map +1 -0
- package/dist/runtime/safe-json.d.ts +25 -0
- package/dist/runtime/safe-json.d.ts.map +1 -0
- package/dist/runtime.js +332 -22
- 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 +7 -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 +181 -48
- 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 +158 -20
- package/dist/semantic-search-indexer/index.d.ts +1 -1
- package/dist/semantic-search-indexer/index.d.ts.map +1 -1
- package/dist/semantic-search-indexer.js +7 -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 +97 -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 +34 -8
- 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 +34 -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 +132 -9
- package/dist/todo-listener/index.d.ts +1 -32
- package/dist/todo-listener/index.d.ts.map +1 -1
- package/dist/todo-listener.js +30 -1
- package/dist/todo-tracker/index.d.ts +1 -1
- package/dist/todo-tracker/index.d.ts.map +1 -1
- package/dist/todo-tracker.js +3 -4
- 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/token-throttle.js +17 -2
- package/dist/type-gate/index.d.ts +1 -1
- package/dist/type-gate/index.d.ts.map +1 -1
- package/dist/type-gate.js +106 -19
- package/package.json +80 -68
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wrongstack/plugins — canonical credential-pattern table.
|
|
3
|
+
*
|
|
4
|
+
* Two plugins detect credentials, at different points in the pipeline:
|
|
5
|
+
*
|
|
6
|
+
* - `secret-scanner` gates tool *input* and inspects tool *output*.
|
|
7
|
+
* - `prompt-firewall` inspects the outgoing *provider request* (and the
|
|
8
|
+
* response) so a credential sitting in context is not shipped to a
|
|
9
|
+
* third party.
|
|
10
|
+
*
|
|
11
|
+
* They previously each carried their own pattern list. The lists drifted:
|
|
12
|
+
* one grew GitLab, npm, SendGrid and DigitalOcean coverage while the other
|
|
13
|
+
* did not, so which credentials were caught depended on which side of the
|
|
14
|
+
* pipeline they crossed. A credential is a credential — the two surfaces
|
|
15
|
+
* should never disagree about what one looks like.
|
|
16
|
+
*
|
|
17
|
+
* This module is the single source of truth. Adding a pattern here
|
|
18
|
+
* strengthens both surfaces at once.
|
|
19
|
+
*
|
|
20
|
+
* Style notes for new entries:
|
|
21
|
+
* - Prefer explicit lookaround boundaries — `(?<![A-Za-z0-9])` /
|
|
22
|
+
* `(?![A-Za-z0-9])` — over ``. `` is defined against word
|
|
23
|
+
* characters, so it silently fails next to the `+`, `/` and `=` that
|
|
24
|
+
* base64-shaped secrets routinely end with.
|
|
25
|
+
* - Keep every group non-capturing (`(?:…)`). The combined regex maps a
|
|
26
|
+
* capture-group index back to the pattern that fired; an inner group
|
|
27
|
+
* shifts that mapping. `secret-scanner` compensates for user-supplied
|
|
28
|
+
* patterns, but built-ins should not need it.
|
|
29
|
+
* - Avoid unbounded `.*` lookarounds: these run on every provider
|
|
30
|
+
* request, against the full context.
|
|
31
|
+
*/
|
|
32
|
+
/** One credential shape, with a stable machine-readable id. */
|
|
33
|
+
export interface CredentialPattern {
|
|
34
|
+
/** Stable id, e.g. `github_pat`. Reported to users and in metrics. */
|
|
35
|
+
type: string;
|
|
36
|
+
/** Global-flagged matcher. */
|
|
37
|
+
regex: RegExp;
|
|
38
|
+
}
|
|
39
|
+
export declare const CREDENTIAL_PATTERNS: readonly CredentialPattern[];
|
|
40
|
+
/** Fresh, independently-stateful copies (RegExp `lastIndex` is mutable). */
|
|
41
|
+
export declare function cloneCredentialPatterns(): CredentialPattern[];
|
|
42
|
+
//# sourceMappingURL=credential-patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-patterns.d.ts","sourceRoot":"","sources":["../../src/runtime/credential-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,mBAAmB,EAAE,SAAS,iBAAiB,EAwG3D,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,uBAAuB,IAAI,iBAAiB,EAAE,CAK7D"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
* output parsing) stays in the plugin that owns that language.
|
|
30
30
|
*/
|
|
31
31
|
export { parseLlmJsonObject, runOptionalPluginLlm, stripOuterMarkdownFence, type OptionalLlmRequest, type OptionalLlmResult, } from './llm.js';
|
|
32
|
+
export { BoundedMap, BoundedSet, type BoundedMapOptions } from './bounded-map.js';
|
|
33
|
+
export { UNSERIALIZABLE, safeJsonStringify } from './safe-json.js';
|
|
34
|
+
export { clearLocalBinCache, findOnPath, resolveExecInvocation, resolveFirstNodeBin, resolveNodeBin, resolveWin32Command, type ExecInvocation, type ResolvedNodeBin, } from './local-bin.js';
|
|
32
35
|
export type LanguageId = 'typescript' | 'javascript' | 'python' | 'go' | 'rust' | 'shell' | 'ruby' | 'java' | 'kotlin' | 'dotnet' | 'generic';
|
|
33
36
|
export type PackageManagerId = 'npm' | 'pnpm' | 'yarn' | 'bun' | 'pip' | 'poetry' | 'go' | 'cargo' | 'gem' | 'maven' | 'gradle' | 'dotnet' | 'none';
|
|
34
37
|
export interface LanguageRuntime {
|
|
@@ -126,6 +129,9 @@ export declare function probeRunner(runtime: LanguageRuntime, probeArg: string |
|
|
|
126
129
|
* This is the canonical sandbox check that every file-mutating or
|
|
127
130
|
* file-reading plugin should call before touching a path supplied
|
|
128
131
|
* by tool input. It replaces 27 identical copies across plugins.
|
|
132
|
+
*
|
|
133
|
+
* Performance: caches `process.cwd()` per call to avoid redundant
|
|
134
|
+
* syscalls when checking multiple paths in the same tick.
|
|
129
135
|
*/
|
|
130
136
|
export declare function withinProject(p: string): boolean;
|
|
131
137
|
/**
|
|
@@ -149,8 +155,20 @@ export interface CollectOptions {
|
|
|
149
155
|
*
|
|
150
156
|
* Shared by 6+ plugin source-scan tools that previously duplicated
|
|
151
157
|
* this implementation identically.
|
|
158
|
+
*
|
|
159
|
+
* Determinism: returns files in sorted order (locale-aware) so
|
|
160
|
+
* scan results are reproducible across platforms and file systems.
|
|
152
161
|
*/
|
|
153
162
|
export declare function collectSourceFiles(root: string, opts: CollectOptions): string[];
|
|
163
|
+
/**
|
|
164
|
+
* Async version of `collectSourceFiles` for non-blocking file collection.
|
|
165
|
+
* Uses `fs.promises` to avoid blocking the event loop on large directory trees.
|
|
166
|
+
*
|
|
167
|
+
* Performance: prefer this in hooks and tools that run on every write/edit
|
|
168
|
+
* (e.g., dead-code-detector, duplicate-code-detector) to keep the agent loop
|
|
169
|
+
* responsive during large scans.
|
|
170
|
+
*/
|
|
171
|
+
export declare function collectSourceFilesAsync(root: string, opts: CollectOptions): Promise<string[]>;
|
|
154
172
|
/**
|
|
155
173
|
* Check whether `p` has one of the given extensions (case-insensitive).
|
|
156
174
|
* 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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"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"}
|
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"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wrongstack/plugins — project-local binary resolution.
|
|
3
|
+
*
|
|
4
|
+
* Why this module exists
|
|
5
|
+
* ----------------------
|
|
6
|
+
* Several plugins need to run a Node CLI that ships with the project
|
|
7
|
+
* (`biome`, `eslint`, `tsc`, `vitest`, …). The obvious spelling —
|
|
8
|
+
* `execFile('npx', ['biome', …])` — is wrong in three separate ways:
|
|
9
|
+
*
|
|
10
|
+
* 1. **It does not run on Windows at all.** `npx`/`pnpm`/`npm` are
|
|
11
|
+
* `.cmd` shims there, and `execFile`/`spawn` without a shell do not
|
|
12
|
+
* consult `PATHEXT`. The call fails `ENOENT`, plugins swallow the
|
|
13
|
+
* error as "tool not installed", and the feature silently no-ops on
|
|
14
|
+
* every Windows machine.
|
|
15
|
+
* 2. **It is slow.** `npx` re-resolves the package on each invocation,
|
|
16
|
+
* and for a missing package it may try to *download* one — on a hook
|
|
17
|
+
* that fires after every write.
|
|
18
|
+
* 3. **It is a weaker sandbox.** The shim is a shell script; arguments
|
|
19
|
+
* cross a `cmd.exe` boundary on Windows (the BatBadBut class).
|
|
20
|
+
*
|
|
21
|
+
* `lint-gate` and `test-flake-detector` already solved this locally by
|
|
22
|
+
* resolving the package's `bin` entry through `createRequire` and running
|
|
23
|
+
* it as `process.execPath <entry>`. That is the correct pattern: no shell,
|
|
24
|
+
* no shim, no network, identical on every platform. This module promotes
|
|
25
|
+
* that proven approach to a shared helper so every plugin gets it.
|
|
26
|
+
*
|
|
27
|
+
* Fallback: when the package is genuinely absent from the project,
|
|
28
|
+
* `resolveNodeBin` returns `null` and the caller decides whether to
|
|
29
|
+
* degrade gracefully or fall back to a PATH lookup via
|
|
30
|
+
* `resolveWin32Command` (exported here for that purpose).
|
|
31
|
+
*/
|
|
32
|
+
import { resolveWin32Command } from '@wrongstack/tools/win32';
|
|
33
|
+
export { resolveWin32Command };
|
|
34
|
+
/** A spawn-ready invocation, already adjusted for the host platform. */
|
|
35
|
+
export interface ExecInvocation {
|
|
36
|
+
cmd: string;
|
|
37
|
+
args: string[];
|
|
38
|
+
/** Only ever true on the Windows `.cmd`/`.bat` shim path. */
|
|
39
|
+
windowsVerbatimArguments: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Turn a `(command, args)` pair into something `execFile`/`spawn` can
|
|
43
|
+
* actually launch on this platform.
|
|
44
|
+
*
|
|
45
|
+
* On Windows, `npx`/`npm`/`pnpm`/`biome`/`tsc`/… ship as `.cmd` wrappers.
|
|
46
|
+
* `execFile` and `spawn` without a shell ignore `PATHEXT`, so a bare
|
|
47
|
+
* `execFile('npx', …)` fails `ENOENT` — and because every plugin treats a
|
|
48
|
+
* spawn failure as "tool not installed", the feature silently no-ops on
|
|
49
|
+
* every Windows machine. This resolves the real path first and, for a
|
|
50
|
+
* `.cmd`/`.bat` shim, routes through `cmd.exe` with per-argument quoting
|
|
51
|
+
* and a metacharacter guard (the BatBadBut argument-injection class), so
|
|
52
|
+
* a dynamic path argument still cannot chain a second command.
|
|
53
|
+
*
|
|
54
|
+
* On non-Windows, and for real `.exe` binaries, this is a passthrough.
|
|
55
|
+
*
|
|
56
|
+
* Throws when an argument carries a `cmd.exe` metacharacter on the shim
|
|
57
|
+
* path — callers should treat that as "skip", never as "run anyway".
|
|
58
|
+
*
|
|
59
|
+
* Prefer {@link resolveNodeBin} when the target is a Node CLI that the
|
|
60
|
+
* project depends on: `node <bin-entry>` needs no shim at all.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveExecInvocation(command: string, args?: readonly string[]): ExecInvocation;
|
|
63
|
+
/**
|
|
64
|
+
* Locate `cmd` on `PATH`, or return `null` if it is not there.
|
|
65
|
+
*
|
|
66
|
+
* This is the existence check `resolveWin32Command` deliberately does not
|
|
67
|
+
* provide: that function returns its input unchanged when nothing matches,
|
|
68
|
+
* so a caller cannot distinguish "found `biome`" from "gave up and handed
|
|
69
|
+
* back the string `biome`". Treating the passthrough as success makes a
|
|
70
|
+
* missing tool look installed — the caller then spawns it, gets `ENOENT`,
|
|
71
|
+
* and (because plugins read a spawn failure as "not installed") silently
|
|
72
|
+
* does nothing while reporting itself healthy.
|
|
73
|
+
*
|
|
74
|
+
* Returns the resolved path on success. Walks `PATH` directly, applying
|
|
75
|
+
* `PATHEXT` suffixes on Windows for a bare name and checking the execute
|
|
76
|
+
* bit on POSIX.
|
|
77
|
+
*/
|
|
78
|
+
export declare function findOnPath(cmd: string): string | null;
|
|
79
|
+
/** A resolved, directly-spawnable invocation. Never a shell or a shim. */
|
|
80
|
+
export interface ResolvedNodeBin {
|
|
81
|
+
/** Always `process.execPath` — the Node binary running this process. */
|
|
82
|
+
cmd: string;
|
|
83
|
+
/** `[binEntryPath, ...extraArgs]`. */
|
|
84
|
+
args: string[];
|
|
85
|
+
/** Absolute path of the package's bin entry, for diagnostics. */
|
|
86
|
+
entry: string;
|
|
87
|
+
}
|
|
88
|
+
/** Drop every cached resolution. Call from `teardown()`. */
|
|
89
|
+
export declare function clearLocalBinCache(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Resolve a project-local Node CLI to a `process.execPath <entry>`
|
|
92
|
+
* invocation.
|
|
93
|
+
*
|
|
94
|
+
* @param packageName npm package to resolve, e.g. `@biomejs/biome`.
|
|
95
|
+
* @param binName which `bin` key to prefer when the package declares
|
|
96
|
+
* several. Falls back to the sole/first entry.
|
|
97
|
+
* @param cwd project root whose `package.json` anchors resolution.
|
|
98
|
+
* @param extraArgs arguments appended after the bin entry.
|
|
99
|
+
*
|
|
100
|
+
* Returns `null` when the package is not installed, declares no `bin`, or
|
|
101
|
+
* the declared entry escapes its own package directory (a tampered
|
|
102
|
+
* `package.json` must not become an arbitrary-file execution primitive).
|
|
103
|
+
*/
|
|
104
|
+
export declare function resolveNodeBin(packageName: string, binName: string, cwd: string, extraArgs?: readonly string[]): ResolvedNodeBin | null;
|
|
105
|
+
/**
|
|
106
|
+
* Resolve the first installed package from `candidates`.
|
|
107
|
+
*
|
|
108
|
+
* Used by plugins that accept several equivalent tools (biome *or*
|
|
109
|
+
* eslint, vitest *or* jest) and want the first one the project actually
|
|
110
|
+
* has, without probing each with a subprocess.
|
|
111
|
+
*/
|
|
112
|
+
export declare function resolveFirstNodeBin(candidates: readonly {
|
|
113
|
+
packageName: string;
|
|
114
|
+
binName: string;
|
|
115
|
+
args?: readonly string[];
|
|
116
|
+
}[], cwd: string): (ResolvedNodeBin & {
|
|
117
|
+
packageName: string;
|
|
118
|
+
binName: string;
|
|
119
|
+
}) | null;
|
|
120
|
+
//# sourceMappingURL=local-bin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-bin.d.ts","sourceRoot":"","sources":["../../src/runtime/local-bin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAKH,OAAO,EAA+B,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE3F,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,6DAA6D;IAC7D,wBAAwB,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,SAAS,MAAM,EAAO,GAC3B,cAAc,CAWhB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoCrD;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;CACf;AAqCD,4DAA4D;AAC5D,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,SAAS,GAAE,SAAS,MAAM,EAAO,GAChC,eAAe,GAAG,IAAI,CAwCxB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,SAAS;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,EACzF,GAAG,EAAE,MAAM,GACV,CAAC,eAAe,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,IAAI,CAMrE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wrongstack/plugins — serialisation that cannot take the process down.
|
|
3
|
+
*
|
|
4
|
+
* Plugins routinely stringify values they did not construct: event-bus
|
|
5
|
+
* payloads, tool results, mailbox bodies. `JSON.stringify` throws on a
|
|
6
|
+
* circular reference and on `BigInt`, and several of these call sites sit
|
|
7
|
+
* inside detached (fire-and-forget) work where a throw becomes an
|
|
8
|
+
* unhandled rejection rather than a handled failure.
|
|
9
|
+
*
|
|
10
|
+
* `safeJsonStringify` never throws. A value it cannot represent is
|
|
11
|
+
* replaced with a marker, so the surrounding feature degrades to "this
|
|
12
|
+
* field is unreadable" instead of failing — or crashing — outright.
|
|
13
|
+
*/
|
|
14
|
+
/** Placeholder substituted for a value that cannot be serialised. */
|
|
15
|
+
export declare const UNSERIALIZABLE = "[unserializable]";
|
|
16
|
+
/**
|
|
17
|
+
* `JSON.stringify` with cycle handling and a total-failure fallback.
|
|
18
|
+
*
|
|
19
|
+
* @param value anything
|
|
20
|
+
* @param indent passed through to `JSON.stringify` (e.g. `2` to pretty-print)
|
|
21
|
+
* @returns a JSON string, or a marker string when the value resists
|
|
22
|
+
* serialisation entirely. Never throws.
|
|
23
|
+
*/
|
|
24
|
+
export declare function safeJsonStringify(value: unknown, indent?: number): string;
|
|
25
|
+
//# sourceMappingURL=safe-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-json.d.ts","sourceRoot":"","sources":["../../src/runtime/safe-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,qEAAqE;AACrE,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAyBzE"}
|