Tracked under ADR 0002 — Phase B. Detail: implementation plan §B1.
Problem
The current draft pipeline assumes one author and one output format. Hard-coded examples:
internal/domain/article/draft.go:25-35 requires a # title first line and rejects code fences.
internal/application/draft/prompt.go:12-51 injects "Noteにそのまま貼り付けられる日本語Markdown記事" into every system message.
internal/infrastructure/note/fetcher.go:234-246 rejects any host other than note.com.
To support both Terisuke (本人) and Cloudia (架空キャラクター) on note / cor-jp blog / Zenn / Qiita / homepage, we need two orthogonal first-class concepts in the domain.
Scope
New packages:
internal/domain/persona
- types:
Persona, PersonaID, PersonaSeed, Registry
internal/domain/format
- types:
OutputFormat, FormatID, Validator, Registry
Hooks:
domain/article.NewDraft accepts format_id, dispatches validation to the format's Validator instead of the current hard-coded rules.
domain/brief.ArticleBriefSession gains persona_id, output_format_id.
application/draft.BuildPrompt becomes BuildPrompt(persona, format, guide, brief) and pulls a per-format system fragment.
Acceptance criteria
Out of scope
- Specific format implementations beyond
note_article (those land in Phase B3).
- Persistence of persona/format ids (Phase C).
- Source fetcher changes (Phase B2).
Dependencies
- Should land before B3 (templates) and B4 (persona seeds).
Tracked under ADR 0002 — Phase B. Detail: implementation plan §B1.
Problem
The current draft pipeline assumes one author and one output format. Hard-coded examples:
internal/domain/article/draft.go:25-35requires a# titlefirst line and rejects code fences.internal/application/draft/prompt.go:12-51injects "Noteにそのまま貼り付けられる日本語Markdown記事" into every system message.internal/infrastructure/note/fetcher.go:234-246rejects any host other thannote.com.To support both Terisuke (本人) and Cloudia (架空キャラクター) on note / cor-jp blog / Zenn / Qiita / homepage, we need two orthogonal first-class concepts in the domain.
Scope
New packages:
internal/domain/personaPersona,PersonaID,PersonaSeed,Registryinternal/domain/formatOutputFormat,FormatID,Validator,RegistryHooks:
domain/article.NewDraftacceptsformat_id, dispatches validation to the format'sValidatorinstead of the current hard-coded rules.domain/brief.ArticleBriefSessiongainspersona_id,output_format_id.application/draft.BuildPromptbecomesBuildPrompt(persona, format, guide, brief)and pulls a per-format system fragment.Acceptance criteria
go test ./...passes with at least the existingnote_articleformat registered.if format == "note_article"exists in application/handler code; all branching is through strategy dispatch.BuildPromptis unit-tested for each registered format.cor_instrument× note) produce byte-identical or near-identical drafts to before this refactor (regression safety).Out of scope
note_article(those land in Phase B3).Dependencies