Commit 900fcec
feat(prd): Add comprehensive PRD management commands and versioning (#293)
* feat(prd): Add comprehensive PRD management commands and versioning
Implements a complete PRD management system for the codeframe CLI:
Core PRD functions (codeframe/core/prd.py):
- delete(workspace, prd_id) - Remove a PRD from workspace
- export_to_file(workspace, prd_id, path, force) - Export PRD to file
- create_new_version(workspace, prd_id, content, summary) - Create new version
- get_versions(workspace, prd_id) - List all versions of a PRD
- get_version(workspace, prd_id, version_number) - Get specific version
- diff_versions(workspace, prd_id, v1, v2) - Generate unified diff
CLI commands (codeframe/cli/app.py):
- prd list - List all PRDs with IDs and timestamps
- prd show [id] - Enhanced to accept optional PRD ID
- prd delete <id> [--force] - Delete PRD with confirmation
- prd export <id|latest> <file> [--force] - Export PRD to file
- prd versions <id> - Show version history
- prd diff <id> <v1> <v2> - Show diff between versions
- prd update <id> <file> -m <message> - Create new version
Database schema additions:
- version (INTEGER) - Version number for PRD
- parent_id (TEXT) - Links to previous version
- change_summary (TEXT) - Description of changes
Includes 68 tests covering core functions and CLI commands.
* Update codeframe/core/prd.py
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
* fix: Address code review issues for PRD versioning
- Add chain_id field to PrdRecord and prds table schema
- Add database indexes on parent_id and chain_id columns
- Make version number increment atomic with explicit transactions
- Optimize get_versions() to use single query with chain_id
- Add list_chains() function to list unique PRD chains
- Add delete validation with check_dependencies parameter
- Add PrdHasDependentTasksError exception for dependent tasks
- Update CLI_WIREFRAME.md with new PRD commands documentation
Fixes from code review:
1. Performance: Added idx_prds_parent and idx_prds_chain indexes
2. Architecture: Added chain_id for version grouping
3. Concurrency: Wrapped version creation in explicit transaction
4. N+1 queries: get_versions() now uses single query via chain_id
5. Documentation: Added 7 new PRD commands to CLI_WIREFRAME.md
6. Validation: delete() now checks for dependent tasks
* Update codeframe/cli/app.py
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
* Update codeframe/core/prd.py
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
---------
Co-authored-by: Test User <test@example.com>
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>1 parent 24afd97 commit 900fcec
7 files changed
Lines changed: 2135 additions & 13 deletions
File tree
- codeframe
- cli
- core
- docs
- tests
- cli
- core
0 commit comments