@wrongstack/plugins 0.308.6 → 0.308.7
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/dist/accessibility-auditor.js +26 -82
- package/dist/agent-handoff.js +16 -26
- package/dist/auto-i18n-extractor.js +19 -23
- package/dist/branch-guard.js +19 -111
- package/dist/changelog-writer.js +20 -133
- package/dist/code-metrics.js +26 -71
- package/dist/commit-validator.js +16 -14
- package/dist/config-validator.js +18 -22
- package/dist/cost-tracker.js +15 -96
- package/dist/dead-code-detector.js +27 -31
- package/dist/dependency-vulnerability-gate.js +18 -15
- package/dist/diff-summary.js +19 -128
- package/dist/doc-sync-guard.js +24 -39
- package/dist/duplicate-code-detector.js +30 -169
- package/dist/feature-flag-tracker.js +26 -71
- package/dist/file-watcher.js +19 -23
- package/dist/format-on-save.js +25 -214
- package/dist/import-organizer.js +31 -106
- package/dist/index.js +452 -1236
- package/dist/interface-contract-guard.js +26 -71
- package/dist/lint-gate.js +19 -111
- package/dist/migration-planner.js +28 -120
- package/dist/notify-hub.js +18 -28
- package/dist/path-guard.js +27 -102
- package/dist/pr-drafter.js +18 -16
- package/dist/prompt-firewall.js +8 -205
- package/dist/refactor-suggester.js +27 -166
- package/dist/release-notes-generator.js +6 -35
- package/dist/runtime/bounded-map.d.ts +2 -85
- package/dist/runtime/credential-patterns.d.ts +2 -41
- package/dist/runtime/h1-state.d.ts +2 -61
- package/dist/runtime/handles.d.ts +2 -45
- package/dist/runtime/index.d.ts +8 -180
- package/dist/runtime/llm.d.ts +2 -43
- package/dist/runtime/local-bin.d.ts +2 -119
- package/dist/runtime/redos-guard.d.ts +2 -68
- package/dist/runtime/safe-json.d.ts +2 -24
- package/dist/runtime/sandbox.d.ts +2 -58
- package/dist/runtime.js +1 -868
- package/dist/schema-evolution-guard.js +20 -24
- package/dist/secret-scanner.js +22 -146
- package/dist/security-hotspot-scanner.js +24 -154
- package/dist/session-recap.js +16 -14
- package/dist/spec-linker.js +19 -17
- package/dist/template-engine.js +22 -37
- package/dist/test-coverage-gate.js +19 -34
- package/dist/test-generator.js +6 -35
- package/dist/test-runner-gate.js +34 -143
- package/dist/todo-listener.js +17 -38
- package/dist/type-gate.js +23 -311
- package/package.json +4 -3
|
@@ -1,81 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
|
|
1
15
|
// src/accessibility-auditor/index.ts
|
|
2
16
|
import { readFile } from "node:fs/promises";
|
|
3
|
-
import { isAbsolute
|
|
4
|
-
|
|
5
|
-
// src/runtime/index.ts
|
|
6
|
-
import { basename, extname, isAbsolute, relative, resolve } from "node:path";
|
|
7
|
-
|
|
8
|
-
// src/runtime/local-bin.ts
|
|
9
|
-
import { buildWin32CmdShimInvocation, resolveWin32Command } from "@wrongstack/tools/win32";
|
|
10
|
-
|
|
11
|
-
// src/runtime/handles.ts
|
|
12
|
-
function releaseHandle(off) {
|
|
13
|
-
if (off) {
|
|
14
|
-
try {
|
|
15
|
-
off();
|
|
16
|
-
} catch {
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
17
|
+
import { isAbsolute, relative, resolve } from "node:path";
|
|
21
18
|
|
|
22
19
|
// src/runtime/index.ts
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
function withinProjectPath(projectRoot, candidate) {
|
|
28
|
-
if (candidate.length === 0 || candidate.length > 4096) return false;
|
|
29
|
-
if (hasLeadingDash(candidate)) return false;
|
|
30
|
-
const resolved = isAbsolute(candidate) ? resolve(candidate) : resolve(projectRoot, candidate);
|
|
31
|
-
const rel = relative(projectRoot, resolved);
|
|
32
|
-
return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
|
|
33
|
-
}
|
|
34
|
-
function withinProject(p) {
|
|
35
|
-
const cwd = process.cwd();
|
|
36
|
-
return withinProjectPath(cwd, p) || relative(cwd, p) === ".";
|
|
37
|
-
}
|
|
38
|
-
var DEFAULT_EXCLUDE_DIRS = ["node_modules", "dist", ".git", "coverage"];
|
|
39
|
-
async function collectSourceFilesAsync(root, opts) {
|
|
40
|
-
const { readdir, stat } = await import("node:fs/promises");
|
|
41
|
-
const files = [];
|
|
42
|
-
try {
|
|
43
|
-
const s = await stat(root);
|
|
44
|
-
if (s.isFile()) {
|
|
45
|
-
if (matchesExtension(root, opts.extensions)) files.push(root);
|
|
46
|
-
return files;
|
|
47
|
-
}
|
|
48
|
-
if (!s.isDirectory()) return files;
|
|
49
|
-
} catch {
|
|
50
|
-
return files;
|
|
51
|
-
}
|
|
52
|
-
const exclude = opts.excludeDirs ?? DEFAULT_EXCLUDE_DIRS;
|
|
53
|
-
const excludeSet = new Set(exclude);
|
|
54
|
-
async function walk(dir, depth) {
|
|
55
|
-
if (opts.maxDepth !== void 0 && depth > opts.maxDepth) return;
|
|
56
|
-
let entries;
|
|
57
|
-
try {
|
|
58
|
-
entries = await readdir(dir, { withFileTypes: true });
|
|
59
|
-
} catch {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
63
|
-
for (const entry of entries) {
|
|
64
|
-
if (excludeSet.has(entry.name)) continue;
|
|
65
|
-
const full = resolve(dir, entry.name);
|
|
66
|
-
if (entry.isDirectory()) {
|
|
67
|
-
await walk(full, depth + 1);
|
|
68
|
-
} else if (entry.isFile() && matchesExtension(full, opts.extensions)) {
|
|
69
|
-
files.push(full);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
await walk(root, 0);
|
|
74
|
-
return files;
|
|
75
|
-
}
|
|
76
|
-
function matchesExtension(p, exts) {
|
|
77
|
-
return exts.includes(extname(p).toLowerCase());
|
|
78
|
-
}
|
|
20
|
+
var runtime_exports = {};
|
|
21
|
+
__reExport(runtime_exports, runtime_star);
|
|
22
|
+
import * as runtime_star from "@wrongstack/plugin-sdk/runtime";
|
|
79
23
|
|
|
80
24
|
// src/accessibility-auditor/index.ts
|
|
81
25
|
var API_VERSION = "^0.1.10";
|
|
@@ -162,7 +106,7 @@ async function auditFile(filePath, projectRoot) {
|
|
|
162
106
|
const idsByValue = /* @__PURE__ */ new Map();
|
|
163
107
|
function add(line, rule, severity, message, note) {
|
|
164
108
|
findings.push({
|
|
165
|
-
file:
|
|
109
|
+
file: relative(projectRoot, filePath),
|
|
166
110
|
line,
|
|
167
111
|
rule,
|
|
168
112
|
severity,
|
|
@@ -261,9 +205,9 @@ async function auditFile(filePath, projectRoot) {
|
|
|
261
205
|
}
|
|
262
206
|
async function auditPath(rawPath, cfg) {
|
|
263
207
|
const root = process.cwd();
|
|
264
|
-
const resolved =
|
|
208
|
+
const resolved = isAbsolute(rawPath) ? resolve(rawPath) : resolve(root, rawPath);
|
|
265
209
|
const exts = normalizeExtensions(cfg.includeExtensions);
|
|
266
|
-
const files = await collectSourceFilesAsync(resolved, { extensions: exts });
|
|
210
|
+
const files = await (0, runtime_exports.collectSourceFilesAsync)(resolved, { extensions: exts });
|
|
267
211
|
const findings = [];
|
|
268
212
|
let scannedFiles = 0;
|
|
269
213
|
let truncated = false;
|
|
@@ -277,7 +221,7 @@ async function auditPath(rawPath, cfg) {
|
|
|
277
221
|
}
|
|
278
222
|
}
|
|
279
223
|
return {
|
|
280
|
-
path:
|
|
224
|
+
path: relative(root, resolved),
|
|
281
225
|
findings: findings.slice(0, cfg.maxFindings),
|
|
282
226
|
fileCount: files.length,
|
|
283
227
|
scannedFiles,
|
|
@@ -350,7 +294,7 @@ var plugin = {
|
|
|
350
294
|
state.findingCount = 0;
|
|
351
295
|
state.hookInvocationCount = 0;
|
|
352
296
|
state.lastResult = null;
|
|
353
|
-
state.hookUnregister = releaseHandle(state.hookUnregister);
|
|
297
|
+
state.hookUnregister = (0, runtime_exports.releaseHandle)(state.hookUnregister);
|
|
354
298
|
const cfg = readConfig(api.config.extensions?.["accessibility-auditor"]);
|
|
355
299
|
const hook = async (input) => {
|
|
356
300
|
if (!cfg.enabled || !cfg.onWriteEdit) return;
|
|
@@ -358,9 +302,9 @@ var plugin = {
|
|
|
358
302
|
const inp = input.toolInput ?? {};
|
|
359
303
|
const sourcePath = inp["path"];
|
|
360
304
|
if (!sourcePath || typeof sourcePath !== "string") return;
|
|
361
|
-
if (!withinProject(sourcePath)) return;
|
|
305
|
+
if (!(0, runtime_exports.withinProject)(sourcePath)) return;
|
|
362
306
|
const exts = normalizeExtensions(cfg.includeExtensions);
|
|
363
|
-
if (!matchesExtension(sourcePath, exts)) return;
|
|
307
|
+
if (!(0, runtime_exports.matchesExtension)(sourcePath, exts)) return;
|
|
364
308
|
state.hookInvocationCount += 1;
|
|
365
309
|
const result = await auditPath(sourcePath, cfg);
|
|
366
310
|
state.auditCount += 1;
|
|
@@ -402,7 +346,7 @@ var plugin = {
|
|
|
402
346
|
if (!rawPath || typeof rawPath !== "string") {
|
|
403
347
|
return { ok: false, error: "path is required" };
|
|
404
348
|
}
|
|
405
|
-
if (!withinProject(rawPath)) {
|
|
349
|
+
if (!(0, runtime_exports.withinProject)(rawPath)) {
|
|
406
350
|
return { ok: false, error: "path must be inside the project" };
|
|
407
351
|
}
|
|
408
352
|
state.auditCount += 1;
|
package/dist/agent-handoff.js
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
value,
|
|
11
|
-
function replacer(_key, val) {
|
|
12
|
-
if (typeof val === "bigint") return `${val.toString()}n`;
|
|
13
|
-
if (val === null || typeof val !== "object") return val;
|
|
14
|
-
while (stack.length > 0 && stack[stack.length - 1] !== this) stack.pop();
|
|
15
|
-
if (stack.includes(val)) return "[circular]";
|
|
16
|
-
stack.push(val);
|
|
17
|
-
return val;
|
|
18
|
-
},
|
|
19
|
-
indent
|
|
20
|
-
);
|
|
21
|
-
return out ?? String(value);
|
|
22
|
-
} catch {
|
|
23
|
-
return UNSERIALIZABLE;
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
10
|
}
|
|
25
|
-
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
26
14
|
|
|
27
15
|
// src/runtime/index.ts
|
|
28
|
-
var
|
|
16
|
+
var runtime_exports = {};
|
|
17
|
+
__reExport(runtime_exports, runtime_star);
|
|
18
|
+
import * as runtime_star from "@wrongstack/plugin-sdk/runtime";
|
|
29
19
|
|
|
30
20
|
// src/agent-handoff/index.ts
|
|
31
21
|
var API_VERSION = "^0.1.10";
|
|
@@ -84,7 +74,7 @@ function buildBody(payload, cfg) {
|
|
|
84
74
|
if (cfg.includeResult && payload.result !== void 0) {
|
|
85
75
|
lines.push("## Result");
|
|
86
76
|
lines.push("```json");
|
|
87
|
-
lines.push(safeJsonStringify(payload.result, 2));
|
|
77
|
+
lines.push((0, runtime_exports.safeJsonStringify)(payload.result, 2));
|
|
88
78
|
lines.push("```");
|
|
89
79
|
lines.push("");
|
|
90
80
|
}
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
|
|
1
15
|
// src/auto-i18n-extractor/index.ts
|
|
2
16
|
import { readFileSync } from "node:fs";
|
|
3
17
|
|
|
4
18
|
// src/runtime/index.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { buildWin32CmdShimInvocation, resolveWin32Command } from "@wrongstack/tools/win32";
|
|
9
|
-
|
|
10
|
-
// src/runtime/index.ts
|
|
11
|
-
var MAX_BUFFER_BYTES = 16 * 1024 * 1024;
|
|
12
|
-
function hasLeadingDash(arg) {
|
|
13
|
-
return arg.length > 0 && arg.startsWith("-");
|
|
14
|
-
}
|
|
15
|
-
function withinProjectPath(projectRoot, candidate) {
|
|
16
|
-
if (candidate.length === 0 || candidate.length > 4096) return false;
|
|
17
|
-
if (hasLeadingDash(candidate)) return false;
|
|
18
|
-
const resolved = isAbsolute(candidate) ? resolve(candidate) : resolve(projectRoot, candidate);
|
|
19
|
-
const rel = relative(projectRoot, resolved);
|
|
20
|
-
return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
|
|
21
|
-
}
|
|
22
|
-
function withinProject(p) {
|
|
23
|
-
const cwd = process.cwd();
|
|
24
|
-
return withinProjectPath(cwd, p) || relative(cwd, p) === ".";
|
|
25
|
-
}
|
|
19
|
+
var runtime_exports = {};
|
|
20
|
+
__reExport(runtime_exports, runtime_star);
|
|
21
|
+
import * as runtime_star from "@wrongstack/plugin-sdk/runtime";
|
|
26
22
|
|
|
27
23
|
// src/auto-i18n-extractor/index.ts
|
|
28
24
|
var API_VERSION = "^0.1.10";
|
|
@@ -185,7 +181,7 @@ var plugin = {
|
|
|
185
181
|
const inp = input.toolInput ?? {};
|
|
186
182
|
const sourcePath = inp["path"];
|
|
187
183
|
if (!sourcePath || typeof sourcePath !== "string") return;
|
|
188
|
-
if (!withinProject(sourcePath)) return;
|
|
184
|
+
if (!(0, runtime_exports.withinProject)(sourcePath)) return;
|
|
189
185
|
const ext = fileExtension(sourcePath);
|
|
190
186
|
if (!cfg.fileExtensions.includes(ext)) {
|
|
191
187
|
state.skipped += 1;
|
|
@@ -238,7 +234,7 @@ ${lines.join("\n")}${more}`;
|
|
|
238
234
|
if (typeof filePath !== "string" || !filePath) {
|
|
239
235
|
return { ok: false, error: "path is required" };
|
|
240
236
|
}
|
|
241
|
-
if (!withinProject(filePath)) {
|
|
237
|
+
if (!(0, runtime_exports.withinProject)(filePath)) {
|
|
242
238
|
return { ok: false, error: "path must be inside the project" };
|
|
243
239
|
}
|
|
244
240
|
const ext = fileExtension(filePath);
|
package/dist/branch-guard.js
CHANGED
|
@@ -1,116 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
max;
|
|
11
|
-
ttlMs;
|
|
12
|
-
now;
|
|
13
|
-
/** Entries dropped to stay under `max`. Surfaced by plugin health(). */
|
|
14
|
-
evictions = 0;
|
|
15
|
-
constructor(options) {
|
|
16
|
-
const normalizedMax = Math.floor(options.max);
|
|
17
|
-
this.max = Number.isSafeInteger(normalizedMax) ? Math.max(1, normalizedMax) : 1;
|
|
18
|
-
this.ttlMs = options.ttlMs;
|
|
19
|
-
this.now = options.now ?? Date.now;
|
|
20
|
-
}
|
|
21
|
-
expired(entry) {
|
|
22
|
-
return this.ttlMs !== void 0 && this.now() - entry.storedAt > this.ttlMs;
|
|
23
|
-
}
|
|
24
|
-
get(key) {
|
|
25
|
-
const entry = this.map.get(key);
|
|
26
|
-
if (entry === void 0) return void 0;
|
|
27
|
-
if (this.expired(entry)) {
|
|
28
|
-
this.map.delete(key);
|
|
29
|
-
return void 0;
|
|
30
|
-
}
|
|
31
|
-
this.map.delete(key);
|
|
32
|
-
this.map.set(key, entry);
|
|
33
|
-
return entry.value;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Read without promoting the key to most-recently-used. Use for
|
|
37
|
-
* diagnostics that must not perturb the eviction order.
|
|
38
|
-
*/
|
|
39
|
-
peek(key) {
|
|
40
|
-
const entry = this.map.get(key);
|
|
41
|
-
if (entry === void 0 || this.expired(entry)) return void 0;
|
|
42
|
-
return entry.value;
|
|
43
|
-
}
|
|
44
|
-
has(key) {
|
|
45
|
-
const entry = this.map.get(key);
|
|
46
|
-
if (entry === void 0) return false;
|
|
47
|
-
if (this.expired(entry)) {
|
|
48
|
-
this.map.delete(key);
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
set(key, value) {
|
|
54
|
-
this.map.delete(key);
|
|
55
|
-
this.map.set(key, { value, storedAt: this.now() });
|
|
56
|
-
while (this.map.size > this.max) {
|
|
57
|
-
const coldest = this.map.keys().next().value;
|
|
58
|
-
if (coldest === void 0) break;
|
|
59
|
-
this.map.delete(coldest);
|
|
60
|
-
this.evictions += 1;
|
|
61
|
-
}
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
delete(key) {
|
|
65
|
-
return this.map.delete(key);
|
|
66
|
-
}
|
|
67
|
-
clear() {
|
|
68
|
-
this.map.clear();
|
|
69
|
-
this.evictions = 0;
|
|
70
|
-
}
|
|
71
|
-
get size() {
|
|
72
|
-
return this.map.size;
|
|
73
|
-
}
|
|
74
|
-
/** How many entries have been dropped to respect `max`, since the last clear. */
|
|
75
|
-
get evictionCount() {
|
|
76
|
-
return this.evictions;
|
|
77
|
-
}
|
|
78
|
-
/** Drop every expired entry. Cheap enough to call from a status tool. */
|
|
79
|
-
prune() {
|
|
80
|
-
if (this.ttlMs === void 0) return 0;
|
|
81
|
-
let removed = 0;
|
|
82
|
-
for (const [key, entry] of this.map) {
|
|
83
|
-
if (this.expired(entry)) {
|
|
84
|
-
this.map.delete(key);
|
|
85
|
-
removed += 1;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return removed;
|
|
89
|
-
}
|
|
90
|
-
/** Live (non-expired) entries, coldest first. */
|
|
91
|
-
*entries() {
|
|
92
|
-
for (const [key, entry] of this.map) {
|
|
93
|
-
if (!this.expired(entry)) yield [key, entry.value];
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
[Symbol.iterator]() {
|
|
97
|
-
return this.entries();
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
98
10
|
}
|
|
11
|
+
return to;
|
|
99
12
|
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
100
14
|
|
|
101
|
-
// src/
|
|
102
|
-
|
|
103
|
-
if (off) {
|
|
104
|
-
try {
|
|
105
|
-
off();
|
|
106
|
-
} catch {
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
15
|
+
// src/branch-guard/index.ts
|
|
16
|
+
import { execFile } from "node:child_process";
|
|
111
17
|
|
|
112
18
|
// src/runtime/index.ts
|
|
113
|
-
var
|
|
19
|
+
var runtime_exports = {};
|
|
20
|
+
__reExport(runtime_exports, runtime_star);
|
|
21
|
+
import * as runtime_star from "@wrongstack/plugin-sdk/runtime";
|
|
114
22
|
|
|
115
23
|
// src/branch-guard/index.ts
|
|
116
24
|
var API_VERSION = "^0.1.10";
|
|
@@ -164,7 +72,7 @@ function hasDisabledPluginEntry(raw) {
|
|
|
164
72
|
return name === "branch-guard" || name === "@wrongstack/plugins/branch-guard";
|
|
165
73
|
});
|
|
166
74
|
}
|
|
167
|
-
var branchCache = new BoundedMap({ max: 64, ttlMs: 3e4 });
|
|
75
|
+
var branchCache = new runtime_exports.BoundedMap({ max: 64, ttlMs: 3e4 });
|
|
168
76
|
function runGit(args, cwd, signal) {
|
|
169
77
|
return new Promise((resolve, reject) => {
|
|
170
78
|
execFile(
|
|
@@ -274,8 +182,8 @@ var plugin = {
|
|
|
274
182
|
state.invocationCount = 0;
|
|
275
183
|
state.blockCount = 0;
|
|
276
184
|
state.warnCount = 0;
|
|
277
|
-
state.hookUnregister = releaseHandle(state.hookUnregister);
|
|
278
|
-
state.configUnregister = releaseHandle(state.configUnregister);
|
|
185
|
+
state.hookUnregister = (0, runtime_exports.releaseHandle)(state.hookUnregister);
|
|
186
|
+
state.configUnregister = (0, runtime_exports.releaseHandle)(state.configUnregister);
|
|
279
187
|
state.lastBlock = null;
|
|
280
188
|
branchCache.clear();
|
|
281
189
|
let cfg = readHostConfig(api.config);
|
package/dist/changelog-writer.js
CHANGED
|
@@ -1,143 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
|
|
1
15
|
// src/changelog-writer/index.ts
|
|
2
16
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
3
17
|
import { isAbsolute, relative, resolve } from "node:path";
|
|
4
18
|
|
|
5
|
-
// src/runtime/local-bin.ts
|
|
6
|
-
import { buildWin32CmdShimInvocation, resolveWin32Command } from "@wrongstack/tools/win32";
|
|
7
|
-
|
|
8
|
-
// src/runtime/bounded-map.ts
|
|
9
|
-
var BoundedMap = class {
|
|
10
|
-
map = /* @__PURE__ */ new Map();
|
|
11
|
-
max;
|
|
12
|
-
ttlMs;
|
|
13
|
-
now;
|
|
14
|
-
/** Entries dropped to stay under `max`. Surfaced by plugin health(). */
|
|
15
|
-
evictions = 0;
|
|
16
|
-
constructor(options) {
|
|
17
|
-
const normalizedMax = Math.floor(options.max);
|
|
18
|
-
this.max = Number.isSafeInteger(normalizedMax) ? Math.max(1, normalizedMax) : 1;
|
|
19
|
-
this.ttlMs = options.ttlMs;
|
|
20
|
-
this.now = options.now ?? Date.now;
|
|
21
|
-
}
|
|
22
|
-
expired(entry) {
|
|
23
|
-
return this.ttlMs !== void 0 && this.now() - entry.storedAt > this.ttlMs;
|
|
24
|
-
}
|
|
25
|
-
get(key) {
|
|
26
|
-
const entry = this.map.get(key);
|
|
27
|
-
if (entry === void 0) return void 0;
|
|
28
|
-
if (this.expired(entry)) {
|
|
29
|
-
this.map.delete(key);
|
|
30
|
-
return void 0;
|
|
31
|
-
}
|
|
32
|
-
this.map.delete(key);
|
|
33
|
-
this.map.set(key, entry);
|
|
34
|
-
return entry.value;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Read without promoting the key to most-recently-used. Use for
|
|
38
|
-
* diagnostics that must not perturb the eviction order.
|
|
39
|
-
*/
|
|
40
|
-
peek(key) {
|
|
41
|
-
const entry = this.map.get(key);
|
|
42
|
-
if (entry === void 0 || this.expired(entry)) return void 0;
|
|
43
|
-
return entry.value;
|
|
44
|
-
}
|
|
45
|
-
has(key) {
|
|
46
|
-
const entry = this.map.get(key);
|
|
47
|
-
if (entry === void 0) return false;
|
|
48
|
-
if (this.expired(entry)) {
|
|
49
|
-
this.map.delete(key);
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
set(key, value) {
|
|
55
|
-
this.map.delete(key);
|
|
56
|
-
this.map.set(key, { value, storedAt: this.now() });
|
|
57
|
-
while (this.map.size > this.max) {
|
|
58
|
-
const coldest = this.map.keys().next().value;
|
|
59
|
-
if (coldest === void 0) break;
|
|
60
|
-
this.map.delete(coldest);
|
|
61
|
-
this.evictions += 1;
|
|
62
|
-
}
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
delete(key) {
|
|
66
|
-
return this.map.delete(key);
|
|
67
|
-
}
|
|
68
|
-
clear() {
|
|
69
|
-
this.map.clear();
|
|
70
|
-
this.evictions = 0;
|
|
71
|
-
}
|
|
72
|
-
get size() {
|
|
73
|
-
return this.map.size;
|
|
74
|
-
}
|
|
75
|
-
/** How many entries have been dropped to respect `max`, since the last clear. */
|
|
76
|
-
get evictionCount() {
|
|
77
|
-
return this.evictions;
|
|
78
|
-
}
|
|
79
|
-
/** Drop every expired entry. Cheap enough to call from a status tool. */
|
|
80
|
-
prune() {
|
|
81
|
-
if (this.ttlMs === void 0) return 0;
|
|
82
|
-
let removed = 0;
|
|
83
|
-
for (const [key, entry] of this.map) {
|
|
84
|
-
if (this.expired(entry)) {
|
|
85
|
-
this.map.delete(key);
|
|
86
|
-
removed += 1;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return removed;
|
|
90
|
-
}
|
|
91
|
-
/** Live (non-expired) entries, coldest first. */
|
|
92
|
-
*entries() {
|
|
93
|
-
for (const [key, entry] of this.map) {
|
|
94
|
-
if (!this.expired(entry)) yield [key, entry.value];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
[Symbol.iterator]() {
|
|
98
|
-
return this.entries();
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
var BoundedSet = class {
|
|
102
|
-
inner;
|
|
103
|
-
constructor(options) {
|
|
104
|
-
this.inner = new BoundedMap(options);
|
|
105
|
-
}
|
|
106
|
-
has(value) {
|
|
107
|
-
return this.inner.has(value);
|
|
108
|
-
}
|
|
109
|
-
add(value) {
|
|
110
|
-
this.inner.set(value, true);
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
delete(value) {
|
|
114
|
-
return this.inner.delete(value);
|
|
115
|
-
}
|
|
116
|
-
clear() {
|
|
117
|
-
this.inner.clear();
|
|
118
|
-
}
|
|
119
|
-
get size() {
|
|
120
|
-
return this.inner.size;
|
|
121
|
-
}
|
|
122
|
-
/** How many entries have been dropped to respect `max`, since the last clear. */
|
|
123
|
-
get evictionCount() {
|
|
124
|
-
return this.inner.evictionCount;
|
|
125
|
-
}
|
|
126
|
-
*values() {
|
|
127
|
-
for (const [key] of this.inner) yield key;
|
|
128
|
-
}
|
|
129
|
-
[Symbol.iterator]() {
|
|
130
|
-
return this.values();
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
19
|
// src/runtime/index.ts
|
|
135
|
-
var
|
|
20
|
+
var runtime_exports = {};
|
|
21
|
+
__reExport(runtime_exports, runtime_star);
|
|
22
|
+
import * as runtime_star from "@wrongstack/plugin-sdk/runtime";
|
|
136
23
|
|
|
137
24
|
// src/changelog-writer/index.ts
|
|
138
25
|
var state = {
|
|
139
26
|
entries: [],
|
|
140
|
-
filesTouched: new BoundedSet({ max: 2e3 }),
|
|
27
|
+
filesTouched: new runtime_exports.BoundedSet({ max: 2e3 }),
|
|
141
28
|
commitsSeen: 0,
|
|
142
29
|
writes: 0,
|
|
143
30
|
polishes: 0,
|
|
@@ -298,7 +185,7 @@ var plugin = {
|
|
|
298
185
|
},
|
|
299
186
|
setup(api) {
|
|
300
187
|
state.entries = [];
|
|
301
|
-
state.filesTouched = new BoundedSet({ max: 2e3 });
|
|
188
|
+
state.filesTouched = new runtime_exports.BoundedSet({ max: 2e3 });
|
|
302
189
|
state.commitsSeen = 0;
|
|
303
190
|
state.writes = 0;
|
|
304
191
|
for (const off of state.eventUnsubscribers) {
|
|
@@ -494,7 +381,7 @@ var plugin = {
|
|
|
494
381
|
filesTouched: state.filesTouched.size
|
|
495
382
|
};
|
|
496
383
|
state.entries = [];
|
|
497
|
-
state.filesTouched = new BoundedSet({ max: 2e3 });
|
|
384
|
+
state.filesTouched = new runtime_exports.BoundedSet({ max: 2e3 });
|
|
498
385
|
state.commitsSeen = 0;
|
|
499
386
|
state.writes = 0;
|
|
500
387
|
api.log.info("changelog-writer: teardown complete", { final });
|