@nick848/fet 1.1.7 → 1.1.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/README.md +116 -12
- package/README_en.md +114 -12
- package/dist/cli/index.js +1013 -133
- package/dist/cli/index.js.map +1 -1
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# FET
|
|
2
2
|
|
|
3
|
-
[中文](
|
|
3
|
+
[中文](https://unpkg.com/@nick848/fet/README.md) | [English](https://unpkg.com/@nick848/fet/README_en.md)
|
|
4
|
+
|
|
5
|
+
> npm 包页只展示 `README.md`,站内 `./README_en.md` 等相对链接会 404。请用上方 **unpkg** 链接打开同 npm 包内的另一份文档;源码仓库见 [Gitee](https://gitee.com/agent-team/fet)。
|
|
4
6
|
|
|
5
7
|
FET 是一个围绕 OpenSpec 构建的前端开发工作流编排 CLI。它不会直接生成业务代码,而是代理 OpenSpec 命令、维护本地工作流状态、生成可审计的项目上下文,并帮助 Cursor、Codex 等 AI 编程工具读取正确的项目资料。
|
|
6
8
|
|
|
@@ -13,7 +15,9 @@ FET 是一个围绕 OpenSpec 构建的前端开发工作流编排 CLI。它不
|
|
|
13
15
|
- 统一语言:默认使用中文输出交互信息和生成产物,可通过 `--lang <language>` 切换。
|
|
14
16
|
- 保护关键阶段:在 `sync` / `archive` 前检查 FET verify 状态,降低未验证变更被合入或归档的风险。
|
|
15
17
|
- 可选代码图:可接入 GitNexus,在大范围扫描前优先提供结构化代码上下文。
|
|
16
|
-
- Figma 守卫:当 change 产物含 Figma
|
|
18
|
+
- Figma 守卫:当 change 产物含 Figma 链接时,自动写入 `figma-apply-instructions.md`(apply 前必读稿)与 `figma-stop.md`(读稿失败则停下问用户,禁止猜样式)。
|
|
19
|
+
- UI 展示契约:当 change 含 Figma 和/或接口文档引用时,生成 `ui-display-contract.yaml` 草案与 `ui-field-apply-instructions.md`;规划 spec 须写入「仅展示 displayFields」Requirement,避免按 OpenAPI 全量渲染。
|
|
20
|
+
- Spec 分层双语:英文 Requirements/Scenario 为权威,每个 Requirement 配 `<!-- 中文:... -->`;LLM 更新 spec 时须同次编辑同步中文说明(见 `fet.specLanguage` 与 `.cursor/rules/fet-spec-language.mdc`)。
|
|
17
21
|
|
|
18
22
|
## 基本原理
|
|
19
23
|
|
|
@@ -43,31 +47,127 @@ npm install -g @nick848/fet
|
|
|
43
47
|
```sh
|
|
44
48
|
fet --version
|
|
45
49
|
fet --help
|
|
50
|
+
fet update
|
|
46
51
|
```
|
|
47
52
|
|
|
48
|
-
##
|
|
53
|
+
## 第一次使用(推荐顺序)
|
|
54
|
+
|
|
55
|
+
以下流程面向**第一次在业务项目中接入 FET** 的场景。请在你希望接入 OpenSpec 的**项目根目录**(含 `package.json` 或业务源码的目录)执行,而不是在 FET 工具仓库自身目录。
|
|
56
|
+
|
|
57
|
+
### 步骤 1:安装依赖工具
|
|
58
|
+
|
|
59
|
+
1. 安装 [OpenSpec CLI](https://github.com/Fission-AI/OpenSpec)(全局):
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm install -g @fission-ai/openspec
|
|
63
|
+
openspec --version
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. 安装 FET(全局):
|
|
49
67
|
|
|
50
|
-
|
|
68
|
+
```sh
|
|
69
|
+
npm install -g @nick848/fet
|
|
70
|
+
fet --version
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 步骤 2:初始化项目
|
|
74
|
+
|
|
75
|
+
在业务项目根目录执行:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
fet init --yes
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`fet init` 会:
|
|
82
|
+
|
|
83
|
+
- 检测 OpenSpec;若项目尚无 `openspec/`,则调用 `openspec init`
|
|
84
|
+
- 扫描仓库并生成 `AGENTS.md`、`openspec/config.yaml` 的 `fet:` 配置
|
|
85
|
+
- 写入 `openspec/fet-state.json` 等工作流状态
|
|
86
|
+
- 为 **Cursor**、**Codex** 生成 Skill / 规则 / 命令指南(见下文「在 IDE 中使用」)
|
|
87
|
+
- 可选检测 GitNexus(未安装仅提示一次,不阻断)
|
|
88
|
+
|
|
89
|
+
需要英文产物时,可在初始化时指定:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
fet init --yes --lang en
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 步骤 3:检查环境
|
|
51
96
|
|
|
52
97
|
```sh
|
|
53
|
-
fet init
|
|
54
|
-
fet fill-context
|
|
55
98
|
fet doctor
|
|
56
99
|
```
|
|
57
100
|
|
|
58
|
-
|
|
101
|
+
确认 OpenSpec 路径、上下文文件、工具集成无 `fail`。若有锁文件残留,可执行 `fet doctor --fix-lock`。
|
|
102
|
+
|
|
103
|
+
### 步骤 4:补齐项目上下文(与 IDE 协作)
|
|
104
|
+
|
|
105
|
+
扫描器无法自动推断的内容会在 `AGENTS.md` 中标记为 `[NEEDS LLM INPUT]`。请执行:
|
|
59
106
|
|
|
60
107
|
```sh
|
|
61
|
-
fet
|
|
62
|
-
|
|
63
|
-
|
|
108
|
+
fet fill-context
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
然后在 **Cursor** 或 **Codex** 中按生成的 handoff 说明(如 `.fet/fill-context.md`、`.cursor/skills/fet-fill-context/SKILL.md`)让 AI 协助补全占位符。补全后再次运行 `fet doctor`,占位符相关项应为通过。
|
|
112
|
+
|
|
113
|
+
### 步骤 5:(可选)配置代码图
|
|
114
|
+
|
|
115
|
+
若希望 AI 在大范围扫仓库前先读结构化代码图,请先安装 GitNexus CLI(确保 `gitnexus` 在 PATH 中),再执行:
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
fet graph setup # 生成安装引导,FET 不会自动安装 GitNexus
|
|
119
|
+
fet graph init # 首次构建图谱
|
|
120
|
+
fet graph handoff # 生成 IDE 交接说明
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 步骤 6:在 IDE 中使用
|
|
124
|
+
|
|
125
|
+
初始化完成后,建议在 AI 工具中确认以下资料可被读取:
|
|
126
|
+
|
|
127
|
+
| 工具 | 主要入口 |
|
|
128
|
+
|------|----------|
|
|
129
|
+
| Cursor | `.cursor/rules/fet-context.mdc`;`.cursor/skills/fet-*/SKILL.md` |
|
|
130
|
+
| Codex | `.codex/fet/context.md`;`$CODEX_HOME/prompts/fet-*.md` |
|
|
131
|
+
|
|
132
|
+
工作流命令请在**终端**执行 `fet <command>`(例如 `fet apply`),不要绕过 FET 直接调用 `openspec`,否则本地状态与 verify 闸门不会更新。
|
|
133
|
+
|
|
134
|
+
### 步骤 7:完成第一个 change
|
|
135
|
+
|
|
136
|
+
初始化无误后,按 OpenSpec 工作流创建并落地第一个变更。简单路径示例:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
fet propose my-first-change
|
|
140
|
+
# 或在 Cursor/Codex 中按提示逐步执行 fet continue
|
|
141
|
+
fet apply --change my-first-change
|
|
142
|
+
fet verify --change my-first-change
|
|
143
|
+
fet verify --done --change my-first-change
|
|
144
|
+
fet sync --change my-first-change
|
|
145
|
+
fet archive --change my-first-change
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
复杂路径可先 `fet new <id>`,再多次 `fet continue` 或 `fet ff`。各阶段说明见下文「日常变更流程」。
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 日常变更流程
|
|
153
|
+
|
|
154
|
+
在已完成「第一次使用」的项目中,典型循环为:
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
fet new my-change # 或 fet propose my-change
|
|
158
|
+
fet continue # 按需重复,生成下一规划产物
|
|
159
|
+
fet apply --change my-change
|
|
64
160
|
fet verify --change my-change
|
|
65
161
|
fet verify --done --change my-change
|
|
66
|
-
fet sync
|
|
162
|
+
fet sync --change my-change
|
|
67
163
|
fet archive --change my-change
|
|
68
164
|
```
|
|
69
165
|
|
|
70
|
-
|
|
166
|
+
说明:
|
|
167
|
+
|
|
168
|
+
- `continue`、`apply`、`ff`、`sync` 等命令在未传 `--change` 时,优先使用 FET 记录的 **active change**;若仅有一个打开的 change,会自动选中。
|
|
169
|
+
- 经 FET 执行的 `sync` / `archive` 会先检查是否已 `fet verify --done`。
|
|
170
|
+
- 项目结构变化后运行 `fet update-context`;仅刷新 IDE 占位符提示时运行 `fet fill-context`。
|
|
71
171
|
|
|
72
172
|
## 语言设置
|
|
73
173
|
|
|
@@ -114,6 +214,7 @@ fet init --lang en
|
|
|
114
214
|
| 命令 | 用法 | 说明 |
|
|
115
215
|
|------|------|------|
|
|
116
216
|
| `fet init` | `fet init [--yes] [--lang <language>]` | 初始化 FET 和 OpenSpec;生成上下文、状态、Cursor 集成和 Codex 工作流指南。 |
|
|
217
|
+
| `fet update` | `fet update` | 检查 npm 上的新版本并在需要时自动升级 FET。 |
|
|
117
218
|
| `fet update-context` | `fet update-context [--yes]` | 重新扫描项目并更新 `AGENTS.md` 与 `openspec/config.yaml` 的 FET 托管区域。 |
|
|
118
219
|
| `fet fill-context` | `fet fill-context [--yes]` | 刷新 IDE 交接命令;自动识别小程序工程并写入包体积/2MB 约束,引导 AI 补齐其余 `AGENTS.md` 占位符。 |
|
|
119
220
|
| `fet doctor` | `fet doctor [--fix-lock]` | 诊断 OpenSpec、FET 状态、上下文文件、工具集成和锁文件。 |
|
|
@@ -178,10 +279,13 @@ FET 可能创建或更新:
|
|
|
178
279
|
- `.cursor/skills/fet-*/SKILL.md`
|
|
179
280
|
- `.cursor/rules/fet-context.mdc`
|
|
180
281
|
- `.cursor/rules/fet-figma-stop.mdc`
|
|
282
|
+
- `.cursor/rules/fet-spec-language.mdc`
|
|
181
283
|
- `.cursor/rules/karpathy-guidelines.mdc`
|
|
182
284
|
- `.codex/fet/context.md`
|
|
183
285
|
- `.codex/fet/figma-stop.md`
|
|
286
|
+
- `.codex/fet/spec-language.md`
|
|
184
287
|
- `.codex/fet/karpathy-guidelines.md`
|
|
288
|
+
- `openspec/changes/<change-id>/.fet/figma-apply-instructions.md`(apply 时含 Figma 链接则写入,实施 UI 前必读)
|
|
185
289
|
- `openspec/changes/<change-id>/.fet/figma-stop.md`(change 含 Figma 链接时自动写入)
|
|
186
290
|
- `.codex/fet/commands/*.md`
|
|
187
291
|
- `$CODEX_HOME/prompts/fet-*.md`
|
package/README_en.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# FET
|
|
2
2
|
|
|
3
|
-
[中文](
|
|
3
|
+
[中文](https://unpkg.com/@nick848/fet/README.md) | [English](https://unpkg.com/@nick848/fet/README_en.md)
|
|
4
|
+
|
|
5
|
+
> The npm package page only renders `README.md`; relative links such as `./README_en.md` return 404. Use the **unpkg** links above to open the other file from the same npm package. Source repo: [Gitee](https://gitee.com/agent-team/fet).
|
|
4
6
|
|
|
5
7
|
FET is a frontend development workflow orchestration CLI built around OpenSpec. It does not generate business code directly. Instead, it proxies OpenSpec commands, maintains local workflow state, generates auditable project context, and helps AI coding tools such as Cursor and Codex load the right project material.
|
|
6
8
|
|
|
@@ -13,7 +15,9 @@ FET is a frontend development workflow orchestration CLI built around OpenSpec.
|
|
|
13
15
|
- Unifies language: Chinese is the default for interaction messages and generated artifacts; use `--lang <language>` to switch.
|
|
14
16
|
- Guards critical stages: checks FET verification state before `sync` / `archive`.
|
|
15
17
|
- Supports optional code graphs: integrates with GitNexus so AI tools can prefer structured code context before broad repository scans.
|
|
16
|
-
- Figma guard: when a change references Figma, FET writes
|
|
18
|
+
- Figma guard: when a change references Figma, FET writes `figma-apply-instructions.md` (read design before UI work on apply) and `figma-stop.md` (stop and ask the user when Figma cannot be read—no guessed styles).
|
|
19
|
+
- Layered bilingual specs: English Requirements/Scenario stay canonical; each Requirement gets a `<!-- 中文:... -->` note. LLM edits must refresh Chinese notes in the same edit (`fet.specLanguage`, `.cursor/rules/fet-spec-language.mdc`).
|
|
20
|
+
- UI display contract: when a change references Figma and/or API docs, FET writes `ui-display-contract.yaml` (draft) and `ui-field-apply-instructions.md`; planning specs must include a Requirement that only `displayFields` may render—OpenAPI must not drive full UI field lists.
|
|
17
21
|
|
|
18
22
|
## How It Works
|
|
19
23
|
|
|
@@ -46,29 +50,124 @@ fet --help
|
|
|
46
50
|
fet update
|
|
47
51
|
```
|
|
48
52
|
|
|
49
|
-
##
|
|
53
|
+
## First-Time Setup (Recommended Order)
|
|
54
|
+
|
|
55
|
+
This section is for **bringing FET into a business project for the first time**. Run commands in the **project root** you want OpenSpec to manage (where your app source lives), not inside the FET tool repository itself.
|
|
56
|
+
|
|
57
|
+
### Step 1: Install required tools
|
|
58
|
+
|
|
59
|
+
1. Install the [OpenSpec CLI](https://github.com/Fission-AI/OpenSpec) globally:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm install -g @fission-ai/openspec
|
|
63
|
+
openspec --version
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. Install FET globally:
|
|
50
67
|
|
|
51
|
-
|
|
68
|
+
```sh
|
|
69
|
+
npm install -g @nick848/fet
|
|
70
|
+
fet --version
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Step 2: Initialize the project
|
|
74
|
+
|
|
75
|
+
From your project root:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
fet init --yes
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`fet init` will:
|
|
82
|
+
|
|
83
|
+
- Detect OpenSpec and run `openspec init` when `openspec/` is missing
|
|
84
|
+
- Scan the repository and generate `AGENTS.md` plus the `fet:` namespace in `openspec/config.yaml`
|
|
85
|
+
- Write workflow state such as `openspec/fet-state.json`
|
|
86
|
+
- Install **Cursor** and **Codex** integration files (see “Use in your IDE” below)
|
|
87
|
+
- Optionally detect GitNexus (a one-time recommendation if missing; non-blocking)
|
|
88
|
+
|
|
89
|
+
For English interaction messages and generated artifacts:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
fet init --yes --lang en
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Step 3: Verify the environment
|
|
52
96
|
|
|
53
97
|
```sh
|
|
54
|
-
fet init
|
|
55
|
-
fet fill-context
|
|
56
98
|
fet doctor
|
|
57
99
|
```
|
|
58
100
|
|
|
59
|
-
|
|
101
|
+
Confirm there are no `fail` results for OpenSpec, context files, or tool integration. Use `fet doctor --fix-lock` if a stale `openspec/.fet.lock` is reported.
|
|
102
|
+
|
|
103
|
+
### Step 4: Fill project context (with your IDE)
|
|
104
|
+
|
|
105
|
+
The scanner marks unknown facts in `AGENTS.md` as `[NEEDS LLM INPUT]`. Run:
|
|
60
106
|
|
|
61
107
|
```sh
|
|
62
|
-
fet
|
|
63
|
-
|
|
64
|
-
|
|
108
|
+
fet fill-context
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Then, in **Cursor** or **Codex**, follow the generated handoff (for example `.fet/fill-context.md` or `.cursor/skills/fet-fill-context/SKILL.md`) so the AI can help replace placeholders. Run `fet doctor` again afterward; placeholder checks should pass.
|
|
112
|
+
|
|
113
|
+
### Step 5: (Optional) Set up a code graph
|
|
114
|
+
|
|
115
|
+
To let AI prefer structured graph context before broad repository scans, install GitNexus, then:
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
fet graph setup # installation guide only; FET does not install GitNexus for you
|
|
119
|
+
fet graph init # first graph build
|
|
120
|
+
fet graph handoff # IDE handoff document
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Step 6: Use in your IDE
|
|
124
|
+
|
|
125
|
+
After initialization, make sure your AI tool can read:
|
|
126
|
+
|
|
127
|
+
| Tool | Main entry points |
|
|
128
|
+
|------|-------------------|
|
|
129
|
+
| Cursor | `.cursor/rules/fet-context.mdc`; `.cursor/skills/fet-*/SKILL.md` |
|
|
130
|
+
| Codex | `.codex/fet/context.md`; `$CODEX_HOME/prompts/fet-*.md` |
|
|
131
|
+
|
|
132
|
+
Run workflow commands in the **terminal** as `fet <command>` (for example `fet apply`). Calling `openspec` directly bypasses FET state and the verify gate.
|
|
133
|
+
|
|
134
|
+
### Step 7: Complete your first change
|
|
135
|
+
|
|
136
|
+
When setup looks healthy, drive your first OpenSpec change. Simple path example:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
fet propose my-first-change
|
|
140
|
+
# or use fet continue step by step from your IDE handoff
|
|
141
|
+
fet apply --change my-first-change
|
|
142
|
+
fet verify --change my-first-change
|
|
143
|
+
fet verify --done --change my-first-change
|
|
144
|
+
fet sync --change my-first-change
|
|
145
|
+
fet archive --change my-first-change
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
For the expanded workflow, start with `fet new <id>` and repeat `fet continue` or run `fet ff`. See “Day-to-day change workflow” below.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Day-to-day change workflow
|
|
153
|
+
|
|
154
|
+
After first-time setup, a typical loop is:
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
fet new my-change # or fet propose my-change
|
|
158
|
+
fet continue # repeat as needed for the next planning artifact
|
|
159
|
+
fet apply --change my-change
|
|
65
160
|
fet verify --change my-change
|
|
66
161
|
fet verify --done --change my-change
|
|
67
|
-
fet sync
|
|
162
|
+
fet sync --change my-change
|
|
68
163
|
fet archive --change my-change
|
|
69
164
|
```
|
|
70
165
|
|
|
71
|
-
|
|
166
|
+
Notes:
|
|
167
|
+
|
|
168
|
+
- When `continue`, `apply`, `ff`, or `sync` is called without `--change`, FET uses the recorded **active change**, or the only open change when there is exactly one.
|
|
169
|
+
- `sync` and `archive` through FET require `fet verify --done` first.
|
|
170
|
+
- Run `fet update-context` after major project structure changes; run `fet fill-context` when you only need to refresh IDE placeholder handoff.
|
|
72
171
|
|
|
73
172
|
## Language
|
|
74
173
|
|
|
@@ -180,10 +279,13 @@ FET may create or update:
|
|
|
180
279
|
- `.cursor/skills/fet-*/SKILL.md`
|
|
181
280
|
- `.cursor/rules/fet-context.mdc`
|
|
182
281
|
- `.cursor/rules/fet-figma-stop.mdc`
|
|
282
|
+
- `.cursor/rules/fet-spec-language.mdc`
|
|
183
283
|
- `.cursor/rules/karpathy-guidelines.mdc`
|
|
184
284
|
- `.codex/fet/context.md`
|
|
185
285
|
- `.codex/fet/figma-stop.md`
|
|
286
|
+
- `.codex/fet/spec-language.md`
|
|
186
287
|
- `.codex/fet/karpathy-guidelines.md`
|
|
288
|
+
- `openspec/changes/<change-id>/.fet/figma-apply-instructions.md` (written on apply when the change references Figma)
|
|
187
289
|
- `openspec/changes/<change-id>/.fet/figma-stop.md` (written when the change references Figma)
|
|
188
290
|
- `.codex/fet/commands/*.md`
|
|
189
291
|
- `$CODEX_HOME/prompts/fet-*.md`
|