{"_rev":"4-f4bdbbd05b94f5261e5424dad05a8e0f","time":{"created":"2026-06-18T03:46:17.398Z","modified":"2026-06-18T03:46:17.991Z","0.1.0":"2026-06-18T01:25:31.419Z","0.1.1":"2026-06-18T03:46:17.701Z"},"_id":"@daishengli1024/aicode","name":"@daishengli1024/aicode","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.1":{"name":"@daishengli1024/aicode","version":"0.1.1","description":"跨 AI 编码工具（Claude Code / codex / opencode）的开发规范管理 CLI","main":"./lib/index.js","bin":{"aicode":"bin/aicode.js"},"scripts":{"test":"node test/run.js","start":"node bin/aicode.js","lint":"echo \"lint 占位，后续接入\" && exit 0","publish:official":"node scripts/publish-official.js"},"keywords":["cli","ai","claude-code","codex","opencode","rules","standards","scaffolding"],"engines":{"node":">=18.0.0"},"author":{"name":"aicode contributors"},"license":"MIT","dependencies":{"chalk":"^4.1.2","commander":"^11.1.0","fs-extra":"^11.2.0","inquirer":"^8.2.6","js-yaml":"^4.1.0"},"devDependencies":{},"gitHead":"1718ba0457af65d1eab76aa1013d8dcabe7dd3bc","_id":"@daishengli1024/aicode@0.1.1","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-XBLzxig7UaBr7Vm02dd6pRRvSfMlO2iQVb7O0mCGm/RSkKrJ1epFyArLv9+nDVGIGz4u0DQuAp+z1spahgdrLQ==","shasum":"01d9e54fabd394f2f99c059ba10b5f36efe6fbc5","tarball":"https://registry.npmjs.org/@daishengli1024/aicode/-/aicode-0.1.1.tgz","fileCount":37,"unpackedSize":111377,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDvz+qcjRQ2Aca4O/Khgu2JLmuRFqgr1J+fDUBk8ZsmKAIgUe+ryTWnfxOG5zVEAeesGWBmXvjSRoSjJi6vznkCobE="}]},"_npmUser":{"name":"daishengli1024","email":"daishengli1024@outlook.com"},"directories":{},"maintainers":[{"name":"daishengli1024","email":"daishengli1024@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/aicode_0.1.1_1781754377553_0.6853275134529933"},"_hasShrinkwrap":false}},"maintainers":[{"name":"daishengli1024","email":"daishengli1024@outlook.com"}],"description":"跨 AI 编码工具（Claude Code / codex / opencode）的开发规范管理 CLI","keywords":["cli","ai","claude-code","codex","opencode","rules","standards","scaffolding"],"author":{"name":"aicode contributors"},"license":"MIT","readme":"# aicode\n\n> 跨 AI 编码工具（Claude Code / codex / opencode）的规则管理 + 文档生成 CLI\n\n[![CI](https://github.com/daishengli/aicode/actions/workflows/ci.yml/badge.svg)](https://github.com/daishengli/aicode/actions/workflows/ci.yml)\n[![npm version](https://img.shields.io/npm/v/%40daishengli1024%2Faicode.svg)](https://www.npmjs.com/package/@daishengli1024/aicode)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Node >= 18](https://img.shields.io/badge/Node-%3E%3D18-brightgreen.svg)](https://nodejs.org)\n\n## 这是什么\n\n`aicode` 是一个 Node.js CLI 工具，做两件事：\n\n1. **规则管理**：把项目规范（数据库设计、接口设计、代码风格、字典枚举）集中存放在项目级 `.aicode/rules/`\n2. **文档生成**：根据规则自动生成需求文档、设计文档、SQL（MySQL/PostgreSQL）、OpenAPI 规范\n\n**核心设计**：规则 = 唯一的真相源。改一处规则，所有生成（SQL、OpenAPI、设计文档）都跟着改。\n\n## ✨ 核心特性\n\n- 📋 **规则集中管理**：`.aicode/rules/*.md`（Markdown + YAML frontmatter）\n- 🔄 **跨 AI 工具同步**：一条命令同步到 Claude Code、codex、opencode\n- 🛠 **5 阶段文档生成**：`aicode doc new` 一次产出 5 类文档\n- 🔍 **自洽性检查**：新需求与已有需求自动比对\n- 🇨🇳 **中文友好**：文件名、commit message、文档都支持中文\n- 🎯 **预置规则按项目类型**：hasBackend/hasDatabase 决定预置哪些规则\n\n## 📦 安装\n\n```bash\nnpm install -g @daishengli1024/aicode\n```\n\n要求 Node.js >= 18。\n\n## 🚀 快速开始\n\n```bash\n# 1. 在项目根目录初始化（询问 hasBackend / hasDatabase）\ncd my-project\naicode init\n\n# 2. 同步规则到所有 AI 工具\naicode sync\n# → 生成 CLAUDE.md（Claude Code 读取）\n# → 生成 AGENTS.md（codex / opencode 读取）\n\n# 3. 新建需求文档（5 阶段流程）\naicode doc new 订单管理\n# Stage 1: 多轮交互收集需求\n# Stage 2: 自洽性检查\n# Stage 3: 生成需求文档\n# Stage 4: 生成设计文档（功能/接口/数据库/字典）\n# Stage 5: 顺便生成 SQL + OpenAPI\n\n# 4. 环境检查\naicode doctor\n```\n\n## 📖 命令一览\n\n| 命令 | 说明 |\n|---|---|\n| `aicode init` | 初始化 `.aicode/`，询问项目类型 |\n| `aicode rule list` | 查看所有规则 |\n| `aicode rule add` | 新增规则（交互式） |\n| `aicode rule edit <name>` | 编辑规则 |\n| `aicode rule enable <name>` | 启用规则 |\n| `aicode rule disable <name>` | 禁用规则 |\n| `aicode rule remove <name>` | 删除规则 |\n| `aicode doc new <需求>` | 5 阶段一体化生成 |\n| `aicode sync` | 编译规则并同步到 AI 工具 |\n| `aicode doctor` | 环境检查 |\n\n## 🎯 预置规则（按项目类型自动选）\n\n| 规则 | 含结构化 frontmatter | 适用 |\n|---|---|---|\n| `db-design.md` | `sqlRules` | 有数据库项目 |\n| `api-design.md` | `apiRules` | 有服务端项目 |\n| `feature-design.md` | `featureRules` | 无服务端项目（CLI / 库） |\n| `dictionary-design.md` | `dictionaryRules` | 总是需要 |\n| `code-style.md` | 纯说明 | 总是需要 |\n\n## 🔄 规则的双重身份\n\n**作为开发规范**：规则 body 是给 AI 读的说明文档（\"为什么这么做\"）\n\n**作为生成约束**：规则 frontmatter 是给 aicode 读的结构化字段（\"怎么生成 SQL/OpenAPI\"）\n\n```markdown\n---\nname: db-design\nsqlRules:           # ← 机器读\n  systemFields: [...]\n  foreignKey: false\n  charset: utf8mb4\n---\n\n# 数据库设计规范   # ← AI 读\n- 不使用外键约束\n- ...\n```\n\n## 📚 文档\n\n- [需求文档](docs/REQUIREMENTS.md) — aicode 自身的功能需求\n- [接口规范](docs/API.md) — CLI 命令详细规范\n\n## 🧪 开发\n\n```bash\ngit clone https://github.com/daishengli/aicode.git\ncd aicode\npnpm install\npnpm test\nnode bin/aicode.js --version\n```\n\n## 🤝 贡献\n\n欢迎 PR！详见 [CONTRIBUTING.md](CONTRIBUTING.md)。\n\n## 📄 许可证\n\nMIT © aicode contributors\n","readmeFilename":"README.md"}