opencode-novel 0.0.1

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 (196) hide show
  1. package/README.md +110 -0
  2. package/assets/templates/bible-glossary.md +4 -0
  3. package/assets/templates/bible-rules.md +5 -0
  4. package/assets/templates/bible-world.md +8 -0
  5. package/assets/templates/chapter.md +21 -0
  6. package/assets/templates/character.md +27 -0
  7. package/assets/templates/faction.md +14 -0
  8. package/assets/templates/location.md +11 -0
  9. package/assets/templates/thread.md +16 -0
  10. package/dist/agents/editor.d.ts +2 -0
  11. package/dist/agents/experts.d.ts +13 -0
  12. package/dist/agents/index.d.ts +7 -0
  13. package/dist/agents/muse.d.ts +2 -0
  14. package/dist/agents/novel.d.ts +2 -0
  15. package/dist/agents/security.d.ts +1 -0
  16. package/dist/agents/sentinel.d.ts +2 -0
  17. package/dist/agents/types.d.ts +3 -0
  18. package/dist/cli.d.ts +2 -0
  19. package/dist/cli.js +3716 -0
  20. package/dist/config/defaults.d.ts +2 -0
  21. package/dist/config/load.d.ts +16 -0
  22. package/dist/config/schema.d.ts +203 -0
  23. package/dist/config/types.d.ts +5 -0
  24. package/dist/features/builtin-commands/commands.d.ts +2 -0
  25. package/dist/features/builtin-commands/index.d.ts +2 -0
  26. package/dist/features/builtin-commands/templates/novel-apply-candidates.d.ts +1 -0
  27. package/dist/features/builtin-commands/templates/novel-bible.d.ts +1 -0
  28. package/dist/features/builtin-commands/templates/novel-bootstrap.d.ts +1 -0
  29. package/dist/features/builtin-commands/templates/novel-chapter-draft.d.ts +1 -0
  30. package/dist/features/builtin-commands/templates/novel-chapter-plan.d.ts +1 -0
  31. package/dist/features/builtin-commands/templates/novel-chapter-review.d.ts +1 -0
  32. package/dist/features/builtin-commands/templates/novel-character-report.d.ts +1 -0
  33. package/dist/features/builtin-commands/templates/novel-character.d.ts +1 -0
  34. package/dist/features/builtin-commands/templates/novel-config-check.d.ts +1 -0
  35. package/dist/features/builtin-commands/templates/novel-continuation.d.ts +1 -0
  36. package/dist/features/builtin-commands/templates/novel-continuity-check.d.ts +1 -0
  37. package/dist/features/builtin-commands/templates/novel-entities-audit.d.ts +1 -0
  38. package/dist/features/builtin-commands/templates/novel-export.d.ts +1 -0
  39. package/dist/features/builtin-commands/templates/novel-extract-entities.d.ts +1 -0
  40. package/dist/features/builtin-commands/templates/novel-faction.d.ts +1 -0
  41. package/dist/features/builtin-commands/templates/novel-foreshadowing-audit.d.ts +1 -0
  42. package/dist/features/builtin-commands/templates/novel-graph.d.ts +1 -0
  43. package/dist/features/builtin-commands/templates/novel-import.d.ts +1 -0
  44. package/dist/features/builtin-commands/templates/novel-index.d.ts +1 -0
  45. package/dist/features/builtin-commands/templates/novel-init.d.ts +1 -0
  46. package/dist/features/builtin-commands/templates/novel-outline.d.ts +1 -0
  47. package/dist/features/builtin-commands/templates/novel-polish.d.ts +1 -0
  48. package/dist/features/builtin-commands/templates/novel-rewrite.d.ts +1 -0
  49. package/dist/features/builtin-commands/templates/novel-snapshot.d.ts +1 -0
  50. package/dist/features/builtin-commands/templates/novel-style-check.d.ts +1 -0
  51. package/dist/features/builtin-commands/templates/novel-style-guide.d.ts +1 -0
  52. package/dist/features/builtin-commands/templates/novel-summary.d.ts +1 -0
  53. package/dist/features/builtin-commands/templates/novel-thread.d.ts +1 -0
  54. package/dist/features/builtin-commands/types.d.ts +11 -0
  55. package/dist/features/builtin-skills/artifacts.d.ts +16 -0
  56. package/dist/features/builtin-skills/index.d.ts +4 -0
  57. package/dist/features/builtin-skills/skills/audience-classifier.d.ts +1 -0
  58. package/dist/features/builtin-skills/skills/emotion-classifier.d.ts +1 -0
  59. package/dist/features/builtin-skills/skills/genre-classifier.d.ts +1 -0
  60. package/dist/features/builtin-skills/skills/market-tagger.d.ts +1 -0
  61. package/dist/features/builtin-skills/skills/novel-character-expert.d.ts +1 -0
  62. package/dist/features/builtin-skills/skills/novel-continuation-expert.d.ts +1 -0
  63. package/dist/features/builtin-skills/skills/novel-continuity-sentinel.d.ts +1 -0
  64. package/dist/features/builtin-skills/skills/novel-entity-extractor.d.ts +1 -0
  65. package/dist/features/builtin-skills/skills/novel-faction-relations.d.ts +1 -0
  66. package/dist/features/builtin-skills/skills/novel-flaw-finder.d.ts +1 -0
  67. package/dist/features/builtin-skills/skills/novel-foreshadowing-unresolved.d.ts +1 -0
  68. package/dist/features/builtin-skills/skills/novel-oracle.d.ts +1 -0
  69. package/dist/features/builtin-skills/skills/novel-polish-expert.d.ts +1 -0
  70. package/dist/features/builtin-skills/skills/novel-summary-expert.d.ts +1 -0
  71. package/dist/features/builtin-skills/skills/novel-timeline-keeper.d.ts +1 -0
  72. package/dist/features/builtin-skills/skills/novel-worldbible-keeper.d.ts +1 -0
  73. package/dist/features/builtin-skills/skills/profile-aggregator.d.ts +1 -0
  74. package/dist/features/builtin-skills/skills/structure-classifier.d.ts +1 -0
  75. package/dist/features/builtin-skills/skills/taxonomy-registry.d.ts +1 -0
  76. package/dist/features/builtin-skills/skills/trope-classifier.d.ts +1 -0
  77. package/dist/features/builtin-skills/skills.d.ts +2 -0
  78. package/dist/features/builtin-skills/taxonomy/index.d.ts +3 -0
  79. package/dist/features/builtin-skills/taxonomy/references.d.ts +8 -0
  80. package/dist/features/builtin-skills/taxonomy/registry.d.ts +2 -0
  81. package/dist/features/builtin-skills/taxonomy/types.d.ts +42 -0
  82. package/dist/features/builtin-skills/types.d.ts +11 -0
  83. package/dist/index.d.ts +3 -0
  84. package/dist/index.js +61966 -0
  85. package/dist/novel.schema.json +904 -0
  86. package/dist/plugin-handlers/config-handler.d.ts +9 -0
  87. package/dist/plugin-handlers/index.d.ts +1 -0
  88. package/dist/shared/errors/diagnostics.d.ts +19 -0
  89. package/dist/shared/fs/paths.d.ts +3 -0
  90. package/dist/shared/fs/read.d.ts +5 -0
  91. package/dist/shared/fs/write.d.ts +8 -0
  92. package/dist/shared/hashing/hash8.d.ts +1 -0
  93. package/dist/shared/hashing/sha256.d.ts +2 -0
  94. package/dist/shared/markdown/frontmatter.d.ts +15 -0
  95. package/dist/shared/opencode/artifacts.d.ts +12 -0
  96. package/dist/shared/strings/chinese-number.d.ts +1 -0
  97. package/dist/shared/strings/slug.d.ts +1 -0
  98. package/dist/shared/strings/text-encoding.d.ts +2 -0
  99. package/dist/shared/tool-output.d.ts +6 -0
  100. package/dist/tools/novel-apply-candidates/index.d.ts +2 -0
  101. package/dist/tools/novel-apply-candidates/render.d.ts +2 -0
  102. package/dist/tools/novel-apply-candidates/tool.d.ts +6 -0
  103. package/dist/tools/novel-apply-candidates/types.d.ts +52 -0
  104. package/dist/tools/novel-bible/index.d.ts +2 -0
  105. package/dist/tools/novel-bible/render.d.ts +3 -0
  106. package/dist/tools/novel-bible/tool.d.ts +6 -0
  107. package/dist/tools/novel-bible/types.d.ts +26 -0
  108. package/dist/tools/novel-bootstrap/index.d.ts +2 -0
  109. package/dist/tools/novel-bootstrap/tool.d.ts +6 -0
  110. package/dist/tools/novel-bootstrap/types.d.ts +38 -0
  111. package/dist/tools/novel-candidates-write/index.d.ts +2 -0
  112. package/dist/tools/novel-candidates-write/tool.d.ts +6 -0
  113. package/dist/tools/novel-candidates-write/types.d.ts +13 -0
  114. package/dist/tools/novel-chapter-plan/index.d.ts +2 -0
  115. package/dist/tools/novel-chapter-plan/tool.d.ts +6 -0
  116. package/dist/tools/novel-chapter-plan/types.d.ts +32 -0
  117. package/dist/tools/novel-character-report/index.d.ts +2 -0
  118. package/dist/tools/novel-character-report/render.d.ts +2 -0
  119. package/dist/tools/novel-character-report/tool.d.ts +6 -0
  120. package/dist/tools/novel-character-report/types.d.ts +23 -0
  121. package/dist/tools/novel-config-check/index.d.ts +2 -0
  122. package/dist/tools/novel-config-check/tool.d.ts +4 -0
  123. package/dist/tools/novel-config-check/types.d.ts +15 -0
  124. package/dist/tools/novel-context-pack/index.d.ts +2 -0
  125. package/dist/tools/novel-context-pack/tool.d.ts +6 -0
  126. package/dist/tools/novel-context-pack/types.d.ts +37 -0
  127. package/dist/tools/novel-continuity-check/index.d.ts +2 -0
  128. package/dist/tools/novel-continuity-check/render.d.ts +9 -0
  129. package/dist/tools/novel-continuity-check/tool.d.ts +6 -0
  130. package/dist/tools/novel-continuity-check/types.d.ts +37 -0
  131. package/dist/tools/novel-entity-gaps/index.d.ts +2 -0
  132. package/dist/tools/novel-entity-gaps/render.d.ts +5 -0
  133. package/dist/tools/novel-entity-gaps/tool.d.ts +6 -0
  134. package/dist/tools/novel-entity-gaps/types.d.ts +33 -0
  135. package/dist/tools/novel-export/docx.d.ts +5 -0
  136. package/dist/tools/novel-export/epub.d.ts +10 -0
  137. package/dist/tools/novel-export/index.d.ts +2 -0
  138. package/dist/tools/novel-export/preflight.d.ts +19 -0
  139. package/dist/tools/novel-export/render.d.ts +6 -0
  140. package/dist/tools/novel-export/tool.d.ts +6 -0
  141. package/dist/tools/novel-export/types.d.ts +109 -0
  142. package/dist/tools/novel-foreshadowing-audit/index.d.ts +2 -0
  143. package/dist/tools/novel-foreshadowing-audit/render.d.ts +5 -0
  144. package/dist/tools/novel-foreshadowing-audit/tool.d.ts +6 -0
  145. package/dist/tools/novel-foreshadowing-audit/types.d.ts +40 -0
  146. package/dist/tools/novel-graph/index.d.ts +2 -0
  147. package/dist/tools/novel-graph/render.d.ts +5 -0
  148. package/dist/tools/novel-graph/tool.d.ts +6 -0
  149. package/dist/tools/novel-graph/types.d.ts +21 -0
  150. package/dist/tools/novel-import/index.d.ts +2 -0
  151. package/dist/tools/novel-import/tool.d.ts +7 -0
  152. package/dist/tools/novel-import/types.d.ts +47 -0
  153. package/dist/tools/novel-index/index.d.ts +2 -0
  154. package/dist/tools/novel-index/render.d.ts +35 -0
  155. package/dist/tools/novel-index/tool.d.ts +6 -0
  156. package/dist/tools/novel-index/types.d.ts +41 -0
  157. package/dist/tools/novel-outline/index.d.ts +2 -0
  158. package/dist/tools/novel-outline/tool.d.ts +6 -0
  159. package/dist/tools/novel-outline/types.d.ts +37 -0
  160. package/dist/tools/novel-scaffold/index.d.ts +2 -0
  161. package/dist/tools/novel-scaffold/scaffold.d.ts +18 -0
  162. package/dist/tools/novel-scaffold/templates.d.ts +5 -0
  163. package/dist/tools/novel-scaffold/tool.d.ts +6 -0
  164. package/dist/tools/novel-scaffold/types.d.ts +19 -0
  165. package/dist/tools/novel-scan/helpers.d.ts +88 -0
  166. package/dist/tools/novel-scan/index.d.ts +3 -0
  167. package/dist/tools/novel-scan/scan.d.ts +17 -0
  168. package/dist/tools/novel-scan/tool.d.ts +6 -0
  169. package/dist/tools/novel-scan/types.d.ts +106 -0
  170. package/dist/tools/novel-scene-check/index.d.ts +2 -0
  171. package/dist/tools/novel-scene-check/render.d.ts +11 -0
  172. package/dist/tools/novel-scene-check/tool.d.ts +6 -0
  173. package/dist/tools/novel-scene-check/types.d.ts +38 -0
  174. package/dist/tools/novel-setup/index.d.ts +2 -0
  175. package/dist/tools/novel-setup/tool.d.ts +6 -0
  176. package/dist/tools/novel-setup/types.d.ts +35 -0
  177. package/dist/tools/novel-snapshot/index.d.ts +2 -0
  178. package/dist/tools/novel-snapshot/tool.d.ts +6 -0
  179. package/dist/tools/novel-snapshot/types.d.ts +26 -0
  180. package/dist/tools/novel-structure-check/index.d.ts +2 -0
  181. package/dist/tools/novel-structure-check/render.d.ts +14 -0
  182. package/dist/tools/novel-structure-check/tool.d.ts +6 -0
  183. package/dist/tools/novel-structure-check/types.d.ts +42 -0
  184. package/dist/tools/novel-style-check/index.d.ts +2 -0
  185. package/dist/tools/novel-style-check/render.d.ts +8 -0
  186. package/dist/tools/novel-style-check/tool.d.ts +6 -0
  187. package/dist/tools/novel-style-check/types.d.ts +39 -0
  188. package/dist/tools/skill/index.d.ts +3 -0
  189. package/dist/tools/skill/loader.d.ts +5 -0
  190. package/dist/tools/skill/tool.d.ts +5 -0
  191. package/dist/tools/skill/types.d.ts +14 -0
  192. package/dist/tools/slashcommand/index.d.ts +3 -0
  193. package/dist/tools/slashcommand/loader.d.ts +5 -0
  194. package/dist/tools/slashcommand/tool.d.ts +6 -0
  195. package/dist/tools/slashcommand/types.d.ts +14 -0
  196. package/package.json +55 -0
@@ -0,0 +1,106 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelScanMode = "full" | "incremental";
3
+ export type NovelScanArgs = {
4
+ rootDir?: string;
5
+ manuscriptDir?: string;
6
+ mode?: NovelScanMode;
7
+ strictMode?: boolean;
8
+ writeCache?: boolean;
9
+ };
10
+ export type NovelFileHash = {
11
+ path: string;
12
+ mtimeMs: number;
13
+ size: number;
14
+ sha256: string;
15
+ };
16
+ export type ChapterStructureEntity = {
17
+ act?: number;
18
+ beat_id?: string;
19
+ beat_goal?: string;
20
+ };
21
+ export type ChapterSceneEntity = {
22
+ scene_id?: string;
23
+ objective?: string;
24
+ conflict?: string;
25
+ outcome?: string;
26
+ hook?: string;
27
+ };
28
+ export type ChapterEntity = {
29
+ chapter_id: string;
30
+ title?: string;
31
+ path: string;
32
+ pov?: string;
33
+ timeline?: {
34
+ date?: string;
35
+ start?: string;
36
+ end?: string;
37
+ location?: string;
38
+ };
39
+ characters?: string[];
40
+ factions?: string[];
41
+ locations?: string[];
42
+ threads_opened?: string[];
43
+ threads_advanced?: string[];
44
+ threads_closed?: string[];
45
+ summary?: string;
46
+ tags?: string[];
47
+ structure?: ChapterStructureEntity;
48
+ scenes?: ChapterSceneEntity[];
49
+ };
50
+ export type CharacterEntity = {
51
+ id: string;
52
+ name?: string;
53
+ path: string;
54
+ alias?: string[];
55
+ };
56
+ export type ThreadEntity = {
57
+ thread_id: string;
58
+ type?: string;
59
+ status?: string;
60
+ path: string;
61
+ };
62
+ export type FactionEntity = {
63
+ id: string;
64
+ name?: string;
65
+ path: string;
66
+ };
67
+ export type LocationEntity = {
68
+ id: string;
69
+ name?: string;
70
+ path: string;
71
+ };
72
+ export type NovelScanResultJson = {
73
+ version: 1;
74
+ rootDir: string;
75
+ manuscriptDir: string;
76
+ stats: {
77
+ filesScanned: number;
78
+ entities: Record<string, number>;
79
+ durationMs: number;
80
+ cache: {
81
+ mode: NovelScanMode;
82
+ loaded: boolean;
83
+ written: boolean;
84
+ fastHits: number;
85
+ hashHits: number;
86
+ misses: number;
87
+ };
88
+ };
89
+ files: NovelFileHash[];
90
+ entities: {
91
+ chapters: ChapterEntity[];
92
+ characters: CharacterEntity[];
93
+ threads: ThreadEntity[];
94
+ factions: FactionEntity[];
95
+ locations: LocationEntity[];
96
+ };
97
+ diagnostics: Diagnostic[];
98
+ cache: {
99
+ scanCachePath?: string;
100
+ };
101
+ };
102
+ export type ScanCacheV1 = NovelScanResultJson & {
103
+ __internal?: {
104
+ perFileDiagnostics?: Record<string, Diagnostic[]>;
105
+ };
106
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelSceneCheckTool } from "./tool";
2
+ export type { NovelSceneArgs, NovelSceneResultJson, NovelSceneScope, SceneFinding } from "./types";
@@ -0,0 +1,11 @@
1
+ import type { SceneFinding } from "./types";
2
+ export declare function renderSceneReportMd(options: {
3
+ stats: {
4
+ sceneCount: number;
5
+ invalidCount: number;
6
+ errors: number;
7
+ warns: number;
8
+ infos: number;
9
+ };
10
+ findings: SceneFinding[];
11
+ }): string;
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelSceneCheckTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,38 @@
1
+ import type { Diagnostic, DiagnosticEvidence } from "../../shared/errors/diagnostics";
2
+ export type NovelSceneScope = {
3
+ kind: "all";
4
+ } | {
5
+ kind: "chapter";
6
+ chapter_id: string;
7
+ };
8
+ export type NovelSceneArgs = {
9
+ rootDir?: string;
10
+ manuscriptDir?: string;
11
+ outputDir?: string;
12
+ scope?: NovelSceneScope;
13
+ writeReport?: boolean;
14
+ requiredFields?: Array<"scene_id" | "objective" | "conflict" | "outcome" | "hook">;
15
+ };
16
+ export type SceneFinding = {
17
+ severity: "error" | "warn" | "info";
18
+ code: string;
19
+ message: string;
20
+ evidence: DiagnosticEvidence[];
21
+ suggestedFix?: string;
22
+ repro?: string;
23
+ };
24
+ export type NovelSceneResultJson = {
25
+ version: 1;
26
+ reportPath?: string;
27
+ stats: {
28
+ sceneCount: number;
29
+ invalidCount: number;
30
+ errors: number;
31
+ warns: number;
32
+ infos: number;
33
+ durationMs: number;
34
+ };
35
+ findings: SceneFinding[];
36
+ nextSteps?: string[];
37
+ diagnostics: Diagnostic[];
38
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelSetupTool } from "./tool";
2
+ export type { NovelSetupArgs, NovelSetupResultJson } from "./types";
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelSetupTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,35 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelSetupArgs = {
3
+ rootDir?: string;
4
+ manuscriptDir?: string;
5
+ bookTitle?: string;
6
+ writeTemplates?: boolean;
7
+ forceOverwriteTemplates?: boolean;
8
+ exportCommands?: boolean;
9
+ exportSkills?: boolean;
10
+ forceOverwriteCommands?: boolean;
11
+ forceOverwriteSkills?: boolean;
12
+ writeConfigJsonc?: boolean;
13
+ };
14
+ export type NovelSetupResultJson = {
15
+ version: 1;
16
+ manuscriptDir: string;
17
+ configPath?: string;
18
+ createdDirs: string[];
19
+ writtenFiles: string[];
20
+ skippedExisting: string[];
21
+ commands: {
22
+ dir: string;
23
+ written: string[];
24
+ skipped: string[];
25
+ };
26
+ skills: {
27
+ dir: string;
28
+ written: string[];
29
+ skipped: string[];
30
+ };
31
+ stats: {
32
+ durationMs: number;
33
+ };
34
+ diagnostics: Diagnostic[];
35
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelSnapshotTool } from "./tool";
2
+ export type { NovelSnapshotArgs, NovelSnapshotEntry, NovelSnapshotResultJson } from "./types";
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelSnapshotTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,26 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelSnapshotArgs = {
3
+ rootDir?: string;
4
+ manuscriptDir?: string;
5
+ outputDir?: string;
6
+ tag?: string;
7
+ includeBible?: boolean;
8
+ includeDerived?: boolean;
9
+ };
10
+ export type NovelSnapshotEntry = {
11
+ source: string;
12
+ dest: string;
13
+ };
14
+ export type NovelSnapshotResultJson = {
15
+ version: 1;
16
+ tag: string;
17
+ snapshotDir: string;
18
+ entries: NovelSnapshotEntry[];
19
+ savedFiles: string[];
20
+ stats: {
21
+ durationMs: number;
22
+ savedFiles: number;
23
+ };
24
+ nextSteps?: string[];
25
+ diagnostics: Diagnostic[];
26
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelStructureCheckTool } from "./tool";
2
+ export type { NovelStructureArgs, NovelStructureResultJson, NovelStructureScope, StructureFinding, } from "./types";
@@ -0,0 +1,14 @@
1
+ import type { StructureFinding } from "./types";
2
+ export declare function renderStructureReportMd(options: {
3
+ stats: {
4
+ coverage: number;
5
+ requiredBeats: number;
6
+ seenRequiredBeats: number;
7
+ missing: number;
8
+ orderErrors: number;
9
+ errors: number;
10
+ warns: number;
11
+ infos: number;
12
+ };
13
+ findings: StructureFinding[];
14
+ }): string;
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelStructureCheckTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,42 @@
1
+ import type { Diagnostic, DiagnosticEvidence } from "../../shared/errors/diagnostics";
2
+ export type NovelStructureScope = {
3
+ kind: "all";
4
+ } | {
5
+ kind: "chapter";
6
+ chapter_id: string;
7
+ };
8
+ export type NovelStructureArgs = {
9
+ rootDir?: string;
10
+ manuscriptDir?: string;
11
+ outputDir?: string;
12
+ scope?: NovelStructureScope;
13
+ writeReport?: boolean;
14
+ requiredBeats?: string[];
15
+ minCoverage?: number;
16
+ };
17
+ export type StructureFinding = {
18
+ severity: "error" | "warn" | "info";
19
+ code: string;
20
+ message: string;
21
+ evidence: DiagnosticEvidence[];
22
+ suggestedFix?: string;
23
+ repro?: string;
24
+ };
25
+ export type NovelStructureResultJson = {
26
+ version: 1;
27
+ reportPath?: string;
28
+ stats: {
29
+ coverage: number;
30
+ requiredBeats: number;
31
+ seenRequiredBeats: number;
32
+ missing: number;
33
+ orderErrors: number;
34
+ errors: number;
35
+ warns: number;
36
+ infos: number;
37
+ durationMs: number;
38
+ };
39
+ findings: StructureFinding[];
40
+ nextSteps?: string[];
41
+ diagnostics: Diagnostic[];
42
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelStyleCheckTool } from "./tool";
2
+ export type { NovelStyleArgs, NovelStyleResultJson, NovelStyleScope, StyleFinding } from "./types";
@@ -0,0 +1,8 @@
1
+ import type { StyleFinding } from "./types";
2
+ export declare function renderStyleReportMd(options: {
3
+ findings: StyleFinding[];
4
+ stats: {
5
+ warns: number;
6
+ infos: number;
7
+ };
8
+ }): string;
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelStyleCheckTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,39 @@
1
+ import type { Diagnostic, DiagnosticEvidence } from "../../shared/errors/diagnostics";
2
+ export type NovelStyleScope = {
3
+ kind: "all";
4
+ } | {
5
+ kind: "chapter";
6
+ chapter_id: string;
7
+ } | {
8
+ kind: "character";
9
+ id: string;
10
+ };
11
+ export type NovelStyleArgs = {
12
+ rootDir?: string;
13
+ manuscriptDir?: string;
14
+ outputDir?: string;
15
+ scope?: NovelStyleScope;
16
+ catchphraseMaxCount?: number;
17
+ catchphraseReportMissing?: boolean;
18
+ writeReport?: boolean;
19
+ };
20
+ export type StyleFinding = {
21
+ severity: "warn" | "info";
22
+ code: string;
23
+ message: string;
24
+ evidence: DiagnosticEvidence[];
25
+ suggestedFix?: string;
26
+ repro?: string;
27
+ };
28
+ export type NovelStyleResultJson = {
29
+ version: 1;
30
+ reportPath?: string;
31
+ stats: {
32
+ warns: number;
33
+ infos: number;
34
+ durationMs: number;
35
+ };
36
+ findings: StyleFinding[];
37
+ nextSteps?: string[];
38
+ diagnostics: Diagnostic[];
39
+ };
@@ -0,0 +1,3 @@
1
+ export { discoverAllSkills } from "./loader";
2
+ export { createSkillTool } from "./tool";
3
+ export type { LoadedSkill, SkillScope } from "./types";
@@ -0,0 +1,5 @@
1
+ import type { LoadedSkill } from "./types";
2
+ export declare function discoverAllSkills(options: {
3
+ projectRoot: string;
4
+ disabledSkills?: string[];
5
+ }): LoadedSkill[];
@@ -0,0 +1,5 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ export declare function createSkillTool(options: {
3
+ projectRoot: string;
4
+ disabledSkills?: string[];
5
+ }): ToolDefinition;
@@ -0,0 +1,14 @@
1
+ export type SkillScope = "builtin" | "project" | "user";
2
+ export type LoadedSkill = {
3
+ name: string;
4
+ scope: SkillScope;
5
+ path?: string;
6
+ definition: {
7
+ description?: string;
8
+ argumentHint?: string;
9
+ agent?: string;
10
+ model?: string;
11
+ subtask?: boolean;
12
+ template: string;
13
+ };
14
+ };
@@ -0,0 +1,3 @@
1
+ export { discoverAllCommands } from "./loader";
2
+ export { createSlashcommandTool } from "./tool";
3
+ export type { CommandInfo, CommandScope } from "./types";
@@ -0,0 +1,5 @@
1
+ import type { CommandInfo } from "./types";
2
+ export declare function discoverAllCommands(options: {
3
+ projectRoot: string;
4
+ disabledCommands?: string[];
5
+ }): CommandInfo[];
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ export declare function createSlashcommandTool(options: {
3
+ projectRoot: string;
4
+ disabledCommands?: string[];
5
+ disabledSkills?: string[];
6
+ }): ToolDefinition;
@@ -0,0 +1,14 @@
1
+ export type CommandScope = "builtin" | "project" | "user";
2
+ export type CommandInfo = {
3
+ name: string;
4
+ scope: CommandScope;
5
+ path?: string;
6
+ metadata: {
7
+ description?: string;
8
+ argumentHint?: string;
9
+ agent?: string;
10
+ model?: string;
11
+ subtask?: boolean;
12
+ };
13
+ content: string;
14
+ };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "opencode-novel",
3
+ "version": "0.0.1",
4
+ "description": "Novel writing workflow plugin for OpenCode (Bun/TypeScript).",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "bin": {
9
+ "opencode-novel": "dist/cli.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "assets"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ },
20
+ "./schema.json": "./dist/novel.schema.json"
21
+ },
22
+ "scripts": {
23
+ "build": "bun run clean && bun build src/index.ts src/cli.ts --outdir dist --target bun --format esm && tsc --emitDeclarationOnly && bun run build:schema",
24
+ "build:schema": "bun run script/build-schema.ts",
25
+ "clean": "rm -rf dist",
26
+ "install:opencode": "bun run script/install-opencode.ts -- --target=global",
27
+ "uninstall:opencode": "bun run script/uninstall-opencode.ts -- --target=global",
28
+ "benchmark:index": "bun run script/perf-index-benchmark.ts",
29
+ "check:code-rules": "bun run script/check-code-rules.ts",
30
+ "lint": "biome check --error-on-warnings .",
31
+ "lint:fix": "biome check --write .",
32
+ "typecheck": "tsc --noEmit",
33
+ "check": "bun run lint && bun run check:code-rules && bun run typecheck && bun test && bun run build",
34
+ "test": "bun test"
35
+ },
36
+ "dependencies": {
37
+ "@opencode-ai/plugin": "^1.1.19",
38
+ "@opencode-ai/sdk": "^1.1.19",
39
+ "docx": "^9.5.1",
40
+ "fflate": "^0.8.2",
41
+ "js-yaml": "^4.1.1",
42
+ "jsonc-parser": "^3.3.1",
43
+ "marked": "^16.2.1",
44
+ "picomatch": "^4.0.2",
45
+ "zod": "^4.1.8"
46
+ },
47
+ "devDependencies": {
48
+ "@biomejs/biome": "^2.2.4",
49
+ "@types/js-yaml": "^4.0.9",
50
+ "@types/picomatch": "^3.0.2",
51
+ "bun-types": "1.3.6",
52
+ "lefthook": "^1.13.4",
53
+ "typescript": "^5.7.3"
54
+ }
55
+ }