Skip to content

apps/cli/src/links/index.ts is never called by production code #261

Closed

Description

@nc9

apps/cli/src/links/index.ts is 383 lines of link analysis that production code never calls.

Found while doing #1938 (public #260). Checking which PageAudit fields had readers, page.links appeared to have one — this module — which is what stopped me dropping links on the first pass. It turned out the module itself is unreachable.

What is there

Five exported functions: extractEnhancedLinks, analyzeInternalLinks, analyzeAnchorText, validateInternalLinks, validateAnchorText. They compute link equity, crawl depth, orphan detection, anchor-text quality and internal-link validation.

Every reference to any of them, across apps/cli/src and packages/, is in apps/cli/tests/link-analysis.test.ts (407 lines). Nothing imports @/links outside that test. The other links hits in the tree are unrelated modules: packages/parser/src/extractors/links, packages/rules/src/links and packages/rules/src/links/redirects.

The types it uses (EnhancedLinkData, InternalLinkAnalysis, AnchorTextAnalysis) are declared in apps/cli/src/types.ts and are likewise only reachable through this module.

Why it matters beyond the line count

790 lines of source and tests that pass, are maintained, and shape decisions about code that ships. It cost real time on #1938: the module is the only reason page.links looked load-bearing, and it takes a while to be sure that a well-tested module with a plausible name is not wired to anything.

The link analysis a report actually surfaces comes from the rules in packages/rules/src/links, which are unrelated to this.

Worth deciding rather than assuming

Whether this was meant to ship and was never wired up, or was superseded by the links rules. git log on it shows only incidental touches — a case-insensitivity fix and a security hardening pass — so nothing here says it was deliberately parked. If the analysis is wanted, wiring it up is a different piece of work from deleting it, and either way the current state should not persist.

Acceptance Criteria

  • Established whether the analysis is wanted: either wired into a surface that renders it, or removed
  • If removed, apps/cli/src/links/index.ts and apps/cli/tests/link-analysis.test.ts are gone, along with the types in apps/cli/src/types.ts that nothing else uses
  • PageAudit.links is either populated again because something reads it, or stays unpopulated as feat(report): add cacheStats to audit JSON when pages were reused (repo#1981) #1938 left it
  • The CLI typechecks and its suites pass with no remaining reference
  • The report's own link findings, from the rules in packages/rules/src/links, are unaffected

Activity

  1. added
    P3
    size: XS
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3choresize: XS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions