@testgorilla/tgo-checker-core
v0.1.0
Published
Shared engine, rule model, AST helpers, and reporter for TestGorilla's deterministic Angular checkers (test + production-code)
Readme
TGO Checker Core
@testgorilla/tgo-checker-core — the shared engine and primitives behind
TestGorilla's deterministic Angular checkers:
@testgorilla/tgo-testing-checker— test-canon rules@testgorilla/tgo-code-checker— production-code-canon rules
Keeping the engine and — critically — the reporter here means both checkers
emit the exact same JSON shape, the contract the tgo-graph PR gate consumes via
--import-findings.
What's in here
| Module | Exports |
| --- | --- |
| types | Severity, RuleCategory, RuleDefinitionBase, RuleViolation, CheckContext<O>, FileResult/CheckResult/SectionResult/GroupedCheckResult, the three *RuleChecker interfaces, FixReplacement/RuleFixer. |
| config | RuleConfig, RulesConfigBase, mergeRuleConfigs, getSeverity. |
| ast-helpers | TypeScript-compiler helpers: parseFile (cached), visit, getLineNumber, matchCallExpression, getFirstStringArg, isInsideCallOf, clearSourceFileCache. |
| project-root | findProjectRoot (walks up to the consumer repo root). |
| engine | FileDomain, EngineGroup, runChecks, RunChecksOptions, discoverFiles/categorizeChangedFiles/walkDir/matchesPattern/getFilesForRule/scopeToSrcRoot/filterActiveRules. |
| reporter | printReport, printJsonReport, buildJsonReport (+ ReporterOptions, SeverityFilter, GroupByMode, RuleNameResolver). |
The engine is domain-parameterized
runChecks(projectRoot, config, domain, groups, options) is checker-agnostic.
Each checker supplies:
- a
FileDomain— which file-category keys exist, how a path buckets into them, how files group into report sections, plus any rule/file applicability filtering (e.g. the test checker's--type integration|unit); - an array of
EngineGroups — a rule set plus how to invoke it (grep passeslines; AST/cross-file are guarded; a group can augment the context).
typescript is a peer dependency, so the consumer repo's compiler is used.
nx test tgo-checker-core
nx build tgo-checker-core