Skip to content

feat: AI-powered smart import detection for multi-language PRs#23

Merged
oddur merged 1 commit intomainfrom
feat/smart-imports
Feb 20, 2026
Merged

feat: AI-powered smart import detection for multi-language PRs#23
oddur merged 1 commit intomainfrom
feat/smart-imports

Conversation

@oddur
Copy link
Copy Markdown
Owner

@oddur oddur commented Feb 20, 2026

Summary

  • Adds a "Smart imports" toggle that uses Claude Haiku to detect local file imports across all languages (C#, Rust, Python, Go, etc.), replacing the regex-only ES6 parser when enabled
  • Existing regex behavior is preserved as the default — new path is opt-in via toggle
  • Shows neighbor file count on the overview slide when files are found

How it works

  • callClaudeQuick() in lib/agent.ts — lightweight, non-streaming CLI helper
  • extractImportsWithClaude() in lib/github.ts — sends changed file contents to Haiku with a system prompt that returns a JSON array of repo-relative import paths
  • getNeighborFiles accepts a useSmartImports flag; when false, existing regex logic runs unchanged

Test plan

  • Toggle OFF: generate review for JS/TS PR — confirm same behavior as before
  • Toggle ON: generate review for C# PR — confirm neighbor files contain .cs files
  • Toggle ON: generate review for JS/TS PR — confirm it still works
  • Verify overview slide shows "{N} additional files included for context"
  • Verify logs show Claude's detected imports and fetched neighbor files

…or files

Use Claude Haiku via the CLI to identify local imports across all languages
(C#, Rust, Python, Go, etc.) instead of only regex-based ES6 import parsing.

- Add `callClaudeQuick()` helper for non-streaming CLI calls
- Add `extractImportsWithClaude()` with a focused system prompt
- Gate behind `smartImports` toggle (off by default, existing regex preserved)
- Show neighbor file count on overview slide
- Add "Smart imports" toggle to HomePage (Experimental badge)

+semver: minor
@oddur oddur merged commit 7a93582 into main Feb 20, 2026
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