|
| 1 | +# Execution Plan: Documentation and Test Synchronization |
| 2 | + |
| 3 | +## Objective |
| 4 | +Harmonize the project's documentation with its implementation by standardizing command names, filling documentation gaps, and replacing brittle tests with a dynamic synchronization verification suite. |
| 5 | + |
| 6 | +## Architectural Impact |
| 7 | +- **Consistency:** Ensures that users and AI agents have a single, accurate source of truth for command names and capabilities. |
| 8 | +- **Maintainability:** Reduces test suite fragility by moving from hard-coded string matching to dynamic discovery. |
| 9 | +- **Safety:** Strengthens the link between implementation (TOML/Markdown) and documentation (README/User Guide) through automated CI checks. |
| 10 | + |
| 11 | +## File Operations |
| 12 | + |
| 13 | +### Files to Modify: |
| 14 | +- `README.md`: Update `/learn` description; ensure `/document` is correctly referenced. |
| 15 | +- `docs/index.md`: Rename `/docs` references to `/document`. |
| 16 | +- `docs/user-guide.md`: |
| 17 | + - Rename `/docs` to `/document`. |
| 18 | + - Add missing `/scaffold` and `/onboard` sections. |
| 19 | + - Remove redundant `/learn` section. |
| 20 | + - Explicitly identify `learner` and `debugger` as subagents. |
| 21 | +- `tests/test_review_command.py`: Refactor to remove brittle string assertions. |
| 22 | + |
| 23 | +### Files to Create: |
| 24 | +- `tests/test_sync.py`: New dynamic test suite for implementation-documentation synchronization. |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## Step-by-Step Execution |
| 29 | + |
| 30 | +### Phase 1: Documentation Harmonization |
| 31 | + |
| 32 | +#### Step 1.1: Update `docs/index.md` |
| 33 | +- Replace the legacy `/docs` command reference with `/document` in the "Key Capabilities" section. |
| 34 | + |
| 35 | +#### Step 1.2: Update `docs/user-guide.md` |
| 36 | +- **Search & Replace:** Globally replace `/docs` with `/document`. |
| 37 | +- **Deduplication:** Remove the second, redundant occurrence of the `### /learn` section. |
| 38 | +- **Explicit Agent Identification:** |
| 39 | + - Update the `/learn` section to explicitly mention the `learner` subagent. |
| 40 | + - Update the `/debug` section to explicitly mention the `debugger` subagent. |
| 41 | +- **Add Missing Commands:** |
| 42 | + - Add a `### /onboard` section under "The Discovery & Strategy Workflow". |
| 43 | + - Add a `### /scaffold` section under "The Software Development Workflow". |
| 44 | + |
| 45 | +#### Step 1.3: Update `README.md` |
| 46 | +- Update the `/learn` section under "Phase 1: Planning & Discovery" to explicitly mention the `learner` subagent (consistent with how `/debug` and `/plan` are described). |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +### Phase 2: Test Suite Refactoring |
| 51 | + |
| 52 | +#### Step 2.1: Refactor `tests/test_review_command.py` |
| 53 | +- Modify `test_reviewer_agent_has_grep_search` to verify file existence and basic Markdown structure (e.g., presence of a title) instead of specific tool names like `grep_search`. |
| 54 | +- Modify `test_review_command_is_multiphase` to verify the TOML file contains `description` and `prompt` keys, rather than searching for specific "Phase X" strings. |
| 55 | +- Simplify `test_maintenance_command_is_audit` and `test_planner_agent_read_only` to focus on existence and high-level role rather than internal implementation details. |
| 56 | +- Retain "gone" file checks (e.g., `test_editor_agent_gone`) as they validate successful migrations. |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +### Phase 3: Dynamic Synchronization Implementation |
| 61 | + |
| 62 | +#### Step 3.1: Create `tests/test_sync.py` |
| 63 | +Implement a pytest-compatible script that performs the following: |
| 64 | +1. **Command Discovery:** Programmatically list all `.toml` files in `.gemini/commands/`. |
| 65 | +2. **Agent Discovery:** Programmatically list all `.md` files in `.gemini/agents/`. |
| 66 | +3. **Forward Sync Check:** |
| 67 | + - Verify every discovered command is mentioned as `/{command}` in both `README.md` and `docs/user-guide.md`. |
| 68 | + - Verify every discovered agent is mentioned in `docs/design.md` and `docs/user-guide.md`. |
| 69 | +4. **Reverse Sync Check:** |
| 70 | + - Parse `README.md` and `docs/user-guide.md` for any strings matching the `/{command}` pattern. |
| 71 | + - Assert that each found pattern (excluding known exceptions like `/docs`) has a corresponding `.toml` file in `.gemini/commands/`. |
| 72 | +5. **Agent Role Verification:** |
| 73 | + - Ensure `README.md` and `docs/user-guide.md` use the terms "agent" or "subagent" when describing the specialized roles (e.g., `planner`, `researcher`, `learner`). |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Testing Strategy |
| 78 | + |
| 79 | +### 1. Manual Validation |
| 80 | +- Inspect the modified `docs/user-guide.md` and `README.md` to ensure formatting is correct and descriptions are accurate. |
| 81 | +- Verify that the `/document` command is used consistently across all files. |
| 82 | + |
| 83 | +### 2. Automated Validation |
| 84 | +- **Run the refactored suite:** Execute `pytest tests/test_review_command.py` to ensure the new, leaner assertions pass. |
| 85 | +- **Run the synchronization suite:** Execute `pytest tests/test_sync.py`. This test is expected to fail initially if any commands were missed during the manual update phase, providing an automated "punch list" for completion. |
| 86 | + |
| 87 | +### 3. CI/CD Integration |
| 88 | +- Ensure these new tests are picked up by the `make test` target, which is triggered by the `pre-commit.py` hook and GitHub Actions. |
0 commit comments