Skip to content

bug: branch-compare command and programmatic API crash — missing branch-compare.js #166

@carlos-alm

Description

@carlos-alm

Found during dogfooding v2.5.0

Severity: Critical
Command: codegraph branch-compare main HEAD and import('@optave/codegraph')

Reproduction

npm init -y && npm install @optave/codegraph@2.5.0
npx codegraph branch-compare main HEAD
# ERR_MODULE_NOT_FOUND: Cannot find module '.../src/branch-compare.js'

node --input-type=module -e "import('@optave/codegraph').then(m => console.log(Object.keys(m))).catch(e => console.error(e.code))"
# ERR_MODULE_NOT_FOUND

Expected behavior

  • branch-compare should either work or not be registered as a CLI command
  • import('@optave/codegraph') should return the programmatic API without crashing

Actual behavior

  1. branch-compare crashes with ERR_MODULE_NOT_FOUND — the file src/branch-compare.js does not exist in the source repo
  2. import('@optave/codegraph') crashes because src/index.js line 9 has a top-level re-export: export { branchCompareData, branchCompareMermaid } from './branch-compare.js'

The second issue is critical — it makes the entire programmatic API unusable.

Root cause

The branch-compare command was registered in cli.js and its exports added to index.js, but the implementation file src/branch-compare.js was never created/committed.

Suggested fix

Remove the branch-compare references from cli.js (lines 826–843) and index.js (line 9) until the implementation exists. The command definition in --help is misleading, and the index.js export makes the entire package unusable programmatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdogfoodFound during dogfooding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions