cowriter 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +283 -0
  2. package/assets/cowriter-header.png +0 -0
  3. package/frontend/app/api/cowriter/codex/route.ts +65 -0
  4. package/frontend/app/api/cowriter/cover/route.ts +45 -0
  5. package/frontend/app/api/cowriter/events/hub.ts +24 -0
  6. package/frontend/app/api/cowriter/events/route.ts +77 -0
  7. package/frontend/app/api/cowriter/route.ts +83 -0
  8. package/frontend/app/api/cowriter/selection/route.ts +69 -0
  9. package/frontend/app/api/cowriter/selection/store.ts +27 -0
  10. package/frontend/app/globals.css +274 -0
  11. package/frontend/app/layout.tsx +14 -0
  12. package/frontend/app/page.tsx +1554 -0
  13. package/frontend/components/ui.tsx +66 -0
  14. package/frontend/lib/highlight.ts +53 -0
  15. package/frontend/lib/markdown.ts +47 -0
  16. package/frontend/lib/project.ts +335 -0
  17. package/frontend/lib/skills.ts +15 -0
  18. package/frontend/lib/turndown-plugin-gfm.d.ts +5 -0
  19. package/frontend/lib/types.ts +143 -0
  20. package/frontend/lib/utils.ts +6 -0
  21. package/frontend/lib/writing-skills.json +58 -0
  22. package/frontend/next-env.d.ts +6 -0
  23. package/frontend/next.config.js +10 -0
  24. package/frontend/package.json +44 -0
  25. package/frontend/postcss.config.mjs +7 -0
  26. package/frontend/tsconfig.json +22 -0
  27. package/package.json +62 -0
  28. package/scripts/cowriter-ai.mjs +1126 -0
  29. package/templates/init/.codex/skills/cowriter/SKILL.md +273 -0
  30. package/templates/init/.codex/skills/cowriter/references/actions.md +52 -0
  31. package/templates/init/.codex/skills/cowriter/references/character-voice.md +23 -0
  32. package/templates/init/.codex/skills/cowriter/references/context-priming.md +15 -0
  33. package/templates/init/.codex/skills/cowriter/references/continuity-review.md +22 -0
  34. package/templates/init/.codex/skills/cowriter/references/import-existing.md +16 -0
  35. package/templates/init/.codex/skills/cowriter/references/onboarding.md +45 -0
  36. package/templates/init/.codex/skills/cowriter/references/project-model.md +45 -0
  37. package/templates/init/.codex/skills/cowriter/references/prose-diagnostics.md +33 -0
  38. package/templates/init/.codex/skills/cowriter/references/prose-review.md +22 -0
  39. package/templates/init/.codex/skills/cowriter/references/scene-planning.md +28 -0
  40. package/templates/init/.codex/skills/cowriter/references/state-updates.md +22 -0
  41. package/templates/init/.codex/skills/cowriter/references/title-brainstorming.md +27 -0
  42. package/templates/init/.cowriter/project.yaml +3 -0
  43. package/templates/init/.cowriter/reports/.gitkeep +1 -0
  44. package/templates/init/AGENTS.md +79 -0
  45. package/templates/init/chapters/001-opening.md +0 -0
  46. package/templates/init/characters/primary-character.yaml +6 -0
  47. package/templates/init/outline.yaml +4 -0
  48. package/templates/init/story.yaml +8 -0
@@ -0,0 +1,79 @@
1
+ # Cowriter Book Project
2
+
3
+ This folder is a Cowriter book project. Keep manuscript and story materials
4
+ as the center of gravity.
5
+
6
+ Use the Cowriter workspace from the app repo:
7
+
8
+ ```sh
9
+ npx cowriter info -o json
10
+ npx cowriter inspect -o json
11
+ npx cowriter serve --open
12
+ npx cowriter upgrade
13
+ ```
14
+
15
+ Durable files:
16
+
17
+ - `chapters/*.md` for manuscript chapters.
18
+ - `story.yaml` for title, synopsis, setting, themes, genre, tone, perspective,
19
+ and continuity.
20
+ - `characters/*.yaml` for character records.
21
+ - `outline.yaml` for outline beats.
22
+ - `.cowriter/project.yaml` for project metadata.
23
+
24
+ You should edit these files directly. Do not hold accepted manuscript or
25
+ story-bible changes in chat, and do not require action JSON for normal writing
26
+ edits.
27
+
28
+ Ask one onboarding question at a time. Wait for the writer's answer before
29
+ asking the next question; do not bundle premise, protagonist, setting, ending,
30
+ and folder questions into one turn unless the writer explicitly asks for a
31
+ checklist.
32
+
33
+ If the localhost Cowriter workspace is not open in Codex Browser, or it is
34
+ open on a different port, tell the writer to run
35
+ `npx cowriter serve --open` from the book folder and open the reported
36
+ localhost URL. Do not start the long-running serve process yourself unless the
37
+ writer explicitly asks.
38
+
39
+ The workspace publishes current manuscript selection context for the served book.
40
+ If the writer asks about selected text and that text is not already available in
41
+ chat or file context, use the selection API when it would materially improve the
42
+ response:
43
+
44
+ ```sh
45
+ curl -sS "$COWRITER_URL/api/cowriter/selection"
46
+ ```
47
+
48
+ The response includes `selection.selectedText`, chapter metadata, range,
49
+ surrounding text, and `updatedAt`, or `selection: null` when nothing useful is
50
+ selected. Treat the endpoint as optional context, not a required step for every
51
+ request.
52
+
53
+ When discussing a specific manuscript passage with the writer, call the
54
+ Cowriter highlight API so the web UI selects that passage. Derive
55
+ `COWRITER_URL` from `cowriter info -o json` at `app.url`, then call:
56
+
57
+ ```sh
58
+ curl -sS -X POST "$COWRITER_URL/api/cowriter/codex" \
59
+ -H 'content-type: application/json' \
60
+ --data '{"command":"highlight","text":"exact passage text","chapterPath":"chapters/001-opening.md"}'
61
+ ```
62
+
63
+ Use `occurrence` when the same passage appears more than once. If the UI is not
64
+ open or the passage is not found, continue the writing conversation normally.
65
+
66
+ Save approved changes as you go. When the writer accepts a manuscript or
67
+ story-material change, immediately edit the relevant `chapters/*.md`,
68
+ `story.yaml`, `characters/*.yaml`, or `outline.yaml` file, then inspect the
69
+ project to confirm it changed. The Cowriter web workspace watches these
70
+ files and reloads automatically.
71
+
72
+ Commit at sensible creative checkpoints: after accepted onboarding material, a
73
+ scene/chapter draft or revision pass, a stable continuity/story-bible update,
74
+ before switching task types, and before pausing or ending a work session.
75
+ Before committing, run `git status --short`, review the relevant diff, and
76
+ stage only Cowriter book files for the completed writing unit. Saving and
77
+ committing are separate responsibilities.
78
+
79
+ Write YAML and markdown with 80 character line wraps.
File without changes
@@ -0,0 +1,6 @@
1
+ id: primary-character
2
+ name: ""
3
+ role: ""
4
+ desire: ""
5
+ conflict: ""
6
+ notes: ""
@@ -0,0 +1,4 @@
1
+ beats:
2
+ - id: opening-beat
3
+ title: ""
4
+ summary: ""
@@ -0,0 +1,8 @@
1
+ title: {{title}}
2
+ synopsis: {{synopsis}}
3
+ setting: ""
4
+ themes: ""
5
+ genre: ""
6
+ tone: ""
7
+ perspective: ""
8
+ continuity: ""