chore: implement rdb init project structure

This commit is contained in:
2026-06-02 06:13:43 +01:00
parent 7cb7034704
commit 6211a391b5
7 changed files with 104 additions and 5 deletions
+2 -2
View File
@@ -2,11 +2,11 @@
## Current Stage ## Current Stage
DISCOVERY BUILDING
## Current Task ## Current Task
TASK-000Bootstrap RDB project standards TASK-002Run initial project discovery
## Instructions For Agent ## Instructions For Agent
+1 -1
View File
@@ -4,7 +4,7 @@ Current Stage: BUILDING
Previous Stage: BOOTSTRAP_READY Previous Stage: BOOTSTRAP_READY
Next Stage: REVIEW_READY Next Stage: REVIEW_READY
Current Task: TASK-001 Current Task: TASK-002
Active Branch: main Active Branch: main
Last Updated: 2026-06-01 Last Updated: 2026-06-01
+19
View File
@@ -39,6 +39,25 @@ rdb handoff
5. Give the next task to Claude Code or Cline 5. Give the next task to Claude Code or Cline
6. Commit after each completed task 6. Commit after each completed task
## Project structure
`rdb init` creates the following files (skips existing ones):
- context/discovery-log.md
- context/product-brief.md
- context/architecture.md
- context/decisions.md
- context/risks.md
- context/assumptions.md
- context/open-questions.md
- context/repository-context.md
- TASKS.md
- TEST_PLAN.md
- RUN_LOG.md
- PROJECT_STATE.md
- AGENT_HANDOFF.md
- .rdb/project.json
## Principle ## Principle
Markdown files are the source of truth. No database is required. Markdown files are the source of truth. No database is required.
+1
View File
@@ -4,3 +4,4 @@ Run Log
Bootstrap project structure created. Bootstrap project structure created.
Fixed TASKS.md parser to match em/en dashes in task headings. Fixed TASKS.md parser to match em/en dashes in task headings.
TASK-000 marked Done — bootstrap standards complete. TASK-000 marked Done — bootstrap standards complete.
TASK-001 marked Done — rdb init creates all project control files.
+1 -1
View File
@@ -18,6 +18,6 @@ Acceptance Criteria:
## TASK-001 — Implement rdb init ## TASK-001 — Implement rdb init
Status: Todo Status: Done
Goal: Create the command that initialises the standard RDB project structure. Goal: Create the command that initialises the standard RDB project structure.
+51
View File
@@ -71,6 +71,57 @@ TBD
| ID | Assumption | Confidence | Validation Needed | | ID | Assumption | Confidence | Validation Needed |
|---|---|---|---| |---|---|---|---|
""",
"context/repository-context.md": """# Repository Context
## Purpose
TBD
## Key Components
TBD
## Dependencies
TBD
## Contributing
TBD
""",
"PROJECT_STATE.md": """# Project State
Current Stage: DISCOVERY
Previous Stage: NONE
Next Stage: BOOTSTRAP_READY
Current Task: None
Active Branch: main
Last Updated: TBD
""",
"AGENT_HANDOFF.md": """# Agent Handoff
## Current Stage
DISCOVERY
## Instructions For Agent
- Complete one task only
- Make the smallest useful change
- Update documentation
- Run tests
- Commit changes
- Stop after task completion
""",
".rdb/project.json": """{
"name": "rdb-discovery",
"stage": "DISCOVERY",
"tasks": [],
"created": "TBD"
}
""", """,
"context/open-questions.md": """# Open Questions "context/open-questions.md": """# Open Questions
+29 -1
View File
@@ -1,6 +1,6 @@
from pathlib import Path from pathlib import Path
from rdb_discovery.templates import write_file_if_missing from rdb_discovery.templates import CONTEXT_FILES, write_file_if_missing
def test_write_file_if_missing(tmp_path: Path) -> None: def test_write_file_if_missing(tmp_path: Path) -> None:
@@ -8,3 +8,31 @@ def test_write_file_if_missing(tmp_path: Path) -> None:
assert (tmp_path / "context" / "test.md").read_text(encoding="utf-8") == "hello" assert (tmp_path / "context" / "test.md").read_text(encoding="utf-8") == "hello"
assert write_file_if_missing(tmp_path, "context/test.md", "changed") is False assert write_file_if_missing(tmp_path, "context/test.md", "changed") is False
assert (tmp_path / "context" / "test.md").read_text(encoding="utf-8") == "hello" assert (tmp_path / "context" / "test.md").read_text(encoding="utf-8") == "hello"
def test_all_context_files_have_content() -> None:
for path, content in CONTEXT_FILES.items():
assert content.strip(), f"Empty content for {path}"
def test_init_creates_all_files(tmp_path: Path) -> None:
for relative_path, content in CONTEXT_FILES.items():
write_file_if_missing(tmp_path, relative_path, content)
for relative_path in CONTEXT_FILES:
assert (tmp_path / relative_path).exists(), f"Missing {relative_path}"
def test_init_skips_existing_files(tmp_path: Path) -> None:
skipped = []
for relative_path, content in CONTEXT_FILES.items():
target = tmp_path / relative_path
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text("existing", encoding="utf-8")
result = write_file_if_missing(tmp_path, relative_path, content)
if not result:
skipped.append(relative_path)
assert skipped == list(CONTEXT_FILES)
assert (tmp_path / "TASKS.md").read_text(encoding="utf-8") == "existing"