Skip to content

feat: add native coverage, audit, duplication, and SAST gates - #19

Merged
SynthLuvr merged 2 commits into
mainfrom
feat/quality-gates
Aug 5, 2026
Merged

SynthLuvr merged 2 commits into
mainfrom
feat/quality-gates

Conversation

@SynthLuvr

Copy link
Copy Markdown
Owner

Summary

Adds the four quality gaps — coverage, SCA (dependency audit), SAST, and code duplication — natively, using the existing pnpm + vitest + oxlint stack. No new quality-tool binary, no second config system.

This came out of evaluating LucidShark: every capability it adds is achievable with tools this template already uses, so this keeps the stack lean.

Changes

  • vitest.config.ts — v8 coverage with an 80% threshold (statements/branches/functions/lines). Gated via test (vitest run --coverage); test:watch stays clean.
  • package.json
    • test → vitest run --coverage (coverage gate)
    • lint:audit → pnpm audit --prod (production dependency vulnerability scan)
    • lint:duplicates → jscpd (duplication gate, 5% threshold)
    • both wired into the lint aggregate
    • new devDeps: @vitest/coverage-v8, jscpd
  • .oxlintrc.json — enable 6 security-oriented rules (verified passing on current code): no-eval, no-implied-eval, no-new-func, no-unsafe-finally, no-unsafe-negation, no-unsafe-optional-chaining
  • .gitignore — ignore generated coverage/ and report/ so biome check . stays green after a local test run (biome uses vcs.useIgnoreFile)

Why these thresholds

  • Coverage 80% — current code is at 100%; 80% is a conventional floor.
  • Duplication 5% — current code is 0%; flags meaningful copy-paste without noise.
  • pnpm audit --prod — gates shipped (production) vulnerabilities; avoids breaking CI on dev-only transitive advisories.

Verification

  • pnpm build, pnpm lint, pnpm test all pass (true exit codes).
  • Gate is idempotent: pnpm lint stays green even when coverage/ exists (i.e. after running test then lint locally).
  • pnpm install --frozen-lockfile succeeds (CI parity).

Gap → native solution

Gap Native solution Where
Coverage vitest v8 + 80% threshold pnpm test
SCA (dep vulns) pnpm audit --prod pnpm lint
SAST oxlint security rules pnpm lint
Duplication jscpd 5% pnpm lint

Cover the four quality gaps (coverage, SCA, SAST, duplication) using the
existing pnpm/vitest/oxlint stack rather than adding a separate quality tool.

- vitest.config.ts: v8 coverage with an 80% threshold (Stmts/Branch/Funcs/Lines)
- package.json: `test` runs `vitest run --coverage`; add `lint:audit`
  (`pnpm audit --prod`) and `lint:duplicates` (jscpd, 5% threshold), wired
  into the `lint` aggregate; new devDeps @vitest/coverage-v8, jscpd
- .oxlintrc.json: enable security rules (no-eval, no-implied-eval, no-new-func,
  no-unsafe-finally, no-unsafe-negation, no-unsafe-optional-chaining)
- .gitignore: ignore generated coverage/ and report/ so biome check . stays
  green after a local test run

Verified: build, full lint, and test all pass; the gate is idempotent
(lint stays green even when coverage/ is present).
- Tech Stack: add @vitest/coverage-v8 and jscpd
- Lint table: add lint:audit (pnpm audit --prod) and lint:duplicates (jscpd)
- Test: note that pnpm test enforces an 80% coverage threshold
- Quick Start: mention test runs coverage
@SynthLuvr
SynthLuvr merged commit 0137e68 into main Aug 5, 2026
1 check passed
@SynthLuvr
SynthLuvr deleted the feat/quality-gates branch August 5, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant