Skip to content

feat: add outline CLI shell#2700

Merged
HerringtonDarkholme merged 1 commit into
mainfrom
outline-cli-shell
Jun 11, 2026
Merged

feat: add outline CLI shell#2700
HerringtonDarkholme merged 1 commit into
mainfrom
outline-cli-shell

Conversation

@HerringtonDarkholme

@HerringtonDarkholme HerringtonDarkholme commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • add the public sg outline CLI shell and documented options
  • wire outline to shared input/color/json CLI argument conventions
  • keep runtime behavior as a placeholder nothing found for this slice
  • expand CLI parser coverage for the outline command contract

Verification

  • cargo fmt --check
  • cargo test -p ast-grep --lib test_cli
  • cargo check -p ast-grep
  • cargo clippy -p ast-grep --all-targets -- -D warnings

Summary by CodeRabbit

  • New Features

    • Expanded outline CLI options: language selection, multiple JSON formats (compact/stream), color control, item/type filtering, name matching, public-member filtering, multiple view modes, stdin/language handling, follow/no-ignore/globs/threads.
  • Tests

    • Broadened test matrix covering many valid and invalid outline argument combinations and validations.
  • Bug Fixes

    • Standardized output when no outline items are found (now prints "nothing found").

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: ddb0e5d5-cce5-4cc1-a723-d6998e3b3147

📥 Commits

Reviewing files that changed from the base of the PR and between 806143c and c0c223c.

📒 Files selected for processing (2)
  • crates/cli/src/lib.rs
  • crates/cli/src/outline.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/cli/src/lib.rs
  • crates/cli/src/outline.rs

📝 Walkthrough

Walkthrough

Refactors the outline subcommand into a typed, clap-driven CLI (language, JSON/color, filtering, views, input args), stubs run_outline to print a placeholder, and expands tests to cover many valid option matrices and invalid-argument cases.

Changes

Outline CLI expansion

Layer / File(s) Summary
Modules and CLI enums
crates/cli/src/outline.rs
Adds model/rule module declarations and defines OutlineItems/OutlineView clap enums for typed parsing.
OutlineArg expanded options
crates/cli/src/outline.rs
Replaces paths: Vec<PathBuf> with a clap OutlineArg exposing lang, json, color, items, symbol_type, match_item, pub_members, view, and flattened InputArgs.
run_outline placeholder behavior
crates/cli/src/outline.rs
run_outline now ignores the argument and prints nothing found while returning ExitCode::SUCCESS.
Expanded outline tests
crates/cli/src/lib.rs
test_outline rewritten to validate many successful outline invocations (JSON variants, color, items/type filtering, match, pub-members, multiple views, stdin+lang, follow/no-ignore, globs, threads) and added invalid-argument cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ast-grep/ast-grep#2687: Modifies crates/cli/src/outline.rs changing OutlineArg shape and run_outline stub behavior at the CLI entrypoint.
  • ast-grep/ast-grep#2689: Also updates the outline subcommand shape and argument-parsing tests in crates/cli/src/lib.rs.
  • ast-grep/ast-grep#2688: Alters test_outline assertions and handling of the unimplemented outline command.

Poem

🐰 I nibble flags and hop through code,
enums sprout where options grow,
JSON, color, views to try,
tests tumble under a vast sky,
a rabbit cheers: "Parse on, let's go!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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 'feat: add outline CLI shell' accurately summarizes the main change: adding the outline CLI command structure with its options and shell implementation.
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-shell

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 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.51%. Comparing base (b0cee36) to head (c0c223c).

Files with missing lines Patch % Lines
crates/cli/src/outline.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2700      +/-   ##
==========================================
+ Coverage   86.50%   86.51%   +0.01%     
==========================================
  Files         119      119              
  Lines       20342    20367      +25     
==========================================
+ Hits        17596    17620      +24     
- Misses       2746     2747       +1     

☔ 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.

Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs
Comment thread crates/cli/src/outline.rs
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
Comment thread crates/cli/src/outline.rs Outdated
@HerringtonDarkholme
HerringtonDarkholme added this pull request to the merge queue Jun 11, 2026
Merged via the queue into main with commit fa8fe4c Jun 11, 2026
6 checks passed
@HerringtonDarkholme
HerringtonDarkholme deleted the outline-cli-shell branch June 11, 2026 21:35
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