Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors duplicated helper logic across the codebase and updates the duplicates detector/CLI to emit grouped duplicate findings by default, with optional access to raw unit-pair suggestions.
Changes:
- Change duplicate detection output from flat
suggestionsto groupedgroups(with--raw-pairs/includeRawPairsto optionally include raw pairs). - Extract repeated helper utilities (Git test helpers, symlink availability checks, agent session counting, resolution candidate lookup, SQL lookup helpers, edge helpers, CLI project-file validation).
- Update docs, tests, and package scripts to match the new duplicates output and adjusted
npm testbehavior.
Reviewed changes
Copilot reviewed 64 out of 64 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/review.test.ts | Uses shared runGit test helper instead of inline Git spawning. |
| tests/project-file-discovery.test.ts | Uses shared isSymlinkUnavailable helper. |
| tests/package-metadata.test.ts | Adds coverage asserting npm test points at fast suite and bench remains opt-in. |
| tests/mcp-server.test.ts | Reuses shared agent and filesystem helpers. |
| tests/impact-streaming.test.ts | Switches to shared Git helper. |
| tests/impact-git-provider.test.ts | Switches to shared Git helper. |
| tests/impact-cli.test.ts | Switches to shared Git helper; removes spawnSync usage. |
| tests/helpers/git.ts | New shared Git helper for tests (spawn + consistent author/committer env). |
| tests/helpers/filesystem.ts | New shared symlink-unavailable detection helper. |
| tests/helpers/agent.ts | New shared counting AgentSession wrapper for tests. |
| tests/graph-delta.test.ts | Switches to shared Git helper. |
| tests/git-diff-semantics.test.ts | Switches to shared Git helper. |
| tests/duplicates.test.ts | Updates expectations to grouped duplicates output; adds new grouping/flag behavior tests. |
| tests/cli-regressions.test.ts | Switches to shared Git helper. |
| tests/cache-invalidation.test.ts | Switches to shared Git helper. |
| tests/artifact-build.test.ts | Reuses shared agent/filesystem helpers. |
| tests/agent-search.test.ts | Reuses shared agent/filesystem helpers. |
| tests/agent-explain.test.ts | Switches to shared Git helper. |
| src/util/workspace.ts | Refactors fileExists/directoryExists to a shared cached-stat helper. |
| src/util/resolutionCandidates.ts | Exports getResolutionExtensions for reuse. |
| src/util/resolution/phpComposer.ts | Uses shared findFirstExistingResolutionCandidate helper. |
| src/util/resolution/php.ts | Uses shared findFirstExistingResolutionCandidate helper. |
| src/util/resolution/node.ts | Uses shared findFirstExistingResolutionCandidate helper. |
| src/util/resolution/findFirstExisting.ts | New shared “first existing resolution candidate” helper. |
| src/util/resolution.ts | Uses shared getResolutionExtensions + shared “first existing candidate” helper. |
| src/util/projectFiles/parsers.ts | Uses shared isPlainRecord; factors assigned-string name parsing. |
| src/util/guards.ts | New shared isPlainRecord guard. |
| src/util/graphEdges.ts | New shared edge key/sort/relative conversion helpers. |
| src/sql/sourceGraph.ts | Uses shared SQL lookup push helper. |
| src/sql/review.ts | Uses shared SQL object lookup key helper. |
| src/sql/navigation.ts | Uses shared SQL lookup push helper. |
| src/sql/lookup.ts | New shared SQL object lookup key + Map-push helper. |
| src/sql/extractFacts.ts | Uses shared SQL object lookup key helper. |
| src/review/report.ts | Uses shared graph edge helpers instead of local duplicates. |
| src/review/deleted.ts | Uses shared graph edge helpers; removes local duplicates. |
| src/presets.ts | Uses shared isPlainRecord guard instead of local helper. |
| src/native/execution.ts | Consolidates “native unavailable” fallback construction. |
| src/languages/types.ts | Reuses JS fallback types (JsPoint/JsSyntaxNode) for Syntax*Like types. |
| src/languages/definitions/cpp.ts | Factors shared C-family declarator/query logic into shared module. |
| src/languages/definitions/cFamily.ts | New shared helpers for C/C++ definition logic. |
| src/languages/definitions/c.ts | Factors shared C-family declarator/query logic into shared module. |
| src/indexer/shared.ts | Re-exports shared graph edge helpers from util/graphEdges. |
| src/indexer/imports/languageSpecific.ts | Factors Java/Kotlin JVM import binding handling into shared helper. |
| src/index.ts | Exports new DuplicateGroup type from public API surface. |
| src/impact/reportShared.ts | New shared mapping helpers for full vs compact impact report projections. |
| src/impact/reportFull.ts | Uses shared mapping helpers to reduce duplication. |
| src/impact/reportCompact.ts | Uses shared mapping helpers to reduce duplication. |
| src/graphs/traversal.ts | Factors shared dependency traversal logic between forward and reverse walks. |
| src/duplicates.ts | Introduces grouped duplicate results, overlap clustering, and includeRawPairs. |
| src/cli/projectFile.ts | New shared CLI helper for project-root confined file args and error output. |
| src/cli/options.ts | Refactors integer option parsing to shared internal helpers. |
| src/cli/navigation.ts | Uses shared CLI project-file helper. |
| src/cli/help.ts | Updates duplicates help to describe grouped output + --raw-pairs. |
| src/cli/graphQueries.ts | Uses shared CLI project-file helper. |
| src/cli/duplicates.ts | Adds --raw-pairs flag plumbing to duplicate detection options. |
| src/cli/doctor.ts | Uses shared isPlainRecord guard. |
| src/agent/artifact.ts | Uses shared isPlainRecord guard; removes local record guard. |
| src/agent-tools.ts | Factors common dependency listing logic between deps/rdeps tools. |
| README.md | Updates duplicates workflow description and test command guidance. |
| package.json | Changes npm test to run the fast suite by default. |
| docs/superpowers/plans/2026-05-22-duplicate-refactor-checklist.md | Adds planning/checklist doc capturing the refactor + grouping goals. |
| docs/library-api.md | Updates library API docs to show grouped duplicates and includeRawPairs. |
| docs/cli.md | Updates CLI docs for grouped duplicates output and --raw-pairs. |
| codegraph-skill/codegraph/SKILL.md | Updates skill guidance to reflect grouped duplicates + --raw-pairs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.