051 — At code level 3 a story file takes its number from its issue (#261)

Why

tp idea story numbers a story one above the highest file in the checkout's docs/stories/. Two stories scaffolded before either lands are cut from the same base and take the same number: #255 and #257 were both numbered 049, and one was renamed by hand. With agents building several stories at once that is every pair of stories in flight. The number is cited, by ADRs (stories/046-…), by the documentation and by code comments (story 043), so a clash found after the build is not only a rename.

At level 3 a piece of work already keeps one number from the thought to the release: its issue's. The forge hands those out, so two stories cannot share one, and a second number exists only to be kept in step with the first.

What changes

  • tp idea story N: the file is docs/stories/<N>-slug.md and its heading # <N> — TITLE (#N), N padded to three digits as the numbers before it were. It refuses when a story numbered N is in docs/stories/ already, which is a directory listing and is asked each time.
  • docs/story.md (Numbering) and docs/idea.md (Ready: a story).

Acceptance

tp idea story N [TITLE] at maturity.code: 3, issue N open and labelled idea or roadmap; the other rows of story 043 are as they were.

N docs/stories/ Outcome
261 no file numbered 261 261-slug.md written, headed # 261 — TITLE (#261); the issue relabelled story
261 files numbered up to 048, and 049 and 050 from before this story the same: the highest number is not read
7 no file numbered 007 007-slug.md, headed # 007 — TITLE (#7)
1203 no file numbered 1203 1203-slug.md
40 040-other.md, a story of another issue or of none error naming 040-other.md; no file written; the issue's labels unchanged
261 261-slug.md, headed (#261) error: it is a story already, as today
maturity.code Command Outcome
0, 1 tp story new TITLE one above the highest number, as today
3 tp story define, review, call, land, query find the story by the (#N) on its heading, as today, whatever its file's number

Out of scope

  • Renumbering the stories written before this one, 049 and 050 among them: they keep their numbers and are found by their headings.
  • Looking across every repository for an old story whose number a future issue will take: the refusal is made when it happens, costs a directory listing, and names the file to rename.
  • Dropping the (#N) from a heading that now begins with N: every reader of a story finds its issue there.
  • Numbering below level 3.

Decisions

None.

Done when

  • tests express the acceptance table and pass
  • spec updated
  • changelog entry
  • issue closed with a link to the release