Skip to content

Fix #648: Wire TsconfigResolver in CLI commands#675

Open
kishansaaai wants to merge 1 commit into
repowise-dev:mainfrom
kishansaaai:fix-648-tsconfig-cli
Open

Fix #648: Wire TsconfigResolver in CLI commands#675
kishansaaai wants to merge 1 commit into
repowise-dev:mainfrom
kishansaaai:fix-648-tsconfig-cli

Conversation

@kishansaaai

@kishansaaai kishansaaai commented Jul 3, 2026

Copy link
Copy Markdown

Summary

This PR fixes the false-positive unreachable_file reports for TS/JS projects using path aliases (like @/components) in CLI commands.

The root cause was that TsconfigResolver was only being wired up during the pipeline ingestion phase. Any CLI command that rebuilt the graph in-memory without this phase (such as dead-code, health, and workspace) would fail to resolve aliases, leaving valid targets with in_degree=0.

Changes:

  • Extracted wire_tsconfig_resolver helper function in repowise.core.ingestion.tsconfig_resolver.
  • Refactored repowise/core/pipeline/phases/ingestion.py to use the shared helper.
  • Added resolver wiring calls right before graph_builder.build() in dead_code_cmd.py, health_cmd.py, and workspace_cmd.py.

Related Issues

Fixes #648

Test Plan

  • Tests pass (pytest)
  • Lint passes (ruff check .)
  • Web build passes (npm run build) (if frontend changes)

Added a dedicated regression test (test_tsconfig_cli_repro.py) that mimics the CLI command's in-memory graph rebuild with a mock @/* alias to ensure it properly connects to its target and suppresses the false unreachability finding.

Checklist

  • My code follows the project's code style
  • I have added tests for new functionality
  • All existing tests still pass
  • I have updated documentation if needed

@repowise-bot

repowise-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

✅ Health: 7.6 (unchanged)
5 hotspots · 5 hidden couplings · 5 with fix history · 1 dead-code finding

⚠️ Change risk: moderate (riskier than 41% of this repo's commits · raw 8.4/10)
This change's risk is driven by:

  • more lines added than baseline
  • more scattered than baseline

🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)

🔥 Hotspots touched (5)
  • .../commands/dead_code_cmd.py — 7 commits/90d, 2 dependents · primary owner: Raghav Chamadiya (94%)
  • .../commands/workspace_cmd.py — 11 commits/90d, 7 dependents · primary owner: Raghav Chamadiya (97%)
  • .../ingestion/tsconfig_resolver.py — 4 commits/90d, 4 dependents · primary owner: Raghav Chamadiya (97%)
2 more
  • .../commands/health_cmd.py — 14 commits/90d, 3 dependents · primary owner: Raghav Chamadiya (99%)
  • .../phases/ingestion.py — 7 commits/90d, 3 dependents · primary owner: Swati Ahuja (51%)
🔗 Hidden coupling (2 files)
  • .../commands/workspace_cmd.py co-changes with these files (not in this PR):
    • docs/CLI_REFERENCE.md (5× — 🟢 routine)
    • .../routers/workspace.py (4× — 🟢 routine)
  • .../commands/health_cmd.py co-changes with these files (not in this PR):
    • .../health/engine.py (5× — 🟢 routine)
    • docs/CODE_HEALTH.md (5× — 🟢 routine)
    • .../refactoring/__init__.py (4× — 🟢 routine)
💀 Dead code (1 finding)
  • 💀 .../phases/ingestion.py _parse_one (confidence 0.65)

📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-03 20:27 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

@swati510

swati510 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

The dead-code and health wirings are in place. Those are two of the three CLI commands that build a GraphBuilder, and both read include_submodules/include_nested_repos from state before the call.

The blocker is the third site. workspace_cmd.py:685 passes include_submodules=… and include_nested_repos=… to _generate_docs_for_added_repo, and that function takes neither parameter. It raises NameError and crashes repowise workspace add for every repo. The error fires before the TS-language guard, so even non-TS repos hit it. That function never resolved those flags, so calling wire_tsconfig_resolver(graph_builder, repo_path) with the defaults matches its existing behavior.

A test that invokes the workspace path would catch this. The current regression test only exercises the helper on its own. Once that's fixed and green, this is ready.

@repowise-bot repowise-bot Bot added repowise:hotspot Repowise: touches a temporal hotspot file repowise:risk-medium Repowise: change-risk elevated for this repo's history labels Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

repowise:hotspot Repowise: touches a temporal hotspot file repowise:risk-medium Repowise: change-risk elevated for this repo's history

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] dead-code, health, and workspace CLI commands report false-positive unreachable files for TS/JS projects using @/ path aliases

2 participants