feat: 工具一 anima-extract,從輕小說章節產生角色包並建立 PR

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 06:15:09 +00:00
co-authored by Claude Sonnet 5.5
parent c890059a50
commit e681e11ae9
5 changed files with 527 additions and 0 deletions
+3
View File
@@ -2,6 +2,7 @@ import type { Engine, Register } from 'claude-code'
import { CHARACTERS, applyOverrides, findCharacter, personaSection } from './characters'
import type { Axes } from './characters'
import { EXTRACT_COMMAND, runExtract } from './extractCommand'
import { layout, meter, parseFields, remainColor, SEPARATOR, usedColor } from './statusline'
import type { Segment } from './statusline'
@@ -78,6 +79,7 @@ export const register: Register = (on, options) => {
for (const c of CHARACTERS) {
await $.command.register({ name: c.slug, description: `啟動《${c.work}》的${c.name}` })
}
await $.command.register({ name: EXTRACT_COMMAND, description: '從輕小說章節萃取作品與角色包,確認後建立 PR' })
await $.command.register({ name: OFF_COMMAND, description: '離開角色,回到一般的 Claude Code' })
const saved = await $.store.get(ACTIVE_KEY)
active = flag('persist', true) && typeof saved === 'string' && findCharacter(saved) ? saved : undefined
@@ -87,6 +89,7 @@ export const register: Register = (on, options) => {
on('command.run', async ($, e, next) => {
if (!isEnabled) return next(e)
if (e.command === EXTRACT_COMMAND) return { text: await runExtract($, e.args) }
if (e.command === OFF_COMMAND) {
active = undefined
await $.store.delete(ACTIVE_KEY)