Repository navigation
fix(mcp): validate the /pm prompt command argument - #786
Conversation
…ng raw input Parse the first word against standup|groom|plan|health|portfolio|mode and re-emit only canonical tokens (numeric/enum args); unknown subcommands or invalid args return a one-line usage message without echoing the input. Agentflare-Agent: claude-code Agentflare-Branch: task/606-pm-mcp-prompt-validate-the-command-argum Agentflare-Item: 606 Agentflare-Session: fc1d74a0-d97a-47a2-bb12-939245af642d
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: getappz/agentflare/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (1)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. 📝 WalkthroughWalkthroughThe PM prompt path now accepts recognized commands with defined argument formats, normalizes valid input, rejects invalid input with usage text, and renders only canonical commands. Tests cover direct rendering and ChangesPM command handling
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
command argument against the documented subcommands
The
/pmprompt now validates itscommandargument instead of pasting it into the prompt. All 26mcp_promptstests pass, and clippy is clean. The change is committed locally as3c2444dontask/606-…and not pushed.The fix (
src/mcp_prompts.rs)canonical_pm_commandchecks the first word againststandup|groom|plan|health|portfolio|mode. Each argument slot is checked too: numbers,~Ncapacity,rice|wsjf|value-effort,standup|healthfor portfolio, andon|offfor mode.standup 007becomesstandup 7. Optional args can be skipped (groom wsjf), but order is enforced.modereturns the one-linePM_USAGEstring. The input is never echoed andpm.mdis not embedded.render_pm_promptwas split out ofget_pm_commandso tests can call it without Debug-escaped output.Tests
pm_prompt_substitutes_command_argumentandpm_prompt_embeds_mode_off_subcommandtests. The new tests replace them:$ARGUMENTS.PM_USAGE.mode,mode maybe,standup soon,groom 14 fibonacciandplan 8returnPM_USAGE.get_prompt.Parse "<canonical>":line frompm.md, which only appears when the argument is substituted.Commands run:
cargo fmt;cargo test --bin agentflare mcp_prompts;cargo clippy --all-targets -- -D warnings -A unsafe_code -A clippy::pedantic.Concerns
pm.mdwork; anything else gets the usage line.Co-Authored-Bytrailer, as your global CLAUDE.md rule says, even though the harness reminder asked for one.Opened by
claude-codeon flared:c997d745ae66 for item #606 via agentflare.Summary by CodeRabbit
New Features
/pmcommand parsing with support for recognized subcommands and ordered numeric, capacity, framework, report, and mode arguments.Bug Fixes
/pminputs now return usage guidance without echoing the submitted input.