ops-toolkit 1.1.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/.commitlintrc.js +25 -0
- package/.env.example +25 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.opencode/README.md +320 -0
- package/.opencode/command/add-cmd.md +38 -0
- package/.opencode/command/add-pkg.md +28 -0
- package/.opencode/command/build.md +27 -0
- package/.opencode/command/debug.md +36 -0
- package/.opencode/command/fix.md +23 -0
- package/.opencode/command/release.md +28 -0
- package/.opencode/command/review.md +36 -0
- package/.opencode/command/test.md +25 -0
- package/.prettierrc +16 -0
- package/.release-it.json +29 -0
- package/.versionrc.js +18 -0
- package/.vscode/extensions.json +14 -0
- package/.vscode/launch.json +33 -0
- package/.vscode/typescript.code-snippets +61 -0
- package/AGENTS.md +277 -0
- package/CHANGELOG.md +24 -0
- package/QUICKSTART.md +136 -0
- package/README.md +143 -0
- package/bin/ops-toolkit.ts +92 -0
- package/bun.lock +1921 -0
- package/dist/index.js +3726 -0
- package/docs/DEBUGGING.md +255 -0
- package/docs/DEVELOPMENT_GUIDE.md +538 -0
- package/eslint.config.js +64 -0
- package/package.json +90 -0
- package/src/commands/deploy/index.ts +97 -0
- package/src/commands/monitor/index.ts +60 -0
- package/src/commands/system/index.ts +120 -0
- package/src/index.ts +82 -0
- package/src/types/commands.ts +41 -0
- package/src/types/index.ts +3 -0
- package/src/types/system.ts +65 -0
- package/src/types/ui.ts +61 -0
- package/src/utils/config.ts +146 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/logger.ts +62 -0
- package/src/utils/system.ts +183 -0
- package/tsconfig.json +48 -0
package/.commitlintrc.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ['@commitlint/config-conventional'],
|
|
3
|
+
rules: {
|
|
4
|
+
'type-enum': [
|
|
5
|
+
2,
|
|
6
|
+
'always',
|
|
7
|
+
[
|
|
8
|
+
'feat', // 新功能
|
|
9
|
+
'fix', // 修复
|
|
10
|
+
'docs', // 文档
|
|
11
|
+
'style', // 格式
|
|
12
|
+
'refactor', // 重构
|
|
13
|
+
'perf', // 性能
|
|
14
|
+
'test', // 测试
|
|
15
|
+
'chore', // 构建过程或辅助工具的变动
|
|
16
|
+
'ci', // CI配置
|
|
17
|
+
'build', // 构建系统
|
|
18
|
+
'revert', // 回滚
|
|
19
|
+
],
|
|
20
|
+
],
|
|
21
|
+
'subject-max-length': [2, 'always', 50],
|
|
22
|
+
'body-max-line-length': [2, 'always', 72],
|
|
23
|
+
'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']],
|
|
24
|
+
},
|
|
25
|
+
};
|
package/.env.example
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Environment variables for ops-toolkit
|
|
2
|
+
# Copy this file to .env and fill in your values
|
|
3
|
+
|
|
4
|
+
# Debug mode
|
|
5
|
+
DEBUG=false
|
|
6
|
+
NODE_ENV=development
|
|
7
|
+
|
|
8
|
+
# CLI Options
|
|
9
|
+
OPS_CONFIG_PATH=~/.ops-toolkit
|
|
10
|
+
OPS_LOG_LEVEL=info
|
|
11
|
+
|
|
12
|
+
# API Keys (if needed)
|
|
13
|
+
# API_KEY=your_api_key_here
|
|
14
|
+
|
|
15
|
+
# Deployment settings
|
|
16
|
+
DEPLOY_ENV=development
|
|
17
|
+
DEPLOY_TIMEOUT=300000
|
|
18
|
+
|
|
19
|
+
# Monitoring settings
|
|
20
|
+
MONITOR_REFRESH_INTERVAL=1000
|
|
21
|
+
MONITOR_HISTORY_SIZE=100
|
|
22
|
+
|
|
23
|
+
# Log settings
|
|
24
|
+
LOG_MAX_LINES=1000
|
|
25
|
+
LOG_DEFAULT_PATH=/var/log
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
# OpenCode 自定义命令
|
|
2
|
+
|
|
3
|
+
ops-toolkit 项目的 OpenCode 自定义命令配置,提高开发效率。
|
|
4
|
+
|
|
5
|
+
## 📁 命令文件位置
|
|
6
|
+
|
|
7
|
+
命令文件位于: `.opencode/command/`
|
|
8
|
+
|
|
9
|
+
## 🚀 可用命令
|
|
10
|
+
|
|
11
|
+
### `/add-cmd <command-name>`
|
|
12
|
+
|
|
13
|
+
添加新的 CLI 命令。
|
|
14
|
+
|
|
15
|
+
**用法**:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/add-cmd monitor
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**功能**:
|
|
22
|
+
|
|
23
|
+
- 在 `src/commands/` 创建命令文件
|
|
24
|
+
- 在 `src/index.ts` 注册命令
|
|
25
|
+
- 包含完整的 TypeScript 类型定义
|
|
26
|
+
- 添加错误处理和彩色输出
|
|
27
|
+
|
|
28
|
+
**示例**:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
/add-cmd backup
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
### `/fix <issue-description>`
|
|
37
|
+
|
|
38
|
+
修复代码问题并运行检查。
|
|
39
|
+
|
|
40
|
+
**用法**:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
/fix monitor command not showing correct output
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**功能**:
|
|
47
|
+
|
|
48
|
+
- 分析问题并提供解决方案
|
|
49
|
+
- 确保 TypeScript 严格模式
|
|
50
|
+
- 包含适当的错误处理
|
|
51
|
+
- 运行类型检查和 lint
|
|
52
|
+
- 运行测试验证修复
|
|
53
|
+
|
|
54
|
+
**示例**:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
/fix TypeError: Cannot read property 'x' of undefined
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### `/test`
|
|
63
|
+
|
|
64
|
+
运行测试套件并分析结果。
|
|
65
|
+
|
|
66
|
+
**用法**:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
/test
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**功能**:
|
|
73
|
+
|
|
74
|
+
- 运行所有测试
|
|
75
|
+
- 识别失败的测试
|
|
76
|
+
- 分析失败原因
|
|
77
|
+
- 建议修复方案
|
|
78
|
+
- 检查测试覆盖率
|
|
79
|
+
- 推荐额外的测试用例
|
|
80
|
+
|
|
81
|
+
**示例**:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
/test
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### `/release`
|
|
90
|
+
|
|
91
|
+
准备项目发布。
|
|
92
|
+
|
|
93
|
+
**用法**:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
/release
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**功能**:
|
|
100
|
+
|
|
101
|
+
- 检查测试是否通过
|
|
102
|
+
- 运行类型检查
|
|
103
|
+
- 运行 lint 修复
|
|
104
|
+
- 查看最近的提交
|
|
105
|
+
- 建议版本号变更类型
|
|
106
|
+
- 建议提交信息格式
|
|
107
|
+
|
|
108
|
+
**示例**:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
/release
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### `/review <location>`
|
|
117
|
+
|
|
118
|
+
审查代码更改。
|
|
119
|
+
|
|
120
|
+
**用法**:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
/review src/commands/monitor/index.ts
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**功能**:
|
|
127
|
+
|
|
128
|
+
- 代码质量检查
|
|
129
|
+
- 性能分析
|
|
130
|
+
- 安全审查
|
|
131
|
+
- 代码风格检查
|
|
132
|
+
- 测试覆盖率检查
|
|
133
|
+
|
|
134
|
+
**审查清单**:
|
|
135
|
+
|
|
136
|
+
1. ✅ TypeScript 最佳实践
|
|
137
|
+
2. ✅ 没有使用 `any` 类型
|
|
138
|
+
3. ✅ 良好的错误处理
|
|
139
|
+
4. ✅ 性能优化
|
|
140
|
+
5. ✅ 安全性检查
|
|
141
|
+
6. ✅ 遵循 ESLint 规则
|
|
142
|
+
|
|
143
|
+
**示例**:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
/review src/utils/logger.ts
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### `/build`
|
|
152
|
+
|
|
153
|
+
构建并验证项目。
|
|
154
|
+
|
|
155
|
+
**用法**:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
/build
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**功能**:
|
|
162
|
+
|
|
163
|
+
- 运行类型检查
|
|
164
|
+
- 运行 lint
|
|
165
|
+
- 执行构建
|
|
166
|
+
- 运行测试
|
|
167
|
+
- 报告所有问题
|
|
168
|
+
|
|
169
|
+
**检查顺序**:
|
|
170
|
+
|
|
171
|
+
1. Type Check → Lint → Build → Test
|
|
172
|
+
|
|
173
|
+
**示例**:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
/build
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### `/add-pkg <package-name>`
|
|
182
|
+
|
|
183
|
+
添加新的依赖包。
|
|
184
|
+
|
|
185
|
+
**用法**:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
/add-pkg axios
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**功能**:
|
|
192
|
+
|
|
193
|
+
- 确定是运行时还是开发依赖
|
|
194
|
+
- 使用 `bun add` 安装
|
|
195
|
+
- 更新导入语句
|
|
196
|
+
- 添加类型定义(如果需要)
|
|
197
|
+
- 验证兼容性
|
|
198
|
+
|
|
199
|
+
**示例**:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
/add-pkg dotenv
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
### `/debug <issue-description>`
|
|
208
|
+
|
|
209
|
+
获取调试帮助。
|
|
210
|
+
|
|
211
|
+
**用法**:
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
/debug async function not awaiting promise
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**功能**:
|
|
218
|
+
|
|
219
|
+
- 分析错误
|
|
220
|
+
- 定位错误位置
|
|
221
|
+
- 检查堆栈跟踪
|
|
222
|
+
- 建议调试步骤
|
|
223
|
+
- 提供修复方案
|
|
224
|
+
- 验证修复
|
|
225
|
+
|
|
226
|
+
**示例**:
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
/debug process.exit(1) not exiting program
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 💡 使用技巧
|
|
235
|
+
|
|
236
|
+
### 组合使用命令
|
|
237
|
+
|
|
238
|
+
**添加新功能**:
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
1. /add-cmd my-command
|
|
242
|
+
2. /review src/commands/my-command
|
|
243
|
+
3. /test
|
|
244
|
+
4. /release
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**修复 Bug**:
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
1. /fix error message
|
|
251
|
+
2. /review src/fixed-file.ts
|
|
252
|
+
3. /test
|
|
253
|
+
4. /build
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**代码审查**:
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
1. /review src/changed-files/
|
|
260
|
+
2. /test
|
|
261
|
+
3. /build
|
|
262
|
+
4. /release
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### 参数使用
|
|
266
|
+
|
|
267
|
+
大多数命令支持参数:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
/add-cmd backup # 添加 backup 命令
|
|
271
|
+
/fix monitor bug # 修复 monitor 命令的 bug
|
|
272
|
+
/review src/utils/ # 审查 src/utils/ 目录
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Shell 命令集成
|
|
276
|
+
|
|
277
|
+
某些命令会自动运行 shell 命令:
|
|
278
|
+
|
|
279
|
+
- `/test` → 运行 `bun test`
|
|
280
|
+
- `/build` → 运行 `bun run typecheck`, `bun run lint`, `bun run build`, `bun test`
|
|
281
|
+
- `/release` → 运行 `git log`, `bun test`, `bun run typecheck`
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## 🔧 自定义命令
|
|
286
|
+
|
|
287
|
+
你可以创建自己的命令文件:
|
|
288
|
+
|
|
289
|
+
1. 在 `.opencode/command/` 创建新的 `.md` 文件
|
|
290
|
+
2. 文件名即为命令名(如 `my-cmd.md` → `/my-cmd`)
|
|
291
|
+
3. 使用 frontmatter 配置命令属性
|
|
292
|
+
|
|
293
|
+
**Frontmatter 选项**:
|
|
294
|
+
|
|
295
|
+
```yaml
|
|
296
|
+
---
|
|
297
|
+
description: 命令描述
|
|
298
|
+
agent: build | general
|
|
299
|
+
model: anthropic/claude-3-5-sonnet-20241022
|
|
300
|
+
---
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**可用的占位符**:
|
|
304
|
+
|
|
305
|
+
- `$ARGUMENTS` - 所有参数
|
|
306
|
+
- `$1`, `$2`, `$3` - 位置参数
|
|
307
|
+
- !`command` - Shell 命令输出
|
|
308
|
+
- @filename - 文件引用
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 📚 更多资源
|
|
313
|
+
|
|
314
|
+
- [OpenCode 命令文档](https://opencode.ai/docs/commands/)
|
|
315
|
+
- [项目 AGENTS.md](../AGENTS.md)
|
|
316
|
+
- [开发指南](./DEVELOPMENT_GUIDE.md)
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
**提示**: 使用 `/help` 查看所有可用命令。
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Add a new CLI command
|
|
3
|
+
agent: build
|
|
4
|
+
model: anthropic/claude-3-5-sonnet-20241022
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Create a new CLI command named $ARGUMENTS for ops-toolkit.
|
|
8
|
+
|
|
9
|
+
Follow these steps:
|
|
10
|
+
|
|
11
|
+
1. Create command file in src/commands/$ARGUMENTS/index.ts
|
|
12
|
+
2. Implement the command handler with TypeScript
|
|
13
|
+
3. Register the command in src/index.ts using commander.js
|
|
14
|
+
4. Add type definitions in src/types/ if needed
|
|
15
|
+
5. Include error handling with try-catch
|
|
16
|
+
6. Use chalk for colored terminal output
|
|
17
|
+
|
|
18
|
+
Command structure:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { program } from 'commander';
|
|
22
|
+
import chalk from 'chalk';
|
|
23
|
+
|
|
24
|
+
program
|
|
25
|
+
.command('$ARGUMENTS')
|
|
26
|
+
.description('Description here')
|
|
27
|
+
.action(async () => {
|
|
28
|
+
try {
|
|
29
|
+
console.log(chalk.blue('$ARGUMENTS command'));
|
|
30
|
+
// Implementation here
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error(chalk.red('❌ Error:'), error);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Make sure to follow the project's code style and conventions as defined in AGENTS.md.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Add a new dependency
|
|
3
|
+
agent: build
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Add $ARGUMENTS to the project.
|
|
7
|
+
|
|
8
|
+
Determine if it's a runtime dependency or dev dependency:
|
|
9
|
+
|
|
10
|
+
- Runtime: Use `bun add <package>`
|
|
11
|
+
- Dev: Use `bun add -d <package>`
|
|
12
|
+
|
|
13
|
+
After adding:
|
|
14
|
+
|
|
15
|
+
1. Check package.json for proper installation
|
|
16
|
+
2. Update src/index.ts to import and use the package
|
|
17
|
+
3. Add type definitions if needed (@types/package)
|
|
18
|
+
4. Run `bun run typecheck` to verify types
|
|
19
|
+
5. Run `bun run lint:fix` to check for issues
|
|
20
|
+
6. Add basic usage example or documentation
|
|
21
|
+
|
|
22
|
+
Ensure the package is compatible with:
|
|
23
|
+
|
|
24
|
+
- Bun runtime
|
|
25
|
+
- Project's TypeScript version (5.3.3+)
|
|
26
|
+
- Node version requirement (18.0.0+)
|
|
27
|
+
|
|
28
|
+
If the package replaces existing functionality, help refactor the code to use the new package.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Build and verify project
|
|
3
|
+
agent: build
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Build and verify ops-toolkit project.
|
|
7
|
+
|
|
8
|
+
Run these checks in order:
|
|
9
|
+
|
|
10
|
+
1. **Type Check**
|
|
11
|
+
Execute: !`bun run typecheck`
|
|
12
|
+
Report any TypeScript errors
|
|
13
|
+
|
|
14
|
+
2. **Lint**
|
|
15
|
+
Execute: !`bun run lint`
|
|
16
|
+
Report any linting issues
|
|
17
|
+
|
|
18
|
+
3. **Build**
|
|
19
|
+
Execute: !`bun run build`
|
|
20
|
+
Verify build completes successfully
|
|
21
|
+
|
|
22
|
+
4. **Test**
|
|
23
|
+
Execute: !`bun test`
|
|
24
|
+
Report any test failures
|
|
25
|
+
|
|
26
|
+
Summary the results and identify any issues that need to be fixed before deployment.
|
|
27
|
+
If all checks pass, confirm the project is ready for production.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Get help with debugging
|
|
3
|
+
agent: build
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Help debug the following issue: $ARGUMENTS
|
|
7
|
+
|
|
8
|
+
Debugging approach:
|
|
9
|
+
|
|
10
|
+
1. **Analyze the error**
|
|
11
|
+
- Identify error type and message
|
|
12
|
+
- Locate where the error occurs
|
|
13
|
+
- Check stack trace if available
|
|
14
|
+
|
|
15
|
+
2. **Check common issues**
|
|
16
|
+
- Missing dependencies
|
|
17
|
+
- Type errors
|
|
18
|
+
- Async/await issues
|
|
19
|
+
- Missing error handling
|
|
20
|
+
|
|
21
|
+
3. **Suggest debugging steps**
|
|
22
|
+
- Add appropriate breakpoints or console.log statements
|
|
23
|
+
- Verify input/output values
|
|
24
|
+
- Check environment variables
|
|
25
|
+
|
|
26
|
+
4. **Provide fix**
|
|
27
|
+
- Write corrected code
|
|
28
|
+
- Ensure proper error handling
|
|
29
|
+
- Add comments explaining the fix
|
|
30
|
+
|
|
31
|
+
5. **Verify fix**
|
|
32
|
+
- Run `bun run typecheck`
|
|
33
|
+
- Run `bun run lint:fix`
|
|
34
|
+
- Test the fix manually if possible
|
|
35
|
+
|
|
36
|
+
Focus on providing a clear explanation of what went wrong and how to prevent similar issues in the future.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fix code issues and run checks
|
|
3
|
+
agent: build
|
|
4
|
+
model: anthropic/claude-3-5-sonnet-20241022
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Fix the following code issue: $ARGUMENTS
|
|
8
|
+
|
|
9
|
+
Analyze the problem and provide a solution that:
|
|
10
|
+
|
|
11
|
+
1. Follows TypeScript strict mode
|
|
12
|
+
2. Includes proper error handling
|
|
13
|
+
3. Uses project's utilities (chalk for colors, etc.)
|
|
14
|
+
4. Passes ESLint checks
|
|
15
|
+
5. Passes type checking
|
|
16
|
+
|
|
17
|
+
After fixing, run these checks to verify:
|
|
18
|
+
|
|
19
|
+
- `bun run typecheck` - TypeScript type checking
|
|
20
|
+
- `bun run lint:fix` - ESLint auto-fix
|
|
21
|
+
- `bun test` - Run tests if applicable
|
|
22
|
+
|
|
23
|
+
Make sure the fix doesn't break existing functionality.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Prepare for release
|
|
3
|
+
agent: build
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Prepare the ops-toolkit project for a new release.
|
|
7
|
+
|
|
8
|
+
Complete these steps:
|
|
9
|
+
|
|
10
|
+
1. Check if all tests pass: !`bun test`
|
|
11
|
+
2. Run type checking: !`bun run typecheck`
|
|
12
|
+
3. Run lint and fix issues: !`bun run lint:fix`
|
|
13
|
+
4. Review recent changes: !`git log --oneline -5`
|
|
14
|
+
|
|
15
|
+
Based on the changes, suggest:
|
|
16
|
+
|
|
17
|
+
- Proper conventional commit message type (feat, fix, refactor, docs, etc.)
|
|
18
|
+
- Version bump type (major, minor, patch)
|
|
19
|
+
- Any additional documentation updates needed
|
|
20
|
+
- Breaking changes that need to be mentioned
|
|
21
|
+
|
|
22
|
+
After review, use:
|
|
23
|
+
|
|
24
|
+
- `bun run release` - Standard patch release
|
|
25
|
+
- `bun run release:minor` - Minor feature release
|
|
26
|
+
- `bun run release:major` - Major breaking change release
|
|
27
|
+
|
|
28
|
+
Ensure the changelog is properly updated and commit messages follow the project's conventional commits format.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Review code changes
|
|
3
|
+
agent: build
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Review the code changes in the following location: $ARGUMENTS
|
|
7
|
+
|
|
8
|
+
Review checklist:
|
|
9
|
+
|
|
10
|
+
1. **Code Quality**
|
|
11
|
+
- Follows TypeScript best practices
|
|
12
|
+
- Uses proper types (no `any`)
|
|
13
|
+
- Has good error handling
|
|
14
|
+
- Uses project utilities appropriately
|
|
15
|
+
|
|
16
|
+
2. **Performance**
|
|
17
|
+
- No blocking operations in event loop
|
|
18
|
+
- Efficient use of async/await
|
|
19
|
+
- Proper resource cleanup
|
|
20
|
+
|
|
21
|
+
3. **Security**
|
|
22
|
+
- No exposed secrets or credentials
|
|
23
|
+
- Proper input validation
|
|
24
|
+
- Safe handling of user input
|
|
25
|
+
|
|
26
|
+
4. **Style**
|
|
27
|
+
- Follows ESLint rules
|
|
28
|
+
- Uses chalk for terminal output
|
|
29
|
+
- Consistent code style
|
|
30
|
+
|
|
31
|
+
5. **Testing**
|
|
32
|
+
- Has adequate test coverage
|
|
33
|
+
- Tests cover edge cases
|
|
34
|
+
- Tests are maintainable
|
|
35
|
+
|
|
36
|
+
Provide specific suggestions for improvements and highlight any issues that need to be addressed before merging.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run tests and analyze results
|
|
3
|
+
agent: build
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Run the test suite and analyze the results.
|
|
7
|
+
|
|
8
|
+
Execute: !`bun test`
|
|
9
|
+
|
|
10
|
+
Based on the test results:
|
|
11
|
+
|
|
12
|
+
1. Identify any failing tests
|
|
13
|
+
2. Analyze why tests are failing
|
|
14
|
+
3. Suggest fixes for failing tests
|
|
15
|
+
4. Check for test coverage gaps
|
|
16
|
+
5. Recommend additional test cases if needed
|
|
17
|
+
|
|
18
|
+
If tests are failing, help me fix them by:
|
|
19
|
+
|
|
20
|
+
- Updating test assertions
|
|
21
|
+
- Fixing the implementation code
|
|
22
|
+
- Adding proper mocking if needed
|
|
23
|
+
- Handling edge cases properly
|
|
24
|
+
|
|
25
|
+
Focus on ensuring all tests pass and the codebase remains robust.
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"printWidth": 100,
|
|
3
|
+
"tabWidth": 2,
|
|
4
|
+
"useTabs": false,
|
|
5
|
+
"semi": true,
|
|
6
|
+
"singleQuote": true,
|
|
7
|
+
"quoteProps": "as-needed",
|
|
8
|
+
"trailingComma": "es5",
|
|
9
|
+
"bracketSpacing": true,
|
|
10
|
+
"bracketSameLine": false,
|
|
11
|
+
"arrowParens": "avoid",
|
|
12
|
+
"endOfLine": "lf",
|
|
13
|
+
"proseWrap": "preserve",
|
|
14
|
+
"htmlWhitespaceSensitivity": "css",
|
|
15
|
+
"embeddedLanguageFormatting": "auto"
|
|
16
|
+
}
|
package/.release-it.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"git": {
|
|
3
|
+
"commit": true,
|
|
4
|
+
"tag": true,
|
|
5
|
+
"push": true,
|
|
6
|
+
"commitMessage": "chore(release): ${version}",
|
|
7
|
+
"tagName": "v${version}"
|
|
8
|
+
},
|
|
9
|
+
"github": {
|
|
10
|
+
"release": true,
|
|
11
|
+
"owner": "username",
|
|
12
|
+
"repo": "ops-toolkit"
|
|
13
|
+
},
|
|
14
|
+
"npm": {
|
|
15
|
+
"publish": true,
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"hooks": {
|
|
19
|
+
"before:init": ["bun run lint", "bun run typecheck", "bun run test"],
|
|
20
|
+
"after:bump": ["bun run build"],
|
|
21
|
+
"after:release": ["git push origin HEAD"]
|
|
22
|
+
},
|
|
23
|
+
"plugins": {
|
|
24
|
+
"@release-it/conventional-changelog": {
|
|
25
|
+
"preset": "angular",
|
|
26
|
+
"infile": "CHANGELOG.md"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
package/.versionrc.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
types: [
|
|
3
|
+
{ type: 'feat', section: 'Features' },
|
|
4
|
+
{ type: 'fix', section: 'Bug Fixes' },
|
|
5
|
+
{ type: 'docs', section: 'Documentation' },
|
|
6
|
+
{ type: 'style', section: 'Styles' },
|
|
7
|
+
{ type: 'refactor', section: 'Code Refactoring' },
|
|
8
|
+
{ type: 'perf', section: 'Performance Improvements' },
|
|
9
|
+
{ type: 'test', section: 'Tests' },
|
|
10
|
+
{ type: 'chore', section: 'Chores', hidden: true },
|
|
11
|
+
{ type: 'ci', section: 'Continuous Integration', hidden: true },
|
|
12
|
+
{ type: 'build', section: 'Builds', hidden: true },
|
|
13
|
+
{ type: 'revert', section: 'Reverts' },
|
|
14
|
+
],
|
|
15
|
+
commitUrlFormat: 'https://github.com/username/ops-toolkit/commits/{{hash}}',
|
|
16
|
+
compareUrlFormat: 'https://github.com/username/ops-toolkit/compare/{{previousTag}}...{{currentTag}}',
|
|
17
|
+
issueUrlFormat: 'https://github.com/username/ops-toolkit/issues/{{id}}',
|
|
18
|
+
};
|