dsh-lifecard 0.2.0 → 0.2.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.
- package/cordis.patch.yml +171 -2
- package/lib/client.js +1191 -132
- package/lib/codec.js +287 -1
- package/lib/core.js +87 -1
- package/lib/index.js +812 -26
- package/lib/novel.js +10 -2
- package/lib/presets.js +35 -0
- package/lib/prose.js +253 -0
- package/lib/store.js +584 -15
- package/lifecard-tools.js +805 -0
- package/package.json +9 -3
- package/skills/blind-review-loop/SKILL.md +205 -0
- package/skills/human-writing/LICENSE +21 -0
- package/skills/human-writing/SKILL.md +306 -0
- package/skills/human-writing/VERSION +1 -0
- package/skills/human-writing/agents/openai.yaml +4 -0
- package/skills/human-writing/dist/human-writing-lite.md +29 -0
- package/skills/human-writing/references/essay-or-fiction.md +79 -0
- package/skills/human-writing/references/fiction.md +115 -0
- package/skills/human-writing/references/formats.md +99 -0
- package/skills/human-writing/references/forum-prose.md +349 -0
- package/skills/human-writing/references/reality.md +119 -0
- package/skills/human-writing/references/revision.md +228 -0
- package/skills/human-writing/references/story-diagnosis.md +131 -0
- package/skills/human-writing/references/writing-ceiling.md +151 -0
- package/skills/human-writing/scripts/check_prose.py +864 -0
- package/skills/lifecard-novel-writing/SKILL.md +88 -0
- package/skills/visual-novel/SKILL.md +139 -0
- package/skills/visual-novel/references/script-and-flow.md +89 -0
package/lib/novel.js
CHANGED
|
@@ -442,8 +442,16 @@ export function buildChapterPrompt({ title, idea, genre, previousTail, currentBo
|
|
|
442
442
|
'【怎么写】',
|
|
443
443
|
'- 直接写正文,不要复述设定,不要写「好的,我来写」这种话。',
|
|
444
444
|
'- 接着上面的情节往下,不要重写已经写过的部分。',
|
|
445
|
-
'-
|
|
446
|
-
'-
|
|
445
|
+
'- 这一章只把一件事写清楚:有人想做什么、被什么挡住、最后落在哪个具体的东西上。',
|
|
446
|
+
'- 写到具体的东西为止:手上在做什么、屋里有什么声音、谁站在哪儿。不写「他很孤独」这种结论。',
|
|
447
|
+
'- 对话不加「他笑着说」「她冷冷地说」这类提示语;让话自己站住,语气靠说的是什么。',
|
|
448
|
+
'- 结尾停在具体的动作、物件或一句没接完的话上,不要总结这一章,也不要预告下一章。',
|
|
449
|
+
'- 句式天然一点:「不是…而是…」「与此同时」「不禁」「瞳孔一缩」「命运的齿轮」这些一律不用。',
|
|
450
|
+
'- 形容词要落得回一个能用手的场面:稳的是车和地基,平的是地和案板。不要写「他做事很平」「这个判断很沉」这种;要评价一个人,就写他做了什么。',
|
|
451
|
+
'- 不解释刚写出来的东西:写完一个动作就往下走,不要在它后面紧跟一句替读者总结这意味了什么。',
|
|
452
|
+
'- 比喻只在现场捞:用的东西得是这一场里真出现过的(门、碗、雨、他手上那根烟)。从别处搬一个漂亮东西过来形容这里,宁可不要。',
|
|
453
|
+
'- 人物对话里「行」「我记着了」「你先说」这种短回应可以留——对面坐着人,接得住。叙述里不要出现「这句话很稳」这类没有对象的自我表态。',
|
|
454
|
+
'- 每人按自己的性格和处境行动,不要为了推情节让谁临时变傻或变好。',
|
|
447
455
|
'- 不写章节标题,标题我自己加。',
|
|
448
456
|
'- 只写这一章,写到该收的地方就停,不要顺手把下一章也开了头。',
|
|
449
457
|
'',
|
package/lib/presets.js
CHANGED
|
@@ -173,6 +173,41 @@ export const BUILTIN = [
|
|
|
173
173
|
].join('\n'),
|
|
174
174
|
},
|
|
175
175
|
|
|
176
|
+
// 这两份是把「传统严肃文学」和「连载」两套写法各写一遍。
|
|
177
|
+
// 之前插件里只有按笔法分的五份(白描/散文化/悬疑/对话/第一人称),
|
|
178
|
+
// 缺一个「按用途选」的入口:写投稿的短篇和写要连载的长篇,
|
|
179
|
+
// 要守的东西不一样。
|
|
180
|
+
{
|
|
181
|
+
id: 'novel-serious',
|
|
182
|
+
mode: 'novel',
|
|
183
|
+
name: '严肃短篇',
|
|
184
|
+
desc: '按传统文学的标准写,能拿去投稿的那种',
|
|
185
|
+
prompt: [
|
|
186
|
+
'这一段按传统严肃文学的标准写。',
|
|
187
|
+
'- 先想清楚这一段里谁在做什么、他为什么不肯直说,再动笔。不要用大纲代替正文。',
|
|
188
|
+
'- 写不被看见的人,给他们说话的机会。不写主角光环,不炫技,不把穷和苦写成猎奇。',
|
|
189
|
+
'- 情绪不要当场结清:不靠眼泪、不靠怜悯、不靠一次性的催泪。把力气放在处境、细节和后面才起作用的地方。',
|
|
190
|
+
'- 用具体的动作和物写,少用形容词堆叠。不写「他感到一阵悲凉」,写他做了什么、看见什么。',
|
|
191
|
+
'- 对话不加解释性提示语,少写「他愤怒地说」。',
|
|
192
|
+
'- 写完自己读一遍,把硬伤改掉再交出来。',
|
|
193
|
+
].join('\n'),
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: 'novel-serial',
|
|
197
|
+
mode: 'novel',
|
|
198
|
+
name: '连载章回',
|
|
199
|
+
desc: '一章一个推进,结尾留钩子(网文节奏)',
|
|
200
|
+
prompt: [
|
|
201
|
+
'这一段按连载的节奏写。',
|
|
202
|
+
'- 一章只推一个主事件。开头接上一章的结尾,结尾把读者的注意力留在一个未解决的问题上。',
|
|
203
|
+
'- 钩子要落在具体的事上(一句话、一个动作、一件东西),不要用「他不知道,这将改变一切」这种旁白预告。',
|
|
204
|
+
'- 人物按设定行动,有私心也有误会,不当工具人。他的选择要能说出理由。',
|
|
205
|
+
'- 写进去的伏笔记着,到该回收的时候要回收。',
|
|
206
|
+
'- 篇幅写足,不要交一千字以下的残章;不够就补细节和推进,不要注水。',
|
|
207
|
+
'- 避开万能句:「嘴角勾起一抹冷笑」「不禁」「仿佛」这类一写就有的句子。',
|
|
208
|
+
].join('\n'),
|
|
209
|
+
},
|
|
210
|
+
|
|
176
211
|
// ── 文字小说游戏 ──────────────────────────────
|
|
177
212
|
{
|
|
178
213
|
id: 'game-detect',
|
package/lib/prose.js
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 顺手数一下「像 AI 写的」那些地方。
|
|
3
|
+
*
|
|
4
|
+
* 模型审稿(`novel.chapter.review`)问的是「哪里卡住、哪里不信、哪里想跳过」,
|
|
5
|
+
* 那是读者的判断,靠它自己读。但有一类毛病不靠判断也能数出来:
|
|
6
|
+
* 「不是…而是…」连着用了四次、「瞳孔一缩」出现了三次、每五百字五个「似乎」。
|
|
7
|
+
* 这种地方人一眼看不出密度,数出来才知道。
|
|
8
|
+
*
|
|
9
|
+
* 所以这里做的是**统计**,不是评价:只报告「哪个说法出现了几次、举一句原文」,
|
|
10
|
+
* 不替作者改句子,也不说「这段写得不好」。
|
|
11
|
+
*
|
|
12
|
+
* 三条纪律:
|
|
13
|
+
* 1. 只数,不判。这里没有分数,也没有「合格/不合格」。
|
|
14
|
+
* 2. 举原句要举完整的短句,让人能自己判断是不是该改。
|
|
15
|
+
* 3. 查不到就说查不到,不要为了显得有用而凑数。
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** 严重程度只是「先看哪个」的顺序,不是错误等级。 */
|
|
19
|
+
const ORDER = { 先看: 0, 顺便看: 1 }
|
|
20
|
+
|
|
21
|
+
/** 一、套话:说出来等于没说,删掉不影响任何信息。 */
|
|
22
|
+
const FILLER_WORDS = [
|
|
23
|
+
['此外', '删掉,或者直接接着说下一件事'],
|
|
24
|
+
['总而言之', '删掉,接着写就行'],
|
|
25
|
+
['综上所述', '删掉'],
|
|
26
|
+
['不可否认', '改成「确实」,或者直接陈述'],
|
|
27
|
+
['显而易见', '删掉,把看得见的东西写出来'],
|
|
28
|
+
['值得注意的是', '删掉,直接写值得注意的那件事'],
|
|
29
|
+
['需要指出的是', '删掉'],
|
|
30
|
+
['众所周知', '删掉'],
|
|
31
|
+
['从某种意义上说', '删掉,直接说'],
|
|
32
|
+
['不言而喻', '删掉,让读者自己体会'],
|
|
33
|
+
['意味深长', '用具体的话或表情替代'],
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
/** 二、句式:不是错,是密度一高就露出「同一个脑子在写」。 */
|
|
37
|
+
const PATTERNS = [
|
|
38
|
+
[/不是[^。!?\n]{1,30}而是/g, '先说什么不是什么,再另起一句说什么', '先看'],
|
|
39
|
+
[/没有[^。!?\n]{1,30}只是/g, '直接陈述事实', '先看'],
|
|
40
|
+
[/让[^。!?\n]{1,15}(?:感到|觉得|意识到|想起)/g, '去掉「让」,写他自己感到的那个动作', '先看'],
|
|
41
|
+
[/令[^。!?\n]{1,15}(?:感到|觉得|想起)/g, '同上', '先看'],
|
|
42
|
+
[/与此同时/g, '「同时」或「这时候」', '先看'],
|
|
43
|
+
[/当[^。!?\n]{1,40}时/g, '拆成两句,别把时间条件套在前面', '顺便看'],
|
|
44
|
+
[/于是[^。!?\n]{1,20}然而/g, '拆成两句', '顺便看'],
|
|
45
|
+
[/随即[^。!?\n]{1,20}紧接着/g, '留一个连接词就够', '顺便看'],
|
|
46
|
+
[/不禁[^。!?\n]{0,8}/g, '直接写动作', '顺便看'],
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
/** 三、身体模板:情绪一动就用同一套身体反应。 */
|
|
50
|
+
const BODY = [
|
|
51
|
+
[/瞳孔[^。!?\n]{0,5}(?:缩|一缩)/g, '写他眼睛具体在看什么', '顺便看'],
|
|
52
|
+
[/身体[^。!?\n]{0,5}(?:一僵|僵住|僵了)/g, '「他停住了」「动作顿了一下」', '顺便看'],
|
|
53
|
+
[/倒(?:吸|抽)[^。!?\n]{0,5}凉气/g, '写他在那儿看到了什么', '顺便看'],
|
|
54
|
+
[/呼吸[^。!?\n]{0,5}(?:一滞|滞住)/g, '「他屏住呼吸」或者删掉', '顺便看'],
|
|
55
|
+
[/心头[^。!?\n]{0,5}(?:一暖|暖了|暖)/g, '写身上哪儿热了一下', '顺便看'],
|
|
56
|
+
[/心里[^。!?\n]{0,5}(?:一沉|沉了|沉)/g, '「胃里一阵发紧」或「手脚发凉」', '顺便看'],
|
|
57
|
+
[/嘴角[^。!?\n]{0,5}(?:勾起|上扬|翘起)/g, '写他脸上具体的表情', '顺便看'],
|
|
58
|
+
[/眼神[^。!?\n]{0,5}(?:闪烁|游移)/g, '写他在躲什么', '顺便看'],
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
/** 四、大词:本来要具体写的地方,用一个大词糊过去。 */
|
|
62
|
+
const BIG_WORDS = [
|
|
63
|
+
['至关重要', '「关键」「要命」'],
|
|
64
|
+
['深入探讨', '写他们真的说了什么'],
|
|
65
|
+
['充满活力', '写具体在动的东西'],
|
|
66
|
+
['不可磨灭', '写那件事本身'],
|
|
67
|
+
['焕然一新', '写变了什么'],
|
|
68
|
+
['翻天覆地', '写变了什么'],
|
|
69
|
+
['命运的齿轮', '删掉'],
|
|
70
|
+
['无声地诉说', '写它具体是什么样子'],
|
|
71
|
+
['空气中弥漫着', '写闻到的、看到的'],
|
|
72
|
+
['交织在一起', '写两件事怎么缠上的'],
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
/** 五、形容词脱钩:把一个挂在物件上的词,摘下来挂到抽象的东西上(「他做事很平」)。 */
|
|
76
|
+
const DETACHED = [
|
|
77
|
+
[
|
|
78
|
+
/(?:做法|判断|方案|稿子|这话|这句话|逻辑|节奏|关系|思路|风格|口气|语气)(?:很|挺|太|够|有点|特别|十分|非常)?(?:稳|平|沉|轻|重)/g,
|
|
79
|
+
'「稳」是车和地基的属性,「平」是地的属性。写清他做了什么,别把物件上的词摘下来挂到做法上',
|
|
80
|
+
'先看',
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
/(?:做事|做人|办事|下笔|分析|推理)(?:很|挺|太|够|有点|特别)?(?:稳|平|沉|轻|重)/g,
|
|
84
|
+
'同上:把它翻成他到底在做什么动作',
|
|
85
|
+
'先看',
|
|
86
|
+
],
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
/** 六、糊词:一个两个是语气,一堆就是没想清楚。 */
|
|
90
|
+
const FUZZY = ['似乎', '也许', '大概', '仿佛', '好像', '隐约', '莫名', '某种', '一丝', '些许']
|
|
91
|
+
|
|
92
|
+
/** 每 500 字允许几个糊词(超过就算「太多」)。 */
|
|
93
|
+
const FUZZY_PER_500 = 3
|
|
94
|
+
|
|
95
|
+
/** 取命中位置前后一小段,人能看出是哪一句。 */
|
|
96
|
+
function excerpt(text, index, length) {
|
|
97
|
+
const start = Math.max(0, index - 10)
|
|
98
|
+
const end = Math.min(text.length, index + length + 10)
|
|
99
|
+
const cut = text.slice(start, end).replace(/\s+/g, ' ').trim()
|
|
100
|
+
return cut.length > 32 ? `${cut.slice(0, 32)}…` : cut
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function countOf(text, word) {
|
|
104
|
+
let count = 0
|
|
105
|
+
let from = 0
|
|
106
|
+
for (;;) {
|
|
107
|
+
const at = text.indexOf(word, from)
|
|
108
|
+
if (at < 0) return count
|
|
109
|
+
count += 1
|
|
110
|
+
from = at + word.length
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 数一遍。
|
|
116
|
+
* @param {string} text 正文
|
|
117
|
+
* @returns {{chars:number,total:number,byOrder:object,hits:Array,fuzzy:object}}
|
|
118
|
+
*/
|
|
119
|
+
export function scanProse(text) {
|
|
120
|
+
const source = String(text ?? '')
|
|
121
|
+
const chars = source.replace(/\s+/g, '').length
|
|
122
|
+
const hits = []
|
|
123
|
+
|
|
124
|
+
for (const [word, advice] of FILLER_WORDS) {
|
|
125
|
+
const count = countOf(source, word)
|
|
126
|
+
if (count === 0) continue
|
|
127
|
+
const at = source.indexOf(word)
|
|
128
|
+
hits.push({ kind: 'filler', label: `「${word}」`, count, advice, sample: excerpt(source, at, word.length), order: '先看' })
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
for (const [pattern, advice, order] of PATTERNS) {
|
|
132
|
+
const found = []
|
|
133
|
+
pattern.lastIndex = 0
|
|
134
|
+
let match = pattern.exec(source)
|
|
135
|
+
while (match !== null) {
|
|
136
|
+
found.push({ index: match.index, text: match[0] })
|
|
137
|
+
if (found.length >= 20) break
|
|
138
|
+
match = pattern.exec(source)
|
|
139
|
+
}
|
|
140
|
+
if (found.length === 0) continue
|
|
141
|
+
hits.push({
|
|
142
|
+
kind: 'pattern',
|
|
143
|
+
label: patternLabel(found[0].text),
|
|
144
|
+
count: found.length,
|
|
145
|
+
advice,
|
|
146
|
+
sample: excerpt(source, found[0].index, found[0].text.length),
|
|
147
|
+
order,
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
for (const [pattern, advice, order] of BODY) {
|
|
152
|
+
const found = []
|
|
153
|
+
pattern.lastIndex = 0
|
|
154
|
+
let match = pattern.exec(source)
|
|
155
|
+
while (match !== null) {
|
|
156
|
+
found.push({ index: match.index, text: match[0] })
|
|
157
|
+
if (found.length >= 20) break
|
|
158
|
+
match = pattern.exec(source)
|
|
159
|
+
}
|
|
160
|
+
if (found.length === 0) continue
|
|
161
|
+
hits.push({
|
|
162
|
+
kind: 'body',
|
|
163
|
+
label: `「${found[0].text}」这类身体反应`,
|
|
164
|
+
count: found.length,
|
|
165
|
+
advice,
|
|
166
|
+
sample: excerpt(source, found[0].index, found[0].text.length),
|
|
167
|
+
order,
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
for (const [pattern, advice, order] of DETACHED) {
|
|
172
|
+
const found = []
|
|
173
|
+
pattern.lastIndex = 0
|
|
174
|
+
let match = pattern.exec(source)
|
|
175
|
+
while (match !== null) {
|
|
176
|
+
found.push({ index: match.index, text: match[0] })
|
|
177
|
+
if (found.length >= 20) break
|
|
178
|
+
match = pattern.exec(source)
|
|
179
|
+
}
|
|
180
|
+
if (found.length === 0) continue
|
|
181
|
+
hits.push({
|
|
182
|
+
kind: 'detached',
|
|
183
|
+
label: `「${found[0].text}」这类说法`,
|
|
184
|
+
count: found.length,
|
|
185
|
+
advice,
|
|
186
|
+
sample: excerpt(source, found[0].index, found[0].text.length),
|
|
187
|
+
order,
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
for (const [word, advice] of BIG_WORDS) {
|
|
192
|
+
const count = countOf(source, word)
|
|
193
|
+
if (count === 0) continue
|
|
194
|
+
const at = source.indexOf(word)
|
|
195
|
+
hits.push({ kind: 'big', label: `「${word}」`, count, advice, sample: excerpt(source, at, word.length), order: '先看' })
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
let fuzzyCount = 0
|
|
199
|
+
for (const word of FUZZY) fuzzyCount += countOf(source, word)
|
|
200
|
+
const per500 = chars === 0 ? 0 : Math.round((fuzzyCount / (chars / 500)) * 10) / 10
|
|
201
|
+
const fuzzy = { count: fuzzyCount, per500, tooMany: chars >= 500 && per500 > FUZZY_PER_500 }
|
|
202
|
+
|
|
203
|
+
hits.sort((a, b) => (ORDER[a.order] ?? 9) - (ORDER[b.order] ?? 9) || b.count - a.count)
|
|
204
|
+
const byOrder = { 先看: 0, 顺便看: 0 }
|
|
205
|
+
for (const hit of hits) byOrder[hit.order] = (byOrder[hit.order] ?? 0) + hit.count
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
ok: true,
|
|
209
|
+
chars,
|
|
210
|
+
total: hits.reduce((sum, hit) => sum + hit.count, 0),
|
|
211
|
+
byOrder,
|
|
212
|
+
hits,
|
|
213
|
+
fuzzy,
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** 正则命中的原句开头几字,用来当标签(「不是…而是」)。 */
|
|
218
|
+
function patternLabel(matched) {
|
|
219
|
+
const text = String(matched ?? '')
|
|
220
|
+
if (text.startsWith('不是')) return '「不是…而是」这种句式'
|
|
221
|
+
if (text.startsWith('没有')) return '「没有…只是」这种句式'
|
|
222
|
+
if (/^让/.test(text)) return '「让某人感到/觉得」这种句式'
|
|
223
|
+
if (/^令/.test(text)) return '「令人感到」这种句式'
|
|
224
|
+
if (text.startsWith('与此同时')) return '「与此同时」'
|
|
225
|
+
if (/^当/.test(text)) return '「当…时」这种句式'
|
|
226
|
+
if (/^于是/.test(text)) return '「于是…然而」连着用'
|
|
227
|
+
if (/^随即/.test(text)) return '「随即…紧接着」连着用'
|
|
228
|
+
if (/^不禁/.test(text)) return '「不禁…」'
|
|
229
|
+
return `「${text.slice(0, 6)}」这类句式`
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* 把数出来的结果写成一段人能读的话。
|
|
234
|
+
* 一条都没有时返回空串(调用方就别贴一段「没查出问题」占地方)。
|
|
235
|
+
*/
|
|
236
|
+
export function proseReportText(scan) {
|
|
237
|
+
const data = scan && scan.ok === true ? scan : null
|
|
238
|
+
if (data === null) return ''
|
|
239
|
+
const lines = []
|
|
240
|
+
|
|
241
|
+
for (const hit of data.hits) {
|
|
242
|
+
// 只出现一次、篇幅又短:算不上密度问题,别拿一条孤例占版面。
|
|
243
|
+
// 但一章里出现一次「命运的齿轮」也值得说,所以门槛按篇幅走。
|
|
244
|
+
// 套话与大词出现一次就该看见;句式与身体模板要成密度才说,否则一句一个不算毛病。
|
|
245
|
+
if (hit.kind !== 'filler' && hit.kind !== 'big' && hit.kind !== 'detached' && hit.count < 2 && data.chars < 800) continue
|
|
246
|
+
lines.push(`- ${hit.label}用了 ${hit.count} 次,例如「${hit.sample}」——${hit.advice}`)
|
|
247
|
+
}
|
|
248
|
+
if (data.fuzzy.tooMany === true) {
|
|
249
|
+
lines.push(`- 「似乎 / 大概 / 仿佛」这类词每五百字 ${data.fuzzy.per500} 个(一共 ${data.fuzzy.count} 个)——想清楚的地方不用这些词`)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return lines.join('\n')
|
|
253
|
+
}
|