Skip to content

refactor: map outline cli to core options#2747

Merged
HerringtonDarkholme merged 1 commit into
mainfrom
outline-cli-core-options
Jun 20, 2026
Merged

refactor: map outline cli to core options#2747
HerringtonDarkholme merged 1 commit into
mainfrom
outline-cli-core-options

Conversation

@HerringtonDarkholme

@HerringtonDarkholme HerringtonDarkholme commented Jun 19, 2026

Copy link
Copy Markdown
Member

Stacked on #2746.\n\nThis PR maps CLI outline item/view/member settings into core outline extractor options and keeps regex matching in the CLI layer.

Summary by CodeRabbit

  • Refactor
    • Restructured outline command's option handling and extractor initialization to improve internal consistency and code organization.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8a9ed1cd-a9b8-4018-91f2-5f287bc16e8f

📥 Commits

Reviewing files that changed from the base of the PR and between 0af4b77 and ac0c535.

📒 Files selected for processing (3)
  • crates/cli/src/outline.rs
  • crates/cli/src/outline/extract.rs
  • crates/cli/src/outline/options.rs

📝 Walkthrough

Walkthrough

OutlineTextOptions gains a to_extractor_options method that maps CLI flag values into OutlineExtractorOptions. This result is now computed before OutlineExtractors::try_from, whose signature is updated to accept &OutlineExtractorOptions and forward it to CombinedExtractors. Per-item filtering in extract switches from matches_item_filters to matches_item_matcher.

Changes

Outline extractor options wiring

Layer / File(s) Summary
OutlineTextOptions::to_extractor_options and matches_item_matcher
crates/cli/src/outline/options.rs
Imports four new ast_grep_outline types. Adds to_extractor_options that maps resolved items/view/pub_members/item_matcher flags into an OutlineExtractorOptions. Replaces matches_item_filters with matches_item_matcher that checks item_matcher against entry.name and entry.signature.
OutlineExtractors signature and run_outline wiring
crates/cli/src/outline/extract.rs, crates/cli/src/outline.rs
OutlineExtractors::try_from gains an &OutlineExtractorOptions parameter forwarded (via clone) to CombinedExtractors::try_from_rules. extract switches to matches_item_matcher via filter_map. run_outline builds OutlineTextOptions first, then passes derived extractor options into OutlineExtractors::try_from.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • ast-grep/ast-grep#2745: Introduces OutlineExtractorOptions and OutlineFlagFilter types that this PR wires into the CLI extraction path.
  • ast-grep/ast-grep#2746: Adds option-aware rule compilation and member/item retention inside CombinedExtractors::try_from_rules and extract, which this PR now drives with the forwarded OutlineExtractorOptions.
  • ast-grep/ast-grep#2729: Refactors CombinedExtractors traversal and member extraction, the same types this PR threads options through.

Poem

🐇 Hop, hop, options in a row,
Extract the items, put on a show,
to_extractor_options leads the way,
Matcher replaces filter today,
The outline pipeline follows the flow! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main refactoring work: mapping outline CLI options to core options, which aligns with the PR's primary objective of separating CLI configuration from core extractor logic.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch outline-cli-core-options

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-cli-core-options branch from f9f2628 to 9664406 Compare June 19, 2026 21:18
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-apply-options branch 2 times, most recently from 2a223f8 to fe4c03d Compare June 19, 2026 21:30
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-cli-core-options branch 2 times, most recently from f79bb37 to 1e4d57f Compare June 19, 2026 21:43
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-apply-options branch 2 times, most recently from 2a60763 to 6c3b8f7 Compare June 19, 2026 21:56
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-cli-core-options branch 2 times, most recently from 3a59fd6 to 21df176 Compare June 19, 2026 22:02
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-cli-core-options branch from 21df176 to cb4c900 Compare June 19, 2026 22:08
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-apply-options branch 2 times, most recently from 5d22507 to 5e9cffe Compare June 19, 2026 22:13
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-cli-core-options branch from cb4c900 to 8fd54fe Compare June 19, 2026 22:13
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-cli-core-options branch from 8fd54fe to 8aafd68 Compare June 19, 2026 22:31
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-apply-options branch 2 times, most recently from 715a85f to 7181af6 Compare June 19, 2026 22:58
Base automatically changed from outline-apply-options to main June 20, 2026 04:05
@HerringtonDarkholme
HerringtonDarkholme force-pushed the outline-cli-core-options branch from 8aafd68 to ac0c535 Compare June 20, 2026 04:13
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.03%. Comparing base (0af4b77) to head (ac0c535).

Files with missing lines Patch % Lines
crates/cli/src/outline/options.rs 0.00% 29 Missing ⚠️
crates/cli/src/outline/extract.rs 0.00% 6 Missing ⚠️
crates/cli/src/outline.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2747      +/-   ##
==========================================
- Coverage   86.08%   86.03%   -0.05%     
==========================================
  Files         126      126              
  Lines       22347    22359      +12     
==========================================
  Hits        19237    19237              
- Misses       3110     3122      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@HerringtonDarkholme
HerringtonDarkholme added this pull request to the merge queue Jun 20, 2026
Merged via the queue into main with commit 8120aff Jun 20, 2026
4 of 6 checks passed
@HerringtonDarkholme
HerringtonDarkholme deleted the outline-cli-core-options branch June 20, 2026 14:30
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