story-kit: accept 116_story_story_kit_init_command_scaffolds_a_new_project

This commit is contained in:
Dave
2026-02-24 14:38:39 +00:00
parent af39d34993
commit 115d1f4758

View File

@@ -0,0 +1,43 @@
---
name: "Init command scaffolds deterministic project structure"
---
# Story 116: Init command scaffolds deterministic project structure
## User Story
As a new Story Kit user, I want to point at a directory and have the `.story_kit/` workflow structure scaffolded automatically, so that I have a working pipeline without manual configuration.
## Context
Currently `scaffold_story_kit()` in `server/src/io/fs.rs`:
- Creates the old `stories/archive/` structure instead of the `work/` pipeline dirs
- Writes `00_CONTEXT.md` and `STACK.md` with content that describes Story Kit itself, not a blank template for the user's project
- Does not create `project.toml` (agent config)
- Does not create `.mcp.json` (MCP endpoint registration)
- Does not run `git init`
- The embedded `STORY_KIT_README` constant is a stale copy that diverges from the actual `.story_kit/README.md` checked into this repo
## Acceptance Criteria
- [ ] Creates the `work/` pipeline: `work/1_upcoming/`, `work/2_current/`, `work/3_qa/`, `work/4_merge/`, `work/5_archived/` — each with a `.gitkeep` file so empty dirs survive git clone
- [ ] Removes creation of the old `stories/` and `stories/archive/` directories
- [ ] Creates `specs/`, `specs/tech/`, `specs/functional/` (unchanged)
- [ ] Creates `script/test` with the existing stub (unchanged)
- [ ] Writes `.story_kit/README.md` using `include_str!` to embed the canonical README.md at build time (replacing the stale `STORY_KIT_README` constant)
- [ ] Writes `.story_kit/project.toml` with a sensible default agent config (one coder agent, one qa agent, one mergemaster — using `sonnet` model aliases)
- [ ] Writes `.mcp.json` in the project root with the default port (reuse `write_mcp_json` from `worktree.rs`)
- [ ] Writes `specs/00_CONTEXT.md` as a blank template with section headings (High-Level Goal, Core Features, Domain Definition, Glossary) and placeholder instructions — NOT content about Story Kit itself
- [ ] Writes `specs/tech/STACK.md` as a blank template with section headings (Core Stack, Coding Standards, Quality Gates, Libraries) and placeholder instructions — NOT content about Story Kit itself
- [ ] Runs `git init` if the directory is not already a git repo
- [ ] Makes an initial commit with the scaffolded files (only on fresh `git init`, not into an existing repo)
- [ ] Unit tests for `scaffold_story_kit()` that run against a temp directory and verify: all expected directories exist, all expected files exist with correct content, `.gitkeep` files are present in work dirs, template specs contain placeholder headings (not Story Kit content), `project.toml` has valid default agent config, `.mcp.json` is valid JSON with correct endpoint
- [ ] Test that scaffold is idempotent — running it twice on the same directory doesn't overwrite or duplicate files
- [ ] Test that scaffold into an existing git repo does not run `git init` or create an initial commit
## Out of Scope
- Interactive onboarding (guided conversation to populate specs) — see Story 139
- Generating actual application code or project boilerplate (e.g. `cargo init`, `create-react-app`) — Story Kit is stack-agnostic, it only scaffolds the `.story_kit/` workflow layer
- Template galleries or presets for common stacks (future enhancement)
- Migrating existing projects that already have a `.story_kit/` directory