Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

The AGENTS.md file lacked critical bash-specific patterns and project context needed for effective AI agent interaction, particularly lessons from PR #28's exit code handling implementation.

Enhanced Documentation Structure

Bash-Specific Patterns (new section)

  • Exit code handling: SCRIPT_DIALOG_CANCEL_EXIT_CODE (124), command substitution propagation pattern || exit "$?", and exit status capture timing semantics
  • Variable existence checking: ${VAR+x} pattern
  • Platform detection: actual implementation patterns with [[ ]] for wildcards, [ ] for POSIX tests

Cross-Platform Considerations (new section)

  • Platform-specific behaviors: macOS, Windows/WSL, Linux desktop detection via pgrep -l
  • Wayland vs X11 compositor detection for screenshot utility

Testing Approaches (new section)

  • Manual: interface selection, cancel behavior validation
  • Screenshot: screenshot-dialogs.sh usage patterns
  • CI: shellcheck automation

Common Patterns & Pitfalls (new section)

  • DO: Capture $? immediately after commands, test multiple interfaces
  • DON'T: Capture $? after if/fi (always returns 0), break cancel detection

PR #28 Learnings (new section)

  • Refactoring trade-offs, cancellation testing importance, exit code 124 rationale

Critical Pattern Example

# CORRECT - exit status captured immediately
if [ "$INTERFACE" == "zenity" ]; then
    result=$(zenity --entry --text="$1" 2>/dev/null)
    exit_status=$?  # Must be right after the command
fi

# WRONG - captures if statement exit status (always 0)
if [ "$INTERFACE" == "zenity" ]; then
    result=$(zenity --entry --text="$1" 2>/dev/null)
fi
exit_status=$?  # This is 0, not the zenity exit code

Stats

  • 53 → 214 lines (+172, -10)
  • Added 5 major sections
  • Enhanced all existing sections with project-specific patterns
Original prompt

Are there any improvements to the AGENTS.md that can be made based on the project and feedback given on all the PRs?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits December 16, 2025 02:35
…d learnings

- Add detailed project overview with intelligent interface selection
- Document bash version requirement and all tools (including screenshot utilities)
- Include screenshot-dialogs.sh and CI workflow in project structure
- Expand code style conventions with specific bash best practices
- Add comprehensive "Bash-Specific Patterns and Best Practices" section
- Document exit code handling and cancellation patterns (SCRIPT_DIALOG_CANCEL_EXIT_CODE)
- Explain command substitution and subshell behavior with examples
- Document exit status capture timing (critical bash semantic)
- Add cross-platform considerations (macOS, Windows/WSL, Linux)
- Document platform-specific behaviors and testing approaches
- Add manual, screenshot, and automated testing sections
- Include "Common Patterns and Pitfalls" with DO/DON'T lists
- Document key learnings from PR #28 about refactoring and testing
- Expand boundaries and guardrails with more specific rules
- Provide concrete examples throughout for clarity

Co-authored-by: lunarcloud <1565970+lunarcloud@users.noreply.github.com>
Co-authored-by: lunarcloud <1565970+lunarcloud@users.noreply.github.com>
- Changed [ ] to [[ ]] in variable existence checking example
- Updated platform detection examples to show actual bash syntax from code
- Added specific process names for Linux desktop detection (gnome-shell, mutter, kwin)

Co-authored-by: lunarcloud <1565970+lunarcloud@users.noreply.github.com>
- Clarified that [ ] is used for basic POSIX tests (equality, -z, -n, etc.)
- Clarified that [[ ]] is used for pattern matching and bash-specific features
- Updated examples to use [ ] to match actual implementation in script-dialog.sh
- Added note about pattern matching in platform detection examples
- Added pgrep -l pattern for Linux desktop detection

Co-authored-by: lunarcloud <1565970+lunarcloud@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve AGENTS.md based on project feedback Enhance AGENTS.md with bash patterns and project learnings from PR #28 Dec 16, 2025
Copilot AI requested a review from lunarcloud December 16, 2025 02:44
@lunarcloud lunarcloud marked this pull request as ready for review December 16, 2025 02:45
@lunarcloud lunarcloud merged commit 67f84d4 into main Dec 16, 2025
@lunarcloud lunarcloud deleted the copilot/update-agents-documentation branch December 16, 2025 02: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