Architecture
A small TypeScript ESM CLI and library. No backend, no database — state lives in the scanned repository.
Data flow
The CLI orchestrates scan, fix, and init. The scanner talks to an ecosystem adapter and an advisory provider. Remediation planning is pure. Apply mutates files, then rescans. Optional AI only enriches already-confirmed findings.
Layout
src/
cli.ts commands.ts scanner.ts config.ts output.ts
cli/ # style + progress UI (zero-dep)
core/ # types + errors (incl. FixResult)
ecosystems/ # EcosystemAdapter (npm today)
advisories/ # AdvisoryProvider (OSV today)
remediation/ # planner + atomic apply
ai/ # optional explanations
automation/ # GitHub workflow generation
templates/eridas.yml
eridas.schema.jsonAdapter contracts
EcosystemAdapter discovers a dependency inventory from a project path. v0.1 ships npm lockfile support.
AdvisoryProvider queries advisories for exact versions. v0.1 ships OSV with batching, timeouts, retries, and response validation.
AI is intentionally not an advisory provider. It cannot create findings or choose versions.
Domain types
| Type | Role |
|---|---|
| Dependency | Installed package identity + paths |
| Advisory | Normalized OSV advisory |
| Finding | Dependency + advisory (+ optional AI) |
| ScanResult | Versioned scan report (schemaVersion: 1) |
| RemediationPlan | Planned changes + unresolved findings |
| ApplyResult | Whether changes applied + post-rescan |
Testing
| Area | Location |
|---|---|
| Lockfile parsing | test/npm-lockfile.test.ts |
| OSV client | test/osv.test.ts |
| Planner / apply / rollback | test/remediation-*.test.ts |
| AI isolation | test/ai.test.ts |
| Workflow generation | test/automation.test.ts |
| End-to-end with mocks | test/integration.test.ts |