Skip to content

docs: add CLI command authoring conventions to CONVENTIONS.md - #607

Open
ruromero wants to merge 1 commit into
guacsec:mainfrom
ruromero:TC-5560
Open

docs: add CLI command authoring conventions to CONVENTIONS.md#607
ruromero wants to merge 1 commit into
guacsec:mainfrom
ruromero:TC-5560

Conversation

@ruromero

@ruromero ruromero commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Document CLI command authoring conventions in CONVENTIONS.md
  • Cover two non-obvious patterns: yargs conflicts for mutually exclusive flags (and why default: false breaks it), and provider/source option wording with env var references in --help output

Implements TC-5560

Test plan

  • No code changes — documentation only
  • Conventions match the patterns used by existing CLI commands

🤖 Generated with Claude Code

@sourcery-ai

sourcery-ai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Reviewer's Guide

Documents and standardizes conventions for authoring new yargs-based CLI commands, including option naming, backend URL resolution, provider/source filtering, and conflict handling, with a canonical code example.

Sequence diagram for canonical yargs CLI command flow

sequenceDiagram
    actor User
    participant CLI as node_src_cli
    participant yargs
    participant example as command_example
    participant backend as selectTrustifyDABackend

    User->>CLI: invoke `trustify-da example <path> --providers --sources`
    CLI->>yargs: register command_example
    yargs->>example: builder(yargs)
    yargs->>example: handler(args)
    example->>example: build opts from args.providers / args.sources
    example->>backend: selectTrustifyDABackend(opts)
    backend-->>example: backend_url
    example-->>User: command output using backend_url
Loading

File-Level Changes

Change Details Files
Add CLI command authoring conventions to the project documentation, including a canonical yargs command example.
  • Introduce a new 'CLI Commands' section describing required patterns for new commands in src/cli.js.
  • Specify use of the yargs 'desc' alias for option descriptions instead of 'describe'.
  • Document the requirement to use selectTrustifyDABackend(opts) from index.js for backend URL resolution.
  • Standardize provider/source option wording with environment variable references for TRUSTIFY_DA_PROVIDERS and TRUSTIFY_DA_SOURCES.
  • Explain correct usage of yargs 'conflicts' for mutually exclusive flags and warn against defaulting conflicting booleans.
  • Provide a canonical JavaScript example demonstrating positional args, provider/source options, env var mapping, and backend URL selection.
CONVENTIONS.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In the canonical command example, consider showing the import of selectTrustifyDABackend (and yargs if relevant) so newcomers can copy-paste the snippet without guessing where these come from.
  • It might be helpful to briefly clarify what provider vs source conceptually represent in the CLI conventions section so authors know when to include each option.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the canonical command example, consider showing the import of `selectTrustifyDABackend` (and `yargs` if relevant) so newcomers can copy-paste the snippet without guessing where these come from.
- It might be helpful to briefly clarify what `provider` vs `source` conceptually represent in the CLI conventions section so authors know when to include each option.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ruromero
ruromero requested a review from Strum355 August 6, 2026 15:50
Document the established patterns for yargs CLI commands: use `desc`
(not `describe`), call `selectTrustifyDABackend` for URL resolution,
include env var references in provider/source option descriptions,
and avoid `default: false` on conflicting boolean options.

These patterns were already used consistently across 7 existing
commands but were undocumented, causing inconsistencies in new commands.

Implements TC-5560

Assisted-by: Claude Code
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.22%. Comparing base (329b3cf) to head (462bd00).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #607   +/-   ##
=======================================
  Coverage   91.22%   91.22%           
=======================================
  Files          42       42           
  Lines        9175     9175           
  Branches     1624     1624           
=======================================
  Hits         8370     8370           
  Misses        805      805           
Flag Coverage Δ
unit-tests 91.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@Strum355

Strum355 commented Aug 7, 2026

Copy link
Copy Markdown
Member

I see the section on selectTrustifyDABackend was removed in the latest force-push (but the PR description wasnt updated), and CONVENTIONS.md overall has less changes than the original commit. Is that intentional?

@ruromero

ruromero commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

I see the section on selectTrustifyDABackend was removed in the latest force-push (but the PR description wasnt updated), and CONVENTIONS.md overall has less changes than the original commit. Is that intentional?

I will update the description but I decided to limit the scope of the changes, the other suggested changes were things that must be assumed from existing code and general skill instructions

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.

3 participants