@swedevtools/livedoc-vitest 0.2.0 → 0.3.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/CHANGELOG.md +34 -0
- package/LICENSE +20 -20
- package/README.md +160 -95
- package/dist/{RuleContext-BZhuy-zS.d.cts → RuleContext-DQ8o_n1D.d.ts} +62 -62
- package/dist/globals.d.ts +99 -99
- package/dist/{index-Blmp569T.d.cts → index-sbV15ohX.d.ts} +21 -2
- package/dist/index.d.ts +7 -5
- package/dist/index.js +1062 -159
- package/dist/reporter/index.d.ts +2 -2
- package/dist/reporter/index.js +629 -84
- package/package.json +14 -12
- package/tools/livedoc-setup.mjs +172 -164
- package/tools/skills/SKILL.md +339 -244
- package/tools/skills/VALIDATION.md +37 -29
- package/tools/skills/examples/routing.md +75 -60
- package/tools/skills/resources/anti-patterns.md +19 -0
- package/tools/skills/resources/bdd-features.md +231 -231
- package/tools/skills/resources/partial-testing.md +77 -0
- package/tools/skills/resources/playwright.md +148 -148
- package/tools/skills/resources/reporter-config.md +213 -163
- package/tools/skills/resources/specifications.md +159 -159
- package/tools/skills/resources/test-strategy.md +103 -0
- package/tools/skills/resources/web-testing.md +62 -0
- package/dist/RuleContext-BZhuy-zS.d.ts +0 -206
- package/dist/globals.cjs +0 -2
- package/dist/globals.d.cts +0 -104
- package/dist/index-CysiWbtk.d.ts +0 -687
- package/dist/index.cjs +0 -10024
- package/dist/index.d.cts +0 -291
- package/dist/playwright/index.cjs +0 -103
- package/dist/playwright/index.d.cts +0 -129
- package/dist/reporter/index.cjs +0 -8676
- package/dist/reporter/index.d.cts +0 -7
- package/dist/setup.cjs +0 -14
- package/dist/setup.d.cts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swedevtools/livedoc-vitest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"author": "Garry McGlennon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "BDD extensions for Vitest that support LiveDoc reporting with Gherkin syntax and MSpec-style specifications.",
|
|
@@ -20,41 +20,42 @@
|
|
|
20
20
|
"bin": {
|
|
21
21
|
"livedoc-vitest-setup": "./tools/livedoc-setup.mjs"
|
|
22
22
|
},
|
|
23
|
-
"main": "./dist/index.
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
24
|
"module": "./dist/index.js",
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
29
|
"import": "./dist/index.js",
|
|
30
|
-
"
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./reporter": {
|
|
33
33
|
"types": "./dist/reporter/index.d.ts",
|
|
34
34
|
"import": "./dist/reporter/index.js",
|
|
35
|
-
"
|
|
35
|
+
"default": "./dist/reporter/index.js"
|
|
36
36
|
},
|
|
37
37
|
"./setup": {
|
|
38
38
|
"types": "./dist/setup.d.ts",
|
|
39
39
|
"import": "./dist/setup.js",
|
|
40
|
-
"
|
|
40
|
+
"default": "./dist/setup.js"
|
|
41
41
|
},
|
|
42
42
|
"./globals": {
|
|
43
43
|
"types": "./dist/globals.d.ts",
|
|
44
44
|
"import": "./dist/globals.js",
|
|
45
|
-
"
|
|
45
|
+
"default": "./dist/globals.js"
|
|
46
46
|
},
|
|
47
47
|
"./playwright": {
|
|
48
48
|
"types": "./dist/playwright/index.d.ts",
|
|
49
49
|
"import": "./dist/playwright/index.js",
|
|
50
|
-
"
|
|
50
|
+
"default": "./dist/playwright/index.js"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"files": [
|
|
54
54
|
"dist",
|
|
55
55
|
"tools",
|
|
56
56
|
"README.md",
|
|
57
|
-
"LICENSE"
|
|
57
|
+
"LICENSE",
|
|
58
|
+
"CHANGELOG.md"
|
|
58
59
|
],
|
|
59
60
|
"keywords": [
|
|
60
61
|
"livedoc",
|
|
@@ -77,6 +78,7 @@
|
|
|
77
78
|
"@types/fs-extra": "^11.0.4",
|
|
78
79
|
"@types/node": "^20.19.27",
|
|
79
80
|
"@types/wordwrap": "^1.0.3",
|
|
81
|
+
"@vitest/coverage-v8": "4.1.0",
|
|
80
82
|
"@vitest/runner": "^4.0.16",
|
|
81
83
|
"@vitest/ui": "^4.0.16",
|
|
82
84
|
"chai": "^6.2.1",
|
|
@@ -86,13 +88,13 @@
|
|
|
86
88
|
"tsup": "^8.5.1",
|
|
87
89
|
"typescript": "^5.9.3",
|
|
88
90
|
"vitest": "^4.0.16",
|
|
89
|
-
"@swedevtools/livedoc-
|
|
90
|
-
"@swedevtools/livedoc-
|
|
91
|
+
"@swedevtools/livedoc-server": "^0.3.0",
|
|
92
|
+
"@swedevtools/livedoc-schema": "0.3.0"
|
|
91
93
|
},
|
|
92
94
|
"peerDependencies": {
|
|
93
|
-
"@swedevtools/livedoc-server": ">=
|
|
95
|
+
"@swedevtools/livedoc-server": ">=0.3.0",
|
|
94
96
|
"playwright": ">=1.50.0",
|
|
95
|
-
"vitest": ">=
|
|
97
|
+
"vitest": ">=4.0.16 <5"
|
|
96
98
|
},
|
|
97
99
|
"peerDependenciesMeta": {
|
|
98
100
|
"@swedevtools/livedoc-server": {
|
package/tools/livedoc-setup.mjs
CHANGED
|
@@ -1,164 +1,172 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// LiveDoc AI Skill Installer — install AI coding skills for your team.
|
|
3
|
-
// Usage:
|
|
4
|
-
// npx @swedevtools/livedoc-vitest setup # Interactive menu
|
|
5
|
-
// npx @swedevtools/livedoc-vitest setup --tool copilot # Non-interactive
|
|
6
|
-
// npx livedoc-vitest-setup --tool
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{ key: '
|
|
40
|
-
{ key: '
|
|
41
|
-
{ key: '
|
|
42
|
-
{ key: '
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
console.log('');
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
console.log('
|
|
120
|
-
console.log('');
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// LiveDoc AI Skill Installer — install AI coding skills for your team.
|
|
3
|
+
// Usage:
|
|
4
|
+
// npx @swedevtools/livedoc-vitest setup # Interactive menu
|
|
5
|
+
// npx @swedevtools/livedoc-vitest setup --tool copilot # Non-interactive
|
|
6
|
+
// npx livedoc-vitest-setup --tool copilot,codex,claude # Multiple tools
|
|
7
|
+
// npx livedoc-vitest-setup --tool all # Direct bin entry
|
|
8
|
+
|
|
9
|
+
import { existsSync, mkdirSync, cpSync, readdirSync, statSync, copyFileSync } from 'node:fs';
|
|
10
|
+
import { join, dirname, resolve, relative } from 'node:path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
import { createInterface } from 'node:readline';
|
|
13
|
+
import { execSync } from 'node:child_process';
|
|
14
|
+
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = dirname(__filename);
|
|
17
|
+
|
|
18
|
+
// ── Paths ──────────────────────────────────────────────────
|
|
19
|
+
const skillsSource = join(__dirname, 'skills');
|
|
20
|
+
|
|
21
|
+
if (!existsSync(join(skillsSource, 'SKILL.md'))) {
|
|
22
|
+
console.error(' Error: Could not find skill files at', skillsSource);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ── Git root discovery ─────────────────────────────────────
|
|
27
|
+
function findGitRoot() {
|
|
28
|
+
try {
|
|
29
|
+
return execSync('git rev-parse --show-toplevel', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
30
|
+
} catch {
|
|
31
|
+
return process.cwd();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const gitRoot = findGitRoot();
|
|
36
|
+
|
|
37
|
+
// ── Tool definitions (same mapping as xUnit SDK) ──────────
|
|
38
|
+
const tools = [
|
|
39
|
+
{ key: 'copilot', name: 'GitHub Copilot', dest: '.github/skills/livedoc-vitest' },
|
|
40
|
+
{ key: 'codex', name: 'OpenAI Codex', dest: '.agents/skills/livedoc-vitest' },
|
|
41
|
+
{ key: 'claude', name: 'Claude Code', dest: '.claude/skills/livedoc-vitest' },
|
|
42
|
+
{ key: 'roo', name: 'Roo Code', dest: '.roo/skills/livedoc-vitest' },
|
|
43
|
+
{ key: 'cursor', name: 'Cursor', dest: '.cursor/rules/livedoc-vitest' },
|
|
44
|
+
{ key: 'windsurf', name: 'Windsurf', dest: '.windsurf/rules/livedoc-vitest' },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
// ── Recursive directory copy ──────────────────────────────
|
|
48
|
+
function copyRecursive(src, dest) {
|
|
49
|
+
const entries = readdirSync(src, { withFileTypes: true });
|
|
50
|
+
mkdirSync(dest, { recursive: true });
|
|
51
|
+
for (const entry of entries) {
|
|
52
|
+
const srcPath = join(src, entry.name);
|
|
53
|
+
const destPath = join(dest, entry.name);
|
|
54
|
+
if (entry.isDirectory()) {
|
|
55
|
+
copyRecursive(srcPath, destPath);
|
|
56
|
+
} else {
|
|
57
|
+
copyFileSync(srcPath, destPath);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ── Install skills for selected tools ─────────────────────
|
|
63
|
+
function installSkills(selected) {
|
|
64
|
+
console.log('');
|
|
65
|
+
for (const tool of selected) {
|
|
66
|
+
const dest = join(gitRoot, tool.dest);
|
|
67
|
+
copyRecursive(skillsSource, dest);
|
|
68
|
+
console.log(` \x1b[32m[ok]\x1b[0m ${tool.name} → ${dest}`);
|
|
69
|
+
}
|
|
70
|
+
console.log('');
|
|
71
|
+
console.log(' \x1b[36mDone! Commit the generated files to share with your team.\x1b[0m');
|
|
72
|
+
console.log('');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ── Parse CLI args ────────────────────────────────────────
|
|
76
|
+
function parseArgs() {
|
|
77
|
+
const args = process.argv.slice(2);
|
|
78
|
+
// Strip leading "setup" command if present (npx @swedevtools/livedoc-vitest setup --tool X)
|
|
79
|
+
if (args[0] === 'setup') args.shift();
|
|
80
|
+
|
|
81
|
+
let toolArg = null;
|
|
82
|
+
for (let i = 0; i < args.length; i++) {
|
|
83
|
+
if (args[i] === '--tool' && args[i + 1]) {
|
|
84
|
+
toolArg = args[i + 1].toLowerCase();
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
// Also support --tool=value
|
|
88
|
+
if (args[i].startsWith('--tool=')) {
|
|
89
|
+
toolArg = args[i].slice('--tool='.length).toLowerCase();
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return toolArg;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ── Non-interactive mode ──────────────────────────────────
|
|
97
|
+
function resolveNonInteractive(toolArg) {
|
|
98
|
+
if (toolArg === 'all') return tools;
|
|
99
|
+
|
|
100
|
+
const requested = [...new Set(toolArg.split(',').map((value) => value.trim()).filter(Boolean))];
|
|
101
|
+
const selected = [];
|
|
102
|
+
for (const key of requested) {
|
|
103
|
+
const match = tools.find((tool) => tool.key === key);
|
|
104
|
+
if (!match) {
|
|
105
|
+
console.error(` Unknown tool: ${key}. Use: copilot, codex, claude, roo, cursor, windsurf, all`);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
selected.push(match);
|
|
109
|
+
}
|
|
110
|
+
return selected;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── Interactive menu ──────────────────────────────────────
|
|
114
|
+
function showInteractiveMenu() {
|
|
115
|
+
return new Promise((resolve) => {
|
|
116
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
117
|
+
|
|
118
|
+
console.log('');
|
|
119
|
+
console.log(' \x1b[36mLiveDoc AI Skill Installer\x1b[0m');
|
|
120
|
+
console.log('');
|
|
121
|
+
console.log(' Select AI tool(s) to install skills for:');
|
|
122
|
+
console.log('');
|
|
123
|
+
tools.forEach((t, i) => {
|
|
124
|
+
console.log(` ${i + 1}. ${t.name}`);
|
|
125
|
+
});
|
|
126
|
+
console.log(' A. All of the above');
|
|
127
|
+
console.log(' Use commas to select multiple tools, for example: 1,2,3');
|
|
128
|
+
console.log('');
|
|
129
|
+
|
|
130
|
+
rl.question(' Choice(s) [A]: ', (answer) => {
|
|
131
|
+
rl.close();
|
|
132
|
+
const choice = (answer || 'A').trim();
|
|
133
|
+
|
|
134
|
+
if (choice.toLowerCase() === 'a') {
|
|
135
|
+
resolve(tools);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const indices = [...new Set(choice.split(',').map((value) => Number.parseInt(value.trim(), 10)))];
|
|
140
|
+
if (indices.length > 0 && indices.every((idx) => idx >= 1 && idx <= tools.length)) {
|
|
141
|
+
resolve(indices.map((idx) => tools[idx - 1]));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
console.error(` Invalid choice: ${choice}`);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ── Main ──────────────────────────────────────────────────
|
|
152
|
+
async function main() {
|
|
153
|
+
const toolArg = parseArgs();
|
|
154
|
+
|
|
155
|
+
let selected;
|
|
156
|
+
if (toolArg) {
|
|
157
|
+
selected = resolveNonInteractive(toolArg);
|
|
158
|
+
} else if (!process.stdin.isTTY) {
|
|
159
|
+
// Non-interactive context without --tool: default to all
|
|
160
|
+
console.log(' Non-interactive context detected. Installing for all tools.');
|
|
161
|
+
selected = tools;
|
|
162
|
+
} else {
|
|
163
|
+
selected = await showInteractiveMenu();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
installSkills(selected);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
main().catch((err) => {
|
|
170
|
+
console.error(err);
|
|
171
|
+
process.exit(1);
|
|
172
|
+
});
|