Skip to content

feat: add pixi start wrapper script that forwards app args#25

Merged
K1ngst0m merged 1 commit intomainfrom
start-app-args
Dec 31, 2025
Merged

feat: add pixi start wrapper script that forwards app args#25
K1ngst0m merged 1 commit intomainfrom
start-app-args

Conversation

@K1ngst0m
Copy link
Copy Markdown
Collaborator

@K1ngst0m K1ngst0m commented Dec 31, 2025

Summary by CodeRabbit

  • Documentation

    • Updated launch instructions with preset argument support and new command options.
    • Improved help text for the start command with clearer syntax and argument documentation.
  • Chores

    • Refactored task configuration to delegate to external scripts for better maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 31, 2025

📝 Walkthrough

Walkthrough

The changes refactor the pixi start task from an inline bash command to a delegated script (scripts/start.sh), which handles CMake preset validation, viewer binary location, and process orchestration. Documentation and help text are updated to reflect the new command syntax supporting optional preset and application arguments.

Changes

Cohort / File(s) Summary
Documentation Updates
README.md, scripts/help.sh
Updated usage instructions for the start command, changing argument order from <APP> [PRESET] to [PRESET] <APP> [ARGS...] and documenting the --wsi xcb flag in example commands.
Task Configuration
pixi.toml
Delegated [tasks.start] command from inline bash to bash scripts/start.sh and removed args and depends-on fields; added cmd to [tasks.shader-fetch] pointing to scripts/download_retroarch_shaders.sh.
New Script
scripts/start.sh
New orchestration script that validates CMake presets, triggers preset build via pixi, locates and launches the viewer binary, runs the target application, and manages process cleanup on exit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12–15 minutes

Poem

🐰 A tale of scripts so grand and new,
Where presets dance in preset queue,
The viewer launches, apps run free,
With cleanup magic—hop with glee!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly reflects the main change: adding a wrapper script (scripts/start.sh) that enables forwarding app arguments, with supporting documentation and configuration updates.
✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
scripts/start.sh (1)

10-34: Preset parsing is robust with appropriate fallback.

The Python-based JSON parsing correctly filters hidden and i686 presets. The fallback list provides resilience when Python or the presets file is unavailable.

Consider adding a comment explaining that the fallback list (lines 32-34) should be kept in sync with CMakePresets.json when new presets are added, to help maintainers remember to update both locations.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33bba7d and 3a53ab6.

📒 Files selected for processing (4)
  • README.md
  • pixi.toml
  • scripts/help.sh
  • scripts/start.sh
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-29T00:55:08.857Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2025-12-29T00:55:08.857Z
Learning: Applies to docs/**/CMakePresets.json : Use CMake presets for all builds and tests; never run `cmake -B build` or build directly without a preset

Applied to files:

  • scripts/start.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Static Analysis (clang-tidy)
  • GitHub Check: Build and Test (test preset)
🔇 Additional comments (16)
README.md (2)

100-102: LGTM: Documentation accurately reflects the new CLI syntax.

The command syntax and default preset behavior are clearly documented and align with the implementation in scripts/start.sh.


105-106: LGTM: Clear and practical examples.

The examples effectively demonstrate both default and explicit preset usage patterns.

scripts/help.sh (2)

14-14: LGTM: Clear command syntax documentation.

The help text accurately reflects the new CLI interface with proper notation conventions.


25-28: LGTM: Complete argument documentation.

All arguments are clearly documented with appropriate defaults and descriptions.

pixi.toml (2)

62-64: LGTM: Clean refactor to script delegation.

Delegating to scripts/start.sh simplifies the task definition. The script properly handles preset validation and building via pixi run dev.


66-68: LGTM: Explicit script delegation.

Making the shader-fetch task explicitly delegate to a script improves consistency with other tasks.

scripts/start.sh (10)

1-9: LGTM: Robust initialization with good bash practices.

The script uses strict error handling (set -euo pipefail) and robust path resolution. Variable initialization is clean and follows best practices.


36-47: LGTM: Comprehensive usage documentation.

The usage function provides clear examples covering common cases and edge cases (using -- separator). This aligns well with the help text and README.


49-71: LGTM: Well-structured helper functions.

The helper functions follow bash best practices with proper error handling, stderr output, and informative error messages.


73-103: LGTM: Robust argument parsing with edge case handling.

The argument parsing correctly handles multiple flag formats (--preset VALUE, --preset=VALUE), help flag, and the -- separator for disambiguation. State tracking with preset_explicit and positional_preset_allowed is well-designed.


105-109: LGTM: Correct positional preset detection logic.

The conditional logic properly handles the optional positional preset with appropriate guards and validation. The state management correctly updates preset_explicit.


111-120: LGTM: Proper validation and argument extraction.

The validation logic correctly ensures required arguments are present and valid before proceeding. Error messages are helpful by showing usage.


122-128: LGTM: Proper build orchestration and validation.

The script correctly uses pixi run dev (which honors CMake presets per project policies) and validates the resulting binary before use.


130-137: LGTM: Robust cleanup handler.

The cleanup function defensively checks process existence before termination and properly reaps the child process. The trap covers all relevant exit scenarios (EXIT, INT, TERM).


139-144: Verify viewer startup before launching app.

The script launches the viewer and waits 1 second but doesn't verify it started successfully. If the viewer crashes during initialization, the app will run uncaptured without warning.

Consider adding a check after the sleep to verify the viewer process is still running:

 "$VIEWER_BIN" &
 VIEWER_PID=$!
 
 # Give the viewer a moment to initialize before attaching.
 sleep 1
+
+if ! kill -0 "$VIEWER_PID" 2>/dev/null; then
+  die "viewer process failed to start"
+fi

Alternatively, if there's a way to detect when the viewer is ready (e.g., checking for a socket file or listening port), that would be more robust than a fixed sleep duration.


145-150: LGTM: Correct exit status propagation.

The script properly disables exit-on-error to capture the app's exit status and propagates it correctly. Array expansion is safe in bash even when empty.

@K1ngst0m K1ngst0m merged commit e25c89a into main Dec 31, 2025
4 checks passed
@K1ngst0m K1ngst0m deleted the start-app-args branch January 1, 2026 00:24
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.

1 participant