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,58 @@
1
+ [
2
+ {
3
+ "id": "rewrite-selection",
4
+ "label": "Rewrite",
5
+ "target": "selection",
6
+ "description": "Rewrite selected prose while preserving meaning and point of view.",
7
+ "instruction": "Rewrite the selected manuscript passage with stronger rhythm, concrete detail, and consistent voice. Return a replace-selection action only when selected text is present."
8
+ },
9
+ {
10
+ "id": "expand-selection",
11
+ "label": "Expand",
12
+ "target": "selection",
13
+ "description": "Add texture, action, and interiority to the selected passage.",
14
+ "instruction": "Expand the selected passage into richer prose without changing the scene outcome. Return a replace-selection action only when selected text is present."
15
+ },
16
+ {
17
+ "id": "character-development",
18
+ "label": "Develop Character",
19
+ "target": "story-bible",
20
+ "description": "Sharpen a character role, desire, conflict, and notes.",
21
+ "instruction": "Improve the relevant character record for dramatic specificity. Return an upsert-character action."
22
+ },
23
+ {
24
+ "id": "synopsis-expansion",
25
+ "label": "Expand Synopsis",
26
+ "target": "story-bible",
27
+ "description": "Turn a rough synopsis into a stronger story promise.",
28
+ "instruction": "Expand the synopsis into a clear dramatic arc with stakes, pressure, and transformation. Return an update-story-fields action for synopsis."
29
+ },
30
+ {
31
+ "id": "scene-planning",
32
+ "label": "Plan Scene",
33
+ "target": "story-bible",
34
+ "description": "Create or refine an outline beat for the next scene.",
35
+ "instruction": "Create or refine a scene beat with goal, obstacle, reversal, and exit image. Return an update-outline-beat action."
36
+ },
37
+ {
38
+ "id": "continuity-review",
39
+ "label": "Continuity",
40
+ "target": "chat",
41
+ "description": "Find contradictions and unresolved story facts.",
42
+ "instruction": "Review the provided story context for continuity risks. Return concise notes and suggested fixes; when a stable fact, decision, unresolved question, or tentative rule should be remembered, return an update-story-fields action that records it in continuity."
43
+ },
44
+ {
45
+ "id": "dialogue-polish",
46
+ "label": "Dialogue",
47
+ "target": "selection",
48
+ "description": "Make dialogue sound more specific to character and pressure.",
49
+ "instruction": "Polish selected dialogue so each speaker has clearer subtext and fewer generic lines. Return a replace-selection action only when selected text is present."
50
+ },
51
+ {
52
+ "id": "tone-matching",
53
+ "label": "Match Tone",
54
+ "target": "selection",
55
+ "description": "Bring a passage back into the book's chosen tone.",
56
+ "instruction": "Adjust selected prose to match the story tone and perspective while preserving events. Return a replace-selection action only when selected text is present."
57
+ }
58
+ ]
@@ -0,0 +1,6 @@
1
+ /// <reference types="next" />
2
+ /// <reference types="next/image-types/global" />
3
+ import "./.next/dev/types/routes.d.ts";
4
+
5
+ // NOTE: This file should not be edited
6
+ // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
@@ -0,0 +1,10 @@
1
+ /** @type {import('next').NextConfig} */
2
+ const nextConfig = {
3
+ allowedDevOrigins: ["127.0.0.1"],
4
+ transpilePackages: ["cowriter"],
5
+ images: {
6
+ unoptimized: true,
7
+ },
8
+ };
9
+
10
+ module.exports = nextConfig;
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "cowriter-frontend",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "scripts": {
6
+ "dev": "next dev",
7
+ "build": "next build",
8
+ "start": "next start",
9
+ "test": "vitest run",
10
+ "test:watch": "vitest",
11
+ "test:e2e": "playwright test"
12
+ },
13
+ "dependencies": {
14
+ "@radix-ui/react-icons": "^1.3.2",
15
+ "@tiptap/extension-placeholder": "^3.23.1",
16
+ "@tiptap/extension-table": "^3.23.1",
17
+ "@tiptap/react": "^3.23.1",
18
+ "@tiptap/starter-kit": "^3.23.1",
19
+ "clsx": "^2.1.1",
20
+ "marked": "^18.0.3",
21
+ "next": "^16.2.6",
22
+ "react": "^19.2.6",
23
+ "react-dom": "^19.2.6",
24
+ "tailwind-merge": "^3.6.0",
25
+ "turndown": "^7.2.4",
26
+ "turndown-plugin-gfm": "^1.0.2",
27
+ "yaml": "^2.8.4",
28
+ "zod": "^4.4.3"
29
+ },
30
+ "devDependencies": {
31
+ "@playwright/test": "^1.59.1",
32
+ "@tailwindcss/postcss": "^4.3.0",
33
+ "@testing-library/jest-dom": "^6.9.1",
34
+ "@testing-library/react": "^16.3.2",
35
+ "@types/node": "^25.6.2",
36
+ "@types/react": "^19.2.14",
37
+ "@types/react-dom": "^19.2.3",
38
+ "@types/turndown": "^5.0.6",
39
+ "jsdom": "^29.1.1",
40
+ "tailwindcss": "^4.3.0",
41
+ "typescript": "^6.0.3",
42
+ "vitest": "^4.1.5"
43
+ }
44
+ }
@@ -0,0 +1,7 @@
1
+ const config = {
2
+ plugins: {
3
+ "@tailwindcss/postcss": {},
4
+ },
5
+ };
6
+
7
+ export default config;
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "react-jsx",
15
+ "incremental": true,
16
+ "plugins": [{ "name": "next" }],
17
+ "baseUrl": ".",
18
+ "paths": { "@/*": ["./*"] }
19
+ },
20
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
21
+ "exclude": ["node_modules"]
22
+ }
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "cowriter",
3
+ "version": "0.1.0",
4
+ "description": "A local Codex.app writing workspace for long-form stories.",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "cowriter": "scripts/cowriter-ai.mjs",
8
+ "cowriter-ai": "scripts/cowriter-ai.mjs"
9
+ },
10
+ "files": [
11
+ "README.md",
12
+ "assets",
13
+ "scripts",
14
+ "templates",
15
+ "frontend/app",
16
+ "frontend/components",
17
+ "frontend/lib",
18
+ "frontend/next-env.d.ts",
19
+ "frontend/next.config.js",
20
+ "frontend/package.json",
21
+ "frontend/postcss.config.mjs",
22
+ "frontend/tsconfig.json"
23
+ ],
24
+ "scripts": {
25
+ "serve": "node scripts/cowriter-ai.mjs serve",
26
+ "build": "pnpm --dir frontend build",
27
+ "test": "pnpm --dir frontend test",
28
+ "cowriter": "node scripts/cowriter-ai.mjs",
29
+ "pack:dry": "npm pack --dry-run"
30
+ },
31
+ "dependencies": {
32
+ "@radix-ui/react-icons": "^1.3.2",
33
+ "@tailwindcss/postcss": "^4.3.0",
34
+ "@tiptap/extension-placeholder": "^3.23.1",
35
+ "@tiptap/extension-table": "^3.23.1",
36
+ "@tiptap/react": "^3.23.1",
37
+ "@tiptap/starter-kit": "^3.23.1",
38
+ "@types/node": "^25.6.2",
39
+ "@types/react": "^19.2.14",
40
+ "@types/react-dom": "^19.2.3",
41
+ "@types/turndown": "^5.0.6",
42
+ "clsx": "^2.1.1",
43
+ "marked": "^18.0.3",
44
+ "next": "^16.2.6",
45
+ "react": "^19.2.6",
46
+ "react-dom": "^19.2.6",
47
+ "tailwind-merge": "^3.6.0",
48
+ "tailwindcss": "^4.3.0",
49
+ "turndown": "^7.2.4",
50
+ "turndown-plugin-gfm": "^1.0.2",
51
+ "typescript": "^6.0.3",
52
+ "yaml": "^2.8.4",
53
+ "zod": "^4.4.3"
54
+ },
55
+ "devDependencies": {
56
+ "@playwright/test": "^1.59.1",
57
+ "@testing-library/jest-dom": "^6.9.1",
58
+ "@testing-library/react": "^16.3.2",
59
+ "jsdom": "^29.1.1",
60
+ "vitest": "^4.1.5"
61
+ }
62
+ }