Skip to content

Add root --skill flag printing the bundled skill text - #15264

Open
schacon wants to merge 1 commit into
masterfrom
but-skill-flag
Open

Add root --skill flag printing the bundled skill text#15264
schacon wants to merge 1 commit into
masterfrom
but-skill-flag

Conversation

@schacon

@schacon schacon commented Aug 10, 2026

Copy link
Copy Markdown
Member

but --skill writes the bundled base skill text (SKILL.md) to stdout and exits, so agents can load the GitButler skill into context directly (e.g. but --skill >> prompt.md) without installing skill files first.

What changed

  • New root-only --skill flag on Args. It short-circuits right after argument parsing, like --version: but --skill prints the skill even if a subcommand follows, and but status --skill is rejected since the flag is not global.
  • The output reuses the installer's prepare_skill_content path via a new command::skill::base_skill_text(), so the CLI version is injected into the frontmatter exactly as but skill install writes it, and the embedded file is UTF-8 validated.
  • Output is raw stdout — no pager, truncation, or output-channel formatting — so it pipes cleanly.
  • but skill --help long help now cross-references but --skill for discoverability.

Decisions

  • Only SKILL.md is printed, not the references/ files; the flag targets bootstrap/context-loading, where the base skill is the entry point.
  • The bundled skill docs themselves don't mention the flag: an agent that already has the skill installed has no use for printing it.

Testing

Integration test asserts but --skill output equals the embedded SKILL.md with the version swapped in, deriving the expected version from but --version so it holds for both dev and release builds.

but --skill writes SKILL.md (with the CLI version injected) to stdout and
exits, like --version, so agents can load the base skill without installing
it. Also cross-referenced from the but skill command help.
Copilot AI lite review requested due to automatic review settings August 10, 2026 13:30
@cursor

cursor Bot commented Aug 10, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@github-actions github-actions Bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Aug 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new root-only --skill flag to the but CLI that prints the bundled SKILL.md (with the CLI version injected) to stdout and exits, enabling agents/users to easily load the GitButler skill text into context via piping/redirection.

Changes:

  • Added a new top-level --skill flag and short-circuit execution path to print the bundled base skill text and exit.
  • Exposed command::skill::base_skill_text() to reuse the existing skill content preparation/version-injection logic.
  • Added an integration test asserting but --skill output matches the bundled SKILL.md with the runtime --version injected, and updated but skill --help docs to reference the flag.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
crates/but/src/args/mod.rs Adds the root-only --skill flag and updates skill subcommand help text to reference it.
crates/but/src/lib.rs Implements early-exit behavior that prints the skill text when --skill is set.
crates/but/src/command/skill/mod.rs Introduces base_skill_text() to produce version-injected SKILL.md content for --skill.
crates/but/tests/but/command/skill.rs Adds an integration test validating but --skill output against the bundled SKILL.md with version injection.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/but/src/lib.rs
Comment on lines +284 to +288
// Like `--version`, `--skill` prints and exits without dispatching a subcommand.
if args.skill {
print!("{}", command::skill::base_skill_text()?);
return Ok(());
}
@krlvi

krlvi commented Aug 10, 2026

Copy link
Copy Markdown
Member

Since we already have a but skill command, how about this being but skill show?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants