|
| 1 | +# Spec (per PR) |
| 2 | + |
| 3 | +**Spec ID**: 20251105 |
| 4 | +**Created**: 2025-11-05 |
| 5 | + |
| 6 | +**Feature name**: Selective Update for Directive-Maintained Files |
| 7 | +**One-line summary**: Allow users to safely update Directive-maintained files (templates, AOP, cursor rules) when new versions are released, while preserving project-specific content (specs and agent context). |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Problem |
| 12 | +When Directive releases updated templates, agent operating procedures, or cursor rules, users currently have to manually identify which files to update. The current `directive update` command copies everything non-destructively, meaning users never get updates to files they've already initialized. Users need an easy way to pull the latest Directive-maintained files while preserving only their project-specific content (specs and agent context). |
| 13 | + |
| 14 | +## Goal |
| 15 | +Users can run `directive update` to refresh all Directive-maintained files (templates, AOP, and cursor rules), while preserving only their project-specific content (specs and agent context). |
| 16 | + |
| 17 | +## Success Criteria |
| 18 | +- [ ] Users can update templates, AOP, and cursor rules with a single command |
| 19 | +- [ ] Project-specific content (agent_context.md and specs) is never overwritten |
| 20 | +- [ ] Users see a clear preview of exactly which files will be overwritten before any changes occur |
| 21 | +- [ ] Users can cancel the update after seeing the preview |
| 22 | +- [ ] Updates work seamlessly across version upgrades |
| 23 | + |
| 24 | +## User Story |
| 25 | +As a Directive user, I want to easily pull the latest templates, agent operating procedures, and cursor rules when new versions are released, so that I can benefit from improvements without manually comparing files or worrying about losing my project-specific content (specs and agent context). |
| 26 | + |
| 27 | +## Flow / States |
| 28 | + |
| 29 | +**Happy Path:** |
| 30 | +1. User runs `directive update` |
| 31 | +2. Command checks if directive/ exists |
| 32 | +3. Command displays list of files that will be overwritten: |
| 33 | + ``` |
| 34 | + The following files will be updated (overwritten): |
| 35 | + - directive/reference/agent_operating_procedure.md |
| 36 | + - directive/reference/templates/spec_template.md |
| 37 | + - directive/reference/templates/impact_template.md |
| 38 | + - directive/reference/templates/tdr_template.md |
| 39 | + - directive/reference/templates/implementation_summary_template.md |
| 40 | + - .cursor/rules/directive-core-protocol.mdc |
| 41 | + |
| 42 | + Files that will NOT be modified: |
| 43 | + - directive/reference/agent_context.md (your project-specific context) |
| 44 | + - directive/specs/ (your project history) |
| 45 | + ``` |
| 46 | +4. Command asks for confirmation (Y/n, default Yes) |
| 47 | +5. If confirmed, files are overwritten with latest versions from package |
| 48 | +6. Success message shows what was actually updated |
| 49 | + |
| 50 | +**Edge Case - No directive/ directory:** |
| 51 | +1. User has no `directive/` directory yet |
| 52 | +2. Command detects this and suggests running `directive init` first |
| 53 | +3. Exits gracefully with helpful message |
| 54 | + |
| 55 | +**Edge Case - Non-interactive mode:** |
| 56 | +1. User runs command in CI/non-TTY environment |
| 57 | +2. Command shows what would be updated |
| 58 | +3. Auto-confirms with default (Yes) and proceeds |
| 59 | + |
| 60 | +## UX Links |
| 61 | +N/A - CLI only feature |
| 62 | + |
| 63 | +## Requirements |
| 64 | +- Must show a clear preview of which files will be overwritten before making any changes |
| 65 | +- Must ask for user confirmation before overwriting (with sensible default) |
| 66 | +- Must update these Directive-maintained files with overwrite: |
| 67 | + - `directive/reference/agent_operating_procedure.md` |
| 68 | + - `directive/reference/templates/spec_template.md` |
| 69 | + - `directive/reference/templates/impact_template.md` |
| 70 | + - `directive/reference/templates/tdr_template.md` |
| 71 | + - `directive/reference/templates/implementation_summary_template.md` |
| 72 | + - `.cursor/rules/directive-core-protocol.mdc` (and any other cursor rules from package) |
| 73 | +- Must NOT overwrite project-specific content: |
| 74 | + - `directive/reference/agent_context.md` (project-specific context) |
| 75 | + - `directive/specs/` directory (project history) |
| 76 | + - Any other user-created files not in the package |
| 77 | +- Must work whether or not directive/ already exists |
| 78 | +- Must provide clear feedback about what was actually updated after completion |
| 79 | +- Must handle non-interactive mode gracefully (CI/scripts) |
| 80 | + |
| 81 | +## Acceptance Criteria |
| 82 | +- Given a directive/ directory exists, when user runs `directive update`, then a preview of files to be overwritten is shown before any changes |
| 83 | +- Given the preview is shown, when user confirms (Y), then templates, AOP, and cursor rules are overwritten and success message shows what was updated |
| 84 | +- Given the preview is shown, when user declines (n), then no files are modified and command exits gracefully |
| 85 | +- Given command runs in non-interactive mode, when `directive update` is called, then it auto-confirms and proceeds with updates |
| 86 | +- Given directive/ doesn't exist, when user runs `directive update`, then command exits with helpful message to run `directive init` |
| 87 | +- Given `agent_context.md` has custom content, when user runs `directive update`, then `agent_context.md` is unchanged |
| 88 | +- Given `.cursor/rules/` has Directive rules, when user runs `directive update`, then cursor rules are overwritten with latest from package |
| 89 | +- Given `directive/specs/` has project history, when user runs `directive update`, then specs directory is unchanged |
| 90 | + |
| 91 | +## Non-Goals |
| 92 | +- Intelligent merging of template changes (simple overwrite only) |
| 93 | +- Backup/restore functionality for overwritten files |
| 94 | +- Updating `.cursor/mcp.json` or `.cursor/servers/` (MCP setup remains one-time via `init`) |
| 95 | +- Version-aware updates or migration scripts |
| 96 | +- Selective update of individual files (all-or-nothing update of maintained files) |
| 97 | + |
0 commit comments