zjs105910/workbuddy-market / bundled/novel-writing-suite/skills/story-setup
story-setup
Flagged网文写作工具集基础设施部署与检查。为 Claude Code / OpenCode / Codex / Google Antigravity / ZCode / OpenClaw / Reasonix 提供内置适配;Web AI / 通用 Agent 可走 skills + AGENTS.md 文件模式。触发方式:/story-setup、$story-setup、「准备写书」「帮我搭一下环境」「配置写作项目」「检查写作环境」。
scripts/merge-antigravity-hooks.py
View on GitHub#!/usr/bin/env python3
"""Merge the managed oh-story Antigravity hook group atomically.
Antigravity's workspace hooks file is a top-level mapping of named hook groups.
story-setup owns only the ``oh-story`` key and preserves every user group.
"""
from __future__ import annotations
import argparse
import json
import os
import stat
import tempfile
from pathlib import Path
from typing import Any
class MergeError(ValueError):
pass
def load_object(path: Path, *, missing_ok: bool) -> dict[str, Any]:
if missing_ok and not path.exists():
return {}
try:
value = json.loads(path.read_text(encoding="utf-8-sig"))
except (OSError, json.JSONDecodeError) as exc:
raise MergeError(f"cannot read valid JSON object from {path}: {exc}") from exc
if not isinstance(value, dict):
raise MergeError(f"expected a JSON object in {path}")
return value
def merge(existing: dict[str, Any], template: dict[str, Any]) -> dict[str, Any]:
managed = template.get("oh-story")
if not isinstance(managed, dict):
raise MergeError("template must contain an object-valued oh-story group")
result = dict(existing)
result["oh-story"] = managed
return result
def atomic_write(path: Path, value: dict[str, Any]) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
mode = stat.S_IMODE(path.stat().st_mode) if path.exists() else 0o644
descriptor, temporary = tempfile.mkstemp(prefix=f".{path.name}.", dir=path.parent)
try:
with os.fdopen(descriptor, "w", encoding="utf-8", newline="\n") as handle:
json.dump(value, handle, ensure_ascii=False, indent=2)
handle.write("\n")
handle.flush()
os.fsync(handle.fileno())
os.chmod(temporary, mode)
os.replace(temporary, path)
finally:
try:
os.unlink(temporary)
except FileNotFoundError:
pass
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("existing", type=Path)
parser.add_argument("template", type=Path)
args = parser.parse_args()
existing = load_object(args.existing, missing_ok=True)
template = load_object(args.template, missing_ok=False)
atomic_write(args.existing, merge(existing, template))
return 0
if __name__ == "__main__":
raise SystemExit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |