feat(tasks): add project:render PROJECT-DEFINITION regeneration tool (#323)#342
Conversation
890cbea to
168978f
Compare
Greptile SummaryAdds Confidence Score: 5/5Safe to merge — all previously flagged P1 issues are resolved and remaining findings are display-only P2 nits. The three prior review concerns (circular alias, invocation-relative path, whitespace-only title split) are all fixed in the batch fix commit. The only remaining findings are a singular/plural grammar nit in the output message and a redundant exists() call — neither affects correctness or test coverage. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([task project:render]) --> B[render_project_definition]
B --> C[scan_lifecycle_folders\nproposed/pending/active/\ncompleted/cancelled]
C --> D{*.vbrief.json\nfound?}
D -->|valid JSON| E[Extract title, status,\nrefs → items list]
D -->|parse error| F[Append unreadable\nitem with status=draft]
E --> G[Build items list]
F --> G
G --> H{PROJECT-DEFINITION\nexists?}
H -->|no| I[create_skeleton\nitems + timestamps +\nempty narratives]
H -->|yes| J[Load existing file]
J --> K[Replace items registry]
K --> L[Refresh vBRIEFInfo.updated]
L --> M[flag_stale_narratives\nfor completed items]
M --> N{keyword overlap\nor ≥3 completed?}
N -->|yes| O[Append staleness flags]
N -->|no| P[No flags]
O --> Q[Write JSON output]
P --> Q
I --> Q
Q --> R([Print summary report\n✓ N scope items])
Prompt To Fix All With AIThis is a comment left during a code review.
Path: scripts/project_render.py
Line: 251
Comment:
**Singular/plural inconsistency in output message**
The format string always uses `"scope items"` regardless of count, producing `"1 scope items"` when a single scope is found. The test in `tests/cli/test_project_render.py` (line 259) also asserts `"1 scope items"` so both would need updating together.
```suggestion
noun = "item" if item_count == 1 else "items"
parts = [f"✓ PROJECT-DEFINITION.vbrief.json {action} ({item_count} scope {noun})"]
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: scripts/project_render.py
Line: 207-209
Comment:
**Redundant `exists()` calls**
`created_new` is computed from `project_def_path.exists()` on line 207, then `project_def_path.exists()` is called again on line 209 instead of reusing `created_new`. The second call is redundant and creates a minor TOCTOU window.
```suggestion
created_new = not project_def_path.exists()
if not created_new:
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (3): Last reviewed commit: "fix: address Greptile review findings (b..." | Re-trigger Greptile |
…323) - Create scripts/project_render.py: deterministic regeneration for vbrief/PROJECT-DEFINITION.vbrief.json per RFC #309 Decision D14 - Scan all 5 lifecycle folders (proposed/, pending/, active/, completed/, cancelled/) for *.vbrief.json scope files - Update items registry with title, status, file path, and references - Timestamp freshness via vBRIEFInfo.updated on each run - Flag stale narratives based on completed scope topic keywords (camelCase-aware key splitting + general threshold at >=3 completed) - Create skeleton with empty narratives if no PROJECT-DEFINITION exists - Handle missing/empty lifecycle folders and malformed files gracefully - Document agent-assisted narrative review layer in code comments - Add tasks/project.yml with PYTHONUTF8=1 for Windows compatibility - Wire as project:render include + alias in Taskfile.yml - Add 23 subprocess-based tests in tests/cli/test_project_render.py covering skeleton creation, 5-folder scanning, update preservation, timestamp refresh, staleness flagging, determinism, error handling, and CLI argument validation - Add CHANGELOG.md entry under [Unreleased]
- Remove circular project:render alias from Taskfile.yml (P1): the included task is already accessible as project:render without an alias - Switch USER_WORKING_DIR to ROOT_DIR in tasks/project.yml (P2): ensures vbrief/ path resolves to project root regardless of invocation directory - Use re.split for title word extraction in staleness flagging (P2): catches hyphenated title words like 'tech-stack' that whitespace-only split would miss - MCP unavailable in this session -- used gh api fallback for review comments
688bfe1 to
5e6071a
Compare
Summary
Add deterministic PROJECT-DEFINITION regeneration tool ( ask project:render) per RFC #309 Decision D14.
Deterministic layer (scripts/project_render.py):
Agent-assisted layer (documented in code comments, not implemented as code):
Taskfile integration:
Tests: 23 subprocess-based tests in ests/cli/test_project_render.py covering skeleton creation, 5-folder scanning, update preservation, timestamp refresh, staleness flagging, determinism, graceful error handling, CLI usage.
Checklist
Part of #309. Closes #323. Tracking: #338.