@bovinphang/frontend-craft 2.5.0
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/.claude-plugin/marketplace.json +61 -0
- package/.claude-plugin/plugin.json +32 -0
- package/.mcp.json +44 -0
- package/CHANGELOG.md +229 -0
- package/CHANGELOG.zh-CN.md +228 -0
- package/CODE_OF_CONDUCT.md +34 -0
- package/CODE_OF_CONDUCT.zh-CN.md +34 -0
- package/CONTRIBUTING.md +356 -0
- package/CONTRIBUTING.zh-CN.md +356 -0
- package/LICENSE +21 -0
- package/README.md +467 -0
- package/README.openclaw.md +262 -0
- package/README.openclaw.zh-CN.md +262 -0
- package/README.zh-CN.md +467 -0
- package/SECURITY.md +44 -0
- package/SECURITY.zh-CN.md +44 -0
- package/agents/fec-architect.md +125 -0
- package/agents/fec-code-reviewer.md +152 -0
- package/agents/fec-debugger.md +44 -0
- package/agents/fec-design-token-mapper.md +75 -0
- package/agents/fec-doc-updater.md +30 -0
- package/agents/fec-e2e-runner.md +107 -0
- package/agents/fec-figma-implementer.md +104 -0
- package/agents/fec-performance-optimizer.md +293 -0
- package/agents/fec-refactor-cleaner.md +32 -0
- package/agents/fec-security-reviewer.md +116 -0
- package/agents/fec-test-planner.md +50 -0
- package/agents/fec-typescript-reviewer.md +142 -0
- package/agents/fec-ui-checker.md +120 -0
- package/commands/fec-debug.md +30 -0
- package/commands/fec-doc-sync.md +18 -0
- package/commands/fec-init.md +70 -0
- package/commands/fec-plan.md +94 -0
- package/commands/fec-refactor-clean.md +19 -0
- package/commands/fec-review.md +66 -0
- package/commands/fec-scaffold.md +205 -0
- package/commands/fec-tdd.md +21 -0
- package/dist/bin/frontend-craft.js +82 -0
- package/dist/hooks/fec-cleanup-claude-cache.js +4 -0
- package/dist/hooks/fec-format-changed-file.js +1 -0
- package/dist/hooks/fec-notify.js +1 -0
- package/dist/hooks/fec-run-tests.js +1 -0
- package/dist/hooks/fec-security-check.js +2 -0
- package/dist/hooks/fec-session-start.js +1 -0
- package/docs/example-prompts.md +124 -0
- package/docs/ja-JP/README.md +467 -0
- package/docs/ko-KR/README.md +467 -0
- package/docs/project-structure.md +119 -0
- package/docs/runtimes/antigravity.md +10 -0
- package/docs/runtimes/augment.md +10 -0
- package/docs/runtimes/claude.md +171 -0
- package/docs/runtimes/claude.zh-CN.md +169 -0
- package/docs/runtimes/cline.md +10 -0
- package/docs/runtimes/codebuddy.md +10 -0
- package/docs/runtimes/codex.md +10 -0
- package/docs/runtimes/copilot.md +10 -0
- package/docs/runtimes/cursor.md +10 -0
- package/docs/runtimes/gemini.md +10 -0
- package/docs/runtimes/kilo.md +10 -0
- package/docs/runtimes/openclaw.md +10 -0
- package/docs/runtimes/opencode.md +10 -0
- package/docs/runtimes/qoder.md +19 -0
- package/docs/runtimes/trae.md +10 -0
- package/docs/runtimes/windsurf.md +10 -0
- package/docs/superpowers/plans/2026-05-29-fec-debug.md +491 -0
- package/docs/superpowers/specs/2026-05-29-fec-debug-design.md +340 -0
- package/docs/zh-CN/example-prompts.md +124 -0
- package/docs/zh-CN/project-structure.md +119 -0
- package/docs/zh-TW/README.md +467 -0
- package/hooks/hooks.json +71 -0
- package/openclaw.plugin.json +26 -0
- package/package.json +101 -0
- package/skills/TEMPLATE.md +155 -0
- package/skills/eval_queries.json +890 -0
- package/skills/fec-accessibility-check/SKILL.md +39 -0
- package/skills/fec-accessibility-check/references/report-template.md +23 -0
- package/skills/fec-accessibility-check/references/screen-reader-testing.md +33 -0
- package/skills/fec-api-integration/SKILL.md +78 -0
- package/skills/fec-api-integration/references/integration-patterns.md +80 -0
- package/skills/fec-browser-storage/SKILL.md +34 -0
- package/skills/fec-browser-storage/references/storage-patterns.md +65 -0
- package/skills/fec-canvas-threejs/SKILL.md +66 -0
- package/skills/fec-canvas-threejs/references/rendering-patterns.md +67 -0
- package/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +67 -0
- package/skills/fec-code-review/SKILL.md +135 -0
- package/skills/fec-code-review/references/report-template.md +29 -0
- package/skills/fec-component-testing/SKILL.md +119 -0
- package/skills/fec-data-fetching/SKILL.md +62 -0
- package/skills/fec-data-fetching/references/query-patterns.md +77 -0
- package/skills/fec-debug-framework/SKILL.md +162 -0
- package/skills/fec-dependency-upgrade/SKILL.md +34 -0
- package/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +56 -0
- package/skills/fec-doc-sync/SKILL.md +37 -0
- package/skills/fec-e2e-testing/SKILL.md +40 -0
- package/skills/fec-e2e-testing/references/e2e-advanced.md +176 -0
- package/skills/fec-e2e-testing/references/playwright-patterns.md +95 -0
- package/skills/fec-form-handling/SKILL.md +76 -0
- package/skills/fec-form-handling/references/advanced-form-patterns.md +72 -0
- package/skills/fec-implement-from-design/SKILL.md +122 -0
- package/skills/fec-implement-from-design/references/design-plan-template.md +36 -0
- package/skills/fec-legacy-to-modern-migration/SKILL.md +180 -0
- package/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +41 -0
- package/skills/fec-legacy-web-standard/SKILL.md +35 -0
- package/skills/fec-legacy-web-standard/references/legacy-patterns.md +85 -0
- package/skills/fec-list-virtualization/SKILL.md +34 -0
- package/skills/fec-list-virtualization/references/virtualization-patterns.md +52 -0
- package/skills/fec-monorepo-project-standard/SKILL.md +142 -0
- package/skills/fec-motion-interaction/SKILL.md +66 -0
- package/skills/fec-motion-interaction/references/motion-patterns.md +112 -0
- package/skills/fec-nextjs-project-standard/SKILL.md +117 -0
- package/skills/fec-nuxt-project-standard/SKILL.md +122 -0
- package/skills/fec-performance-optimization/SKILL.md +72 -0
- package/skills/fec-pwa-implementation/SKILL.md +36 -0
- package/skills/fec-pwa-implementation/references/manifest-and-icons.md +53 -0
- package/skills/fec-pwa-implementation/references/service-worker-workbox.md +68 -0
- package/skills/fec-react-project-standard/SKILL.md +83 -0
- package/skills/fec-react-project-standard/references/react-project-details.md +642 -0
- package/skills/fec-refactor-clean/SKILL.md +48 -0
- package/skills/fec-responsive-layout/SKILL.md +34 -0
- package/skills/fec-responsive-layout/references/responsive-layout-patterns.md +59 -0
- package/skills/fec-route-protection/SKILL.md +135 -0
- package/skills/fec-security-review/SKILL.md +38 -0
- package/skills/fec-security-review/references/report-template.md +27 -0
- package/skills/fec-security-review/references/security-checklist.md +64 -0
- package/skills/fec-source-driven-development/SKILL.md +61 -0
- package/skills/fec-state-management/SKILL.md +140 -0
- package/skills/fec-state-management/references/state-patterns.md +109 -0
- package/skills/fec-storybook-component-doc/SKILL.md +37 -0
- package/skills/fec-storybook-component-doc/references/story-patterns.md +118 -0
- package/skills/fec-svg-animation/SKILL.md +148 -0
- package/skills/fec-tailwind-design-system/SKILL.md +34 -0
- package/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +55 -0
- package/skills/fec-tdd-workflow/SKILL.md +52 -0
- package/skills/fec-testing-strategy/SKILL.md +45 -0
- package/skills/fec-typescript-type-safety/SKILL.md +157 -0
- package/skills/fec-typescript-type-safety/references/type-safety-patterns.md +102 -0
- package/skills/fec-ui-design/SKILL.md +90 -0
- package/skills/fec-ui-design/data/product-rules.json +110 -0
- package/skills/fec-ui-design/data/stack-ui-rules.json +14 -0
- package/skills/fec-ui-design/data/style-archetypes.json +74 -0
- package/skills/fec-ui-design/data/ux-quality-rules.json +56 -0
- package/skills/fec-ui-design/references/design-intelligence.md +37 -0
- package/skills/fec-ui-design/references/master-page-overrides.md +30 -0
- package/skills/fec-ui-design/references/pre-delivery-checklist.md +33 -0
- package/skills/fec-ui-design/scripts/design-system.mjs +530 -0
- package/skills/fec-validation-fix/SKILL.md +48 -0
- package/skills/fec-vite-project-standard/SKILL.md +83 -0
- package/skills/fec-vue3-project-standard/SKILL.md +49 -0
- package/skills/fec-vue3-project-standard/references/vue3-project-details.md +547 -0
- package/skills/fec-web-workers/SKILL.md +36 -0
- package/skills/fec-web-workers/references/advanced-workers.md +54 -0
- package/skills/fec-web-workers/references/basic-worker.md +67 -0
- package/skills/metadata.json +1422 -0
- package/skills/relations.json +644 -0
- package/templates/claude/CLAUDE.md +106 -0
- package/templates/claude/settings.json +62 -0
- package/templates/codex/AGENTS.md +105 -0
- package/templates/codex/config.toml +32 -0
- package/templates/openclaw/AGENTS.md +101 -0
- package/templates/openclaw/OPENCLAW-CONFIG.md +12 -0
- package/templates/shared/rules/fec-agent-workflow.md +54 -0
- package/templates/shared/rules/fec-api-layer.md +99 -0
- package/templates/shared/rules/fec-ci-cd.md +128 -0
- package/templates/shared/rules/fec-code-comments.md +33 -0
- package/templates/shared/rules/fec-design-system.md +248 -0
- package/templates/shared/rules/fec-error-handling.md +200 -0
- package/templates/shared/rules/fec-git-conventions.md +73 -0
- package/templates/shared/rules/fec-i18n.md +112 -0
- package/templates/shared/rules/fec-naming-conventions.md +120 -0
- package/templates/shared/rules/fec-performance.md +101 -0
- package/templates/shared/rules/fec-react.md +82 -0
- package/templates/shared/rules/fec-refactoring.md +43 -0
- package/templates/shared/rules/fec-rendering-patterns.md +183 -0
- package/templates/shared/rules/fec-responsive-design.md +227 -0
- package/templates/shared/rules/fec-source-driven-development.md +31 -0
- package/templates/shared/rules/fec-state-management.md +163 -0
- package/templates/shared/rules/fec-testing.md +98 -0
- package/templates/shared/rules/fec-typescript.md +355 -0
- package/templates/shared/rules/fec-vue.md +64 -0
- package/templates/shared/rules/fec-working-modes.md +50 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
# 贡献指南
|
|
2
|
+
|
|
3
|
+
> **English:** [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
4
|
+
|
|
5
|
+
感谢你对 `frontend-craft` 的关注。欢迎通过 Issue、Pull Request、文档修正、runtime 适配、示例补充等方式参与贡献。
|
|
6
|
+
|
|
7
|
+
## 开发环境
|
|
8
|
+
|
|
9
|
+
- Node.js >= 22,用于通用安装器与 OpenClaw 包构建。
|
|
10
|
+
- Git。
|
|
11
|
+
- 本地开发前运行 `npm install`。
|
|
12
|
+
|
|
13
|
+
常用校验:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm test
|
|
17
|
+
npm run pack:skills
|
|
18
|
+
npm run check:skills-publish
|
|
19
|
+
npm run typecheck:openclaw
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 项目结构
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
├── agents/ # Agent 定义(Markdown + YAML frontmatter)
|
|
26
|
+
├── bin/ # CLI 入口 (frontend-craft.ts)
|
|
27
|
+
├── commands/ # 自定义命令定义 (fec-init, fec-review, fec-scaffold)
|
|
28
|
+
├── docs/ # 各 runtime 安装文档与多语言 README
|
|
29
|
+
├── hooks/ # Hook 配置 (hooks.json)
|
|
30
|
+
├── scripts/ # 源码运行的维护脚本(构建、打包、发布校验)
|
|
31
|
+
├── skills/ # Skill 定义 (SKILL.md + metadata.json)
|
|
32
|
+
├── src/ # 源代码
|
|
33
|
+
│ ├── hooks/ # runtime hook 源码,打包到 dist/hooks/
|
|
34
|
+
│ ├── install/ # 安装器核心 (CLI、交互式向导、各 runtime 转换器)
|
|
35
|
+
│ └── openclaw/ # OpenClaw runtime TypeScript 源码
|
|
36
|
+
├── templates/ # 模板文件 (Claude/Codex/OpenClaw 配置 + 共享规则)
|
|
37
|
+
├── tests/ # 测试用例
|
|
38
|
+
│ ├── converters/ # 转换器测试
|
|
39
|
+
│ └── install/ # 安装器测试 (CLI、端到端、全 runtime dry-run)
|
|
40
|
+
└── package.json # 项目配置与脚本
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 本地开发与调试
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# 1. 安装依赖
|
|
47
|
+
npm install
|
|
48
|
+
|
|
49
|
+
# 2. 构建 dist/bin 与 dist/hooks
|
|
50
|
+
npm run build
|
|
51
|
+
|
|
52
|
+
# 3. 本地安装到指定 runtime(如 claude)
|
|
53
|
+
node dist/bin/frontend-craft.js install claude --local --dry-run # 先 dry-run 预览
|
|
54
|
+
node dist/bin/frontend-craft.js install claude --local # 实际安装
|
|
55
|
+
|
|
56
|
+
# 4. 安装到所有 runtime
|
|
57
|
+
node dist/bin/frontend-craft.js install --all --dry-run
|
|
58
|
+
|
|
59
|
+
# 5. 列出所有支持的 runtime
|
|
60
|
+
node dist/bin/frontend-craft.js list
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`npm run build` 会依次运行 `clean`、`typecheck` 和 `scripts/build-dist.ts`。本地使用 `dist/bin/frontend-craft.js` 或打包后的 hook 脚本前,请先运行它。
|
|
64
|
+
|
|
65
|
+
## 测试指南
|
|
66
|
+
|
|
67
|
+
测试使用 Node.js 内置 `node:test` + `assert/strict`。
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# 运行所有测试
|
|
71
|
+
npm test
|
|
72
|
+
|
|
73
|
+
# 运行单个测试文件
|
|
74
|
+
node --import tsx --test tests/install/cli.test.ts
|
|
75
|
+
|
|
76
|
+
# 运行安装器相关测试
|
|
77
|
+
node --import tsx --test tests/install/*.test.ts
|
|
78
|
+
|
|
79
|
+
# 运行转换器相关测试
|
|
80
|
+
node --import tsx --test tests/converters/*.test.ts
|
|
81
|
+
|
|
82
|
+
# 运行全 runtime dry-run 测试
|
|
83
|
+
node --import tsx --test tests/install/all-runtimes-dry.test.ts
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
测试交互式安装向导时,设置 `FRONTEND_CRAFT_FORCE_INTERACTIVE=1` 环境变量:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
FRONTEND_CRAFT_FORCE_INTERACTIVE=1 node --import tsx --test tests/install/cli.test.ts
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`npm test` 会先运行 `npm run build`,再通过 `tsx` 执行 `tests/` 下精选的 converter 与 installer 测试。
|
|
93
|
+
|
|
94
|
+
## OpenClaw 构建流程
|
|
95
|
+
|
|
96
|
+
OpenClaw runtime 有独立的构建管线:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm run build:openclaw # 使用 esbuild 将 TypeScript 打包到 dist/openclaw/
|
|
100
|
+
npm run typecheck:openclaw # TypeScript 类型检查
|
|
101
|
+
npm run check:openclaw-dist # 验证 dist 完整性
|
|
102
|
+
npm run pack:openclaw # 完整构建 + 验证 + 打包
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
源码路径:`src/openclaw/`(TypeScript)→ `dist/openclaw/index.js`(打包后的 ESM)。
|
|
106
|
+
TypeScript 配置:`tsconfig.openclaw.json`。
|
|
107
|
+
|
|
108
|
+
## 独立 Skill 发布包
|
|
109
|
+
|
|
110
|
+
Skill 的权威源文件位于 `skills/<skill-id>/`。不要手动修改 `skill-packages/` 下的生成产物。
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm run pack:skills # 为每个 skill 生成独立发布包
|
|
114
|
+
npm run check:skills-publish # 校验包元数据、索引和引用文件
|
|
115
|
+
npm run pack:all # 完整测试 + OpenClaw 包 + 独立 skill 包
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`npm run pack:skills` 会生成 `skill-packages/<skill-id>/`,其中包含 `SKILL.md`、该 skill 实际引用的 `references/` 文件、`metadata.json`、`package.json`、`README.md` 和 `LICENSE`。同时会生成 `skill-packages/index.json`,供平台索引或发布自动化使用。
|
|
119
|
+
|
|
120
|
+
修改 skill 时,请保持这些源文件一致:
|
|
121
|
+
|
|
122
|
+
- `skills/<skill-id>/SKILL.md` — runtime 使用的权威说明。
|
|
123
|
+
- `skills/metadata.json` — 发布元数据、分类、标签、关键词、目标平台和包版本。
|
|
124
|
+
- `skills/eval_queries.json` — 用于路由质量检查的正向/负向触发样例。
|
|
125
|
+
- 当公开 skill 列表或用户可见行为变化时,同步 `README.md` 和各语言 README 摘要。
|
|
126
|
+
|
|
127
|
+
## npm scripts
|
|
128
|
+
|
|
129
|
+
请把 `package.json` scripts 作为公开的开发入口。
|
|
130
|
+
|
|
131
|
+
| Script | 用途 |
|
|
132
|
+
| ------------------------------ | -------------------------------------------------------------------------- |
|
|
133
|
+
| `npm run clean` | 删除 `dist/`。 |
|
|
134
|
+
| `npm run typecheck` | 使用 `tsconfig.json` 对主项目做 TypeScript 类型检查。 |
|
|
135
|
+
| `npm run build` | 运行 `clean`、`typecheck`,并通过 `scripts/build-dist.ts` 打包 CLI/hooks。 |
|
|
136
|
+
| `npm test` | 先构建,再通过 `tsx` 运行精选的 `node:test` 测试集。 |
|
|
137
|
+
| `npm run build:openclaw` | 构建主项目,然后打包 OpenClaw runtime 输出。 |
|
|
138
|
+
| `npm run audit:skills` | 构建后输出 skill 说明长度与描述重叠度信号。 |
|
|
139
|
+
| `npm run typecheck:openclaw` | 使用 `tsconfig.openclaw.json` 检查 OpenClaw 类型。 |
|
|
140
|
+
| `npm run check:openclaw-dist` | 校验生成的 OpenClaw dist 输出。 |
|
|
141
|
+
| `npm run pack:openclaw` | 构建、校验并打包 OpenClaw 插件。 |
|
|
142
|
+
| `npm run pack:skills` | 在 `skill-packages/` 下生成独立 skill 包。 |
|
|
143
|
+
| `npm run check:skills-publish` | 构建后校验独立 skill 包元数据与复制文件。 |
|
|
144
|
+
| `npm run pack:all` | 运行测试、打包 OpenClaw、打包 skills,并校验 skill 发布产物。 |
|
|
145
|
+
| `npm run sync:version` | 同步发布清单中的 package 版本元数据。 |
|
|
146
|
+
| `npm run version` | 运行 `sync:version`,并为 npm version 工作流暂存版本清单。 |
|
|
147
|
+
| `npm run prepack` | 在 `npm pack` 前构建。 |
|
|
148
|
+
| `npm run prepublishOnly` | 在 npm publish 前同步版本并运行测试。 |
|
|
149
|
+
|
|
150
|
+
常见变更类型建议:
|
|
151
|
+
|
|
152
|
+
- Skill 变更:运行 `npm test`、`npm run audit:skills`、`npm run pack:skills` 和 `npm run check:skills-publish`。
|
|
153
|
+
- OpenClaw 变更:运行 `npm run typecheck:openclaw` 和 `npm run pack:openclaw`。
|
|
154
|
+
- 发布打包:运行 `npm run pack:all`;`prepublishOnly` 也会在发布前执行版本同步和测试。
|
|
155
|
+
|
|
156
|
+
## 源码维护脚本
|
|
157
|
+
|
|
158
|
+
维护脚本位于 `scripts/`,通过 `tsx` 直接运行源码;它们不会以 `dist/scripts` 形式发布。
|
|
159
|
+
|
|
160
|
+
| 文件 | 用途 |
|
|
161
|
+
| ------------------------------------------ | ------------------------------ |
|
|
162
|
+
| `scripts/audit-skills.ts` | Skill 大小与触发描述重叠度审计 |
|
|
163
|
+
| `scripts/build-dist.ts` | CLI 与 runtime hook 打包 |
|
|
164
|
+
| `scripts/sync-codex-agents-toml.ts` | 同步 Codex agents 配置 |
|
|
165
|
+
| `scripts/sync-version.ts` | 同步发布版本元数据 |
|
|
166
|
+
| `scripts/pack-skills.ts` | 独立 skill 包构建 |
|
|
167
|
+
| `scripts/check-skills-publish.ts` | 独立 skill 包校验 |
|
|
168
|
+
| `scripts/skill-packaging.ts` | skill 打包共享辅助函数 |
|
|
169
|
+
| `scripts/openclaw/build.ts` | OpenClaw esbuild 打包 |
|
|
170
|
+
| `scripts/openclaw/pack-openclaw.ts` | OpenClaw 打包 |
|
|
171
|
+
| `scripts/openclaw/verify-openclaw-dist.ts` | 验证 OpenClaw dist 完整性 |
|
|
172
|
+
|
|
173
|
+
## Runtime Hook 脚本
|
|
174
|
+
|
|
175
|
+
Hook 脚本位于 `src/hooks/`,发布时会打包到 `dist/hooks/` 供 runtime 使用。维护脚本位于 `scripts/`,通过 `tsx` 直接运行源码,不再发布为 `dist/scripts`。
|
|
176
|
+
|
|
177
|
+
| 源文件 | 打包输出 | 用途 |
|
|
178
|
+
| ---------------------------------- | ----------------------------------- | -------------- |
|
|
179
|
+
| `src/hooks/run-tests.ts` | `dist/hooks/run-tests.js` | 测试运行辅助 |
|
|
180
|
+
| `src/hooks/format-changed-file.ts` | `dist/hooks/format-changed-file.js` | 格式化变更文件 |
|
|
181
|
+
| `src/hooks/security-check.ts` | `dist/hooks/security-check.js` | 安全检查 |
|
|
182
|
+
| `src/hooks/notify.ts` | `dist/hooks/notify.js` | 通知脚本 |
|
|
183
|
+
| `src/hooks/session-start.ts` | `dist/hooks/session-start.js` | 会话初始化 |
|
|
184
|
+
|
|
185
|
+
## 架构概览
|
|
186
|
+
|
|
187
|
+
通用安装器的架构如下:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
bin/frontend-craft.ts
|
|
191
|
+
└─ src/install/cli.ts # CLI 入口(解析命令:install/list/version/uninstall)
|
|
192
|
+
├─ src/install/registry.ts # runtime 注册表(名称 + 安装器映射)
|
|
193
|
+
├─ src/install/converters/ # 各 runtime 适配器(claude, codex, cursor, copilot 等)
|
|
194
|
+
├─ src/install/interactive.ts # 交互式安装向导(runtime/位置选择)
|
|
195
|
+
├─ src/install/runtime-homes.ts # 全局/本地目录约定
|
|
196
|
+
└─ src/install/types.ts # 共享 TypeScript 类型
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`src/install/converters/` 下的每个 runtime 转换器都实现了 `types.ts` 中定义的 `InstallContext` 接口,将 skills、agents、commands、hooks 和模板写入目标 runtime 的配置目录。
|
|
200
|
+
|
|
201
|
+
## 分支策略
|
|
202
|
+
|
|
203
|
+
- `main` — 稳定发布分支。
|
|
204
|
+
- `develop` — 开发分支(如使用)。
|
|
205
|
+
- `feature/<name>` — 新功能。
|
|
206
|
+
- `fix/<name>` — Bug 修复。
|
|
207
|
+
- `docs/<name>` — 文档更新。
|
|
208
|
+
|
|
209
|
+
## 提交规范
|
|
210
|
+
|
|
211
|
+
遵循 [Conventional Commits](https://www.conventionalcommits.org/):
|
|
212
|
+
|
|
213
|
+
```text
|
|
214
|
+
<type>(<scope>): <description>
|
|
215
|
+
|
|
216
|
+
[optional body]
|
|
217
|
+
[optional footer]
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
常见类型:
|
|
221
|
+
|
|
222
|
+
| Type | 含义 |
|
|
223
|
+
| ---------- | ---------------- |
|
|
224
|
+
| `feat` | 新功能 |
|
|
225
|
+
| `fix` | Bug 修复 |
|
|
226
|
+
| `docs` | 文档 |
|
|
227
|
+
| `refactor` | 重构 |
|
|
228
|
+
| `test` | 测试 |
|
|
229
|
+
| `chore` | 构建、工具或维护 |
|
|
230
|
+
|
|
231
|
+
示例:
|
|
232
|
+
|
|
233
|
+
```text
|
|
234
|
+
feat(skills): add e2e testing skill
|
|
235
|
+
fix(hooks): resolve Windows path handling
|
|
236
|
+
docs(readme): update installation steps
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## 语言与文档策略
|
|
240
|
+
|
|
241
|
+
英文是公开项目治理、runtime 文档、发布说明和 GitHub 协作模板的**源语言**。多语言 README 应聚焦用户向摘要,并在贡献者或维护者细节上链接回英文文档。
|
|
242
|
+
|
|
243
|
+
当 Pull Request 修改公共行为、安装步骤、runtime、agent、skill、command 或 hook 时:
|
|
244
|
+
|
|
245
|
+
- 优先更新 `README.md` 与 `CHANGELOG.md`(及对应的 [CHANGELOG.zh-CN.md](CHANGELOG.zh-CN.md) 若需同步中文读者)。
|
|
246
|
+
- 若影响用户,需同步 `README.zh-CN.md`、`docs/zh-TW/README.md`、`docs/ja-JP/README.md` 和 `docs/ko-KR/README.md` 中的用户向摘要。
|
|
247
|
+
- Claude Code Marketplace 的安装与更新说明以 [`docs/runtimes/claude.md`](docs/runtimes/claude.md) 与 [`docs/runtimes/claude.zh-CN.md`](docs/runtimes/claude.zh-CN.md) 为准;修改该流程时请更新这两份文件(根 README 与各语言 README 仅链向它们)。
|
|
248
|
+
- 若同一 PR 无法完成翻译,请创建或链接后续 Issue,并在 PR 描述中说明。
|
|
249
|
+
- 各语言版本中的代码示例、runtime 名称、命令名、文件路径和包名应保持一致。
|
|
250
|
+
|
|
251
|
+
Issue 与 PR 使用英文最便于全球社区检索与 Review。若你更习惯中文,也欢迎提交;维护者可协助翻译标题和摘要。
|
|
252
|
+
|
|
253
|
+
## 如何添加 Skill
|
|
254
|
+
|
|
255
|
+
1. 在 `skills/` 下创建目录,例如 `skills/fec-my-skill/`。
|
|
256
|
+
2. 创建 `SKILL.md`,包含 YAML frontmatter 与简洁说明:
|
|
257
|
+
|
|
258
|
+
```markdown
|
|
259
|
+
---
|
|
260
|
+
name: fec-my-skill
|
|
261
|
+
description: Use when the user needs ...
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
# Skill Title
|
|
265
|
+
|
|
266
|
+
## When to Use
|
|
267
|
+
|
|
268
|
+
- ...
|
|
269
|
+
|
|
270
|
+
## Core Rules
|
|
271
|
+
|
|
272
|
+
- ...
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
3. 在 `skills/metadata.json` 中新增条目,包括 `id`、展示名称 `name`、分类 `category`、`tags`、`summary`、发布元数据、`keywords` 和 `platforms`。其中 `version`、`license`、`homepage`、`repository` 应与 `package.json` 保持一致。
|
|
276
|
+
4. 在 `skills/eval_queries.json` 中补充正向和负向触发样例。
|
|
277
|
+
5. 在 `README.md` 的 Skills 表格中新增一行。
|
|
278
|
+
6. 若可见目录结构变化,同步 `README.md` 与各语言 README 的目录树。
|
|
279
|
+
7. 运行 `npm test`、`npm run pack:skills` 和 `npm run check:skills-publish`。
|
|
280
|
+
|
|
281
|
+
## 如何添加 Agent
|
|
282
|
+
|
|
283
|
+
1. 创建 `agents/my-agent.md`。
|
|
284
|
+
2. 定义 YAML frontmatter:
|
|
285
|
+
|
|
286
|
+
```markdown
|
|
287
|
+
---
|
|
288
|
+
name: my-agent
|
|
289
|
+
description: Use this agent when ...
|
|
290
|
+
tools: Read, Edit, Write, Glob, Grep, Bash
|
|
291
|
+
model: sonnet
|
|
292
|
+
skills:
|
|
293
|
+
- relevant-skill
|
|
294
|
+
---
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
3. 在 `README.md` 的 Agents 表格中新增一行。
|
|
298
|
+
4. 当数量或用户向描述变化时,同步 `README.zh-CN.md`、`docs/*/README.md` 与 `.claude-plugin/marketplace.json`。
|
|
299
|
+
|
|
300
|
+
## 如何添加 Command
|
|
301
|
+
|
|
302
|
+
1. 创建 `commands/my-command.md`。
|
|
303
|
+
2. 使用 YAML frontmatter 与 Markdown 描述执行步骤。
|
|
304
|
+
3. 在 `README.md` 的 Commands 表格中新增一行,并按需同步多语言用户向摘要。
|
|
305
|
+
|
|
306
|
+
## 如何添加 Rule 模板
|
|
307
|
+
|
|
308
|
+
1. 在 `templates/shared/rules/` 下创建 `my-rule.md`。
|
|
309
|
+
2. 在 `commands/fec-init.md` 的复制清单中新增该文件。
|
|
310
|
+
3. 在 `templates/claude/CLAUDE.md` 的规则导入示例中补充(如适用)。
|
|
311
|
+
|
|
312
|
+
## 多工具安装器
|
|
313
|
+
|
|
314
|
+
- 入口:`bin/frontend-craft.ts`。
|
|
315
|
+
- 实现目录:`src/install/`(安装器、注册表、路径辅助)。
|
|
316
|
+
- 交互向导与输入解析:`src/install/interactive.ts`(测试可将 `FRONTEND_CRAFT_FORCE_INTERACTIVE` 设为 `1` 以模拟管道输入下的问答)。
|
|
317
|
+
- 新增 runtime 时,在 `src/install/registry.ts` 注册。
|
|
318
|
+
- 在 `src/install/converters/` 下添加 runtime 安装器。
|
|
319
|
+
- 参考 `src/install/runtime-homes.ts` 中的全局目录约定。
|
|
320
|
+
- 在 `tests/install/` 中新增或更新测试。
|
|
321
|
+
|
|
322
|
+
## 如何添加 Hook
|
|
323
|
+
|
|
324
|
+
1. 更新 `hooks/hooks.json`。
|
|
325
|
+
2. 如需 runtime hook 脚本,放在 `src/hooks/` 下,并优先使用跨平台 Node.js。
|
|
326
|
+
3. 在 `scripts/build-dist.ts` 中新增对应入口,确保 `npm run build` 会将其打包到 `dist/hooks/`。
|
|
327
|
+
4. 在 `hooks/hooks.json` 中,引用内置 hook 入口请使用 **`${CLAUDE_PLUGIN_ROOT}/dist/hooks/<script>.js`**(Claude Code 会在运行时替换根路径;见官方 [Plugins reference](https://code.claude.com/docs/en/plugins-reference))。本仓库的 Claude 安装器在将 `hooks.json` 写入 `.claude/` 时,也会把 **`${CLAUDE_PLUGIN_ROOT}`** 及旧占位符 **`${FRONTEND_CRAFT_ROOT}`** 展开为绝对路径。
|
|
328
|
+
5. 仓库维护脚本继续放在 `scripts/`,不要在 runtime hook 配置中直接引用它们。
|
|
329
|
+
6. 更新 `README.md` 的 Hooks 表格。
|
|
330
|
+
|
|
331
|
+
## Pull Request 自检
|
|
332
|
+
|
|
333
|
+
提交 PR 前请确认:
|
|
334
|
+
|
|
335
|
+
- [ ] 变更范围清晰,描述明确。
|
|
336
|
+
- [ ] `npm test` 通过。
|
|
337
|
+
- [ ] 修改 skill 时,`npm run audit:skills`、`npm run pack:skills` 与 `npm run check:skills-publish` 通过。
|
|
338
|
+
- [ ] 修改 OpenClaw 代码或模板时,`npm run typecheck:openclaw` 与 `npm run pack:openclaw` 通过。
|
|
339
|
+
- [ ] 用户可见行为变化已更新 `README.md` 与 `CHANGELOG.md`(及 [CHANGELOG.zh-CN.md](CHANGELOG.zh-CN.md) 如适用)。
|
|
340
|
+
- [ ] 多语言 README 已同步,或已链接后续翻译 Issue。
|
|
341
|
+
- [ ] 新增 runtime、agent、skill、command、hook 或模板时,包含相关测试或 dry-run 覆盖。
|
|
342
|
+
- [ ] 发布打包相关变更已通过 `npm run pack:all`,或已由 `prepublishOnly` 发布门禁覆盖。
|
|
343
|
+
- [ ] 涉及安全敏感逻辑时,已按 [SECURITY.zh-CN.md](SECURITY.zh-CN.md) / [SECURITY.md](SECURITY.md) 检查。
|
|
344
|
+
|
|
345
|
+
## 代码风格
|
|
346
|
+
|
|
347
|
+
- Markdown 使用稳定标题和清晰表格。
|
|
348
|
+
- Skill 与 Agent 描述保持简洁,因为模型路由依赖这些描述。
|
|
349
|
+
- 自动化脚本优先使用跨平台 Node.js。
|
|
350
|
+
- 除非特定 runtime 明确需要,否则避免依赖某个 shell 的特性。
|
|
351
|
+
|
|
352
|
+
## 问题反馈
|
|
353
|
+
|
|
354
|
+
使用 [GitHub Issues](https://github.com/bovinphang/frontend-craft/issues) 提交 Bug 或功能建议。请尽量包含 runtime、操作系统、Node.js 版本、执行命令、预期行为和实际行为。
|
|
355
|
+
|
|
356
|
+
**安全敏感漏洞**不要提交公开 Issue,请按 [SECURITY.zh-CN.md](SECURITY.zh-CN.md)(或 [SECURITY.md](SECURITY.md))处理。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Bovin Phang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|