openwriter 0.40.1 → 0.40.2

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 (56) hide show
  1. package/dist/plugins/authors-voice/dist/index.d.ts +48 -0
  2. package/dist/plugins/authors-voice/dist/index.js +235 -0
  3. package/dist/plugins/authors-voice/package.json +24 -0
  4. package/dist/plugins/authors-voice/skill/LICENSE +21 -0
  5. package/dist/plugins/authors-voice/skill/README.md +126 -0
  6. package/dist/plugins/authors-voice/skill/SKILL.md +151 -0
  7. package/dist/plugins/authors-voice/skill/catalog/ai-tells.md +144 -0
  8. package/dist/plugins/authors-voice/skill/catalog/anchor-prompt.md +189 -0
  9. package/dist/plugins/authors-voice/skill/catalog/author-hints.md +119 -0
  10. package/dist/plugins/authors-voice/skill/catalog/fingerprints.md +175 -0
  11. package/dist/plugins/authors-voice/skill/catalog/hurdle.md +76 -0
  12. package/dist/plugins/authors-voice/skill/catalog/post-write-audit.md +105 -0
  13. package/dist/plugins/authors-voice/skill/docs/analysis.md +31 -0
  14. package/dist/plugins/authors-voice/skill/docs/anchor-iteration.md +176 -0
  15. package/dist/plugins/authors-voice/skill/docs/api/import.md +78 -0
  16. package/dist/plugins/authors-voice/skill/docs/api/protocol.md +140 -0
  17. package/dist/plugins/authors-voice/skill/docs/api/setup.md +37 -0
  18. package/dist/plugins/authors-voice/skill/docs/api/tools.md +102 -0
  19. package/dist/plugins/authors-voice/skill/docs/api/troubleshooting.md +7 -0
  20. package/dist/plugins/authors-voice/skill/docs/apply-protocol-deep.md +191 -0
  21. package/dist/plugins/authors-voice/skill/docs/context-hygiene.md +33 -0
  22. package/dist/plugins/authors-voice/skill/docs/setup.md +74 -0
  23. package/dist/plugins/authors-voice/skill/docs/tiers.md +13 -0
  24. package/dist/plugins/authors-voice/skill/package.json +35 -0
  25. package/dist/plugins/authors-voice/skill/prompts/skeleton.md +29 -0
  26. package/dist/plugins/authors-voice/skill/voice/README.md +51 -0
  27. package/dist/plugins/authors-voice/skill/voice/corpus/.gitkeep +0 -0
  28. package/dist/plugins/github/dist/blog-tools.d.ts +84 -0
  29. package/dist/plugins/github/dist/blog-tools.js +1208 -0
  30. package/dist/plugins/github/dist/git-sync.d.ts +46 -0
  31. package/dist/plugins/github/dist/git-sync.js +335 -0
  32. package/dist/plugins/github/dist/helpers.d.ts +127 -0
  33. package/dist/plugins/github/dist/helpers.js +67 -0
  34. package/dist/plugins/github/dist/index.d.ts +12 -0
  35. package/dist/plugins/github/dist/index.js +112 -0
  36. package/dist/plugins/github/package.json +24 -0
  37. package/dist/plugins/image-gen/dist/index.d.ts +35 -0
  38. package/dist/plugins/image-gen/dist/index.js +149 -0
  39. package/dist/plugins/image-gen/package.json +26 -0
  40. package/dist/plugins/publish/dist/helpers.d.ts +66 -0
  41. package/dist/plugins/publish/dist/helpers.js +199 -0
  42. package/dist/plugins/publish/dist/index.d.ts +3 -0
  43. package/dist/plugins/publish/dist/index.js +1156 -0
  44. package/dist/plugins/publish/dist/newsletter-tools.d.ts +2 -0
  45. package/dist/plugins/publish/dist/newsletter-tools.js +394 -0
  46. package/dist/plugins/publish/package.json +31 -0
  47. package/dist/plugins/x-api/dist/index.d.ts +27 -0
  48. package/dist/plugins/x-api/dist/index.js +368 -0
  49. package/dist/plugins/x-api/dist/server-bridge.d.ts +22 -0
  50. package/dist/plugins/x-api/dist/server-bridge.js +43 -0
  51. package/dist/plugins/x-api/package.json +27 -0
  52. package/package.json +1 -1
  53. package/skill/docs/enrichment.md +180 -0
  54. package/skill/docs/footnotes.md +178 -0
  55. package/skill/docs/setup.md +62 -0
  56. package/skill/docs/welcome.md +21 -0
@@ -0,0 +1,178 @@
1
+ # Footnotes — Author Guide for Agents
2
+
3
+ OpenWriter supports CommonMark / Pandoc footnote syntax for citation-heavy
4
+ long-form writing. The editor renders inline references as superscript
5
+ chips and corrals definitions into an end-of-doc "Footnotes" section.
6
+
7
+ This doc explains how to write footnotes via MCP tools and what to expect
8
+ on disk and in the editor.
9
+
10
+ ## The syntax (Pandoc / CommonMark)
11
+
12
+ Two parts:
13
+
14
+ - **Reference** (inline): `text[^N]` — appears in the prose
15
+ - **Definition** (block): `[^N]: footnote text` — appears at end of doc
16
+
17
+ Labels can be numeric or mnemonic:
18
+
19
+ ```markdown
20
+ The body repairs itself during deep sleep[^1] too.
21
+
22
+ Per Sapolsky[^sapolsky2017], stress responses follow a pattern.
23
+
24
+ [^1]: Eibl-Eibesfeldt 1973, replicated and extended by Galati et al. 2003.
25
+
26
+ [^sapolsky2017]: Sapolsky, R. (2017). *Behave*. Penguin Press.
27
+ ```
28
+
29
+ The author label (`1` or `sapolsky2017`) is what pairs reference to
30
+ definition. **Display numbering is automatic** — the editor's CSS counter
31
+ shows sequential `[1] [2] [3]` regardless of label. Mnemonic labels stay
32
+ on disk for human-readable file diffs.
33
+
34
+ ## How to write footnotes from MCP
35
+
36
+ Just include the syntax in your markdown content — no special tool needed.
37
+
38
+ ### populate_document (initial draft)
39
+
40
+ ```ts
41
+ populate_document({
42
+ docId: "abc12345",
43
+ content: `# Chapter 1
44
+
45
+ Theory of mind develops late[^1] in non-human primates.
46
+
47
+ [^1]: Premack & Woodruff (1978), Behavioral and Brain Sciences 1: 515–526.
48
+ `
49
+ })
50
+ ```
51
+
52
+ The parser handles `[^1]` references and `[^1]: ...` definitions. The
53
+ editor renders the reference as a superscript chip and the definition
54
+ inside an end-of-doc "Footnotes" section.
55
+
56
+ ### write_to_pad (adding to existing doc)
57
+
58
+ To add a new footnote to existing prose, you have two paths.
59
+
60
+ **Append a new reference + definition together** (recommended):
61
+
62
+ ```ts
63
+ // Step 1: rewrite the paragraph to add the reference
64
+ write_to_pad({
65
+ docId: "abc12345",
66
+ changes: [
67
+ {
68
+ operation: "rewrite",
69
+ nodeId: "para_id",
70
+ content: "The same sentence now with a new claim[^2]."
71
+ }
72
+ ]
73
+ })
74
+
75
+ // Step 2: append the definition. If the doc already has a footnoteSection,
76
+ // you can insert the definition inside it via afterNodeId pointing at the
77
+ // last definition. If the doc has no footnotes yet, the parser auto-creates
78
+ // the section when it sees `[^N]: ...` at the end of the markdown body.
79
+ ```
80
+
81
+ **Simpler: just include both the reference and the definition in one
82
+ write_to_pad call**:
83
+
84
+ ```ts
85
+ write_to_pad({
86
+ docId: "abc12345",
87
+ changes: [
88
+ {
89
+ operation: "rewrite",
90
+ nodeId: "para_id",
91
+ content: "Sentence with new claim[^2]."
92
+ },
93
+ {
94
+ operation: "insert",
95
+ afterNodeId: "end",
96
+ content: "[^2]: Smith et al. (2020), Nature 580: 142–148."
97
+ }
98
+ ]
99
+ })
100
+ ```
101
+
102
+ The serializer normalizes definitions to the end-of-doc `footnoteSection`
103
+ regardless of where they're inserted in the tree.
104
+
105
+ ## What you see in `read_pad`
106
+
107
+ ```
108
+ title: My Chapter
109
+ id: abc12345
110
+ words: 423
111
+ pending: 0
112
+ ---
113
+ [h1:aa0001] Chapter 1
114
+ [p:bb0002] Theory of mind develops late[^1] in non-human primates.
115
+ [fnsec:cc0003]
116
+ [fndef:dd0004] [^1]: Premack & Woodruff (1978), Behavioral and Brain Sciences 1: 515–526.
117
+ ```
118
+
119
+ The `[^N]` in the body is the inline reference. `[fnsec:...]` is the
120
+ end-of-doc section. `[fndef:...]` is each definition.
121
+
122
+ ## Per-doc scope — important
123
+
124
+ **Footnote labels are local to each doc.** Chapter 3's `[^1]` does not
125
+ refer to Chapter 4's `[^1]`. Each chapter is its own `.md` file with its
126
+ own numbering. Cross-chapter references are not supported at the editor
127
+ level (a future book-export pipeline will handle global numbering at
128
+ typeset time).
129
+
130
+ If the author writes "see Ch 1 note 4" they're writing prose, not a
131
+ cross-doc footnote link.
132
+
133
+ ## Multi-paragraph definitions
134
+
135
+ Pandoc allows multi-paragraph footnotes via 4-space-indented continuation:
136
+
137
+ ```markdown
138
+ [^1]: First paragraph of the definition.
139
+
140
+ Continuation paragraph, indented 4 spaces.
141
+
142
+ Another continuation.
143
+ ```
144
+
145
+ The editor preserves the multi-paragraph structure inside the definition.
146
+ Use this for footnotes that need substantial explanation (lengthy
147
+ methodology notes, multi-source citations, etc.).
148
+
149
+ ## What's NOT supported (yet)
150
+
151
+ - **Cross-doc footnote references.** Each doc has its own numbering.
152
+ - **Bibliography auto-generation.** Authors manage citation text inline.
153
+ Zotero / Mendeley / BibTeX integration is a future enhancement.
154
+ - **DOI auto-resolution.** Footnote text is plain — paste a DOI manually.
155
+ - **Per-page footnotes (Phase 3).** The editor uses end-of-doc placement;
156
+ per-page placement is a print-layout concern handled at book-export
157
+ time, not in the editor.
158
+
159
+ ## When to use footnotes vs inline parentheticals
160
+
161
+ Use footnotes when:
162
+ - The citation count exceeds ~3 per ~500 words (inline parentheticals
163
+ start visibly disrupting the prose at that density)
164
+ - The audience expects an academic register (popular nonfiction in the
165
+ Sapolsky / Wrangham / Pinker lineage)
166
+ - The work targets book-class output (cumulative citation load at book
167
+ scale destroys readability under inline parentheticals)
168
+
169
+ Use inline parentheticals when:
170
+ - Citations are sparse (<1 per 500 words) and short
171
+ - The author prefers a journalistic register
172
+ - The work is short-form (tweet thread, blog post) where there's no
173
+ end-of-doc section to defer to
174
+
175
+ ## Reference docs (for the editor maintainers, not agents)
176
+
177
+ - `docs/footnotes.md` (in the openwriter repo): full architecture
178
+ - `adr/footnote-system.md`: load-bearing invariants + decision log
@@ -0,0 +1,62 @@
1
+ # OpenWriter Setup
2
+
3
+ ## Quick install
4
+
5
+ ```bash
6
+ npx openwriter setup
7
+ ```
8
+
9
+ This installs openwriter globally, configures the MCP server for Claude Code, and copies this skill — all in one step. After it finishes, the user just needs to restart their Claude Code session.
10
+
11
+ ## Claude Code
12
+
13
+ **Fallback (if the command above fails):** Do it manually:
14
+
15
+ ```bash
16
+ npm install -g openwriter
17
+ claude mcp add -s user openwriter -- openwriter --no-open
18
+ ```
19
+
20
+ If `claude mcp add` can't run (e.g. nested session error), edit `~/.claude.json` directly. Add `openwriter` as the **first entry** in `mcpServers`:
21
+
22
+ ```json
23
+ {
24
+ "mcpServers": {
25
+ "openwriter": {
26
+ "command": "openwriter",
27
+ "args": ["--no-open"]
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ ## OpenCode
34
+
35
+ Same binary, different config format. Add to `opencode.json` at the project root:
36
+
37
+ ```json
38
+ {
39
+ "$schema": "https://opencode.ai/config.json",
40
+ "mcp": {
41
+ "openwriter": {
42
+ "type": "local",
43
+ "command": ["openwriter", "--no-open"],
44
+ "enabled": true
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ OpenCode auto-discovers the skill at `~/.claude/skills/openwriter/SKILL.md` — no copy needed.
51
+
52
+ The enrichment minion is NOT auto-discovered. Place it at one of:
53
+
54
+ - `~/.config/opencode/agents/openwriter-enrichment-minion.md` (global, all projects)
55
+ - `.opencode/agents/openwriter-enrichment-minion.md` (this project only, repo root)
56
+
57
+ Source file lives at `~/.claude/skills/openwriter/agents/openwriter-enrichment-minion.md` after `npx openwriter setup`. Copy it to one of the paths above and restart OpenCode. The filename becomes the agent name OpenCode resolves when the parent dispatches it.
58
+
59
+ ## After setup
60
+
61
+ 1. Restart your Claude Code or OpenCode session (MCP servers load on startup)
62
+ 2. Open http://localhost:5050 in your browser
@@ -0,0 +1,21 @@
1
+ # Welcome to OpenWriter
2
+
3
+ What you're looking at right now is how we collaborate. These green highlights are my proposed changes — I write, you review. Use the review panel on the right to navigate (j/k), accept (a), or reject (r) each change. Try it now.
4
+
5
+ ## Create Documents
6
+
7
+ Hit the **+** button in the sidebar to create different document types: blog posts, newsletters, tweets, LinkedIn posts, and articles. Each type has its own compose view tailored to that format. Or just ask me to write something and I'll create the right doc type for you.
8
+
9
+ ## Workspaces
10
+
11
+ Organize your documents into workspaces with containers and tags. This is especially powerful for book writing — each chapter is a document, grouped into sections as containers. I can see your full workspace structure and work across multiple docs.
12
+
13
+ ## Plugins
14
+
15
+ **Author's Voice** — Feed me your writing samples and I'll write in your voice. Not an approximation — I pull your actual patterns, cadence, and word choices from your corpus.
16
+
17
+ **Publish** — Send newsletters to your subscriber list, post to X/Twitter, publish blog posts to GitHub, and schedule content. All from inside the editor, no copy-pasting to other platforms.
18
+
19
+ ## What's Next
20
+
21
+ Ask me to write something. A blog post, a tweet thread, a newsletter — whatever you're working on. I'll create a doc for it and we'll iterate together.