@gepeiyu/smart 0.1.1 → 0.1.2
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 +86 -55
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
# Smart — GitHub Issue
|
|
1
|
+
# Smart — 把 GitHub Issue 当作全流程变更容器
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 一条 Issue = 一次 `issue → design → build → verify → archive`;Issue 关闭即变更归档。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- **纯 Bash 状态机**:`scripts/smart-*.sh`,所有工具都能 `bash scripts/smart-*.sh` 直接跑
|
|
7
|
-
- **OpenSpec 复用**:`openspec/specs/` + `openspec/changes/` + `openspec/changes/archive/` 三层
|
|
8
|
-
- **Issue 驱动**:`gh issue view` 读取、`gh issue comment` 回写、`gh issue close` 归档
|
|
5
|
+
Smart 是一个 agent skill:AI agent 读到一条 GitHub Issue 后,把它当作从需求到归档的整条变更流水线推进——读 Issue 取需求(`gh issue view`)、各阶段向 Issue 回写进度(`gh issue comment`)、归档时关闭 Issue(`gh issue close`)。状态机由纯 Bash 脚本驱动,工具中性。
|
|
9
6
|
|
|
10
|
-
##
|
|
7
|
+
## Issue 在 Smart 里是什么
|
|
8
|
+
|
|
9
|
+
一条 Issue 不只是待办项,而是**一个变更的完整生命周期容器**:
|
|
10
|
+
|
|
11
|
+
| 阶段 | Issue 的角色 |
|
|
12
|
+
|------|-------------|
|
|
13
|
+
| issue | 触发源——`gh issue view` 读正文/评论,解析为目标/范围/验收 |
|
|
14
|
+
| design | 进度面——回写 Design Doc 链接 |
|
|
15
|
+
| build | 进度面——每完成一个 task 回写勾选进度 |
|
|
16
|
+
| verify | 结论面——回写验证结论 |
|
|
17
|
+
| archive | 关闭信号——`gh issue close`,Issue 关闭 ≈ 变更归档 |
|
|
18
|
+
|
|
19
|
+
OpenSpec 负责规格(`openspec/specs/` + `openspec/changes/` + `openspec/changes/archive/` 三层),纯 Bash 脚本负责状态机(`.smart.yaml`),Superpowers 负责设计与执行方法论。
|
|
20
|
+
|
|
21
|
+
## 安装
|
|
11
22
|
|
|
12
23
|
```bash
|
|
13
24
|
npm install -g @gepeiyu/smart
|
|
@@ -15,80 +26,100 @@ cd your-project
|
|
|
15
26
|
smart init
|
|
16
27
|
```
|
|
17
28
|
|
|
18
|
-
|
|
29
|
+
或免全局安装:`npx @gepeiyu/smart init`
|
|
30
|
+
|
|
31
|
+
`smart init` 会:检测 AI 平台目录(`.opencode`/`.claude`/`.cursor`/`.codex` 等)→ 部署 Smart 8 子 skill + 脚本 + reference + commands → 可选安装 OpenSpec CLI 与 Superpowers → 建 `docs/superpowers/{specs,plans,reports}` 工作目录与 `.smart/config.yaml`。
|
|
19
32
|
|
|
20
|
-
|
|
33
|
+
## 上手(30 秒)
|
|
21
34
|
|
|
22
35
|
```bash
|
|
23
|
-
|
|
36
|
+
smart init # 在项目里部署 Smart
|
|
37
|
+
gh issue create --title "..." --body "..." # 建一条 Issue
|
|
38
|
+
# 在 AI 平台里:/smart-issue #1
|
|
24
39
|
```
|
|
25
40
|
|
|
41
|
+
`/smart-issue #1` 会用 `gh issue view 1` 拉取 Issue 内容作为需求种子,建 OpenSpec change + `.smart.yaml`,回写收纳评论,然后自动推进 design → build → verify → archive,归档时 `gh issue close 1`。
|
|
42
|
+
|
|
43
|
+
也可以用描述触发(不绑 Issue):`/smart-issue <描述>`。
|
|
44
|
+
|
|
26
45
|
## CLI 命令
|
|
27
46
|
|
|
28
47
|
| 命令 | 作用 |
|
|
29
48
|
|------|------|
|
|
30
|
-
| `smart init [path]` |
|
|
49
|
+
| `smart init [path]` | 部署 skill + 装依赖 + 建工作目录(`--yes` 非交互,`--no-deps` 跳过依赖) |
|
|
31
50
|
| `smart status [path]` | 显示活跃 change 与 phase/issue |
|
|
32
|
-
| `smart uninstall [path]` |
|
|
51
|
+
| `smart uninstall [path]` | 移除 skill(保留 openspec/changes 等用户数据;`--force`) |
|
|
33
52
|
| `smart --version` / `--help` | 版本 / 帮助 |
|
|
34
53
|
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
| 依赖 | 版本/要求 | 验证 |
|
|
38
|
-
|------|----------|------|
|
|
39
|
-
| `gh` CLI | 已登录 | `gh auth status` |
|
|
40
|
-
| OpenSpec CLI | `@fission-ai/openspec` | `npx openspec --version`(本项目已含依赖) |
|
|
41
|
-
| Bash | 5.x | Windows 用 Git Bash(`C:\Program Files\Git\bin\bash.exe`);`bash --version` |
|
|
42
|
-
| git | 任意 | `git --version` |
|
|
43
|
-
|
|
44
|
-
Windows 用户注意:PATH 里的 `bash` 可能指向 WSL(不可用)。请用 Git Bash 的 `bash.exe`,或把 Git Bash 的 `bin` 加到 PATH 前面。
|
|
54
|
+
## 技能清单
|
|
45
55
|
|
|
46
|
-
|
|
56
|
+
| 命令 | 阶段 | 作用 |
|
|
57
|
+
|------|------|------|
|
|
58
|
+
| `/smart` | — | 主入口:自动检测当前 change 阶段并分派 |
|
|
59
|
+
| `/smart-issue` | 1 | 从 Issue/描述开启变更(`#ID` 经 `gh` 拉取) |
|
|
60
|
+
| `/smart-design` | 2 | 深度设计(brainstorming + Design Doc) |
|
|
61
|
+
| `/smart-build` | 3 | 计划与构建(实现代码) |
|
|
62
|
+
| `/smart-verify` | 4 | 验证与收尾 |
|
|
63
|
+
| `/smart-archive` | 5 | 归档(合并 spec + `gh issue close`) |
|
|
64
|
+
| `/smart-hotfix` | 预设 | 快速 bug 修复(跳过 brainstorming) |
|
|
65
|
+
| `/smart-tweak` | 预设 | 小改动(文案/配置/文档) |
|
|
47
66
|
|
|
48
|
-
|
|
49
|
-
SKILL.md # 主 skill 文件(工具中性)
|
|
50
|
-
scripts/smart-env.sh # 脚本定位 + env 加载
|
|
51
|
-
scripts/smart-state.sh # .smart.yaml 状态机
|
|
52
|
-
scripts/smart-guard.sh # 阶段守卫
|
|
53
|
-
scripts/smart-handoff.sh # 交接包生成
|
|
54
|
-
scripts/smart-archive.sh # 一键归档 + gh issue close
|
|
55
|
-
reference/smart-yaml-fields.md
|
|
56
|
-
reference/file-structure.md
|
|
57
|
-
reference/issue-lifecycle.md
|
|
58
|
-
.smart/config.yaml # 项目级配置(可选)
|
|
59
|
-
```
|
|
67
|
+
## 守护脚本(纯 Bash)
|
|
60
68
|
|
|
61
|
-
|
|
69
|
+
| 脚本 | 用途 |
|
|
70
|
+
|------|------|
|
|
71
|
+
| `smart-env.sh` | 脚本定位 + env 加载 + 共享 helper |
|
|
72
|
+
| `smart-state.sh` | `.smart.yaml` 状态机(init/check/set/get/transition/next/scale/task-checkoff) |
|
|
73
|
+
| `smart-guard.sh` | 阶段守卫(`--apply` 推进 phase;校验交接 hash、Design Doc frontmatter、build 决策) |
|
|
74
|
+
| `smart-handoff.sh` | 交接包生成(带 SHA256 追踪,`--write`/`--hash-only`) |
|
|
75
|
+
| `smart-archive.sh` | 一键归档(合并主 spec + 移动 change + `gh issue close`) |
|
|
62
76
|
|
|
63
|
-
|
|
77
|
+
## 工作流
|
|
64
78
|
|
|
65
|
-
|
|
79
|
+
```
|
|
80
|
+
/smart(检测阶段)
|
|
81
|
+
↓
|
|
82
|
+
/smart-issue ──→ /smart-design ──→ /smart-build ──→ /smart-verify ──→ /smart-archive
|
|
83
|
+
读 Issue Design Doc 实现代码 验证报告 gh issue close
|
|
66
84
|
|
|
67
|
-
|
|
85
|
+
/smart-hotfix:issue → build → verify → archive(跳过 brainstorming)
|
|
86
|
+
/smart-tweak: issue → 轻量 build → 轻量 verify → archive
|
|
87
|
+
```
|
|
68
88
|
|
|
69
|
-
|
|
89
|
+
阶段衔接由 `smart-state.sh next` 输出下一步该调的子 skill;agent 据此自动推进,遇到用户决策点(澄清确认/方案确认/plan-ready/验证失败/归档前)暂停等待。
|
|
70
90
|
|
|
71
|
-
|
|
91
|
+
## 状态机
|
|
72
92
|
|
|
73
|
-
|
|
93
|
+
每个变更在 `openspec/changes/<name>/.smart.yaml` 记录:`phase`(issue|design|build|verify|archive)、`workflow`(full|hotfix|tweak)、`issue_number`/`issue_repo`、`verify_result`、`archived` 等。所有状态转换走脚本(`smart-state.sh transition` / `smart-guard.sh --apply`),不靠 agent 记忆——断点恢复时 agent 只需读 `.smart.yaml` 即知当前阶段。`issue_number` 为 null 时脚本跳过所有 `gh` 读写(本地流程仍完整)。
|
|
74
94
|
|
|
75
|
-
|
|
95
|
+
项目级配置在 `.smart/config.yaml`(`context_compression`/`review_mode`/`auto_transition` 默认值)。字段详见 `reference/smart-yaml-fields.md`。
|
|
76
96
|
|
|
77
|
-
|
|
97
|
+
## 前置依赖
|
|
78
98
|
|
|
79
|
-
|
|
99
|
+
| 依赖 | 要求 | 验证 |
|
|
100
|
+
|------|------|------|
|
|
101
|
+
| Node.js | 20+ | `node --version` |
|
|
102
|
+
| `gh` CLI | 已登录 | `gh auth status` |
|
|
103
|
+
| OpenSpec CLI | `smart init` 代装,或手动 `npm i -D @fission-ai/openspec` | `npx openspec --version` |
|
|
104
|
+
| Bash | 5.x(Windows 用 Git Bash) | `bash --version` |
|
|
105
|
+
| git | 任意 | `git --version` |
|
|
80
106
|
|
|
81
|
-
|
|
107
|
+
Windows 注意:PATH 的 `bash` 可能指向 WSL(不可用);用 Git Bash 的 `bash.exe`,或把 Git Bash 的 `bin` 加到 PATH 前面。
|
|
82
108
|
|
|
83
|
-
|
|
109
|
+
## 项目结构
|
|
84
110
|
|
|
85
|
-
|
|
111
|
+
```
|
|
112
|
+
your-project/
|
|
113
|
+
├── .smart/config.yaml # 项目级配置
|
|
114
|
+
├── .opencode/skills/ # 部署的 skill(.claude/.cursor 等同理)
|
|
115
|
+
│ ├── smart/{SKILL.md, scripts/, reference/}
|
|
116
|
+
│ └── smart-{issue,design,build,verify,archive,hotfix,tweak}/SKILL.md
|
|
117
|
+
├── openspec/ # OpenSpec 规格
|
|
118
|
+
│ ├── specs/ # 主 spec(归档时从 delta 合并)
|
|
119
|
+
│ └── changes/<name>/ # 活跃变更(含 .smart.yaml)
|
|
120
|
+
└── docs/superpowers/{specs,plans,reports}/ # Design Doc / 计划 / 验证报告
|
|
121
|
+
```
|
|
86
122
|
|
|
87
|
-
|
|
88
|
-
# 语法检查
|
|
89
|
-
bash -n scripts/smart-*.sh
|
|
123
|
+
## License
|
|
90
124
|
|
|
91
|
-
|
|
92
|
-
bash scripts/smart-state.sh check <change-name> issue
|
|
93
|
-
bash scripts/smart-state.sh next <change-name>
|
|
94
|
-
```
|
|
125
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gepeiyu/smart",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Smart — GitHub Issue 驱动的 OpenSpec 变更流程 agent skill
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Smart — GitHub Issue 驱动的 OpenSpec 变更流程 agent skill",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"smart": "./bin/smart.js"
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"superpowers",
|
|
30
30
|
"agent-skill",
|
|
31
31
|
"github-issue",
|
|
32
|
-
"comet",
|
|
33
32
|
"spec-driven"
|
|
34
33
|
],
|
|
35
34
|
"license": "MIT",
|