@deepstorm/cli 0.9.2 → 0.10.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.
Files changed (25) hide show
  1. package/dist/cli.js +508 -24
  2. package/dist/registry.json +168 -0
  3. package/dist/skills/reef-commit/SKILL.md +27 -100
  4. package/dist/skills/reef-commit/scripts/branch-check.mjs +109 -0
  5. package/dist/skills/reef-commit/scripts/check-openspec-status.mjs +92 -0
  6. package/dist/skills/reef-commit/scripts/collect-git-context.mjs +186 -0
  7. package/dist/skills/reef-commit/scripts/run-tests.sh +91 -0
  8. package/dist/skills/reef-commit/scripts/stash-and-switch.sh +44 -0
  9. package/dist/skills/reef-gen-backend/variants/nodejs/steps.md +53 -0
  10. package/dist/skills/reef-harden/SKILL.md +11 -19
  11. package/dist/skills/reef-harden/scripts/find-change-dir.mjs +157 -0
  12. package/dist/skills/reef-pr/SKILL.md +7 -19
  13. package/dist/skills/reef-pr/scripts/create-pr.mjs +217 -0
  14. package/dist/skills/reef-style-backend/fragments/nodejs/eslint-config.json +30 -0
  15. package/dist/skills/reef-style-backend/fragments/nodejs/nestjs-structure.md +58 -0
  16. package/dist/skills/reef-style-backend/fragments/nodejs/prettier-config.json +19 -0
  17. package/dist/skills/reef-style-backend/variants/nodejs/examples/module-example.md +166 -0
  18. package/dist/skills/reef-style-backend/variants/nodejs/examples/prisma-example.md +115 -0
  19. package/dist/skills/reef-style-backend/variants/nodejs/quick-reference.md +116 -0
  20. package/dist/skills/sweep-init/SKILL.md +12 -125
  21. package/dist/skills/sweep-init/scripts/init-project.mjs +166 -0
  22. package/dist/skills/sweep-run/SKILL.md +11 -35
  23. package/dist/skills/sweep-run/scripts/env-manager.mjs +71 -2
  24. package/dist/skills/sweep-run/scripts/generate-report.mjs +116 -0
  25. package/package.json +2 -2
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * generate-report.mjs
5
+ * 生成格式化的 E2E 测试报告(markdown)。
6
+ *
7
+ * 用法:
8
+ * node generate-report.mjs --results <json> -o report.md
9
+ * node generate-report.mjs --help
10
+ */
11
+
12
+ import { writeFileSync } from 'node:fs';
13
+ import { resolve } from 'node:path';
14
+
15
+ // ── Pure functions ────────────────────────────────────────────────
16
+
17
+ /**
18
+ * 生成 markdown 格式的测试报告
19
+ * @param {object} data
20
+ * @param {string} data.fileName - .flow.md 文件名
21
+ * @param {string} data.timestamp - 执行时间
22
+ * @param {string} data.env - 目标环境名
23
+ * @param {string} data.envUrl - 环境 URL
24
+ * @param {string} data.mode - 执行模式
25
+ * @param {Array} data.flows - [{ id, title, steps: [{n,op,vf,result}] }]
26
+ * @param {number} data.passed - 通过步骤数
27
+ * @param {number} data.failed - 失败步骤数
28
+ * @param {number} data.skipped - 跳过的步骤数
29
+ * @returns {string} markdown 报告内容
30
+ */
31
+ export function generateReport(data) {
32
+ const total = data.passed + data.failed + data.skipped;
33
+ const passRate = total > 0
34
+ ? Math.round((data.passed / total) * 100) : 0;
35
+
36
+ const lines = [];
37
+ lines.push('# 测试执行报告\n');
38
+ lines.push(`**文件:** ${data.fileName}`);
39
+ lines.push(`**执行时间:** ${data.timestamp}`);
40
+ lines.push(`**目标环境:** ${data.env} (${data.envUrl || '-'})`);
41
+ lines.push(`**执行模式:** ${data.mode}\n`);
42
+ lines.push('---\n');
43
+
44
+ for (const flow of data.flows) {
45
+ const status = flow.failed > 0 ? 'X' : 'OK';
46
+ lines.push(`## Flow: ${flow.id} - ${flow.title} ${status}\n`);
47
+ lines.push('| 步骤 | 操作 | 验证 | 结果 |');
48
+ lines.push('|------|------|------|------|');
49
+
50
+ for (const step of flow.steps) {
51
+ let resultStr = '';
52
+ if (step.result === 'skip') resultStr = '>';
53
+ else if (step.result === 'pass') resultStr = 'OK';
54
+ else if (step.result === 'fail') resultStr = 'X';
55
+ else resultStr = step.result || '-';
56
+
57
+ lines.push(`| ${step.n} | ${step.op} | ${step.vf} | ${resultStr} |`);
58
+ }
59
+ lines.push('');
60
+ }
61
+
62
+ lines.push('---\n');
63
+ lines.push('## 汇总\n');
64
+ lines.push('| 项目 | 值 |');
65
+ lines.push('|------|-----|');
66
+ lines.push(`| 总 Flows 数 | ${data.flows.length} |`);
67
+ lines.push(`| 总步骤数 | ${total} |`);
68
+ lines.push(`| 通过 | ${data.passed} |`);
69
+ lines.push(`| 失败 | ${data.failed} |`);
70
+ lines.push(`| 跳过 | ${data.skipped} |`);
71
+ lines.push(`| 通过率 | ${passRate}% |\n`);
72
+
73
+ return lines.join('\n');
74
+ }
75
+
76
+ // ── CLI entry ─────────────────────────────────────────────────────
77
+
78
+ if (import.meta.filename === process.argv[1]) {
79
+ if (process.argv.includes('--help') || process.argv.includes('-h')) {
80
+ console.log(`
81
+ generate-report.mjs — 生成测试报告
82
+
83
+ 用法:
84
+ node generate-report.mjs --results <json> -o report.md
85
+ node generate-report.mjs --help
86
+ `);
87
+ process.exit(0);
88
+ }
89
+
90
+ const resultsIdx = process.argv.indexOf('--results');
91
+ const outIdx = process.argv.indexOf('-o');
92
+
93
+ if (resultsIdx < 0) {
94
+ console.error('--results 必填');
95
+ process.exit(1);
96
+ }
97
+
98
+ const resultsJson = process.argv[resultsIdx + 1];
99
+ let data;
100
+ try {
101
+ data = JSON.parse(resultsJson);
102
+ } catch {
103
+ console.error('--results 值不是有效 JSON');
104
+ process.exit(1);
105
+ }
106
+
107
+ const report = generateReport(data);
108
+
109
+ if (outIdx >= 0) {
110
+ const outPath = resolve(process.cwd(), process.argv[outIdx + 1]);
111
+ writeFileSync(outPath, report, 'utf8');
112
+ console.log(JSON.stringify({ written: true, path: outPath }));
113
+ } else {
114
+ process.stdout.write(report + '\n');
115
+ }
116
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepstorm/cli",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "description": "DeepStorm CLI — 一键配置项目开发环境",
5
5
  "license": "MIT",
6
6
  "author": "billkang",
@@ -16,7 +16,7 @@
16
16
  "dotenv": "^17.4.2",
17
17
  "handlebars": "^4.7.8",
18
18
  "js-yaml": "^4.1.0",
19
- "@deepstorm/pilot": "^0.9.2"
19
+ "@deepstorm/pilot": "^0.10.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^22.0.0",