lib: idea-code generator + plan_md yaml-frontmatter parser (M12 T-494)
- lib/idea-code.ts: pure formatIdeaCode helper (client-safe, no prisma) - lib/idea-code-server.ts: atomic nextIdeaCode via Prisma row-lock, accepts optional TransactionClient for combining with idea.create - lib/idea-plan-parser.ts: parsePlanMd extracts ---yaml---/body, runs yaml.parse + ideaPlanMdFrontmatterSchema, returns line-info on failure; CRLF-tolerant - adds yaml@^2.8.4 dependency - 8 unit tests (parser happy/missing/yaml-error/zod-error/empty-stories/CRLF; formatIdeaCode pad-3 + overflow) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bba3f11269
commit
dfee518996
7 changed files with 236 additions and 4 deletions
8
lib/idea-code.ts
Normal file
8
lib/idea-code.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// Pure helpers voor IDEA-codes. Geen DB-imports — daarom client-safe.
|
||||
// De DB-mutating nextIdeaCode staat in lib/idea-code-server.ts.
|
||||
|
||||
const PAD = 3 // "IDEA-001". Bumps to 4 digits at counter 1000 organically.
|
||||
|
||||
export function formatIdeaCode(n: number): string {
|
||||
return `IDEA-${String(n).padStart(PAD, '0')}`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue