Skip to content

CM-77192: Add Project/Diff/File scan scope - #103

Merged
omer-roth merged 4 commits into
cycodehq:mainfrom
aaron-butler-cy-int:CM-77192-scan-scope
Nov 25, 2026
Merged

omer-roth merged 4 commits into
cycodehq:mainfrom
aaron-butler-cy-int:CM-77192-scan-scope

Conversation

@aaron-butler-cy-int

@aaron-butler-cy-int aaron-butler-cy-int commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add a scan scope selector (Project / Diff / File) to the Cycode tool window, ported from the VS Code extension (CM-73887).
  • Diff scans only the changes between two revisions (branch, tag, commit) or between a revision and the local directory. Commit ranges use the merge base and full SHAs. IaC does not support diffs and falls back to a full project scan, and the UI says so. Diff is disabled outside a git repository. With a custom CLI older than 3.25.0 (automatic CLI management off) the plugin shows one notification asking to upgrade or re-enable it.
  • File scans the file open in the editor.
  • The scope is saved per project; the selected revisions are session-only.
  • Require Cycode CLI 3.25.0, which provides pre-commit --base-ref/--include-unstaged/--path (CM-72985).
  • The foojay toolchain resolver is bumped to 1.0.0 so the build works on Gradle 9.

This PR was split after review. It now holds only the scan scope core. The follow-ups are separate PRs that build on this one:

  • Tool window polish (spinners, Scan all, collapsible and dock-aware layout, close button, results stay expanded).
  • The "Open vulnerabilities in an editor tab" setting.

Review changes included here: DiffSide instead of a sentinel string, a DiffRefsService split out of ScanScopeService, GitRepository renamed to GitCli, and no rewrite of the saved scope when the CLI is too old.

Jira

CM-77192, related to CM-73887

Testing

  • Unit tests pass (./gradlew test): real temporary git repos for commit ranges and revision lists, the diff scan planner, argument builders, the planner refusals and file support rules.
  • Not run yet: a real end-to-end diff scan against CLI 3.25.0+.

Not done

  • Revision lists are rebuilt each time the Diff scope is selected or the tab is rebuilt, but not live while the tab stays open. Live refresh with Git4Idea and the UI DSL rewrite of the tab are tracked in CM-79606.
  • Vulnerabilities outside the scanned path are not filtered.

🤖 Generated with Claude Code

@omer-roth omer-roth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed for DRY / KISS / YAGNI / SOLID. Inline comments are tagged by severity: 1 Blocker, 5 High, 9 Medium. Low/nit items are left out.

The main ask (Blocker): split this PR into scan scope core, tool window UI polish and the editor tab setting. Several High/Medium items go away once the polish is out.

🤖 Generated with Claude Code

aaron-butler-cy-int and others added 2 commits November 9, 2026 09:26
Add a scan scope selector (Project, Diff and File) to the Cycode tool window,
ported from the VS Code extension (CM-73887).

- Diff scans the changes between two revisions or a revision and the local
  directory (commit ranges use the merge base and full SHAs); IaC falls back
  to a full project scan; Diff needs a git repository and CLI 3.25.0 or later
- File scans the file open in the editor
- The scope is persisted per project, the revisions are session-only
- Require Cycode CLI 3.25.0 (CM-72985)
- Bump the foojay toolchain resolver to 1.0.0 for Gradle 9

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- DiffSide (Local or Rev) replaces the NUL-prefixed sentinel string, so the
  compiler enforces the local-directory special case
- DiffRefsService owns the repository state, the selected sides and the
  cached revision lists; ScanScopeService keeps the scope and the dispatch
- Rename GitRepository to GitCli so it does not clash with
  git4idea.repo.GitRepository

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…eck custom CLI version once

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@omer-roth omer-roth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked at 3ce33c8 for DRY / KISS / YAGNI / SOLID (medium and above). Four new findings plus one docs leftover, inline. The status of the earlier threads is in replies on each thread.

Comment thread README.md Resolved

@omer-roth omer-roth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 70adef4. All DRY / KISS / YAGNI / SOLID threads are fixed, moved to #105, or tracked in CM-79606.

Before merging, please run one manual end-to-end check against CLI 3.25.0+ (the PR's Testing section says this hasn't been run yet). The unit tests check the arguments we build, not that the CLI accepts them or that the results show up:

  1. Diff, Local directory vs HEAD (pre-commit --include-unstaged --base-ref ... --path ...): the findings appear in the tool window.
  2. Diff, branch A vs branch B (commit-history --commit-range <merge-base>..<tip>): only the changes in that range are reported.
  3. File scope on an unsupported file type for SCA/IaC: the "not supported for the open file" notification is shown.

Please post the results here, or note any issue you find.

@omer-roth
omer-roth merged commit 3cd8f8e into cycodehq:main Nov 25, 2026
8 checks passed
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.

2 participants