yuelinghuashu/story-cli
📚 story-cli
제로 배포, Git 네이티브 Markdown 콘텐츠 관리 CLI. 간단한 디렉터리 규칙으로 스토리/논문/노트/튜토리얼을 관리하고, README를 자동 생성하며, EPUB을 내보내고, 중영 이중 언어를 지원합니다.
✨ 기능
간단한 디렉터리 규칙 — 콘텐츠는 폴더입니다:
NN-이름/에config.json+text.md포함README 자동 생성 — 각 항목과 루트 인덱스가 자동 생성됩니다 (템플릿 기반, 사용자 정의 가능)
시리즈 그룹 정렬 —
series/seriesOrder로 표시 순서를 제어하며, 임의 삽입 시 재정렬 불필요런타임 검증 — 빌드 전에 구성 검사 (필수 필드, 열거형, 형식)
규정 준수 검사 —
story validate가 Story-Repo 규격에 따라 검증 (디렉터리 이름 / UTF-8 / 중복 번호 / schema)연관 스토리 —
story link로 약한 연관 관리;story build가 같은 시리즈 후보 연관 자동 제안이중 언어 지원 — 중영 콘텐츠 + 현지화된 README 자동 생성
챕터 + 단어 수 — 챕터 제목과 언어 인식 단어 수 자동 추출
다중 형식 내보내기 — EPUB (표지 렌더링/레이아웃 스타일/시리즈 메타데이터) / HTML / TXT / JSON / Markdown / embeddings,
--stdout파이프 지원범용 콘텐츠 플랫폼 — 지식 베이스 모드 (논문/인터뷰/노트), 기술 문서 모드 (튜토리얼/API)
MCP Server — AI 클라이언트 (Claude / Cursor) 가 콘텐츠 라이브러리를 직접 읽고 쓸 수 있음
GitHub Action — 제로 구성 CI 진입점 (
yuelinghuashu/story-cli@v1), 원클릭으로 「Push → Build → 배포」 구현Watch 모드 — 파일 변경 시 자동 재빌드
Related MCP server: Workfile
🚀 빠른 시작
# 安装(需要 Node.js >= 22)
npm install -g @yuelinghuashu/story-cli
# 创建示例仓库并查看效果
story demo
# 初始化仓库
story init
# 创建内容并编写
story new "我的新故事"
# 构建所有 README
story build
# 导出 EPUB / 统计
story epub --all
story statsmake init # 初始化
make new TITLE="我的故事" # 新建并自动构建
make commit # 构建 + 提交
make push # 构建 + 提交 + 推送
make stats # 查看创作统计
make analyze # 写作质量分析(重复短语 / 字数过期 / 章节趋势,需 jq)
Windows 사용자는 story init 으로 생성된 story.ps1 (PowerShell 버전 워크플로우) 도 사용할 수 있습니다: .\story.ps1 init / .\story.ps1 new -Title '我的故事' / .\story.ps1 build.
🌱 이야기 그 이상
범용 콘텐츠 관리 — '정규화'할 수 있는 모든 텍스트 자산은 동일한 워크플로우를 사용할 수 있습니다:
템플릿 모드 | 콘텐츠 유형 | 대표 시나리오 |
| 소설 / 스토리 | 오리지널, 2차 창작 |
| 논문 / 인터뷰 / 블로그 / 노트 | 지식 베이스, 연구 라이브러리 |
| 튜토리얼 / API 문서 / 변경 로그 | 기술 블로그, 프로젝트 문서 |
story init --template=knowledge
story init --template=tech🤖 AI가 콘텐츠 라이브러리를 관리하게 하세요
story-cli에는 MCP Server 가 내장되어 있습니다. AI 클라이언트 (Claude Desktop / Cursor / VSCode Copilot Chat) 가 콘텐츠 라이브러리를 직접 읽고 쓸 수 있습니다. AI는 '생성 → 작성 → 빌드 → 통계'의 완전한 루프를 독립적으로 수행할 수 있으며, 터미널에서 수동으로 명령을 실행할 필요가 없습니다.
💡 토큰 경제성: MCP 도구는 설계 초기부터 AI 호출 비용 절감을 핵심 원칙으로 삼았습니다.
scan_stories는 기본적으로 간결한 출력 (디렉터리 탐색 시 ~80-95% 절약),read_chapter는 필요에 따라 잘라내기 지원 (이어쓰기 시나리오에서 ~95%+ 절약),stats는 한 번의 호출로 모든 데이터 확보 (~99%) — 모든 세부 사항이 AI 워크플로우의 토큰 소비를 줄입니다.
기능 | MCP 도구 | 설명 |
📖 탐색 |
| 스토리 라이브러리 나열, 챕터 읽기 (필요에 따라 로드 및 끝부분 잘라내기 지원, 토큰 절약) |
✍️ 작성 |
| 새 스토리 생성, 본문 원자적 쓰기 (선택적 쓰기 후 규정 준수 검사) |
✅ 관리 |
| 메타데이터 필드 직접 수정, README 재빌드 실행, 구성 유효성 검사 |
📊 통계 |
| 총 단어 수 / 챕터 수 / 시리즈 진행률 / 건강도 확인 |
# 启动 MCP Server(需在故事仓库根目录;--root 可从任意目录指定仓库)
story mcp-server💡 자세한 구성과 예시는 docs/mcp.md 를 참조하세요. MCP Server 는 현재 작업 디렉터리의 모든 파일을 읽고 씁니다. 신뢰할 수 있는 저장소에서만 실행하세요.
🎯 미세 조정 데이터 준비 (SFT / Embedding)
스토리 라이브러리의 구조화된 출력은 대규모 언어 모델 훈련 데이터 소스로 자연스럽게 적합합니다. config.json 에는 분류 태그가 포함되어 있고, export json 은 챕터별로 정확하게 슬라이스하며, export embeddings 는 순수 텍스트 블록을 출력합니다. --stdout + Unix 도구 체인과 함께 사용하면 한 줄의 파이프로 표준 미세 조정 형식으로 변환할 수 있습니다:
# 导出为指令微调 JSONL(summary → instruction,正文 → output)
story export json --stdout | jq -c '.stories[] | {messages: [{role: "user", content: .summary}, {role: "assistant", content: .content}]}' > sft_data.jsonl
# 导出为 Embedding 训练格式
story export embeddings --stdout | jq -c '{text: .content, metadata: {title: .title, series: .series}}' > embedding_data.jsonl
# 快速分析数据配比(总字数/章节分布/重复短语)
story stats --json | jq '{words: .totalWords, chapters: .totalChapters, repeated: .analysis.repeated}'💡 story-cli 는 UTF-8 인코딩 (GBK 자동 감지 경고), 챕터 수준 슬라이스 (의미론적 잘림 방지), 메타데이터 완전성 (type/series/summary 는 자연스럽게 분류 태그로 사용 가능) 을 보장합니다. 추가 정리 스크립트가 필요 없습니다.
🛠️ 주요 명령
명령 | 설명 |
| 저장소 초기화 (기본 스토리/지식 베이스/기술 문서 모드) |
| 새 항목 생성 |
| README 빌드 |
| EPUB 내보내기 |
| 다양한 형식 내보내기 (embeddings 는 텍스트 블록 JSONL) |
| JSON에서 일괄 가져오기 |
| 창작 통계 |
| 규정 준수 검사 (Story-Repo 규격) |
| 스토리 연관 관리 (약한 연관) |
| MCP Server 시작 (AI 연결 진입점) |
모든 명령의 별칭, 하위 명령, 매개변수, 분류 설명은 docs/commands.md (중영 이중 언어) 를 참조하세요.
사용자 정의 스토리 유형/상태 및 현지화 태그:
{
"types": ["original", "fanfic", "translation"],
"statuses": ["completed", "ongoing", "planned"],
"typeLabels": { "translation": { "zh": "翻译", "en": "Translation" } }
}내장 열거형에는 이미 태그가 내장되어 있어 중복 구성이 필요 없습니다. 파일을 삭제하면 기본값으로 돌아갑니다.
📚 문서
문서 | 중국어 | English | 내용 |
디자인 철학 | 프로젝트 철학 | ||
저장소 규격 | 데이터 규격 | ||
새 콘텐츠 추가 방법 | 디렉터리 규칙 | ||
콘텐츠 내보내기 | 내보내기 가이드 | ||
EPUB / PDF | EPUB 내보내기 | ||
CI | GitHub Actions | ||
MCP Server | AI 연결 가이드 | ||
아키텍처 | 모듈 설계 | ||
명령 참조 | 전체 명령 목록 | ||
변경 로그 | 변경 기록 |
⚠️ 인코딩 요구 사항
모든 파일은 UTF-8 인코딩을 사용해야 합니다. GBK/GB2312 가 감지되면 경고하지만 빌드를 차단하지는 않습니다.
🧪 테스트
make test # 或 pnpm test550개 이상의 테스트가 모두 통과했습니다. 포함: 스캐너, 시리즈 그룹화, 검증, 템플릿 렌더링, 단어 수 계산, 국제화, README 생성, EPUB 내보내기, CLI 엔드투엔드 (스모크 테스트가 모든 명령을 포함), .storyignore, MCP 프로토콜, JSON 가져오기, GitHub Action 구조, 규정 준수 검사, 연관 제안, 증분 빌드 캐시, embeddings 내보내기 등.
☕ 후원 지원
⚖️ License
🤝 기여
Issue 제출을 환영합니다 (버그 피드백 / 기능 제안, 양식 템플릿 있음). 코드 기여를 원하시면 CONTRIBUTING.md 를 읽고, ROADMAP.md 에서 프로젝트 방향을 확인하세요.
Available Tools
9 toolsbuildAIdempotent
重建所有 README(等效 story build)。返回构建结果与捕获的输出日志
Inputs: no named parameters.
create_storyA
创建一个新故事(文件夹 + config.json + text.md 草稿)
Inputs: title (required), type, series, status, +3 more.
edit_configAIdempotent
更新故事 config.json 的元数据字段。可编辑:summary/status/series/seriesOrder/volume/links/author/originalWork/originalAuthor/cover/language/wordCount。字段值传 null 表示移除该可选字段。title/type/created/isMultiChapter 为身份或审计字段,禁止修改。写入前经仓库级 schema 校验,校验失败不写盘。修改后请运行 build 更新 README
Inputs: fields (required), folder (required).
import_jsonA
从结构化 JSON 批量导入故事(与 CLI import json 同构)
Inputs: stories (required).
read_chapterARead-only
读取指定故事的章节内容(支持按章节索引按需加载)。tailLength 可只返回章节末尾 N 字符用于续写衔接,节省 Token
Inputs: folder (required), tailLength, chapterIndex.
scan_storiesARead-only
列出所有故事及元数据(标题/类型/状态/字数/系列)。默认返回精简列表节省 Token;传 verbose=true 获取完整详情
Inputs: verbose.
statsARead-only
获取故事库写作统计(总字数/章节数/系列分组/健康度/重复短语)
Inputs: no named parameters.
validateARead-only
检查仓库合规性(目录命名/必需文件/config schema/编码),等效 CLI story validate
Inputs: no named parameters.
write_chapterAIdempotent
将正文写入指定故事(原子写入 text.md)。validate=true 时写入后立即执行仓库合规检查并返回结果(不阻断写入)
Inputs: folder (required), content (required), validate.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct operation or resource: creating/importing stories, reading/writing chapters, editing config, validating, building, stats, and scanning. There is no real overlap, and the descriptions clarify boundaries even where purposes are adjacent, such as create_story vs import_json.
Most tools follow a clear verb_noun snake_case pattern (create_story, scan_stories, read_chapter, write_chapter, edit_config, import_json). validate, build, and stats are shorter imperative/noun names but are still intuitive and do not break the overall predictability.
Nine tools is well-scoped for a story authoring workflow. Each tool has a clearly defined role, and none feel redundant or unnecessary for the server's purpose.
The core authoring loop is covered: create, read/write chapters, edit metadata, validate, build, and get stats. However, there is no delete story/chapter operation and no explicit chapter listing tool, leaving lifecycle management incomplete. Agents could work around some gaps, but deletion is a notable missing capability.
Maintenance
Related MCP Connectors
Linked markdown notes as memory for AI apps: search, read, save and link notes over MCP.
Notes and memory assistant: one Markdown vault that Claude, ChatGPT and any MCP client can share.
Publish and share access-controlled Markdown documents from any MCP-enabled AI tool.
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceGit-native MCP server for managing AI context across sessions. Enables LLMs to access project and feature context via markdown files, preserving decisions and constraints.1-
- AlicenseAqualityBmaintenanceRepository-native protocol and MCP server for coordinating work items, documentation, changelogs, and project memory between humans and AI agents, using Markdown files in a Git repository as the canonical data source.304MIT
- AlicenseNot gradedqualityBmaintenanceServes a git-backed folder of Markdown notes over MCP so AI agents can search, read, write, move and delete them, with every write recorded as a git commit attributed to the calling client. Supports full-text section search with snippets, wikilinks and typed relations, LFS-backed searchable attachments, optimistic concurrency for multiple agents, and per-client token or OAuth 2.1 access.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables an AI assistant to read and write a git-versioned personal markdown knowledge base through MCP tools, with deterministic validation, lifecycle enforcement, local hybrid search, and corpus auditing.MIT