moluoxixi-ai-rules 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README-en.md +321 -0
  2. package/README.md +268 -89
  3. package/dist/capabilities/coding.d.ts +7 -0
  4. package/dist/capabilities/coding.js +9 -0
  5. package/dist/capabilities/common.d.ts +7 -0
  6. package/dist/capabilities/common.js +9 -0
  7. package/dist/capabilities/engineering.d.ts +12 -0
  8. package/dist/capabilities/engineering.js +17 -0
  9. package/dist/capabilities/frontend.d.ts +19 -0
  10. package/dist/capabilities/frontend.js +25 -0
  11. package/dist/capabilities/index.d.ts +7 -0
  12. package/dist/capabilities/index.js +187 -0
  13. package/dist/capabilities/productivity.d.ts +14 -0
  14. package/dist/capabilities/productivity.js +18 -0
  15. package/dist/capabilities/types.d.ts +15 -0
  16. package/dist/capabilities/types.js +7 -0
  17. package/dist/constants/hosts.d.ts +1 -1
  18. package/dist/constants/hosts.js +78 -7
  19. package/dist/roles/matt/constants/skills.d.ts +1 -0
  20. package/dist/roles/matt/constants/skills.js +18 -28
  21. package/dist/roles/moluoxixi/constants/skills.d.ts +3 -1
  22. package/dist/roles/moluoxixi/constants/skills.js +27 -31
  23. package/dist/roles/trellis/constants/skills.d.ts +1 -0
  24. package/dist/roles/trellis/constants/skills.js +23 -39
  25. package/dist/scripts/lib/canonical-path.d.ts +9 -0
  26. package/dist/scripts/lib/canonical-path.js +65 -0
  27. package/dist/scripts/lib/install.d.ts +10 -7
  28. package/dist/scripts/lib/install.js +188 -76
  29. package/dist/scripts/lib/mcp-catalog.d.ts +7 -0
  30. package/dist/scripts/lib/mcp-catalog.js +63 -0
  31. package/dist/scripts/lib/role-packages.d.ts +34 -0
  32. package/dist/scripts/lib/role-packages.js +204 -0
  33. package/dist/scripts/lib/roles.js +2 -2
  34. package/dist/scripts/lib/tool.js +3 -3
  35. package/dist/scripts/lib/vendor-staging.js +38 -15
  36. package/dist/scripts/lib/vendors.d.ts +24 -2
  37. package/dist/scripts/lib/vendors.js +70 -0
  38. package/dist/scripts/lib/verify.d.ts +1 -1
  39. package/dist/scripts/lib/verify.js +58 -9
  40. package/dist/scripts/role-packages.d.ts +8 -0
  41. package/dist/scripts/role-packages.js +207 -0
  42. package/package.json +3 -3
  43. package/roles/matt/constants/skills.ts +22 -29
  44. package/roles/moluoxixi/constants/skills.ts +32 -32
  45. package/roles/moluoxixi/role.yaml +8 -4
  46. package/roles/trellis/constants/skills.ts +27 -40
  47. package/roles/trellis/role.yaml +8 -2
  48. package/README-zh.md +0 -151
package/README.md CHANGED
@@ -1,151 +1,330 @@
1
1
  # Moluoxixi AIRules
2
2
 
3
- AIRules installs AI skills and role assets for supported coding hosts.
3
+ 简体中文 | [English](README-en.md)
4
4
 
5
- > The npm `latest` release may lag behind the repository. The prompts below install the current version from source.
5
+ AIRules 为 AI 编程宿主分发带版本的角色能力。一个 role 不只是“一组提示词”,而是由共享 skills、MCP servers、角色 CLI、项目工作流、agents、hooks 和运行时资产组成的可安装组合。
6
6
 
7
- ## Install From Source
7
+ 先区分两个安装层级:
8
8
 
9
- Run this once to install the current Moluoxixi role and expose the `airules` command:
9
+ - `airules install <role>` 安装用户级资产:拉取固定版本的 vendor、组合 capabilities、把 skills 投影到 `~/.agents/skills`、合并宿主 MCP 配置,并安装角色声明的 CLI package。
10
+ - `init-project` 安装项目级资产:调用角色原生 CLI,在当前仓库生成 `.moluoxixi/` 或 `.trellis/`,再补装 AIRules 的知识库和中文兼容扩展。
11
+
12
+ AIRules 安装器负责用户级 package setup、资产分发和受管 skills/MCP 校验,但不调度 agents。agents 的派发权属于初始化后的 Moluoxixi/Trellis 主工作流,hooks 负责注入状态和上下文,skills 才负责语义分析与文件修改。
13
+
14
+ ## `moluoxixi`
15
+
16
+ 适合希望获得完整 AI 开发流程,同时需要 Moluoxixi 原生 CLI、项目知识库、多领域 skills 和可控多 agent 调度的用户。
17
+
18
+ ### 安装
10
19
 
11
20
  ```bash
12
- git clone https://github.com/moluoxixi/AIRules.git
13
- cd AIRules
14
- npm install
15
- npm run build
16
- npm link
21
+ npm install --global moluoxixi-ai-rules
17
22
  airules install moluoxixi --host all
23
+ airules verify moluoxixi --host all
18
24
  ```
19
25
 
20
- Replace `moluoxixi` with `trellis` or `matt` to install another role. Later updates only require `airules install <role> --host all`; a clean source checkout is fast-forwarded before the role is installed and verified.
26
+ `airules install moluoxixi` 会自动安装 Moluoxixi core 和全局 CLI,可用两个命令名:
21
27
 
22
- ## Moluoxixi Role
28
+ ```bash
29
+ moluoxixi --version
30
+ ml --version
31
+ ```
23
32
 
24
- The Moluoxixi role installs the `init-project` skill, CodeGraph, the related MCP configuration, and Matt Pocock's productivity skills.
33
+ 只有在不安装完整 role、或需要单独修复 CLI 时,才需要直接安装角色包:
25
34
 
26
- ### Install with AI
35
+ ```bash
36
+ npm install --global @moluoxixi/airules-moluoxixi-cli
37
+ ```
27
38
 
28
- Copy this prompt into your AI coding assistant:
39
+ ### 功能
40
+
41
+ #### 安装后的资产
42
+
43
+ | 层级 | 资产 | 作用 |
44
+ | --- | --- | --- |
45
+ | 用户级角色资产 | Moluoxixi core、`moluoxixi`/`ml` CLI、`init-project` | 提供原生项目初始化、更新、任务、memory、workflow 和 channel 命令 |
46
+ | 公共 capability | `common`、`coding`、`productivity`、`frontend` | 组合共享 skills、外部固定版本 skills 和 MCP servers |
47
+ | 原生项目资产 | `.moluoxixi/workflow.md`、`tasks/`、`spec/`、`scripts/`、`agents/`、宿主配置 | 保存工作流状态、任务工件、项目规范和 agent 定义 |
48
+ | AIRules 项目扩展 | `.moluoxixi/knowledge/`、知识 runtime、宿主 knowledge hook、`moluoxixi-knowledge` | 检测 source 变化,维护可追踪的项目知识库 |
49
+
50
+ 共享 skills 以 `~/.agents/skills` 为 canonical 目录。能够直接发现该目录的宿主不会再复制一份;需要私有 skill 目录的宿主由 AIRules 建立受管投影。
51
+
52
+ #### Skills
53
+
54
+ 项目工作流入口会按宿主能力生成为 slash command 或可发现 skill;下表使用统一的逻辑名称。
55
+
56
+ | 来源 | Skill | 做什么 |
57
+ | --- | --- | --- |
58
+ | 角色入口 | `init-project` | 调用已安装的 Moluoxixi CLI 初始化当前项目,再安装知识库、宿主 hooks 和中文任务约定 |
59
+ | 项目工作流 | `moluoxixi-start` | 读取开发者、Git、当前任务和项目规范,判断新需求应直接修改还是进入任务流程 |
60
+ | 项目工作流 | `moluoxixi-brainstorm` | 在实现前澄清需求、取舍和 MVP,形成 PRD、设计与实施计划 |
61
+ | 项目工作流 | `moluoxixi-before-dev` | 开发前读取当前任务工件和相关 `.moluoxixi/spec/` 规范 |
62
+ | 项目工作流 | `moluoxixi-continue` | 根据任务 phase index 恢复未完成工作,定位下一步 |
63
+ | 项目工作流 | `moluoxixi-check` | 检查 spec 一致性、lint、类型、测试、跨层数据流和改动范围 |
64
+ | 项目工作流 | `moluoxixi-break-loop` | 在修复反复出现的 bug 后分析根因,并形成防复发机制 |
65
+ | 项目工作流 | `moluoxixi-update-spec` | 把调试、实现和讨论中确认的可执行契约写入项目 spec |
66
+ | 项目工作流 | `moluoxixi-finish-work` | 核对质量门禁、提醒提交、归档任务并记录开发日志 |
67
+ | 项目工作流 | `moluoxixi-channel` | 通过 `moluoxixi channel` 启动、观察和协调实时多 agent worker |
68
+ | 项目工作流 | `moluoxixi-session-insight` | 通过 `moluoxixi mem` 检索过去会话中的决定和解决方案 |
69
+ | 项目工作流 | `moluoxixi-spec-bootstrap` | 从真实代码建立或刷新项目专属 coding specs |
70
+ | 项目工作流 | `moluoxixi-meta` | 理解和定制 `.moluoxixi/`、宿主 hooks、agents、skills 与 workflow 模板 |
71
+ | 知识扩展 | `moluoxixi-knowledge` | 把 `knowledge/sources/` 整理为 library 页面,更新 `index.md` 和 `relations.json`,通过一致性门禁后确认批次 |
72
+ | `common` | `create-skill` | 创建或修订可复用的 agent skill |
73
+ | `common` | `spec-organization` | 重组 spec 目录、命名、索引和链接 |
74
+ | `frontend` | `frontend-design` | 为新 UI 或现有界面重塑提供有明确审美方向的设计指导 |
75
+ | `productivity` | `grill-me` | 启动严格访谈,把模糊想法推进到可执行方案 |
76
+ | `productivity` | `grilling` | 压力测试计划、决策或设计中的薄弱假设 |
77
+ | `productivity` | `handoff` | 把当前对话压缩为下一位 agent 可接手的交接文档 |
78
+ | `productivity` | `teach` | 在当前仓库中进行可跨会话记录状态的教学 |
79
+ | `productivity` | `to-questionnaire` | 把 agent 无法独立回答的决策转成给知情人的问卷 |
80
+ | `productivity` | `wait-what` | 用更直接的技术英语重新解释未被理解的内容 |
81
+ | `productivity` | `writing-for-agents` | 编写供 agent 消费的 skills、`AGENTS.md` 和 `CLAUDE.md` |
82
+
83
+ `coding` capability 安装 CodeGraph、Context7、Sequential Thinking MCP;`frontend` capability 安装 Playwright MCP。前者分别用于代码关系探索、库文档查询和结构化推理,后者用于浏览器检查与自动化。
84
+
85
+ #### Agents、hooks 与调度
86
+
87
+ | Agent | 职责 | 写入边界 |
88
+ | --- | --- | --- |
89
+ | `moluoxixi-research` | 跨文件研究代码、规范和方案,为计划提供证据 | 只写当前任务的 `research/`,其余只读 |
90
+ | `moluoxixi-implement` | 按 PRD/design/implement 实现并运行 lint、typecheck、tests | 修改实现,不提交,不递归派发 agent |
91
+ | `moluoxixi-check` | 独立审查 diff、spec、测试和范围;可修复机械问题 | 修改检查范围内文件,不提交,不递归派发 agent |
92
+
93
+ 主会话拥有唯一派发权。自动调度时,研究型问题可先派 `research`,进入执行阶段后按 `implement -> check -> update-spec -> commit -> finish-work` 收敛;`dispatch_mode: inline` 时,主会话直接执行 `before-dev -> edit -> check`。`moluoxixi channel spawn --agent <name>` 会加载 `.moluoxixi/agents/` 中的定义,supervisor 通过事件日志连接 worker 与主会话。
94
+
95
+ hooks 不替代 skills:
29
96
 
30
97
  ```text
31
- Install the Moluoxixi role from AIRules on this machine.
32
-
33
- 1. Check that Node.js 22 or newer, npm, and Git are available.
34
- 2. Resolve my user home directory and clone https://github.com/moluoxixi/AIRules.git to `<user-home>/AIRules`. Do not clone it into a project or into `<user-home>/.moluoxixi`.
35
- 3. Enter `<user-home>/AIRules`.
36
- 4. Run `npm install`, `npm run build`, and `npm link`.
37
- 5. Run `airules --version` and confirm that version 0.2.0 or newer is installed.
38
- 6. Before installing, tell me that AIRules will first fast-forward its clean Git checkout with `git pull --ff-only`, then write the Moluoxixi assets and Matt Pocock productivity skills to `<user-home>/.moluoxixi`, `<user-home>/.agents/skills`, and supported AI host configuration directories. The install command is user-level and does not need to run inside a project.
39
- 7. After I confirm, run `airules install moluoxixi --host all`.
40
- 8. The install command verifies the result automatically. Report the installed version, updated hosts, written directories, and any errors.
41
-
42
- Do not use sudo. Do not pass `--skip-vendors` or `--no-verify`. Do not delete or overwrite files that are not managed by AIRules.
98
+ UserPrompt/SessionStart
99
+ -> workflow-state hook 读取活动任务和 workflow.md
100
+ -> knowledge-hook.py 调用 common/knowledge.py 读取 index + status
101
+ -> 将当前 phase、任务、受影响知识资产注入主会话
102
+ -> 主会话按需调用 workflow/knowledge skill
103
+
104
+ SubagentStart
105
+ -> subagent-context hook 识别 research/implement/check
106
+ -> 注入任务 JSONL、PRD、design、implement 和相关 spec
43
107
  ```
44
108
 
45
- ### Usage
109
+ 知识 Hook 只做确定性扫描和上下文注入,不会启动另一个 AI,也不会直接改 library。`moluoxixi-knowledge` 负责语义整理;`relations.json` 是机器关系的唯一事实源,记录每个 canonical asset 依赖的一个或多个 sources,运行时据此构建 source-to-assets 反向索引。
46
110
 
47
- Install or update the role:
111
+ ### 用法
48
112
 
49
- ```bash
50
- airules install moluoxixi --host all
113
+ 首次在项目中启用完整工作流和知识库时,在目标 AI 宿主中发送:
114
+
115
+ ```text
116
+ 请使用 init-project 初始化当前项目的 Moluoxixi 工作流,目标宿主为 Codex。
51
117
  ```
52
118
 
53
- Verify again without reinstalling:
119
+ 之后的典型路径是:
54
120
 
55
- ```bash
56
- airules verify moluoxixi --host all
121
+ ```text
122
+ 描述需求
123
+ -> start 判断任务类型
124
+ -> brainstorm 形成 PRD/design/implement
125
+ -> task start
126
+ -> research(需要时)
127
+ -> implement
128
+ -> check
129
+ -> update-spec
130
+ -> 用户确认提交
131
+ -> finish-work
57
132
  ```
58
133
 
59
- Role installation is user-level and can be run from `<user-home>/AIRules`. To initialize a project, enter the target project first, then invoke the `init-project` skill in your AI coding host.
134
+ 资料放入 `.moluoxixi/knowledge/sources/` 后,每轮 Hook 会检查变化。存在待整理 source 时,AI 先运行 `moluoxixi-knowledge`,更新 library、索引和关系账本,再继续主任务。
135
+
136
+ `init-project` 只在首次接入、增加/重新配置宿主或补装扩展时使用。只使用共享 skills 或 CLI 时可以不运行;直接执行 `moluoxixi init` 只安装原生项目资产,不包含 AIRules 知识扩展。
60
137
 
61
- ## Trellis Role
138
+ 角色源码位于 [`roles/moluoxixi`](roles/moluoxixi)。
62
139
 
63
- The Trellis role installs the official Trellis CLI, its `init-project` skill, the default CodeGraph, Context7, Sequential Thinking, and Playwright MCP servers, and Matt Pocock's productivity skills.
140
+ ## `matt`
64
141
 
65
- ### Install with AI
142
+ 适合只想安装 Matt Pocock 的工程方法和效率 skills,不需要固定项目工作流、项目 agents、hooks、MCP 或角色 CLI 的用户。
143
+
144
+ ### 安装
145
+
146
+ ```bash
147
+ npm install --global moluoxixi-ai-rules
148
+ airules install matt --host all
149
+ airules verify matt --host all
150
+ ```
66
151
 
67
- Copy this prompt into your AI coding assistant:
152
+ ### 功能
153
+
154
+ #### 安装后的资产
155
+
156
+ `matt` 只组合 `engineering` 和 `productivity` 两个 capability。它安装固定上游版本的 skills,但不创建 `.matt/`,没有 role-owned `init-project`、agents、hooks、CLI 或 MCP server。
157
+
158
+ #### Skills
159
+
160
+ | Capability | Skill | 做什么 |
161
+ | --- | --- | --- |
162
+ | `engineering` | `ask-matt` | 根据当前问题选择适合的 Matt skill 或工作流;这是显式调用的路由器 |
163
+ | `engineering` | `code-review` | 从指定基线对改动做 standards 与 spec 双轴审查 |
164
+ | `engineering` | `codebase-design` | 用深模块原则改进模块边界、接口和可测试性 |
165
+ | `engineering` | `diagnosing-bugs` | 系统诊断疑难 bug、性能问题或回归 |
166
+ | `engineering` | `domain-modeling` | 建立或修订领域模型、`CONTEXT.md` 和 ADR |
167
+ | `engineering` | `grill-with-docs` | 通过访谈打磨设计,并同步产出 ADR 与词汇文档 |
168
+ | `engineering` | `implement` | 按已有 spec 或 tickets 实施工作 |
169
+ | `engineering` | `improve-codebase-architecture` | 扫描架构深化机会,生成报告并推进取舍 |
170
+ | `engineering` | `prototype` | 用一次性原型回答设计、状态模型或 UI 问题 |
171
+ | `engineering` | `research` | 依据一手来源研究,并将结果写入仓库 Markdown |
172
+ | `engineering` | `resolving-merge-conflicts` | 处理进行中的 merge/rebase 冲突并运行检查 |
173
+ | `engineering` | `setup-matt-pocock-skills` | 首次配置 issue tracker、triage labels 和领域文档布局 |
174
+ | `engineering` | `tdd` | 以 red-green-refactor 方式进行测试驱动开发 |
175
+ | `engineering` | `to-spec` | 把当前对话整理为 spec,并发布到 issue tracker |
176
+ | `engineering` | `to-tickets` | 把计划或 spec 拆成有依赖关系的 tracer-bullet tickets |
177
+ | `engineering` | `triage` | 核验并分类 issue/外部 PR,生成 agent-ready brief |
178
+ | `engineering` | `wayfinder` | 把超出单次会话的大型工作规划成决策与 ticket 地图 |
179
+ | `engineering` | `wizard` | 生成交互式 bash wizard,引导人工完成凭据、控制台或迁移步骤 |
180
+ | `productivity` | `grill-me` | 启动严格访谈,把模糊计划推进到可执行状态 |
181
+ | `productivity` | `grilling` | 压力测试计划、决策或设计 |
182
+ | `productivity` | `handoff` | 生成下一位 agent 可直接接手的交接文档 |
183
+ | `productivity` | `teach` | 在仓库中进行可记录进度的跨会话教学 |
184
+ | `productivity` | `to-questionnaire` | 把未决问题转成面向知情人的问卷 |
185
+ | `productivity` | `wait-what` | 重新解释没有被理解的信息 |
186
+ | `productivity` | `writing-for-agents` | 编写 agent 消费的文档和 skills |
187
+
188
+ #### 调度方式
189
+
190
+ `matt` 没有项目级 agent scheduler。AI 宿主根据每个 `SKILL.md` 的 description 发现可用 skill;带有手动调用约束的 skills 不会被保证自动触发。选择不明确时显式要求使用 `ask-matt`,比假设 AIRules 会自动编排更准确。
191
+
192
+ ### 用法
193
+
194
+ 无需运行 `init-project`,直接描述工程目标或显式点名 skill。例如:
68
195
 
69
196
  ```text
70
- Install the Trellis role from AIRules on this machine.
71
-
72
- 1. Check that Node.js 22 or newer, npm, Git, and Python 3.9 or newer are available.
73
- 2. Resolve my user home directory and clone https://github.com/moluoxixi/AIRules.git to `<user-home>/AIRules`. Do not clone it into a project or into `<user-home>/.moluoxixi`.
74
- 3. Enter `<user-home>/AIRules`.
75
- 4. Run `npm install`, `npm run build`, and `npm link`.
76
- 5. Run `airules --version` and confirm that version 0.2.0 or newer is installed.
77
- 6. Before installing, tell me that AIRules will first fast-forward its clean Git checkout with `git pull --ff-only`, then install the official Trellis and CodeGraph CLIs, write the initialization and Matt productivity skills to supported AI host directories, and merge the default MCP servers into supported host configurations. The install command is user-level and does not need to run inside a project.
78
- 7. After I confirm, run `airules install trellis --host all`.
79
- 8. The install command verifies the result automatically. Report the installed versions, updated hosts, written directories, and any errors.
80
-
81
- Do not use sudo. Do not pass `--skip-vendors` or `--no-verify`. Do not delete or overwrite files that are not managed by AIRules.
197
+ 请使用 ask-matt 判断这个需求应该走哪条工程工作流。
198
+ 请使用 diagnosing-bugs 分析这个性能回归的根因。
199
+ 请把当前方案 to-spec,再用 to-tickets 拆成可并行任务。
200
+ 请使用 tdd 实现这个行为,最后运行 code-review。
82
201
  ```
83
202
 
84
- ### Usage
203
+ 一条典型链路是 `setup-matt-pocock-skills -> to-spec -> to-tickets -> implement -> code-review`;单点问题则直接使用对应 skill。所有状态由当前宿主、仓库文档或 issue tracker 管理,AIRules 不创建 `.matt/`。
85
204
 
86
- Install or update the role:
205
+ 角色源码位于 [`roles/matt`](roles/matt)。
87
206
 
88
- ```bash
89
- airules install trellis --host all
90
- ```
207
+ ## `trellis`
208
+
209
+ 适合希望使用原生 Trellis 的任务与规范驱动工作流,同时获得 AIRules 共享 skills、MCP、知识库和多 agent 调度的用户。
91
210
 
92
- Verify again without reinstalling:
211
+ ### 安装
93
212
 
94
213
  ```bash
214
+ npm install --global moluoxixi-ai-rules
215
+ airules install trellis --host all
95
216
  airules verify trellis --host all
217
+ trellis --version
96
218
  ```
97
219
 
98
- Role installation is user-level and can be run from `<user-home>/AIRules`. To initialize a project, enter the target project first, then invoke the `init-project` skill in your AI coding host or run:
220
+ `airules install trellis` 会安装 Trellis CLI 和用户级能力,但不会自动修改任何项目;项目级工作流由下一步的 `init-project` 创建。
99
221
 
100
- ```bash
101
- trellis init -u <your-name>
102
- ```
222
+ ### 功能
223
+
224
+ #### 安装后的资产
225
+
226
+ | 层级 | 资产 | 作用 |
227
+ | --- | --- | --- |
228
+ | 用户级角色资产 | Trellis CLI、`init-project` | 提供原生 `init/update/upgrade/uninstall/mem/workflow/platforms/channel` 命令 |
229
+ | 公共 capability | `common`、`coding`、`productivity`、`frontend` | 与 Moluoxixi 相同的共享 skills、外部固定版本 skills 和 MCP servers |
230
+ | 原生项目资产 | `.trellis/workflow.md`、`tasks/`、`spec/`、`scripts/`、`agents/`、宿主配置 | 保存 Plan/Execute/Finish 状态、任务工件、规范和 agent 定义 |
231
+ | AIRules 项目扩展 | `.trellis/knowledge/`、知识 runtime、宿主 hook、`trellis-knowledge` | 自动发现 source 变化并维护双向可追踪知识关系 |
232
+
233
+ #### Skills
234
+
235
+ 原生 Trellis 会按宿主能力把工作流入口投影为 command 或 skill;下表使用统一的 skill 名称说明其职责。
103
236
 
104
- ## Matt Role
237
+ | 来源 | Skill | 做什么 |
238
+ | --- | --- | --- |
239
+ | 角色入口 | `init-project` | 运行原生 `trellis init`,再补装知识库、README 用法和简体中文任务约定 |
240
+ | 项目工作流 | `trellis-start` | 建立开发 session,读取身份、Git、任务和规范并选择工作路径 |
241
+ | 项目工作流 | `trellis-brainstorm` | 澄清新功能或复杂需求,创建 PRD、设计和实施计划 |
242
+ | 项目工作流 | `trellis-before-dev` | 在写代码前注入适用的项目 coding guidelines |
243
+ | 项目工作流 | `trellis-continue` | 读取 phase index 并恢复当前任务 |
244
+ | 项目工作流 | `trellis-check` | 执行 spec、lint、类型、测试、复用与跨层一致性检查 |
245
+ | 项目工作流 | `trellis-break-loop` | 对重复 bug 做根因分类并建立防复发机制 |
246
+ | 项目工作流 | `trellis-update-spec` | 把已经确认的契约和编码约定固化到 `.trellis/spec/` |
247
+ | 项目工作流 | `trellis-finish-work` | 核对质量门禁、归档任务并写开发日志 |
248
+ | 项目工作流 | `trellis-channel` | 通过 Trellis channel runtime 管理实时多 agent 协作 |
249
+ | 项目工作流 | `trellis-session-insight` | 使用 `trellis mem` 检索历史会话中的决定和解决方案 |
250
+ | 项目工作流 | `trellis-spec-bootstrap` | 从真实代码建立或刷新项目规范 |
251
+ | 项目工作流 | `trellis-meta` | 理解和定制 `.trellis/`、平台 hooks、agents、skills 与 workflow |
252
+ | 知识扩展 | `trellis-knowledge` | 整理 `.trellis/knowledge/sources/`,更新 library/index/relations 并确认稳定批次 |
253
+ | `common` | `create-skill` | 创建或修订可复用的 agent skill |
254
+ | `common` | `spec-organization` | 重组项目 specification 文档及索引 |
255
+ | `frontend` | `frontend-design` | 指导有明确视觉方向的前端设计与重塑 |
256
+ | `productivity` | `grill-me` | 启动严格需求访谈 |
257
+ | `productivity` | `grilling` | 压力测试计划、决策或设计 |
258
+ | `productivity` | `handoff` | 生成跨 agent 交接文档 |
259
+ | `productivity` | `teach` | 进行可记录进度的跨会话教学 |
260
+ | `productivity` | `to-questionnaire` | 把未决问题转成问卷 |
261
+ | `productivity` | `wait-what` | 重新解释未被理解的内容 |
262
+ | `productivity` | `writing-for-agents` | 编写 agent 文档与 skills |
105
263
 
106
- The Matt role installs all engineering and productivity skills from `mattpocock/skills`, pinned to the revision recorded in the role manifest.
264
+ Trellis 同样安装 CodeGraph、Context7、Sequential Thinking 和 Playwright MCP;role-owned MCP 清单为空,实际 MCP 来自 `coding` 与 `frontend` capabilities。
107
265
 
108
- ### Install with AI
266
+ #### Agents、hooks 与调度
109
267
 
110
- Copy this prompt into your AI coding assistant:
268
+ | Agent | 职责 | 调度时机 |
269
+ | --- | --- | --- |
270
+ | `trellis-research` | 研究代码、spec 和技术方案,只向任务 `research/` 写证据 | Plan 阶段或执行前需要外部研究时 |
271
+ | `trellis-implement` | 按任务工件实现并运行基本检查 | Execute 阶段 |
272
+ | `trellis-check` | 独立检查实现,可修机械问题并重新验证 | implement 之后、提交之前 |
273
+
274
+ 主会话默认按 `trellis-implement -> trellis-check` 派发,research 按需插入。子代理提示首行携带 `Active task`,hook 再按 `JSONL -> prd.md -> design.md -> implement.md -> spec` 注入上下文;implement/check 不能互相或递归派发。`dispatch_mode: inline` 时由主会话直接执行 `trellis-before-dev -> edit -> trellis-check`。
275
+
276
+ Plan 阶段创建并确认 PRD,复杂任务补齐 design/implement 后 `task.py start`;Execute 阶段实施与检查;Finish 阶段运行 break-loop(需要时)、update-spec、用户确认提交和 finish-work。channel runtime 还可以显式加载 `.trellis/agents/implement.md` 或 `check.md` 作为长驻 worker。
277
+
278
+ 知识调用链与 Moluoxixi 相同,只是根目录和 skill 名不同:宿主事件调用 `knowledge-hook.py`,公共 scanner 计算 source diff、受影响 assets 和关系错误,Hook 注入 `<trellis-knowledge>`;`trellis-knowledge` 再负责实际整理和 acknowledge。
279
+
280
+ ### 用法
281
+
282
+ 首次在项目中启用完整工作流和知识库时发送:
111
283
 
112
284
  ```text
113
- Install the Matt role from AIRules on this machine.
114
-
115
- 1. Check that Node.js 22 or newer, npm, and Git are available.
116
- 2. Resolve my user home directory and clone https://github.com/moluoxixi/AIRules.git to `<user-home>/AIRules`. Do not clone it into a project or into `<user-home>/.moluoxixi`.
117
- 3. Enter `<user-home>/AIRules`.
118
- 4. Run `npm install`, `npm run build`, and `npm link`.
119
- 5. Run `airules --version` and confirm that version 0.2.0 or newer is installed.
120
- 6. Before installing, tell me that AIRules will first fast-forward its clean Git checkout with `git pull --ff-only`, then clone the pinned Matt Pocock skills revision and write engineering and productivity skills to `<user-home>/.moluoxixi`, `<user-home>/.agents/skills`, and supported AI host directories.
121
- 7. After I confirm, run `airules install matt --host all`.
122
- 8. The install command verifies the result automatically. Report the installed version, updated hosts, written directories, and any errors.
123
-
124
- Do not use sudo. Do not pass `--skip-vendors` or `--no-verify`. Do not delete or overwrite files that are not managed by AIRules.
285
+ 请使用 init-project 初始化当前项目的 Trellis 工作流,开发者名称为 wl,目标宿主为 Codex。
125
286
  ```
126
287
 
127
- ### Usage
128
-
129
- Install or update the role:
288
+ 日常通过工作流入口推进:
130
289
 
131
- ```bash
132
- airules install matt --host all
290
+ ```text
291
+ 请使用 Trellis 开始处理这个需求:<描述需求>
292
+ 请使用 Trellis 继续当前任务。
293
+ 请使用 Trellis 检查当前改动。
294
+ 请使用 Trellis 完成本次工作。
133
295
  ```
134
296
 
135
- Verify again without reinstalling:
297
+ 整体链路是“规划(Plan)→ 执行(Execute)→ 完成(Finish)”。资料放在 `.trellis/knowledge/sources/`;Hook 检测到变化后会先路由到 `trellis-knowledge`,修复 library 与关系账本后再进入主任务。
136
298
 
137
- ```bash
138
- airules verify matt --host all
299
+ `init-project` 只在首次接入、增加宿主或重新配置时使用。如果只使用该 role 的共享 skills/MCP,可以不运行它。
300
+
301
+ 角色源码位于 [`roles/trellis`](roles/trellis)。
302
+
303
+ ## 公共分发机制
304
+
305
+ Role 只声明 capability,registry 负责按声明顺序组合 vendor,合并兼容投影、去重完全相同的 projection,并拒绝来源或目标冲突。完整映射见 [capabilities/README.md](capabilities/README.md)。
306
+
307
+ 分发链路为:
308
+
309
+ ```text
310
+ role manifest
311
+ -> 固定 vendor checkout / package setup
312
+ -> vendor staging
313
+ -> canonical ~/.agents/skills
314
+ -> 宿主 skill 投影与 MCP 合并
139
315
  ```
140
316
 
141
- ## Version
317
+ 当前安装 role 的受管 shared layer 会替换上一 role 不再需要的受管链接,因此不要把三个 role 理解为完全隔离、永久叠加的环境。用户已有的同名 MCP 配置优先保留。`airules verify` 检查受管 skills、宿主 links 和 MCP server 名称,不检查项目初始化器生成的 agents/hooks;后者应通过角色工作流自身的检查完成。
318
+
319
+ ## 开发
142
320
 
143
321
  ```bash
144
- airules --version
322
+ npm install
323
+ npm test
324
+ npm run typecheck
325
+ npm run lint:check
145
326
  ```
146
327
 
147
- Chinese documentation: [README-zh.md](README-zh.md)
148
-
149
- ## License
328
+ ## 许可证
150
329
 
151
330
  MIT
@@ -0,0 +1,7 @@
1
+ export declare const codingCapability: {
2
+ roleProjections: {
3
+ kind: "mcp";
4
+ sourceFile: string;
5
+ output: string;
6
+ }[];
7
+ };
@@ -0,0 +1,9 @@
1
+ export const codingCapability = {
2
+ roleProjections: [
3
+ {
4
+ kind: 'mcp',
5
+ sourceFile: 'mcps/code/mcps.json',
6
+ output: 'mcps/code/mcp.json',
7
+ },
8
+ ],
9
+ };
@@ -0,0 +1,7 @@
1
+ export declare const commonCapability: {
2
+ roleProjections: {
3
+ kind: "namespace";
4
+ sourceDir: string;
5
+ output: string;
6
+ }[];
7
+ };
@@ -0,0 +1,9 @@
1
+ export const commonCapability = {
2
+ roleProjections: [
3
+ {
4
+ kind: 'namespace',
5
+ sourceDir: 'skills/common',
6
+ output: 'common',
7
+ },
8
+ ],
9
+ };
@@ -0,0 +1,12 @@
1
+ export declare const engineeringCapability: {
2
+ vendors: {
3
+ name: string;
4
+ source: string;
5
+ revision: string;
6
+ projections: {
7
+ kind: "namespace";
8
+ sourceDir: string;
9
+ output: string;
10
+ }[];
11
+ }[];
12
+ };
@@ -0,0 +1,17 @@
1
+ import { MATT_POCOCK_SKILLS_REVISION, MATT_POCOCK_SKILLS_SOURCE } from './productivity.js';
2
+ export const engineeringCapability = {
3
+ vendors: [
4
+ {
5
+ name: 'mattpocock',
6
+ source: MATT_POCOCK_SKILLS_SOURCE,
7
+ revision: MATT_POCOCK_SKILLS_REVISION,
8
+ projections: [
9
+ {
10
+ kind: 'namespace',
11
+ sourceDir: 'skills/engineering',
12
+ output: 'engineering',
13
+ },
14
+ ],
15
+ },
16
+ ],
17
+ };
@@ -0,0 +1,19 @@
1
+ export declare const ANTHROPIC_SKILLS_SOURCE = "https://github.com/anthropics/skills.git";
2
+ export declare const ANTHROPIC_SKILLS_REVISION = "3b3fad96af16a10759d930941b4520ba0c40edae";
3
+ export declare const frontendCapability: {
4
+ roleProjections: {
5
+ kind: "mcp";
6
+ sourceFile: string;
7
+ output: string;
8
+ }[];
9
+ vendors: {
10
+ name: string;
11
+ source: string;
12
+ revision: string;
13
+ projections: {
14
+ kind: "skills";
15
+ sourceBaseDir: string;
16
+ skills: string[];
17
+ }[];
18
+ }[];
19
+ };
@@ -0,0 +1,25 @@
1
+ export const ANTHROPIC_SKILLS_SOURCE = 'https://github.com/anthropics/skills.git';
2
+ export const ANTHROPIC_SKILLS_REVISION = '3b3fad96af16a10759d930941b4520ba0c40edae';
3
+ export const frontendCapability = {
4
+ roleProjections: [
5
+ {
6
+ kind: 'mcp',
7
+ sourceFile: 'mcps/frontend/mcps.json',
8
+ output: 'mcps/frontend/mcp.json',
9
+ },
10
+ ],
11
+ vendors: [
12
+ {
13
+ name: 'anthropic-skills',
14
+ source: ANTHROPIC_SKILLS_SOURCE,
15
+ revision: ANTHROPIC_SKILLS_REVISION,
16
+ projections: [
17
+ {
18
+ kind: 'skills',
19
+ sourceBaseDir: 'skills',
20
+ skills: ['frontend-design'],
21
+ },
22
+ ],
23
+ },
24
+ ],
25
+ };
@@ -0,0 +1,7 @@
1
+ import type { VendorRepo } from '../scripts/lib/vendors.js';
2
+ import type { CapabilityDefinition, CapabilityName, CapabilitySelection, ComposeCapabilitiesOptions } from './types.js';
3
+ export type { CapabilityDefinition, CapabilityName, CapabilitySelection, ComposeCapabilitiesOptions } from './types.js';
4
+ export { CAPABILITY_NAMES } from './types.js';
5
+ export declare const capabilityRegistry: Readonly<Record<CapabilityName, CapabilityDefinition>>;
6
+ export declare function composeCapabilities(capabilities: readonly CapabilityName[], options: ComposeCapabilitiesOptions): VendorRepo[];
7
+ export declare function composeCapabilityDefinitions(selections: readonly CapabilitySelection[], options: ComposeCapabilitiesOptions): VendorRepo[];