Skip to content

refactor: split outline extract options and style#2748

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

refactor: split outline extract options and style#2748
HerringtonDarkholme merged 1 commit into
mainfrom
outline-cli-options-style

Conversation

@HerringtonDarkholme

@HerringtonDarkholme HerringtonDarkholme commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an extraction-time item filter option (item_regex) to include only items whose name or signature matches a provided regex.
  • Refactor

    • Streamlined outline extraction and output rendering by consolidating configuration into unified extraction and style settings, and simplifying how items are emitted across stdin and path streaming modes.
  • Tests

    • Updated outline rendering and emitter tests to use the new unified style and extraction configuration flow.

@coderabbitai

coderabbitai Bot commented Jun 20, 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: e8073279-145a-46e6-a7ce-961246aae238

📥 Commits

Reviewing files that changed from the base of the PR and between 01a84e3 and 02a99e6.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • crates/cli/src/outline.rs
  • crates/cli/src/outline/extract.rs
  • crates/cli/src/outline/options.rs
  • crates/cli/src/outline/output.rs
  • crates/cli/src/outline/output/tests.rs
  • crates/outline/Cargo.toml
  • crates/outline/src/options.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • crates/cli/src/outline.rs
  • crates/cli/src/outline/output.rs
  • crates/cli/src/outline/options.rs
  • crates/cli/src/outline/output/tests.rs

📝 Walkthrough

Walkthrough

The PR splits OutlineTextOptions into two focused types: OutlineExtractOptions (holding extractor config and show_empty_files) and OutlineStyle (holding OutlineView and OutlineTextStyle). The core outline library gains regex-based item filtering capability. All pipeline stages—option parsing, extraction, filtering, emission, and tests—are updated to use the new types.

Changes

Outline options split into extract and style types

Layer / File(s) Summary
OutlineExtractOptions and OutlineStyle definitions
crates/cli/src/outline/options.rs, crates/cli/src/outline/output.rs, crates/outline/Cargo.toml
OutlineExtractOptions replaces OutlineTextOptions with try_from_arg constructor; OutlineStyle bundles view and text. OutlineEmitter drops its lifetime and stores style: OutlineStyle. Removes matches_item_matcher and to_extractor_options. Adds regex workspace dependency.
Item regex filtering in core outline library
crates/outline/src/options.rs
OutlineExtractorOptions gains item_regex: Option<Regex> field and filters items at extraction time via keep_item. Adds matches_item_regex helper and test coverage.
Extraction pipeline updated
crates/cli/src/outline/extract.rs
OutlineExtractors::extract, extract_stdin, stream_paths, extract_path_or_report, and extract_path switch to &OutlineExtractOptions parameter type; removes per-item options parameter from extraction.
run_outline wiring updated
crates/cli/src/outline.rs
Builds extract_options and style from arg, constructs OutlineExtractors from extract_options.extractor (cloned), initializes OutlineEmitter with style, and routes &extract_options into stdin and streaming paths.
Output tests updated to OutlineStyle helpers
crates/cli/src/outline/output/tests.rs
New style()/color_style() helpers replace the prior options() helper; all print_text_to and OutlineEmitter::new call sites are updated.

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ast-grep/ast-grep#2738: Introduced the initial outline CLI command whose OutlineTextOptions/OutlineTextStyle types are directly replaced by this PR's new OutlineExtractOptions and OutlineStyle.
  • ast-grep/ast-grep#2745: Introduced OutlineExtractorOptions that OutlineExtractOptions::extractor now wraps and exposes throughout the CLI pipeline.
  • ast-grep/ast-grep#2747: Refactors the same outline.rs and outline/extract.rs wiring that this PR builds upon, introducing per-item matcher logic that this PR consolidates into OutlineExtractorOptions item filtering.

Poem

🐇 Hoppy refactor day!
Old TextOptions hopped away,
ExtractOptions took the lead,
OutlineStyle planted the seed.
Now the pipeline flows just right—
Every item filtered bright! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% 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 accurately summarizes the main refactoring work: splitting outline options into extract-specific and style-specific components.
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-options-style

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.

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 35.96491% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.07%. Comparing base (27c618b) to head (02a99e6).

Files with missing lines Patch % Lines
crates/cli/src/outline/options.rs 0.00% 53 Missing ⚠️
crates/cli/src/outline.rs 0.00% 8 Missing ⚠️
crates/cli/src/outline/extract.rs 0.00% 6 Missing ⚠️
crates/cli/src/outline/output.rs 76.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2748      +/-   ##
==========================================
- Coverage   86.08%   86.07%   -0.02%     
==========================================
  Files         126      126              
  Lines       22328    22355      +27     
==========================================
+ Hits        19221    19242      +21     
- Misses       3107     3113       +6     

☔ 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 force-pushed the outline-cli-options-style branch from 01a84e3 to 02a99e6 Compare June 20, 2026 19:09
@HerringtonDarkholme
HerringtonDarkholme added this pull request to the merge queue Jun 20, 2026
Merged via the queue into main with commit eaa82c4 Jun 20, 2026
4 of 6 checks passed
@HerringtonDarkholme
HerringtonDarkholme deleted the outline-cli-options-style branch June 20, 2026 19:16
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