@shirayner/ace 0.1.0 → 0.1.1-snapshot.1
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.zh-CN.md → README.en-US.md} +11 -1
- package/README.md +276 -63
- package/bin/ace.js +1 -1
- package/package.json +1 -1
- package/plugin/skills/auto-goal/SKILL.md +97 -12
- package/src/commands/init.js +156 -39
- package/src/core/constants.js +8 -4
- package/src/core/installer.js +93 -16
- package/src/core/ui.js +182 -0
- package/templates/CLAUDE.md +6 -0
- package/templates/hookify/ace.hookify.code-quality-gate.local.md +45 -0
- package/templates/hookify/ace.hookify.safe-git-commands.local.md +38 -0
- package/templates/hookify/hookify.dangerous-commands.local.md +20 -0
- package/templates/hookify/hookify.sensitive-data.local.md +22 -0
- package/templates/openspec/config.yaml +4 -4
- package/templates/openspec/procedures/evolution-system.md +1 -1
- package/templates/openspec/procedures/interactive-clarification-protocol.md +1 -1
- package/templates/settings.json +39 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-quality-gate
|
|
3
|
+
enabled: true
|
|
4
|
+
event: file
|
|
5
|
+
conditions:
|
|
6
|
+
- field: file_extension
|
|
7
|
+
operator: in
|
|
8
|
+
value: [".js", ".ts", ".tsx", ".java", ".py", ".go", ".rs"]
|
|
9
|
+
action: warn
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
**代码质量检查**
|
|
13
|
+
|
|
14
|
+
保存代码文件时,请自检以下项目:
|
|
15
|
+
|
|
16
|
+
## 检查清单
|
|
17
|
+
|
|
18
|
+
### 1. 调试代码
|
|
19
|
+
- [ ] 已移除 `console.log` / `System.out.println` / `print`
|
|
20
|
+
- [ ] 已移除 `debugger;` 语句
|
|
21
|
+
- [ ] 已移除临时代码注释 (`// TEMP`, `// HACK`)
|
|
22
|
+
|
|
23
|
+
### 2. 代码规范
|
|
24
|
+
- [ ] 函数长度适中(理想 20 行内,最多 30 行)
|
|
25
|
+
- [ ] 嵌套深度不超过 3 层
|
|
26
|
+
- [ ] 无魔法值,使用命名常量
|
|
27
|
+
- [ ] 错误处理显性化
|
|
28
|
+
|
|
29
|
+
### 3. 测试相关
|
|
30
|
+
- [ ] 新增代码有对应测试
|
|
31
|
+
- [ ] 测试能通过
|
|
32
|
+
- [ ] 考虑边界条件
|
|
33
|
+
|
|
34
|
+
### 4. 敏感信息
|
|
35
|
+
- [ ] 无硬编码密码/API Key
|
|
36
|
+
- [ ] 配置文件使用环境变量
|
|
37
|
+
|
|
38
|
+
## 代码异味标记
|
|
39
|
+
|
|
40
|
+
| 标记 | 含义 | 建议 |
|
|
41
|
+
|------|------|------|
|
|
42
|
+
| `TODO` | 待办事项 | 确保有跟进计划 |
|
|
43
|
+
| `FIXME` | 需要修复 | 优先处理或创建 Issue |
|
|
44
|
+
| `HACK` | 临时方案 | 记录原因,计划重构 |
|
|
45
|
+
| `XXX` | 警告标记 | 高风险代码,需要审查 |
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: safe-git-commands
|
|
3
|
+
enabled: true
|
|
4
|
+
event: bash
|
|
5
|
+
pattern: git\s+push\s+.*(-f|--force)|git\s+reset\s+--hard|git\s+clean\s+-fd|git\s+rebase\s+-i|git\s+commit\s+--amend
|
|
6
|
+
action: warn
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Git 危险操作警告!**
|
|
10
|
+
|
|
11
|
+
即将执行可能影响团队协作的 Git 命令,请确认:
|
|
12
|
+
|
|
13
|
+
## 受保护命令
|
|
14
|
+
|
|
15
|
+
### Force Push (`git push --force`)
|
|
16
|
+
⚠️ 这会覆盖远程分支历史,可能影响其他协作者
|
|
17
|
+
- **建议**: 使用 `git push --force-with-lease`
|
|
18
|
+
- **确认**: 已通知团队成员,无人基于此分支工作
|
|
19
|
+
|
|
20
|
+
### Reset Hard (`git reset --hard`)
|
|
21
|
+
⚠️ 这会丢弃所有未提交的更改
|
|
22
|
+
- **建议**: 先用 `git stash` 保存更改
|
|
23
|
+
- **确认**: 已备份重要修改
|
|
24
|
+
|
|
25
|
+
### Clean Force (`git clean -fd`)
|
|
26
|
+
⚠️ 这会删除未跟踪的文件和目录
|
|
27
|
+
- **建议**: 先用 `git clean -n` 预览将被删除的文件
|
|
28
|
+
- **确认**: 不会误删重要文件
|
|
29
|
+
|
|
30
|
+
### Interactive Rebase (`git rebase -i`)
|
|
31
|
+
⚠️ 修改已发布的提交会改变历史
|
|
32
|
+
- **建议**: 仅对本地未推送的提交使用
|
|
33
|
+
- **确认**: 了解变基后需要 force push
|
|
34
|
+
|
|
35
|
+
### Amend Commit (`git commit --amend`)
|
|
36
|
+
⚠️ 修改已推送的提交需要 force push
|
|
37
|
+
- **建议**: 仅修改本地最新提交
|
|
38
|
+
- **确认**: 尚未推送到远程
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: block-dangerous-commands
|
|
3
|
+
enabled: true
|
|
4
|
+
event: bash
|
|
5
|
+
pattern: rm\s+-rf|sudo\s+|dd\s+if=|mkfs|format\s+|>:\s*/
|
|
6
|
+
action: block
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**危险命令 detected!**
|
|
10
|
+
|
|
11
|
+
此命令可能造成数据丢失或系统损坏:
|
|
12
|
+
- `rm -rf` - 强制递归删除
|
|
13
|
+
- `sudo` - 特权执行
|
|
14
|
+
- `dd if=` / `mkfs` / `format` - 磁盘操作
|
|
15
|
+
- `> /path` - 重定向到系统文件
|
|
16
|
+
|
|
17
|
+
请确认:
|
|
18
|
+
1. 路径是否正确
|
|
19
|
+
2. 是否有备份
|
|
20
|
+
3. 是否可以使用更安全的方式
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: warn-sensitive-data
|
|
3
|
+
enabled: true
|
|
4
|
+
event: file
|
|
5
|
+
action: warn
|
|
6
|
+
conditions:
|
|
7
|
+
- field: new_text
|
|
8
|
+
operator: regex_match
|
|
9
|
+
pattern: (API_KEY|SECRET|TOKEN|PASSWORD|PWD)\s*[=:]\s*["'][^"']+["']
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
**敏感信息 detected!**
|
|
13
|
+
|
|
14
|
+
文件内容可能包含硬编码凭证:
|
|
15
|
+
- API_KEY / API_SECRET
|
|
16
|
+
- TOKEN / ACCESS_TOKEN
|
|
17
|
+
- PASSWORD / PWD
|
|
18
|
+
|
|
19
|
+
建议:
|
|
20
|
+
1. 使用环境变量替代硬编码
|
|
21
|
+
2. 确认文件已在 .gitignore 中
|
|
22
|
+
3. 考虑使用密钥管理服务
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
schema: spec-driven
|
|
2
2
|
|
|
3
3
|
# =============================================================================
|
|
4
|
-
#
|
|
4
|
+
# aspec (ace-spec) 增强配置 v5 — 寄生模式
|
|
5
5
|
# =============================================================================
|
|
6
|
-
#
|
|
6
|
+
# aspec 通过 context 和 rules 注入 OpenSpec 工作流,不改变 OpenSpec schema。
|
|
7
7
|
# 核心目标:捕获需求/设计中的不确定性,避免基于假设实施带来的返工。
|
|
8
8
|
# =============================================================================
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ language: zh
|
|
|
13
13
|
context: |
|
|
14
14
|
## 工作模式
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
aspec (ace-spec) 采用"寄生模式"增强 OpenSpec 核心流程:在关键阶段注入前置/后置检查,
|
|
17
17
|
不改变 OpenSpec schema。跳过澄清 = AI 基于假设实施 = 大概率返工。
|
|
18
18
|
|
|
19
19
|
## 门禁条件(强制,不满足时禁止继续)
|
|
@@ -47,7 +47,7 @@ context: |
|
|
|
47
47
|
|
|
48
48
|
## 进化体系(v5)
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
aspec 在 archive 时自动积累项目知识,**使用越久,流程越精准**:
|
|
51
51
|
- Layer A(每次立即):ADR 技术决策 / 词汇表 / 风险图谱
|
|
52
52
|
- Layer B(积累 3+ 复盘后触发):问题分类学优化 / 任务模板 / 用户偏好
|
|
53
53
|
- Layer C(长期):规格演化历史 / 效率指标
|
package/templates/settings.json
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(git:*)",
|
|
5
|
+
"Bash(ls*)",
|
|
6
|
+
"Bash(cat*)",
|
|
7
|
+
"Bash(echo*)",
|
|
8
|
+
"Bash(pwd)",
|
|
9
|
+
"Bash(cd*)",
|
|
10
|
+
"Bash(find*)",
|
|
11
|
+
"Bash(grep*)",
|
|
12
|
+
"Bash(sed*)",
|
|
13
|
+
"Bash(mkdir*)",
|
|
14
|
+
"Bash(touch*)",
|
|
15
|
+
"Bash(npm*)",
|
|
16
|
+
"Bash(node*)",
|
|
17
|
+
"Bash(jq*)",
|
|
18
|
+
"Bash(openspec*)",
|
|
19
|
+
"Bash(opc*)",
|
|
20
|
+
"Bash(gh *)",
|
|
21
|
+
"Read",
|
|
22
|
+
"Glob",
|
|
23
|
+
"Grep",
|
|
24
|
+
"Skill(openspec:*)",
|
|
25
|
+
"WebSearch",
|
|
26
|
+
"WebFetch",
|
|
27
|
+
"mcp__context7__resolve_library_id",
|
|
28
|
+
"mcp__context7__query_docs",
|
|
29
|
+
"Skill(report)",
|
|
30
|
+
"Skill(ace:report)"
|
|
31
|
+
],
|
|
32
|
+
"deny": [
|
|
33
|
+
"Bash(rm -rf*)",
|
|
34
|
+
"Bash(sudo*)",
|
|
35
|
+
"Bash(curl*--data*)",
|
|
36
|
+
"Write(*.env)",
|
|
37
|
+
"Write(*id_rsa*)"
|
|
38
|
+
],
|
|
3
39
|
"hooks": {
|
|
4
40
|
"PostToolUse": []
|
|
5
41
|
}
|
|
@@ -7,6 +43,8 @@
|
|
|
7
43
|
"autoMemoryDirectory": "~/.claude/memory/",
|
|
8
44
|
"enabledPlugins": {
|
|
9
45
|
"hookify@claude-plugins-official": true,
|
|
46
|
+
"revealjs@revealjs-skill": true,
|
|
10
47
|
"ace@ace-local": true
|
|
11
|
-
}
|
|
48
|
+
},
|
|
49
|
+
"hooks": {}
|
|
12
50
|
}
|