qualiow-exploratory-testing 1.1.0 → 1.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.
Files changed (79) hide show
  1. package/README.md +177 -0
  2. package/bin/mcli +16 -0
  3. package/bin/mobile-cli.mjs +573 -0
  4. package/bin/wadb +6 -0
  5. package/bin/wk-ios +58 -0
  6. package/bin/wkeval.mjs +44 -0
  7. package/data/domains/_default.md +181 -0
  8. package/data/domains/ecommerce.md +192 -0
  9. package/data/domains/fintech.md +200 -0
  10. package/data/domains/identity.md +88 -0
  11. package/data/domains/identity.yml +138 -0
  12. package/data/domains/marketing.md +194 -0
  13. package/data/domains/saas.md +197 -0
  14. package/data/knowledge/changelog.yml +86 -0
  15. package/data/knowledge/learned-patterns.md +172 -1
  16. package/data/knowledge/manifest.yml +210 -4
  17. package/data/knowledge/releases/v0.2.0/entries/technique-contract-narrowing.yml +150 -0
  18. package/data/knowledge/releases/v0.2.0/entries/technique-test-suite-audit.yml +116 -0
  19. package/data/knowledge/releases/v0.2.0/release.yml +20 -0
  20. package/data/knowledge/releases/v0.3.0/entries/technique-functional-diff-analysis.yml +119 -0
  21. package/data/knowledge/releases/v0.3.0/entries/technique-llm-output-verification.yml +102 -0
  22. package/data/knowledge/releases/v0.3.0/entries/technique-verification-mode-selection.yml +153 -0
  23. package/data/knowledge/releases/v0.3.0/release.yml +25 -0
  24. package/data/knowledge/releases/v0.4.0/entries/technique-authenticated-api-probing.yml +137 -0
  25. package/data/knowledge/releases/v0.4.0/entries/technique-environment-fingerprinting.yml +113 -0
  26. package/data/knowledge/releases/v0.4.0/entries/technique-silent-failure-audit.yml +86 -0
  27. package/data/knowledge/releases/v0.4.0/entries/technique-ui-api-differential.yml +97 -0
  28. package/data/knowledge/releases/v0.4.0/release.yml +28 -0
  29. package/data/knowledge/releases/v0.5.0/entries/technique-config-surface-verification.yml +77 -0
  30. package/data/knowledge/releases/v0.5.0/entries/technique-derived-value-verification.yml +81 -0
  31. package/data/knowledge/releases/v0.5.0/entries/technique-expected-behaviour-specification.yml +97 -0
  32. package/data/knowledge/releases/v0.5.0/entries/technique-presentation-integrity.yml +78 -0
  33. package/data/knowledge/releases/v0.5.0/entries/technique-release-readiness-verification.yml +110 -0
  34. package/data/knowledge/releases/v0.5.0/release.yml +33 -0
  35. package/data/targets/_example-backend.yml +123 -0
  36. package/data/targets/_example-mobile-emulation.yml +52 -0
  37. package/data/targets/_example-native-mobile.yml +61 -0
  38. package/data/targets/_example-sim-android-chrome.yml +81 -0
  39. package/data/targets/_example-sim-ios-safari.yml +80 -0
  40. package/data/templates/api-probe-matrix.md +99 -0
  41. package/data/templates/coverage-map.md +14 -0
  42. package/data/templates/expected-behaviour.md +93 -0
  43. package/dist/cli/index.js +137 -5
  44. package/dist/cli/index.js.map +1 -1
  45. package/dist/index.d.ts +350 -527
  46. package/dist/index.js +144 -5
  47. package/dist/index.js.map +1 -1
  48. package/docs/BACKEND-VERIFICATION.md +277 -0
  49. package/docs/MOBILE-SETUP.md +92 -0
  50. package/package.json +26 -12
  51. package/scripts/doctor-mobile.sh +143 -0
  52. package/scripts/setup-mobile.sh +213 -0
  53. package/skills/qa-explore/phases/00-setup.md +8 -1
  54. package/skills/qa-explore/phases/01-auth.md +4 -0
  55. package/skills/qa-explore-mobile/SKILL.md +146 -0
  56. package/skills/qa-explore-mobile/phases/00-setup.md +203 -0
  57. package/skills/qa-explore-mobile/phases/01-auth.md +127 -0
  58. package/skills/qa-explore-mobile/phases/02-charter.md +70 -0
  59. package/skills/qa-explore-mobile/phases/03-discovery.md +79 -0
  60. package/skills/qa-explore-mobile/phases/04-journeys.md +49 -0
  61. package/skills/qa-explore-mobile/phases/05-features.md +72 -0
  62. package/skills/qa-explore-mobile/phases/06-edge-cases.md +157 -0
  63. package/skills/qa-explore-mobile/phases/07-reporting.md +123 -0
  64. package/skills/qa-explore-mobile/references/mobile-edges.md +117 -0
  65. package/skills/qa-explore-quick/SKILL.md +6 -0
  66. package/skills/qa-verify-backend/SKILL.md +163 -0
  67. package/skills/qa-verify-backend/phases/00-setup.md +97 -0
  68. package/skills/qa-verify-backend/phases/01-ac-decomposition.md +58 -0
  69. package/skills/qa-verify-backend/phases/02-static-review.md +71 -0
  70. package/skills/qa-verify-backend/phases/03-live-verification.md +62 -0
  71. package/skills/qa-verify-backend/phases/03b-api-verification.md +157 -0
  72. package/skills/qa-verify-backend/phases/04-e2e-trigger.md +66 -0
  73. package/skills/qa-verify-backend/phases/05-reporting.md +135 -0
  74. package/skills/qa-verify-backend/references/api-probes.md +141 -0
  75. package/skills/qa-verify-backend/references/aws-readonly-probes.md +156 -0
  76. package/skills/qa-verify-backend/references/environment-fingerprinting.md +104 -0
  77. package/skills/qa-verify-backend/references/payload-verification.md +112 -0
  78. package/skills/qa-verify-backend/references/release-readiness.md +97 -0
  79. package/skills/qa-verify-backend/references/safety-rules.md +90 -0
package/dist/index.js CHANGED
@@ -1,21 +1,41 @@
1
1
  // src/schemas/target.schema.ts
2
2
  import { z } from "zod";
3
3
  var AuthConfigSchema = z.object({
4
- strategy: z.enum(["none", "storage_state", "credentials", "token"]),
4
+ // 'in-app' (native mobile: login/signup inside the app) and 'interactive-sso'
5
+ // (mobile web: one-time human SSO/MFA login the browser profile persists) are
6
+ // mobile-only strategies used by /qa-explore-mobile.
7
+ strategy: z.enum([
8
+ "none",
9
+ "storage_state",
10
+ "credentials",
11
+ "token",
12
+ "in-app",
13
+ "interactive-sso"
14
+ ]),
5
15
  state_file: z.string().optional(),
6
16
  login_url: z.string().url().optional(),
7
17
  credentials: z.object({
8
18
  username: z.string(),
9
19
  password: z.string()
10
20
  }).optional(),
11
- token: z.string().optional()
21
+ token: z.string().optional(),
22
+ identity_provider: z.string().optional(),
23
+ // Staging builds sometimes accept a fixed OTP — recorded so the auth phase can
24
+ // use it instead of waiting for a real code. Never a real credential.
25
+ static_otp: z.string().optional(),
26
+ test_email_pattern: z.string().optional()
12
27
  });
13
28
  var BrowserConfigSchema = z.object({
14
29
  headless: z.boolean(),
15
30
  viewport: z.object({
16
31
  width: z.number().int().positive(),
17
32
  height: z.number().int().positive()
18
- })
33
+ }),
34
+ // Optional engine selection + Playwright device descriptor for mobile-web
35
+ // emulation targets (e.g. engine: webkit, device: "iPhone 15").
36
+ engine: z.enum(["chromium", "webkit", "firefox"]).optional(),
37
+ channel: z.string().optional(),
38
+ device: z.string().optional()
19
39
  });
20
40
  var ScopeConfigSchema = z.object({
21
41
  start_pages: z.array(z.string()).optional(),
@@ -29,17 +49,129 @@ var SafetyConfigSchema = z.object({
29
49
  no_file_upload: z.boolean().optional(),
30
50
  no_delete_actions: z.boolean().optional()
31
51
  });
32
- var TargetConfigSchema = z.object({
52
+ var EnvironmentConfigSchema = z.object({
53
+ kind: z.enum(["dev", "ephemeral", "staging", "production"]),
54
+ destroyed_automatically: z.boolean().optional()
55
+ });
56
+ var BackendConfigSchema = z.object({
57
+ provider: z.enum(["aws"]).optional(),
58
+ aws_profile_env: z.string().optional(),
59
+ region_env: z.string().optional(),
60
+ region: z.string().optional(),
61
+ // Expected account. The skill compares it to `sts get-caller-identity` and
62
+ // stops the live lane on a mismatch rather than probing someone else's account.
63
+ account_id: z.string().optional(),
64
+ env_suffix: z.string().optional(),
65
+ // Free-form logical name -> deployed resource name (config_table, dlq, ...).
66
+ resources: z.record(z.string(), z.string()).optional(),
67
+ notes: z.string().optional()
68
+ });
69
+ var ApiSurfaceConfigSchema = z.object({
70
+ // Defaults to the target's base_url when omitted.
71
+ base_url: z.string().optional(),
72
+ auth: z.enum(["session-cookie", "bearer-env", "none"]).optional(),
73
+ // NAME of the env var holding a bearer token, for `auth: bearer-env`.
74
+ token_env: z.string().optional(),
75
+ // Persistent browser profile directory holding the authenticated session,
76
+ // e.g. `.auth/my-service-dev-profile`. Gitignored.
77
+ browser_profile: z.string().optional(),
78
+ // Endpoint returning the deployed build, used to fingerprint the environment.
79
+ version_endpoint: z.string().optional(),
80
+ // Logical name -> "VERB /path", e.g. search: "POST /api/v1/search".
81
+ endpoints: z.record(z.string(), z.string()).optional(),
82
+ // The ONLY endpoints the read-only API lane may call without asking.
83
+ probe_allowlist: z.array(z.string()).optional(),
84
+ // Other target ids to run the same matrix against, for parity comparison.
85
+ parity_targets: z.array(z.string()).optional(),
86
+ // Flag name -> where its deployed value is declared for this environment.
87
+ // A flag can select between two implementations inside one identical build.
88
+ feature_flags: z.record(z.string(), z.string()).optional(),
89
+ notes: z.string().optional()
90
+ });
91
+ var SourceBranchConfigSchema = z.object({
92
+ repo_path: z.string(),
93
+ branch: z.string(),
94
+ base_branch: z.string().optional(),
95
+ components: z.record(z.string(), z.string()).optional()
96
+ });
97
+ var WebTargetConfigSchema = z.object({
33
98
  id: z.string().min(1),
34
99
  name: z.string().min(1),
35
- base_url: z.string().url(),
100
+ // '' is allowed for the ad-hoc template (_default.yml) where the URL is
101
+ // provided at session start rather than in the config.
102
+ base_url: z.union([z.literal(""), z.string().url()]),
36
103
  domain: z.string().min(1),
37
104
  auth: AuthConfigSchema,
38
105
  browser: BrowserConfigSchema,
39
106
  scope: ScopeConfigSchema,
40
107
  safety: SafetyConfigSchema.optional(),
108
+ // Optional blocks consumed by /qa-verify-backend. A target without them is
109
+ // still a valid /qa-explore target.
110
+ environment: EnvironmentConfigSchema.optional(),
111
+ backend: BackendConfigSchema.optional(),
112
+ api: ApiSurfaceConfigSchema.optional(),
113
+ source: SourceBranchConfigSchema.optional(),
114
+ notes: z.string().optional()
115
+ });
116
+ var MobileDeviceConfigSchema = z.object({
117
+ name: z.string().optional(),
118
+ // iOS simulator name (portable across machines)
119
+ udid: z.string().optional(),
120
+ // iOS simulator UDID (takes precedence over name)
121
+ avd: z.string().optional(),
122
+ // Android AVD name
123
+ serial: z.string().optional()
124
+ // Android serial once booted (e.g. emulator-5554)
125
+ });
126
+ var MobileAppConfigSchema = z.object({
127
+ bundle_id: z.string().optional(),
128
+ // iOS bundle id (or browser bundle in web mode)
129
+ package: z.string().optional(),
130
+ // Android application id (or browser package)
131
+ app_paths: z.array(z.string()).optional(),
132
+ // iOS .app artifact(s) — native mode
133
+ apk_paths: z.array(z.string()).optional()
134
+ // Android APK(s) — native mode
135
+ });
136
+ var MobileWebConfigSchema = z.object({
137
+ base_url: z.string().url(),
138
+ start_url: z.string().url().optional()
139
+ });
140
+ var SourceRepoConfigSchema = z.object({
141
+ path: z.string(),
142
+ build_commands: z.record(z.string(), z.string()).optional()
143
+ });
144
+ var MobileScopeConfigSchema = z.object({
145
+ start_screen: z.string().optional(),
146
+ start_url: z.string().optional(),
147
+ include_patterns: z.array(z.string()).optional(),
148
+ exclude_patterns: z.array(z.string()).optional()
149
+ });
150
+ var MobileTargetConfigSchema = z.object({
151
+ id: z.string().min(1),
152
+ name: z.string().min(1),
153
+ platform: z.enum(["ios", "android"]),
154
+ // discriminates mobile from web targets
155
+ domain: z.string().min(1),
156
+ device: MobileDeviceConfigSchema,
157
+ app: MobileAppConfigSchema,
158
+ web: MobileWebConfigSchema.optional(),
159
+ // present → WEB mode; absent → NATIVE mode
160
+ auth: AuthConfigSchema,
161
+ scope: MobileScopeConfigSchema.optional(),
162
+ safety: SafetyConfigSchema.optional(),
163
+ source_repo: SourceRepoConfigSchema.optional(),
41
164
  notes: z.string().optional()
42
165
  });
166
+ var TargetConfigSchema = z.custom().superRefine((data, ctx) => {
167
+ const isMobile = typeof data === "object" && data !== null && "platform" in data;
168
+ const branch = isMobile ? MobileTargetConfigSchema : WebTargetConfigSchema;
169
+ const result = branch.safeParse(data);
170
+ if (!result.success) {
171
+ for (const issue of result.error.issues)
172
+ ctx.addIssue(issue);
173
+ }
174
+ });
43
175
 
44
176
  // src/schemas/knowledge-entry.schema.ts
45
177
  import { z as z2 } from "zod";
@@ -1111,11 +1243,18 @@ export {
1111
1243
  KnowledgeManifestSchema,
1112
1244
  KnowledgeManifestStatsSchema,
1113
1245
  LoadingStrategySchema,
1246
+ MobileAppConfigSchema,
1247
+ MobileDeviceConfigSchema,
1248
+ MobileScopeConfigSchema,
1249
+ MobileTargetConfigSchema,
1250
+ MobileWebConfigSchema,
1114
1251
  SafetyConfigSchema,
1115
1252
  ScopeConfigSchema,
1116
1253
  SessionMetricsSchema,
1117
1254
  SeverityCountsSchema,
1255
+ SourceRepoConfigSchema,
1118
1256
  TargetConfigSchema,
1257
+ WebTargetConfigSchema,
1119
1258
  appendSessionMetrics,
1120
1259
  containsSecrets,
1121
1260
  generateHtmlReport,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/target.schema.ts","../src/schemas/knowledge-entry.schema.ts","../src/schemas/knowledge-manifest.schema.ts","../src/schemas/domain-config.schema.ts","../src/schemas/session-metrics.schema.ts","../src/utils/redact.ts","../src/utils/validate.ts","../src/utils/metrics.ts","../src/utils/parse-session.ts","../src/formatters/html-report.ts","../src/formatters/json-report.ts","../src/formatters/jira-export.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const AuthConfigSchema = z.object({\n strategy: z.enum(['none', 'storage_state', 'credentials', 'token']),\n state_file: z.string().optional(),\n login_url: z.string().url().optional(),\n credentials: z\n .object({\n username: z.string(),\n password: z.string(),\n })\n .optional(),\n token: z.string().optional(),\n});\n\nexport const BrowserConfigSchema = z.object({\n headless: z.boolean(),\n viewport: z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n }),\n});\n\nexport const ScopeConfigSchema = z.object({\n start_pages: z.array(z.string()).optional(),\n max_depth: z.number().int().min(0),\n include_patterns: z.array(z.string()).optional(),\n exclude_patterns: z.array(z.string()).optional(),\n});\n\nexport const SafetyConfigSchema = z.object({\n read_only: z.boolean(),\n no_form_submit: z.boolean(),\n no_file_upload: z.boolean().optional(),\n no_delete_actions: z.boolean().optional(),\n});\n\nexport const TargetConfigSchema = z.object({\n id: z.string().min(1),\n name: z.string().min(1),\n base_url: z.string().url(),\n domain: z.string().min(1),\n auth: AuthConfigSchema,\n browser: BrowserConfigSchema,\n scope: ScopeConfigSchema,\n safety: SafetyConfigSchema.optional(),\n notes: z.string().optional(),\n});\n\nexport type TargetConfigInput = z.input<typeof TargetConfigSchema>;\n","import { z } from 'zod';\n\nexport const KnowledgeEntryContentSchema = z\n .object({\n summary: z.string().min(1),\n })\n .passthrough();\n\nexport const KnowledgeEntrySchema = z.object({\n id: z.string().min(1),\n version: z.string().min(1),\n type: z.enum(['heuristic', 'technique', 'checklist', 'reference']),\n name: z.string().min(1),\n description: z.string().min(1),\n author: z.string().optional(),\n source: z.string().optional(),\n tags: z.array(z.string()).min(1),\n domains: z.array(z.string()).min(1),\n priority: z.enum(['high', 'medium', 'low']),\n added: z.string().min(1),\n content: KnowledgeEntryContentSchema,\n});\n\nexport type KnowledgeEntryInput = z.input<typeof KnowledgeEntrySchema>;\n","import { z } from 'zod';\n\nexport const KnowledgeManifestStatsSchema = z.object({\n total_entries: z.number().int().min(0),\n heuristics: z.number().int().min(0),\n techniques: z.number().int().min(0),\n checklists: z.number().int().min(0),\n references: z.number().int().min(0),\n domain_profiles: z.number().int().min(0),\n custom_entries: z.number().int().min(0),\n});\n\nexport const KnowledgeManifestEntrySchema = z.object({\n id: z.string().min(1),\n file: z.string().min(1),\n type: z.string().min(1),\n priority: z.enum(['high', 'medium', 'low']),\n tags: z.array(z.string()),\n domains: z.array(z.string()),\n});\n\nexport const LoadingStrategySchema = z.object({\n always: z.array(z.string()),\n by_domain: z.record(z.string(), z.array(z.string())),\n by_tag: z.record(z.string(), z.array(z.string())),\n});\n\nexport const KnowledgeManifestSchema = z.object({\n version: z.string().min(1),\n last_updated: z.string().min(1),\n active_releases: z.array(z.string()).min(1),\n stats: KnowledgeManifestStatsSchema,\n loading_strategy: LoadingStrategySchema,\n entries: z.array(KnowledgeManifestEntrySchema).min(1),\n});\n\nexport type KnowledgeManifestInput = z.input<typeof KnowledgeManifestSchema>;\n","import { z } from 'zod';\n\nexport const JourneySchema = z.object({\n id: z.string().min(1),\n name: z.string().min(1),\n description: z.string().min(1),\n steps: z.array(z.string()).min(1),\n risk: z.enum(['high', 'medium', 'low']),\n});\n\nexport const DomainConfigSchema = z.object({\n id: z.string().min(1),\n name: z.string().min(1),\n risk_ranking: z.array(z.string()).min(1),\n completeness_checklist: z.array(z.string()).min(1),\n data_integrity_checks: z.array(z.string()).min(1),\n journeys: z.array(JourneySchema).min(1),\n guidance: z.array(z.string()).min(1),\n});\n\nexport type DomainConfigInput = z.input<typeof DomainConfigSchema>;\n","import { z } from 'zod';\n\nexport const SeverityCountsSchema = z.object({\n critical: z.number().int().min(0),\n high: z.number().int().min(0),\n medium: z.number().int().min(0),\n low: z.number().int().min(0),\n});\n\nexport const SessionMetricsSchema = z.object({\n session_id: z.string().min(1),\n target: z.string().min(1),\n date: z.string().min(1),\n duration_min: z.number().min(0),\n bugs_found: z.number().int().min(0),\n severity_counts: SeverityCountsSchema,\n pages_explored: z.number().int().min(0),\n});\n\nexport type SessionMetricsInput = z.input<typeof SessionMetricsSchema>;\n","/**\n * Credential and secret redaction utility.\n * Patterns derived from data/security/SECURITY-POLICY.md.\n */\n\ninterface RedactionPattern {\n name: string;\n pattern: RegExp;\n replacement: string;\n}\n\nconst REDACTION_PATTERNS: RedactionPattern[] = [\n {\n name: 'JWT token',\n pattern: /Bearer\\s+eyJ[A-Za-z0-9\\-_]+\\.[A-Za-z0-9\\-_]+\\.[A-Za-z0-9\\-_]+/g,\n replacement: 'Bearer [JWT_REDACTED]',\n },\n {\n name: 'API key',\n pattern: /api[_\\-]?key[=:\\s]+[A-Za-z0-9\\-_]{16,}/gi,\n replacement: 'api_key=[API_KEY_REDACTED]',\n },\n {\n name: 'Password',\n pattern: /password[=:\\s]+[^\\s,}\"']+/gi,\n replacement: 'password=[REDACTED]',\n },\n {\n name: 'Token',\n pattern: /token[=:\\s]+[A-Za-z0-9\\-_]{16,}/gi,\n replacement: 'token=[TOKEN_REDACTED]',\n },\n {\n name: 'Secret',\n pattern: /secret[=:\\s]+[^\\s,}\"']+/gi,\n replacement: 'secret=[REDACTED]',\n },\n {\n name: 'SSN',\n pattern: /\\b\\d{3}-\\d{2}-\\d{4}\\b/g,\n replacement: '[SSN_REDACTED]',\n },\n {\n name: 'Credit card number',\n pattern: /\\b\\d{13,19}\\b/g,\n replacement: '[CARD_NUMBER_REDACTED]',\n },\n];\n\n/**\n * Redacts secrets from the given text.\n * Returns the redacted text and a list of which secret types were found.\n */\nexport function redact(text: string): { text: string; redactions: string[] } {\n const redactions: string[] = [];\n let result = text;\n\n for (const { name, pattern, replacement } of REDACTION_PATTERNS) {\n // Reset lastIndex for global regex\n pattern.lastIndex = 0;\n if (pattern.test(result)) {\n redactions.push(name);\n pattern.lastIndex = 0;\n result = result.replace(pattern, replacement);\n }\n }\n\n return { text: result, redactions };\n}\n\n/**\n * Checks whether the text contains any detectable secrets.\n */\nexport function containsSecrets(text: string): boolean {\n for (const { pattern } of REDACTION_PATTERNS) {\n pattern.lastIndex = 0;\n if (pattern.test(text)) {\n return true;\n }\n }\n return false;\n}\n","import { readFileSync } from 'node:fs';\nimport { resolve, join } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\nimport { ZodError, type ZodSchema } from 'zod';\nimport { TargetConfigSchema } from '../schemas/target.schema.js';\nimport { KnowledgeEntrySchema } from '../schemas/knowledge-entry.schema.js';\nimport { DomainConfigSchema } from '../schemas/domain-config.schema.js';\nimport type { ValidationResult } from '../types/index.js';\nimport { globSync } from 'glob';\n\nfunction validateYamlFile(\n filePath: string,\n schema: ZodSchema,\n): ValidationResult {\n const absPath = resolve(filePath);\n try {\n const raw = readFileSync(absPath, 'utf-8');\n const data = parseYaml(raw);\n schema.parse(data);\n return { file: absPath, valid: true };\n } catch (err) {\n if (err instanceof ZodError) {\n return {\n file: absPath,\n valid: false,\n errors: err.issues.map((issue) => ({\n path: issue.path.join('.'),\n message: issue.message,\n })),\n };\n }\n return {\n file: absPath,\n valid: false,\n errors: [\n {\n path: '',\n message:\n err instanceof Error ? err.message : 'Unknown parsing error',\n },\n ],\n };\n }\n}\n\nexport function validateTargetConfig(filePath: string): ValidationResult {\n return validateYamlFile(filePath, TargetConfigSchema);\n}\n\nexport function validateKnowledgeEntry(filePath: string): ValidationResult {\n return validateYamlFile(filePath, KnowledgeEntrySchema);\n}\n\nexport function validateDomainConfig(filePath: string): ValidationResult {\n return validateYamlFile(filePath, DomainConfigSchema);\n}\n\nexport function validateAllConfigs(dataDir: string): ValidationResult[] {\n const results: ValidationResult[] = [];\n const absDir = resolve(dataDir);\n\n // Validate target configs\n const targetFiles = globSync(join(absDir, 'targets', '*.yml'));\n for (const file of targetFiles) {\n results.push(validateTargetConfig(file));\n }\n\n // Validate knowledge entries\n const entryFiles = globSync(\n join(absDir, 'knowledge', 'releases', '**', 'entries', '*.yml'),\n );\n for (const file of entryFiles) {\n results.push(validateKnowledgeEntry(file));\n }\n\n return results;\n}\n","import { readFileSync, appendFileSync, existsSync, mkdirSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { SessionMetricsSchema } from '../schemas/session-metrics.schema.js';\nimport type { SessionMetrics } from '../types/index.js';\n\nconst METRICS_FILENAME = 'metrics.jsonl';\n\n/**\n * Appends a single session metrics record to the JSONL file.\n * Creates the output directory and file if they do not exist.\n */\nexport function appendSessionMetrics(\n outputDir: string,\n metrics: SessionMetrics,\n): void {\n // Validate before writing\n SessionMetricsSchema.parse(metrics);\n\n const filePath = join(outputDir, METRICS_FILENAME);\n const dir = dirname(filePath);\n\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n const line = JSON.stringify(metrics) + '\\n';\n appendFileSync(filePath, line, 'utf-8');\n}\n\n/**\n * Reads all session metrics from the JSONL file.\n * Returns an empty array if the file does not exist or is empty.\n */\nexport function readAllMetrics(outputDir: string): SessionMetrics[] {\n const filePath = join(outputDir, METRICS_FILENAME);\n\n if (!existsSync(filePath)) {\n return [];\n }\n\n const content = readFileSync(filePath, 'utf-8').trim();\n if (!content) {\n return [];\n }\n\n const lines = content.split('\\n');\n const results: SessionMetrics[] = [];\n\n for (const line of lines) {\n if (line.trim()) {\n const parsed = JSON.parse(line);\n results.push(SessionMetricsSchema.parse(parsed));\n }\n }\n\n return results;\n}\n","/**\n * Session and bug report parser.\n * Reads a session directory and extracts structured data\n * from markdown files produced during exploratory testing.\n */\n\nimport { readFileSync, readdirSync, existsSync } from 'node:fs';\nimport { join, basename } from 'node:path';\n\n// ─── Types ──────────────────────────────────────────────────────────\n\nexport interface ParsedBug {\n id: string;\n title: string;\n severity: 'critical' | 'high' | 'medium' | 'low';\n component: string;\n url: string;\n expected: string;\n actual: string;\n steps: string[];\n business_impact: string;\n evidence: { screenshots: string[]; console_errors: string[] };\n}\n\nexport interface ParsedSession {\n id: string;\n charter?: string;\n bugs: ParsedBug[];\n report?: string;\n phases: { name: string; content: string }[];\n}\n\n// ─── Severity helpers ───────────────────────────────────────────────\n\nconst SEVERITY_ORDER: Record<string, number> = {\n critical: 0,\n high: 1,\n medium: 2,\n low: 3,\n};\n\nfunction normalizeSeverity(raw: string): ParsedBug['severity'] {\n const lower = raw.toLowerCase().trim();\n if (lower === 'critical' || lower === 'high' || lower === 'medium' || lower === 'low') {\n return lower;\n }\n // Handle variants like \"High (aggregate)\"\n if (lower.startsWith('critical')) return 'critical';\n if (lower.startsWith('high')) return 'high';\n if (lower.startsWith('medium')) return 'medium';\n if (lower.startsWith('low')) return 'low';\n return 'medium';\n}\n\n// ─── Section extraction ─────────────────────────────────────────────\n\n/**\n * Extracts the content under a markdown heading that starts with the\n * given prefix. Searches for both ## and ### level headings.\n */\nfunction extractSection(content: string, headingPrefix: string): string {\n const lines = content.split('\\n');\n let capturing = false;\n let capturedLevel = 0;\n const captured: string[] = [];\n\n for (const line of lines) {\n const headingMatch = line.match(/^(#{1,6})\\s+(.*)$/);\n\n if (headingMatch) {\n const level = headingMatch[1].length;\n const text = headingMatch[2].trim();\n\n if (text.toLowerCase().startsWith(headingPrefix.toLowerCase())) {\n capturing = true;\n capturedLevel = level;\n continue;\n }\n\n // Stop if we hit a heading at the same or higher level\n if (capturing && level <= capturedLevel) {\n break;\n }\n }\n\n if (capturing) {\n captured.push(line);\n }\n }\n\n return captured.join('\\n').trim();\n}\n\n/**\n * Extracts numbered list items from markdown text.\n * Handles lines like \"1. Navigate to ...\" and continuation lines.\n */\nfunction extractNumberedList(text: string): string[] {\n const steps: string[] = [];\n const lines = text.split('\\n');\n\n for (const line of lines) {\n const match = line.match(/^\\d+\\.\\s+(.+)$/);\n if (match) {\n steps.push(match[1].trim());\n }\n }\n\n return steps;\n}\n\n/**\n * Extracts screenshots and console errors from the evidence section.\n */\nfunction extractEvidence(content: string): { screenshots: string[]; console_errors: string[] } {\n const screenshots: string[] = [];\n const console_errors: string[] = [];\n\n const evidenceText = extractSection(content, 'Evidence');\n if (!evidenceText) {\n return { screenshots, console_errors };\n }\n\n for (const line of evidenceText.split('\\n')) {\n const trimmed = line.replace(/^[-*]\\s*/, '').trim();\n\n if (/screenshot/i.test(trimmed)) {\n // Extract path if present\n const pathMatch = trimmed.match(/:\\s*(.+)/);\n if (pathMatch) {\n screenshots.push(pathMatch[1].trim());\n }\n }\n\n if (/console\\s*(error|log)/i.test(trimmed)) {\n const msgMatch = trimmed.match(/:\\s*(.+)/);\n if (msgMatch && !/none/i.test(msgMatch[1])) {\n console_errors.push(msgMatch[1].trim());\n }\n }\n }\n\n return { screenshots, console_errors };\n}\n\n// ─── Public API ─────────────────────────────────────────────────────\n\n/**\n * Parses a single bug report markdown file into structured data.\n */\nexport async function parseBugReport(filePath: string): Promise<ParsedBug> {\n const content = readFileSync(filePath, 'utf-8');\n const filename = basename(filePath, '.md');\n\n // Extract ID from filename (e.g. BUG-R2-001, BUG-001)\n const id = filename;\n\n // Extract title from first heading: \"# BUG-R2-001: Title here\" or \"## [Component] Title\"\n let title = '';\n let component = '';\n\n const titleMatch = content.match(/^#\\s+(?:BUG[-\\w]*:\\s*)?(.+)$/m)\n ?? content.match(/^##\\s+(?:BUG[-\\w]*:\\s*)?(.+)$/m);\n\n if (titleMatch) {\n title = titleMatch[1].trim();\n }\n\n // Extract component from title — patterns: \"[Login]\", \"[Login Form]\"\n const componentMatch = title.match(/^\\[([^\\]]+)\\]\\s*/);\n if (componentMatch) {\n component = componentMatch[1];\n title = title.replace(/^\\[[^\\]]+\\]\\s*/, '').trim();\n }\n\n // If no bracketed component, try to extract from the title before \"fails\" or first word\n if (!component) {\n // Use the section before the first dash or the bug category from the report\n const categoryMatch = content.match(/\\|\\s*Category\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (categoryMatch) {\n component = categoryMatch[1].trim();\n }\n }\n\n // Extract severity: \"## Severity: High\" or \"**Severity:** High\"\n let severity: ParsedBug['severity'] = 'medium';\n const severityMatch = content.match(/\\*\\*Severity:\\*\\*\\s*(.+)/i)\n ?? content.match(/^##\\s+Severity:\\s*(.+)/mi);\n if (severityMatch) {\n severity = normalizeSeverity(severityMatch[1]);\n }\n\n // Extract URL\n let url = '';\n const urlMatch = content.match(/\\*\\*URL:\\*\\*\\s*(.+)/i)\n ?? content.match(/URL:\\s*(https?:\\/\\/[^\\s]+)/i);\n if (urlMatch) {\n url = urlMatch[1].trim();\n }\n\n // Extract expected behavior\n const expected = extractSection(content, 'Expected')\n .replace(/^_.*_\\n?/, '')\n .replace(/^>\\s*/gm, '')\n .trim();\n\n // Extract actual behavior\n const actual = extractSection(content, 'Actual')\n .replace(/^_.*_\\n?/, '')\n .replace(/^>\\s*/gm, '')\n .trim();\n\n // Extract steps\n const stepsSection = extractSection(content, 'Steps to Reproduce');\n const steps = extractNumberedList(stepsSection);\n\n // Extract business impact\n const business_impact = extractSection(content, 'Business Impact');\n\n // Extract evidence\n const evidence = extractEvidence(content);\n\n return {\n id,\n title,\n severity,\n component,\n url,\n expected,\n actual,\n steps,\n business_impact,\n evidence,\n };\n}\n\n/**\n * Parses an entire session directory into structured data.\n * Reads the session report, charter, phase files, and all bug reports.\n */\nexport async function parseSession(sessionDir: string): Promise<ParsedSession> {\n const id = basename(sessionDir);\n\n // Read charter if present\n let charter: string | undefined;\n const charterPath = join(sessionDir, 'charter.md');\n if (existsSync(charterPath)) {\n charter = readFileSync(charterPath, 'utf-8');\n }\n\n // Read session report if present\n let report: string | undefined;\n const reportPath = join(sessionDir, 'session-report.md');\n if (existsSync(reportPath)) {\n report = readFileSync(reportPath, 'utf-8');\n }\n\n // Read phase files\n const phases: { name: string; content: string }[] = [];\n if (existsSync(sessionDir)) {\n const files = readdirSync(sessionDir);\n const phaseFiles = files.filter((f) => /^phase-\\d+/i.test(f)).sort();\n for (const file of phaseFiles) {\n const content = readFileSync(join(sessionDir, file), 'utf-8');\n const name = file.replace(/\\.md$/, '');\n phases.push({ name, content });\n }\n }\n\n // Read and parse bug reports\n const bugsDir = join(sessionDir, 'bugs');\n const bugs: ParsedBug[] = [];\n\n if (existsSync(bugsDir)) {\n const bugFiles = readdirSync(bugsDir)\n .filter((f) => /^BUG-.*\\.md$/i.test(f))\n .sort();\n\n for (const file of bugFiles) {\n const bug = await parseBugReport(join(bugsDir, file));\n bugs.push(bug);\n }\n }\n\n // Sort bugs by severity\n bugs.sort((a, b) => SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity]);\n\n return {\n id,\n charter,\n bugs,\n report,\n phases,\n };\n}\n","/**\n * HTML report generator.\n * Produces a standalone dark-mode HTML report from session data.\n * The template is inline to simplify distribution.\n */\n\nimport Handlebars from 'handlebars';\nimport { parseSession } from '../utils/parse-session.js';\n\n// ─── Report metadata extraction ─────────────────────────────────────\n\ninterface ReportMeta {\n target: string;\n date: string;\n duration: string;\n sessionId: string;\n summary: string;\n}\n\nfunction extractReportMeta(report: string, sessionId: string): ReportMeta {\n const meta: ReportMeta = {\n target: sessionId,\n date: '',\n duration: '',\n sessionId,\n summary: '',\n };\n\n // Extract from session report metadata\n const dateMatch = report.match(/\\*\\*Date:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\|\\s*Date\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (dateMatch) meta.date = dateMatch[1].trim();\n\n const durationMatch = report.match(/\\*\\*Duration:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\|\\s*Duration\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (durationMatch) meta.duration = durationMatch[1].trim();\n\n const targetMatch = report.match(/\\*\\*Application:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\*\\*Target:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\|\\s*Target\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (targetMatch) meta.target = targetMatch[1].trim();\n\n // Extract executive summary\n const summaryMatch = report.match(/##\\s+Executive Summary\\s*\\n+([\\s\\S]*?)(?=\\n##\\s|\\n---)/i);\n if (summaryMatch) meta.summary = summaryMatch[1].trim();\n\n return meta;\n}\n\n// ─── Coverage extraction ────────────────────────────────────────────\n\ninterface CoverageEntry {\n area: string;\n status: string;\n bugsFound: string;\n notes: string;\n}\n\nfunction extractCoverage(report: string): CoverageEntry[] {\n const entries: CoverageEntry[] = [];\n\n // Look for coverage map table rows\n const tableMatch = report.match(\n /\\|\\s*Area\\s*\\|\\s*Status\\s*\\|[\\s\\S]*?\\n((?:\\|.+\\|.+\\n?)+)/i,\n );\n if (!tableMatch) return entries;\n\n const rows = tableMatch[1].split('\\n').filter((r) => r.trim().startsWith('|'));\n for (const row of rows) {\n const cells = row.split('|').map((c) => c.trim()).filter(Boolean);\n if (cells.length >= 2 && !cells[0].startsWith('---')) {\n entries.push({\n area: cells[0] || '',\n status: cells[1] || '',\n bugsFound: cells[3] || '0',\n notes: cells[4] || '',\n });\n }\n }\n\n return entries;\n}\n\n// ─── Observations and recommendations ───────────────────────────────\n\nfunction extractListSection(report: string, heading: string): string[] {\n const items: string[] = [];\n const regex = new RegExp(`##\\\\s+${heading}\\\\s*\\\\n+([\\\\s\\\\S]*?)(?=\\\\n##\\\\s|\\\\n---|$)`, 'i');\n const match = report.match(regex);\n if (!match) return items;\n\n for (const line of match[1].split('\\n')) {\n const itemMatch = line.match(/^[-*]\\s+(?:\\[.\\]\\s+)?(.+)/);\n if (itemMatch) {\n items.push(itemMatch[1].trim());\n }\n // Also capture numbered items under sub-headings\n const numberedMatch = line.match(/^\\d+\\.\\s+\\*\\*(.+?)\\*\\*\\s*(.+)?/);\n if (numberedMatch) {\n const text = numberedMatch[2]\n ? `${numberedMatch[1]} ${numberedMatch[2]}`\n : numberedMatch[1];\n items.push(text.replace(/\\s*--\\s*/, ' -- '));\n }\n }\n\n return items;\n}\n\n// ─── Handlebars template ────────────────────────────────────────────\n\nconst HTML_TEMPLATE = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Qualiow Report — {{meta.target}}</title>\n <style>\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n\n body {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n background: #0a0f1a;\n color: #e0e6ed;\n line-height: 1.6;\n padding: 2rem;\n }\n\n a { color: #3498db; text-decoration: none; }\n a:hover { text-decoration: underline; }\n\n .container { max-width: 960px; margin: 0 auto; }\n\n /* Header */\n .header {\n border-bottom: 2px solid #1e2a3a;\n padding-bottom: 1.5rem;\n margin-bottom: 2rem;\n }\n .header h1 {\n font-size: 1.75rem;\n font-weight: 700;\n color: #ffffff;\n margin-bottom: 0.25rem;\n }\n .header .meta {\n display: flex;\n flex-wrap: wrap;\n gap: 1.5rem;\n font-size: 0.9rem;\n color: #8899aa;\n margin-top: 0.5rem;\n }\n .header .meta span { white-space: nowrap; }\n\n /* Stats cards */\n .stats {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));\n gap: 1rem;\n margin-bottom: 2rem;\n }\n .stat-card {\n background: #111927;\n border-radius: 8px;\n padding: 1rem 1.25rem;\n text-align: center;\n }\n .stat-card .number {\n font-size: 2rem;\n font-weight: 700;\n display: block;\n }\n .stat-card .label {\n font-size: 0.8rem;\n color: #8899aa;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n }\n .stat-total .number { color: #e0e6ed; }\n .stat-critical .number { color: #ff4757; }\n .stat-high .number { color: #ffa502; }\n .stat-medium .number { color: #ffd32a; }\n .stat-low .number { color: #3498db; }\n\n /* Summary */\n .summary {\n background: #111927;\n border-radius: 8px;\n padding: 1.25rem 1.5rem;\n margin-bottom: 2rem;\n font-size: 0.95rem;\n color: #c0c8d0;\n }\n\n /* Section headings */\n .section-title {\n font-size: 1.25rem;\n font-weight: 600;\n color: #ffffff;\n margin: 2rem 0 1rem;\n padding-bottom: 0.5rem;\n border-bottom: 1px solid #1e2a3a;\n }\n\n /* Bug cards */\n .bug-card {\n background: #111927;\n border-radius: 8px;\n border-left: 4px solid #3498db;\n padding: 1.25rem 1.5rem;\n margin-bottom: 1rem;\n }\n .bug-card.severity-critical { border-left-color: #ff4757; }\n .bug-card.severity-high { border-left-color: #ffa502; }\n .bug-card.severity-medium { border-left-color: #ffd32a; }\n .bug-card.severity-low { border-left-color: #3498db; }\n\n .bug-card .bug-header {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-bottom: 0.75rem;\n }\n .bug-card .bug-title {\n font-size: 1rem;\n font-weight: 600;\n color: #ffffff;\n flex: 1;\n min-width: 200px;\n }\n\n .badge {\n display: inline-block;\n font-size: 0.7rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n padding: 0.2rem 0.5rem;\n border-radius: 4px;\n white-space: nowrap;\n }\n .badge-critical { background: #ff475733; color: #ff4757; }\n .badge-high { background: #ffa50233; color: #ffa502; }\n .badge-medium { background: #ffd32a33; color: #ffd32a; }\n .badge-low { background: #3498db33; color: #3498db; }\n .badge-component { background: #1e2a3a; color: #8899aa; }\n\n .bug-section-label {\n font-size: 0.8rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: #8899aa;\n margin: 0.75rem 0 0.25rem;\n }\n\n .bug-card p,\n .bug-card li {\n font-size: 0.9rem;\n color: #c0c8d0;\n }\n\n .bug-card ol {\n padding-left: 1.25rem;\n margin: 0.25rem 0;\n }\n .bug-card ol li {\n margin-bottom: 0.15rem;\n }\n\n .bug-card .evidence-item {\n font-size: 0.85rem;\n color: #8899aa;\n }\n\n /* Coverage table */\n table {\n width: 100%;\n border-collapse: collapse;\n margin-bottom: 1rem;\n font-size: 0.9rem;\n }\n th, td {\n text-align: left;\n padding: 0.5rem 0.75rem;\n border-bottom: 1px solid #1e2a3a;\n }\n th {\n font-size: 0.8rem;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: #8899aa;\n font-weight: 600;\n }\n td { color: #c0c8d0; }\n\n /* Lists */\n .list-section ul {\n list-style: disc;\n padding-left: 1.25rem;\n }\n .list-section li {\n font-size: 0.9rem;\n color: #c0c8d0;\n margin-bottom: 0.35rem;\n }\n\n /* Footer */\n .footer {\n margin-top: 3rem;\n padding-top: 1.5rem;\n border-top: 1px solid #1e2a3a;\n text-align: center;\n font-size: 0.8rem;\n color: #556677;\n }\n\n /* Print styles */\n @media print {\n body {\n background: #ffffff;\n color: #1a1a1a;\n padding: 1rem;\n }\n .stat-card, .bug-card, .summary {\n background: #f5f5f5;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n .stat-total .number { color: #1a1a1a; }\n .stat-critical .number { color: #cc0000; }\n .stat-high .number { color: #cc7700; }\n .stat-medium .number { color: #cc9900; }\n .stat-low .number { color: #2266aa; }\n .bug-card .bug-title { color: #1a1a1a; }\n th { color: #555555; }\n td, .bug-card p, .bug-card li, .list-section li { color: #333333; }\n .bug-section-label { color: #555555; }\n .footer { color: #999999; }\n }\n\n /* Responsive */\n @media (max-width: 600px) {\n body { padding: 1rem; }\n .header h1 { font-size: 1.35rem; }\n .stats { grid-template-columns: repeat(2, 1fr); }\n .bug-card .bug-header { flex-direction: column; align-items: flex-start; }\n }\n </style>\n</head>\n<body>\n <div class=\"container\">\n\n <div class=\"header\">\n <h1>Exploratory Testing Report</h1>\n <div class=\"meta\">\n <span>Target: <strong>{{meta.target}}</strong></span>\n {{#if meta.date}}<span>Date: <strong>{{meta.date}}</strong></span>{{/if}}\n {{#if meta.duration}}<span>Duration: <strong>{{meta.duration}}</strong></span>{{/if}}\n <span>Session: <strong>{{meta.sessionId}}</strong></span>\n </div>\n </div>\n\n <div class=\"stats\">\n <div class=\"stat-card stat-total\">\n <span class=\"number\">{{totalBugs}}</span>\n <span class=\"label\">Total Bugs</span>\n </div>\n <div class=\"stat-card stat-critical\">\n <span class=\"number\">{{criticalCount}}</span>\n <span class=\"label\">Critical</span>\n </div>\n <div class=\"stat-card stat-high\">\n <span class=\"number\">{{highCount}}</span>\n <span class=\"label\">High</span>\n </div>\n <div class=\"stat-card stat-medium\">\n <span class=\"number\">{{mediumCount}}</span>\n <span class=\"label\">Medium</span>\n </div>\n <div class=\"stat-card stat-low\">\n <span class=\"number\">{{lowCount}}</span>\n <span class=\"label\">Low</span>\n </div>\n </div>\n\n {{#if meta.summary}}\n <div class=\"summary\">{{meta.summary}}</div>\n {{/if}}\n\n <h2 class=\"section-title\">Bugs Found</h2>\n\n {{#each bugs}}\n <div class=\"bug-card severity-{{this.severity}}\">\n <div class=\"bug-header\">\n <span class=\"bug-title\">{{this.id}}: {{this.title}}</span>\n <span class=\"badge badge-{{this.severity}}\">{{this.severity}}</span>\n {{#if this.component}}<span class=\"badge badge-component\">{{this.component}}</span>{{/if}}\n </div>\n\n {{#if this.business_impact}}\n <div class=\"bug-section-label\">Business Impact</div>\n <p>{{this.business_impact_summary}}</p>\n {{/if}}\n\n {{#if this.steps.length}}\n <div class=\"bug-section-label\">Steps to Reproduce</div>\n <ol>\n {{#each this.steps}}\n <li>{{this}}</li>\n {{/each}}\n </ol>\n {{/if}}\n\n {{#if this.hasEvidence}}\n <div class=\"bug-section-label\">Evidence</div>\n {{#each this.evidence.screenshots}}\n <p class=\"evidence-item\">Screenshot: {{this}}</p>\n {{/each}}\n {{#each this.evidence.console_errors}}\n <p class=\"evidence-item\">Console: {{this}}</p>\n {{/each}}\n {{/if}}\n </div>\n {{/each}}\n\n {{#if coverage.length}}\n <h2 class=\"section-title\">Coverage Map</h2>\n <table>\n <thead>\n <tr>\n <th>Area</th>\n <th>Status</th>\n <th>Bugs</th>\n <th>Notes</th>\n </tr>\n </thead>\n <tbody>\n {{#each coverage}}\n <tr>\n <td>{{this.area}}</td>\n <td>{{this.status}}</td>\n <td>{{this.bugsFound}}</td>\n <td>{{this.notes}}</td>\n </tr>\n {{/each}}\n </tbody>\n </table>\n {{/if}}\n\n {{#if observations.length}}\n <h2 class=\"section-title\">Observations</h2>\n <div class=\"list-section\">\n <ul>\n {{#each observations}}\n <li>{{this}}</li>\n {{/each}}\n </ul>\n </div>\n {{/if}}\n\n {{#if recommendations.length}}\n <h2 class=\"section-title\">Recommendations</h2>\n <div class=\"list-section\">\n <ul>\n {{#each recommendations}}\n <li>{{this}}</li>\n {{/each}}\n </ul>\n </div>\n {{/if}}\n\n <div class=\"footer\">\n Generated by Qualiow Exploratory Testing\n </div>\n\n </div>\n</body>\n</html>`;\n\n// ─── Template compilation ───────────────────────────────────────────\n\nconst compiledTemplate = Handlebars.compile(HTML_TEMPLATE);\n\n// ─── Public API ─────────────────────────────────────────────────────\n\n/**\n * Generates a self-contained dark-mode HTML report from a session directory.\n */\nexport async function generateHtmlReport(sessionDir: string): Promise<string> {\n const session = await parseSession(sessionDir);\n\n const report = session.report ?? '';\n const meta = extractReportMeta(report, session.id);\n const coverage = extractCoverage(report);\n const observations = extractListSection(report, 'Observations');\n const recommendations = extractListSection(report, 'Recommendations');\n\n // Count severities\n const counts = { critical: 0, high: 0, medium: 0, low: 0 };\n for (const bug of session.bugs) {\n counts[bug.severity]++;\n }\n\n // Prepare bug data for the template\n const bugsForTemplate = session.bugs.map((bug) => ({\n ...bug,\n business_impact_summary: summarizeBusinessImpact(bug.business_impact),\n hasEvidence:\n bug.evidence.screenshots.length > 0 ||\n bug.evidence.console_errors.length > 0,\n }));\n\n const html = compiledTemplate({\n meta,\n totalBugs: session.bugs.length,\n criticalCount: counts.critical,\n highCount: counts.high,\n mediumCount: counts.medium,\n lowCount: counts.low,\n bugs: bugsForTemplate,\n coverage,\n observations,\n recommendations,\n });\n\n return html;\n}\n\n/**\n * Extracts a one-line summary from the business impact section.\n * Takes the first meaningful line or sentence.\n */\nfunction summarizeBusinessImpact(impact: string): string {\n if (!impact) return '';\n\n const lines = impact.split('\\n').filter((l) => l.trim());\n const summaryLines: string[] = [];\n\n for (const line of lines) {\n const cleaned = line\n .replace(/^[-*]\\s*/, '')\n .replace(/^\\*\\*[^*]+\\*\\*\\s*/, '')\n .trim();\n if (cleaned) {\n summaryLines.push(cleaned);\n }\n }\n\n // Return first 2-3 meaningful points joined\n return summaryLines.slice(0, 3).join(' ');\n}\n","/**\n * JSON report generator.\n * Produces structured JSON from session data for programmatic consumption.\n */\n\nimport { parseSession } from '../utils/parse-session.js';\n\n// ─── Report metadata extraction ─────────────────────────────────────\n\nfunction extractTarget(report: string, sessionId: string): string {\n const match = report.match(/\\*\\*Application:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\*\\*Target:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\|\\s*Target\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (match) return match[1].trim();\n\n // Fallback: extract from session ID (e.g. \"2026-03-28-r2-parabank\" -> \"parabank\")\n const parts = sessionId.split('-');\n return parts[parts.length - 1] || sessionId;\n}\n\nfunction extractDate(report: string): string {\n const match = report.match(/\\*\\*Date:\\*\\*\\s*(\\d{4}-\\d{2}-\\d{2})/i)\n ?? report.match(/\\|\\s*Date\\s*\\|\\s*(\\d{4}-\\d{2}-\\d{2})\\s*\\|/i);\n return match ? match[1] : '';\n}\n\nfunction extractDuration(report: string): number {\n const match = report.match(/\\*\\*Duration:\\*\\*\\s*~?(\\d+)\\s*min/i)\n ?? report.match(/\\|\\s*Duration\\s*\\|\\s*~?(\\d+)\\s*min/i);\n return match ? parseInt(match[1], 10) : 0;\n}\n\nfunction extractPagesExplored(report: string): number {\n const match = report.match(/Pages\\s+Explored\\s*\\|\\s*(\\d+)/i);\n return match ? parseInt(match[1], 10) : 0;\n}\n\n// ─── Coverage extraction ────────────────────────────────────────────\n\ninterface CoverageEntry {\n area: string;\n status: string;\n bugs_found: number;\n notes: string;\n}\n\nfunction extractCoverage(report: string): CoverageEntry[] {\n const entries: CoverageEntry[] = [];\n const tableMatch = report.match(\n /\\|\\s*Area\\s*\\|\\s*Status\\s*\\|[\\s\\S]*?\\n((?:\\|.+\\|.+\\n?)+)/i,\n );\n if (!tableMatch) return entries;\n\n const rows = tableMatch[1].split('\\n').filter((r) => r.trim().startsWith('|'));\n for (const row of rows) {\n const cells = row.split('|').map((c) => c.trim()).filter(Boolean);\n if (cells.length >= 2 && !cells[0].startsWith('---')) {\n entries.push({\n area: cells[0] || '',\n status: cells[1] || '',\n bugs_found: parseInt(cells[3] || '0', 10) || 0,\n notes: cells[4] || '',\n });\n }\n }\n return entries;\n}\n\n// ─── List extraction ────────────────────────────────────────────────\n\nfunction extractListSection(report: string, heading: string): string[] {\n const items: string[] = [];\n const regex = new RegExp(`##\\\\s+${heading}\\\\s*\\\\n+([\\\\s\\\\S]*?)(?=\\\\n##\\\\s|\\\\n---|$)`, 'i');\n const match = report.match(regex);\n if (!match) return items;\n\n for (const line of match[1].split('\\n')) {\n const itemMatch = line.match(/^[-*]\\s+(?:\\[.\\]\\s+)?(.+)/);\n if (itemMatch) {\n items.push(itemMatch[1].trim());\n }\n const numberedMatch = line.match(/^\\d+\\.\\s+\\*\\*(.+?)\\*\\*\\s*(.+)?/);\n if (numberedMatch) {\n const text = numberedMatch[2]\n ? `${numberedMatch[1]} ${numberedMatch[2]}`\n : numberedMatch[1];\n items.push(text.replace(/\\s*--\\s*/, ' -- '));\n }\n }\n return items;\n}\n\n// ─── Public API ─────────────────────────────────────────────────────\n\n/**\n * Generates a structured JSON report from a session directory.\n */\nexport async function generateJsonReport(sessionDir: string): Promise<object> {\n const session = await parseSession(sessionDir);\n const report = session.report ?? '';\n\n const target = extractTarget(report, session.id);\n const date = extractDate(report);\n const duration_min = extractDuration(report);\n const pages_explored = extractPagesExplored(report);\n\n const counts = { critical: 0, high: 0, medium: 0, low: 0 };\n for (const bug of session.bugs) {\n counts[bug.severity]++;\n }\n\n const coverage = extractCoverage(report);\n const observations = extractListSection(report, 'Observations');\n const recommendations = extractListSection(report, 'Recommendations');\n\n return {\n session: {\n id: session.id,\n target,\n date,\n duration_min,\n },\n summary: {\n total_bugs: session.bugs.length,\n critical: counts.critical,\n high: counts.high,\n medium: counts.medium,\n low: counts.low,\n pages_explored,\n },\n bugs: session.bugs.map((bug) => ({\n id: bug.id,\n title: bug.title,\n severity: bug.severity,\n component: bug.component,\n url: bug.url,\n business_impact: bug.business_impact,\n steps: bug.steps,\n evidence: bug.evidence,\n })),\n coverage,\n observations,\n recommendations,\n };\n}\n","/**\n * Jira CSV export generator.\n * Produces a CSV file importable via Jira bulk import.\n */\n\nimport { parseSession } from '../utils/parse-session.js';\nimport type { ParsedBug } from '../utils/parse-session.js';\n\n// ─── Severity to Jira priority mapping ──────────────────────────────\n\nconst SEVERITY_TO_JIRA_PRIORITY: Record<string, string> = {\n critical: 'Blocker',\n high: 'Critical',\n medium: 'Major',\n low: 'Minor',\n};\n\n// ─── CSV escaping ───────────────────────────────────────────────────\n\n/**\n * Escapes a value for inclusion in a CSV field.\n * Wraps in double quotes and escapes internal double quotes.\n */\nfunction csvEscape(value: string): string {\n if (!value) return '\"\"';\n // Always quote to avoid issues with commas, newlines, quotes\n const escaped = value.replace(/\"/g, '\"\"');\n return `\"${escaped}\"`;\n}\n\n// ─── Description formatting ─────────────────────────────────────────\n\nfunction formatDescription(bug: ParsedBug): string {\n const parts: string[] = [];\n\n if (bug.steps.length > 0) {\n parts.push('h3. Steps to Reproduce');\n for (const step of bug.steps) {\n parts.push(`# ${step}`);\n }\n parts.push('');\n }\n\n if (bug.expected) {\n parts.push(`h3. Expected Behavior`);\n parts.push(bug.expected);\n parts.push('');\n }\n\n if (bug.actual) {\n parts.push(`h3. Actual Behavior`);\n parts.push(bug.actual);\n parts.push('');\n }\n\n if (bug.business_impact) {\n parts.push('h3. Business Impact');\n parts.push(bug.business_impact);\n parts.push('');\n }\n\n if (bug.url) {\n parts.push(`h3. URL`);\n parts.push(bug.url);\n }\n\n return parts.join('\\n');\n}\n\n// ─── Domain extraction ──────────────────────────────────────────────\n\nfunction extractDomain(sessionId: string): string {\n // Attempt to extract domain from session ID (e.g. \"2026-03-28-r2-parabank\" -> \"fintech\")\n // Fallback to \"general\" since we cannot reliably determine domain from session ID alone\n return 'general';\n}\n\n// ─── Public API ─────────────────────────────────────────────────────\n\n/**\n * Generates a CSV string importable by Jira bulk import from a session directory.\n *\n * CSV columns:\n * - Summary: bug title\n * - Priority: mapped from severity\n * - Description: steps + business impact formatted in Jira wiki markup\n * - Component: from bug component field\n * - Labels: qualiow, exploratory-testing, domain\n */\nexport async function generateJiraExport(sessionDir: string): Promise<string> {\n const session = await parseSession(sessionDir);\n\n const headers = ['Summary', 'Priority', 'Description', 'Component', 'Labels'];\n const rows: string[] = [headers.join(',')];\n\n const domain = extractDomain(session.id);\n\n for (const bug of session.bugs) {\n const summary = `${bug.id}: ${bug.title}`;\n const priority = SEVERITY_TO_JIRA_PRIORITY[bug.severity] ?? 'Major';\n const description = formatDescription(bug);\n const component = bug.component || '';\n const labels = ['qualiow', 'exploratory-testing', domain]\n .filter(Boolean)\n .join(' ');\n\n rows.push(\n [\n csvEscape(summary),\n csvEscape(priority),\n csvEscape(description),\n csvEscape(component),\n csvEscape(labels),\n ].join(','),\n );\n }\n\n return rows.join('\\n');\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,UAAU,EAAE,KAAK,CAAC,QAAQ,iBAAiB,eAAe,OAAO,CAAC;AAAA,EAClE,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,WAAW,EAAE,OAAO,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,KAAK,EAAE;AAAA,EACf;AAEA,MAAI,IAAI,iBAAiB;AACvB,UAAM,KAAK,qBAAqB;AAChC,UAAM,KAAK,IAAI,eAAe;AAC9B,UAAM,KAAK,EAAE;AAAA,EACf;AAEA,MAAI,IAAI,KAAK;AACX,UAAM,KAAK,SAAS;AACpB,UAAM,KAAK,IAAI,GAAG;AAAA,EACpB;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;AAIA,SAAS,cAAc,WAA2B;AAGhD,SAAO;AACT;AAcA,eAAsB,mBAAmB,YAAqC;AAC5E,QAAM,UAAU,MAAM,aAAa,UAAU;AAE7C,QAAM,UAAU,CAAC,WAAW,YAAY,eAAe,aAAa,QAAQ;AAC5E,QAAM,OAAiB,CAAC,QAAQ,KAAK,GAAG,CAAC;AAEzC,QAAM,SAAS,cAAc,QAAQ,EAAE;AAEvC,aAAW,OAAO,QAAQ,MAAM;AAC9B,UAAM,UAAU,GAAG,IAAI,EAAE,KAAK,IAAI,KAAK;AACvC,UAAM,WAAW,0BAA0B,IAAI,QAAQ,KAAK;AAC5D,UAAM,cAAc,kBAAkB,GAAG;AACzC,UAAM,YAAY,IAAI,aAAa;AACnC,UAAM,SAAS,CAAC,WAAW,uBAAuB,MAAM,EACrD,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SAAK;AAAA,MACH;AAAA,QACE,UAAU,OAAO;AAAA,QACjB,UAAU,QAAQ;AAAA,QAClB,UAAU,WAAW;AAAA,QACrB,UAAU,SAAS;AAAA,QACnB,UAAU,MAAM;AAAA,MAClB,EAAE,KAAK,GAAG;AAAA,IACZ;AAAA,EACF;AAEA,SAAO,KAAK,KAAK,IAAI;AACvB;","names":["z","z","z","z","readFileSync","join","join","readFileSync","readFileSync","existsSync","join","extractCoverage","extractListSection"]}
1
+ {"version":3,"sources":["../src/schemas/target.schema.ts","../src/schemas/knowledge-entry.schema.ts","../src/schemas/knowledge-manifest.schema.ts","../src/schemas/domain-config.schema.ts","../src/schemas/session-metrics.schema.ts","../src/utils/redact.ts","../src/utils/validate.ts","../src/utils/metrics.ts","../src/utils/parse-session.ts","../src/formatters/html-report.ts","../src/formatters/json-report.ts","../src/formatters/jira-export.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const AuthConfigSchema = z.object({\n // 'in-app' (native mobile: login/signup inside the app) and 'interactive-sso'\n // (mobile web: one-time human SSO/MFA login the browser profile persists) are\n // mobile-only strategies used by /qa-explore-mobile.\n strategy: z.enum([\n 'none',\n 'storage_state',\n 'credentials',\n 'token',\n 'in-app',\n 'interactive-sso',\n ]),\n state_file: z.string().optional(),\n login_url: z.string().url().optional(),\n credentials: z\n .object({\n username: z.string(),\n password: z.string(),\n })\n .optional(),\n token: z.string().optional(),\n identity_provider: z.string().optional(),\n // Staging builds sometimes accept a fixed OTP — recorded so the auth phase can\n // use it instead of waiting for a real code. Never a real credential.\n static_otp: z.string().optional(),\n test_email_pattern: z.string().optional(),\n});\n\nexport const BrowserConfigSchema = z.object({\n headless: z.boolean(),\n viewport: z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n }),\n // Optional engine selection + Playwright device descriptor for mobile-web\n // emulation targets (e.g. engine: webkit, device: \"iPhone 15\").\n engine: z.enum(['chromium', 'webkit', 'firefox']).optional(),\n channel: z.string().optional(),\n device: z.string().optional(),\n});\n\nexport const ScopeConfigSchema = z.object({\n start_pages: z.array(z.string()).optional(),\n max_depth: z.number().int().min(0),\n include_patterns: z.array(z.string()).optional(),\n exclude_patterns: z.array(z.string()).optional(),\n});\n\nexport const SafetyConfigSchema = z.object({\n read_only: z.boolean(),\n no_form_submit: z.boolean(),\n no_file_upload: z.boolean().optional(),\n no_delete_actions: z.boolean().optional(),\n});\n\n// ─── Backend verification surface (/qa-verify-backend) ────────────────\n\n// What the skill is allowed to do in this environment. `kind: production`\n// forces read-only probes and skips the end-to-end write phase.\nexport const EnvironmentConfigSchema = z.object({\n kind: z.enum(['dev', 'ephemeral', 'staging', 'production']),\n destroyed_automatically: z.boolean().optional(),\n});\n\n// Cloud resources to probe read-only. Credentials are referenced by env var\n// NAME (`aws_profile_env`, `region_env`) and never stored here.\nexport const BackendConfigSchema = z.object({\n provider: z.enum(['aws']).optional(),\n aws_profile_env: z.string().optional(),\n region_env: z.string().optional(),\n region: z.string().optional(),\n // Expected account. The skill compares it to `sts get-caller-identity` and\n // stops the live lane on a mismatch rather than probing someone else's account.\n account_id: z.string().optional(),\n env_suffix: z.string().optional(),\n // Free-form logical name -> deployed resource name (config_table, dlq, ...).\n resources: z.record(z.string(), z.string()).optional(),\n notes: z.string().optional(),\n});\n\n// The service's own HTTP surface, probed read-only from the authenticated\n// session. Credentials are referenced by env var NAME or by profile directory —\n// never stored here.\nexport const ApiSurfaceConfigSchema = z.object({\n // Defaults to the target's base_url when omitted.\n base_url: z.string().optional(),\n auth: z.enum(['session-cookie', 'bearer-env', 'none']).optional(),\n // NAME of the env var holding a bearer token, for `auth: bearer-env`.\n token_env: z.string().optional(),\n // Persistent browser profile directory holding the authenticated session,\n // e.g. `.auth/my-service-dev-profile`. Gitignored.\n browser_profile: z.string().optional(),\n // Endpoint returning the deployed build, used to fingerprint the environment.\n version_endpoint: z.string().optional(),\n // Logical name -> \"VERB /path\", e.g. search: \"POST /api/v1/search\".\n endpoints: z.record(z.string(), z.string()).optional(),\n // The ONLY endpoints the read-only API lane may call without asking.\n probe_allowlist: z.array(z.string()).optional(),\n // Other target ids to run the same matrix against, for parity comparison.\n parity_targets: z.array(z.string()).optional(),\n // Flag name -> where its deployed value is declared for this environment.\n // A flag can select between two implementations inside one identical build.\n feature_flags: z.record(z.string(), z.string()).optional(),\n notes: z.string().optional(),\n});\n\n// The implementation branch reviewed statically. Read with `git show`, never\n// checked out — the user may have uncommitted work.\nexport const SourceBranchConfigSchema = z.object({\n repo_path: z.string(),\n branch: z.string(),\n base_branch: z.string().optional(),\n components: z.record(z.string(), z.string()).optional(),\n});\n\n// ─── Web target (Playwright / playwright-cli — /qa-explore) ───────────\n\nexport const WebTargetConfigSchema = z.object({\n id: z.string().min(1),\n name: z.string().min(1),\n // '' is allowed for the ad-hoc template (_default.yml) where the URL is\n // provided at session start rather than in the config.\n base_url: z.union([z.literal(''), z.string().url()]),\n domain: z.string().min(1),\n auth: AuthConfigSchema,\n browser: BrowserConfigSchema,\n scope: ScopeConfigSchema,\n safety: SafetyConfigSchema.optional(),\n // Optional blocks consumed by /qa-verify-backend. A target without them is\n // still a valid /qa-explore target.\n environment: EnvironmentConfigSchema.optional(),\n backend: BackendConfigSchema.optional(),\n api: ApiSurfaceConfigSchema.optional(),\n source: SourceBranchConfigSchema.optional(),\n notes: z.string().optional(),\n});\n\n// ─── Mobile target (Maestro / mobile-cli — /qa-explore-mobile) ────────\n\nexport const MobileDeviceConfigSchema = z.object({\n name: z.string().optional(), // iOS simulator name (portable across machines)\n udid: z.string().optional(), // iOS simulator UDID (takes precedence over name)\n avd: z.string().optional(), // Android AVD name\n serial: z.string().optional(), // Android serial once booted (e.g. emulator-5554)\n});\n\nexport const MobileAppConfigSchema = z.object({\n bundle_id: z.string().optional(), // iOS bundle id (or browser bundle in web mode)\n package: z.string().optional(), // Android application id (or browser package)\n app_paths: z.array(z.string()).optional(), // iOS .app artifact(s) — native mode\n apk_paths: z.array(z.string()).optional(), // Android APK(s) — native mode\n});\n\nexport const MobileWebConfigSchema = z.object({\n base_url: z.string().url(),\n start_url: z.string().url().optional(),\n});\n\nexport const SourceRepoConfigSchema = z.object({\n path: z.string(),\n build_commands: z.record(z.string(), z.string()).optional(),\n});\n\nexport const MobileScopeConfigSchema = z.object({\n start_screen: z.string().optional(),\n start_url: z.string().optional(),\n include_patterns: z.array(z.string()).optional(),\n exclude_patterns: z.array(z.string()).optional(),\n});\n\nexport const MobileTargetConfigSchema = z.object({\n id: z.string().min(1),\n name: z.string().min(1),\n platform: z.enum(['ios', 'android']), // discriminates mobile from web targets\n domain: z.string().min(1),\n device: MobileDeviceConfigSchema,\n app: MobileAppConfigSchema,\n web: MobileWebConfigSchema.optional(), // present → WEB mode; absent → NATIVE mode\n auth: AuthConfigSchema,\n scope: MobileScopeConfigSchema.optional(),\n safety: SafetyConfigSchema.optional(),\n source_repo: SourceRepoConfigSchema.optional(),\n notes: z.string().optional(),\n});\n\n// ─── Combined ─────────────────────────────────────────────────────────\n\nexport type WebTargetConfigInput = z.input<typeof WebTargetConfigSchema>;\nexport type MobileTargetConfigInput = z.input<typeof MobileTargetConfigSchema>;\nexport type TargetConfigInput = WebTargetConfigInput | MobileTargetConfigInput;\n\n// Discriminate on the presence of `platform` (mobile-only, required there) instead\n// of z.union — a union wraps branch failures in one `invalid_union` issue and loses\n// the per-field error paths that the CLI validate output reports.\nexport const TargetConfigSchema: z.ZodType<\n z.output<typeof WebTargetConfigSchema> | z.output<typeof MobileTargetConfigSchema>\n> = z.custom<TargetConfigInput>().superRefine((data, ctx) => {\n const isMobile =\n typeof data === 'object' && data !== null && 'platform' in data;\n const branch = isMobile ? MobileTargetConfigSchema : WebTargetConfigSchema;\n const result = branch.safeParse(data);\n if (!result.success) {\n // A fully-formed issue from a sub-parse is structurally compatible with\n // ctx.addIssue but lacks the index signature zod 4's raw-issue type\n // declares; assert against the method's own parameter type to forward it\n // verbatim and keep the per-field error paths.\n for (const issue of result.error.issues)\n ctx.addIssue(issue as Parameters<typeof ctx.addIssue>[0]);\n }\n});\n","import { z } from 'zod';\n\nexport const KnowledgeEntryContentSchema = z\n .object({\n summary: z.string().min(1),\n })\n .passthrough();\n\nexport const KnowledgeEntrySchema = z.object({\n id: z.string().min(1),\n version: z.string().min(1),\n type: z.enum(['heuristic', 'technique', 'checklist', 'reference']),\n name: z.string().min(1),\n description: z.string().min(1),\n author: z.string().optional(),\n source: z.string().optional(),\n tags: z.array(z.string()).min(1),\n domains: z.array(z.string()).min(1),\n priority: z.enum(['high', 'medium', 'low']),\n added: z.string().min(1),\n content: KnowledgeEntryContentSchema,\n});\n\nexport type KnowledgeEntryInput = z.input<typeof KnowledgeEntrySchema>;\n","import { z } from 'zod';\n\nexport const KnowledgeManifestStatsSchema = z.object({\n total_entries: z.number().int().min(0),\n heuristics: z.number().int().min(0),\n techniques: z.number().int().min(0),\n checklists: z.number().int().min(0),\n references: z.number().int().min(0),\n domain_profiles: z.number().int().min(0),\n custom_entries: z.number().int().min(0),\n});\n\nexport const KnowledgeManifestEntrySchema = z.object({\n id: z.string().min(1),\n file: z.string().min(1),\n type: z.string().min(1),\n priority: z.enum(['high', 'medium', 'low']),\n tags: z.array(z.string()),\n domains: z.array(z.string()),\n});\n\nexport const LoadingStrategySchema = z.object({\n always: z.array(z.string()),\n by_domain: z.record(z.string(), z.array(z.string())),\n by_tag: z.record(z.string(), z.array(z.string())),\n});\n\nexport const KnowledgeManifestSchema = z.object({\n version: z.string().min(1),\n last_updated: z.string().min(1),\n active_releases: z.array(z.string()).min(1),\n stats: KnowledgeManifestStatsSchema,\n loading_strategy: LoadingStrategySchema,\n entries: z.array(KnowledgeManifestEntrySchema).min(1),\n});\n\nexport type KnowledgeManifestInput = z.input<typeof KnowledgeManifestSchema>;\n","import { z } from 'zod';\n\nexport const JourneySchema = z.object({\n id: z.string().min(1),\n name: z.string().min(1),\n description: z.string().min(1),\n steps: z.array(z.string()).min(1),\n risk: z.enum(['high', 'medium', 'low']),\n});\n\nexport const DomainConfigSchema = z.object({\n id: z.string().min(1),\n name: z.string().min(1),\n risk_ranking: z.array(z.string()).min(1),\n completeness_checklist: z.array(z.string()).min(1),\n data_integrity_checks: z.array(z.string()).min(1),\n journeys: z.array(JourneySchema).min(1),\n guidance: z.array(z.string()).min(1),\n});\n\nexport type DomainConfigInput = z.input<typeof DomainConfigSchema>;\n","import { z } from 'zod';\n\nexport const SeverityCountsSchema = z.object({\n critical: z.number().int().min(0),\n high: z.number().int().min(0),\n medium: z.number().int().min(0),\n low: z.number().int().min(0),\n});\n\nexport const SessionMetricsSchema = z.object({\n session_id: z.string().min(1),\n target: z.string().min(1),\n date: z.string().min(1),\n duration_min: z.number().min(0),\n bugs_found: z.number().int().min(0),\n severity_counts: SeverityCountsSchema,\n pages_explored: z.number().int().min(0),\n});\n\nexport type SessionMetricsInput = z.input<typeof SessionMetricsSchema>;\n","/**\n * Credential and secret redaction utility.\n * Patterns derived from data/security/SECURITY-POLICY.md.\n */\n\ninterface RedactionPattern {\n name: string;\n pattern: RegExp;\n replacement: string;\n}\n\nconst REDACTION_PATTERNS: RedactionPattern[] = [\n {\n name: 'JWT token',\n pattern: /Bearer\\s+eyJ[A-Za-z0-9\\-_]+\\.[A-Za-z0-9\\-_]+\\.[A-Za-z0-9\\-_]+/g,\n replacement: 'Bearer [JWT_REDACTED]',\n },\n {\n name: 'API key',\n pattern: /api[_\\-]?key[=:\\s]+[A-Za-z0-9\\-_]{16,}/gi,\n replacement: 'api_key=[API_KEY_REDACTED]',\n },\n {\n name: 'Password',\n pattern: /password[=:\\s]+[^\\s,}\"']+/gi,\n replacement: 'password=[REDACTED]',\n },\n {\n name: 'Token',\n pattern: /token[=:\\s]+[A-Za-z0-9\\-_]{16,}/gi,\n replacement: 'token=[TOKEN_REDACTED]',\n },\n {\n name: 'Secret',\n pattern: /secret[=:\\s]+[^\\s,}\"']+/gi,\n replacement: 'secret=[REDACTED]',\n },\n {\n name: 'SSN',\n pattern: /\\b\\d{3}-\\d{2}-\\d{4}\\b/g,\n replacement: '[SSN_REDACTED]',\n },\n {\n name: 'Credit card number',\n pattern: /\\b\\d{13,19}\\b/g,\n replacement: '[CARD_NUMBER_REDACTED]',\n },\n];\n\n/**\n * Redacts secrets from the given text.\n * Returns the redacted text and a list of which secret types were found.\n */\nexport function redact(text: string): { text: string; redactions: string[] } {\n const redactions: string[] = [];\n let result = text;\n\n for (const { name, pattern, replacement } of REDACTION_PATTERNS) {\n // Reset lastIndex for global regex\n pattern.lastIndex = 0;\n if (pattern.test(result)) {\n redactions.push(name);\n pattern.lastIndex = 0;\n result = result.replace(pattern, replacement);\n }\n }\n\n return { text: result, redactions };\n}\n\n/**\n * Checks whether the text contains any detectable secrets.\n */\nexport function containsSecrets(text: string): boolean {\n for (const { pattern } of REDACTION_PATTERNS) {\n pattern.lastIndex = 0;\n if (pattern.test(text)) {\n return true;\n }\n }\n return false;\n}\n","import { readFileSync } from 'node:fs';\nimport { resolve, join } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\nimport { ZodError, type ZodSchema } from 'zod';\nimport { TargetConfigSchema } from '../schemas/target.schema.js';\nimport { KnowledgeEntrySchema } from '../schemas/knowledge-entry.schema.js';\nimport { DomainConfigSchema } from '../schemas/domain-config.schema.js';\nimport type { ValidationResult } from '../types/index.js';\nimport { globSync } from 'glob';\n\nfunction validateYamlFile(\n filePath: string,\n schema: ZodSchema,\n): ValidationResult {\n const absPath = resolve(filePath);\n try {\n const raw = readFileSync(absPath, 'utf-8');\n const data = parseYaml(raw);\n schema.parse(data);\n return { file: absPath, valid: true };\n } catch (err) {\n if (err instanceof ZodError) {\n return {\n file: absPath,\n valid: false,\n errors: err.issues.map((issue) => ({\n path: issue.path.join('.'),\n message: issue.message,\n })),\n };\n }\n return {\n file: absPath,\n valid: false,\n errors: [\n {\n path: '',\n message:\n err instanceof Error ? err.message : 'Unknown parsing error',\n },\n ],\n };\n }\n}\n\nexport function validateTargetConfig(filePath: string): ValidationResult {\n return validateYamlFile(filePath, TargetConfigSchema);\n}\n\nexport function validateKnowledgeEntry(filePath: string): ValidationResult {\n return validateYamlFile(filePath, KnowledgeEntrySchema);\n}\n\nexport function validateDomainConfig(filePath: string): ValidationResult {\n return validateYamlFile(filePath, DomainConfigSchema);\n}\n\nexport function validateAllConfigs(dataDir: string): ValidationResult[] {\n const results: ValidationResult[] = [];\n const absDir = resolve(dataDir);\n\n // Validate target configs\n const targetFiles = globSync(join(absDir, 'targets', '*.yml'));\n for (const file of targetFiles) {\n results.push(validateTargetConfig(file));\n }\n\n // Validate knowledge entries\n const entryFiles = globSync(\n join(absDir, 'knowledge', 'releases', '**', 'entries', '*.yml'),\n );\n for (const file of entryFiles) {\n results.push(validateKnowledgeEntry(file));\n }\n\n return results;\n}\n","import { readFileSync, appendFileSync, existsSync, mkdirSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { SessionMetricsSchema } from '../schemas/session-metrics.schema.js';\nimport type { SessionMetrics } from '../types/index.js';\n\nconst METRICS_FILENAME = 'metrics.jsonl';\n\n/**\n * Appends a single session metrics record to the JSONL file.\n * Creates the output directory and file if they do not exist.\n */\nexport function appendSessionMetrics(\n outputDir: string,\n metrics: SessionMetrics,\n): void {\n // Validate before writing\n SessionMetricsSchema.parse(metrics);\n\n const filePath = join(outputDir, METRICS_FILENAME);\n const dir = dirname(filePath);\n\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n const line = JSON.stringify(metrics) + '\\n';\n appendFileSync(filePath, line, 'utf-8');\n}\n\n/**\n * Reads all session metrics from the JSONL file.\n * Returns an empty array if the file does not exist or is empty.\n */\nexport function readAllMetrics(outputDir: string): SessionMetrics[] {\n const filePath = join(outputDir, METRICS_FILENAME);\n\n if (!existsSync(filePath)) {\n return [];\n }\n\n const content = readFileSync(filePath, 'utf-8').trim();\n if (!content) {\n return [];\n }\n\n const lines = content.split('\\n');\n const results: SessionMetrics[] = [];\n\n for (const line of lines) {\n if (line.trim()) {\n const parsed = JSON.parse(line);\n results.push(SessionMetricsSchema.parse(parsed));\n }\n }\n\n return results;\n}\n","/**\n * Session and bug report parser.\n * Reads a session directory and extracts structured data\n * from markdown files produced during exploratory testing.\n */\n\nimport { readFileSync, readdirSync, existsSync } from 'node:fs';\nimport { join, basename } from 'node:path';\n\n// ─── Types ──────────────────────────────────────────────────────────\n\nexport interface ParsedBug {\n id: string;\n title: string;\n severity: 'critical' | 'high' | 'medium' | 'low';\n component: string;\n url: string;\n expected: string;\n actual: string;\n steps: string[];\n business_impact: string;\n evidence: { screenshots: string[]; console_errors: string[] };\n}\n\nexport interface ParsedSession {\n id: string;\n charter?: string;\n bugs: ParsedBug[];\n report?: string;\n phases: { name: string; content: string }[];\n}\n\n// ─── Severity helpers ───────────────────────────────────────────────\n\nconst SEVERITY_ORDER: Record<string, number> = {\n critical: 0,\n high: 1,\n medium: 2,\n low: 3,\n};\n\nfunction normalizeSeverity(raw: string): ParsedBug['severity'] {\n const lower = raw.toLowerCase().trim();\n if (lower === 'critical' || lower === 'high' || lower === 'medium' || lower === 'low') {\n return lower;\n }\n // Handle variants like \"High (aggregate)\"\n if (lower.startsWith('critical')) return 'critical';\n if (lower.startsWith('high')) return 'high';\n if (lower.startsWith('medium')) return 'medium';\n if (lower.startsWith('low')) return 'low';\n return 'medium';\n}\n\n// ─── Section extraction ─────────────────────────────────────────────\n\n/**\n * Extracts the content under a markdown heading that starts with the\n * given prefix. Searches for both ## and ### level headings.\n */\nfunction extractSection(content: string, headingPrefix: string): string {\n const lines = content.split('\\n');\n let capturing = false;\n let capturedLevel = 0;\n const captured: string[] = [];\n\n for (const line of lines) {\n const headingMatch = line.match(/^(#{1,6})\\s+(.*)$/);\n\n if (headingMatch) {\n const level = headingMatch[1].length;\n const text = headingMatch[2].trim();\n\n if (text.toLowerCase().startsWith(headingPrefix.toLowerCase())) {\n capturing = true;\n capturedLevel = level;\n continue;\n }\n\n // Stop if we hit a heading at the same or higher level\n if (capturing && level <= capturedLevel) {\n break;\n }\n }\n\n if (capturing) {\n captured.push(line);\n }\n }\n\n return captured.join('\\n').trim();\n}\n\n/**\n * Extracts numbered list items from markdown text.\n * Handles lines like \"1. Navigate to ...\" and continuation lines.\n */\nfunction extractNumberedList(text: string): string[] {\n const steps: string[] = [];\n const lines = text.split('\\n');\n\n for (const line of lines) {\n const match = line.match(/^\\d+\\.\\s+(.+)$/);\n if (match) {\n steps.push(match[1].trim());\n }\n }\n\n return steps;\n}\n\n/**\n * Extracts screenshots and console errors from the evidence section.\n */\nfunction extractEvidence(content: string): { screenshots: string[]; console_errors: string[] } {\n const screenshots: string[] = [];\n const console_errors: string[] = [];\n\n const evidenceText = extractSection(content, 'Evidence');\n if (!evidenceText) {\n return { screenshots, console_errors };\n }\n\n for (const line of evidenceText.split('\\n')) {\n const trimmed = line.replace(/^[-*]\\s*/, '').trim();\n\n if (/screenshot/i.test(trimmed)) {\n // Extract path if present\n const pathMatch = trimmed.match(/:\\s*(.+)/);\n if (pathMatch) {\n screenshots.push(pathMatch[1].trim());\n }\n }\n\n if (/console\\s*(error|log)/i.test(trimmed)) {\n const msgMatch = trimmed.match(/:\\s*(.+)/);\n if (msgMatch && !/none/i.test(msgMatch[1])) {\n console_errors.push(msgMatch[1].trim());\n }\n }\n }\n\n return { screenshots, console_errors };\n}\n\n// ─── Public API ─────────────────────────────────────────────────────\n\n/**\n * Parses a single bug report markdown file into structured data.\n */\nexport async function parseBugReport(filePath: string): Promise<ParsedBug> {\n const content = readFileSync(filePath, 'utf-8');\n const filename = basename(filePath, '.md');\n\n // Extract ID from filename (e.g. BUG-R2-001, BUG-001)\n const id = filename;\n\n // Extract title from first heading: \"# BUG-R2-001: Title here\" or \"## [Component] Title\"\n let title = '';\n let component = '';\n\n const titleMatch = content.match(/^#\\s+(?:BUG[-\\w]*:\\s*)?(.+)$/m)\n ?? content.match(/^##\\s+(?:BUG[-\\w]*:\\s*)?(.+)$/m);\n\n if (titleMatch) {\n title = titleMatch[1].trim();\n }\n\n // Extract component from title — patterns: \"[Login]\", \"[Login Form]\"\n const componentMatch = title.match(/^\\[([^\\]]+)\\]\\s*/);\n if (componentMatch) {\n component = componentMatch[1];\n title = title.replace(/^\\[[^\\]]+\\]\\s*/, '').trim();\n }\n\n // If no bracketed component, try to extract from the title before \"fails\" or first word\n if (!component) {\n // Use the section before the first dash or the bug category from the report\n const categoryMatch = content.match(/\\|\\s*Category\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (categoryMatch) {\n component = categoryMatch[1].trim();\n }\n }\n\n // Extract severity: \"## Severity: High\" or \"**Severity:** High\"\n let severity: ParsedBug['severity'] = 'medium';\n const severityMatch = content.match(/\\*\\*Severity:\\*\\*\\s*(.+)/i)\n ?? content.match(/^##\\s+Severity:\\s*(.+)/mi);\n if (severityMatch) {\n severity = normalizeSeverity(severityMatch[1]);\n }\n\n // Extract URL\n let url = '';\n const urlMatch = content.match(/\\*\\*URL:\\*\\*\\s*(.+)/i)\n ?? content.match(/URL:\\s*(https?:\\/\\/[^\\s]+)/i);\n if (urlMatch) {\n url = urlMatch[1].trim();\n }\n\n // Extract expected behavior\n const expected = extractSection(content, 'Expected')\n .replace(/^_.*_\\n?/, '')\n .replace(/^>\\s*/gm, '')\n .trim();\n\n // Extract actual behavior\n const actual = extractSection(content, 'Actual')\n .replace(/^_.*_\\n?/, '')\n .replace(/^>\\s*/gm, '')\n .trim();\n\n // Extract steps\n const stepsSection = extractSection(content, 'Steps to Reproduce');\n const steps = extractNumberedList(stepsSection);\n\n // Extract business impact\n const business_impact = extractSection(content, 'Business Impact');\n\n // Extract evidence\n const evidence = extractEvidence(content);\n\n return {\n id,\n title,\n severity,\n component,\n url,\n expected,\n actual,\n steps,\n business_impact,\n evidence,\n };\n}\n\n/**\n * Parses an entire session directory into structured data.\n * Reads the session report, charter, phase files, and all bug reports.\n */\nexport async function parseSession(sessionDir: string): Promise<ParsedSession> {\n const id = basename(sessionDir);\n\n // Read charter if present\n let charter: string | undefined;\n const charterPath = join(sessionDir, 'charter.md');\n if (existsSync(charterPath)) {\n charter = readFileSync(charterPath, 'utf-8');\n }\n\n // Read session report if present\n let report: string | undefined;\n const reportPath = join(sessionDir, 'session-report.md');\n if (existsSync(reportPath)) {\n report = readFileSync(reportPath, 'utf-8');\n }\n\n // Read phase files\n const phases: { name: string; content: string }[] = [];\n if (existsSync(sessionDir)) {\n const files = readdirSync(sessionDir);\n const phaseFiles = files.filter((f) => /^phase-\\d+/i.test(f)).sort();\n for (const file of phaseFiles) {\n const content = readFileSync(join(sessionDir, file), 'utf-8');\n const name = file.replace(/\\.md$/, '');\n phases.push({ name, content });\n }\n }\n\n // Read and parse bug reports\n const bugsDir = join(sessionDir, 'bugs');\n const bugs: ParsedBug[] = [];\n\n if (existsSync(bugsDir)) {\n const bugFiles = readdirSync(bugsDir)\n .filter((f) => /^BUG-.*\\.md$/i.test(f))\n .sort();\n\n for (const file of bugFiles) {\n const bug = await parseBugReport(join(bugsDir, file));\n bugs.push(bug);\n }\n }\n\n // Sort bugs by severity\n bugs.sort((a, b) => SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity]);\n\n return {\n id,\n charter,\n bugs,\n report,\n phases,\n };\n}\n","/**\n * HTML report generator.\n * Produces a standalone dark-mode HTML report from session data.\n * The template is inline to simplify distribution.\n */\n\nimport Handlebars from 'handlebars';\nimport { parseSession } from '../utils/parse-session.js';\n\n// ─── Report metadata extraction ─────────────────────────────────────\n\ninterface ReportMeta {\n target: string;\n date: string;\n duration: string;\n sessionId: string;\n summary: string;\n}\n\nfunction extractReportMeta(report: string, sessionId: string): ReportMeta {\n const meta: ReportMeta = {\n target: sessionId,\n date: '',\n duration: '',\n sessionId,\n summary: '',\n };\n\n // Extract from session report metadata\n const dateMatch = report.match(/\\*\\*Date:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\|\\s*Date\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (dateMatch) meta.date = dateMatch[1].trim();\n\n const durationMatch = report.match(/\\*\\*Duration:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\|\\s*Duration\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (durationMatch) meta.duration = durationMatch[1].trim();\n\n const targetMatch = report.match(/\\*\\*Application:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\*\\*Target:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\|\\s*Target\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (targetMatch) meta.target = targetMatch[1].trim();\n\n // Extract executive summary\n const summaryMatch = report.match(/##\\s+Executive Summary\\s*\\n+([\\s\\S]*?)(?=\\n##\\s|\\n---)/i);\n if (summaryMatch) meta.summary = summaryMatch[1].trim();\n\n return meta;\n}\n\n// ─── Coverage extraction ────────────────────────────────────────────\n\ninterface CoverageEntry {\n area: string;\n status: string;\n bugsFound: string;\n notes: string;\n}\n\nfunction extractCoverage(report: string): CoverageEntry[] {\n const entries: CoverageEntry[] = [];\n\n // Look for coverage map table rows\n const tableMatch = report.match(\n /\\|\\s*Area\\s*\\|\\s*Status\\s*\\|[\\s\\S]*?\\n((?:\\|.+\\|.+\\n?)+)/i,\n );\n if (!tableMatch) return entries;\n\n const rows = tableMatch[1].split('\\n').filter((r) => r.trim().startsWith('|'));\n for (const row of rows) {\n const cells = row.split('|').map((c) => c.trim()).filter(Boolean);\n if (cells.length >= 2 && !cells[0].startsWith('---')) {\n entries.push({\n area: cells[0] || '',\n status: cells[1] || '',\n bugsFound: cells[3] || '0',\n notes: cells[4] || '',\n });\n }\n }\n\n return entries;\n}\n\n// ─── Observations and recommendations ───────────────────────────────\n\nfunction extractListSection(report: string, heading: string): string[] {\n const items: string[] = [];\n const regex = new RegExp(`##\\\\s+${heading}\\\\s*\\\\n+([\\\\s\\\\S]*?)(?=\\\\n##\\\\s|\\\\n---|$)`, 'i');\n const match = report.match(regex);\n if (!match) return items;\n\n for (const line of match[1].split('\\n')) {\n const itemMatch = line.match(/^[-*]\\s+(?:\\[.\\]\\s+)?(.+)/);\n if (itemMatch) {\n items.push(itemMatch[1].trim());\n }\n // Also capture numbered items under sub-headings\n const numberedMatch = line.match(/^\\d+\\.\\s+\\*\\*(.+?)\\*\\*\\s*(.+)?/);\n if (numberedMatch) {\n const text = numberedMatch[2]\n ? `${numberedMatch[1]} ${numberedMatch[2]}`\n : numberedMatch[1];\n items.push(text.replace(/\\s*--\\s*/, ' -- '));\n }\n }\n\n return items;\n}\n\n// ─── Handlebars template ────────────────────────────────────────────\n\nconst HTML_TEMPLATE = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Qualiow Report — {{meta.target}}</title>\n <style>\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n\n body {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n background: #0a0f1a;\n color: #e0e6ed;\n line-height: 1.6;\n padding: 2rem;\n }\n\n a { color: #3498db; text-decoration: none; }\n a:hover { text-decoration: underline; }\n\n .container { max-width: 960px; margin: 0 auto; }\n\n /* Header */\n .header {\n border-bottom: 2px solid #1e2a3a;\n padding-bottom: 1.5rem;\n margin-bottom: 2rem;\n }\n .header h1 {\n font-size: 1.75rem;\n font-weight: 700;\n color: #ffffff;\n margin-bottom: 0.25rem;\n }\n .header .meta {\n display: flex;\n flex-wrap: wrap;\n gap: 1.5rem;\n font-size: 0.9rem;\n color: #8899aa;\n margin-top: 0.5rem;\n }\n .header .meta span { white-space: nowrap; }\n\n /* Stats cards */\n .stats {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));\n gap: 1rem;\n margin-bottom: 2rem;\n }\n .stat-card {\n background: #111927;\n border-radius: 8px;\n padding: 1rem 1.25rem;\n text-align: center;\n }\n .stat-card .number {\n font-size: 2rem;\n font-weight: 700;\n display: block;\n }\n .stat-card .label {\n font-size: 0.8rem;\n color: #8899aa;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n }\n .stat-total .number { color: #e0e6ed; }\n .stat-critical .number { color: #ff4757; }\n .stat-high .number { color: #ffa502; }\n .stat-medium .number { color: #ffd32a; }\n .stat-low .number { color: #3498db; }\n\n /* Summary */\n .summary {\n background: #111927;\n border-radius: 8px;\n padding: 1.25rem 1.5rem;\n margin-bottom: 2rem;\n font-size: 0.95rem;\n color: #c0c8d0;\n }\n\n /* Section headings */\n .section-title {\n font-size: 1.25rem;\n font-weight: 600;\n color: #ffffff;\n margin: 2rem 0 1rem;\n padding-bottom: 0.5rem;\n border-bottom: 1px solid #1e2a3a;\n }\n\n /* Bug cards */\n .bug-card {\n background: #111927;\n border-radius: 8px;\n border-left: 4px solid #3498db;\n padding: 1.25rem 1.5rem;\n margin-bottom: 1rem;\n }\n .bug-card.severity-critical { border-left-color: #ff4757; }\n .bug-card.severity-high { border-left-color: #ffa502; }\n .bug-card.severity-medium { border-left-color: #ffd32a; }\n .bug-card.severity-low { border-left-color: #3498db; }\n\n .bug-card .bug-header {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-bottom: 0.75rem;\n }\n .bug-card .bug-title {\n font-size: 1rem;\n font-weight: 600;\n color: #ffffff;\n flex: 1;\n min-width: 200px;\n }\n\n .badge {\n display: inline-block;\n font-size: 0.7rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n padding: 0.2rem 0.5rem;\n border-radius: 4px;\n white-space: nowrap;\n }\n .badge-critical { background: #ff475733; color: #ff4757; }\n .badge-high { background: #ffa50233; color: #ffa502; }\n .badge-medium { background: #ffd32a33; color: #ffd32a; }\n .badge-low { background: #3498db33; color: #3498db; }\n .badge-component { background: #1e2a3a; color: #8899aa; }\n\n .bug-section-label {\n font-size: 0.8rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: #8899aa;\n margin: 0.75rem 0 0.25rem;\n }\n\n .bug-card p,\n .bug-card li {\n font-size: 0.9rem;\n color: #c0c8d0;\n }\n\n .bug-card ol {\n padding-left: 1.25rem;\n margin: 0.25rem 0;\n }\n .bug-card ol li {\n margin-bottom: 0.15rem;\n }\n\n .bug-card .evidence-item {\n font-size: 0.85rem;\n color: #8899aa;\n }\n\n /* Coverage table */\n table {\n width: 100%;\n border-collapse: collapse;\n margin-bottom: 1rem;\n font-size: 0.9rem;\n }\n th, td {\n text-align: left;\n padding: 0.5rem 0.75rem;\n border-bottom: 1px solid #1e2a3a;\n }\n th {\n font-size: 0.8rem;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: #8899aa;\n font-weight: 600;\n }\n td { color: #c0c8d0; }\n\n /* Lists */\n .list-section ul {\n list-style: disc;\n padding-left: 1.25rem;\n }\n .list-section li {\n font-size: 0.9rem;\n color: #c0c8d0;\n margin-bottom: 0.35rem;\n }\n\n /* Footer */\n .footer {\n margin-top: 3rem;\n padding-top: 1.5rem;\n border-top: 1px solid #1e2a3a;\n text-align: center;\n font-size: 0.8rem;\n color: #556677;\n }\n\n /* Print styles */\n @media print {\n body {\n background: #ffffff;\n color: #1a1a1a;\n padding: 1rem;\n }\n .stat-card, .bug-card, .summary {\n background: #f5f5f5;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n .stat-total .number { color: #1a1a1a; }\n .stat-critical .number { color: #cc0000; }\n .stat-high .number { color: #cc7700; }\n .stat-medium .number { color: #cc9900; }\n .stat-low .number { color: #2266aa; }\n .bug-card .bug-title { color: #1a1a1a; }\n th { color: #555555; }\n td, .bug-card p, .bug-card li, .list-section li { color: #333333; }\n .bug-section-label { color: #555555; }\n .footer { color: #999999; }\n }\n\n /* Responsive */\n @media (max-width: 600px) {\n body { padding: 1rem; }\n .header h1 { font-size: 1.35rem; }\n .stats { grid-template-columns: repeat(2, 1fr); }\n .bug-card .bug-header { flex-direction: column; align-items: flex-start; }\n }\n </style>\n</head>\n<body>\n <div class=\"container\">\n\n <div class=\"header\">\n <h1>Exploratory Testing Report</h1>\n <div class=\"meta\">\n <span>Target: <strong>{{meta.target}}</strong></span>\n {{#if meta.date}}<span>Date: <strong>{{meta.date}}</strong></span>{{/if}}\n {{#if meta.duration}}<span>Duration: <strong>{{meta.duration}}</strong></span>{{/if}}\n <span>Session: <strong>{{meta.sessionId}}</strong></span>\n </div>\n </div>\n\n <div class=\"stats\">\n <div class=\"stat-card stat-total\">\n <span class=\"number\">{{totalBugs}}</span>\n <span class=\"label\">Total Bugs</span>\n </div>\n <div class=\"stat-card stat-critical\">\n <span class=\"number\">{{criticalCount}}</span>\n <span class=\"label\">Critical</span>\n </div>\n <div class=\"stat-card stat-high\">\n <span class=\"number\">{{highCount}}</span>\n <span class=\"label\">High</span>\n </div>\n <div class=\"stat-card stat-medium\">\n <span class=\"number\">{{mediumCount}}</span>\n <span class=\"label\">Medium</span>\n </div>\n <div class=\"stat-card stat-low\">\n <span class=\"number\">{{lowCount}}</span>\n <span class=\"label\">Low</span>\n </div>\n </div>\n\n {{#if meta.summary}}\n <div class=\"summary\">{{meta.summary}}</div>\n {{/if}}\n\n <h2 class=\"section-title\">Bugs Found</h2>\n\n {{#each bugs}}\n <div class=\"bug-card severity-{{this.severity}}\">\n <div class=\"bug-header\">\n <span class=\"bug-title\">{{this.id}}: {{this.title}}</span>\n <span class=\"badge badge-{{this.severity}}\">{{this.severity}}</span>\n {{#if this.component}}<span class=\"badge badge-component\">{{this.component}}</span>{{/if}}\n </div>\n\n {{#if this.business_impact}}\n <div class=\"bug-section-label\">Business Impact</div>\n <p>{{this.business_impact_summary}}</p>\n {{/if}}\n\n {{#if this.steps.length}}\n <div class=\"bug-section-label\">Steps to Reproduce</div>\n <ol>\n {{#each this.steps}}\n <li>{{this}}</li>\n {{/each}}\n </ol>\n {{/if}}\n\n {{#if this.hasEvidence}}\n <div class=\"bug-section-label\">Evidence</div>\n {{#each this.evidence.screenshots}}\n <p class=\"evidence-item\">Screenshot: {{this}}</p>\n {{/each}}\n {{#each this.evidence.console_errors}}\n <p class=\"evidence-item\">Console: {{this}}</p>\n {{/each}}\n {{/if}}\n </div>\n {{/each}}\n\n {{#if coverage.length}}\n <h2 class=\"section-title\">Coverage Map</h2>\n <table>\n <thead>\n <tr>\n <th>Area</th>\n <th>Status</th>\n <th>Bugs</th>\n <th>Notes</th>\n </tr>\n </thead>\n <tbody>\n {{#each coverage}}\n <tr>\n <td>{{this.area}}</td>\n <td>{{this.status}}</td>\n <td>{{this.bugsFound}}</td>\n <td>{{this.notes}}</td>\n </tr>\n {{/each}}\n </tbody>\n </table>\n {{/if}}\n\n {{#if observations.length}}\n <h2 class=\"section-title\">Observations</h2>\n <div class=\"list-section\">\n <ul>\n {{#each observations}}\n <li>{{this}}</li>\n {{/each}}\n </ul>\n </div>\n {{/if}}\n\n {{#if recommendations.length}}\n <h2 class=\"section-title\">Recommendations</h2>\n <div class=\"list-section\">\n <ul>\n {{#each recommendations}}\n <li>{{this}}</li>\n {{/each}}\n </ul>\n </div>\n {{/if}}\n\n <div class=\"footer\">\n Generated by Qualiow Exploratory Testing\n </div>\n\n </div>\n</body>\n</html>`;\n\n// ─── Template compilation ───────────────────────────────────────────\n\nconst compiledTemplate = Handlebars.compile(HTML_TEMPLATE);\n\n// ─── Public API ─────────────────────────────────────────────────────\n\n/**\n * Generates a self-contained dark-mode HTML report from a session directory.\n */\nexport async function generateHtmlReport(sessionDir: string): Promise<string> {\n const session = await parseSession(sessionDir);\n\n const report = session.report ?? '';\n const meta = extractReportMeta(report, session.id);\n const coverage = extractCoverage(report);\n const observations = extractListSection(report, 'Observations');\n const recommendations = extractListSection(report, 'Recommendations');\n\n // Count severities\n const counts = { critical: 0, high: 0, medium: 0, low: 0 };\n for (const bug of session.bugs) {\n counts[bug.severity]++;\n }\n\n // Prepare bug data for the template\n const bugsForTemplate = session.bugs.map((bug) => ({\n ...bug,\n business_impact_summary: summarizeBusinessImpact(bug.business_impact),\n hasEvidence:\n bug.evidence.screenshots.length > 0 ||\n bug.evidence.console_errors.length > 0,\n }));\n\n const html = compiledTemplate({\n meta,\n totalBugs: session.bugs.length,\n criticalCount: counts.critical,\n highCount: counts.high,\n mediumCount: counts.medium,\n lowCount: counts.low,\n bugs: bugsForTemplate,\n coverage,\n observations,\n recommendations,\n });\n\n return html;\n}\n\n/**\n * Extracts a one-line summary from the business impact section.\n * Takes the first meaningful line or sentence.\n */\nfunction summarizeBusinessImpact(impact: string): string {\n if (!impact) return '';\n\n const lines = impact.split('\\n').filter((l) => l.trim());\n const summaryLines: string[] = [];\n\n for (const line of lines) {\n const cleaned = line\n .replace(/^[-*]\\s*/, '')\n .replace(/^\\*\\*[^*]+\\*\\*\\s*/, '')\n .trim();\n if (cleaned) {\n summaryLines.push(cleaned);\n }\n }\n\n // Return first 2-3 meaningful points joined\n return summaryLines.slice(0, 3).join(' ');\n}\n","/**\n * JSON report generator.\n * Produces structured JSON from session data for programmatic consumption.\n */\n\nimport { parseSession } from '../utils/parse-session.js';\n\n// ─── Report metadata extraction ─────────────────────────────────────\n\nfunction extractTarget(report: string, sessionId: string): string {\n const match = report.match(/\\*\\*Application:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\*\\*Target:\\*\\*\\s*(.+)/i)\n ?? report.match(/\\|\\s*Target\\s*\\|\\s*(.+?)\\s*\\|/i);\n if (match) return match[1].trim();\n\n // Fallback: extract from session ID (e.g. \"2026-03-28-r2-parabank\" -> \"parabank\")\n const parts = sessionId.split('-');\n return parts[parts.length - 1] || sessionId;\n}\n\nfunction extractDate(report: string): string {\n const match = report.match(/\\*\\*Date:\\*\\*\\s*(\\d{4}-\\d{2}-\\d{2})/i)\n ?? report.match(/\\|\\s*Date\\s*\\|\\s*(\\d{4}-\\d{2}-\\d{2})\\s*\\|/i);\n return match ? match[1] : '';\n}\n\nfunction extractDuration(report: string): number {\n const match = report.match(/\\*\\*Duration:\\*\\*\\s*~?(\\d+)\\s*min/i)\n ?? report.match(/\\|\\s*Duration\\s*\\|\\s*~?(\\d+)\\s*min/i);\n return match ? parseInt(match[1], 10) : 0;\n}\n\nfunction extractPagesExplored(report: string): number {\n const match = report.match(/Pages\\s+Explored\\s*\\|\\s*(\\d+)/i);\n return match ? parseInt(match[1], 10) : 0;\n}\n\n// ─── Coverage extraction ────────────────────────────────────────────\n\ninterface CoverageEntry {\n area: string;\n status: string;\n bugs_found: number;\n notes: string;\n}\n\nfunction extractCoverage(report: string): CoverageEntry[] {\n const entries: CoverageEntry[] = [];\n const tableMatch = report.match(\n /\\|\\s*Area\\s*\\|\\s*Status\\s*\\|[\\s\\S]*?\\n((?:\\|.+\\|.+\\n?)+)/i,\n );\n if (!tableMatch) return entries;\n\n const rows = tableMatch[1].split('\\n').filter((r) => r.trim().startsWith('|'));\n for (const row of rows) {\n const cells = row.split('|').map((c) => c.trim()).filter(Boolean);\n if (cells.length >= 2 && !cells[0].startsWith('---')) {\n entries.push({\n area: cells[0] || '',\n status: cells[1] || '',\n bugs_found: parseInt(cells[3] || '0', 10) || 0,\n notes: cells[4] || '',\n });\n }\n }\n return entries;\n}\n\n// ─── List extraction ────────────────────────────────────────────────\n\nfunction extractListSection(report: string, heading: string): string[] {\n const items: string[] = [];\n const regex = new RegExp(`##\\\\s+${heading}\\\\s*\\\\n+([\\\\s\\\\S]*?)(?=\\\\n##\\\\s|\\\\n---|$)`, 'i');\n const match = report.match(regex);\n if (!match) return items;\n\n for (const line of match[1].split('\\n')) {\n const itemMatch = line.match(/^[-*]\\s+(?:\\[.\\]\\s+)?(.+)/);\n if (itemMatch) {\n items.push(itemMatch[1].trim());\n }\n const numberedMatch = line.match(/^\\d+\\.\\s+\\*\\*(.+?)\\*\\*\\s*(.+)?/);\n if (numberedMatch) {\n const text = numberedMatch[2]\n ? `${numberedMatch[1]} ${numberedMatch[2]}`\n : numberedMatch[1];\n items.push(text.replace(/\\s*--\\s*/, ' -- '));\n }\n }\n return items;\n}\n\n// ─── Public API ─────────────────────────────────────────────────────\n\n/**\n * Generates a structured JSON report from a session directory.\n */\nexport async function generateJsonReport(sessionDir: string): Promise<object> {\n const session = await parseSession(sessionDir);\n const report = session.report ?? '';\n\n const target = extractTarget(report, session.id);\n const date = extractDate(report);\n const duration_min = extractDuration(report);\n const pages_explored = extractPagesExplored(report);\n\n const counts = { critical: 0, high: 0, medium: 0, low: 0 };\n for (const bug of session.bugs) {\n counts[bug.severity]++;\n }\n\n const coverage = extractCoverage(report);\n const observations = extractListSection(report, 'Observations');\n const recommendations = extractListSection(report, 'Recommendations');\n\n return {\n session: {\n id: session.id,\n target,\n date,\n duration_min,\n },\n summary: {\n total_bugs: session.bugs.length,\n critical: counts.critical,\n high: counts.high,\n medium: counts.medium,\n low: counts.low,\n pages_explored,\n },\n bugs: session.bugs.map((bug) => ({\n id: bug.id,\n title: bug.title,\n severity: bug.severity,\n component: bug.component,\n url: bug.url,\n business_impact: bug.business_impact,\n steps: bug.steps,\n evidence: bug.evidence,\n })),\n coverage,\n observations,\n recommendations,\n };\n}\n","/**\n * Jira CSV export generator.\n * Produces a CSV file importable via Jira bulk import.\n */\n\nimport { parseSession } from '../utils/parse-session.js';\nimport type { ParsedBug } from '../utils/parse-session.js';\n\n// ─── Severity to Jira priority mapping ──────────────────────────────\n\nconst SEVERITY_TO_JIRA_PRIORITY: Record<string, string> = {\n critical: 'Blocker',\n high: 'Critical',\n medium: 'Major',\n low: 'Minor',\n};\n\n// ─── CSV escaping ───────────────────────────────────────────────────\n\n/**\n * Escapes a value for inclusion in a CSV field.\n * Wraps in double quotes and escapes internal double quotes.\n */\nfunction csvEscape(value: string): string {\n if (!value) return '\"\"';\n // Always quote to avoid issues with commas, newlines, quotes\n const escaped = value.replace(/\"/g, '\"\"');\n return `\"${escaped}\"`;\n}\n\n// ─── Description formatting ─────────────────────────────────────────\n\nfunction formatDescription(bug: ParsedBug): string {\n const parts: string[] = [];\n\n if (bug.steps.length > 0) {\n parts.push('h3. Steps to Reproduce');\n for (const step of bug.steps) {\n parts.push(`# ${step}`);\n }\n parts.push('');\n }\n\n if (bug.expected) {\n parts.push(`h3. Expected Behavior`);\n parts.push(bug.expected);\n parts.push('');\n }\n\n if (bug.actual) {\n parts.push(`h3. Actual Behavior`);\n parts.push(bug.actual);\n parts.push('');\n }\n\n if (bug.business_impact) {\n parts.push('h3. Business Impact');\n parts.push(bug.business_impact);\n parts.push('');\n }\n\n if (bug.url) {\n parts.push(`h3. URL`);\n parts.push(bug.url);\n }\n\n return parts.join('\\n');\n}\n\n// ─── Domain extraction ──────────────────────────────────────────────\n\nfunction extractDomain(sessionId: string): string {\n // Attempt to extract domain from session ID (e.g. \"2026-03-28-r2-parabank\" -> \"fintech\")\n // Fallback to \"general\" since we cannot reliably determine domain from session ID alone\n return 'general';\n}\n\n// ─── Public API ─────────────────────────────────────────────────────\n\n/**\n * Generates a CSV string importable by Jira bulk import from a session directory.\n *\n * CSV columns:\n * - Summary: bug title\n * - Priority: mapped from severity\n * - Description: steps + business impact formatted in Jira wiki markup\n * - Component: from bug component field\n * - Labels: qualiow, exploratory-testing, domain\n */\nexport async function generateJiraExport(sessionDir: string): Promise<string> {\n const session = await parseSession(sessionDir);\n\n const headers = ['Summary', 'Priority', 'Description', 'Component', 'Labels'];\n const rows: string[] = [headers.join(',')];\n\n const domain = extractDomain(session.id);\n\n for (const bug of session.bugs) {\n const summary = `${bug.id}: ${bug.title}`;\n const priority = SEVERITY_TO_JIRA_PRIORITY[bug.severity] ?? 'Major';\n const description = formatDescription(bug);\n const component = bug.component || '';\n const labels = ['qualiow', 'exploratory-testing', domain]\n .filter(Boolean)\n .join(' ');\n\n rows.push(\n [\n csvEscape(summary),\n csvEscape(priority),\n csvEscape(description),\n csvEscape(component),\n csvEscape(labels),\n ].join(','),\n );\n }\n\n return rows.join('\\n');\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,mBAAmB,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAIvC,UAAU,EAAE,KAAK;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EACrC,aAAa,EACV,OAAO;AAAA,IACN,UAAU,EAAE,OAAO;AAAA,IACnB,UAAU,EAAE,OAAO;AAAA,EACrB,CAAC,EACA,SAAS;AAAA,EACZ,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,mBAAmB,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA,EAGvC,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,oBAAoB,EAAE,OAAO,EAAE,SAAS;AAC1C,CAAC;AAEM,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,UAAU,EAAE,QAAQ;AAAA,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M,KAAK,SAAS;AACpB,UAAM,KAAK,IAAI,GAAG;AAAA,EACpB;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;AAIA,SAAS,cAAc,WAA2B;AAGhD,SAAO;AACT;AAcA,eAAsB,mBAAmB,YAAqC;AAC5E,QAAM,UAAU,MAAM,aAAa,UAAU;AAE7C,QAAM,UAAU,CAAC,WAAW,YAAY,eAAe,aAAa,QAAQ;AAC5E,QAAM,OAAiB,CAAC,QAAQ,KAAK,GAAG,CAAC;AAEzC,QAAM,SAAS,cAAc,QAAQ,EAAE;AAEvC,aAAW,OAAO,QAAQ,MAAM;AAC9B,UAAM,UAAU,GAAG,IAAI,EAAE,KAAK,IAAI,KAAK;AACvC,UAAM,WAAW,0BAA0B,IAAI,QAAQ,KAAK;AAC5D,UAAM,cAAc,kBAAkB,GAAG;AACzC,UAAM,YAAY,IAAI,aAAa;AACnC,UAAM,SAAS,CAAC,WAAW,uBAAuB,MAAM,EACrD,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SAAK;AAAA,MACH;AAAA,QACE,UAAU,OAAO;AAAA,QACjB,UAAU,QAAQ;AAAA,QAClB,UAAU,WAAW;AAAA,QACrB,UAAU,SAAS;AAAA,QACnB,UAAU,MAAM;AAAA,MAClB,EAAE,KAAK,GAAG;AAAA,IACZ;AAAA,EACF;AAEA,SAAO,KAAK,KAAK,IAAI;AACvB;","names":["z","z","z","z","readFileSync","join","join","readFileSync","readFileSync","existsSync","join","extractCoverage","extractListSection"]}