novel-weaver 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.
- package/README.md +148 -0
- package/dist/index.cjs +28499 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +28467 -0
- package/dist/index.js.map +1 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# novel-weaver
|
|
2
|
+
|
|
3
|
+
> AI-assisted novel writing system for [OpenCode](https://opencode.ai/) — genre packs, arc templates, character voice tracking, pacing analysis, and a built-in web UI.
|
|
4
|
+
|
|
5
|
+
novel-weaver 是一款专为 [OpenCode](https://opencode.ai/) 设计的网络小说写作助手插件。它把 OpenCode 从"写代码"变成"写小说",提供:
|
|
6
|
+
|
|
7
|
+
- **35 个领域工具**:世界观/角色/章节/伏笔/审查/统计/查询
|
|
8
|
+
- **4 个 Agent**:ArcMaster · WorldBuilder · Reviewer · PlotPlanner
|
|
9
|
+
- **5 个 Hook**:自动上下文注入、意图检测、章节完成推进
|
|
10
|
+
- **4 个题材包**:infinite-flow · xianxia · urban · _default
|
|
11
|
+
- **8 个 arc 模板**:副本、试炼、任务、剧情
|
|
12
|
+
- **Web UI**:Dashboard · Chat · Editor · World · Review · Pacing · Settings
|
|
13
|
+
- **任务模型配置**:每个任务可独立配置 LLM 模型与温度
|
|
14
|
+
|
|
15
|
+
## 安装
|
|
16
|
+
|
|
17
|
+
### 方法 1:从 npm 安装(推荐)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 在 OpenCode 全局配置中添加
|
|
21
|
+
# ~/.config/opencode/opencode.json
|
|
22
|
+
{
|
|
23
|
+
"plugin": ["novel-weaver"]
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
OpenCode 启动时会自动用 Bun 安装插件到 `~/.cache/opencode/node_modules/`。
|
|
28
|
+
|
|
29
|
+
### 方法 2:从本地源码安装(开发)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 在项目目录运行
|
|
33
|
+
opencode plugin "file:." --global
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 方法 3:项目级安装
|
|
37
|
+
|
|
38
|
+
把 `novel-weaver` 加入到项目的 `opencode.json`:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"plugin": ["novel-weaver"]
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 快速开始
|
|
47
|
+
|
|
48
|
+
1. 启动 OpenCode
|
|
49
|
+
2. 在小说项目目录里,让 LLM 调用 `novel_init` 工具初始化项目
|
|
50
|
+
3. 描述你的小说题材(如"无限流"、"仙侠"、"都市")
|
|
51
|
+
4. 开始用斜杠命令或 Chat UI 写作
|
|
52
|
+
|
|
53
|
+
### 斜杠命令
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
/novel:init 初始化小说项目
|
|
57
|
+
/novel:status 查看项目状态
|
|
58
|
+
/novel:model list 列出当前所有任务的模型
|
|
59
|
+
/novel:model set write opus-4
|
|
60
|
+
/novel:model use write sonnet
|
|
61
|
+
/novel:model reset write
|
|
62
|
+
/novel:model cost 查看 token 成本
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 常用工具
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
novel_ping 插件健康检查
|
|
69
|
+
novel_init 初始化项目
|
|
70
|
+
novel_arc_generate 生成篇章弧线
|
|
71
|
+
novel_arc_customize 自定义弧线
|
|
72
|
+
novel_world_create 创建世界观
|
|
73
|
+
novel_character_create 创建角色
|
|
74
|
+
novel_write_chapter 写章
|
|
75
|
+
novel_review 8 维审查
|
|
76
|
+
novel_consistency_check 5 维一致性检查
|
|
77
|
+
novel_query 智能查询(4 种意图)
|
|
78
|
+
novel_pacing_visualize 节奏图谱
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Web UI
|
|
82
|
+
|
|
83
|
+
启动 OpenCode 后访问 [http://localhost:4096](http://localhost:4096),可以看到:
|
|
84
|
+
|
|
85
|
+
- **首页**:项目概览、Pipeline 进度
|
|
86
|
+
- **对话**:与 LLM 实时对话写作(SSE 流式)
|
|
87
|
+
- **编辑器**:章节内容 + Markdown 预览
|
|
88
|
+
- **世界观**:世界观/角色/篇章三 Tab
|
|
89
|
+
- **审查**:8 维审查结果可视化
|
|
90
|
+
- **节奏图谱**:🟢🟡🔴 爆点/爽点/虐点分布
|
|
91
|
+
- **设置**:任务模型切换、温度调整
|
|
92
|
+
|
|
93
|
+
## 配置文件
|
|
94
|
+
|
|
95
|
+
`./.novel-weaver/config.json`:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"taskModel": {
|
|
100
|
+
"write": "anthropic/claude-opus-4",
|
|
101
|
+
"review": "anthropic/claude-sonnet-4",
|
|
102
|
+
"query": "anthropic/claude-haiku-4"
|
|
103
|
+
},
|
|
104
|
+
"temperature": {
|
|
105
|
+
"write": 0.8,
|
|
106
|
+
"review": 0.2
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 开发
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# 1. 克隆
|
|
115
|
+
git clone https://github.com/wvfp/novel-weaver.git
|
|
116
|
+
cd novel-weaver
|
|
117
|
+
|
|
118
|
+
# 2. 安装依赖
|
|
119
|
+
npm install
|
|
120
|
+
|
|
121
|
+
# 3. 类型检查
|
|
122
|
+
npm run typecheck
|
|
123
|
+
|
|
124
|
+
# 4. 编译
|
|
125
|
+
npm run build
|
|
126
|
+
|
|
127
|
+
# 5. Web UI 开发
|
|
128
|
+
npm run web:dev
|
|
129
|
+
|
|
130
|
+
# 6. Web UI 构建
|
|
131
|
+
npm run web:build
|
|
132
|
+
|
|
133
|
+
# 7. 测试
|
|
134
|
+
bun test
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 文档
|
|
138
|
+
|
|
139
|
+
- [tools/](src/tools/) — 25 个工具
|
|
140
|
+
- [hooks/](src/hooks/) — 5 个 hook
|
|
141
|
+
- [agents/prompts/](src/agents/prompts/) — 4 个 agent
|
|
142
|
+
- [genre-packs/](src/genre-packs/) — 4 个题材包
|
|
143
|
+
- [dashboard/](src/dashboard/) — HTTP API
|
|
144
|
+
- [web/](web/) — SolidJS + Vite 前端
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
MIT © [wvfp](https://github.com/wvfp)
|