@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,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commit-message-validator plugin — PreToolUse hook that validates
|
|
3
|
+
* conventional-commit format on `git_autocommit` and `bash` (git commit)
|
|
4
|
+
* before the commit is created.
|
|
5
|
+
*
|
|
6
|
+
* Tools registered:
|
|
7
|
+
* - commit_validator_status : Show config + per-session counters.
|
|
8
|
+
*
|
|
9
|
+
* Hooks registered:
|
|
10
|
+
* - PreToolUse with matcher `bash|git_autocommit`. Inspects the
|
|
11
|
+
* commit message (from toolInput.message for git_autocommit, or
|
|
12
|
+
* parsed from `-m` flag for bash git commit). If the message does
|
|
13
|
+
* not match the conventional-commit format, the call is blocked.
|
|
14
|
+
*
|
|
15
|
+
* Config (`config.extensions['commit-validator']`):
|
|
16
|
+
*
|
|
17
|
+
* ```jsonc
|
|
18
|
+
* {
|
|
19
|
+
* "mode": "block", // "block" | "warn"
|
|
20
|
+
* "requireScope": false, // require a scope in parentheses
|
|
21
|
+
* "allowedTypes": [], // empty = all types allowed; or ["feat","fix","docs",...]
|
|
22
|
+
* "maxSubjectLength": 72 // subject line character limit
|
|
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/commit-validator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAsP/C,QAAA,MAAM,MAAM,EAAE,MAgSb,CAAC;eAEa,MAAM"}
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* commit-message-validator plugin — PreToolUse hook that validates
|
|
5
|
-
* conventional-commit format on `git_autocommit` and `bash` (git commit)
|
|
6
|
-
* before the commit is created.
|
|
7
|
-
*
|
|
8
|
-
* Tools registered:
|
|
9
|
-
* - commit_validator_status : Show config + per-session counters.
|
|
10
|
-
*
|
|
11
|
-
* Hooks registered:
|
|
12
|
-
* - PreToolUse with matcher `bash|git_autocommit`. Inspects the
|
|
13
|
-
* commit message (from toolInput.message for git_autocommit, or
|
|
14
|
-
* parsed from `-m` flag for bash git commit). If the message does
|
|
15
|
-
* not match the conventional-commit format, the call is blocked.
|
|
16
|
-
*
|
|
17
|
-
* Config (`config.extensions['commit-validator']`):
|
|
18
|
-
*
|
|
19
|
-
* ```jsonc
|
|
20
|
-
* {
|
|
21
|
-
* "mode": "block", // "block" | "warn"
|
|
22
|
-
* "requireScope": false, // require a scope in parentheses
|
|
23
|
-
* "allowedTypes": [], // empty = all types allowed; or ["feat","fix","docs",...]
|
|
24
|
-
* "maxSubjectLength": 72 // subject line character limit
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
declare const plugin: Plugin;
|
|
32
|
-
|
|
33
|
-
export { plugin as default };
|
|
1
|
+
export * from './commit-validator/index.js';
|
|
2
|
+
export { default } from './commit-validator/index.js';
|
package/dist/commit-validator.js
CHANGED
|
@@ -77,7 +77,8 @@ function parseCommitMessage(message, cfg) {
|
|
|
77
77
|
errors.push(
|
|
78
78
|
`Type "${type}" is not in allowedTypes: ${cfg.allowedTypes.join(", ")}. Standard types: ${STANDARD_TYPES.join(", ")}.`
|
|
79
79
|
);
|
|
80
|
-
} else if (cfg.allowedTypes.length === 0 && !STANDARD_TYPES.includes(type))
|
|
80
|
+
} else if (cfg.allowedTypes.length === 0 && !STANDARD_TYPES.includes(type)) {
|
|
81
|
+
}
|
|
81
82
|
if (cfg.requireScope && !scope) {
|
|
82
83
|
errors.push("A scope is required (e.g. feat(auth): ...).");
|
|
83
84
|
}
|
|
@@ -371,5 +372,6 @@ Suggested rewrite (${suggest.model}):
|
|
|
371
372
|
}
|
|
372
373
|
};
|
|
373
374
|
var commit_validator_default = plugin;
|
|
374
|
-
|
|
375
|
-
|
|
375
|
+
export {
|
|
376
|
+
commit_validator_default as default
|
|
377
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* config-validator plugin — instant syntax feedback after config-file
|
|
3
|
+
* writes.
|
|
4
|
+
*
|
|
5
|
+
* A broken `package.json` or malformed YAML often goes unnoticed
|
|
6
|
+
* until a later build fails with an unrelated-looking error. This
|
|
7
|
+
* plugin validates config files immediately: a `PostToolUse` hook on
|
|
8
|
+
* `write|edit` re-reads the target file from disk (what actually
|
|
9
|
+
* landed, not what the tool intended) and reports problems via
|
|
10
|
+
* `additionalContext` in the same turn:
|
|
11
|
+
*
|
|
12
|
+
* - `.json` / `.jsonc` → strict parse (JSONC comments stripped
|
|
13
|
+
* first); parse errors include the line/column
|
|
14
|
+
* - `package.json` → parse + shape checks (name/version
|
|
15
|
+
* present, `dependencies` is an object)
|
|
16
|
+
* - `.yaml` / `.yml` → structural lint: tab indentation
|
|
17
|
+
* (illegal in YAML), duplicate keys at the same indent within a
|
|
18
|
+
* block, unclosed quotes
|
|
19
|
+
* - `.toml` → duplicate table headers, duplicate
|
|
20
|
+
* keys within a table
|
|
21
|
+
*
|
|
22
|
+
* Valid files produce no output — zero noise on the happy path.
|
|
23
|
+
*
|
|
24
|
+
* Config (`config.extensions['config-validator']`):
|
|
25
|
+
*
|
|
26
|
+
* ```jsonc
|
|
27
|
+
* {
|
|
28
|
+
* "enabled": true,
|
|
29
|
+
* "extensions": [".json", ".jsonc", ".yaml", ".yml", ".toml"],
|
|
30
|
+
* "maxFileBytes": 1048576
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* Toggle off with `{ "name": "config-validator", "enabled": false }`
|
|
35
|
+
* in `config.plugins`, or `"enabled": false` in the options above.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
import type { Plugin } from '@wrongstack/core';
|
|
40
|
+
export declare function validateJson(text: string, isJsonc: boolean, fileName: string): string[];
|
|
41
|
+
export declare function validateYaml(text: string): string[];
|
|
42
|
+
export declare function validateToml(text: string): string[];
|
|
43
|
+
export declare function validateFile(path: string, text: string): string[];
|
|
44
|
+
declare const plugin: Plugin;
|
|
45
|
+
export default plugin;
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config-validator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA0H/C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CA2CvF;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAuDnD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAuCnD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAOjE;AAMD,QAAA,MAAM,MAAM,EAAE,MAqJb,CAAC;eAEa,MAAM"}
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* config-validator plugin — instant syntax feedback after config-file
|
|
5
|
-
* writes.
|
|
6
|
-
*
|
|
7
|
-
* A broken `package.json` or malformed YAML often goes unnoticed
|
|
8
|
-
* until a later build fails with an unrelated-looking error. This
|
|
9
|
-
* plugin validates config files immediately: a `PostToolUse` hook on
|
|
10
|
-
* `write|edit` re-reads the target file from disk (what actually
|
|
11
|
-
* landed, not what the tool intended) and reports problems via
|
|
12
|
-
* `additionalContext` in the same turn:
|
|
13
|
-
*
|
|
14
|
-
* - `.json` / `.jsonc` → strict parse (JSONC comments stripped
|
|
15
|
-
* first); parse errors include the line/column
|
|
16
|
-
* - `package.json` → parse + shape checks (name/version
|
|
17
|
-
* present, `dependencies` is an object)
|
|
18
|
-
* - `.yaml` / `.yml` → structural lint: tab indentation
|
|
19
|
-
* (illegal in YAML), duplicate keys at the same indent within a
|
|
20
|
-
* block, unclosed quotes
|
|
21
|
-
* - `.toml` → duplicate table headers, duplicate
|
|
22
|
-
* keys within a table
|
|
23
|
-
*
|
|
24
|
-
* Valid files produce no output — zero noise on the happy path.
|
|
25
|
-
*
|
|
26
|
-
* Config (`config.extensions['config-validator']`):
|
|
27
|
-
*
|
|
28
|
-
* ```jsonc
|
|
29
|
-
* {
|
|
30
|
-
* "enabled": true,
|
|
31
|
-
* "extensions": [".json", ".jsonc", ".yaml", ".yml", ".toml"],
|
|
32
|
-
* "maxFileBytes": 1048576
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* Toggle off with `{ "name": "config-validator", "enabled": false }`
|
|
37
|
-
* in `config.plugins`, or `"enabled": false` in the options above.
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
declare function validateJson(text: string, isJsonc: boolean, fileName: string): string[];
|
|
43
|
-
declare function validateYaml(text: string): string[];
|
|
44
|
-
declare function validateToml(text: string): string[];
|
|
45
|
-
declare function validateFile(path: string, text: string): string[];
|
|
46
|
-
declare const plugin: Plugin;
|
|
47
|
-
|
|
48
|
-
export { plugin as default, validateFile, validateJson, validateToml, validateYaml };
|
|
1
|
+
export * from './config-validator/index.js';
|
|
2
|
+
export { default } from './config-validator/index.js';
|
package/dist/config-validator.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { statSync, readFileSync } from 'fs';
|
|
2
|
-
|
|
3
1
|
// src/config-validator/index.ts
|
|
2
|
+
import { readFileSync, statSync } from "node:fs";
|
|
4
3
|
var state = {
|
|
5
4
|
invocations: 0,
|
|
6
5
|
filesChecked: 0,
|
|
@@ -343,5 +342,10 @@ var plugin = {
|
|
|
343
342
|
}
|
|
344
343
|
};
|
|
345
344
|
var config_validator_default = plugin;
|
|
346
|
-
|
|
347
|
-
|
|
345
|
+
export {
|
|
346
|
+
config_validator_default as default,
|
|
347
|
+
validateFile,
|
|
348
|
+
validateJson,
|
|
349
|
+
validateToml,
|
|
350
|
+
validateYaml
|
|
351
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* context-pins plugin — pin durable facts into the system prompt.
|
|
3
|
+
*
|
|
4
|
+
* Long sessions lose important constraints to compaction ("the API
|
|
5
|
+
* base URL is X", "never touch the legacy folder", "the user prefers
|
|
6
|
+
* Turkish"). This plugin gives the agent (and the user) three tools:
|
|
7
|
+
*
|
|
8
|
+
* - `pin_add` — pin a short fact (optionally with a label)
|
|
9
|
+
* - `pin_remove` — remove a pin by id or label
|
|
10
|
+
* - `pin_list` — list all pins
|
|
11
|
+
*
|
|
12
|
+
* Every pinned fact is injected into the system prompt on every
|
|
13
|
+
* request via a `SystemPromptContributor`, so pins survive context
|
|
14
|
+
* compaction by construction. Pins persist across sessions in a JSON
|
|
15
|
+
* file (default: `<projectDir>/context-pins.json`, seeded by the CLI
|
|
16
|
+
* host the same way `todo-tracker` gets its path).
|
|
17
|
+
*
|
|
18
|
+
* Config (`config.extensions['context-pins']`):
|
|
19
|
+
*
|
|
20
|
+
* ```jsonc
|
|
21
|
+
* {
|
|
22
|
+
* "enabled": true,
|
|
23
|
+
* "filePath": "", // where pins persist; empty = in-memory only
|
|
24
|
+
* "maxPins": 20, // hard cap so the prompt block stays small
|
|
25
|
+
* "maxPinChars": 500 // per-pin length cap
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Toggle off with `{ "name": "context-pins", "enabled": false }` in
|
|
30
|
+
* `config.plugins`, or `"enabled": false` in the options above.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
import type { Plugin } from '@wrongstack/core';
|
|
35
|
+
export interface Pin {
|
|
36
|
+
id: string;
|
|
37
|
+
label: string | null;
|
|
38
|
+
text: string;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
}
|
|
41
|
+
declare const plugin: Plugin;
|
|
42
|
+
export default plugin;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context-pins/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAM/C,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AA8GD,QAAA,MAAM,MAAM,EAAE,MA8Mb,CAAC;eAEa,MAAM"}
|
package/dist/context-pins.d.ts
CHANGED
|
@@ -1,45 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* context-pins plugin — pin durable facts into the system prompt.
|
|
5
|
-
*
|
|
6
|
-
* Long sessions lose important constraints to compaction ("the API
|
|
7
|
-
* base URL is X", "never touch the legacy folder", "the user prefers
|
|
8
|
-
* Turkish"). This plugin gives the agent (and the user) three tools:
|
|
9
|
-
*
|
|
10
|
-
* - `pin_add` — pin a short fact (optionally with a label)
|
|
11
|
-
* - `pin_remove` — remove a pin by id or label
|
|
12
|
-
* - `pin_list` — list all pins
|
|
13
|
-
*
|
|
14
|
-
* Every pinned fact is injected into the system prompt on every
|
|
15
|
-
* request via a `SystemPromptContributor`, so pins survive context
|
|
16
|
-
* compaction by construction. Pins persist across sessions in a JSON
|
|
17
|
-
* file (default: `<projectDir>/context-pins.json`, seeded by the CLI
|
|
18
|
-
* host the same way `todo-tracker` gets its path).
|
|
19
|
-
*
|
|
20
|
-
* Config (`config.extensions['context-pins']`):
|
|
21
|
-
*
|
|
22
|
-
* ```jsonc
|
|
23
|
-
* {
|
|
24
|
-
* "enabled": true,
|
|
25
|
-
* "filePath": "", // where pins persist; empty = in-memory only
|
|
26
|
-
* "maxPins": 20, // hard cap so the prompt block stays small
|
|
27
|
-
* "maxPinChars": 500 // per-pin length cap
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* Toggle off with `{ "name": "context-pins", "enabled": false }` in
|
|
32
|
-
* `config.plugins`, or `"enabled": false` in the options above.
|
|
33
|
-
*
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
interface Pin {
|
|
38
|
-
id: string;
|
|
39
|
-
label: string | null;
|
|
40
|
-
text: string;
|
|
41
|
-
createdAt: string;
|
|
42
|
-
}
|
|
43
|
-
declare const plugin: Plugin;
|
|
44
|
-
|
|
45
|
-
export { type Pin, plugin as default };
|
|
1
|
+
export * from './context-pins/index.js';
|
|
2
|
+
export { default } from './context-pins/index.js';
|
package/dist/context-pins.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import { dirname, resolve, isAbsolute, relative } from 'path';
|
|
3
|
-
|
|
4
1
|
// src/context-pins/index.ts
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
5
4
|
var state = {
|
|
6
5
|
pins: [],
|
|
7
6
|
nextId: 1,
|
|
@@ -245,5 +244,6 @@ var plugin = {
|
|
|
245
244
|
}
|
|
246
245
|
};
|
|
247
246
|
var context_pins_default = plugin;
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
export {
|
|
248
|
+
context_pins_default as default
|
|
249
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cost-tracker plugin — Tracks LLM token usage and cost per session.
|
|
3
|
+
*
|
|
4
|
+
* Config surface (`config.extensions['cost-tracker']`):
|
|
5
|
+
*
|
|
6
|
+
* ```jsonc
|
|
7
|
+
* {
|
|
8
|
+
* "budgetLimit": 10, // USD; 0 = no limit
|
|
9
|
+
* "warningThreshold": 80, // percent of budget before warning
|
|
10
|
+
* "pricingOverrides": { // user-supplied per-model rates (USD/1M tokens)
|
|
11
|
+
* "gpt-4o": { "input": 5.0, "output": 15.0 },
|
|
12
|
+
* "custom-model": { "input": 3.0, "output": 15.0 }
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Pricing lookup chain (first match wins, all keys lowercased):
|
|
18
|
+
*
|
|
19
|
+
* | Priority | Source | Populated by |
|
|
20
|
+
* |----------|-------------------------------------|--------------------------------------|
|
|
21
|
+
* | 1 | `pricingOverrides[model]` | User config (highest priority) |
|
|
22
|
+
* | 2 | `bundledFromRegistry[model]` | `api.modelsRegistry` (models.dev) |
|
|
23
|
+
* | 3 | `PRICING[model]` | Bundled baseline (updated per release)|
|
|
24
|
+
* | 4 | `DEFAULT_PRICING` | Last-resort fallback for unknown models |
|
|
25
|
+
*
|
|
26
|
+
* Tools registered:
|
|
27
|
+
* - cost_summary: Show token usage breakdown by model
|
|
28
|
+
* - cost_reset: Reset tracking counters
|
|
29
|
+
* - cost_export: Export cost report as JSON or CSV
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
import type { Plugin } from '@wrongstack/core';
|
|
34
|
+
/**
|
|
35
|
+
* Per-model pricing in USD per 1 million tokens.
|
|
36
|
+
*
|
|
37
|
+
* Used by `pricingOverrides` (user config), `bundledFromRegistry`
|
|
38
|
+
* (models.dev), and the bundled `PRICING` table. All three share
|
|
39
|
+
* the same shape so the lookup chain can fall through uniformly.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
export interface ModelPricing {
|
|
44
|
+
/** Cost per 1M input (prompt) tokens in USD. */
|
|
45
|
+
input: number;
|
|
46
|
+
/** Cost per 1M output (completion) tokens in USD. */
|
|
47
|
+
output: number;
|
|
48
|
+
}
|
|
49
|
+
declare const plugin: Plugin;
|
|
50
|
+
export default plugin;
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cost-tracker/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAK/C;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;CAChB;AA8KD,QAAA,MAAM,MAAM,EAAE,MA8Zb,CAAC;eAEa,MAAM"}
|
package/dist/cost-tracker.d.ts
CHANGED
|
@@ -1,53 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* cost-tracker plugin — Tracks LLM token usage and cost per session.
|
|
5
|
-
*
|
|
6
|
-
* Config surface (`config.extensions['cost-tracker']`):
|
|
7
|
-
*
|
|
8
|
-
* ```jsonc
|
|
9
|
-
* {
|
|
10
|
-
* "budgetLimit": 10, // USD; 0 = no limit
|
|
11
|
-
* "warningThreshold": 80, // percent of budget before warning
|
|
12
|
-
* "pricingOverrides": { // user-supplied per-model rates (USD/1M tokens)
|
|
13
|
-
* "gpt-4o": { "input": 5.0, "output": 15.0 },
|
|
14
|
-
* "custom-model": { "input": 3.0, "output": 15.0 }
|
|
15
|
-
* }
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* Pricing lookup chain (first match wins, all keys lowercased):
|
|
20
|
-
*
|
|
21
|
-
* | Priority | Source | Populated by |
|
|
22
|
-
* |----------|-------------------------------------|--------------------------------------|
|
|
23
|
-
* | 1 | `pricingOverrides[model]` | User config (highest priority) |
|
|
24
|
-
* | 2 | `bundledFromRegistry[model]` | `api.modelsRegistry` (models.dev) |
|
|
25
|
-
* | 3 | `PRICING[model]` | Bundled baseline (updated per release)|
|
|
26
|
-
* | 4 | `DEFAULT_PRICING` | Last-resort fallback for unknown models |
|
|
27
|
-
*
|
|
28
|
-
* Tools registered:
|
|
29
|
-
* - cost_summary: Show token usage breakdown by model
|
|
30
|
-
* - cost_reset: Reset tracking counters
|
|
31
|
-
* - cost_export: Export cost report as JSON or CSV
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Per-model pricing in USD per 1 million tokens.
|
|
38
|
-
*
|
|
39
|
-
* Used by `pricingOverrides` (user config), `bundledFromRegistry`
|
|
40
|
-
* (models.dev), and the bundled `PRICING` table. All three share
|
|
41
|
-
* the same shape so the lookup chain can fall through uniformly.
|
|
42
|
-
*
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
interface ModelPricing {
|
|
46
|
-
/** Cost per 1M input (prompt) tokens in USD. */
|
|
47
|
-
input: number;
|
|
48
|
-
/** Cost per 1M output (completion) tokens in USD. */
|
|
49
|
-
output: number;
|
|
50
|
-
}
|
|
51
|
-
declare const plugin: Plugin;
|
|
52
|
-
|
|
53
|
-
export { type ModelPricing, plugin as default };
|
|
1
|
+
export * from './cost-tracker/index.js';
|
|
2
|
+
export { default } from './cost-tracker/index.js';
|
package/dist/cost-tracker.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { expectDefined } from '@wrongstack/core';
|
|
2
|
-
|
|
3
1
|
// src/cost-tracker/index.ts
|
|
2
|
+
import { expectDefined } from "@wrongstack/core";
|
|
4
3
|
var API_VERSION = "^0.1.10";
|
|
5
4
|
var PRICING = {
|
|
6
5
|
"gpt-4o": { input: 5, output: 15 },
|
|
@@ -359,5 +358,6 @@ by model: ${top || "(none)"}`
|
|
|
359
358
|
}
|
|
360
359
|
};
|
|
361
360
|
var cost_tracker_default = plugin;
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
export {
|
|
362
|
+
cost_tracker_default as default
|
|
363
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cron plugin — Schedules recurring tasks via beforeIteration extension hooks.
|
|
3
|
+
*
|
|
4
|
+
* Tools registered:
|
|
5
|
+
* - cron_schedule: Schedule a recurring action
|
|
6
|
+
* - cron_list: List all scheduled jobs
|
|
7
|
+
* - cron_cancel: Cancel a scheduled job
|
|
8
|
+
*/
|
|
9
|
+
import type { Plugin } from '@wrongstack/core';
|
|
10
|
+
declare const plugin: Plugin;
|
|
11
|
+
export default plugin;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cron/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAoE/C,QAAA,MAAM,MAAM,EAAE,MA2Pb,CAAC;eAEa,MAAM"}
|
package/dist/cron.d.ts
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* cron plugin — Schedules recurring tasks via beforeIteration extension hooks.
|
|
5
|
-
*
|
|
6
|
-
* Tools registered:
|
|
7
|
-
* - cron_schedule: Schedule a recurring action
|
|
8
|
-
* - cron_list: List all scheduled jobs
|
|
9
|
-
* - cron_cancel: Cancel a scheduled job
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
declare const plugin: Plugin;
|
|
13
|
-
|
|
14
|
-
export { plugin as default };
|
|
1
|
+
export * from './cron/index.js';
|
|
2
|
+
export { default } from './cron/index.js';
|
package/dist/cron.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dead-code-detector plugin — lightweight regex-based scan for exported
|
|
3
|
+
* identifiers that appear unused anywhere in the project.
|
|
4
|
+
*
|
|
5
|
+
* The plugin registers one tool:
|
|
6
|
+
* - `dead_code_scan` — scan a path for suspicious exported symbols.
|
|
7
|
+
*
|
|
8
|
+
* And one hook:
|
|
9
|
+
* - `PostToolUse` matcher `write|edit` — auto-scan changed source files and
|
|
10
|
+
* inject a short warning when newly exported symbols look unused.
|
|
11
|
+
*
|
|
12
|
+
* No external AST parser is used; all detection is regex-based and
|
|
13
|
+
* deterministic. Expect false positives on re-exports, public API surface,
|
|
14
|
+
* and test-only exports.
|
|
15
|
+
*
|
|
16
|
+
* Config (`config.extensions['dead-code-detector']`):
|
|
17
|
+
*
|
|
18
|
+
* ```jsonc
|
|
19
|
+
* {
|
|
20
|
+
* "enabled": true,
|
|
21
|
+
* "extensions": [".ts", ".tsx", ".js", ".jsx"],
|
|
22
|
+
* "defaultDepth": 3,
|
|
23
|
+
* "excludeDirs": ["node_modules", "dist", ".git", "coverage"]
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
import type { Plugin } from '@wrongstack/core';
|
|
30
|
+
declare const plugin: Plugin;
|
|
31
|
+
export default plugin;
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dead-code-detector/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAyQ/C,QAAA,MAAM,MAAM,EAAE,MAkOb,CAAC;eAEa,MAAM"}
|
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* dead-code-detector plugin — lightweight regex-based scan for exported
|
|
5
|
-
* identifiers that appear unused anywhere in the project.
|
|
6
|
-
*
|
|
7
|
-
* The plugin registers one tool:
|
|
8
|
-
* - `dead_code_scan` — scan a path for suspicious exported symbols.
|
|
9
|
-
*
|
|
10
|
-
* And one hook:
|
|
11
|
-
* - `PostToolUse` matcher `write|edit` — auto-scan changed source files and
|
|
12
|
-
* inject a short warning when newly exported symbols look unused.
|
|
13
|
-
*
|
|
14
|
-
* No external AST parser is used; all detection is regex-based and
|
|
15
|
-
* deterministic. Expect false positives on re-exports, public API surface,
|
|
16
|
-
* and test-only exports.
|
|
17
|
-
*
|
|
18
|
-
* Config (`config.extensions['dead-code-detector']`):
|
|
19
|
-
*
|
|
20
|
-
* ```jsonc
|
|
21
|
-
* {
|
|
22
|
-
* "enabled": true,
|
|
23
|
-
* "extensions": [".ts", ".tsx", ".js", ".jsx"],
|
|
24
|
-
* "defaultDepth": 3,
|
|
25
|
-
* "excludeDirs": ["node_modules", "dist", ".git", "coverage"]
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
declare const plugin: Plugin;
|
|
33
|
-
|
|
34
|
-
export { plugin as default };
|
|
1
|
+
export * from './dead-code-detector/index.js';
|
|
2
|
+
export { default } from './dead-code-detector/index.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { statSync, readFileSync, readdirSync } from 'fs';
|
|
2
|
-
import { resolve, isAbsolute, relative, join, extname } from 'path';
|
|
3
|
-
|
|
4
1
|
// src/dead-code-detector/index.ts
|
|
2
|
+
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
5
4
|
var API_VERSION = "^0.1.10";
|
|
6
5
|
var state = {
|
|
7
6
|
scanCount: 0,
|
|
@@ -74,9 +73,8 @@ var DECLARATION_EXPORT_RE = /export\s+(?:async\s+|abstract\s+)?(?:const|let|var|
|
|
|
74
73
|
var NAMED_EXPORT_RE = /export\s*\{([^}]+)\}/g;
|
|
75
74
|
function extractExports(content, filePath) {
|
|
76
75
|
const exports = [];
|
|
77
|
-
let match;
|
|
78
76
|
DECLARATION_EXPORT_RE.lastIndex = 0;
|
|
79
|
-
|
|
77
|
+
for (const match of content.matchAll(DECLARATION_EXPORT_RE)) {
|
|
80
78
|
exports.push({
|
|
81
79
|
identifier: match[1],
|
|
82
80
|
file: filePath,
|
|
@@ -85,7 +83,7 @@ function extractExports(content, filePath) {
|
|
|
85
83
|
});
|
|
86
84
|
}
|
|
87
85
|
NAMED_EXPORT_RE.lastIndex = 0;
|
|
88
|
-
|
|
86
|
+
for (const match of content.matchAll(NAMED_EXPORT_RE)) {
|
|
89
87
|
const line = lineNumber(content, match.index);
|
|
90
88
|
const names = match[1].split(",").map((s) => s.trim()).filter(Boolean);
|
|
91
89
|
for (const name of names) {
|
|
@@ -228,7 +226,7 @@ var plugin = {
|
|
|
228
226
|
let result;
|
|
229
227
|
try {
|
|
230
228
|
result = scan(scanRoot, 1, cfg);
|
|
231
|
-
} catch
|
|
229
|
+
} catch {
|
|
232
230
|
state.errorCount += 1;
|
|
233
231
|
return;
|
|
234
232
|
}
|
|
@@ -350,5 +348,6 @@ Consider removing the export if it is not part of the public API.`;
|
|
|
350
348
|
}
|
|
351
349
|
};
|
|
352
350
|
var dead_code_detector_default = plugin;
|
|
353
|
-
|
|
354
|
-
|
|
351
|
+
export {
|
|
352
|
+
dead_code_detector_default as default
|
|
353
|
+
};
|