docs: add CLI command authoring conventions to CONVENTIONS.md - #607
docs: add CLI command authoring conventions to CONVENTIONS.md#607ruromero wants to merge 1 commit into
Conversation
Reviewer's GuideDocuments 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 flowsequenceDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In the canonical command example, consider showing the import of
selectTrustifyDABackend(andyargsif relevant) so newcomers can copy-paste the snippet without guessing where these come from. - It might be helpful to briefly clarify what
providervssourceconceptually 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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #607 +/- ##
=======================================
Coverage 91.22% 91.22%
=======================================
Files 42 42
Lines 9175 9175
Branches 1624 1624
=======================================
Hits 8370 8370
Misses 805 805
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
I see the section on |
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 |
Summary
conflictsfor mutually exclusive flags (and whydefault: falsebreaks it), and provider/source option wording with env var references in--helpoutputImplements TC-5560
Test plan
🤖 Generated with Claude Code