feat: Add CLI tool development support to MAP framework#7
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the MAP framework with comprehensive CLI tool development support based on lessons learned from the mapify CLI subcommands implementation. The changes address systematic issues with stdout pollution, version incompatibility, and testing gaps that weren't caught during initial development.
Key Changes:
- Enhanced three MAP agents (Monitor, Predictor, Reflector) to v2.3.0 with CLI-specific validation, risk prediction, and pattern recognition capabilities
- Added new CLI_TOOL_PATTERNS section to playbook schema for capturing CLI development lessons
- Created comprehensive CLI Testing Guide (400+ lines) documenting best practices for output stream management, version compatibility, and integration testing
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/mapify_cli/playbook_manager.py | Updated playbook schema to support new CLI_TOOL_PATTERNS section (sections_count: 9 → 10) |
| docs/CLI_TESTING_GUIDE.md | New comprehensive guide covering CLI testing best practices, common pitfalls, and workflows |
| CHANGELOG.md | Documented all CLI development improvements with context from PR #6 |
| .claude/agents/reflector.md | Added CLI pattern recognition capabilities for extracting CLI-specific lessons |
| .claude/agents/predictor.md | Added CLI-specific risk prediction (stdout pollution, version incompatibility, etc.) |
| .claude/agents/monitor.md | Added CLI validation checklist for manual testing, output streams, and integration tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Enhance MAP agents and documentation with CLI-specific validation, risk prediction, and pattern recognition based on lessons learned from mapify CLI subcommands implementation (PR #6). ## Changes ### Enhanced Agents (all v2.2.0 → v2.3.0) **Monitor Agent**: - Add CLI Tool Validation section (### 6) with comprehensive checklist - Manual execution test requirements - Output stream validation (stdout/stderr separation) - Library version compatibility checks - Integration testing patterns - Common CLI issues with solutions **Predictor Agent**: - Add CLI Tool Specific Risks section - HIGH risk: version incompatibility, stdout pollution, format changes - MEDIUM risk: env vars, error stream changes, command renames - Real-world example from mapify implementation - CLI testing validation checklist **Reflector Agent**: - Add CLI_TOOL_PATTERNS pattern type - CLI pattern recognition signals (pollution, version, streams) - CLI Reflection Template for lesson extraction - Pattern extraction for reusable CLI lessons ### Playbook Schema - Add CLI_TOOL_PATTERNS section (10 sections total, was 9) - Update sections_count in playbook_manager.py ### Documentation - New: docs/CLI_TESTING_GUIDE.md (400+ lines) - Output stream management principles - Version compatibility patterns - Integration testing workflows - Common pitfalls with examples - Best practices checklist ### CHANGELOG - Document all CLI improvements in [Unreleased] - Include context from PR #6 lessons learned ## Rationale These improvements address systematic issues discovered during CLI development: 1. **Stdout Pollution**: Libraries printing diagnostics to stdout - Solution: Always use stderr for diagnostics - Detection: Monitor validates output streams 2. **Version Incompatibility**: Using features not in minimum version - Solution: Check compatibility or use fallback - Detection: Predictor flags version-specific risks 3. **CliRunner ≠ Real CLI**: Tests pass but command fails - Solution: Add integration tests with subprocess - Detection: Monitor requires manual CLI execution 4. **Pattern Capture**: Prevent repeating these mistakes - Solution: Reflector extracts CLI patterns to playbook - Benefit: Institutional memory for CLI development ## Benefits - Proactive risk detection for CLI implementations - Comprehensive validation checklist for reviewers - Systematic lesson capture for future CLI projects - Single source of truth for CLI testing practices - Prevents common CLI development pitfalls Closes #<will-be-created>
2545378 to
43f8693
Compare
azalio
pushed a commit
that referenced
this pull request
Feb 8, 2026
…stillation Five optimizations to the Architect phase: 1. Architecture Graph (Step 4): REQUIRED pseudocode graph of affected classes/modules before decomposition — decomposer gets a skeleton 2. AAG Contracts (Step 5 & 6): mandatory aag_contract per subtask in task_plan.md and aag_contracts map in workflow_state.json — turns the plan from a "todo list" into an executable protocol 3. Semantic Brackets (Step 6 & 7): <MAP_Plan_v1_0> wraps task plan, _semantic_tag in workflow_state.json — zero-ambiguity parsing 4. Contract Clarity (Step 2): dimension #7 in interview checklist — reject process-goals ("improve auth"), require outcome-goals ("returns 401 for expired tokens") 5. Context Distillation (Step 8): distillation checklist before STOP — ensures plan files are self-contained for fresh executor session, target ≤4000 tokens per subtask context https://claude.ai/code/session_01AR3EbNKosxBD5PocKkMSMd
azalio
added a commit
that referenced
this pull request
Feb 13, 2026
-7) - #1-3: Remove Actor "proposals only" section — Actor applies code directly with Edit/Write tools, consistent with map-efficient.md prompts - #4: Rename orchestrator phase 2.7 from APPLY_CHANGES to UPDATE_STATE (Actor applies code, 2.7 only updates state tracking) - #5: Implement check_circuit_breaker command in orchestrator (was referenced in map-efficient.md but missing from argparse) - #6: Replace non-existent map-efficient-step reference with /map-resume - #7: Fix STEP_ORDER index bug — used [3:] (starts at CHOOSE_MODE) instead of index("2.0") (starts at XML_PACKET) for subtask loop reset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Enhance MAP framework with comprehensive CLI tool development support based on lessons learned from mapify CLI subcommands implementation (PR #6).
Problem
During development of CLI subcommands, we encountered systematic issues that MAP agents didn't catch:
SemanticSearchEngineprinted diagnostic messages to stdout, breaking JSON output and| jqpipesCliRunner(mix_stderr=False)unavailable in CI's older Click versionResult: 3 iterations to fix issues that could have been caught with proper CLI validation.
Solution
Add CLI-specific validation, risk prediction, and pattern recognition to MAP agents:
Enhanced Agents (v2.2.0 → v2.3.0)
Monitor Agent
New Section: CLI Tool Validation (### 6)
Example Check:
Predictor Agent
New Section: CLI Tool Specific Risks
HIGH Risks:
Example:
Reflector Agent
New Section: CLI Tool Pattern Recognition
Pattern Types:
Reflection Template:
Playbook Schema
New Section:
CLI_TOOL_PATTERNS(10th section)Documentation
New File:
docs/CLI_TESTING_GUIDE.md(400+ lines)Comprehensive guide covering:
Example Pattern:
Benefits
Proactive Issue Detection
Improved Quality
Knowledge Capture
Real-World Impact
Before (PR #6 without these improvements):
After (with these improvements):
Testing
✅ All agent files validated (template variable check passed)
✅ Playbook schema updated correctly (sections_count: 9 → 10)
✅ CHANGELOG documented comprehensively
✅ CLI Testing Guide provides actionable patterns
Files Changed
.claude/agents/monitor.md: +68 lines (CLI validation).claude/agents/predictor.md: +69 lines (CLI risks).claude/agents/reflector.md: +46 lines (CLI patterns)src/mapify_cli/playbook_manager.py: +5 lines (CLI section)docs/CLI_TESTING_GUIDE.md: +544 lines (new file)CHANGELOG.md: +54 lines (documentation)Total: +786 lines of CLI-specific improvements
Related
Checklist
Next Steps
Future CLI implementations will benefit from:
Summary: Systematically addresses CLI development challenges discovered in PR #6, preventing similar issues in future MAP-powered CLI implementations.