-
Notifications
You must be signed in to change notification settings - Fork 283
docs: add PR review feedback patterns to AGENTS.md #7300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -154,6 +154,13 @@ func (a *myAction) Run(ctx context.Context) (*actions.ActionResult, error) { | |||||
|
|
||||||
| - Commands can support multiple output formats via `--output` flag like `json` and`table` | ||||||
| - Use structured output for machine consumption | ||||||
| - **Shell-safe output**: When printing shell commands (e.g., `cd <path>`), quote or escape paths that may contain spaces. Use `fmt.Sprintf("cd %q", path)` or conditionally quote | ||||||
| - **Consistent JSON contracts**: When adding new fields to JSON output (e.g., `--output json`), ensure the field type and format are consistent with similar fields across commands. For example, don't mix `*time.Time` and `*RFC3339Time` for timestamp fields in the same API surface | ||||||
|
|
||||||
| ### Path Safety | ||||||
|
|
||||||
| - **Never use user-derived path components without validation**: When deriving directory names from user input or template paths, always validate the result is not `.`, `..`, empty, or contains path separators. These can cause path traversal | ||||||
| - **Quote paths in user-facing messages**: File paths in error messages, suggestions, and follow-up hints should be quoted when they may contain spaces | ||||||
|
|
||||||
| ### Code Organization | ||||||
|
|
||||||
|
|
@@ -165,13 +172,23 @@ func (a *myAction) Run(ctx context.Context) (*actions.ActionResult, error) { | |||||
|
|
||||||
| - Wrap errors with `fmt.Errorf("context: %w", err)` to preserve the error chain | ||||||
| - Consider using `internal.ErrorWithSuggestion` for straightforward, deterministic user-fixable issues | ||||||
| - When using `ErrorWithSuggestion`, always populate **all** relevant fields (`Err`, `Suggestion`, and `Links` if applicable). Don't leave `Message` or `Links` empty if the YAML pipeline rule would have provided them — `ErrorMiddleware` skips the YAML pipeline for errors that are already `ErrorWithSuggestion` | ||||||
|
||||||
| - When using `ErrorWithSuggestion`, always populate **all** relevant fields (`Err`, `Suggestion`, and `Links` if applicable). Don't leave `Message` or `Links` empty if the YAML pipeline rule would have provided them — `ErrorMiddleware` skips the YAML pipeline for errors that are already `ErrorWithSuggestion` | |
| - When using `ErrorWithSuggestion`, always populate **all** relevant fields (`Err`, `Message`, `Suggestion`, and `Links` when applicable). Don't leave `Message` or `Links` empty if the YAML pipeline rule would have provided them — `ErrorMiddleware` skips the YAML pipeline for errors that are already `ErrorWithSuggestion` |
Copilot
AI
Mar 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AZD_NO_PROMPT is used for extension processes (it’s propagated by pkg/extensions/runner.go) but the core azd CLI does not appear to read AZD_NO_PROMPT for its own --no-prompt behavior (global flags are parsed via ParseGlobalFlags without an env-var fallback). This bullet may mislead test authors—consider recommending the --no-prompt flag for core CLI tests, and mention AZD_NO_PROMPT specifically in the context of extension subprocesses if needed.
| - **Use correct env vars**: For forcing non-interactive mode in tests, use `AZD_FORCE_TTY=false` (not `AZD_DEBUG_FORCE_NO_TTY`). For no-prompt, use `AZD_NO_PROMPT=true` | |
| - **Use correct env vars and flags**: For forcing non-interactive mode in tests, use `AZD_FORCE_TTY=false` (not `AZD_DEBUG_FORCE_NO_TTY`). For no-prompt behavior in core azd CLI tests, pass `--no-prompt` on the command line; reserve `AZD_NO_PROMPT=true` for extension subprocesses that explicitly honor this env var |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor formatting typo: add a space between
andandtableso the inline code renders correctly ("jsonandtable").