branch-never 0.1.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 ADDED
@@ -0,0 +1,74 @@
1
+ # branch-never
2
+
3
+ `branch-never` is a static-analysis CLI for TypeScript and JavaScript projects. It scans source files for high-value conditional branches and flags the ones whose key tokens never appear in any test file.
4
+
5
+ It is intentionally heuristic-based: no runtime instrumentation, no AST parser, and no execution. The goal is to quickly surface risky branches that look untested.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add -D branch-never
11
+ ```
12
+
13
+ Or run it locally in this repository:
14
+
15
+ ```bash
16
+ pnpm install
17
+ pnpm build
18
+ node dist/index.js src --tests test
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```bash
24
+ branch-never <src-dir> [options]
25
+
26
+ Options:
27
+ --tests <dir> Test directory (default: test/)
28
+ --json JSON output
29
+ --no-fail Don't exit 1 when uncovered branches found
30
+ --pattern <type> Only check: env|retry|error|feature|all (default: all)
31
+ --threshold <pct> Fail if coverage below N% (default: 0, fail on any)
32
+ ```
33
+
34
+ Example output:
35
+
36
+ ```text
37
+ Analyzing import graph and branches...
38
+
39
+ Uncovered branches (never referenced in any test):
40
+ src/api.ts:42 if (process.env.NODE_ENV === 'production') <- env branch, no test
41
+
42
+ Covered branches:
43
+ src/auth.ts:15 if (!token) <- referenced in test/auth.test.ts
44
+
45
+ Summary: 1 uncovered branches, 1 covered. Coverage: 50%
46
+ ```
47
+
48
+ ## What It Detects
49
+
50
+ The extractor looks for these branch shapes using regex:
51
+
52
+ - `if (...)`
53
+ - `catch (...) { ... }` blocks with error property checks
54
+ - Ternary conditions like `condition ? a : b`
55
+ - Short-circuit expressions like `a && b` or `a || b` when they include env/config checks
56
+
57
+ It only reports branches whose condition matches one of these interesting patterns:
58
+
59
+ - `process.env.*` and `NODE_ENV === "..."` checks
60
+ - Retry and timeout logic such as `retries > 3`, `attempts >= 2`, `timeout`
61
+ - Error type/status/code checks such as `err.code === "EXPIRED"`
62
+ - Feature flags such as `feature.someFlag`
63
+
64
+ Coverage is approximated by extracting tokens from each condition and checking whether any test file contains them.
65
+
66
+ ## Compared To Istanbul or c8
67
+
68
+ `branch-never` is not a replacement for Istanbul or `c8`.
69
+
70
+ - `branch-never` is static and heuristic-based, so it can run without executing tests.
71
+ - Istanbul and `c8` are runtime coverage tools, so they produce precise statement and branch coverage from real execution.
72
+ - `branch-never` is useful when you want a fast signal about suspicious branches before full runtime coverage is available.
73
+
74
+ The tradeoff is precision: runtime coverage is more accurate, while `branch-never` is faster to adopt and easier to run in lightweight environments.
@@ -0,0 +1,12 @@
1
+ export type PatternType = "env" | "retry" | "error" | "feature";
2
+ export interface BranchMatch {
3
+ file: string;
4
+ line: number;
5
+ conditionText: string;
6
+ pattern: PatternType;
7
+ kind: "if" | "catch" | "ternary" | "short-circuit";
8
+ }
9
+ export declare function extractInterestingBranches(code: string, file?: string): BranchMatch[];
10
+ export declare function extractBranchesFromDirectory(srcDir: string, patternType?: PatternType | "all"): Promise<BranchMatch[]>;
11
+ export declare function detectPattern(conditionText: string, kind?: BranchMatch["kind"]): PatternType | null;
12
+ export declare function normalizeCondition(conditionText: string): string;
@@ -0,0 +1,124 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { glob } from "glob";
4
+ const PATTERN_DESCRIPTORS = [
5
+ {
6
+ type: "env",
7
+ regexes: [
8
+ /process\.env\.\w+/,
9
+ /\bNODE_ENV\s*===?\s*['"`]\w+['"`]/,
10
+ /\b(?:config|cfg)\.\w+/i
11
+ ]
12
+ },
13
+ {
14
+ type: "retry",
15
+ regexes: [
16
+ /\bretries?\s*[><=!]/i,
17
+ /\battempts?\s*[><=!]/i,
18
+ /\btimeout\b/i
19
+ ]
20
+ },
21
+ {
22
+ type: "error",
23
+ regexes: [
24
+ /\berr(?:or)?\.(?:code|status|type)\s*[=!]/i,
25
+ /\be\.(?:code|status|type)\s*[=!]/i
26
+ ]
27
+ },
28
+ {
29
+ type: "feature",
30
+ regexes: [
31
+ /\bfeature\s*\.\s*\w+/i
32
+ ]
33
+ }
34
+ ];
35
+ const FILE_GLOB = "**/*.{ts,tsx,js,jsx,mjs,cjs}";
36
+ export function extractInterestingBranches(code, file = "<memory>") {
37
+ const branches = [];
38
+ const seen = new Set();
39
+ const addBranch = (conditionText, index, kind) => {
40
+ const normalized = normalizeCondition(conditionText);
41
+ const pattern = detectPattern(normalized, kind);
42
+ if (!pattern) {
43
+ return;
44
+ }
45
+ const line = indexToLine(code, index);
46
+ const key = `${line}:${kind}:${normalized}`;
47
+ if (seen.has(key)) {
48
+ return;
49
+ }
50
+ seen.add(key);
51
+ branches.push({
52
+ file,
53
+ line,
54
+ conditionText: normalized,
55
+ pattern,
56
+ kind
57
+ });
58
+ };
59
+ for (const match of code.matchAll(/\bif\s*\(([\s\S]*?)\)/g)) {
60
+ addBranch(match[1] ?? "", match.index ?? 0, "if");
61
+ }
62
+ for (const match of code.matchAll(/\bcatch\s*\(([\s\S]*?)\)\s*\{([\s\S]*?)\}/g)) {
63
+ const errorName = (match[1] ?? "").trim();
64
+ const body = match[2] ?? "";
65
+ if (errorName) {
66
+ for (const nested of body.matchAll(new RegExp(`\\b${escapeRegExp(errorName)}\\.(?:code|status|type)\\s*[=!]==?\\s*([\\w"'"\`.-]+)`, "g"))) {
67
+ addBranch(nested[0] ?? "", (match.index ?? 0) + (nested.index ?? 0), "catch");
68
+ }
69
+ }
70
+ }
71
+ for (const match of code.matchAll(/([^\n;]+?)\?([^\n;]+?):([^\n;]+?)(?=[;\n])/g)) {
72
+ addBranch(match[1] ?? "", match.index ?? 0, "ternary");
73
+ }
74
+ for (const match of code.matchAll(/([^\n;]+?(?:&&|\|\|)[^\n;]+)(?=[;\n])/g)) {
75
+ const expression = normalizeCondition(match[1] ?? "");
76
+ if (/(process\.env\.|NODE_ENV|config\.|cfg\.)/i.test(expression)) {
77
+ addBranch(expression, match.index ?? 0, "short-circuit");
78
+ }
79
+ }
80
+ return branches.sort((left, right) => left.line - right.line);
81
+ }
82
+ export async function extractBranchesFromDirectory(srcDir, patternType = "all") {
83
+ const absoluteDir = path.resolve(srcDir);
84
+ const files = await glob(FILE_GLOB, {
85
+ absolute: true,
86
+ cwd: absoluteDir,
87
+ nodir: true,
88
+ ignore: ["**/*.d.ts"]
89
+ });
90
+ const branches = await Promise.all(files.map(async (file) => {
91
+ const code = await readFile(file, "utf8");
92
+ return extractInterestingBranches(code, path.relative(process.cwd(), file));
93
+ }));
94
+ return branches
95
+ .flat()
96
+ .filter((branch) => patternType === "all" || branch.pattern === patternType)
97
+ .sort((left, right) => {
98
+ if (left.file === right.file) {
99
+ return left.line - right.line;
100
+ }
101
+ return left.file.localeCompare(right.file);
102
+ });
103
+ }
104
+ export function detectPattern(conditionText, kind) {
105
+ for (const descriptor of PATTERN_DESCRIPTORS) {
106
+ if (descriptor.regexes.some((regex) => regex.test(conditionText))) {
107
+ return descriptor.type;
108
+ }
109
+ }
110
+ if (kind === "short-circuit" && /(process\.env\.|NODE_ENV|config\.|cfg\.)/i.test(conditionText)) {
111
+ return "env";
112
+ }
113
+ return null;
114
+ }
115
+ export function normalizeCondition(conditionText) {
116
+ return conditionText.replace(/\s+/g, " ").trim();
117
+ }
118
+ function indexToLine(code, index) {
119
+ return code.slice(0, index).split("\n").length;
120
+ }
121
+ function escapeRegExp(value) {
122
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
123
+ }
124
+ //# sourceMappingURL=extractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractor.js","sourceRoot":"","sources":["../src/extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAiB5B,MAAM,mBAAmB,GAAwB;IAC/C;QACE,IAAI,EAAE,KAAK;QACX,OAAO,EAAE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,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,aAAqB,EACrB,IAA0B;IAE1B,KAAK,MAAM,UAAU,IAAI,mBAAmB,EAAE,CAAC;QAC7C,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;YAClE,OAAO,UAAU,CAAC,IAAI,CAAC;QACzB,CAAC;IACH,CAAC;IAED,IAAI,IAAI,KAAK,eAAe,IAAI,2CAA2C,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;QAChG,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,aAAqB;IACtD,OAAO,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,KAAa;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;AACjD,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { BranchCoverage } from "./matcher.js";
2
+ import type { CoverageSummary } from "./scorer.js";
3
+ export interface FormatPayload {
4
+ covered: BranchCoverage[];
5
+ uncovered: BranchCoverage[];
6
+ summary: CoverageSummary;
7
+ }
8
+ export declare function formatText(payload: FormatPayload): string;
9
+ export declare function formatJson(payload: FormatPayload): string;
@@ -0,0 +1,47 @@
1
+ import chalk from "chalk";
2
+ export function formatText(payload) {
3
+ const lines = [];
4
+ lines.push(chalk.bold("Analyzing import graph and branches..."));
5
+ lines.push("");
6
+ lines.push(chalk.bold.red("Uncovered branches (never referenced in any test):"));
7
+ if (payload.uncovered.length === 0) {
8
+ lines.push(` ${chalk.green("None")}`);
9
+ }
10
+ else {
11
+ for (const branch of payload.uncovered) {
12
+ lines.push(` ${chalk.red(`${branch.file}:${branch.line}`)} ${branch.conditionText} ${chalk.dim(`\u2190 ${describeUncovered(branch)}`)}`);
13
+ }
14
+ }
15
+ lines.push("");
16
+ lines.push(chalk.bold.green("Covered branches:"));
17
+ if (payload.covered.length === 0) {
18
+ lines.push(` ${chalk.yellow("None")}`);
19
+ }
20
+ else {
21
+ for (const branch of payload.covered) {
22
+ const referencedBy = branch.matchedTestFiles[0] ?? "test";
23
+ lines.push(` ${chalk.green(`${branch.file}:${branch.line}`)} ${branch.conditionText} ${chalk.dim(`\u2190 referenced in ${referencedBy}`)}`);
24
+ }
25
+ }
26
+ lines.push("");
27
+ lines.push(`Summary: ${payload.summary.uncoveredCount} uncovered branches, ${payload.summary.coveredCount} covered. Coverage: ${payload.summary.coveragePercent}%`);
28
+ return lines.join("\n");
29
+ }
30
+ export function formatJson(payload) {
31
+ return JSON.stringify(payload, null, 2);
32
+ }
33
+ function describeUncovered(branch) {
34
+ switch (branch.pattern) {
35
+ case "env":
36
+ return "env branch, no test";
37
+ case "retry":
38
+ return "retry logic, no test";
39
+ case "error":
40
+ return "error branch, no test";
41
+ case "feature":
42
+ return "feature flag, no test";
43
+ default:
44
+ return "no test";
45
+ }
46
+ }
47
+ //# sourceMappingURL=formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,MAAM,UAAU,UAAU,CAAC,OAAsB;IAC/C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,KAAK,C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MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,MAAM,CAAC,aAAa,KAAK,KAAK,CAAC,GAAG,CACxF,wBAAwB,YAAY,EAAE,CACvC,EAAE,CACJ,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CACR,YAAY,OAAO,CAAC,OAAO,CAAC,cAAc,wBAAwB,OAAO,CAAC,OAAO,CAAC,YAAY,uBAAuB,OAAO,CAAC,OAAO,CAAC,eAAe,GAAG,CACxJ,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAsB;IAC/C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAsB;IAC/C,QAAQ,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,KAAK,KAAK;YACR,OAAO,qBAAqB,CAAC;QAC/B,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAC;QAChC,KAAK,OAAO;YACV,OAAO,uBAAuB,CAAC;QACjC,KAAK,SAAS;YACZ,OAAO,uBAAuB,CAAC;QACjC;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { extractBranchesFromDirectory } from "./extractor.js";
4
+ import { formatJson, formatText } from "./formatter.js";
5
+ import { loadTestFiles, matchBranchesToTests } from "./matcher.js";
6
+ import { calculateCoverage } from "./scorer.js";
7
+ const program = new Command();
8
+ program
9
+ .name("branch-never")
10
+ .argument("<src-dir>", "Source directory to analyze")
11
+ .option("--tests <dir>", "Test directory", "test/")
12
+ .option("--json", "Emit JSON output", false)
13
+ .option("--no-fail", "Don't exit 1 when uncovered branches found")
14
+ .option("--pattern <type>", "Only check: env|retry|error|feature|all", "all")
15
+ .option("--threshold <pct>", "Fail if coverage below N% (default: 0, fail on any)", "0")
16
+ .action(async (srcDir, options) => {
17
+ const threshold = Number(options.threshold);
18
+ if (!Number.isFinite(threshold) || threshold < 0 || threshold > 100) {
19
+ console.error("Invalid --threshold value. Expected a number between 0 and 100.");
20
+ process.exitCode = 2;
21
+ return;
22
+ }
23
+ if (!["env", "retry", "error", "feature", "all"].includes(options.pattern)) {
24
+ console.error("Invalid --pattern value. Expected env|retry|error|feature|all.");
25
+ process.exitCode = 2;
26
+ return;
27
+ }
28
+ const branches = await extractBranchesFromDirectory(srcDir, options.pattern);
29
+ const testFiles = await loadTestFiles(options.tests);
30
+ const results = matchBranchesToTests(branches, testFiles);
31
+ const covered = results.filter((result) => result.covered);
32
+ const uncovered = results.filter((result) => !result.covered);
33
+ const summary = calculateCoverage(results);
34
+ const payload = { covered, uncovered, summary };
35
+ if (options.json) {
36
+ console.log(formatJson(payload));
37
+ }
38
+ else {
39
+ console.log(formatText(payload));
40
+ }
41
+ const thresholdTriggered = threshold > 0 ? summary.coveragePercent < threshold : uncovered.length > 0;
42
+ if (options.fail && thresholdTriggered) {
43
+ process.exitCode = 1;
44
+ }
45
+ });
46
+ await program.parseAsync(process.argv);
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;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,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;IAEhD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,kBAAkB,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IACtG,IAAI,OAAO,CAAC,IAAI,IAAI,kBAAkB,EAAE,CAAC;QACvC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { BranchMatch } from "./extractor.js";
2
+ export interface BranchCoverage extends BranchMatch {
3
+ covered: boolean;
4
+ matchedTokens: string[];
5
+ matchedTestFiles: string[];
6
+ tokens: string[];
7
+ }
8
+ export interface TestFileRecord {
9
+ contents: string;
10
+ tokens: Set<string>;
11
+ }
12
+ export declare function extractConditionTokens(conditionText: string): string[];
13
+ export declare function collectTestTokens(contents: string): Set<string>;
14
+ export declare function loadTestFiles(testDir: string): Promise<Map<string, TestFileRecord>>;
15
+ export declare function matchBranchesToTests(branches: BranchMatch[], testFiles: Map<string, string | TestFileRecord>): BranchCoverage[];
@@ -0,0 +1,101 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { glob } from "glob";
4
+ const FILE_GLOB = "**/*.{ts,tsx,js,jsx,mjs,cjs}";
5
+ const RESERVED = new Set([
6
+ "if",
7
+ "else",
8
+ "catch",
9
+ "true",
10
+ "false",
11
+ "null",
12
+ "undefined",
13
+ "return",
14
+ "throw",
15
+ "new",
16
+ "typeof",
17
+ "instanceof",
18
+ "process",
19
+ "env"
20
+ ]);
21
+ export function extractConditionTokens(conditionText) {
22
+ const tokens = new Set();
23
+ for (const match of conditionText.matchAll(/process\.env\.([A-Z0-9_]+)/g)) {
24
+ tokens.add(match[1]);
25
+ }
26
+ for (const match of conditionText.matchAll(/["'`]([^"'`]{2,})["'`]/g)) {
27
+ tokens.add(match[1]);
28
+ }
29
+ for (const match of conditionText.matchAll(/\b[A-Za-z_][A-Za-z0-9_]*\b/g)) {
30
+ const token = match[0];
31
+ if (RESERVED.has(token)) {
32
+ continue;
33
+ }
34
+ if (token.length < 3 && !/^[A-Z0-9_]+$/.test(token)) {
35
+ continue;
36
+ }
37
+ tokens.add(token);
38
+ }
39
+ return [...tokens];
40
+ }
41
+ export function collectTestTokens(contents) {
42
+ const stripped = contents
43
+ .replace(/\/\*[\s\S]*?\*\//g, " ")
44
+ .replace(/\/\/.*$/gm, " ");
45
+ const tokens = new Set();
46
+ for (const match of stripped.matchAll(/["'`]([^"'`]{2,})["'`]/g)) {
47
+ tokens.add(match[1]);
48
+ }
49
+ for (const match of stripped.matchAll(/\b[A-Za-z_][A-Za-z0-9_]*\b/g)) {
50
+ const token = match[0];
51
+ if (RESERVED.has(token)) {
52
+ continue;
53
+ }
54
+ tokens.add(token);
55
+ }
56
+ return tokens;
57
+ }
58
+ export async function loadTestFiles(testDir) {
59
+ const absoluteDir = path.resolve(testDir);
60
+ const files = await glob(FILE_GLOB, {
61
+ absolute: true,
62
+ cwd: absoluteDir,
63
+ nodir: true,
64
+ ignore: ["**/*.d.ts"]
65
+ });
66
+ const entries = await Promise.all(files.map(async (file) => {
67
+ const contents = await readFile(file, "utf8");
68
+ return [
69
+ path.relative(process.cwd(), file),
70
+ {
71
+ contents,
72
+ tokens: collectTestTokens(contents)
73
+ }
74
+ ];
75
+ }));
76
+ return new Map(entries);
77
+ }
78
+ export function matchBranchesToTests(branches, testFiles) {
79
+ return branches.map((branch) => {
80
+ const tokens = extractConditionTokens(branch.conditionText);
81
+ const matchedTokens = new Set();
82
+ const matchedTestFiles = new Set();
83
+ for (const [file, record] of testFiles.entries()) {
84
+ const testTokens = typeof record === "string" ? collectTestTokens(record) : record.tokens;
85
+ for (const token of tokens) {
86
+ if (testTokens.has(token)) {
87
+ matchedTokens.add(token);
88
+ matchedTestFiles.add(file);
89
+ }
90
+ }
91
+ }
92
+ return {
93
+ ...branch,
94
+ covered: matchedTokens.size > 0,
95
+ matchedTokens: [...matchedTokens],
96
+ matchedTestFiles: [...matchedTestFiles],
97
+ tokens
98
+ };
99
+ });
100
+ }
101
+ //# sourceMappingURL=matcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matcher.js","sourceRoot":"","sources":["../src/matcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAe5B,MAAM,SAAS,GAAG,8BAA8B,CAAC;AACjD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,IAAI;IACJ,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,WAAW;IACX,QAAQ;IACR,OAAO;IACP,KAAK;IACL,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,KAAK;CACN,CAA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aAAa,CAAC,CAAC;QAC5D,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;QACxC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;QAE3C,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;YACjD,MAAM,UAAU,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;YAC1F,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC1B,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;oBACzB,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO;YACL,GAAG,MAAM;YACT,OAAO,EAAE,aAAa,CAAC,IAAI,GAAG,CAAC;YAC/B,aAAa,EAAE,CAAC,GAAG,aAAa,CAAC;YACjC,gBAAgB,EAAE,CAAC,GAAG,gBAAgB,CAAC;YACvC,MAAM;SACP,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { BranchCoverage } from "./matcher.js";
2
+ export interface CoverageSummary {
3
+ coveredCount: number;
4
+ uncoveredCount: number;
5
+ total: number;
6
+ coveragePercent: number;
7
+ }
8
+ export type Severity = "low" | "medium" | "high";
9
+ export declare function calculateCoverage(results: BranchCoverage[]): CoverageSummary;
10
+ export declare function branchSeverity(result: BranchCoverage): Severity;
package/dist/scorer.js ADDED
@@ -0,0 +1,26 @@
1
+ export function calculateCoverage(results) {
2
+ const total = results.length;
3
+ const coveredCount = results.filter((result) => result.covered).length;
4
+ const uncoveredCount = total - coveredCount;
5
+ const coveragePercent = total === 0 ? 100 : Math.round((coveredCount / total) * 100);
6
+ return {
7
+ coveredCount,
8
+ uncoveredCount,
9
+ total,
10
+ coveragePercent
11
+ };
12
+ }
13
+ export function branchSeverity(result) {
14
+ switch (result.pattern) {
15
+ case "env":
16
+ case "error":
17
+ return "high";
18
+ case "retry":
19
+ return "medium";
20
+ case "feature":
21
+ return "low";
22
+ default:
23
+ return "medium";
24
+ }
25
+ }
26
+ //# sourceMappingURL=scorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scorer.js","sourceRoot":"","sources":["../src/scorer.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,iBAAiB,CAAC,OAAyB;IACzD,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IAC7B,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IACvE,MAAM,cAAc,GAAG,KAAK,GAAG,YAAY,CAAC;IAC5C,MAAM,eAAe,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;IAErF,OAAO;QACL,YAAY;QACZ,cAAc;QACd,KAAK;QACL,eAAe;KAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,QAAQ,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,KAAK,KAAK,CAAC;QACX,KAAK,OAAO;YACV,OAAO,MAAM,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,QAAQ,CAAC;QAClB,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC;QACf;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "branch-never",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "branch-never": "dist/index.js"
7
+ },
8
+ "files": [
9
+ "dist/",
10
+ "README.md"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "prepublishOnly": "tsc",
15
+ "test": "node --import tsx/esm --test test/*.test.ts"
16
+ },
17
+ "dependencies": {
18
+ "chalk": "^5.3.0",
19
+ "commander": "^14.0.0",
20
+ "glob": "^11.0.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "^25.0.0",
24
+ "tsx": "^4.0.0",
25
+ "typescript": "^6.0.0"
26
+ }
27
+ }