Skip to content

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Jan 19, 2026

Summary

Add comprehensive doc comments to the main public API types to improve discoverability and IDE support.

Changes

  • SpecFlag: Document all fields (name, usage, help variants, short/long, required, deprecated, var, hide, global, count, arg, default, negate, env)
  • SpecArg: Document all fields (name, usage, help variants, required, double_dash, var, hide, default, choices, env)
  • SpecCommand: Document all fields (full_cmd, usage, subcommands, args, flags, mounts, deprecated, hide, subcommand_required, restart_token, help variants, name, aliases, hidden_aliases, before/after_help variants, examples, complete)

Each struct now includes:

  • A high-level description
  • A usage example demonstrating the builder pattern
  • Field-level documentation explaining purpose and behavior

Benefits

  • Better IDE hover documentation
  • Improved cargo doc output
  • Clearer API contract for library users

🤖 Generated with Claude Code


Note

Enhances public API documentation for core CLI spec types without changing behavior.

  • SpecArg, SpecFlag, SpecCommand: Add high-level descriptions, usage examples (builder pattern), and field-level docs (help variants, defaults, variadic/count behavior, env, deprecation, aliases, etc.)
  • Improves cargo doc output and IDE hover info across these structs

Written by Cursor Bugbot for commit 3aab606. This will update automatically on new commits. Configure here.

Add comprehensive doc comments to the main public API types:

- SpecFlag: CLI flag/option specification with field-level docs
- SpecArg: Positional argument specification with field-level docs
- SpecCommand: Command/subcommand specification with field-level docs

Each struct now includes:
- A description of what it represents
- A usage example with the builder pattern
- Documentation for each public field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 19, 2026 19:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive documentation to the main public API types (SpecFlag, SpecArg, and SpecCommand) to improve discoverability and IDE support. Each struct now includes a high-level description, usage examples demonstrating the builder pattern, and field-level documentation explaining purpose and behavior.

Changes:

  • Added struct-level and field-level documentation to SpecFlag
  • Added struct-level and field-level documentation to SpecArg
  • Added struct-level and field-level documentation to SpecCommand

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
lib/src/spec/flag.rs Added comprehensive documentation to SpecFlag struct including all fields (name, usage, help variants, short/long, required, deprecated, var, hide, global, count, arg, default, negate, env)
lib/src/spec/arg.rs Added comprehensive documentation to SpecArg struct including all fields (name, usage, help variants, required, double_dash, var, hide, default, choices, env)
lib/src/spec/cmd.rs Added comprehensive documentation to SpecCommand struct including all fields (full_cmd, usage, subcommands, args, flags, mounts, deprecated, hide, subcommand_required, restart_token, help variants, name, aliases, examples, complete)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/// ```
#[derive(Debug, Default, Clone, Serialize)]
pub struct SpecFlag {
/// Internal name for the flag (derived from long/short if not set)
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The comment states the name is "derived from long/short if not set", but this field doesn't have a default derivation mechanism visible in the struct definition. Consider clarifying whether this derivation happens in the builder or constructor, or if this field must be explicitly set.

Suggested change
/// Internal name for the flag (derived from long/short if not set)
/// Internal name for the flag (typically derived from long/short by the builder)

Copilot uses AI. Check for mistakes.
pub struct SpecFlag {
/// Internal name for the flag (derived from long/short if not set)
pub name: String,
/// Generated usage string (e.g., "-v, --verbose")
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The documentation says "Generated usage string" but this is a public field that can be set directly. Consider clarifying that this is typically auto-generated but can be overridden, or document when/how the generation occurs.

Suggested change
/// Generated usage string (e.g., "-v, --verbose")
/// Usage string (e.g., "-v, --verbose"), typically auto-generated from the flag names but can be set manually

Copilot uses AI. Check for mistakes.
pub struct SpecArg {
/// Name of the argument (used in help text)
pub name: String,
/// Generated usage string (e.g., "<file>" or "[file]")
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

Similar to the flag's usage field, the documentation says "Generated" but this is a public field. Consider clarifying that this is typically auto-generated (as seen in the usage() method in the context) but can be manually set.

Suggested change
/// Generated usage string (e.g., "<file>" or "[file]")
/// Usage string (e.g., "<file>" or "[file]"); typically auto-generated but can be set manually

Copilot uses AI. Check for mistakes.
pub struct SpecCommand {
/// Full command path from root (e.g., ["git", "remote", "add"])
pub full_cmd: Vec<String>,
/// Generated usage string
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The documentation says "Generated usage string" but this is a public field. Consider clarifying that this is typically auto-generated (as seen in the usage() method in the context) but can be manually set.

Suggested change
/// Generated usage string
/// Usage string for this command.
///
/// This is typically auto-generated (see [`SpecCommand::usage`]) but can
/// be manually set or overridden if needed.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 0% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.62%. Comparing base (949e3a5) to head (3aab606).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
lib/src/spec/flag.rs 0.00% 14 Missing ⚠️
lib/src/spec/cmd.rs 0.00% 12 Missing ⚠️
lib/src/spec/arg.rs 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #455      +/-   ##
==========================================
- Coverage   47.66%   46.62%   -1.04%     
==========================================
  Files          47       47              
  Lines        6928     7039     +111     
  Branches     6928     7039     +111     
==========================================
- Hits         3302     3282      -20     
- Misses       1780     1891     +111     
- Partials     1846     1866      +20     

☔ View full report in Codecov by Sentry.
📢 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.

@jdx jdx merged commit 2a9a76c into main Jan 19, 2026
9 of 11 checks passed
@jdx jdx deleted the feat/public-api-docs branch January 19, 2026 19:45
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