Skip to main content

story-setup

网文写作工具集基础设施部署与检查。为 Claude Code / OpenCode / Codex / Google Antigravity / ZCode / OpenClaw / Reasonix 提供内置适配;Web AI / 通用 Agent 可走 skills + AGENTS.md 文件模式。触发方式:/story-setup、$story-setup、「准备写书」「帮我搭一下环境」「配置写作项目」「检查写作环境」。

Source facts

Repository
suphiozdedee/projenicdesign.com
Last source activity
September 27, 2026 at 06:46
Detected SKILL.md language
Chinese
Stars
0
Forks
0

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

File Explorer
100 files

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
story-setup
version
1.2.10
description
网文写作工具集基础设施部署与检查。为 Claude Code / OpenCode / Codex / Google Antigravity / ZCode / OpenClaw / Reasonix 提供内置适配;Web AI / 通用 Agent 可走 skills + AGENTS.md 文件模式。触发方式:/story-setup、$story-setup、「准备写书」「帮我搭一下环境」「配置写作项目」「检查写作环境」。
metadata
{"openclaw":{"source":"https://github.com/zenstory-ai/oh-story-claudecode"}}
# story-setup:网文写作工具集基础设施部署 你是写作基础设施部署器。将网文写作工具集部署到用户项目目录:已适配的 CLI 走专用 hooks/agents/config;NarraFork、Web AI、自定义 Agent 等环境走通用文件模式。 **执行铁律:不覆盖用户已有配置,合并而非替换。** ## 选择模式 - 参数为 `check`,或用户只要求检查部署、诊断环境、排查 agent 不可用时:完整读取 [references/diagnostics.md](references/diagnostics.md),按其中流程仅检查并报告;不进入下面的部署流程。 - 用户要求安装、更新或修复时:执行下面的部署流程。检查后已明确授权的修复沿用本文件的部署与合并规则。 --- ## Phase 1:检测项目状态 **先自检参考目录**:以正在执行的本 `SKILL.md` 所在目录为准,列出与它同级的 `references/` 下的子目录,核对下面 9 个名字是否都在**且都非空**——`agent-references`、`templates`、`opencode`、`codex`、`antigravity`、`zcode`、`openclaw`、`reasonix`、`generic`;同级 `scripts/merge-claude-settings.py`、`scripts/merge-codex-hooks.py`、`scripts/merge-antigravity-hooks.py`、`scripts/generate-antigravity-agents.mjs`、`scripts/deploy-antigravity-skills.py` 与 `scripts/copy-path-safety.py` 也必须存在(Claude/Codex/Antigravity hooks 合并、Antigravity Skills 物化与 agent 生成、递归复制安全检查依赖它们)。有缺即 skill 包没装全,**立即停止,不写任何部署文件**,报告里区分「缺目录」「目录为空」和「缺脚本」,并给修复指令:「story-setup 参考资料包不完整,缺 {路径}。按你的安装方式重装 oh-story-claudecode(命令行装的重跑 `npx skills add zenstory-ai/oh-story-claudecode -y -g`,marketplace / Plugin Management 装的在面板里重装),再执行 /story-setup。」 > 判据是「有没有 `SKILL.md`」:只看正在执行的 `SKILL.md` 同级的 `references/`。项目内 `.claude/skills/story-setup/`、`.codex/skills/story-setup/` 和 OpenCode 的 `skills/story-setup/` 只有 `references/agent-references/`、不含 `SKILL.md`,不会是执行目录,也不要拿它们核对。Antigravity / ZCode / OpenClaw / Reasonix / generic 的项目副本是整份 skill 拷贝、自带 `SKILL.md`,9 个子目录本就齐全,照常核对即可。 1. 检查当前目录是否已部署过(存在 `.story-deployed`) - `agents_version` 缺失、非整数或小于 `30` → 标记为待更新,继续执行当前部署 - `agents_version: 30` → 使用 AskUserQuestion 确认是否重新部署;提示里写明重新部署只用**当前本地 skill 包**刷新项目文件,要拿 skill 本身的新版本得先更新 oh-story-claudecode(`npx skills add` 或 marketplace),再回来重跑 - `agents_version` 大于 `30` → 当前 story-setup 比项目部署旧;停止以避免降级覆盖,提示先更新 oh-story-claudecode,不写任何部署文件 - 同时读 `target_cli` 字段。**已部署项目以 sentinel 里的值为准**:非空时(逗号分隔的多端组合原样保留)跳过下面第 5-12 步的环境探测与选择,直接按这些端重新部署。只有字段缺失或为空,才回落到探测。用户明确要求增删目标端时,用 AskUserQuestion 在现有值基础上改,改完的值写回 sentinel。 2. 检查是否有书名目录(包含 `追踪/` 子目录的目录,或用户自定义结构) - 有 → 识别为长篇项目,显示当前项目信息 - 无 → 识别为新项目或短篇项目 3. 检查 `.claude/settings.local.json` 是否存在 - 存在 → 读取现有配置,后续合并 - 不存在 → 后续创建新文件 4. 检查 `.active-book` 文件是否存在 - 存在 → 显示当前活跃书目 - 不存在 → 跳过 5. 检查 `opencode.json` 或 `.opencode/` 是否存在 - 存在 → 识别为 opencode 项目,`target_cli = opencode` - 不存在 → 跳过 6. 检查 `.codex/`、`.codex/config.toml`、`.codex/agents/`、`.codex/hooks.json`、`AGENTS.md` 中的 Codex 段 - 存在 → 识别为 Codex 项目,`target_cli = codex` - 不存在 → 跳过 7. 检查 `.agents/hooks.json`、`.agents/agents/`,或 `.agents/rules/oh-story.md` 中的 Antigravity 标记 - 存在 → 识别为 Google Antigravity 项目,`target_cli = antigravity` - 不存在 → 跳过 8. 检查 `.zcode/`、`.zcode/config.json`、`zcode.json`、`.zcode/skills/`、`.zcode/commands/`、`AGENTS.md` 中的 ZCode 段 - 存在 → 识别为 ZCode 项目,`target_cli = zcode` - 不存在 → 跳过 9. 检查 `openclaw.json`、`.openclaw/`,或 `AGENTS.md` 中的 OpenClaw 段(标题行含 `网文写作工具集(OpenClaw)`) - 存在 → 识别为 OpenClaw 项目,`target_cli = openclaw` - 不存在 → 跳过 10. 检查 `.reasonix/`、`reasonix-plugin.json`、`REASONIX.md`,或 `AGENTS.md` 中的 Reasonix 段(标题行含 `网文写作工具集(Reasonix)`) - 存在 → 识别为 Reasonix 项目,`target_cli = reasonix` - 不存在 → 跳过 11. 检查 `AGENTS.md` 中的通用段(标题行含 `网文写作工具集(通用 Agent / Web AI)`) - 存在 → 识别为通用 Web AI 项目,`target_cli = generic` - 不存在 → 跳过 > 第 9-11 步只认各端**互斥**的标记。`skills/*/SKILL.md` 的 `metadata.openclaw` 不作 OpenClaw 信号:13 个 skill 全都带这个字段,而 OpenClaw / Reasonix / generic 三条 skills-only 路径部署出的 `skills/` 长得一样,用它判定会把后两者一律误认成 OpenClaw。`.agents/skills/` 由 Antigravity、Codex 与 Reasonix 共用,也不单独作准;Antigravity 必须由 hooks/agents/rule 专属标记识别。后三端真正的分辨点是各自 `AGENTS.md` 模板的标题行。 12. 如 `.claude/` 或 `CLAUDE.md`、OpenCode、Codex、Antigravity、ZCode、OpenClaw、Reasonix、generic 标记同时存在 → 使用 AskUserQuestion 让用户选择目标环境(选项:Claude Code / OpenCode / Codex / Google Antigravity / ZCode / OpenClaw / Reasonix / 通用 Web AI 或其他 Agent / 任意组合) 13. 如八类标记都不存在(全新项目)→ 使用 AskUserQuestion 让用户选择目标环境 - 用户选择 opencode → `target_cli = opencode`,部署时创建 `opencode.json` 和 `.opencode/` - 用户选择 claude-code → 按现有逻辑处理 - 用户选择 codex → `target_cli = codex`,部署时创建 `.codex/` - 用户选择 antigravity → `target_cli = antigravity`,部署时创建 `.agents/skills`、`.agents/agents`、`.agents/rules`、`.agents/hooks` 并合并 `.agents/hooks.json` - 用户选择 zcode → `target_cli = zcode`,部署时创建 `.zcode/`、合并根 `AGENTS.md`,不创建项目 custom agents - 用户选择 openclaw → `target_cli = openclaw`,部署时复制 OpenClaw 兼容 skills 到项目 `skills/` - 用户选择 reasonix → `target_cli = reasonix`,部署时复制 skills 到项目 `skills/`、写入 Reasonix 版 `AGENTS.md`,不创建项目 custom agents/hooks - 用户选择通用 Web AI / 其他 Agent → `target_cli = generic`,部署通用 `AGENTS.md` 与项目本地 `skills/`;不写平台专属 hooks/agents - 用户选择多端 → `target_cli = claude-code,opencode,codex,antigravity,zcode,openclaw,reasonix,generic` 的子集(仅包含用户选择的端) ## Phase 2:部署基础设施 使用 AskUserQuestion 确认部署位置后,依次执行。 整个 Phase 2 幂等:目录复制、文件写入和下表各合并算法重复执行结果一致。因环境原因(工具不可用、权限被拒、网络失败)中途失败时,直接从头重跑本 Phase,不需要先清理半成品;`create only if absent` 的用户状态文件(见下表 Owner class)不会被二次覆盖。 **两列基准目录不同**:`Source path` 相对正在执行的这份 skill 包,`Target path` 相对用户项目根。执行每一行(以及下面各端部署算法里的每个递归复制步骤)之前,先把通配符具体化为单个源/目标,再用本 `SKILL.md` 同级的 `scripts/copy-path-safety.py` 检查。该脚本按 `Path.resolve` / `realpath` 语义跟随已有 symlink,并在两侧都存在时用 `samefile` 核对文件系统对象;**只转绝对路径或比较字符串不算检查完成**。读取其 JSON:`status: same` 时 no-op,禁止复制;仅 `copy_allowed: true` 时可以复制;`source_missing`、`unsafe_target_within_source` 或 `filesystem_identity_error` 必须停止该步骤并报告。无法运行脚本时只能用当前环境的文件系统 API 做完全相同的 canonical realpath、same-object 与 target-descendant 检查;无法确认就停止,不得尝试复制。OpenClaw / Reasonix / generic 的项目副本是整份 skill 拷贝,重跑时执行的就是项目里那份;Reasonix / Codex 还可能经 `.agents/skills → ../skills` symlink 加载,路径文本不同也可能指向同一目录,照字面复制会把目录嵌进自身并撑满磁盘。 **部署前清理自嵌套残留**:`{.claude,.codex,.zcode}/skills/story-setup/references/agent-references/` 与项目根 `skills/story-setup/references/agent-references/` 里若多出 `agent-references/` 层(可能嵌了多层),以及 `skills/story-setup/skills/`,整段删掉再部署,并在安装报告里列出删掉的路径。 ### Step 1:部署清单(机械可检查) | Source path | Target path | Owner class | Merge mode | Validation check | |-------------|-------------|-------------|------------|------------------| | `skills/story-setup/references/templates/CLAUDE.md.tmpl` | `CLAUDE.md` | user+managed | marker/section merge | contains story skill routing sections | | `skills/story-setup/references/templates/hooks/` | `.claude/hooks/` | story-setup managed | recursive replace | `session-*.sh`, `detect-story-gaps.sh`, `validate-story-commit.sh`, `guard-outline-before-prose.sh`, `check-prose-after-write.sh`, `story_hook_core.js`, `story_hook_cli.js`, `lib/common.sh`, `lib/sentinel.sh` exist;`story_hook_core.js` 与 OpenCode/ZCode 副本字节一致 | | `skills/story-setup/references/templates/rules/*.md` | `.claude/rules/*.md` | story-setup managed | replace | every rule contains `paths` frontmatter | | `skills/story-setup/references/templates/agents/*.md` | `.claude/agents/*.md` | story-setup managed | replace | 7 agent files exist | | `skills/story-setup/references/agent-references/*.md` | `.claude/skills/story-setup/references/agent-references/*.md` | story-setup managed | replace | every `story-setup/references/agent-references/*.md` reference resolves | | `skills/story-setup/references/templates/settings-hooks.json` | `.claude/settings.local.json` | user+managed | replace managed registrations by stable hook identity | hook JSON valid;旧 matcher 注册已迁移、当前模板命令各一份、用户 hook 保留 | | `skills/story-setup/scripts/merge-claude-settings.py` | 部署时执行,不复制到项目 | story-setup helper | execute | 替换已知 story hook 注册、保留用户 hooks/顶层字段,v24→v25 迁移与重复执行幂等 | | `skills/story-setup/scripts/copy-path-safety.py` | 每个递归复制步骤前执行,不复制到项目专用目录 | story-setup helper | execute | JSON 仅 `copy_allowed: true` 时允许复制;symlink 同对象 no-op;target 位于 source 内时停止 | | generated sentinel | `.story-deployed` | story-setup managed | replace | contains `agents_version`, `setup_skill_version`, `target_cli`, `resolver_strategy`, `references_dir` | | `skills/story-setup/references/opencode/AGENTS.md.tmpl` | `AGENTS.md` | user+managed | marker/section merge | contains story skill routing sections | target_cli 含 opencode | | `skills/story-setup/references/opencode/agents/` | `.opencode/agents/` | story-setup managed | replace | 7 agent files exist(replace 前按「配置 OpenCode Agent 模型」中的「保留已有模型配置」缓存现有 `model:`,避免覆盖用户已配模型) | target_cli 含 opencode | | `skills/story-setup/references/opencode/plugin.ts` | `.opencode/plugins/story-hooks.ts` | story-setup managed | replace | TypeScript plugin file exists | target_cli 含 opencode | | `skills/story-setup/references/opencode/story_hook_core.js` | `.opencode/plugins/lib/story_hook_core.js` | story-setup managed | replace | Node syntax valid;与 ZCode 副本字节一致;被 story-hooks.ts import | target_cli 含 opencode | | `skills/story-setup/references/opencode/commands/` | `.opencode/commands/` | story-setup managed | replace | 13 command files exist | target_cli 含 opencode | | `skills/story-setup/references/opencode/opencode.json.patch` | merge into `opencode.json` | user+managed | merge by plugin/permission key | plugin entry registered | target_cli 含 opencode | | repository `skills/story-setup/references/agent-references/` | `skills/story-setup/references/agent-references/` | story-setup managed | replace | every reference resolves | target_cli 含 opencode | | `skills/story-setup/references/opencode/pre-commit.sh` | `.git/hooks/pre-commit` | user+managed | append or create | file exists and is executable;含 marker 块则替换块内容,不含则检测 exit 0 位置智能插入 | target_cli 含 opencode | | `skills/story-setup/references/codex/AGENTS.md.tmpl` | `AGENTS.md` | user+managed | marker/section merge | contains Codex story skill routing sections | target_cli 含 codex | | `skills/story-setup/references/codex/agents/` | `.codex/agents/` | story-setup managed | replace | 7 TOML agent files parse and contain `name`/`description`/`developer_instructions` | target_cli 含 codex | | `skills/story-setup/references/codex/hooks/hooks.json` | `.codex/hooks.json` | user+managed | replace managed registrations by stable hook identity | hook JSON valid; all stale direct/launcher registrations removed, current 6 registrations present exactly once | target_cli 含 codex | | `skills/story-setup/references/codex/hooks/{story_codex_hook.py,run-story-hook.sh,run-story-hook.cmd}` | `.codex/hooks/` 同名文件 | story-setup managed | replace | Python/shell/cmd launcher 文件齐全 | target_cli 含 codex | | `skills/story-setup/scripts/merge-codex-hooks.py` | 部署时执行,不复制到项目 | story-setup helper | execute | 替换已知管理注册、保留用户 hooks 与未知顶层字段,结果幂等 | target_cli 含 codex | | `skills/story-setup/references/agent-references/` | `.codex/skills/story-setup/references/agent-references/` | story-setup managed | replace | every reference resolves | target_cli 含 codex | | current package skill root + `scripts/deploy-antigravity-skills.py` | `.agents/skills/{browser-cdp,story*}/` | story-setup managed for 13 known skill names | atomically replace known dirs; preserve unknown skills; never write through symlink | 13 real skill directories with valid `SKILL.md` exist | target_cli 含 antigravity | | `skills/story-setup/scripts/generate-antigravity-agents.mjs` + Claude agent sources | `.agents/agents/agent-name/agent.md`(`agent-name` 为实际名称) | story-setup managed for 7 known agent definitions | generate then atomically replace known definitions; preserve unknown user agents | 7 Markdown agents parse; exact Antigravity tool names; `mainAgent: false`, `subagent: true` | target_cli 含 antigravity | | `skills/story-setup/references/antigravity/rules/oh-story.md` | `.agents/rules/oh-story.md` | story-setup managed | replace | `trigger: always_on`; under 12,000 characters | target_cli 含 antigravity | | `skills/story-setup/references/antigravity/hooks/hooks.json` | `.agents/hooks.json` | user+managed | replace only top-level `oh-story` group | valid Antigravity named-group schema; user groups preserved; idempotent | target_cli 含 antigravity | | `skills/story-setup/references/antigravity/hooks/{story_antigravity_hook.js,story_hook_core.js}` | `.agents/hooks/` same names | story-setup managed | replace | Node syntax valid; core byte-identical to shared source; hook contract tests pass | target_cli 含 antigravity | | `skills/story-setup/scripts/merge-antigravity-hooks.py` | deployment helper only | story-setup helper | execute | atomically replaces only `oh-story`, preserves user groups, idempotent | target_cli 含 antigravity | | `skills/story-setup/references/zcode/AGENTS.md.tmpl` | `AGENTS.md` | user+managed | marker/section merge | contains ZCode `$story-*` routing and solo fallback | target_cli 含 zcode | | repository `skills/{browser-cdp,story*}/` | `.zcode/skills/{browser-cdp,story*}/` | story-setup managed for known skill names | replace known skill dirs only | 13 `SKILL.md` files exist and satisfy ZCode frontmatter limits | target_cli 含 zcode | | `skills/story-setup/references/zcode/commands/` | `.zcode/commands/` | story-setup managed for known command names | replace known command files only | 13 commands have valid names/frontmatter | target_cli 含 zcode | | `skills/story-setup/references/zcode/hooks/story_zcode_hook.js` | `.zcode/hooks/story_zcode_hook.js` | story-setup managed | replace | Node syntax valid; hook contract tests pass | target_cli 含 zcode | | `skills/story-setup/references/zcode/hooks/story_hook_core.js` | `.zcode/hooks/story_hook_core.js` | story-setup managed | replace | Node syntax valid; hook contract tests pass | target_cli 含 zcode | | `skills/story-setup/references/zcode/config.json.patch` | merge into `.zcode/config.json` | user+managed | merge by event+matcher+process args | JSON valid; 按「ZCode 部署算法」第 4 步 hooks 互斥分支校验——未装 oh-story 插件时 `hooks.enabled=true`、only supported events;已装插件时校验 `.zcode/config.json` 不含(或已移除)这批 oh-story hooks 注册 | target_cli 含 zcode | | `skills/story-setup/references/openclaw/AGENTS.md.tmpl` | `AGENTS.md` | user+managed | marker/section merge | contains OpenClaw story skill routing sections | target_cli 含 openclaw | | `skills/story-setup/references/generic/AGENTS.md.tmpl` | `AGENTS.md` | user+managed | marker/section merge | contains generic story skill routing sections | target_cli 含 generic | | `skills/story-setup/references/reasonix/AGENTS.md.tmpl` | `AGENTS.md` | user+managed | marker/section merge | contains Reasonix story skill routing sections and solo/direct fallback | target_cli 含 reasonix | | repository `skills/{browser-cdp,story*}/` | `skills/{browser-cdp,story*}/` | story-setup managed for known skill names | replace known skill dirs only | 13 `SKILL.md` files exist; OpenClaw-compatible frontmatter | target_cli 含 openclaw 或 generic 或 reasonix | | repository `skills/story-setup/references/agent-references/` | 随上一行整份 skill 拷贝落地,本行 no-op | story-setup managed | 不单独复制 | every reference resolves | target_cli 含 openclaw 或 generic 或 reasonix | ### opencode.json 合并算法 部署 `opencode.json.patch` 时按以下规则合并: 1. 读取现有 `opencode.json`(如存在),解析 JSON 2. 合并 `plugin` 数组:将 `./.opencode/plugins/story-hooks.ts` 加入数组,去重
View on GitHub
This SKILL.md is very large, so SkillsMP previews the first section here. View on GitHub