qualiow-exploratory-testing 1.0.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/LICENSE +21 -0
- package/README.md +214 -0
- package/data/domains/_default.yml +167 -0
- package/data/domains/ecommerce.yml +198 -0
- package/data/domains/fintech.yml +207 -0
- package/data/domains/marketing.yml +202 -0
- package/data/domains/saas.yml +206 -0
- package/data/knowledge/changelog.yml +75 -0
- package/data/knowledge/custom/.gitkeep +0 -0
- package/data/knowledge/learned-patterns.md +40 -0
- package/data/knowledge/manifest.yml +141 -0
- package/data/knowledge/releases/v0.1.0/entries/checklist-accessibility-wcag.yml +326 -0
- package/data/knowledge/releases/v0.1.0/entries/heuristic-few-hiccupps.yml +194 -0
- package/data/knowledge/releases/v0.1.0/entries/heuristic-goldilocks.yml +143 -0
- package/data/knowledge/releases/v0.1.0/entries/heuristic-rcrcrc.yml +207 -0
- package/data/knowledge/releases/v0.1.0/entries/heuristic-sfdipot.yml +171 -0
- package/data/knowledge/releases/v0.1.0/entries/heuristic-test-tours.yml +253 -0
- package/data/knowledge/releases/v0.1.0/entries/reference-exploratory-testing-types.yml +84 -0
- package/data/knowledge/releases/v0.1.0/entries/reference-heuristic-praxis.yml +95 -0
- package/data/knowledge/releases/v0.1.0/entries/technique-boundary-testing.yml +203 -0
- package/data/knowledge/releases/v0.1.0/entries/technique-business-logic-race-conditions.yml +146 -0
- package/data/knowledge/releases/v0.1.0/entries/technique-data-integrity-testing.yml +269 -0
- package/data/knowledge/releases/v0.1.0/entries/technique-error-guessing.yml +216 -0
- package/data/knowledge/releases/v0.1.0/entries/technique-risk-based-testing.yml +298 -0
- package/data/knowledge/releases/v0.1.0/release.yml +22 -0
- package/data/targets/_default.yml +11 -0
- package/data/targets/testers-ai.yml +14 -0
- package/data/templates/bug-report.md +178 -0
- package/data/templates/coverage-map.md +70 -0
- package/data/templates/session-charter.md +77 -0
- package/data/templates/session-report.md +112 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +1757 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +899 -0
- package/dist/index.js +1133 -0
- package/dist/index.js.map +1 -0
- package/docs/GETTING-STARTED.md +265 -0
- package/package.json +70 -0
- package/skills/qa-explore/SKILL.md +70 -0
- package/skills/qa-explore/phases/00-setup.md +96 -0
- package/skills/qa-explore/phases/01-auth.md +34 -0
- package/skills/qa-explore/phases/02-charter.md +112 -0
- package/skills/qa-explore/phases/03-discovery.md +49 -0
- package/skills/qa-explore/phases/04-journeys.md +51 -0
- package/skills/qa-explore/phases/05-features.md +55 -0
- package/skills/qa-explore/phases/06-edge-cases.md +69 -0
- package/skills/qa-explore/phases/07-reporting.md +162 -0
- package/skills/qa-explore/references/context-integration.md +44 -0
- package/skills/qa-explore/references/security-rules.md +43 -0
- package/skills/qa-explore/references/session-rules.md +33 -0
- package/skills/qa-explore/references/severity-guide.md +14 -0
- package/skills/qa-explore-cleanup/SKILL.md +39 -0
- package/skills/qa-explore-feedback/SKILL.md +73 -0
- package/skills/qa-explore-quick/SKILL.md +80 -0
- package/skills/qa-explore-report/SKILL.md +62 -0
- package/skills/qa-gather/SKILL.md +198 -0
- package/skills/qa-knowledge-add/SKILL.md +91 -0
- package/skills/qa-knowledge-list/SKILL.md +54 -0
- package/skills/qa-target-setup/SKILL.md +106 -0
|
@@ -0,0 +1,1757 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli/index.ts
|
|
4
|
+
import { Command as Command7 } from "commander";
|
|
5
|
+
|
|
6
|
+
// src/cli/commands/init.ts
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
import { dirname, resolve, join } from "path";
|
|
10
|
+
import {
|
|
11
|
+
existsSync,
|
|
12
|
+
readFileSync,
|
|
13
|
+
writeFileSync,
|
|
14
|
+
mkdirSync,
|
|
15
|
+
readdirSync
|
|
16
|
+
} from "fs";
|
|
17
|
+
import { cp } from "fs/promises";
|
|
18
|
+
import chalk from "chalk";
|
|
19
|
+
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
function resolvePackageRoot() {
|
|
21
|
+
let current = __dirname;
|
|
22
|
+
for (let i = 0; i < 10; i++) {
|
|
23
|
+
if (existsSync(join(current, "data")) && existsSync(join(current, "package.json"))) {
|
|
24
|
+
return current;
|
|
25
|
+
}
|
|
26
|
+
current = dirname(current);
|
|
27
|
+
}
|
|
28
|
+
return resolve(__dirname, "..", "..");
|
|
29
|
+
}
|
|
30
|
+
var GITIGNORE_ENTRIES = [
|
|
31
|
+
"",
|
|
32
|
+
"# Qualiow",
|
|
33
|
+
".auth/",
|
|
34
|
+
".env",
|
|
35
|
+
"output/sessions/*/",
|
|
36
|
+
".playwright-cli/",
|
|
37
|
+
"*.trace.zip",
|
|
38
|
+
"*.webm",
|
|
39
|
+
"dist/"
|
|
40
|
+
];
|
|
41
|
+
var INDEX_MD_HEADER = `# Exploratory Testing Sessions
|
|
42
|
+
|
|
43
|
+
| Date | Target | Duration | Bugs | Session Directory |
|
|
44
|
+
|------|--------|----------|------|-------------------|
|
|
45
|
+
`;
|
|
46
|
+
var ALL_BUGS_MD_HEADER = `# All Bugs \u2014 Exploratory Testing
|
|
47
|
+
|
|
48
|
+
> Aggregated bug list across all sessions.
|
|
49
|
+
|
|
50
|
+
| ID | Title | Severity | Session | Component |
|
|
51
|
+
|----|-------|----------|---------|-----------|
|
|
52
|
+
`;
|
|
53
|
+
var ENV_EXAMPLE = `# Qualiow \u2014 Environment Variables
|
|
54
|
+
# Copy this file to .env and fill in values.
|
|
55
|
+
|
|
56
|
+
# Target auth tokens (if needed)
|
|
57
|
+
# AUTH_TOKEN=
|
|
58
|
+
|
|
59
|
+
# Playwright options
|
|
60
|
+
# HEADLESS=false
|
|
61
|
+
`;
|
|
62
|
+
function initCommand() {
|
|
63
|
+
const cmd = new Command("init").description("Initialize qualiow in the current project").option("--include-examples", "Include example target configurations", false).option("--force", "Overwrite existing files", false).action(async (options) => {
|
|
64
|
+
try {
|
|
65
|
+
await runInit(options);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.error(chalk.red("Error during init:"), err instanceof Error ? err.message : err);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return cmd;
|
|
72
|
+
}
|
|
73
|
+
async function runInit(options) {
|
|
74
|
+
const cwd = process.cwd();
|
|
75
|
+
const pkgRoot = resolvePackageRoot();
|
|
76
|
+
const skillsDest = join(cwd, ".claude", "skills");
|
|
77
|
+
const existingSkills = existsSync(skillsDest) ? readdirSync(skillsDest).filter((f) => f.startsWith("qa-")) : [];
|
|
78
|
+
if (existingSkills.length > 0 && !options.force) {
|
|
79
|
+
console.warn(
|
|
80
|
+
chalk.yellow(
|
|
81
|
+
`Warning: ${existingSkills.length} skill(s) already exist in .claude/skills/ (${existingSkills.join(", ")}). Use --force to overwrite.`
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
const skillsSrc = join(pkgRoot, ".claude", "skills");
|
|
86
|
+
if (existsSync(skillsSrc)) {
|
|
87
|
+
const srcReal = resolve(skillsSrc);
|
|
88
|
+
const destReal = resolve(skillsDest);
|
|
89
|
+
if (srcReal !== destReal) {
|
|
90
|
+
if (existingSkills.length === 0 || options.force) {
|
|
91
|
+
mkdirSync(skillsDest, { recursive: true });
|
|
92
|
+
await cp(skillsSrc, skillsDest, { recursive: true, force: options.force });
|
|
93
|
+
console.log(chalk.green(" \u2713 Skills installed to .claude/skills/"));
|
|
94
|
+
} else {
|
|
95
|
+
console.log(chalk.cyan(" \u25CB Skills skipped (already exist, use --force to overwrite)"));
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
console.log(chalk.cyan(" \u25CB Skills directory is the same as source \u2014 skipped"));
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
console.log(chalk.yellow(" \u26A0 No skills/ directory found in package root"));
|
|
102
|
+
}
|
|
103
|
+
const dataSrc = join(pkgRoot, "data");
|
|
104
|
+
const dataDest = join(cwd, "data");
|
|
105
|
+
if (existsSync(dataSrc)) {
|
|
106
|
+
const srcReal = resolve(dataSrc);
|
|
107
|
+
const destReal = resolve(dataDest);
|
|
108
|
+
if (srcReal !== destReal) {
|
|
109
|
+
mkdirSync(dataDest, { recursive: true });
|
|
110
|
+
const knowledgeSrc = join(dataSrc, "knowledge");
|
|
111
|
+
if (existsSync(knowledgeSrc)) {
|
|
112
|
+
await cp(knowledgeSrc, join(dataDest, "knowledge"), { recursive: true, force: options.force });
|
|
113
|
+
console.log(chalk.green(" \u2713 Knowledge base installed to data/knowledge/"));
|
|
114
|
+
}
|
|
115
|
+
const domainsSrc = join(dataSrc, "domains");
|
|
116
|
+
if (existsSync(domainsSrc)) {
|
|
117
|
+
await cp(domainsSrc, join(dataDest, "domains"), { recursive: true, force: options.force });
|
|
118
|
+
console.log(chalk.green(" \u2713 Domain configs installed to data/domains/"));
|
|
119
|
+
}
|
|
120
|
+
const templatesSrc = join(dataSrc, "templates");
|
|
121
|
+
if (existsSync(templatesSrc)) {
|
|
122
|
+
await cp(templatesSrc, join(dataDest, "templates"), { recursive: true, force: options.force });
|
|
123
|
+
console.log(chalk.green(" \u2713 Templates installed to data/templates/"));
|
|
124
|
+
}
|
|
125
|
+
const securitySrc = join(dataSrc, "security");
|
|
126
|
+
if (existsSync(securitySrc)) {
|
|
127
|
+
await cp(securitySrc, join(dataDest, "security"), { recursive: true, force: options.force });
|
|
128
|
+
console.log(chalk.green(" \u2713 Security policies installed to data/security/"));
|
|
129
|
+
}
|
|
130
|
+
const targetsSrc = join(dataSrc, "targets");
|
|
131
|
+
const targetsDest = join(dataDest, "targets");
|
|
132
|
+
if (existsSync(targetsSrc)) {
|
|
133
|
+
mkdirSync(targetsDest, { recursive: true });
|
|
134
|
+
const defaultFile = join(targetsSrc, "_default.yml");
|
|
135
|
+
if (existsSync(defaultFile)) {
|
|
136
|
+
const content = readFileSync(defaultFile, "utf-8");
|
|
137
|
+
writeFileSync(join(targetsDest, "_default.yml"), content);
|
|
138
|
+
}
|
|
139
|
+
if (options.includeExamples) {
|
|
140
|
+
const targetFiles = readdirSync(targetsSrc).filter(
|
|
141
|
+
(f) => f.endsWith(".yml") && f !== "_default.yml"
|
|
142
|
+
);
|
|
143
|
+
for (const file of targetFiles) {
|
|
144
|
+
const content = readFileSync(join(targetsSrc, file), "utf-8");
|
|
145
|
+
writeFileSync(join(targetsDest, file), content);
|
|
146
|
+
}
|
|
147
|
+
console.log(chalk.green(" \u2713 Target configs installed to data/targets/ (with examples)"));
|
|
148
|
+
} else {
|
|
149
|
+
console.log(chalk.green(" \u2713 Default target config installed to data/targets/"));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
console.log(chalk.cyan(" \u25CB Data directory is the same as source \u2014 skipped"));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const outputDirs = [
|
|
157
|
+
join(cwd, "output", "sessions"),
|
|
158
|
+
join(cwd, "output", "bugs"),
|
|
159
|
+
join(cwd, "output", "context"),
|
|
160
|
+
join(cwd, ".auth")
|
|
161
|
+
];
|
|
162
|
+
for (const dir of outputDirs) {
|
|
163
|
+
mkdirSync(dir, { recursive: true });
|
|
164
|
+
}
|
|
165
|
+
console.log(chalk.green(" \u2713 Output directories created"));
|
|
166
|
+
const indexPath = join(cwd, "output", "sessions", "INDEX.md");
|
|
167
|
+
if (!existsSync(indexPath)) {
|
|
168
|
+
writeFileSync(indexPath, INDEX_MD_HEADER);
|
|
169
|
+
console.log(chalk.green(" \u2713 Created output/sessions/INDEX.md"));
|
|
170
|
+
}
|
|
171
|
+
const allBugsPath = join(cwd, "output", "bugs", "all-bugs.md");
|
|
172
|
+
if (!existsSync(allBugsPath)) {
|
|
173
|
+
writeFileSync(allBugsPath, ALL_BUGS_MD_HEADER);
|
|
174
|
+
console.log(chalk.green(" \u2713 Created output/bugs/all-bugs.md"));
|
|
175
|
+
}
|
|
176
|
+
const envExamplePath = join(cwd, ".env.example");
|
|
177
|
+
if (!existsSync(envExamplePath)) {
|
|
178
|
+
writeFileSync(envExamplePath, ENV_EXAMPLE);
|
|
179
|
+
console.log(chalk.green(" \u2713 Created .env.example"));
|
|
180
|
+
}
|
|
181
|
+
const gitignorePath = join(cwd, ".gitignore");
|
|
182
|
+
let gitignoreContent = "";
|
|
183
|
+
if (existsSync(gitignorePath)) {
|
|
184
|
+
gitignoreContent = readFileSync(gitignorePath, "utf-8");
|
|
185
|
+
}
|
|
186
|
+
const linesToAdd = [];
|
|
187
|
+
for (const entry of GITIGNORE_ENTRIES) {
|
|
188
|
+
if (entry === "" || entry.startsWith("#")) {
|
|
189
|
+
if (!gitignoreContent.includes("# Qualiow") && entry === "# Qualiow") {
|
|
190
|
+
linesToAdd.push(entry);
|
|
191
|
+
} else if (entry === "" && linesToAdd.length === 0) {
|
|
192
|
+
linesToAdd.push(entry);
|
|
193
|
+
}
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (!gitignoreContent.includes(entry)) {
|
|
197
|
+
linesToAdd.push(entry);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (linesToAdd.length > 0) {
|
|
201
|
+
const appendStr = (gitignoreContent.endsWith("\n") || gitignoreContent === "" ? "" : "\n") + linesToAdd.join("\n") + "\n";
|
|
202
|
+
writeFileSync(gitignorePath, gitignoreContent + appendStr);
|
|
203
|
+
console.log(chalk.green(" \u2713 Updated .gitignore"));
|
|
204
|
+
}
|
|
205
|
+
console.log("");
|
|
206
|
+
console.log(chalk.cyan.bold("Qualiow initialized successfully!"));
|
|
207
|
+
console.log("");
|
|
208
|
+
console.log(chalk.white("Next steps:"));
|
|
209
|
+
console.log(chalk.white(" 1. Install Playwright CLI: npm install @playwright/cli"));
|
|
210
|
+
console.log(chalk.white(" 2. Run your first session: /qa-explore https://your-app.com"));
|
|
211
|
+
console.log(chalk.white(" 3. Or use the CLI: npx qualiow explore https://your-app.com"));
|
|
212
|
+
console.log("");
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// src/cli/commands/validate.ts
|
|
216
|
+
import { Command as Command2 } from "commander";
|
|
217
|
+
import { resolve as resolve3, relative } from "path";
|
|
218
|
+
import { existsSync as existsSync2 } from "fs";
|
|
219
|
+
import { globSync as globSync2 } from "glob";
|
|
220
|
+
import chalk2 from "chalk";
|
|
221
|
+
|
|
222
|
+
// src/utils/validate.ts
|
|
223
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
224
|
+
import { resolve as resolve2, join as join2 } from "path";
|
|
225
|
+
import { parse as parseYaml } from "yaml";
|
|
226
|
+
import { ZodError } from "zod";
|
|
227
|
+
|
|
228
|
+
// src/schemas/target.schema.ts
|
|
229
|
+
import { z } from "zod";
|
|
230
|
+
var AuthConfigSchema = z.object({
|
|
231
|
+
strategy: z.enum(["none", "storage_state", "credentials", "token"]),
|
|
232
|
+
state_file: z.string().optional(),
|
|
233
|
+
login_url: z.string().url().optional(),
|
|
234
|
+
credentials: z.object({
|
|
235
|
+
username: z.string(),
|
|
236
|
+
password: z.string()
|
|
237
|
+
}).optional(),
|
|
238
|
+
token: z.string().optional()
|
|
239
|
+
});
|
|
240
|
+
var BrowserConfigSchema = z.object({
|
|
241
|
+
headless: z.boolean(),
|
|
242
|
+
viewport: z.object({
|
|
243
|
+
width: z.number().int().positive(),
|
|
244
|
+
height: z.number().int().positive()
|
|
245
|
+
})
|
|
246
|
+
});
|
|
247
|
+
var ScopeConfigSchema = z.object({
|
|
248
|
+
start_pages: z.array(z.string()).optional(),
|
|
249
|
+
max_depth: z.number().int().min(0),
|
|
250
|
+
include_patterns: z.array(z.string()).optional(),
|
|
251
|
+
exclude_patterns: z.array(z.string()).optional()
|
|
252
|
+
});
|
|
253
|
+
var SafetyConfigSchema = z.object({
|
|
254
|
+
read_only: z.boolean(),
|
|
255
|
+
no_form_submit: z.boolean(),
|
|
256
|
+
no_file_upload: z.boolean().optional(),
|
|
257
|
+
no_delete_actions: z.boolean().optional()
|
|
258
|
+
});
|
|
259
|
+
var TargetConfigSchema = z.object({
|
|
260
|
+
id: z.string().min(1),
|
|
261
|
+
name: z.string().min(1),
|
|
262
|
+
base_url: z.string().url(),
|
|
263
|
+
domain: z.string().min(1),
|
|
264
|
+
auth: AuthConfigSchema,
|
|
265
|
+
browser: BrowserConfigSchema,
|
|
266
|
+
scope: ScopeConfigSchema,
|
|
267
|
+
safety: SafetyConfigSchema.optional(),
|
|
268
|
+
notes: z.string().optional()
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// src/schemas/knowledge-entry.schema.ts
|
|
272
|
+
import { z as z2 } from "zod";
|
|
273
|
+
var KnowledgeEntryContentSchema = z2.object({
|
|
274
|
+
summary: z2.string().min(1)
|
|
275
|
+
}).passthrough();
|
|
276
|
+
var KnowledgeEntrySchema = z2.object({
|
|
277
|
+
id: z2.string().min(1),
|
|
278
|
+
version: z2.string().min(1),
|
|
279
|
+
type: z2.enum(["heuristic", "technique", "checklist", "reference"]),
|
|
280
|
+
name: z2.string().min(1),
|
|
281
|
+
description: z2.string().min(1),
|
|
282
|
+
author: z2.string().optional(),
|
|
283
|
+
source: z2.string().optional(),
|
|
284
|
+
tags: z2.array(z2.string()).min(1),
|
|
285
|
+
domains: z2.array(z2.string()).min(1),
|
|
286
|
+
priority: z2.enum(["high", "medium", "low"]),
|
|
287
|
+
added: z2.string().min(1),
|
|
288
|
+
content: KnowledgeEntryContentSchema
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// src/schemas/domain-config.schema.ts
|
|
292
|
+
import { z as z3 } from "zod";
|
|
293
|
+
var JourneySchema = z3.object({
|
|
294
|
+
id: z3.string().min(1),
|
|
295
|
+
name: z3.string().min(1),
|
|
296
|
+
description: z3.string().min(1),
|
|
297
|
+
steps: z3.array(z3.string()).min(1),
|
|
298
|
+
risk: z3.enum(["high", "medium", "low"])
|
|
299
|
+
});
|
|
300
|
+
var DomainConfigSchema = z3.object({
|
|
301
|
+
id: z3.string().min(1),
|
|
302
|
+
name: z3.string().min(1),
|
|
303
|
+
risk_ranking: z3.array(z3.string()).min(1),
|
|
304
|
+
completeness_checklist: z3.array(z3.string()).min(1),
|
|
305
|
+
data_integrity_checks: z3.array(z3.string()).min(1),
|
|
306
|
+
journeys: z3.array(JourneySchema).min(1),
|
|
307
|
+
guidance: z3.array(z3.string()).min(1)
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
// src/utils/validate.ts
|
|
311
|
+
import { globSync } from "glob";
|
|
312
|
+
function validateYamlFile(filePath, schema) {
|
|
313
|
+
const absPath = resolve2(filePath);
|
|
314
|
+
try {
|
|
315
|
+
const raw = readFileSync2(absPath, "utf-8");
|
|
316
|
+
const data = parseYaml(raw);
|
|
317
|
+
schema.parse(data);
|
|
318
|
+
return { file: absPath, valid: true };
|
|
319
|
+
} catch (err) {
|
|
320
|
+
if (err instanceof ZodError) {
|
|
321
|
+
return {
|
|
322
|
+
file: absPath,
|
|
323
|
+
valid: false,
|
|
324
|
+
errors: err.issues.map((issue) => ({
|
|
325
|
+
path: issue.path.join("."),
|
|
326
|
+
message: issue.message
|
|
327
|
+
}))
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return {
|
|
331
|
+
file: absPath,
|
|
332
|
+
valid: false,
|
|
333
|
+
errors: [
|
|
334
|
+
{
|
|
335
|
+
path: "",
|
|
336
|
+
message: err instanceof Error ? err.message : "Unknown parsing error"
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function validateTargetConfig(filePath) {
|
|
343
|
+
return validateYamlFile(filePath, TargetConfigSchema);
|
|
344
|
+
}
|
|
345
|
+
function validateKnowledgeEntry(filePath) {
|
|
346
|
+
return validateYamlFile(filePath, KnowledgeEntrySchema);
|
|
347
|
+
}
|
|
348
|
+
function validateDomainConfig(filePath) {
|
|
349
|
+
return validateYamlFile(filePath, DomainConfigSchema);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// src/cli/commands/validate.ts
|
|
353
|
+
function validateCommand() {
|
|
354
|
+
const cmd = new Command2("validate").description("Validate all configuration files").option("--targets", "Validate target configurations only").option("--knowledge", "Validate knowledge entries only").option("--domains", "Validate domain configurations only").option("--all", "Validate all configurations (default)").action(async (options) => {
|
|
355
|
+
try {
|
|
356
|
+
runValidate(options);
|
|
357
|
+
} catch (err) {
|
|
358
|
+
console.error(chalk2.red("Error during validation:"), err instanceof Error ? err.message : err);
|
|
359
|
+
process.exit(1);
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
return cmd;
|
|
363
|
+
}
|
|
364
|
+
function runValidate(options) {
|
|
365
|
+
const cwd = process.cwd();
|
|
366
|
+
const dataDir = resolve3(cwd, "data");
|
|
367
|
+
const runAll = options.all || !options.targets && !options.knowledge && !options.domains;
|
|
368
|
+
if (!existsSync2(dataDir)) {
|
|
369
|
+
console.error(chalk2.red("Error: data/ directory not found. Run `npx qualiow init` first."));
|
|
370
|
+
process.exit(1);
|
|
371
|
+
}
|
|
372
|
+
const results = [];
|
|
373
|
+
if (runAll || options.targets) {
|
|
374
|
+
const targetDir = resolve3(dataDir, "targets");
|
|
375
|
+
if (existsSync2(targetDir)) {
|
|
376
|
+
const files = globSync2(resolve3(targetDir, "*.yml"));
|
|
377
|
+
console.log(chalk2.cyan.bold(`
|
|
378
|
+
Targets (${files.length} files):`));
|
|
379
|
+
for (const file of files) {
|
|
380
|
+
const result = validateTargetConfig(file);
|
|
381
|
+
results.push(result);
|
|
382
|
+
printResult(result, cwd);
|
|
383
|
+
}
|
|
384
|
+
} else {
|
|
385
|
+
console.log(chalk2.yellow("\n No targets/ directory found"));
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (runAll || options.knowledge) {
|
|
389
|
+
const knowledgeDir = resolve3(dataDir, "knowledge");
|
|
390
|
+
if (existsSync2(knowledgeDir)) {
|
|
391
|
+
const files = globSync2(resolve3(knowledgeDir, "releases", "**", "entries", "*.yml"));
|
|
392
|
+
console.log(chalk2.cyan.bold(`
|
|
393
|
+
Knowledge entries (${files.length} files):`));
|
|
394
|
+
for (const file of files) {
|
|
395
|
+
const result = validateKnowledgeEntry(file);
|
|
396
|
+
results.push(result);
|
|
397
|
+
printResult(result, cwd);
|
|
398
|
+
}
|
|
399
|
+
} else {
|
|
400
|
+
console.log(chalk2.yellow("\n No knowledge/ directory found"));
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (runAll || options.domains) {
|
|
404
|
+
const domainsDir = resolve3(dataDir, "domains");
|
|
405
|
+
if (existsSync2(domainsDir)) {
|
|
406
|
+
const files = globSync2(resolve3(domainsDir, "*.yml"));
|
|
407
|
+
console.log(chalk2.cyan.bold(`
|
|
408
|
+
Domains (${files.length} files):`));
|
|
409
|
+
for (const file of files) {
|
|
410
|
+
const result = validateDomainConfig(file);
|
|
411
|
+
results.push(result);
|
|
412
|
+
printResult(result, cwd);
|
|
413
|
+
}
|
|
414
|
+
} else {
|
|
415
|
+
console.log(chalk2.yellow("\n No domains/ directory found"));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
const total = results.length;
|
|
419
|
+
const passed = results.filter((r) => r.valid).length;
|
|
420
|
+
const failed = total - passed;
|
|
421
|
+
console.log("");
|
|
422
|
+
console.log(chalk2.bold("Summary:"));
|
|
423
|
+
console.log(
|
|
424
|
+
` ${total} files validated, ${chalk2.green(`${passed} passed`)}, ${failed > 0 ? chalk2.red(`${failed} failed`) : chalk2.green(`${failed} failed`)}`
|
|
425
|
+
);
|
|
426
|
+
console.log("");
|
|
427
|
+
if (failed > 0) {
|
|
428
|
+
process.exit(1);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
function printResult(result, cwd) {
|
|
432
|
+
const relPath = relative(cwd, result.file);
|
|
433
|
+
if (result.valid) {
|
|
434
|
+
console.log(` ${chalk2.green("PASS")} ${relPath}`);
|
|
435
|
+
} else {
|
|
436
|
+
console.log(` ${chalk2.red("FAIL")} ${relPath}`);
|
|
437
|
+
if (result.errors) {
|
|
438
|
+
for (const err of result.errors) {
|
|
439
|
+
const pathStr = err.path ? `[${err.path}] ` : "";
|
|
440
|
+
console.log(` ${chalk2.red("\u2192")} ${pathStr}${err.message}`);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// src/cli/commands/list.ts
|
|
447
|
+
import { Command as Command3 } from "commander";
|
|
448
|
+
import { resolve as resolve4, join as join3 } from "path";
|
|
449
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync as readdirSync2 } from "fs";
|
|
450
|
+
import { parse as parseYaml2 } from "yaml";
|
|
451
|
+
import chalk3 from "chalk";
|
|
452
|
+
function listCommand() {
|
|
453
|
+
const cmd = new Command3("list").description("List sessions, knowledge, targets, or domains").argument("<type>", "What to list: sessions, knowledge, targets, domains").action(async (type) => {
|
|
454
|
+
try {
|
|
455
|
+
await runList(type);
|
|
456
|
+
} catch (err) {
|
|
457
|
+
console.error(chalk3.red("Error:"), err instanceof Error ? err.message : err);
|
|
458
|
+
process.exit(1);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
return cmd;
|
|
462
|
+
}
|
|
463
|
+
async function runList(type) {
|
|
464
|
+
const cwd = process.cwd();
|
|
465
|
+
switch (type) {
|
|
466
|
+
case "sessions":
|
|
467
|
+
listSessions(cwd);
|
|
468
|
+
break;
|
|
469
|
+
case "knowledge":
|
|
470
|
+
listKnowledge(cwd);
|
|
471
|
+
break;
|
|
472
|
+
case "targets":
|
|
473
|
+
listTargets(cwd);
|
|
474
|
+
break;
|
|
475
|
+
case "domains":
|
|
476
|
+
listDomains(cwd);
|
|
477
|
+
break;
|
|
478
|
+
default:
|
|
479
|
+
console.error(chalk3.red(`Unknown type: "${type}". Choose from: sessions, knowledge, targets, domains`));
|
|
480
|
+
process.exit(1);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
function listSessions(cwd) {
|
|
484
|
+
const indexPath = resolve4(cwd, "output", "sessions", "INDEX.md");
|
|
485
|
+
if (!existsSync3(indexPath)) {
|
|
486
|
+
console.log(chalk3.yellow("No sessions found. Run `npx qualiow init` first, then start a session."));
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const content = readFileSync3(indexPath, "utf-8");
|
|
490
|
+
const lines = content.split("\n");
|
|
491
|
+
const tableRows = lines.filter(
|
|
492
|
+
(line) => line.startsWith("|") && !line.startsWith("|---") && !line.startsWith("| Date") && line.trim() !== ""
|
|
493
|
+
);
|
|
494
|
+
if (tableRows.length === 0) {
|
|
495
|
+
console.log(chalk3.cyan("\nSessions:"));
|
|
496
|
+
console.log(chalk3.yellow(" No sessions recorded yet."));
|
|
497
|
+
console.log(chalk3.white(" Start one with: npx qualiow explore <url>"));
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
console.log(chalk3.cyan.bold("\nSessions:"));
|
|
501
|
+
console.log("");
|
|
502
|
+
const header = ` ${pad("Date", 12)} ${pad("Target", 20)} ${pad("Duration", 10)} ${pad("Bugs", 6)} Session Directory`;
|
|
503
|
+
console.log(chalk3.bold(header));
|
|
504
|
+
console.log(` ${"\u2500".repeat(12)} ${"\u2500".repeat(20)} ${"\u2500".repeat(10)} ${"\u2500".repeat(6)} ${"\u2500".repeat(30)}`);
|
|
505
|
+
for (const row of tableRows) {
|
|
506
|
+
const cells = row.split("|").map((c) => c.trim()).filter((c) => c !== "");
|
|
507
|
+
if (cells.length >= 5) {
|
|
508
|
+
console.log(
|
|
509
|
+
` ${pad(cells[0], 12)} ${pad(cells[1], 20)} ${pad(cells[2], 10)} ${pad(cells[3], 6)} ${cells[4]}`
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
console.log("");
|
|
514
|
+
console.log(chalk3.white(` Total: ${tableRows.length} session(s)`));
|
|
515
|
+
console.log("");
|
|
516
|
+
}
|
|
517
|
+
function listKnowledge(cwd) {
|
|
518
|
+
const manifestPath = resolve4(cwd, "data", "knowledge", "manifest.yml");
|
|
519
|
+
if (!existsSync3(manifestPath)) {
|
|
520
|
+
console.log(chalk3.yellow("No knowledge base found. Run `npx qualiow init` first."));
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
const raw = readFileSync3(manifestPath, "utf-8");
|
|
524
|
+
const manifest = parseYaml2(raw);
|
|
525
|
+
console.log(chalk3.cyan.bold("\nKnowledge Base:"));
|
|
526
|
+
console.log(chalk3.white(` Version: ${manifest.version} | Entries: ${manifest.stats.total_entries}`));
|
|
527
|
+
console.log("");
|
|
528
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
529
|
+
for (const entry of manifest.entries) {
|
|
530
|
+
const list = grouped.get(entry.type) ?? [];
|
|
531
|
+
list.push(entry);
|
|
532
|
+
grouped.set(entry.type, list);
|
|
533
|
+
}
|
|
534
|
+
for (const [type, entries] of grouped) {
|
|
535
|
+
console.log(chalk3.cyan(` ${type.charAt(0).toUpperCase() + type.slice(1)}s (${entries.length}):`));
|
|
536
|
+
for (const entry of entries) {
|
|
537
|
+
const priorityColor = entry.priority === "high" ? chalk3.red : entry.priority === "medium" ? chalk3.yellow : chalk3.white;
|
|
538
|
+
const tags = entry.tags.map((t) => chalk3.gray(t)).join(", ");
|
|
539
|
+
console.log(
|
|
540
|
+
` ${priorityColor(`[${entry.priority}]`)} ${entry.id} ${chalk3.gray("tags:")} ${tags}`
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
console.log("");
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function listTargets(cwd) {
|
|
547
|
+
const targetsDir = resolve4(cwd, "data", "targets");
|
|
548
|
+
if (!existsSync3(targetsDir)) {
|
|
549
|
+
console.log(chalk3.yellow("No targets found. Run `npx qualiow init` first."));
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
const files = readdirSync2(targetsDir).filter((f) => f.endsWith(".yml"));
|
|
553
|
+
if (files.length === 0) {
|
|
554
|
+
console.log(chalk3.yellow("No target configurations found."));
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
console.log(chalk3.cyan.bold("\nTargets:"));
|
|
558
|
+
console.log("");
|
|
559
|
+
const header = ` ${pad("ID", 22)} ${pad("Name", 35)} ${pad("Domain", 12)} ${pad("Auth", 16)} Base URL`;
|
|
560
|
+
console.log(chalk3.bold(header));
|
|
561
|
+
console.log(` ${"\u2500".repeat(22)} ${"\u2500".repeat(35)} ${"\u2500".repeat(12)} ${"\u2500".repeat(16)} ${"\u2500".repeat(30)}`);
|
|
562
|
+
for (const file of files) {
|
|
563
|
+
try {
|
|
564
|
+
const raw = readFileSync3(join3(targetsDir, file), "utf-8");
|
|
565
|
+
const target = parseYaml2(raw);
|
|
566
|
+
console.log(
|
|
567
|
+
` ${pad(target.id, 22)} ${pad(target.name, 35)} ${pad(target.domain, 12)} ${pad(target.auth.strategy, 16)} ${target.base_url || chalk3.gray("(none)")}`
|
|
568
|
+
);
|
|
569
|
+
} catch {
|
|
570
|
+
console.log(` ${chalk3.red("ERROR")} Could not parse ${file}`);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
console.log("");
|
|
574
|
+
console.log(chalk3.white(` Total: ${files.length} target(s)`));
|
|
575
|
+
console.log("");
|
|
576
|
+
}
|
|
577
|
+
function listDomains(cwd) {
|
|
578
|
+
const domainsDir = resolve4(cwd, "data", "domains");
|
|
579
|
+
if (!existsSync3(domainsDir)) {
|
|
580
|
+
console.log(chalk3.yellow("No domain configs found. Run `npx qualiow init` first."));
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
const files = readdirSync2(domainsDir).filter((f) => f.endsWith(".yml"));
|
|
584
|
+
if (files.length === 0) {
|
|
585
|
+
console.log(chalk3.yellow("No domain configurations found."));
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
console.log(chalk3.cyan.bold("\nDomains:"));
|
|
589
|
+
console.log("");
|
|
590
|
+
const header = ` ${pad("ID", 16)} ${pad("Name", 28)} ${pad("Checklist", 12)} ${pad("Journeys", 10)}`;
|
|
591
|
+
console.log(chalk3.bold(header));
|
|
592
|
+
console.log(` ${"\u2500".repeat(16)} ${"\u2500".repeat(28)} ${"\u2500".repeat(12)} ${"\u2500".repeat(10)}`);
|
|
593
|
+
for (const file of files) {
|
|
594
|
+
try {
|
|
595
|
+
const raw = readFileSync3(join3(domainsDir, file), "utf-8");
|
|
596
|
+
const domain = parseYaml2(raw);
|
|
597
|
+
const checklistCount = domain.completeness_checklist?.length ?? 0;
|
|
598
|
+
const journeyCount = domain.journeys?.length ?? 0;
|
|
599
|
+
console.log(
|
|
600
|
+
` ${pad(domain.id, 16)} ${pad(domain.name, 28)} ${pad(String(checklistCount), 12)} ${pad(String(journeyCount), 10)}`
|
|
601
|
+
);
|
|
602
|
+
} catch {
|
|
603
|
+
console.log(` ${chalk3.red("ERROR")} Could not parse ${file}`);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
console.log("");
|
|
607
|
+
console.log(chalk3.white(` Total: ${files.length} domain(s)`));
|
|
608
|
+
console.log("");
|
|
609
|
+
}
|
|
610
|
+
function pad(str, len) {
|
|
611
|
+
if (str.length >= len) {
|
|
612
|
+
return str.slice(0, len);
|
|
613
|
+
}
|
|
614
|
+
return str + " ".repeat(len - str.length);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// src/cli/commands/report.ts
|
|
618
|
+
import { Command as Command4 } from "commander";
|
|
619
|
+
import { resolve as resolve5, join as join5, basename as basename2 } from "path";
|
|
620
|
+
import { existsSync as existsSync5, readdirSync as readdirSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
621
|
+
import chalk4 from "chalk";
|
|
622
|
+
|
|
623
|
+
// src/formatters/html-report.ts
|
|
624
|
+
import Handlebars from "handlebars";
|
|
625
|
+
|
|
626
|
+
// src/utils/parse-session.ts
|
|
627
|
+
import { readFileSync as readFileSync4, readdirSync as readdirSync3, existsSync as existsSync4 } from "fs";
|
|
628
|
+
import { join as join4, basename } from "path";
|
|
629
|
+
var SEVERITY_ORDER = {
|
|
630
|
+
critical: 0,
|
|
631
|
+
high: 1,
|
|
632
|
+
medium: 2,
|
|
633
|
+
low: 3
|
|
634
|
+
};
|
|
635
|
+
function normalizeSeverity(raw) {
|
|
636
|
+
const lower = raw.toLowerCase().trim();
|
|
637
|
+
if (lower === "critical" || lower === "high" || lower === "medium" || lower === "low") {
|
|
638
|
+
return lower;
|
|
639
|
+
}
|
|
640
|
+
if (lower.startsWith("critical")) return "critical";
|
|
641
|
+
if (lower.startsWith("high")) return "high";
|
|
642
|
+
if (lower.startsWith("medium")) return "medium";
|
|
643
|
+
if (lower.startsWith("low")) return "low";
|
|
644
|
+
return "medium";
|
|
645
|
+
}
|
|
646
|
+
function extractSection(content, headingPrefix) {
|
|
647
|
+
const lines = content.split("\n");
|
|
648
|
+
let capturing = false;
|
|
649
|
+
let capturedLevel = 0;
|
|
650
|
+
const captured = [];
|
|
651
|
+
for (const line of lines) {
|
|
652
|
+
const headingMatch = line.match(/^(#{1,6})\s+(.*)$/);
|
|
653
|
+
if (headingMatch) {
|
|
654
|
+
const level = headingMatch[1].length;
|
|
655
|
+
const text = headingMatch[2].trim();
|
|
656
|
+
if (text.toLowerCase().startsWith(headingPrefix.toLowerCase())) {
|
|
657
|
+
capturing = true;
|
|
658
|
+
capturedLevel = level;
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
if (capturing && level <= capturedLevel) {
|
|
662
|
+
break;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
if (capturing) {
|
|
666
|
+
captured.push(line);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return captured.join("\n").trim();
|
|
670
|
+
}
|
|
671
|
+
function extractNumberedList(text) {
|
|
672
|
+
const steps = [];
|
|
673
|
+
const lines = text.split("\n");
|
|
674
|
+
for (const line of lines) {
|
|
675
|
+
const match = line.match(/^\d+\.\s+(.+)$/);
|
|
676
|
+
if (match) {
|
|
677
|
+
steps.push(match[1].trim());
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return steps;
|
|
681
|
+
}
|
|
682
|
+
function extractEvidence(content) {
|
|
683
|
+
const screenshots = [];
|
|
684
|
+
const console_errors = [];
|
|
685
|
+
const evidenceText = extractSection(content, "Evidence");
|
|
686
|
+
if (!evidenceText) {
|
|
687
|
+
return { screenshots, console_errors };
|
|
688
|
+
}
|
|
689
|
+
for (const line of evidenceText.split("\n")) {
|
|
690
|
+
const trimmed = line.replace(/^[-*]\s*/, "").trim();
|
|
691
|
+
if (/screenshot/i.test(trimmed)) {
|
|
692
|
+
const pathMatch = trimmed.match(/:\s*(.+)/);
|
|
693
|
+
if (pathMatch) {
|
|
694
|
+
screenshots.push(pathMatch[1].trim());
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
if (/console\s*(error|log)/i.test(trimmed)) {
|
|
698
|
+
const msgMatch = trimmed.match(/:\s*(.+)/);
|
|
699
|
+
if (msgMatch && !/none/i.test(msgMatch[1])) {
|
|
700
|
+
console_errors.push(msgMatch[1].trim());
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return { screenshots, console_errors };
|
|
705
|
+
}
|
|
706
|
+
async function parseBugReport(filePath) {
|
|
707
|
+
const content = readFileSync4(filePath, "utf-8");
|
|
708
|
+
const filename = basename(filePath, ".md");
|
|
709
|
+
const id = filename;
|
|
710
|
+
let title = "";
|
|
711
|
+
let component = "";
|
|
712
|
+
const titleMatch = content.match(/^#\s+(?:BUG[-\w]*:\s*)?(.+)$/m) ?? content.match(/^##\s+(?:BUG[-\w]*:\s*)?(.+)$/m);
|
|
713
|
+
if (titleMatch) {
|
|
714
|
+
title = titleMatch[1].trim();
|
|
715
|
+
}
|
|
716
|
+
const componentMatch = title.match(/^\[([^\]]+)\]\s*/);
|
|
717
|
+
if (componentMatch) {
|
|
718
|
+
component = componentMatch[1];
|
|
719
|
+
title = title.replace(/^\[[^\]]+\]\s*/, "").trim();
|
|
720
|
+
}
|
|
721
|
+
if (!component) {
|
|
722
|
+
const categoryMatch = content.match(/\|\s*Category\s*\|\s*(.+?)\s*\|/i);
|
|
723
|
+
if (categoryMatch) {
|
|
724
|
+
component = categoryMatch[1].trim();
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
let severity = "medium";
|
|
728
|
+
const severityMatch = content.match(/\*\*Severity:\*\*\s*(.+)/i) ?? content.match(/^##\s+Severity:\s*(.+)/mi);
|
|
729
|
+
if (severityMatch) {
|
|
730
|
+
severity = normalizeSeverity(severityMatch[1]);
|
|
731
|
+
}
|
|
732
|
+
let url = "";
|
|
733
|
+
const urlMatch = content.match(/\*\*URL:\*\*\s*(.+)/i) ?? content.match(/URL:\s*(https?:\/\/[^\s]+)/i);
|
|
734
|
+
if (urlMatch) {
|
|
735
|
+
url = urlMatch[1].trim();
|
|
736
|
+
}
|
|
737
|
+
const expected = extractSection(content, "Expected").replace(/^_.*_\n?/, "").replace(/^>\s*/gm, "").trim();
|
|
738
|
+
const actual = extractSection(content, "Actual").replace(/^_.*_\n?/, "").replace(/^>\s*/gm, "").trim();
|
|
739
|
+
const stepsSection = extractSection(content, "Steps to Reproduce");
|
|
740
|
+
const steps = extractNumberedList(stepsSection);
|
|
741
|
+
const business_impact = extractSection(content, "Business Impact");
|
|
742
|
+
const evidence = extractEvidence(content);
|
|
743
|
+
return {
|
|
744
|
+
id,
|
|
745
|
+
title,
|
|
746
|
+
severity,
|
|
747
|
+
component,
|
|
748
|
+
url,
|
|
749
|
+
expected,
|
|
750
|
+
actual,
|
|
751
|
+
steps,
|
|
752
|
+
business_impact,
|
|
753
|
+
evidence
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
async function parseSession(sessionDir) {
|
|
757
|
+
const id = basename(sessionDir);
|
|
758
|
+
let charter;
|
|
759
|
+
const charterPath = join4(sessionDir, "charter.md");
|
|
760
|
+
if (existsSync4(charterPath)) {
|
|
761
|
+
charter = readFileSync4(charterPath, "utf-8");
|
|
762
|
+
}
|
|
763
|
+
let report;
|
|
764
|
+
const reportPath = join4(sessionDir, "session-report.md");
|
|
765
|
+
if (existsSync4(reportPath)) {
|
|
766
|
+
report = readFileSync4(reportPath, "utf-8");
|
|
767
|
+
}
|
|
768
|
+
const phases = [];
|
|
769
|
+
if (existsSync4(sessionDir)) {
|
|
770
|
+
const files = readdirSync3(sessionDir);
|
|
771
|
+
const phaseFiles = files.filter((f) => /^phase-\d+/i.test(f)).sort();
|
|
772
|
+
for (const file of phaseFiles) {
|
|
773
|
+
const content = readFileSync4(join4(sessionDir, file), "utf-8");
|
|
774
|
+
const name = file.replace(/\.md$/, "");
|
|
775
|
+
phases.push({ name, content });
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
const bugsDir = join4(sessionDir, "bugs");
|
|
779
|
+
const bugs = [];
|
|
780
|
+
if (existsSync4(bugsDir)) {
|
|
781
|
+
const bugFiles = readdirSync3(bugsDir).filter((f) => /^BUG-.*\.md$/i.test(f)).sort();
|
|
782
|
+
for (const file of bugFiles) {
|
|
783
|
+
const bug = await parseBugReport(join4(bugsDir, file));
|
|
784
|
+
bugs.push(bug);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
bugs.sort((a, b) => SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity]);
|
|
788
|
+
return {
|
|
789
|
+
id,
|
|
790
|
+
charter,
|
|
791
|
+
bugs,
|
|
792
|
+
report,
|
|
793
|
+
phases
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// src/formatters/html-report.ts
|
|
798
|
+
function extractReportMeta(report, sessionId) {
|
|
799
|
+
const meta = {
|
|
800
|
+
target: sessionId,
|
|
801
|
+
date: "",
|
|
802
|
+
duration: "",
|
|
803
|
+
sessionId,
|
|
804
|
+
summary: ""
|
|
805
|
+
};
|
|
806
|
+
const dateMatch = report.match(/\*\*Date:\*\*\s*(.+)/i) ?? report.match(/\|\s*Date\s*\|\s*(.+?)\s*\|/i);
|
|
807
|
+
if (dateMatch) meta.date = dateMatch[1].trim();
|
|
808
|
+
const durationMatch = report.match(/\*\*Duration:\*\*\s*(.+)/i) ?? report.match(/\|\s*Duration\s*\|\s*(.+?)\s*\|/i);
|
|
809
|
+
if (durationMatch) meta.duration = durationMatch[1].trim();
|
|
810
|
+
const targetMatch = report.match(/\*\*Application:\*\*\s*(.+)/i) ?? report.match(/\*\*Target:\*\*\s*(.+)/i) ?? report.match(/\|\s*Target\s*\|\s*(.+?)\s*\|/i);
|
|
811
|
+
if (targetMatch) meta.target = targetMatch[1].trim();
|
|
812
|
+
const summaryMatch = report.match(/##\s+Executive Summary\s*\n+([\s\S]*?)(?=\n##\s|\n---)/i);
|
|
813
|
+
if (summaryMatch) meta.summary = summaryMatch[1].trim();
|
|
814
|
+
return meta;
|
|
815
|
+
}
|
|
816
|
+
function extractCoverage(report) {
|
|
817
|
+
const entries = [];
|
|
818
|
+
const tableMatch = report.match(
|
|
819
|
+
/\|\s*Area\s*\|\s*Status\s*\|[\s\S]*?\n((?:\|.+\|.+\n?)+)/i
|
|
820
|
+
);
|
|
821
|
+
if (!tableMatch) return entries;
|
|
822
|
+
const rows = tableMatch[1].split("\n").filter((r) => r.trim().startsWith("|"));
|
|
823
|
+
for (const row of rows) {
|
|
824
|
+
const cells = row.split("|").map((c) => c.trim()).filter(Boolean);
|
|
825
|
+
if (cells.length >= 2 && !cells[0].startsWith("---")) {
|
|
826
|
+
entries.push({
|
|
827
|
+
area: cells[0] || "",
|
|
828
|
+
status: cells[1] || "",
|
|
829
|
+
bugsFound: cells[3] || "0",
|
|
830
|
+
notes: cells[4] || ""
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
return entries;
|
|
835
|
+
}
|
|
836
|
+
function extractListSection(report, heading) {
|
|
837
|
+
const items = [];
|
|
838
|
+
const regex = new RegExp(`##\\s+${heading}\\s*\\n+([\\s\\S]*?)(?=\\n##\\s|\\n---|$)`, "i");
|
|
839
|
+
const match = report.match(regex);
|
|
840
|
+
if (!match) return items;
|
|
841
|
+
for (const line of match[1].split("\n")) {
|
|
842
|
+
const itemMatch = line.match(/^[-*]\s+(?:\[.\]\s+)?(.+)/);
|
|
843
|
+
if (itemMatch) {
|
|
844
|
+
items.push(itemMatch[1].trim());
|
|
845
|
+
}
|
|
846
|
+
const numberedMatch = line.match(/^\d+\.\s+\*\*(.+?)\*\*\s*(.+)?/);
|
|
847
|
+
if (numberedMatch) {
|
|
848
|
+
const text = numberedMatch[2] ? `${numberedMatch[1]} ${numberedMatch[2]}` : numberedMatch[1];
|
|
849
|
+
items.push(text.replace(/\s*--\s*/, " -- "));
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return items;
|
|
853
|
+
}
|
|
854
|
+
var HTML_TEMPLATE = `<!DOCTYPE html>
|
|
855
|
+
<html lang="en">
|
|
856
|
+
<head>
|
|
857
|
+
<meta charset="UTF-8">
|
|
858
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
859
|
+
<title>Qualiow Report \u2014 {{meta.target}}</title>
|
|
860
|
+
<style>
|
|
861
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
862
|
+
|
|
863
|
+
body {
|
|
864
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
865
|
+
background: #0a0f1a;
|
|
866
|
+
color: #e0e6ed;
|
|
867
|
+
line-height: 1.6;
|
|
868
|
+
padding: 2rem;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
a { color: #3498db; text-decoration: none; }
|
|
872
|
+
a:hover { text-decoration: underline; }
|
|
873
|
+
|
|
874
|
+
.container { max-width: 960px; margin: 0 auto; }
|
|
875
|
+
|
|
876
|
+
/* Header */
|
|
877
|
+
.header {
|
|
878
|
+
border-bottom: 2px solid #1e2a3a;
|
|
879
|
+
padding-bottom: 1.5rem;
|
|
880
|
+
margin-bottom: 2rem;
|
|
881
|
+
}
|
|
882
|
+
.header h1 {
|
|
883
|
+
font-size: 1.75rem;
|
|
884
|
+
font-weight: 700;
|
|
885
|
+
color: #ffffff;
|
|
886
|
+
margin-bottom: 0.25rem;
|
|
887
|
+
}
|
|
888
|
+
.header .meta {
|
|
889
|
+
display: flex;
|
|
890
|
+
flex-wrap: wrap;
|
|
891
|
+
gap: 1.5rem;
|
|
892
|
+
font-size: 0.9rem;
|
|
893
|
+
color: #8899aa;
|
|
894
|
+
margin-top: 0.5rem;
|
|
895
|
+
}
|
|
896
|
+
.header .meta span { white-space: nowrap; }
|
|
897
|
+
|
|
898
|
+
/* Stats cards */
|
|
899
|
+
.stats {
|
|
900
|
+
display: grid;
|
|
901
|
+
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
|
|
902
|
+
gap: 1rem;
|
|
903
|
+
margin-bottom: 2rem;
|
|
904
|
+
}
|
|
905
|
+
.stat-card {
|
|
906
|
+
background: #111927;
|
|
907
|
+
border-radius: 8px;
|
|
908
|
+
padding: 1rem 1.25rem;
|
|
909
|
+
text-align: center;
|
|
910
|
+
}
|
|
911
|
+
.stat-card .number {
|
|
912
|
+
font-size: 2rem;
|
|
913
|
+
font-weight: 700;
|
|
914
|
+
display: block;
|
|
915
|
+
}
|
|
916
|
+
.stat-card .label {
|
|
917
|
+
font-size: 0.8rem;
|
|
918
|
+
color: #8899aa;
|
|
919
|
+
text-transform: uppercase;
|
|
920
|
+
letter-spacing: 0.05em;
|
|
921
|
+
}
|
|
922
|
+
.stat-total .number { color: #e0e6ed; }
|
|
923
|
+
.stat-critical .number { color: #ff4757; }
|
|
924
|
+
.stat-high .number { color: #ffa502; }
|
|
925
|
+
.stat-medium .number { color: #ffd32a; }
|
|
926
|
+
.stat-low .number { color: #3498db; }
|
|
927
|
+
|
|
928
|
+
/* Summary */
|
|
929
|
+
.summary {
|
|
930
|
+
background: #111927;
|
|
931
|
+
border-radius: 8px;
|
|
932
|
+
padding: 1.25rem 1.5rem;
|
|
933
|
+
margin-bottom: 2rem;
|
|
934
|
+
font-size: 0.95rem;
|
|
935
|
+
color: #c0c8d0;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/* Section headings */
|
|
939
|
+
.section-title {
|
|
940
|
+
font-size: 1.25rem;
|
|
941
|
+
font-weight: 600;
|
|
942
|
+
color: #ffffff;
|
|
943
|
+
margin: 2rem 0 1rem;
|
|
944
|
+
padding-bottom: 0.5rem;
|
|
945
|
+
border-bottom: 1px solid #1e2a3a;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/* Bug cards */
|
|
949
|
+
.bug-card {
|
|
950
|
+
background: #111927;
|
|
951
|
+
border-radius: 8px;
|
|
952
|
+
border-left: 4px solid #3498db;
|
|
953
|
+
padding: 1.25rem 1.5rem;
|
|
954
|
+
margin-bottom: 1rem;
|
|
955
|
+
}
|
|
956
|
+
.bug-card.severity-critical { border-left-color: #ff4757; }
|
|
957
|
+
.bug-card.severity-high { border-left-color: #ffa502; }
|
|
958
|
+
.bug-card.severity-medium { border-left-color: #ffd32a; }
|
|
959
|
+
.bug-card.severity-low { border-left-color: #3498db; }
|
|
960
|
+
|
|
961
|
+
.bug-card .bug-header {
|
|
962
|
+
display: flex;
|
|
963
|
+
align-items: center;
|
|
964
|
+
flex-wrap: wrap;
|
|
965
|
+
gap: 0.5rem;
|
|
966
|
+
margin-bottom: 0.75rem;
|
|
967
|
+
}
|
|
968
|
+
.bug-card .bug-title {
|
|
969
|
+
font-size: 1rem;
|
|
970
|
+
font-weight: 600;
|
|
971
|
+
color: #ffffff;
|
|
972
|
+
flex: 1;
|
|
973
|
+
min-width: 200px;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
.badge {
|
|
977
|
+
display: inline-block;
|
|
978
|
+
font-size: 0.7rem;
|
|
979
|
+
font-weight: 600;
|
|
980
|
+
text-transform: uppercase;
|
|
981
|
+
letter-spacing: 0.05em;
|
|
982
|
+
padding: 0.2rem 0.5rem;
|
|
983
|
+
border-radius: 4px;
|
|
984
|
+
white-space: nowrap;
|
|
985
|
+
}
|
|
986
|
+
.badge-critical { background: #ff475733; color: #ff4757; }
|
|
987
|
+
.badge-high { background: #ffa50233; color: #ffa502; }
|
|
988
|
+
.badge-medium { background: #ffd32a33; color: #ffd32a; }
|
|
989
|
+
.badge-low { background: #3498db33; color: #3498db; }
|
|
990
|
+
.badge-component { background: #1e2a3a; color: #8899aa; }
|
|
991
|
+
|
|
992
|
+
.bug-section-label {
|
|
993
|
+
font-size: 0.8rem;
|
|
994
|
+
font-weight: 600;
|
|
995
|
+
text-transform: uppercase;
|
|
996
|
+
letter-spacing: 0.05em;
|
|
997
|
+
color: #8899aa;
|
|
998
|
+
margin: 0.75rem 0 0.25rem;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
.bug-card p,
|
|
1002
|
+
.bug-card li {
|
|
1003
|
+
font-size: 0.9rem;
|
|
1004
|
+
color: #c0c8d0;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
.bug-card ol {
|
|
1008
|
+
padding-left: 1.25rem;
|
|
1009
|
+
margin: 0.25rem 0;
|
|
1010
|
+
}
|
|
1011
|
+
.bug-card ol li {
|
|
1012
|
+
margin-bottom: 0.15rem;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
.bug-card .evidence-item {
|
|
1016
|
+
font-size: 0.85rem;
|
|
1017
|
+
color: #8899aa;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/* Coverage table */
|
|
1021
|
+
table {
|
|
1022
|
+
width: 100%;
|
|
1023
|
+
border-collapse: collapse;
|
|
1024
|
+
margin-bottom: 1rem;
|
|
1025
|
+
font-size: 0.9rem;
|
|
1026
|
+
}
|
|
1027
|
+
th, td {
|
|
1028
|
+
text-align: left;
|
|
1029
|
+
padding: 0.5rem 0.75rem;
|
|
1030
|
+
border-bottom: 1px solid #1e2a3a;
|
|
1031
|
+
}
|
|
1032
|
+
th {
|
|
1033
|
+
font-size: 0.8rem;
|
|
1034
|
+
text-transform: uppercase;
|
|
1035
|
+
letter-spacing: 0.05em;
|
|
1036
|
+
color: #8899aa;
|
|
1037
|
+
font-weight: 600;
|
|
1038
|
+
}
|
|
1039
|
+
td { color: #c0c8d0; }
|
|
1040
|
+
|
|
1041
|
+
/* Lists */
|
|
1042
|
+
.list-section ul {
|
|
1043
|
+
list-style: disc;
|
|
1044
|
+
padding-left: 1.25rem;
|
|
1045
|
+
}
|
|
1046
|
+
.list-section li {
|
|
1047
|
+
font-size: 0.9rem;
|
|
1048
|
+
color: #c0c8d0;
|
|
1049
|
+
margin-bottom: 0.35rem;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/* Footer */
|
|
1053
|
+
.footer {
|
|
1054
|
+
margin-top: 3rem;
|
|
1055
|
+
padding-top: 1.5rem;
|
|
1056
|
+
border-top: 1px solid #1e2a3a;
|
|
1057
|
+
text-align: center;
|
|
1058
|
+
font-size: 0.8rem;
|
|
1059
|
+
color: #556677;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/* Print styles */
|
|
1063
|
+
@media print {
|
|
1064
|
+
body {
|
|
1065
|
+
background: #ffffff;
|
|
1066
|
+
color: #1a1a1a;
|
|
1067
|
+
padding: 1rem;
|
|
1068
|
+
}
|
|
1069
|
+
.stat-card, .bug-card, .summary {
|
|
1070
|
+
background: #f5f5f5;
|
|
1071
|
+
-webkit-print-color-adjust: exact;
|
|
1072
|
+
print-color-adjust: exact;
|
|
1073
|
+
}
|
|
1074
|
+
.stat-total .number { color: #1a1a1a; }
|
|
1075
|
+
.stat-critical .number { color: #cc0000; }
|
|
1076
|
+
.stat-high .number { color: #cc7700; }
|
|
1077
|
+
.stat-medium .number { color: #cc9900; }
|
|
1078
|
+
.stat-low .number { color: #2266aa; }
|
|
1079
|
+
.bug-card .bug-title { color: #1a1a1a; }
|
|
1080
|
+
th { color: #555555; }
|
|
1081
|
+
td, .bug-card p, .bug-card li, .list-section li { color: #333333; }
|
|
1082
|
+
.bug-section-label { color: #555555; }
|
|
1083
|
+
.footer { color: #999999; }
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
/* Responsive */
|
|
1087
|
+
@media (max-width: 600px) {
|
|
1088
|
+
body { padding: 1rem; }
|
|
1089
|
+
.header h1 { font-size: 1.35rem; }
|
|
1090
|
+
.stats { grid-template-columns: repeat(2, 1fr); }
|
|
1091
|
+
.bug-card .bug-header { flex-direction: column; align-items: flex-start; }
|
|
1092
|
+
}
|
|
1093
|
+
</style>
|
|
1094
|
+
</head>
|
|
1095
|
+
<body>
|
|
1096
|
+
<div class="container">
|
|
1097
|
+
|
|
1098
|
+
<div class="header">
|
|
1099
|
+
<h1>Exploratory Testing Report</h1>
|
|
1100
|
+
<div class="meta">
|
|
1101
|
+
<span>Target: <strong>{{meta.target}}</strong></span>
|
|
1102
|
+
{{#if meta.date}}<span>Date: <strong>{{meta.date}}</strong></span>{{/if}}
|
|
1103
|
+
{{#if meta.duration}}<span>Duration: <strong>{{meta.duration}}</strong></span>{{/if}}
|
|
1104
|
+
<span>Session: <strong>{{meta.sessionId}}</strong></span>
|
|
1105
|
+
</div>
|
|
1106
|
+
</div>
|
|
1107
|
+
|
|
1108
|
+
<div class="stats">
|
|
1109
|
+
<div class="stat-card stat-total">
|
|
1110
|
+
<span class="number">{{totalBugs}}</span>
|
|
1111
|
+
<span class="label">Total Bugs</span>
|
|
1112
|
+
</div>
|
|
1113
|
+
<div class="stat-card stat-critical">
|
|
1114
|
+
<span class="number">{{criticalCount}}</span>
|
|
1115
|
+
<span class="label">Critical</span>
|
|
1116
|
+
</div>
|
|
1117
|
+
<div class="stat-card stat-high">
|
|
1118
|
+
<span class="number">{{highCount}}</span>
|
|
1119
|
+
<span class="label">High</span>
|
|
1120
|
+
</div>
|
|
1121
|
+
<div class="stat-card stat-medium">
|
|
1122
|
+
<span class="number">{{mediumCount}}</span>
|
|
1123
|
+
<span class="label">Medium</span>
|
|
1124
|
+
</div>
|
|
1125
|
+
<div class="stat-card stat-low">
|
|
1126
|
+
<span class="number">{{lowCount}}</span>
|
|
1127
|
+
<span class="label">Low</span>
|
|
1128
|
+
</div>
|
|
1129
|
+
</div>
|
|
1130
|
+
|
|
1131
|
+
{{#if meta.summary}}
|
|
1132
|
+
<div class="summary">{{meta.summary}}</div>
|
|
1133
|
+
{{/if}}
|
|
1134
|
+
|
|
1135
|
+
<h2 class="section-title">Bugs Found</h2>
|
|
1136
|
+
|
|
1137
|
+
{{#each bugs}}
|
|
1138
|
+
<div class="bug-card severity-{{this.severity}}">
|
|
1139
|
+
<div class="bug-header">
|
|
1140
|
+
<span class="bug-title">{{this.id}}: {{this.title}}</span>
|
|
1141
|
+
<span class="badge badge-{{this.severity}}">{{this.severity}}</span>
|
|
1142
|
+
{{#if this.component}}<span class="badge badge-component">{{this.component}}</span>{{/if}}
|
|
1143
|
+
</div>
|
|
1144
|
+
|
|
1145
|
+
{{#if this.business_impact}}
|
|
1146
|
+
<div class="bug-section-label">Business Impact</div>
|
|
1147
|
+
<p>{{this.business_impact_summary}}</p>
|
|
1148
|
+
{{/if}}
|
|
1149
|
+
|
|
1150
|
+
{{#if this.steps.length}}
|
|
1151
|
+
<div class="bug-section-label">Steps to Reproduce</div>
|
|
1152
|
+
<ol>
|
|
1153
|
+
{{#each this.steps}}
|
|
1154
|
+
<li>{{this}}</li>
|
|
1155
|
+
{{/each}}
|
|
1156
|
+
</ol>
|
|
1157
|
+
{{/if}}
|
|
1158
|
+
|
|
1159
|
+
{{#if this.hasEvidence}}
|
|
1160
|
+
<div class="bug-section-label">Evidence</div>
|
|
1161
|
+
{{#each this.evidence.screenshots}}
|
|
1162
|
+
<p class="evidence-item">Screenshot: {{this}}</p>
|
|
1163
|
+
{{/each}}
|
|
1164
|
+
{{#each this.evidence.console_errors}}
|
|
1165
|
+
<p class="evidence-item">Console: {{this}}</p>
|
|
1166
|
+
{{/each}}
|
|
1167
|
+
{{/if}}
|
|
1168
|
+
</div>
|
|
1169
|
+
{{/each}}
|
|
1170
|
+
|
|
1171
|
+
{{#if coverage.length}}
|
|
1172
|
+
<h2 class="section-title">Coverage Map</h2>
|
|
1173
|
+
<table>
|
|
1174
|
+
<thead>
|
|
1175
|
+
<tr>
|
|
1176
|
+
<th>Area</th>
|
|
1177
|
+
<th>Status</th>
|
|
1178
|
+
<th>Bugs</th>
|
|
1179
|
+
<th>Notes</th>
|
|
1180
|
+
</tr>
|
|
1181
|
+
</thead>
|
|
1182
|
+
<tbody>
|
|
1183
|
+
{{#each coverage}}
|
|
1184
|
+
<tr>
|
|
1185
|
+
<td>{{this.area}}</td>
|
|
1186
|
+
<td>{{this.status}}</td>
|
|
1187
|
+
<td>{{this.bugsFound}}</td>
|
|
1188
|
+
<td>{{this.notes}}</td>
|
|
1189
|
+
</tr>
|
|
1190
|
+
{{/each}}
|
|
1191
|
+
</tbody>
|
|
1192
|
+
</table>
|
|
1193
|
+
{{/if}}
|
|
1194
|
+
|
|
1195
|
+
{{#if observations.length}}
|
|
1196
|
+
<h2 class="section-title">Observations</h2>
|
|
1197
|
+
<div class="list-section">
|
|
1198
|
+
<ul>
|
|
1199
|
+
{{#each observations}}
|
|
1200
|
+
<li>{{this}}</li>
|
|
1201
|
+
{{/each}}
|
|
1202
|
+
</ul>
|
|
1203
|
+
</div>
|
|
1204
|
+
{{/if}}
|
|
1205
|
+
|
|
1206
|
+
{{#if recommendations.length}}
|
|
1207
|
+
<h2 class="section-title">Recommendations</h2>
|
|
1208
|
+
<div class="list-section">
|
|
1209
|
+
<ul>
|
|
1210
|
+
{{#each recommendations}}
|
|
1211
|
+
<li>{{this}}</li>
|
|
1212
|
+
{{/each}}
|
|
1213
|
+
</ul>
|
|
1214
|
+
</div>
|
|
1215
|
+
{{/if}}
|
|
1216
|
+
|
|
1217
|
+
<div class="footer">
|
|
1218
|
+
Generated by Qualiow Exploratory Testing
|
|
1219
|
+
</div>
|
|
1220
|
+
|
|
1221
|
+
</div>
|
|
1222
|
+
</body>
|
|
1223
|
+
</html>`;
|
|
1224
|
+
var compiledTemplate = Handlebars.compile(HTML_TEMPLATE);
|
|
1225
|
+
async function generateHtmlReport(sessionDir) {
|
|
1226
|
+
const session = await parseSession(sessionDir);
|
|
1227
|
+
const report = session.report ?? "";
|
|
1228
|
+
const meta = extractReportMeta(report, session.id);
|
|
1229
|
+
const coverage = extractCoverage(report);
|
|
1230
|
+
const observations = extractListSection(report, "Observations");
|
|
1231
|
+
const recommendations = extractListSection(report, "Recommendations");
|
|
1232
|
+
const counts = { critical: 0, high: 0, medium: 0, low: 0 };
|
|
1233
|
+
for (const bug of session.bugs) {
|
|
1234
|
+
counts[bug.severity]++;
|
|
1235
|
+
}
|
|
1236
|
+
const bugsForTemplate = session.bugs.map((bug) => ({
|
|
1237
|
+
...bug,
|
|
1238
|
+
business_impact_summary: summarizeBusinessImpact(bug.business_impact),
|
|
1239
|
+
hasEvidence: bug.evidence.screenshots.length > 0 || bug.evidence.console_errors.length > 0
|
|
1240
|
+
}));
|
|
1241
|
+
const html = compiledTemplate({
|
|
1242
|
+
meta,
|
|
1243
|
+
totalBugs: session.bugs.length,
|
|
1244
|
+
criticalCount: counts.critical,
|
|
1245
|
+
highCount: counts.high,
|
|
1246
|
+
mediumCount: counts.medium,
|
|
1247
|
+
lowCount: counts.low,
|
|
1248
|
+
bugs: bugsForTemplate,
|
|
1249
|
+
coverage,
|
|
1250
|
+
observations,
|
|
1251
|
+
recommendations
|
|
1252
|
+
});
|
|
1253
|
+
return html;
|
|
1254
|
+
}
|
|
1255
|
+
function summarizeBusinessImpact(impact) {
|
|
1256
|
+
if (!impact) return "";
|
|
1257
|
+
const lines = impact.split("\n").filter((l) => l.trim());
|
|
1258
|
+
const summaryLines = [];
|
|
1259
|
+
for (const line of lines) {
|
|
1260
|
+
const cleaned = line.replace(/^[-*]\s*/, "").replace(/^\*\*[^*]+\*\*\s*/, "").trim();
|
|
1261
|
+
if (cleaned) {
|
|
1262
|
+
summaryLines.push(cleaned);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
return summaryLines.slice(0, 3).join(" ");
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// src/formatters/json-report.ts
|
|
1269
|
+
function extractTarget(report, sessionId) {
|
|
1270
|
+
const match = report.match(/\*\*Application:\*\*\s*(.+)/i) ?? report.match(/\*\*Target:\*\*\s*(.+)/i) ?? report.match(/\|\s*Target\s*\|\s*(.+?)\s*\|/i);
|
|
1271
|
+
if (match) return match[1].trim();
|
|
1272
|
+
const parts = sessionId.split("-");
|
|
1273
|
+
return parts[parts.length - 1] || sessionId;
|
|
1274
|
+
}
|
|
1275
|
+
function extractDate(report) {
|
|
1276
|
+
const match = report.match(/\*\*Date:\*\*\s*(\d{4}-\d{2}-\d{2})/i) ?? report.match(/\|\s*Date\s*\|\s*(\d{4}-\d{2}-\d{2})\s*\|/i);
|
|
1277
|
+
return match ? match[1] : "";
|
|
1278
|
+
}
|
|
1279
|
+
function extractDuration(report) {
|
|
1280
|
+
const match = report.match(/\*\*Duration:\*\*\s*~?(\d+)\s*min/i) ?? report.match(/\|\s*Duration\s*\|\s*~?(\d+)\s*min/i);
|
|
1281
|
+
return match ? parseInt(match[1], 10) : 0;
|
|
1282
|
+
}
|
|
1283
|
+
function extractPagesExplored(report) {
|
|
1284
|
+
const match = report.match(/Pages\s+Explored\s*\|\s*(\d+)/i);
|
|
1285
|
+
return match ? parseInt(match[1], 10) : 0;
|
|
1286
|
+
}
|
|
1287
|
+
function extractCoverage2(report) {
|
|
1288
|
+
const entries = [];
|
|
1289
|
+
const tableMatch = report.match(
|
|
1290
|
+
/\|\s*Area\s*\|\s*Status\s*\|[\s\S]*?\n((?:\|.+\|.+\n?)+)/i
|
|
1291
|
+
);
|
|
1292
|
+
if (!tableMatch) return entries;
|
|
1293
|
+
const rows = tableMatch[1].split("\n").filter((r) => r.trim().startsWith("|"));
|
|
1294
|
+
for (const row of rows) {
|
|
1295
|
+
const cells = row.split("|").map((c) => c.trim()).filter(Boolean);
|
|
1296
|
+
if (cells.length >= 2 && !cells[0].startsWith("---")) {
|
|
1297
|
+
entries.push({
|
|
1298
|
+
area: cells[0] || "",
|
|
1299
|
+
status: cells[1] || "",
|
|
1300
|
+
bugs_found: parseInt(cells[3] || "0", 10) || 0,
|
|
1301
|
+
notes: cells[4] || ""
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
return entries;
|
|
1306
|
+
}
|
|
1307
|
+
function extractListSection2(report, heading) {
|
|
1308
|
+
const items = [];
|
|
1309
|
+
const regex = new RegExp(`##\\s+${heading}\\s*\\n+([\\s\\S]*?)(?=\\n##\\s|\\n---|$)`, "i");
|
|
1310
|
+
const match = report.match(regex);
|
|
1311
|
+
if (!match) return items;
|
|
1312
|
+
for (const line of match[1].split("\n")) {
|
|
1313
|
+
const itemMatch = line.match(/^[-*]\s+(?:\[.\]\s+)?(.+)/);
|
|
1314
|
+
if (itemMatch) {
|
|
1315
|
+
items.push(itemMatch[1].trim());
|
|
1316
|
+
}
|
|
1317
|
+
const numberedMatch = line.match(/^\d+\.\s+\*\*(.+?)\*\*\s*(.+)?/);
|
|
1318
|
+
if (numberedMatch) {
|
|
1319
|
+
const text = numberedMatch[2] ? `${numberedMatch[1]} ${numberedMatch[2]}` : numberedMatch[1];
|
|
1320
|
+
items.push(text.replace(/\s*--\s*/, " -- "));
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
return items;
|
|
1324
|
+
}
|
|
1325
|
+
async function generateJsonReport(sessionDir) {
|
|
1326
|
+
const session = await parseSession(sessionDir);
|
|
1327
|
+
const report = session.report ?? "";
|
|
1328
|
+
const target = extractTarget(report, session.id);
|
|
1329
|
+
const date = extractDate(report);
|
|
1330
|
+
const duration_min = extractDuration(report);
|
|
1331
|
+
const pages_explored = extractPagesExplored(report);
|
|
1332
|
+
const counts = { critical: 0, high: 0, medium: 0, low: 0 };
|
|
1333
|
+
for (const bug of session.bugs) {
|
|
1334
|
+
counts[bug.severity]++;
|
|
1335
|
+
}
|
|
1336
|
+
const coverage = extractCoverage2(report);
|
|
1337
|
+
const observations = extractListSection2(report, "Observations");
|
|
1338
|
+
const recommendations = extractListSection2(report, "Recommendations");
|
|
1339
|
+
return {
|
|
1340
|
+
session: {
|
|
1341
|
+
id: session.id,
|
|
1342
|
+
target,
|
|
1343
|
+
date,
|
|
1344
|
+
duration_min
|
|
1345
|
+
},
|
|
1346
|
+
summary: {
|
|
1347
|
+
total_bugs: session.bugs.length,
|
|
1348
|
+
critical: counts.critical,
|
|
1349
|
+
high: counts.high,
|
|
1350
|
+
medium: counts.medium,
|
|
1351
|
+
low: counts.low,
|
|
1352
|
+
pages_explored
|
|
1353
|
+
},
|
|
1354
|
+
bugs: session.bugs.map((bug) => ({
|
|
1355
|
+
id: bug.id,
|
|
1356
|
+
title: bug.title,
|
|
1357
|
+
severity: bug.severity,
|
|
1358
|
+
component: bug.component,
|
|
1359
|
+
url: bug.url,
|
|
1360
|
+
business_impact: bug.business_impact,
|
|
1361
|
+
steps: bug.steps,
|
|
1362
|
+
evidence: bug.evidence
|
|
1363
|
+
})),
|
|
1364
|
+
coverage,
|
|
1365
|
+
observations,
|
|
1366
|
+
recommendations
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
// src/formatters/jira-export.ts
|
|
1371
|
+
var SEVERITY_TO_JIRA_PRIORITY = {
|
|
1372
|
+
critical: "Blocker",
|
|
1373
|
+
high: "Critical",
|
|
1374
|
+
medium: "Major",
|
|
1375
|
+
low: "Minor"
|
|
1376
|
+
};
|
|
1377
|
+
function csvEscape(value) {
|
|
1378
|
+
if (!value) return '""';
|
|
1379
|
+
const escaped = value.replace(/"/g, '""');
|
|
1380
|
+
return `"${escaped}"`;
|
|
1381
|
+
}
|
|
1382
|
+
function formatDescription(bug) {
|
|
1383
|
+
const parts = [];
|
|
1384
|
+
if (bug.steps.length > 0) {
|
|
1385
|
+
parts.push("h3. Steps to Reproduce");
|
|
1386
|
+
for (const step of bug.steps) {
|
|
1387
|
+
parts.push(`# ${step}`);
|
|
1388
|
+
}
|
|
1389
|
+
parts.push("");
|
|
1390
|
+
}
|
|
1391
|
+
if (bug.expected) {
|
|
1392
|
+
parts.push(`h3. Expected Behavior`);
|
|
1393
|
+
parts.push(bug.expected);
|
|
1394
|
+
parts.push("");
|
|
1395
|
+
}
|
|
1396
|
+
if (bug.actual) {
|
|
1397
|
+
parts.push(`h3. Actual Behavior`);
|
|
1398
|
+
parts.push(bug.actual);
|
|
1399
|
+
parts.push("");
|
|
1400
|
+
}
|
|
1401
|
+
if (bug.business_impact) {
|
|
1402
|
+
parts.push("h3. Business Impact");
|
|
1403
|
+
parts.push(bug.business_impact);
|
|
1404
|
+
parts.push("");
|
|
1405
|
+
}
|
|
1406
|
+
if (bug.url) {
|
|
1407
|
+
parts.push(`h3. URL`);
|
|
1408
|
+
parts.push(bug.url);
|
|
1409
|
+
}
|
|
1410
|
+
return parts.join("\n");
|
|
1411
|
+
}
|
|
1412
|
+
function extractDomain(sessionId) {
|
|
1413
|
+
return "general";
|
|
1414
|
+
}
|
|
1415
|
+
async function generateJiraExport(sessionDir) {
|
|
1416
|
+
const session = await parseSession(sessionDir);
|
|
1417
|
+
const headers = ["Summary", "Priority", "Description", "Component", "Labels"];
|
|
1418
|
+
const rows = [headers.join(",")];
|
|
1419
|
+
const domain = extractDomain(session.id);
|
|
1420
|
+
for (const bug of session.bugs) {
|
|
1421
|
+
const summary = `${bug.id}: ${bug.title}`;
|
|
1422
|
+
const priority = SEVERITY_TO_JIRA_PRIORITY[bug.severity] ?? "Major";
|
|
1423
|
+
const description = formatDescription(bug);
|
|
1424
|
+
const component = bug.component || "";
|
|
1425
|
+
const labels = ["qualiow", "exploratory-testing", domain].filter(Boolean).join(" ");
|
|
1426
|
+
rows.push(
|
|
1427
|
+
[
|
|
1428
|
+
csvEscape(summary),
|
|
1429
|
+
csvEscape(priority),
|
|
1430
|
+
csvEscape(description),
|
|
1431
|
+
csvEscape(component),
|
|
1432
|
+
csvEscape(labels)
|
|
1433
|
+
].join(",")
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
return rows.join("\n");
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
// src/cli/commands/report.ts
|
|
1440
|
+
function reportCommand() {
|
|
1441
|
+
const cmd = new Command4("report").description("Generate a report from a session").option("-s, --session <id>", 'Session ID or "latest"', "latest").option("-f, --format <format>", "Output format: md, html, json, jira", "md").action(async (options) => {
|
|
1442
|
+
try {
|
|
1443
|
+
await runReport(options);
|
|
1444
|
+
} catch (err) {
|
|
1445
|
+
console.error(chalk4.red("Error:"), err instanceof Error ? err.message : err);
|
|
1446
|
+
process.exit(1);
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
return cmd;
|
|
1450
|
+
}
|
|
1451
|
+
async function runReport(options) {
|
|
1452
|
+
const cwd = process.cwd();
|
|
1453
|
+
const sessionsDir = resolve5(cwd, "output", "sessions");
|
|
1454
|
+
if (!existsSync5(sessionsDir)) {
|
|
1455
|
+
console.error(chalk4.red("No sessions directory found. Run `npx qualiow init` first."));
|
|
1456
|
+
process.exit(1);
|
|
1457
|
+
}
|
|
1458
|
+
const sessionDir = resolveSessionDir(sessionsDir, options.session);
|
|
1459
|
+
if (!sessionDir) {
|
|
1460
|
+
console.error(chalk4.red("No session found. Run an exploratory testing session first."));
|
|
1461
|
+
process.exit(1);
|
|
1462
|
+
}
|
|
1463
|
+
const sessionName = basename2(sessionDir);
|
|
1464
|
+
console.log(chalk4.cyan(`
|
|
1465
|
+
Session: ${sessionName}`));
|
|
1466
|
+
const format = options.format.toLowerCase();
|
|
1467
|
+
switch (format) {
|
|
1468
|
+
case "md": {
|
|
1469
|
+
const reportPath = join5(sessionDir, "session-report.md");
|
|
1470
|
+
if (existsSync5(reportPath)) {
|
|
1471
|
+
console.log(chalk4.green(`
|
|
1472
|
+
Report: ${reportPath}`));
|
|
1473
|
+
} else {
|
|
1474
|
+
console.log(chalk4.yellow(" No session-report.md found in this session."));
|
|
1475
|
+
}
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1478
|
+
case "html": {
|
|
1479
|
+
const html = await generateHtmlReport(sessionDir);
|
|
1480
|
+
const outputPath = join5(sessionDir, "session-report.html");
|
|
1481
|
+
writeFileSync2(outputPath, html);
|
|
1482
|
+
console.log(chalk4.green(`
|
|
1483
|
+
HTML report saved: ${outputPath}`));
|
|
1484
|
+
break;
|
|
1485
|
+
}
|
|
1486
|
+
case "json": {
|
|
1487
|
+
const data = await generateJsonReport(sessionDir);
|
|
1488
|
+
const outputPath = join5(sessionDir, "session-report.json");
|
|
1489
|
+
writeFileSync2(outputPath, JSON.stringify(data, null, 2));
|
|
1490
|
+
console.log(chalk4.green(`
|
|
1491
|
+
JSON report saved: ${outputPath}`));
|
|
1492
|
+
break;
|
|
1493
|
+
}
|
|
1494
|
+
case "jira": {
|
|
1495
|
+
const csv = await generateJiraExport(sessionDir);
|
|
1496
|
+
const outputPath = join5(sessionDir, "jira-export.csv");
|
|
1497
|
+
writeFileSync2(outputPath, csv);
|
|
1498
|
+
console.log(chalk4.green(`
|
|
1499
|
+
Jira export saved: ${outputPath}`));
|
|
1500
|
+
break;
|
|
1501
|
+
}
|
|
1502
|
+
default:
|
|
1503
|
+
console.error(chalk4.red(`Unknown format: "${format}". Choose from: md, html, json, jira`));
|
|
1504
|
+
process.exit(1);
|
|
1505
|
+
}
|
|
1506
|
+
console.log("");
|
|
1507
|
+
}
|
|
1508
|
+
function resolveSessionDir(sessionsDir, sessionId) {
|
|
1509
|
+
if (sessionId === "latest") {
|
|
1510
|
+
const dirs2 = readdirSync4(sessionsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort();
|
|
1511
|
+
if (dirs2.length === 0) return null;
|
|
1512
|
+
return join5(sessionsDir, dirs2[dirs2.length - 1]);
|
|
1513
|
+
}
|
|
1514
|
+
const exactPath = join5(sessionsDir, sessionId);
|
|
1515
|
+
if (existsSync5(exactPath)) {
|
|
1516
|
+
return exactPath;
|
|
1517
|
+
}
|
|
1518
|
+
const dirs = readdirSync4(sessionsDir, { withFileTypes: true }).filter((d) => d.isDirectory() && d.name.includes(sessionId)).map((d) => d.name).sort();
|
|
1519
|
+
if (dirs.length > 0) {
|
|
1520
|
+
return join5(sessionsDir, dirs[dirs.length - 1]);
|
|
1521
|
+
}
|
|
1522
|
+
return null;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
// src/cli/commands/explore.ts
|
|
1526
|
+
import { Command as Command5 } from "commander";
|
|
1527
|
+
import { resolve as resolve6, join as join6 } from "path";
|
|
1528
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
1529
|
+
import { execSync } from "child_process";
|
|
1530
|
+
import chalk5 from "chalk";
|
|
1531
|
+
function exploreCommand() {
|
|
1532
|
+
const cmd = new Command5("explore").description("Run an exploratory testing session").argument("[url]", "Target URL to explore").option("-t, --target <name>", "Target configuration name").option("-c, --context <file>", "Context file path").option("--time-box <duration>", "Time box duration (e.g., 30m, 1h)", "30m").option("--dry-run", "Validate inputs and show what would happen", false).action(async (url, options) => {
|
|
1533
|
+
try {
|
|
1534
|
+
await runExplore(url, options);
|
|
1535
|
+
} catch (err) {
|
|
1536
|
+
console.error(chalk5.red("Error:"), err instanceof Error ? err.message : err);
|
|
1537
|
+
process.exit(1);
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
return cmd;
|
|
1541
|
+
}
|
|
1542
|
+
async function runExplore(url, options) {
|
|
1543
|
+
const cwd = process.cwd();
|
|
1544
|
+
if (url) {
|
|
1545
|
+
try {
|
|
1546
|
+
new URL(url);
|
|
1547
|
+
} catch {
|
|
1548
|
+
console.error(chalk5.red(`Invalid URL: "${url}". Please provide a valid URL (e.g., https://example.com).`));
|
|
1549
|
+
process.exit(1);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
let targetName = "adhoc";
|
|
1553
|
+
if (options.target) {
|
|
1554
|
+
const targetPath = resolve6(cwd, "data", "targets", `${options.target}.yml`);
|
|
1555
|
+
if (!existsSync6(targetPath)) {
|
|
1556
|
+
console.error(
|
|
1557
|
+
chalk5.red(`Target config not found: ${targetPath}`)
|
|
1558
|
+
);
|
|
1559
|
+
console.error(chalk5.white(" Available targets: npx qualiow list targets"));
|
|
1560
|
+
process.exit(1);
|
|
1561
|
+
}
|
|
1562
|
+
const result = validateTargetConfig(targetPath);
|
|
1563
|
+
if (!result.valid) {
|
|
1564
|
+
console.error(chalk5.red(`Target config "${options.target}" is invalid:`));
|
|
1565
|
+
for (const err of result.errors ?? []) {
|
|
1566
|
+
console.error(chalk5.red(` \u2192 ${err.path ? `[${err.path}] ` : ""}${err.message}`));
|
|
1567
|
+
}
|
|
1568
|
+
process.exit(1);
|
|
1569
|
+
}
|
|
1570
|
+
targetName = options.target;
|
|
1571
|
+
console.log(chalk5.green(` \u2713 Target config "${options.target}" is valid`));
|
|
1572
|
+
}
|
|
1573
|
+
if (options.context) {
|
|
1574
|
+
const contextPath = resolve6(cwd, options.context);
|
|
1575
|
+
if (!existsSync6(contextPath)) {
|
|
1576
|
+
console.error(chalk5.red(`Context file not found: ${contextPath}`));
|
|
1577
|
+
process.exit(1);
|
|
1578
|
+
}
|
|
1579
|
+
console.log(chalk5.green(` \u2713 Context file found: ${options.context}`));
|
|
1580
|
+
}
|
|
1581
|
+
const now = /* @__PURE__ */ new Date();
|
|
1582
|
+
const timestamp = [
|
|
1583
|
+
now.getFullYear(),
|
|
1584
|
+
String(now.getMonth() + 1).padStart(2, "0"),
|
|
1585
|
+
String(now.getDate()).padStart(2, "0"),
|
|
1586
|
+
"-",
|
|
1587
|
+
String(now.getHours()).padStart(2, "0"),
|
|
1588
|
+
String(now.getMinutes()).padStart(2, "0")
|
|
1589
|
+
].join("");
|
|
1590
|
+
const sessionName = `${timestamp}-${targetName}`;
|
|
1591
|
+
const sessionDir = resolve6(cwd, "output", "sessions", sessionName);
|
|
1592
|
+
if (options.dryRun) {
|
|
1593
|
+
console.log("");
|
|
1594
|
+
console.log(chalk5.cyan.bold("Dry run \u2014 no files created"));
|
|
1595
|
+
console.log("");
|
|
1596
|
+
console.log(chalk5.white(" Session would be created at:"));
|
|
1597
|
+
console.log(chalk5.white(` ${sessionDir}`));
|
|
1598
|
+
console.log("");
|
|
1599
|
+
console.log(chalk5.white(" Configuration:"));
|
|
1600
|
+
console.log(chalk5.white(` URL: ${url ?? "(none \u2014 will be prompted)"}`));
|
|
1601
|
+
console.log(chalk5.white(` Target: ${options.target ?? "(ad-hoc)"}`));
|
|
1602
|
+
console.log(chalk5.white(` Context: ${options.context ?? "(none)"}`));
|
|
1603
|
+
console.log(chalk5.white(` Time box: ${options.timeBox}`));
|
|
1604
|
+
console.log("");
|
|
1605
|
+
console.log(chalk5.green(" \u2713 All inputs valid"));
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
mkdirSync2(sessionDir, { recursive: true });
|
|
1609
|
+
mkdirSync2(join6(sessionDir, "screenshots"), { recursive: true });
|
|
1610
|
+
mkdirSync2(join6(sessionDir, "bugs"), { recursive: true });
|
|
1611
|
+
const charterContent = `# Exploratory Testing Charter
|
|
1612
|
+
|
|
1613
|
+
**Session:** ${sessionName}
|
|
1614
|
+
**Date:** ${now.toISOString().split("T")[0]}
|
|
1615
|
+
**Target:** ${options.target ?? "Ad-hoc"}
|
|
1616
|
+
**URL:** ${url ?? "TBD"}
|
|
1617
|
+
**Time Box:** ${options.timeBox}
|
|
1618
|
+
|
|
1619
|
+
## Mission
|
|
1620
|
+
|
|
1621
|
+
> Describe the testing mission here.
|
|
1622
|
+
|
|
1623
|
+
## Areas of Focus
|
|
1624
|
+
|
|
1625
|
+
-
|
|
1626
|
+
|
|
1627
|
+
## Risks & Concerns
|
|
1628
|
+
|
|
1629
|
+
-
|
|
1630
|
+
|
|
1631
|
+
## Notes
|
|
1632
|
+
|
|
1633
|
+
-
|
|
1634
|
+
`;
|
|
1635
|
+
writeFileSync3(join6(sessionDir, "charter.md"), charterContent);
|
|
1636
|
+
const sessionLogContent = `# Session Log \u2014 ${sessionName}
|
|
1637
|
+
|
|
1638
|
+
| Time | Action | Observation | Bug? |
|
|
1639
|
+
|------|--------|-------------|------|
|
|
1640
|
+
`;
|
|
1641
|
+
writeFileSync3(join6(sessionDir, "session-log.md"), sessionLogContent);
|
|
1642
|
+
console.log("");
|
|
1643
|
+
console.log(chalk5.green.bold("Session created!"));
|
|
1644
|
+
console.log("");
|
|
1645
|
+
console.log(chalk5.white(` Directory: ${sessionDir}`));
|
|
1646
|
+
console.log("");
|
|
1647
|
+
let claudeAvailable = false;
|
|
1648
|
+
try {
|
|
1649
|
+
execSync("which claude", { stdio: "pipe" });
|
|
1650
|
+
claudeAvailable = true;
|
|
1651
|
+
} catch {
|
|
1652
|
+
}
|
|
1653
|
+
if (claudeAvailable) {
|
|
1654
|
+
console.log(chalk5.cyan(" Claude Code detected! To start exploring:"));
|
|
1655
|
+
console.log("");
|
|
1656
|
+
console.log(chalk5.white(` /qa-explore ${url ?? "<url>"}`));
|
|
1657
|
+
} else {
|
|
1658
|
+
console.log(chalk5.cyan(" Next steps:"));
|
|
1659
|
+
console.log(chalk5.white(" 1. Install Claude Code (https://docs.anthropic.com/en/docs/claude-code)"));
|
|
1660
|
+
console.log(chalk5.white(` 2. Run: /qa-explore ${url ?? "<url>"}`));
|
|
1661
|
+
}
|
|
1662
|
+
console.log("");
|
|
1663
|
+
console.log(chalk5.gray(` Session directory: ${sessionDir}`));
|
|
1664
|
+
console.log("");
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
// src/cli/commands/gather.ts
|
|
1668
|
+
import { Command as Command6 } from "commander";
|
|
1669
|
+
import { resolve as resolve7 } from "path";
|
|
1670
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync3 } from "fs";
|
|
1671
|
+
import { execSync as execSync2 } from "child_process";
|
|
1672
|
+
import chalk6 from "chalk";
|
|
1673
|
+
function gatherCommand() {
|
|
1674
|
+
const cmd = new Command6("gather").description("Gather and analyze requirements for testing context").argument("<source>", "Source file path or URL to gather context from").option("-o, --output <file>", "Output file path").option("-d, --domain <name>", "Domain configuration name").action(async (source, options) => {
|
|
1675
|
+
try {
|
|
1676
|
+
await runGather(source, options);
|
|
1677
|
+
} catch (err) {
|
|
1678
|
+
console.error(chalk6.red("Error:"), err instanceof Error ? err.message : err);
|
|
1679
|
+
process.exit(1);
|
|
1680
|
+
}
|
|
1681
|
+
});
|
|
1682
|
+
return cmd;
|
|
1683
|
+
}
|
|
1684
|
+
async function runGather(source, options) {
|
|
1685
|
+
const cwd = process.cwd();
|
|
1686
|
+
const isUrl = isValidUrl(source);
|
|
1687
|
+
const isFile = !isUrl && existsSync7(resolve7(cwd, source));
|
|
1688
|
+
if (!isUrl && !isFile) {
|
|
1689
|
+
console.error(chalk6.red(`Source not found: "${source}"`));
|
|
1690
|
+
console.error(chalk6.white(" Provide a valid file path or URL."));
|
|
1691
|
+
process.exit(1);
|
|
1692
|
+
}
|
|
1693
|
+
if (isUrl) {
|
|
1694
|
+
console.log(chalk6.green(` \u2713 Source is a URL: ${source}`));
|
|
1695
|
+
} else {
|
|
1696
|
+
console.log(chalk6.green(` \u2713 Source file found: ${resolve7(cwd, source)}`));
|
|
1697
|
+
}
|
|
1698
|
+
if (options.domain) {
|
|
1699
|
+
const domainPath = resolve7(cwd, "data", "domains", `${options.domain}.yml`);
|
|
1700
|
+
if (!existsSync7(domainPath)) {
|
|
1701
|
+
console.error(chalk6.red(`Domain config not found: ${domainPath}`));
|
|
1702
|
+
console.error(chalk6.white(" Available domains: npx qualiow list domains"));
|
|
1703
|
+
process.exit(1);
|
|
1704
|
+
}
|
|
1705
|
+
console.log(chalk6.green(` \u2713 Domain config "${options.domain}" found`));
|
|
1706
|
+
}
|
|
1707
|
+
const outputDir = resolve7(cwd, "output", "context");
|
|
1708
|
+
mkdirSync3(outputDir, { recursive: true });
|
|
1709
|
+
if (options.output) {
|
|
1710
|
+
console.log(chalk6.green(` \u2713 Output will be saved to: ${resolve7(cwd, options.output)}`));
|
|
1711
|
+
} else {
|
|
1712
|
+
console.log(chalk6.green(` \u2713 Output directory ready: ${outputDir}`));
|
|
1713
|
+
}
|
|
1714
|
+
let claudeAvailable = false;
|
|
1715
|
+
try {
|
|
1716
|
+
execSync2("which claude", { stdio: "pipe" });
|
|
1717
|
+
claudeAvailable = true;
|
|
1718
|
+
} catch {
|
|
1719
|
+
}
|
|
1720
|
+
console.log("");
|
|
1721
|
+
console.log(chalk6.cyan.bold("Ready to gather context!"));
|
|
1722
|
+
console.log("");
|
|
1723
|
+
if (claudeAvailable) {
|
|
1724
|
+
console.log(chalk6.cyan(" Claude Code detected! To gather context:"));
|
|
1725
|
+
console.log("");
|
|
1726
|
+
console.log(chalk6.white(` /qa-gather ${source}`));
|
|
1727
|
+
} else {
|
|
1728
|
+
console.log(chalk6.cyan(" Next steps:"));
|
|
1729
|
+
console.log(chalk6.white(" 1. Install Claude Code (https://docs.anthropic.com/en/docs/claude-code)"));
|
|
1730
|
+
console.log(chalk6.white(` 2. Run: /qa-gather ${source}`));
|
|
1731
|
+
}
|
|
1732
|
+
console.log("");
|
|
1733
|
+
console.log(chalk6.gray(" The /qa-gather skill will:"));
|
|
1734
|
+
console.log(chalk6.gray(" - Analyze the source for testable requirements"));
|
|
1735
|
+
console.log(chalk6.gray(" - Generate testing context and risk assessment"));
|
|
1736
|
+
console.log(chalk6.gray(" - Save output to output/context/"));
|
|
1737
|
+
console.log("");
|
|
1738
|
+
}
|
|
1739
|
+
function isValidUrl(str) {
|
|
1740
|
+
try {
|
|
1741
|
+
const url = new URL(str);
|
|
1742
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
1743
|
+
} catch {
|
|
1744
|
+
return false;
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
// src/cli/index.ts
|
|
1749
|
+
var program = new Command7().name("qualiow").description("qualiow \u2014 AI-powered exploratory testing").version("1.0.0");
|
|
1750
|
+
program.addCommand(initCommand());
|
|
1751
|
+
program.addCommand(validateCommand());
|
|
1752
|
+
program.addCommand(listCommand());
|
|
1753
|
+
program.addCommand(reportCommand());
|
|
1754
|
+
program.addCommand(exploreCommand());
|
|
1755
|
+
program.addCommand(gatherCommand());
|
|
1756
|
+
program.parse();
|
|
1757
|
+
//# sourceMappingURL=index.js.map
|