From ced0d276b46fe24ff0f73b37ac8fbf46baeccb2a Mon Sep 17 00:00:00 2001 From: typebasedio Date: Fri, 10 Apr 2026 14:31:39 -0400 Subject: [PATCH] feat(v0.3): add built-in project CLAUDE.md template ClaudeMDProject returns the project-oriented default used when --project is passed (and no project seed overrides it). Adds tests asserting required v0.3 spec sections and ASCII-only content. --- internal/seed/templates.go | 34 +++++++++++++++++++++++++++++++++ internal/seed/templates_test.go | 28 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/internal/seed/templates.go b/internal/seed/templates.go index f658afb..2fe5196 100644 --- a/internal/seed/templates.go +++ b/internal/seed/templates.go @@ -39,6 +39,40 @@ Keep it concise -- a few bullet points is enough. ` } +// ClaudeMDProject returns the built-in default CLAUDE.md content for a project workspace. +func ClaudeMDProject() string { + return `# Project Workspace Guidelines + +This is a ctask project workspace -- a long-lived working environment, not a disposable task. + +## File Placement + +- Source code -> ` + "`src/`" + ` or workspace root +- Documentation -> ` + "`docs/`" + ` +- Deliverables and exports -> ` + "`output/`" + ` +- Reference material -> ` + "`context/`" + ` +- Tests -> ` + "`tests/`" + ` +- Configuration files -> workspace root +- Do not place non-code outputs in the workspace root + +## Conventions + +- This project uses git. Commit meaningful changes with clear messages. +- Do not install global packages or modify system files unless asked. +- Record important assumptions and actions in notes.md. +- Keep the workspace root clean. + +## Session Handoff + +Before ending a session, append a brief summary to notes.md with: + +- What was accomplished +- Key decisions made +- Open follow-ups or unfinished work +- How to continue from here +` +} + // NotesMD returns the skeleton notes.md content. func NotesMD(title string) string { return fmt.Sprintf(`# %s diff --git a/internal/seed/templates_test.go b/internal/seed/templates_test.go index c0df5e2..7a2f18c 100644 --- a/internal/seed/templates_test.go +++ b/internal/seed/templates_test.go @@ -34,6 +34,34 @@ func TestClaudeMDContainsV03Sections(t *testing.T) { } } +func TestClaudeMDProjectIsASCII(t *testing.T) { + content := ClaudeMDProject() + for i, b := range []byte(content) { + if b > 127 { + t.Errorf("non-ASCII byte 0x%02x at position %d in project CLAUDE.md template", b, i) + break + } + } +} + +func TestClaudeMDProjectContainsRequiredSections(t *testing.T) { + content := ClaudeMDProject() + for _, want := range []string{ + "# Project Workspace Guidelines", + "long-lived working environment", + "## File Placement", + "Source code -> ", + "Tests -> ", + "## Conventions", + "This project uses git", + "## Session Handoff", + } { + if !strings.Contains(content, want) { + t.Errorf("project CLAUDE.md missing required section: %q", want) + } + } +} + func TestNotesMDIsASCII(t *testing.T) { content := NotesMD("test title") for i, b := range []byte(content) {