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,9 @@
1
+ import type { NovelConfig } from "../config/schema";
2
+ type OpenCodeConfig = Record<string, unknown> & {
3
+ model?: unknown;
4
+ agent?: Record<string, unknown>;
5
+ };
6
+ export declare function createConfigHandler(deps: {
7
+ pluginConfig: NovelConfig;
8
+ }): (config: OpenCodeConfig) => Promise<void>;
9
+ export {};
@@ -0,0 +1 @@
1
+ export { createConfigHandler } from "./config-handler";
@@ -0,0 +1,19 @@
1
+ export type DiagnosticSeverity = "error" | "warn" | "info";
2
+ export type DiagnosticEvidence = {
3
+ file: string;
4
+ line?: number;
5
+ excerpt?: string;
6
+ };
7
+ export type Diagnostic = {
8
+ severity: DiagnosticSeverity;
9
+ code: string;
10
+ message: string;
11
+ file?: string;
12
+ line?: number;
13
+ evidence?: DiagnosticEvidence[];
14
+ suggestedFix?: string;
15
+ repro?: string;
16
+ };
17
+ export declare function inferReproFromDiagnosticCode(code: string): string | undefined;
18
+ export declare function sortDiagnostics(diagnostics: Diagnostic[]): Diagnostic[];
19
+ export declare function formatDiagnosticsMarkdown(diagnostics: Diagnostic[]): string;
@@ -0,0 +1,3 @@
1
+ export declare function toPosixPath(path: string): string;
2
+ export declare function toRelativePosixPath(rootDir: string, absoluteOrRelativePath: string): string;
3
+ export declare function fromRelativePosixPath(rootDir: string, relativePosixPath: string): string;
@@ -0,0 +1,5 @@
1
+ import type { TextEncoding } from "../strings/text-encoding";
2
+ export declare function decodeText(buf: Uint8Array, encoding: TextEncoding): string;
3
+ export declare function readTextFileSync(filePath: string, options?: {
4
+ encoding?: TextEncoding;
5
+ }): string;
@@ -0,0 +1,8 @@
1
+ export type WriteResult = {
2
+ changed: boolean;
3
+ };
4
+ export declare function ensureDirForFile(filePath: string): void;
5
+ export declare function normalizeLf(text: string): string;
6
+ export declare function writeTextFile(filePath: string, content: string, options?: {
7
+ mode?: "always" | "if-changed";
8
+ }): WriteResult;
@@ -0,0 +1 @@
1
+ export declare function hash8(input: string): string;
@@ -0,0 +1,2 @@
1
+ export declare function createSha256Hex(content: string): string;
2
+ export declare function createSha256HexFromBytes(content: Uint8Array): string;
@@ -0,0 +1,15 @@
1
+ import type { Diagnostic } from "../errors/diagnostics";
2
+ export type ParsedFrontmatter<T extends Record<string, unknown>> = {
3
+ data: Partial<T>;
4
+ body: string;
5
+ hasFrontmatter: boolean;
6
+ diagnostics: Diagnostic[];
7
+ };
8
+ export declare function parseFrontmatter<T extends Record<string, unknown>>(content: string, options?: {
9
+ file?: string;
10
+ strict?: boolean;
11
+ }): ParsedFrontmatter<T>;
12
+ export declare function serializeFrontmatter(data: Record<string, unknown>, options?: {
13
+ lineWidth?: number;
14
+ }): string;
15
+ export declare function buildFrontmatterFile(data: Record<string, unknown>, body: string): string;
@@ -0,0 +1,12 @@
1
+ export declare function yamlQuote(value: string): string;
2
+ export declare function buildCommandMarkdown(def: {
3
+ description?: string;
4
+ agent?: string;
5
+ argumentHint?: string;
6
+ template: string;
7
+ }): string;
8
+ export declare function buildSkillMarkdown(def: {
9
+ name: string;
10
+ description: string;
11
+ template: string;
12
+ }): string;
@@ -0,0 +1 @@
1
+ export declare function parseChineseNumber(input: string): number | null;
@@ -0,0 +1 @@
1
+ export declare function slugify(input: string): string;
@@ -0,0 +1,2 @@
1
+ export declare const TEXT_ENCODINGS: readonly ["auto", "utf8", "utf8-bom", "utf16le", "utf16be", "gbk", "gb18030"];
2
+ export type TextEncoding = (typeof TEXT_ENCODINGS)[number];
@@ -0,0 +1,6 @@
1
+ import type { Diagnostic } from "./errors/diagnostics";
2
+ export declare function formatToolMarkdownOutput(options: {
3
+ summaryLines: string[];
4
+ resultJson: unknown;
5
+ diagnostics: Diagnostic[];
6
+ }): string;
@@ -0,0 +1,2 @@
1
+ export { createNovelApplyCandidatesTool } from "./tool";
2
+ export type { CandidateOp, NovelApplyCandidatesArgs, NovelApplyCandidatesResultJson, NovelCandidatesV1, } from "./types";
@@ -0,0 +1,2 @@
1
+ import type { NovelApplyCandidatesResultJson } from "./types";
2
+ export declare function renderApplyReportMd(result: NovelApplyCandidatesResultJson): string;
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelApplyCandidatesTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,52 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelCandidatesV1 = {
3
+ version: 1;
4
+ generatedAt: string;
5
+ scope: {
6
+ kind: "all";
7
+ } | {
8
+ kind: "chapter";
9
+ chapter_id: string;
10
+ };
11
+ notes?: string;
12
+ ops: CandidateOp[];
13
+ };
14
+ export type CandidateOp = {
15
+ op: "ensure_entity";
16
+ kind: "character" | "faction" | "location" | "thread";
17
+ id: string;
18
+ name?: string;
19
+ filePath?: string;
20
+ } | {
21
+ op: "patch_frontmatter";
22
+ filePath: string;
23
+ patch: Record<string, unknown>;
24
+ mode?: "deep_merge" | "shallow_merge" | "merge" | "replace";
25
+ };
26
+ export type NovelApplyCandidatesArgs = {
27
+ rootDir?: string;
28
+ candidatesPath?: string;
29
+ dryRun?: boolean;
30
+ writeReport?: boolean;
31
+ snapshot?: boolean;
32
+ snapshotTag?: string;
33
+ };
34
+ export type NovelApplyCandidatesResultJson = {
35
+ version: 1;
36
+ dryRun: boolean;
37
+ appliedOps: number;
38
+ writtenFiles: string[];
39
+ skippedOps: {
40
+ index: number;
41
+ reason: string;
42
+ }[];
43
+ snapshot?: {
44
+ enabled: boolean;
45
+ tag?: string;
46
+ dir?: string;
47
+ savedFiles: string[];
48
+ };
49
+ nextSteps?: string[];
50
+ reportPath?: string;
51
+ diagnostics: Diagnostic[];
52
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelBibleTool } from "./tool";
2
+ export type { BibleRule, GlossaryTerm, NovelBibleArgs, NovelBibleResultJson } from "./types";
@@ -0,0 +1,3 @@
1
+ import type { BibleRule, GlossaryTerm } from "./types";
2
+ export declare function renderBibleSummaryMd(rules: BibleRule[]): string;
3
+ export declare function renderGlossaryMd(terms: GlossaryTerm[]): string;
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelBibleTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,26 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelBibleArgs = {
3
+ rootDir?: string;
4
+ manuscriptDir?: string;
5
+ outputDir?: string;
6
+ writeDerivedFiles?: boolean;
7
+ };
8
+ export type BibleRule = {
9
+ id: string;
10
+ text: string;
11
+ sourceFile: string;
12
+ line?: number;
13
+ };
14
+ export type GlossaryTerm = {
15
+ term: string;
16
+ definition?: string;
17
+ sourceFile: string;
18
+ };
19
+ export type NovelBibleResultJson = {
20
+ version: 1;
21
+ summaryPath?: string;
22
+ glossaryPath?: string;
23
+ rules: BibleRule[];
24
+ glossary: GlossaryTerm[];
25
+ diagnostics: Diagnostic[];
26
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelBootstrapTool } from "./tool";
2
+ export type { NovelBootstrapArgs, NovelBootstrapResultJson } 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 createNovelBootstrapTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,38 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ import type { NovelCharacterReportResultJson } from "../novel-character-report/types";
3
+ import type { NovelEntityGapsResultJson } from "../novel-entity-gaps/types";
4
+ import type { NovelGraphResultJson } from "../novel-graph/types";
5
+ import type { NovelImportMode, NovelImportResultJson } from "../novel-import/types";
6
+ import type { NovelIndexResultJson } from "../novel-index/types";
7
+ import type { NovelScaffoldResultJson } from "../novel-scaffold/types";
8
+ export type NovelBootstrapArgs = {
9
+ rootDir?: string;
10
+ fromDir?: string;
11
+ manuscriptDir?: string;
12
+ bookTitle?: string;
13
+ importMode?: NovelImportMode;
14
+ createStubs?: boolean;
15
+ };
16
+ export type NovelBootstrapResultJson = {
17
+ version: 1;
18
+ rootDir: string;
19
+ fromDir: string;
20
+ manuscriptDir: string;
21
+ results: {
22
+ scaffold: NovelScaffoldResultJson;
23
+ import: NovelImportResultJson;
24
+ index: NovelIndexResultJson;
25
+ entityGaps: NovelEntityGapsResultJson;
26
+ graphs: {
27
+ relationships: NovelGraphResultJson;
28
+ factions: NovelGraphResultJson;
29
+ };
30
+ characterReport: NovelCharacterReportResultJson;
31
+ };
32
+ writtenFiles: string[];
33
+ nextSteps: string[];
34
+ diagnostics: Diagnostic[];
35
+ stats: {
36
+ durationMs: number;
37
+ };
38
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelCandidatesWriteTool } from "./tool";
2
+ export type { NovelCandidatesWriteArgs, NovelCandidatesWriteResultJson } 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 createNovelCandidatesWriteTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,13 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelCandidatesWriteArgs = {
3
+ rootDir?: string;
4
+ candidatesPath?: string;
5
+ candidates: unknown;
6
+ };
7
+ export type NovelCandidatesWriteResultJson = {
8
+ version: 1;
9
+ candidatesPath?: string;
10
+ changed?: boolean;
11
+ ops?: number;
12
+ diagnostics: Diagnostic[];
13
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelChapterPlanTool } from "./tool";
2
+ export type { ChapterPlanJson, ChapterPlanScene, NovelChapterPlanArgs, NovelChapterPlanResultJson, } 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 createNovelChapterPlanTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,32 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelChapterPlanArgs = {
3
+ rootDir?: string;
4
+ manuscriptDir?: string;
5
+ chapter_id: string;
6
+ structureRef?: string;
7
+ outputPath?: string;
8
+ writeFile?: boolean;
9
+ sceneCount?: number;
10
+ };
11
+ export type ChapterPlanScene = {
12
+ scene_id: string;
13
+ objective: string;
14
+ conflict: string;
15
+ outcome: string;
16
+ hook?: string;
17
+ };
18
+ export type ChapterPlanJson = {
19
+ chapter_id: string;
20
+ title?: string;
21
+ structureRef?: string;
22
+ sourceChapterPath?: string;
23
+ sceneBlueprint: ChapterPlanScene[];
24
+ writingChecklist: string[];
25
+ qualityGates: string[];
26
+ };
27
+ export type NovelChapterPlanResultJson = {
28
+ version: 1;
29
+ planPath?: string;
30
+ planJson: ChapterPlanJson;
31
+ diagnostics: Diagnostic[];
32
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelCharacterReportTool } from "./tool";
2
+ export type { CharacterReportItem, NovelCharacterReportArgs, NovelCharacterReportResultJson, } from "./types";
@@ -0,0 +1,2 @@
1
+ import type { CharacterReportItem } from "./types";
2
+ export declare function renderCharacterReportMd(items: CharacterReportItem[]): string;
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelCharacterReportTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,23 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelCharacterReportArgs = {
3
+ rootDir?: string;
4
+ manuscriptDir?: string;
5
+ outputDir?: string;
6
+ writeReport?: boolean;
7
+ };
8
+ export type CharacterReportItem = {
9
+ id: string;
10
+ path: string;
11
+ appearances: number;
12
+ first_seen?: string;
13
+ last_seen?: string;
14
+ threads_involved: string[];
15
+ arc_summary?: string;
16
+ missingFields?: string[];
17
+ };
18
+ export type NovelCharacterReportResultJson = {
19
+ version: 1;
20
+ reportPath?: string;
21
+ characters: CharacterReportItem[];
22
+ diagnostics: Diagnostic[];
23
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelConfigCheckTool } from "./tool";
2
+ export type { NovelConfigCheckArgs, NovelConfigCheckResultJson } from "./types";
@@ -0,0 +1,4 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ export declare function createNovelConfigCheckTool(deps: {
3
+ projectRoot: string;
4
+ }): ToolDefinition;
@@ -0,0 +1,15 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelConfigCheckArgs = {
3
+ rootDir?: string;
4
+ };
5
+ export type NovelConfigCheckResultJson = {
6
+ version: 1;
7
+ valid: boolean;
8
+ projectRoot: string;
9
+ sources: {
10
+ user?: string;
11
+ project?: string;
12
+ };
13
+ nextSteps?: string[];
14
+ diagnostics: Diagnostic[];
15
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelContextPackTool } from "./tool";
2
+ export type { NovelContextPackArgs, NovelContextPackResultJson, NovelContextPackTask, } 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 createNovelContextPackTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,37 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelContextPackTask = "draft" | "review" | "rewrite" | "continuity" | "foreshadowing";
3
+ export type NovelContextPackArgs = {
4
+ rootDir?: string;
5
+ manuscriptDir?: string;
6
+ task: NovelContextPackTask;
7
+ chapter_id?: string;
8
+ thread_id?: string;
9
+ budget?: {
10
+ maxChars: number;
11
+ };
12
+ include?: {
13
+ bible?: boolean;
14
+ characters?: boolean;
15
+ openThreads?: boolean;
16
+ lastChapters?: number;
17
+ };
18
+ redaction?: {
19
+ enabled: boolean;
20
+ patterns: string[];
21
+ };
22
+ writeFile?: boolean;
23
+ };
24
+ export type NovelContextPackResultJson = {
25
+ version: 1;
26
+ packPath?: string;
27
+ included: {
28
+ path: string;
29
+ reason: string;
30
+ chars: number;
31
+ }[];
32
+ stats: {
33
+ totalChars: number;
34
+ budgetChars: number;
35
+ };
36
+ diagnostics: Diagnostic[];
37
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelContinuityCheckTool } from "./tool";
2
+ export type { ContinuityFinding, ContinuitySeverity, NovelContinuityArgs, NovelContinuityResultJson, NovelContinuityScope, } from "./types";
@@ -0,0 +1,9 @@
1
+ import type { ContinuityFinding } from "./types";
2
+ export declare function renderContinuityReportMd(options: {
3
+ stats: {
4
+ errors: number;
5
+ warns: number;
6
+ infos: number;
7
+ };
8
+ findings: ContinuityFinding[];
9
+ }): string;
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelContinuityCheckTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,37 @@
1
+ import type { Diagnostic, DiagnosticEvidence } from "../../shared/errors/diagnostics";
2
+ export type NovelContinuityScope = {
3
+ kind: "all";
4
+ } | {
5
+ kind: "chapter";
6
+ chapter_id: string;
7
+ };
8
+ export type NovelContinuityArgs = {
9
+ rootDir?: string;
10
+ manuscriptDir?: string;
11
+ outputDir?: string;
12
+ scope?: NovelContinuityScope;
13
+ strictMode?: boolean;
14
+ writeReport?: boolean;
15
+ };
16
+ export type ContinuitySeverity = "error" | "warn" | "info";
17
+ export type ContinuityFinding = {
18
+ ruleId: string;
19
+ severity: ContinuitySeverity;
20
+ message: string;
21
+ evidence: DiagnosticEvidence[];
22
+ suggestedFix?: string;
23
+ repro?: string;
24
+ };
25
+ export type NovelContinuityResultJson = {
26
+ version: 1;
27
+ reportPath?: string;
28
+ stats: {
29
+ errors: number;
30
+ warns: number;
31
+ infos: number;
32
+ durationMs: number;
33
+ };
34
+ findings: ContinuityFinding[];
35
+ nextSteps?: string[];
36
+ diagnostics: Diagnostic[];
37
+ };
@@ -0,0 +1,2 @@
1
+ export { createNovelEntityGapsTool } from "./tool";
2
+ export type { MissingEntityRef, NovelEntityGapsArgs, NovelEntityGapsResultJson, NovelEntityKind, OrphanEntity, } from "./types";
@@ -0,0 +1,5 @@
1
+ import type { MissingEntityRef, OrphanEntity } from "./types";
2
+ export declare function renderEntityGapsMd(options: {
3
+ missing: MissingEntityRef[];
4
+ orphans: OrphanEntity[];
5
+ }): string;
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelEntityGapsTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;
@@ -0,0 +1,33 @@
1
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
2
+ export type NovelEntityKind = "characters" | "threads" | "factions" | "locations";
3
+ export type NovelEntityGapsArgs = {
4
+ rootDir?: string;
5
+ manuscriptDir?: string;
6
+ outputDir?: string;
7
+ writeReport?: boolean;
8
+ createStubs?: boolean;
9
+ stubPolicy?: "skip" | "write";
10
+ };
11
+ export type MissingEntityRef = {
12
+ kind: NovelEntityKind;
13
+ id: string;
14
+ referencedBy: {
15
+ chapter_id: string;
16
+ path: string;
17
+ }[];
18
+ suggestedPath: string;
19
+ };
20
+ export type OrphanEntity = {
21
+ kind: NovelEntityKind;
22
+ id: string;
23
+ path: string;
24
+ };
25
+ export type NovelEntityGapsResultJson = {
26
+ version: 1;
27
+ reportPath?: string;
28
+ missing: MissingEntityRef[];
29
+ orphans: OrphanEntity[];
30
+ createdStubs: string[];
31
+ nextSteps?: string[];
32
+ diagnostics: Diagnostic[];
33
+ };
@@ -0,0 +1,5 @@
1
+ import type { NovelDocxTemplate } from "./types";
2
+ export declare function markdownToDocxBytes(markdown: string, options: {
3
+ title: string;
4
+ template?: NovelDocxTemplate;
5
+ }): Promise<Uint8Array>;
@@ -0,0 +1,10 @@
1
+ export type EpubChapter = {
2
+ id: string;
3
+ title: string;
4
+ bodyHtml: string;
5
+ };
6
+ export declare function chaptersToEpubBytes(options: {
7
+ title: string;
8
+ language: string;
9
+ chapters: EpubChapter[];
10
+ }): Uint8Array;
@@ -0,0 +1,2 @@
1
+ export { createNovelExportTool } from "./tool";
2
+ export type { NovelChapterOrder, NovelExportArgs, NovelExportFormat, NovelExportResultJson, } from "./types";
@@ -0,0 +1,19 @@
1
+ import type { ToolContext } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ import type { Diagnostic } from "../../shared/errors/diagnostics";
4
+ import type { NovelExportPreflightCheck, NovelExportPreflightFailOn, NovelExportPreflightSummary } from "./types";
5
+ export type RunPreflightOptions = {
6
+ projectRoot: string;
7
+ config: NovelConfig;
8
+ rootDir: string;
9
+ manuscriptDir: string;
10
+ enabled: boolean;
11
+ checks: NovelExportPreflightCheck[];
12
+ failOn: NovelExportPreflightFailOn;
13
+ context?: ToolContext;
14
+ };
15
+ /** 执行配置的预检项并汇总检查报告。 */
16
+ export declare function runPreflight(options: RunPreflightOptions): Promise<{
17
+ summary: NovelExportPreflightSummary | undefined;
18
+ diagnostics: Diagnostic[];
19
+ }>;
@@ -0,0 +1,6 @@
1
+ export declare function wrapHtmlDocument(options: {
2
+ title: string;
3
+ bodyHtml: string;
4
+ language?: string;
5
+ }): string;
6
+ export declare function markdownToHtml(markdown: string): string;
@@ -0,0 +1,6 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { NovelConfig } from "../../config/schema";
3
+ export declare function createNovelExportTool(deps: {
4
+ projectRoot: string;
5
+ config: NovelConfig;
6
+ }): ToolDefinition;