Skip to content

Add observability to import-boundary CLI (verbose flag, scan summary, unresolved-import diagnostics) #5

Description

@coderabbitai

Background

PR #3 introduced scripts/lint-import-boundaries.ts as the CLI wrapper for import-boundary enforcement. The checker currently produces output only when violations are found and provides no operation-context logging, scan statistics, or visibility into unresolved imports.

Requested work

Extend the CLI to support maintainer observability:

  1. Scan start/end logging — emit a structured message when scanning begins and completes (file count, duration).
  2. Summary statistics — report total files scanned, violations found, and unresolved imports encountered.
  3. --verbose flag — when passed, emit per-file resolution detail and unresolved-import diagnostics to stderr.
  4. Unresolved-import diagnostics — when an import specifier cannot be resolved to a known source file, emit a diagnostic (currently silent).

All new output must be written to stderr only and must not affect the exit-code contract (0 = clean, 1 = violations).

Acceptance criteria

  • bun run lint:imports --verbose emits scan context and per-file details.
  • Unresolved imports are surfaced as warnings, not errors.
  • Existing main() dependency-injection interface (LintImportBoundaryDependencies) is preserved and extended where necessary.
  • Tests cover the new output paths.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions