aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
39 lines • 1.26 kB
JavaScript
/**
* Contributor Detection Runner
*
* Runs a contributor's declarative detection spec against the project root.
* Determines whether the contributor's framework is *in use* on this project,
* not just installed. Pure I/O — no code execution.
*
* @architecture @.aiwg/architecture/decisions/ADR-023-contributor-discovery-convention.md
* @issue #938
*/
import { glob } from 'glob';
/**
* Run a contributor's detection spec. Returns the count of files matching
* any glob pattern (with deduplication). The caller compares against
* `spec.minCount` to decide in-use status.
*/
export async function runDetection(spec, projectRoot) {
const seen = new Set();
for (const pattern of spec.glob) {
const matches = await glob(pattern, {
cwd: projectRoot,
nodir: true,
dot: false,
absolute: false,
});
for (const m of matches)
seen.add(m);
}
return seen.size;
}
/**
* Convenience wrapper: returns true when match count meets minCount (default 1).
*/
export async function isInUse(spec, projectRoot) {
const min = spec.minCount ?? 1;
const count = await runDetection(spec, projectRoot);
return count >= min;
}
//# sourceMappingURL=detect.js.map