@wrongstack/plugins 0.286.0 → 0.289.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.
Files changed (74) hide show
  1. package/README.md +20 -11
  2. package/dist/accessibility-auditor/index.d.ts.map +1 -1
  3. package/dist/accessibility-auditor.js +67 -55
  4. package/dist/api-compatibility-gate.js +1 -1
  5. package/dist/auto-doc.js +1 -1
  6. package/dist/auto-i18n-extractor/index.d.ts.map +1 -1
  7. package/dist/auto-i18n-extractor.js +20 -12
  8. package/dist/changelog-writer.js +1 -1
  9. package/dist/code-metrics/index.d.ts.map +1 -1
  10. package/dist/code-metrics.js +63 -50
  11. package/dist/commit-validator.js +1 -1
  12. package/dist/config-validator.js +1 -1
  13. package/dist/cost-tracker/index.d.ts.map +1 -1
  14. package/dist/cost-tracker.js +4 -2
  15. package/dist/cron/index.d.ts.map +1 -1
  16. package/dist/cron.js +29 -0
  17. package/dist/dead-code-detector/index.d.ts.map +1 -1
  18. package/dist/dead-code-detector.js +28 -19
  19. package/dist/dep-guard.js +1 -1
  20. package/dist/diff-summary/index.d.ts.map +1 -1
  21. package/dist/diff-summary.js +19 -11
  22. package/dist/doc-sync-guard/index.d.ts.map +1 -1
  23. package/dist/doc-sync-guard.js +25 -16
  24. package/dist/duplicate-code-detector/index.d.ts.map +1 -1
  25. package/dist/duplicate-code-detector.js +70 -57
  26. package/dist/error-lens.js +1 -1
  27. package/dist/feature-flag-tracker/index.d.ts.map +1 -1
  28. package/dist/feature-flag-tracker.js +69 -56
  29. package/dist/file-watcher/index.d.ts.map +1 -1
  30. package/dist/file-watcher.js +21 -4
  31. package/dist/format-on-save/index.d.ts.map +1 -1
  32. package/dist/format-on-save.js +19 -11
  33. package/dist/git-autocommit.js +1 -1
  34. package/dist/import-organizer/index.d.ts.map +1 -1
  35. package/dist/import-organizer.js +23 -14
  36. package/dist/index.d.ts +4 -4
  37. package/dist/index.js +1167 -1048
  38. package/dist/interface-contract-guard/index.d.ts.map +1 -1
  39. package/dist/interface-contract-guard.js +64 -51
  40. package/dist/lint-gate/index.d.ts.map +1 -1
  41. package/dist/lint-gate.js +61 -30
  42. package/dist/migration-planner/index.d.ts +12 -2
  43. package/dist/migration-planner/index.d.ts.map +1 -1
  44. package/dist/migration-planner.js +210 -28
  45. package/dist/pr-drafter.js +1 -1
  46. package/dist/prompt-firewall/index.d.ts +14 -6
  47. package/dist/prompt-firewall/index.d.ts.map +1 -1
  48. package/dist/prompt-firewall.js +7 -6
  49. package/dist/refactor-suggester/index.d.ts.map +1 -1
  50. package/dist/refactor-suggester.js +69 -56
  51. package/dist/release-notes-generator/index.d.ts +3 -1
  52. package/dist/release-notes-generator/index.d.ts.map +1 -1
  53. package/dist/release-notes-generator.js +152 -12
  54. package/dist/runtime/index.d.ts +36 -0
  55. package/dist/runtime/index.d.ts.map +1 -1
  56. package/dist/runtime/llm.d.ts +33 -0
  57. package/dist/runtime/llm.d.ts.map +1 -0
  58. package/dist/runtime.js +119 -25
  59. package/dist/schema-evolution-guard/index.d.ts.map +1 -1
  60. package/dist/schema-evolution-guard.js +22 -13
  61. package/dist/secret-scanner/index.d.ts.map +1 -1
  62. package/dist/secret-scanner.js +17 -6
  63. package/dist/security-hotspot-scanner/index.d.ts.map +1 -1
  64. package/dist/security-hotspot-scanner.js +24 -15
  65. package/dist/session-recap.js +1 -1
  66. package/dist/spec-linker.js +1167 -1048
  67. package/dist/test-generator/index.d.ts +5 -3
  68. package/dist/test-generator/index.d.ts.map +1 -1
  69. package/dist/test-generator.js +169 -26
  70. package/dist/test-runner-gate/index.d.ts.map +1 -1
  71. package/dist/test-runner-gate.js +65 -43
  72. package/dist/type-gate/index.d.ts.map +1 -1
  73. package/dist/type-gate.js +23 -35
  74. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  // src/file-watcher/index.ts
2
2
  import { watch as fsWatch } from "node:fs";
3
- import { isAbsolute, relative, resolve } from "node:path";
3
+ import { isAbsolute, join, relative, resolve } from "node:path";
4
4
  var API_VERSION = "^0.1.10";
5
5
  function withinProject(p) {
6
6
  if (typeof p !== "string" || p.length === 0 || p.length > 4096) return false;
@@ -109,7 +109,11 @@ var plugin = {
109
109
  try {
110
110
  const watcher = fsWatch(dirPath, { recursive }, (eventType, filename) => {
111
111
  if (!filename) return;
112
- const fullPath = `${dirPath}/${filename}`;
112
+ if (handle.events.length > 0 && !(eventType === "change" ? handle.events.includes("change") : handle.events.includes("add") || handle.events.includes("delete"))) {
113
+ return;
114
+ }
115
+ const rawPath = filename.startsWith(dirPath) ? filename : join(dirPath, filename);
116
+ const fullPath = rawPath.replace(/\\/g, "/");
113
117
  const key = `${handle.id}:${fullPath}:${eventType}`;
114
118
  debounceEvent(
115
119
  key,
@@ -294,6 +298,7 @@ var plugin = {
294
298
  api.log.info("file-watcher plugin loaded", { version: "0.1.0" });
295
299
  },
296
300
  teardown(api) {
301
+ const closed = watches.size;
297
302
  for (const handle of watches.values()) {
298
303
  for (const w of handle.watchers) {
299
304
  try {
@@ -306,9 +311,21 @@ var plugin = {
306
311
  for (const t of debounceTimers.values()) clearTimeout(t);
307
312
  debounceTimers.clear();
308
313
  api.log.info("file-watcher: teardown complete", {
309
- closed: 0
310
- // recorded for log symmetry; actual count cleared above
314
+ closed
311
315
  });
316
+ },
317
+ async health() {
318
+ const watcherCount = Array.from(watches.values()).reduce(
319
+ (sum, handle) => sum + handle.watchers.length,
320
+ 0
321
+ );
322
+ return {
323
+ ok: true,
324
+ message: `file-watcher: ${watches.size} active watch group(s), ${watcherCount} filesystem watcher(s)`,
325
+ activeWatchGroups: watches.size,
326
+ filesystemWatchers: watcherCount,
327
+ pendingDebounces: debounceTimers.size
328
+ };
312
329
  }
313
330
  };
314
331
  var file_watcher_default = plugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format-on-save/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAmO/C,QAAA,MAAM,MAAM,EAAE,MA2Ob,CAAC;eAEa,MAAM"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format-on-save/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA2N/C,QAAA,MAAM,MAAM,EAAE,MA2Ob,CAAC;eAEa,MAAM"}
@@ -1,18 +1,26 @@
1
1
  // src/format-on-save/index.ts
2
2
  import { execFileSync, execSync } from "node:child_process";
3
3
  import { existsSync, statSync } from "node:fs";
4
- import { isAbsolute, relative, resolve } from "node:path";
5
- var API_VERSION = "^0.1.10";
4
+
5
+ // src/runtime/index.ts
6
+ import { basename, extname, isAbsolute, relative, resolve } from "node:path";
7
+ var MAX_BUFFER_BYTES = 16 * 1024 * 1024;
8
+ function hasLeadingDash(arg) {
9
+ return arg.length > 0 && arg.startsWith("-");
10
+ }
11
+ function withinProjectPath(projectRoot, candidate) {
12
+ if (candidate.length === 0 || candidate.length > 4096) return false;
13
+ if (hasLeadingDash(candidate)) return false;
14
+ const resolved = isAbsolute(candidate) ? resolve(candidate) : resolve(projectRoot, candidate);
15
+ const rel = relative(projectRoot, resolved);
16
+ return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
17
+ }
6
18
  function withinProject(p) {
7
- if (typeof p !== "string" || p.length === 0 || p.length > 4096) return false;
8
- const root = process.cwd();
9
- const resolved = isAbsolute(p) ? resolve(p) : resolve(root, p);
10
- const rel = relative(root, resolved);
11
- if (rel === "" || rel === ".") return true;
12
- if (rel.startsWith("..")) return false;
13
- if (isAbsolute(rel)) return false;
14
- return true;
19
+ return withinProjectPath(process.cwd(), p) || relative(process.cwd(), p) === ".";
15
20
  }
21
+
22
+ // src/format-on-save/index.ts
23
+ var API_VERSION = "^0.1.10";
16
24
  var state = {
17
25
  invocationCount: 0,
18
26
  /** Times formatting was applied (file changed). */
@@ -219,7 +227,7 @@ var plugin = {
219
227
  state.cleanCount += 1;
220
228
  return;
221
229
  };
222
- state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook);
230
+ state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, { background: true });
223
231
  state.patternUnregister = api.onPattern(
224
232
  "import-organizer:done",
225
233
  (_eventName, payload) => {
@@ -160,7 +160,7 @@ var plugin = {
160
160
  version: "0.2.0",
161
161
  description: "AI-powered git staging and conventional commit message generation",
162
162
  apiVersion: API_VERSION,
163
- capabilities: { tools: true },
163
+ capabilities: { tools: true, llm: true },
164
164
  defaultConfig: {
165
165
  conventionalCommits: true,
166
166
  autoStage: false,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/import-organizer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA4R/C,QAAA,MAAM,MAAM,EAAE,MA8Nb,CAAC;eAEa,MAAM"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/import-organizer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAoR/C,QAAA,MAAM,MAAM,EAAE,MA8Nb,CAAC;eAEa,MAAM"}
@@ -1,17 +1,26 @@
1
1
  // src/import-organizer/index.ts
2
2
  import { spawn } from "node:child_process";
3
3
  import { existsSync, statSync } from "node:fs";
4
- import { basename, isAbsolute, relative, resolve } from "node:path";
4
+ import { basename as basename2, isAbsolute as isAbsolute2 } from "node:path";
5
+
6
+ // src/runtime/index.ts
7
+ import { basename, extname, isAbsolute, relative, resolve } from "node:path";
8
+ var MAX_BUFFER_BYTES = 16 * 1024 * 1024;
9
+ function hasLeadingDash(arg) {
10
+ return arg.length > 0 && arg.startsWith("-");
11
+ }
12
+ function withinProjectPath(projectRoot, candidate) {
13
+ if (candidate.length === 0 || candidate.length > 4096) return false;
14
+ if (hasLeadingDash(candidate)) return false;
15
+ const resolved = isAbsolute(candidate) ? resolve(candidate) : resolve(projectRoot, candidate);
16
+ const rel = relative(projectRoot, resolved);
17
+ return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
18
+ }
5
19
  function withinProject(p) {
6
- if (typeof p !== "string" || p.length === 0 || p.length > 4096) return false;
7
- const root = process.cwd();
8
- const resolved = isAbsolute(p) ? resolve(p) : resolve(root, p);
9
- const rel = relative(root, resolved);
10
- if (rel === "" || rel === ".") return true;
11
- if (rel.startsWith("..")) return false;
12
- if (isAbsolute(rel)) return false;
13
- return true;
20
+ return withinProjectPath(process.cwd(), p) || relative(process.cwd(), p) === ".";
14
21
  }
22
+
23
+ // src/import-organizer/index.ts
15
24
  var ALLOWED_FIRST_TOKENS = /* @__PURE__ */ new Set([
16
25
  "npx",
17
26
  "pnpm",
@@ -31,13 +40,13 @@ function resolveAllowedCommand(command) {
31
40
  if (ALLOWED_FIRST_TOKENS.has(head)) {
32
41
  return { cmd: head, args: tokens.slice(1) };
33
42
  }
34
- if (isAbsolute(head)) {
43
+ if (isAbsolute2(head)) {
35
44
  if (!withinProject(head)) return null;
36
- const base = basename(head);
45
+ const base = basename2(head);
37
46
  if (ALLOWED_FIRST_TOKENS.has(base)) return { cmd: head, args: tokens.slice(1) };
38
47
  }
39
- if (!isAbsolute(head) && withinProject(head)) {
40
- const base = basename(head);
48
+ if (!isAbsolute2(head) && withinProject(head)) {
49
+ const base = basename2(head);
41
50
  if (ALLOWED_FIRST_TOKENS.has(base)) return { cmd: head, args: tokens.slice(1) };
42
51
  }
43
52
  return null;
@@ -256,7 +265,7 @@ ${result.stderr.trim()}`
256
265
  }
257
266
  return;
258
267
  };
259
- state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook);
268
+ state.hookUnregister = api.registerHook("PostToolUse", "write|edit", hook, { background: true });
260
269
  api.tools.register({
261
270
  name: "import_organizer_status",
262
271
  description: "Reports import-organizer state: linter availability, config, and per-session organized/clean/error counters.",
package/dist/index.d.ts CHANGED
@@ -90,10 +90,10 @@
90
90
  * count, and approximate cyclomatic complexity
91
91
  * 39. refactor-suggester — Flags long functions, deep nesting, many
92
92
  * parameters, magic numbers, and console.log usage
93
- * 40. test-generator — Generates a unit-test skeleton from exported
94
- * functions/classes in a source file
95
- * 41. release-notes-generator — Groups conventional commits into a release
96
- * notes markdown draft
93
+ * 40. test-generator — Generates framework-correct test files with an
94
+ * optional behavior-focused api.llm pass
95
+ * 41. release-notes-generator — Produces traceable notes with optional,
96
+ * hash-preserving api.llm polish
97
97
  * 42. smart-rename — Whole-word symbol rename with preview and
98
98
  * optional apply
99
99
  * 43. feature-flag-tracker — Scans source files for feature-flag usage and