@mingfuyun/star-allinone 0.4.7 → 0.4.9
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.
- package/docs/README.md +15 -0
- package/docs/skills/README.md +12 -0
- package/docs/skills/overview.md +53 -0
- package/docs/skills/prism-mock.md +219 -0
- package/examples/AGENTS.md +10 -7
- package/package.json +2 -1
- package/scripts/cli.js +37 -0
- package/skills/README.md +13 -7
- package/skills/shared/prism-mock/SKILL.md +36 -0
- package/skills/shared/prism-mock/references/example-prism-config.json +26 -0
- package/skills/shared/prism-mock/templates/.gitkeep +0 -0
- package/skills/shared/publish-test/SKILL.md +1 -1
- package/skills/shared/publish-test/scripts/publish-current-branch.sh +10 -0
- package/skills/shared/review-and-submit/SKILL.md +1 -1
package/docs/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# star-allinone 文档
|
|
2
|
+
|
|
3
|
+
技能相关说明**只维护在本仓库**,不要在业务仓复制长文。
|
|
4
|
+
|
|
5
|
+
| 目录 | 内容 |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| [skills/](skills/README.md) | 各 shared skill 的人读 / Agent 说明(唯一正文) |
|
|
8
|
+
|
|
9
|
+
业务仓经 `pnpm exec star-allinone skills sync` 后,对应正文会出现在:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
.agents/skills/shared-<name>/references/guide.md
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
业务仓**不维护**技能相关 `docs/`;只读 sync 后的 `.agents/skills/shared-*/references/` 副本。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Skills 文档索引
|
|
2
|
+
|
|
3
|
+
> **维护约定:** 技能说明只改本目录。业务仓删除技能相关 `docs/`,只读 sync 副本。
|
|
4
|
+
|
|
5
|
+
| 文档 | 对应 skill / 主题 | sync 后业务仓路径 |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| [overview.md](overview.md) | 入口与 shared/custom 总览 | `.agents/skills/shared-project-conventions/references/skills-overview.md` |
|
|
8
|
+
| [prism-mock.md](prism-mock.md) | `shared-prism-mock` | `.agents/skills/shared-prism-mock/references/guide.md` |
|
|
9
|
+
|
|
10
|
+
配置示例(JSON):`skills/shared/prism-mock/references/example-prism-config.json`(随 skill sync)。
|
|
11
|
+
|
|
12
|
+
Agent 执行某 skill 时:先读该 skill 的 `SKILL.md`,再读其 `references/guide.md`(由本文档同步生成)。
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# 研发 Skills 使用指南
|
|
2
|
+
|
|
3
|
+
> 维护源:能力包 `docs/skills/overview.md`。业务仓勿复制长文。
|
|
4
|
+
|
|
5
|
+
`shared-*` 来自 `@mingfuyun/star-allinone`,经 `skills sync` 写入业务仓 `.agents/skills/`,**不要在业务仓直接改**。`custom-*` 由业务仓维护。领域规则:`.agents/skills/custom-entry/references/project-rules.md`。
|
|
6
|
+
|
|
7
|
+
## 用户入口
|
|
8
|
+
|
|
9
|
+
只使用 **`$custom-entry`**。不要直接 `$shared-*`,不要直接调用内部 `custom-*`(如全量 swagger / Prism 实现层)。
|
|
10
|
+
|
|
11
|
+
| 经入口委托到 | 用途 |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `shared-api-to-service` | 单个 `METHOD /path/` → 类型、Service、可选 JSON Mock |
|
|
14
|
+
| `shared-design-to-page` | 页面(标准列表内部跑 `gen page`) |
|
|
15
|
+
| `shared-review-and-submit` | 提交前审查,确认后再提交 |
|
|
16
|
+
| `shared-publish-test` | 明确要求测发后再跑;`git push` 后不要自动调用 |
|
|
17
|
+
| `shared-tracking` | 埋点接入与补齐 |
|
|
18
|
+
| `shared-prism-mock`(内部,若已 sync) | 本地 Prism / `dev:mock` / overrides;说明见 [prism-mock.md](prism-mock.md) |
|
|
19
|
+
| 项目 `custom-*`(内部) | 如全量 swagger / OpenAPI 增量等,见各仓 `AGENTS.md` |
|
|
20
|
+
|
|
21
|
+
## 示例
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
使用 $custom-entry,为 GET /api/v1/devices/ 生成类型、Service 和 JSON Mock。
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
使用 $custom-entry,根据设计稿实现管理页面;缺少的 Service、类型一并生成。
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
使用 $custom-entry,对当前变更执行提交前审查。等我确认后再提交。
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
使用 $custom-entry,把当前分支发布到测试环境。
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
使用 $custom-entry,为 GET /api/v1/users/me 写 Prism mock override。
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
使用 $custom-entry。契约已更新,请重建相关 Service 并刷新 Prism mock(保留 overrides)。
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
本地 Prism 详见 [prism-mock.md](prism-mock.md)。接口契约使用**本仓库**自己的 OpenAPI / Swagger,不要复用其他项目的快照或流水线。
|
|
48
|
+
|
|
49
|
+
## 规范源
|
|
50
|
+
|
|
51
|
+
- 常驻:业务仓根 `AGENTS.md`
|
|
52
|
+
- 技能正文:能力包 `docs/skills/`(sync 副本在 `.agents/skills/shared-*/references/`)
|
|
53
|
+
- **禁止** `.cursor/rules`;**禁止** `~/.codex/skills` 全局 skill 作业务入口
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Prism Mock
|
|
2
|
+
|
|
3
|
+
> **维护源(唯一正文):** 能力包 `docs/skills/prism-mock.md`
|
|
4
|
+
> sync 后业务仓副本:`.agents/skills/shared-prism-mock/references/guide.md`
|
|
5
|
+
> 范围:仅 Prism 能力;**不含**整单 workflow / `shared-dev-flow`。
|
|
6
|
+
> 业务仓不维护 `docs/` 技能文档。
|
|
7
|
+
|
|
8
|
+
对话经 `$custom-entry` 委托本能力(收口完成后为 `shared-prism-mock`;过渡期星链可能仍为 `custom-prism-mock`)。人读与 Agent 均以本文为准。
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. 目标
|
|
13
|
+
|
|
14
|
+
| 目标 | 说明 |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| 契约前置 | 后端未就绪时,按正式契约 + Service 类型把页面跑通 |
|
|
17
|
+
| 少侵入 | 不改页面 / `MFRequest` / `request.tsx`;只动 proxy 与 mock 产物 |
|
|
18
|
+
| 可协作 | 假数据进仓库(overrides)或可复现生成,不靠本机插件 |
|
|
19
|
+
| 可混跑 | 登录仍走真实 SSO;未进契约的接口仍打真实服务 |
|
|
20
|
+
|
|
21
|
+
非目标:替代完整联调、模拟有状态审批流、覆盖未进契约的模块。
|
|
22
|
+
|
|
23
|
+
### 分层
|
|
24
|
+
|
|
25
|
+
| 层 | 归属 | 内容 |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| 共享 skill + 本文 | 能力包 | Agent 流程、配置契约、(后续)接入模板 |
|
|
28
|
+
| 项目配置 | `.star-allinone.json` → `prism` | 端口、路径、信封、脚本名 |
|
|
29
|
+
| 运行时 | 业务仓 | proxy、gen、`dev:mock`、overrides **业务数据** |
|
|
30
|
+
| 入口 overlay | `$custom-entry` | 意图委托 |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 2. 日常怎么用
|
|
35
|
+
|
|
36
|
+
脚本名以配置 `prism.devScript` 为准(默认 `dev:mock`):
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm dev:mock # 生成契约 + Prism + 前端(MOCK=1)
|
|
40
|
+
# 全量真实后端:用项目既有脚本(如星链 pnpm test)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
典型会:
|
|
44
|
+
|
|
45
|
+
1. 跑 `prism.genScript` → 写出 `prism.generatedSpec`(gitignore,勿手改)
|
|
46
|
+
2. 启动 Prism 读该文件
|
|
47
|
+
3. 以 MOCK 启动前端,按规则分流 `/api`
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 3. 分流模型(`proxyIntegration: umi`)
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
浏览器 → /api/...
|
|
55
|
+
↓
|
|
56
|
+
应用 proxy(MOCK=1)
|
|
57
|
+
↓
|
|
58
|
+
├─ authPathPrefixes 命中 → 真实后端
|
|
59
|
+
├─ path ∈ 正式契约(openapi) → Prism 127.0.0.1:<mockPort>
|
|
60
|
+
└─ 其它 /api/** → 真实后端
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
| 组件 | 典型路径 | 作用 |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| 分流 | `config/prism.ts` + 应用 proxy | Prism vs 真实 |
|
|
66
|
+
| 生成 | `prism.genScript` | TS / overrides → 生成契约 |
|
|
67
|
+
| 启动 | `package.json` → `prism.devScript` | 一键 |
|
|
68
|
+
| 人工数据 | `prism.overridesDir/**` | 定制接口 |
|
|
69
|
+
| Agent | `shared-prism-mock`(经 entry) | 见下文 A–E |
|
|
70
|
+
|
|
71
|
+
依赖:`@stoplight/prism-cli`、`concurrently`(通常为 devDependencies)。
|
|
72
|
+
|
|
73
|
+
兼容:前置依赖接口用 overrides;半 mock(同页 Prism + 真实);Chrome 插件不作为团队主路径。
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 4. `.star-allinone.json` → `prism`
|
|
78
|
+
|
|
79
|
+
未配置或 `enabled !== true` → Agent **不改业务代码**(可说明如何启用)。
|
|
80
|
+
|
|
81
|
+
复用顶层:`openapi`(正式契约)、`serviceDir`、`project`。
|
|
82
|
+
|
|
83
|
+
| 字段 | 默认 | 说明 |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| `enabled` | — | 启用必为 `true` |
|
|
86
|
+
| `mockPort` | `4010` | 可用 `MOCK_PORT` 覆盖 |
|
|
87
|
+
| `generatedSpec` | `swagger.prism.json` | gen 输出 |
|
|
88
|
+
| `overridesDir` | `mock/overrides` | 人工假数据根目录 |
|
|
89
|
+
| `authPathPrefixes` | `[]` | 始终真实 |
|
|
90
|
+
| `skipOpenapiPathPrefixes` | — | 不写入生成契约 |
|
|
91
|
+
| `skipServiceDirNames` | `[]` | 扫描服务目录跳过 |
|
|
92
|
+
| `devScript` | `dev:mock` | |
|
|
93
|
+
| `genScript` | `scripts/prism/gen-prism-mock.mjs` | |
|
|
94
|
+
| `proxyIntegration` | `umi` | `umi` \| `other` |
|
|
95
|
+
| `envelope.*` | code/msg/data/`0` | 响应信封 |
|
|
96
|
+
| `mockSourceExtensionKey` | `x-mock-source` | 星链现状可用 `x-starlink-mock-source` |
|
|
97
|
+
|
|
98
|
+
示例 JSON:能力包内 `skills/shared/prism-mock/references/example-prism-config.json`。
|
|
99
|
+
|
|
100
|
+
### Agent 读配置
|
|
101
|
+
|
|
102
|
+
1. 先读 `.star-allinone.json`;无 `prism.enabled === true` 则停止写代码。
|
|
103
|
+
2. 契约路径只用顶层 `openapi`。
|
|
104
|
+
3. overrides:`{overridesDir}/<path-without-leading-slash>/<method>.json`,`{param}` → `id`。
|
|
105
|
+
4. 禁止抄他仓 `authPathPrefixes` / pipelineId。
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 5. 假数据优先级与 overrides
|
|
110
|
+
|
|
111
|
+
生成时:`override` > Service 返回类型(TS)> 契约 `schema`。
|
|
112
|
+
生成可去掉 `security`、放宽 required,**不会**改正式契约。
|
|
113
|
+
|
|
114
|
+
路径:
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
{overridesDir}/<api-path>/<method>.json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
例(默认 overridesDir):
|
|
121
|
+
|
|
122
|
+
| 接口 | 文件 |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `GET /api/v1/system-configs` | `mock/overrides/api/v1/system-configs/get.json` |
|
|
125
|
+
| `GET /api/v1/users/me` | `mock/overrides/api/v1/users/me/get.json` |
|
|
126
|
+
| `GET /api/v1/ip-pools/{id}` | `mock/overrides/api/v1/ip-pools/id/get.json` |
|
|
127
|
+
|
|
128
|
+
完整信封推荐;也可只写 `data`。列表枚举等须与页面约定一致。
|
|
129
|
+
|
|
130
|
+
**不要:** 手改生成物;在正式契约写 mock examples;在页面/Service import 假数据;清空 overrides「刷新」。
|
|
131
|
+
|
|
132
|
+
查看:有 override 打开 JSON;否则看生成契约 examples;或 `curl` mock 端口。
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 6. 与 `shared-api-to-service` mock 的边界
|
|
137
|
+
|
|
138
|
+
| | Prism | api-to-service mock |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| 目的 | 本地 Prism + 代理 | 单接口对话/文件 JSON |
|
|
141
|
+
| 假数据主路径 | `overridesDir` + 生成契约 | 非 Prism |
|
|
142
|
+
|
|
143
|
+
历史 `mock/api/**`(非 overrides)不得当作 Prism 源。
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 7. Agent 流程(A–E)
|
|
148
|
+
|
|
149
|
+
### A. 说明 / 排查
|
|
150
|
+
|
|
151
|
+
`pnpm <devScript>`;按分流表解释;不建议改页面/Service/插件主路径。
|
|
152
|
+
|
|
153
|
+
### B. 定制接口
|
|
154
|
+
|
|
155
|
+
确认 path 在正式契约 → 写 override → 重跑 devScript;可用 gen 校验来源标记。
|
|
156
|
+
|
|
157
|
+
### C. 刷新生成物
|
|
158
|
+
|
|
159
|
+
改 typings / `MFRequest` 泛型 → 重跑 gen/devScript。
|
|
160
|
+
|
|
161
|
+
### D. 初始化 / 接入
|
|
162
|
+
|
|
163
|
+
对齐清单:`prism` 配置、分流文件、proxy、gen/devScript、overrides、entry 委托。
|
|
164
|
+
(模板拷贝:后续迭代;当前以业务仓已有落地为准。)
|
|
165
|
+
|
|
166
|
+
验收:devScript 可起;契约接口可 curl;非 mock 脚本仍全真实。
|
|
167
|
+
|
|
168
|
+
### E. 契约更新后刷新
|
|
169
|
+
|
|
170
|
+
正式契约与 Service 已更新 → gen → **保留** overrides → 汇报计数与可能过期 path。
|
|
171
|
+
|
|
172
|
+
### 硬约束
|
|
173
|
+
|
|
174
|
+
- 禁止把流程抄进 `custom-*` 再改一版;差异用 `prism` + entry。
|
|
175
|
+
- 禁止改 `shared-*`。
|
|
176
|
+
- 单接口 Service → `shared-api-to-service`。
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 8. 对话示例(经 `$custom-entry`)
|
|
181
|
+
|
|
182
|
+
```text
|
|
183
|
+
使用 $custom-entry。契约已更新,请重建 Service 并刷新 Prism mock(保留 overrides)。
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
使用 $custom-entry,检查并补齐本仓 Prism 能力(config/proxy/gen/devScript/overrides/委托),不要改业务页面。
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```text
|
|
191
|
+
使用 $custom-entry,为 GET /api/v1/users/me 增加/更新 Prism override,数据如下:{ ... }
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 9. 验收清单
|
|
197
|
+
|
|
198
|
+
- [ ] `pnpm <devScript>` 可启动
|
|
199
|
+
- [ ] curl 契约内接口有预期 JSON
|
|
200
|
+
- [ ] 登录 / SSO 仍打真实服务
|
|
201
|
+
- [ ] 未进契约的接口仍打真实
|
|
202
|
+
- [ ] 非 mock 脚本行为与接入前一致
|
|
203
|
+
- [ ] 业务代码无新增 mock 分支
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 10. 收口步骤(仅 Prism)
|
|
208
|
+
|
|
209
|
+
| 步骤 | 动作 | 状态 |
|
|
210
|
+
| --- | --- | --- |
|
|
211
|
+
| P0 | 本文进 `docs/skills/`;skill 骨架;sync 写入 `references/guide.md` | ✅ |
|
|
212
|
+
| P1 | 业务仓写入 `prism` 配置段 | 待做 |
|
|
213
|
+
| P2 | 能力包 `templates/` 参数化运行时 | 待做 |
|
|
214
|
+
| P3 | 发版 → 业务仓升级 + sync | 待做(本地已可 sync) |
|
|
215
|
+
| P4 | entry 委托 `shared-prism-mock` | 待做 |
|
|
216
|
+
| P5 | 业务仓删除 `docs/` 技能文档,只读 sync 副本 | ✅ |
|
|
217
|
+
| P6 | 删除/瘦身 `custom-prism-mock`;回归 | 待做 |
|
|
218
|
+
|
|
219
|
+
**不做:** 整单 workflow、禅道、强制星眼接入。
|
package/examples/AGENTS.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This is a Umi Max + Ant Design 5 PC admin app. Shared skills live in `.agents/skills/shared-*` and are synced from `@mingfuyun/star-allinone`. Do not edit `shared-*`. Put project-only rules in `.agents/skills/custom-entry/references/` (preferred) or legacy `.agents/project/`.
|
|
4
4
|
|
|
5
|
-
Always-on instructions are this file. Do not add `.cursor/rules
|
|
5
|
+
Always-on instructions are this file. **Normative sources are only this file and `.agents/skills/**`. Do not add `.cursor/rules`.** Do not use global Codex skills under `~/.codex/skills` as a business entry (including retired names such as `publish-starlink-test`, `review-and-commit`, `i-have-adhd`, `zentao-connect`).
|
|
6
6
|
|
|
7
7
|
Peer React is **18.3.1**. The npm package does not export a table.
|
|
8
8
|
|
|
@@ -17,14 +17,17 @@ Props for `MFProTable` are in `.agents/skills/shared-project-conventions/referen
|
|
|
17
17
|
|
|
18
18
|
## Default workflow
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
In business repos, dialogue uses **one entry only**: `$custom-entry`. It reads this file and `custom-entry/references/*`, then delegates to `shared-*` or internal `custom-*`. Do not treat direct `$shared-*` as the production entry.
|
|
21
21
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
22
|
+
- Full requirement / end-to-end flow: intent `flow` (orchestrator `shared-dev-flow` when available; until then: output an implementation plan, wait for `确认方案`, then follow the composite order in `$custom-entry`).
|
|
23
|
+
- One endpoint: via `$custom-entry` → `shared-api-to-service`, or `pnpm exec star-allinone gen service --operation "METHOD /path/"`.
|
|
24
|
+
- Pages: via `$custom-entry` → `shared-design-to-page`. Standard lists run `pnpm exec star-allinone gen page` inside that skill.
|
|
24
25
|
- Project health: `pnpm exec star-allinone doctor`.
|
|
25
|
-
- Review and commit: `$shared-review-and-submit`. Wait for confirmation.
|
|
26
|
-
- Test publish: `$shared-publish-test` after explicit pipeline confirmation.
|
|
27
|
-
- Tracking: `$shared-tracking`. Load the SDK from OSS. Do not commit `tracking-sdk.global.min.js`.
|
|
26
|
+
- Review and commit: via `$custom-entry` → `shared-review-and-submit`. Wait for confirmation (`确认提交` / `确认提交并推送`).
|
|
27
|
+
- Test publish: via `$custom-entry` → `shared-publish-test` after explicit pipeline confirmation (`确认推送流水线` / `发布测试环境`).
|
|
28
|
+
- Tracking: via `$custom-entry` → `shared-tracking`. Load the SDK from OSS. Do not commit `tracking-sdk.global.min.js`.
|
|
29
|
+
|
|
30
|
+
This `examples/AGENTS.md` seeds new projects. Prefer aligning production repos to `$custom-entry` as above.
|
|
28
31
|
|
|
29
32
|
## Hard rules
|
|
30
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mingfuyun/star-allinone",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "星系运维前端能力包",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist",
|
|
31
|
+
"docs",
|
|
31
32
|
"README.md",
|
|
32
33
|
"scripts/cli.js",
|
|
33
34
|
"scripts/gen",
|
package/scripts/cli.js
CHANGED
|
@@ -24,6 +24,8 @@ function usage() {
|
|
|
24
24
|
Run from a business project containing .star-allinone.json.
|
|
25
25
|
|
|
26
26
|
skills sync writes package skills/shared/* to <project>/.agents/skills/shared-*.
|
|
27
|
+
If docs/skills/<name>.md exists, it is copied to shared-<name>/references/guide.md.
|
|
28
|
+
docs/skills/overview.md is copied to shared-project-conventions/references/skills-overview.md.
|
|
27
29
|
It never writes ~/.codex/skills and never modifies custom-* skills.
|
|
28
30
|
If <project>/AGENTS.md is missing, it copies examples/AGENTS.md once.
|
|
29
31
|
|
|
@@ -121,6 +123,39 @@ function copyTree(source, target, variables, options, relativeRoot) {
|
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
|
|
126
|
+
function skillGuideSource(skillName) {
|
|
127
|
+
return path.join(root, 'docs', 'skills', `${skillName}.md`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Copy pack docs/skills/<name>.md into synced skill as references/guide.md (single doc source). */
|
|
131
|
+
function copySkillGuideDoc(skillName, skillTarget, variables, options, relativeRoot) {
|
|
132
|
+
const source = skillGuideSource(skillName);
|
|
133
|
+
if (!fs.existsSync(source)) return;
|
|
134
|
+
const targetPath = path.join(skillTarget, 'references', 'guide.md');
|
|
135
|
+
const relativePath = path.relative(relativeRoot, targetPath);
|
|
136
|
+
console.log(`${options.dryRun ? '[dry-run] ' : ''}${relativePath} (from docs/skills/${skillName}.md)`);
|
|
137
|
+
if (options.dryRun) return;
|
|
138
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
139
|
+
const banner =
|
|
140
|
+
`<!-- 维护源:能力包 docs/skills/${skillName}.md — 勿在业务仓改此副本 -->\n\n`;
|
|
141
|
+
fs.writeFileSync(targetPath, banner + render(fs.readFileSync(source, 'utf8'), variables));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function copySkillsOverviewDoc(destination, options) {
|
|
145
|
+
const source = path.join(root, 'docs', 'skills', 'overview.md');
|
|
146
|
+
if (!fs.existsSync(source)) return;
|
|
147
|
+
const conventions = path.join(destination, `${DEFAULT_PREFIX}project-conventions`);
|
|
148
|
+
if (!fs.existsSync(conventions) && !options.dryRun) return;
|
|
149
|
+
const targetPath = path.join(conventions, 'references', 'skills-overview.md');
|
|
150
|
+
const relativePath = path.relative(destination, targetPath);
|
|
151
|
+
console.log(`${options.dryRun ? '[dry-run] ' : ''}${relativePath} (from docs/skills/overview.md)`);
|
|
152
|
+
if (options.dryRun) return;
|
|
153
|
+
if (!fs.existsSync(conventions)) return;
|
|
154
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
155
|
+
const banner = '<!-- 维护源:能力包 docs/skills/overview.md — 勿在业务仓改此副本 -->\n\n';
|
|
156
|
+
fs.writeFileSync(targetPath, banner + fs.readFileSync(source, 'utf8'));
|
|
157
|
+
}
|
|
158
|
+
|
|
124
159
|
function copySkill(source, destination, skillName, prefix, variables, options) {
|
|
125
160
|
const publicName = publicSkillName(skillName, prefix);
|
|
126
161
|
if (publicName.startsWith(CUSTOM_PREFIX)) {
|
|
@@ -132,6 +167,7 @@ function copySkill(source, destination, skillName, prefix, variables, options) {
|
|
|
132
167
|
fs.mkdirSync(skillTarget, { recursive: true });
|
|
133
168
|
}
|
|
134
169
|
copyTree(source, skillTarget, { ...variables, sharedSkillName: publicName }, options, destination);
|
|
170
|
+
copySkillGuideDoc(skillName, skillTarget, { ...variables, sharedSkillName: publicName }, options, destination);
|
|
135
171
|
}
|
|
136
172
|
|
|
137
173
|
function pruneStaleShared(destination, prefix, syncedNames, options) {
|
|
@@ -178,6 +214,7 @@ function syncProject(options) {
|
|
|
178
214
|
for (const skillName of skills) {
|
|
179
215
|
copySkill(path.join(skillsRoot, skillName), destination, skillName, prefix, variables, options);
|
|
180
216
|
}
|
|
217
|
+
copySkillsOverviewDoc(destination, options);
|
|
181
218
|
pruneStaleShared(destination, prefix, syncedNames, options);
|
|
182
219
|
writeSyncStamp(destination, prefix, syncedNames, options);
|
|
183
220
|
seedAgentsMarkdown(target, options);
|
package/skills/README.md
CHANGED
|
@@ -50,17 +50,23 @@ Cursor / Codex 的常驻说明只放仓库根 `AGENTS.md`(模板见 `examples/
|
|
|
50
50
|
|
|
51
51
|
```text
|
|
52
52
|
@mingfuyun/star-allinone/
|
|
53
|
+
├── docs/skills/ # 技能说明唯一维护源(人读 + Agent)
|
|
54
|
+
│ ├── overview.md
|
|
55
|
+
│ └── prism-mock.md
|
|
53
56
|
└── skills/
|
|
54
57
|
└── shared/
|
|
55
|
-
├── api-to-service/
|
|
56
|
-
├── design-to-page/
|
|
57
|
-
├── review-and-submit/
|
|
58
|
-
├── publish-test/
|
|
59
|
-
├── tracking/
|
|
60
|
-
├──
|
|
61
|
-
|
|
58
|
+
├── api-to-service/
|
|
59
|
+
├── design-to-page/
|
|
60
|
+
├── review-and-submit/
|
|
61
|
+
├── publish-test/
|
|
62
|
+
├── tracking/
|
|
63
|
+
├── prism-mock/ # SKILL;正文 sync 自 docs/skills/prism-mock.md
|
|
64
|
+
├── project-conventions/
|
|
65
|
+
└── i-have-adhd/
|
|
62
66
|
```
|
|
63
67
|
|
|
68
|
+
技能长文只改 `docs/skills/`。`skills sync` 会把 `docs/skills/<name>.md` 写入业务仓 `shared-<name>/references/guide.md`,把 `overview.md` 写入 `shared-project-conventions/references/skills-overview.md`。业务仓不要再维护 `docs/prism-mock.md` 等长文副本。
|
|
69
|
+
|
|
64
70
|
公共入口写死两边已对齐的硬规则,例如:页面走 `MFRequest`、DTO 放 namespace typings、表格用业务仓 `@/components/CommonTable/MFProTable`(不要从包里找 `MFTablePro`)、`ProForm`、弹层从 `@mingfuyun/star-allinone` 导入 `BaseModal` / `CustomDrawer` / `HocModal`、`await` 必须 try/catch、禁止无说明的 `any`、React 18。
|
|
65
71
|
|
|
66
72
|
接入或升级后跑 `pnpm exec star-allinone doctor`。
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: {{sharedSkillName}}
|
|
3
|
+
description: >-
|
|
4
|
+
Internal. Local Prism mock: proxy routing, generated prism spec, mock/overrides, init scaffolding, and post-contract refresh. Prefer project $custom-entry. Use when user asks for Prism, dev:mock, 定制 mock, overrides, 初始化 Prism, swagger/OpenAPI 更新后刷新 mock, 契约前置, or Chrome mock 替代.
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Prism Mock(共享)
|
|
9
|
+
|
|
10
|
+
不是用户入口。业务仓对话经 `$custom-entry` 委托本 skill。
|
|
11
|
+
|
|
12
|
+
## 唯一文档
|
|
13
|
+
|
|
14
|
+
| 场景 | 路径 |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| **维护源(只改这里)** | 能力包 [`docs/skills/prism-mock.md`](../../../../docs/skills/prism-mock.md) |
|
|
17
|
+
| 业务仓 sync 后 | `.agents/skills/{{sharedSkillName}}/references/guide.md` |
|
|
18
|
+
|
|
19
|
+
配置示例:[references/example-prism-config.json](references/example-prism-config.json)
|
|
20
|
+
|
|
21
|
+
## 执行前
|
|
22
|
+
|
|
23
|
+
1. 完整 Read 上方「唯一文档」(业务仓读 `references/guide.md`;能力包开发读 `docs/skills/prism-mock.md`)。
|
|
24
|
+
2. 读业务仓 `.star-allinone.json`;仅当 `prism.enabled === true` 才改 Prism 相关代码。
|
|
25
|
+
3. 契约用顶层 `openapi`;脚本/目录用 `prism.*`。
|
|
26
|
+
|
|
27
|
+
## 硬约束(摘要)
|
|
28
|
+
|
|
29
|
+
- 禁止在业务仓维护技能 `docs/`;只读 sync 后的 `references/guide.md`。
|
|
30
|
+
- 禁止改 `shared-*`;禁止页面/Service 写死 mock 主路径;禁止手改生成物、清空 overrides。
|
|
31
|
+
- 单接口 Service → `shared-api-to-service`。
|
|
32
|
+
- **不包含**整单 workflow / `shared-dev-flow`。
|
|
33
|
+
|
|
34
|
+
## User-facing output
|
|
35
|
+
|
|
36
|
+
需要时可读 `.agents/skills/shared-i-have-adhd/i-have-adhd.md`。
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"project": "example-frontend",
|
|
3
|
+
"publicSkillPrefix": "shared-",
|
|
4
|
+
"serviceDir": "src/services",
|
|
5
|
+
"openapi": "swagger.json",
|
|
6
|
+
"publishPipelineId": "REPLACE_ME",
|
|
7
|
+
"prism": {
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"mockPort": 4010,
|
|
10
|
+
"generatedSpec": "swagger.prism.json",
|
|
11
|
+
"overridesDir": "mock/overrides",
|
|
12
|
+
"authPathPrefixes": ["/api/v1/auth/", "/oauth2/"],
|
|
13
|
+
"skipOpenapiPathPrefixes": ["/api/v1/auth/", "/oauth2"],
|
|
14
|
+
"skipServiceDirNames": ["SystemManagement"],
|
|
15
|
+
"devScript": "dev:mock",
|
|
16
|
+
"genScript": "scripts/prism/gen-prism-mock.mjs",
|
|
17
|
+
"proxyIntegration": "umi",
|
|
18
|
+
"envelope": {
|
|
19
|
+
"codeField": "code",
|
|
20
|
+
"messageFields": ["msg", "message"],
|
|
21
|
+
"dataField": "data",
|
|
22
|
+
"successCode": 0
|
|
23
|
+
},
|
|
24
|
+
"mockSourceExtensionKey": "x-mock-source"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
File without changes
|
|
@@ -56,7 +56,7 @@ before or as part of `max build`. Do not treat `pnpm test` as unit tests; in bus
|
|
|
56
56
|
- Current HEAD is a named branch, not detached.
|
|
57
57
|
- `origin/<branch>` exists and matches local `HEAD`. Push first when it does not.
|
|
58
58
|
- `YUNXIAO_ACCESS_TOKEN` is available. Request approval for the external Yunxiao CLI call.
|
|
59
|
-
- Never print
|
|
59
|
+
- If `YUNXIAO_ACCESS_TOKEN` is unset, the publish script loads `~/.codex/secrets/yunxiao.env` in the same shell when that file exists. Do not ask the user to `export` the token. Never print, copy, or paste the token.
|
|
60
60
|
|
|
61
61
|
## After the run
|
|
62
62
|
|
|
@@ -69,6 +69,16 @@ if [[ "$local_commit" != "$remote_commit" ]]; then
|
|
|
69
69
|
exit 1
|
|
70
70
|
fi
|
|
71
71
|
|
|
72
|
+
if [[ -z "${YUNXIAO_ACCESS_TOKEN:-}" ]]; then
|
|
73
|
+
yunxiao_env="${HOME}/.codex/secrets/yunxiao.env"
|
|
74
|
+
if [[ -f "$yunxiao_env" ]]; then
|
|
75
|
+
# Load token for this shell only. Do not print file contents.
|
|
76
|
+
set -a
|
|
77
|
+
# shellcheck disable=SC1090
|
|
78
|
+
source "$yunxiao_env"
|
|
79
|
+
set +a
|
|
80
|
+
fi
|
|
81
|
+
fi
|
|
72
82
|
if [[ -z "${YUNXIAO_ACCESS_TOKEN:-}" ]]; then
|
|
73
83
|
echo "error: YUNXIAO_ACCESS_TOKEN is unavailable" >&2
|
|
74
84
|
exit 1
|
|
@@ -54,7 +54,7 @@ Then stop and wait. Do not run Git writes.
|
|
|
54
54
|
|
|
55
55
|
## Confirmation gate
|
|
56
56
|
|
|
57
|
-
Execute the commit phase only after an explicit reply such as
|
|
57
|
+
Execute the commit phase only after an explicit reply such as `确认`、`确认提交` or `确认提交并推送` that authorizes the latest proposal.
|
|
58
58
|
|
|
59
59
|
1. Re-check branch, status, and full diff.
|
|
60
60
|
2. Confirm the review scope did not change.
|