Skip to content

[#199] Add PlotLink contentType metadata to OWS New Story flow#212

Merged
realproject7 merged 1 commit into
mainfrom
task/199-content-type-metadata
May 27, 2026
Merged

[#199] Add PlotLink contentType metadata to OWS New Story flow#212
realproject7 merged 1 commit into
mainfrom
task/199-content-type-metadata

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Add Fiction/Cartoon content type selector modal to New Story creation flow
  • Persist contentType in additive .story.json metadata per story directory
  • Show "Cartoon" badge in sidebar for cartoon stories; fiction stories have no badge (default)
  • Add POST /api/stories/:name/metadata endpoint to write/update .story.json
  • Existing stories default to contentType: "fiction" when .story.json is missing — no migration needed
  • Add vitest unit tests for readStoryMeta / writeStoryMeta (7 tests)
  • Update CLAUDE.md and generated CLAUDE.md with new endpoint and file structure

Test plan

  • npm run typecheck passes
  • npm run lint passes (no new warnings)
  • npm run test passes (48 tests, including 7 new metadata tests)
  • Start npm run app:dev — "+ New Story" opens content type modal
  • Selecting Fiction creates session identical to previous behavior (no badge)
  • Selecting Cartoon creates session, "Cartoon" badge appears after story directory detected
  • Cancel dismisses modal without creating session
  • Existing stories without .story.json show as fiction (no badge)
  • Terminal, wallet, and publish flows remain unchanged

Closes #199

🤖 Generated with Claude Code

Add Fiction/Cartoon content type selector to the New Story creation
flow, persist contentType in additive .story.json metadata, and show
a Cartoon badge in the sidebar for cartoon stories. Existing stories
default to fiction with no migration needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

This PR implements the #199 contentType flow with a focused additive metadata file, a new Fiction/Cartoon creation selector, and sidebar visibility for cartoon stories. Existing stories default to fiction and the changes avoid terminal/session/wallet/publish internals.

Findings

  • No blocking findings.

Decision

Approved. The implementation matches the issue acceptance criteria, keeps the scope narrow, and CI is passing: lint, typecheck, and tests all succeeded.

@realproject7
Copy link
Copy Markdown
Owner Author

@re2 verdict: APPROVE

Reviewed:

  • Route ordering: POST /:name/metadata sits correctly between GET /:name and GET /:name/:file. No method or path conflicts with existing routes (/archive, /restore, /:name/:file/publish-status).
  • Security: safeName() applied to :name param, contentType strictly validated against "fiction" | "cartoon", story directory existence checked before write.
  • readStoryMeta / writeStoryMeta: Robust error handling — malformed JSON, missing file, and unknown contentType values all default to "fiction". Consistent with existing readPublishStatus / writePublishStatus pattern.
  • Tests: 7 tests cover all edge cases (missing file, valid values, malformed JSON, unknown value, create, overwrite).
  • UI: Modal is clean. contentTypeMap ref correctly bridges the untitled-session phase with the actual story directory creation. Cleanup on destroy handled. Silent .catch(() => {}) on metadata write consistent with codebase conventions.
  • Sidebar badge: flex-shrink-0 on badge and count prevents layout overflow. Badge only shown for cartoon (fiction is the unmarked default) — correct UX.
  • Backward compatibility: contentType optional in StoryBrowser interface, existing stories default to fiction without migration. .story.json is additive and ignored by v1.0.33 scanner (filters .md only). Meets rollback policy from Operator Gate: confirm webtoon rollout baseline and rollback policy #198.
  • CONTENT_TYPES constant added to lib/genres.ts with proper type export.

No issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add PlotLink contentType metadata to OWS New Story flow

2 participants