feat(checks): unify inspection scope in checks/scope.ts
Single source of truth for what pygienium inspects (implementation-code extensions, exclude dirs, .d.ts/.min.* exclusions) shared by recon, dead-code, deep-modules, defensive-guards, comments, and complexity. Every scan task and agent prompt injects the shared scope rules instead of copy-pasted per-check lists.
This commit is contained in:
23
src/recon.ts
23
src/recon.ts
@@ -15,6 +15,7 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { promisify } from "node:util";
|
||||
import { join } from "node:path";
|
||||
import { stateDir, RECON_FILENAME } from "./run-state.js";
|
||||
import { SCOPE_EXTENSIONS } from "./checks/scope.js";
|
||||
|
||||
const execAsync = promisify(exec);
|
||||
|
||||
@@ -28,26 +29,6 @@ export interface ReconSnapshot {
|
||||
totalSourceFiles: number;
|
||||
}
|
||||
|
||||
/** Source extensions worth inventorying for hygiene checks. */
|
||||
const SOURCE_EXTENSIONS = new Set([
|
||||
".ts",
|
||||
".tsx",
|
||||
".js",
|
||||
".jsx",
|
||||
".mjs",
|
||||
".cjs",
|
||||
".py",
|
||||
".rb",
|
||||
".go",
|
||||
".rs",
|
||||
".java",
|
||||
".kt",
|
||||
".swift",
|
||||
".php",
|
||||
".cs",
|
||||
".lua",
|
||||
]);
|
||||
|
||||
/** Run `git ls-files` when possible to get a clean source inventory. */
|
||||
async function listSourceFiles(cwd: string): Promise<string[]> {
|
||||
try {
|
||||
@@ -62,7 +43,7 @@ async function listSourceFiles(cwd: string): Promise<string[]> {
|
||||
.filter((l) => {
|
||||
const dot = l.lastIndexOf(".");
|
||||
if (dot === -1) return false;
|
||||
return SOURCE_EXTENSIONS.has(l.slice(dot).toLowerCase());
|
||||
return SCOPE_EXTENSIONS.has(l.slice(dot).toLowerCase());
|
||||
});
|
||||
} catch {
|
||||
/* not a git repo or git unavailable — empty inventory */
|
||||
|
||||
Reference in New Issue
Block a user