fix(config): correct pitchfork config add to generate valid TOML#258
fix(config): correct pitchfork config add to generate valid TOML#258
Conversation
Previously, 'pitchfork config add' simply joined all arguments into the 'run' field as a string, causing execution errors when users tried to pass CLI flags: run = "--cmd 'bun run server' --retry 3 --watch 'src/**/*.ts'" retry = 0 This generated broken TOML that caused errors like: sh: line 0: exec: --: invalid option exec: usage: exec [-cl] [-a name] file [redirection ...] Now the command accepts proper CLI flags for each daemon configuration option: --run, --retry, --watch, --dir, --env, --depends, --ready-* --autostart, --autostop, --boot-start, --on-ready, --on-fail, --on-retry --cron-schedule, --cron-retrigger This generates correct TOML with each option as a separate field: run = "bun run server" retry = 3 watch = ["src/**/*.ts"] Changes: - Added 20+ CLI flags for all daemon configuration options - Fixed error handling to use bail!() macro (consistent with codebase) - Made struct fields private (consistent with codebase patterns) - Added comprehensive long_about documentation with examples - Added 14 e2e tests and 6 unit tests for validation - Added create_project_dir() helper to test common module - Updated CLI documentation via usage spec generation Fixes broken config generation bug. Users can now safely use 'pitchfork config add' instead of manually editing pitchfork.toml. Co-authored-by: Kimi K2.5 <kimi-k2.5@example.com> Co-authored-by: Gemini 3.0 Pro Preview <gemini-3.0-pro@example.com>
Summary of ChangesHello @benjaminwestern, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Greptile SummaryThis PR fixes a critical bug where Key changes:
The generated TOML is now valid and parseable, preventing shell execution errors like "exec: --: invalid option". Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 9e66dc8 |
There was a problem hiding this comment.
Code Review
This pull request provides a comprehensive fix for the pitchfork config add command, correctly generating valid TOML configurations for daemon management. The introduction of dedicated CLI flags for all daemon configuration options significantly improves usability and prevents previous execution errors. The changes include robust argument parsing, enhanced error handling, improved encapsulation by making struct fields private, and extensive documentation with examples. The addition of numerous unit and end-to-end tests ensures the reliability and correctness of the new functionality. Overall, this is a well-executed and impactful set of changes that greatly enhances the pitchfork CLI experience.
|
@jdx you were right... BATS tests are much simpler.... should be done for you now. |
Previously, 'pitchfork config add' simply joined all arguments into the 'run' field as a string, causing execution errors when users tried to pass CLI flags:
run = "--cmd 'bun run server' --retry 3 --watch 'src/**/*.ts'"
retry = 0
This generated broken TOML that caused errors like:
sh: line 0: exec: --: invalid option
exec: usage: exec [-cl] [-a name] file [redirection ...]
Now the command accepts proper CLI flags for each daemon configuration option:
--run, --retry, --watch, --dir, --env, --depends, --ready-*
--autostart, --autostop, --boot-start, --on-ready, --on-fail, --on-retry
--cron-schedule, --cron-retrigger
This generates correct TOML with each option as a separate field:
run = "bun run server"
retry = 3
watch = ["src/**/*.ts"]
Changes:
Fixes broken config generation bug. Users can now safely use 'pitchfork config add' instead of manually editing pitchfork.toml.
Co-written with Kimi K2.5 and Gemini 3.0 Pro Preview