@nick848/sf-cli 1.0.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/LICENSE +21 -0
- package/README.md +151 -0
- package/dist/cli/index.js +6029 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.mts +1961 -0
- package/dist/index.d.ts +1961 -0
- package/dist/index.js +7655 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +7590 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sf-cli-team
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# sf-cli (spfe)
|
|
2
|
+
|
|
3
|
+
> 专为前端开发设计的AI驱动CLI工具,支持BDD+TDD+OpenSpec规范
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
## 特性
|
|
8
|
+
|
|
9
|
+
- 🤖 **AI驱动** - 支持 GLM-5、GPT-4o、Claude 等多种AI模型
|
|
10
|
+
- 📋 **标准化流程** - BDD+TDD+OpenSpec 规范
|
|
11
|
+
- 📚 **规范学习** - 自动从代码和对话中学习开发规范
|
|
12
|
+
- 🔧 **Sub Agent** - 专业化 Agent 协作(前端开发、代码审核、架构师、测试)
|
|
13
|
+
- 🔄 **工作流控制** - 三阶段人工确认、回滚机制
|
|
14
|
+
- 🔌 **MCP集成** - 支持蓝湖、Figma 设计稿
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# npm
|
|
20
|
+
npm install -g @nick848/sf-cli
|
|
21
|
+
|
|
22
|
+
# yarn
|
|
23
|
+
yarn global add @nick848/sf-cli
|
|
24
|
+
|
|
25
|
+
# pnpm
|
|
26
|
+
pnpm add -g @nick848/sf-cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 快速开始
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 启动交互模式(两种方式)
|
|
33
|
+
sf-cli
|
|
34
|
+
# 或
|
|
35
|
+
spfe
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
启动后进入交互模式,直接使用 `/` 调用命令:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
# 初始化项目
|
|
42
|
+
/init
|
|
43
|
+
|
|
44
|
+
# 发起新需求
|
|
45
|
+
/new 实现用户登录功能
|
|
46
|
+
|
|
47
|
+
# 配置AI模型
|
|
48
|
+
/model
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 命令
|
|
52
|
+
|
|
53
|
+
### 斜杠命令
|
|
54
|
+
|
|
55
|
+
| 命令 | 说明 |
|
|
56
|
+
|------|------|
|
|
57
|
+
| `/help` | 显示帮助信息 |
|
|
58
|
+
| `/init` | 初始化项目 |
|
|
59
|
+
| `/model` | 配置AI模型 |
|
|
60
|
+
| `/new` | 创建新需求 |
|
|
61
|
+
| `/clear` | 清空对话历史 |
|
|
62
|
+
| `/exit` | 退出CLI |
|
|
63
|
+
| `/update` | 检查更新 |
|
|
64
|
+
|
|
65
|
+
### OpenSpec 工作流命令
|
|
66
|
+
|
|
67
|
+
| 命令 | 说明 |
|
|
68
|
+
|------|------|
|
|
69
|
+
| `/opsx:explore` | 探索需求(复杂流程) |
|
|
70
|
+
| `/opsx:new` | 进入设计阶段 |
|
|
71
|
+
| `/opsx:continue` | 继续开发 |
|
|
72
|
+
| `/opsx:apply` | 应用变更 |
|
|
73
|
+
| `/opsx:archive` | 归档总结 |
|
|
74
|
+
| `/opsx:propose` | 简单需求流程 |
|
|
75
|
+
| `/opsx:status` | 查看工作流状态 |
|
|
76
|
+
| `/opsx:rollback` | 回滚工作流 |
|
|
77
|
+
| `/opsx:confirm` | 确认检查点 |
|
|
78
|
+
|
|
79
|
+
### Agent 调用
|
|
80
|
+
|
|
81
|
+
| Agent | 说明 |
|
|
82
|
+
|-------|------|
|
|
83
|
+
| `$frontend-dev` | 前端开发 |
|
|
84
|
+
| `$code-reviewer` | 代码审核 |
|
|
85
|
+
| `$architect` | 架构设计 |
|
|
86
|
+
| `$tester` | 测试用例 |
|
|
87
|
+
|
|
88
|
+
## 工作流
|
|
89
|
+
|
|
90
|
+
### 复杂需求流程(复杂度 >= 6)
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
explore → new → continue → apply → archive
|
|
94
|
+
↓ ↓ ↓
|
|
95
|
+
确认点 确认点 确认点
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 简单需求流程(复杂度 < 6)
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
propose → apply → archive
|
|
102
|
+
↓
|
|
103
|
+
确认点
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 项目结构
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
.sf-cli/
|
|
110
|
+
├── config.json # 配置文件
|
|
111
|
+
├── norms/ # 规范学习
|
|
112
|
+
│ ├── patterns.json
|
|
113
|
+
│ ├── weights.json
|
|
114
|
+
│ └── devstanded.md
|
|
115
|
+
└── tokens/ # Token统计
|
|
116
|
+
|
|
117
|
+
openspec/
|
|
118
|
+
├── config.yaml # 项目配置
|
|
119
|
+
├── changes/ # 变更记录
|
|
120
|
+
├── spec/ # 归档规范
|
|
121
|
+
└── archive/ # 已归档变更
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 环境变量
|
|
125
|
+
|
|
126
|
+
| 变量 | 说明 |
|
|
127
|
+
|------|------|
|
|
128
|
+
| `LANHU_TOKEN` | 蓝湖访问令牌 |
|
|
129
|
+
| `FIGMA_ACCESS_TOKEN` | Figma访问令牌 |
|
|
130
|
+
|
|
131
|
+
## 作为库使用
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { WorkflowEngine, NormsManager, runAgent } from '@nick848/sf-cli';
|
|
135
|
+
|
|
136
|
+
// 启动工作流
|
|
137
|
+
const engine = new WorkflowEngine();
|
|
138
|
+
await engine.initialize(projectPath);
|
|
139
|
+
await engine.start('实现登录功能', 7);
|
|
140
|
+
|
|
141
|
+
// 学习规范
|
|
142
|
+
const norms = new NormsManager({ projectPath, normsDir });
|
|
143
|
+
await norms.scanProject(projectPath);
|
|
144
|
+
|
|
145
|
+
// 调用 Agent
|
|
146
|
+
const result = await runAgent('frontend-dev', ['创建登录组件'], ctx);
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
[MIT](LICENSE)
|