diff --git a/AGENT_HANDOFF.md b/AGENT_HANDOFF.md index 83d848c..2fd49ab 100644 --- a/AGENT_HANDOFF.md +++ b/AGENT_HANDOFF.md @@ -2,11 +2,11 @@ ## Current Stage -DISCOVERY +BUILDING ## Current Task -TASK-000 — Bootstrap RDB project standards +TASK-002 — Run initial project discovery ## Instructions For Agent diff --git a/PROJECT_STATE.md b/PROJECT_STATE.md index 0630b15..3ef256d 100644 --- a/PROJECT_STATE.md +++ b/PROJECT_STATE.md @@ -4,7 +4,7 @@ Current Stage: BUILDING Previous Stage: BOOTSTRAP_READY Next Stage: REVIEW_READY -Current Task: TASK-001 +Current Task: TASK-002 Active Branch: main Last Updated: 2026-06-01 diff --git a/README.md b/README.md index 6d517e0..bf9ddba 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,25 @@ rdb handoff 5. Give the next task to Claude Code or Cline 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 Markdown files are the source of truth. No database is required. diff --git a/RUN_LOG.md b/RUN_LOG.md index 62db5a0..234d8a4 100644 --- a/RUN_LOG.md +++ b/RUN_LOG.md @@ -4,3 +4,4 @@ Run Log Bootstrap project structure created. Fixed TASKS.md parser to match em/en dashes in task headings. TASK-000 marked Done — bootstrap standards complete. +TASK-001 marked Done — rdb init creates all project control files. diff --git a/TASKS.md b/TASKS.md index 6db295c..7ff8999 100644 --- a/TASKS.md +++ b/TASKS.md @@ -18,6 +18,6 @@ Acceptance Criteria: ## TASK-001 — Implement rdb init -Status: Todo +Status: Done Goal: Create the command that initialises the standard RDB project structure. diff --git a/src/rdb_discovery/templates.py b/src/rdb_discovery/templates.py index 3becffd..28dec61 100644 --- a/src/rdb_discovery/templates.py +++ b/src/rdb_discovery/templates.py @@ -71,6 +71,57 @@ TBD | 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 diff --git a/tests/test_templates.py b/tests/test_templates.py index c203dd1..fd8a1e0 100644 --- a/tests/test_templates.py +++ b/tests/test_templates.py @@ -1,6 +1,6 @@ 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: @@ -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 write_file_if_missing(tmp_path, "context/test.md", "changed") is False 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"