qualiow-exploratory-testing 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +18 -0
- package/bin/qualiow +20 -1
- package/dist/cli/index.js +263 -47
- package/dist/index.d.ts +42 -1
- package/dist/index.js +58 -19
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"name": "qualiow",
|
|
13
13
|
"source": "./",
|
|
14
14
|
"description": "AI-driven exploratory testing for Claude Code: web (playwright-cli), iOS/Android simulators (Maestro via mobile-cli), and backend/API acceptance-criteria verification — with a versioned QA knowledge base.",
|
|
15
|
-
"version": "2.2.
|
|
15
|
+
"version": "2.2.1",
|
|
16
16
|
"category": "testing",
|
|
17
17
|
"keywords": [
|
|
18
18
|
"exploratory-testing",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qualiow",
|
|
3
3
|
"displayName": "Qualiow Exploratory Testing",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.1",
|
|
5
5
|
"description": "AI-driven exploratory testing for Claude Code: web (playwright-cli), iOS/Android simulators (Maestro via mobile-cli), and backend/API acceptance-criteria verification — with a versioned QA knowledge base.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "William Oliveira",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.2.1] - 2026-09-14
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **`qualiow session finalize` writes its rows in the layout the index file already has.** A project initialised before the `Kind` column existed has an `output/sessions/INDEX.md` whose header is `| Date | Target | Bugs | Duration | Status | Report |`. Finalize built every row from the current seven columns and appended it regardless, so the row was one cell wider than its own header and reading it back by column name shifted each value one column to the right — the report link fell off the end, and because the already-indexed check looks for the session directory in the report cell, `qualiow list sessions` then showed the session twice, once as a scrambled row and once as unindexed. The header is now read first: a canonical header behaves exactly as before, and a header that differs gets the row in its own column order, mapped by column name with unrepresented columns left empty. Existing rows are never widened or rewritten, and the older layout is reported on the command line rather than silently accommodated. The same rule covers `output/bugs/all-bugs.md`. `session archive --remove` locates the Status cell from the file's own header instead of assuming its position, and the `delete` / `prune` row counts are matched by reference rather than by column name, so both hold on either layout.
|
|
8
|
+
- **A session index split into blocks by blank lines no longer swallows rows.** Blank lines between the rows of `output/sessions/INDEX.md` — easy to leave behind when the file has been maintained by hand — split one markdown table into several one-row blocks, and a reader stops at the first blank line: the rows below it are on disk and invisible, so `list sessions` undercounts and a session that was just finalized reads back as unindexed. `finalize` now writes its row directly after the last row of the table instead of at end of file, which on a file whose table runs to the end is the same bytes as before, and reports what a reader cannot see (`○ INDEX.md has 3 row(s) outside the first table block (blank lines split it); readers see 2 of 5 — run \`qualiow session repair-index\``) with the counts taken from the file rather than estimated. The already-indexed check reads every block, so a split table cannot collect a second copy of a row. New **`qualiow session repair-index [--yes]`** closes the gap: a dry run by default reporting the blank lines between rows and the rows that would become visible, and with `--yes` it removes only the blank lines sitting strictly between two rows of the same table. Row text is never reflowed, re-aligned, re-ordered or rewritten — a row carrying a stray `|` survives byte for byte — and blank lines before the table, after it and between the title and the header stay where they are, as does a second table under its own heading. It covers `output/bugs/all-bugs.md` too, and a second run reports nothing to do.
|
|
9
|
+
- **Session directories named before the current scheme are visible to cleanup again.** `prune` and the unindexed scan in `list sessions` discovered directories through `SESSION_DIR_RE`, which only matches `<YYYY-MM-DD-HHmm>-<kind>-<slug>`, so output an upgraded project already had on disk (`2026-05-22-1045-demo-target`, `2026-07-09-quick-preprod-product-search`) could never be selected and was not even reported as present. `LEGACY_SESSION_DIR_RE` and `describeSessionDir` in `src/utils/session-dir.ts` now cover any date-prefixed name for DISCOVERY ONLY — reading the `HHmm` when the name carries one and treating it as local midnight when it does not, so ages compare — while `sessionDirName`, `parseSessionDirName` and every creation path keep their current strictness: nothing changes about how a new directory is named. `prune` marks the legacy names in its dry run, the listing marks them `unindexed (legacy)`, and a report cell written in the `[label](path)` link form now resolves to its session directory so an indexed legacy session is no longer counted as unindexed as well.
|
|
10
|
+
- **`bin/qualiow` explains an unbuilt checkout instead of failing through `npx`.** Run the
|
|
11
|
+
launcher with the working directory anywhere inside a copy of this repository that has no
|
|
12
|
+
`dist/` and no `node_modules` — a fresh clone, or the plugin directory itself — and npm
|
|
13
|
+
resolved the local project context, found a `package.json` named
|
|
14
|
+
`qualiow-exploratory-testing` with no linked bin, and exited with a bare
|
|
15
|
+
`sh: qualiow: command not found`. The launcher now detects that case and names the fix
|
|
16
|
+
(build once, or run from a project directory outside the tree). A plugin install invoked
|
|
17
|
+
from a user's project still takes the `npx` path unchanged; `tests/unit/shim.test.ts` covers
|
|
18
|
+
the local-build path, the guard and a nested directory. Root resolution moved to `pwd -P` so
|
|
19
|
+
the comparison holds through symlinked paths.
|
|
20
|
+
|
|
3
21
|
## [2.2.0] - 2026-09-14
|
|
4
22
|
|
|
5
23
|
The second half of the routing work 2.1.0 started. 2.1.0 gave the deterministic work to the CLI; this release gives the bounded reads and the report assembly to four cheap sub-agents, and adds two `PreToolUse` hooks that enforce the read thresholds instead of merely stating them. The judgement stays exactly where it was: severity, priority, business impact, the bug reports, the charter and risk ranking, what is missing, the AC verdicts, the executive summary and the reflection are still written by the session. The interaction phases are untouched — element refs and the observe-decide loop never leave the session. Additive: no skill, command, schema or library export was renamed or removed. Rationale, the routing procedure and the exclusions: `docs/ARCHITECTURE-DECISIONS.md` ADR-011.
|
package/bin/qualiow
CHANGED
|
@@ -16,12 +16,31 @@ while [ -L "$SELF" ]; do
|
|
|
16
16
|
LINK="$(readlink "$SELF")"
|
|
17
17
|
case "$LINK" in /*) SELF="$LINK" ;; *) SELF="$(dirname "$SELF")/$LINK" ;; esac
|
|
18
18
|
done
|
|
19
|
-
|
|
19
|
+
# `pwd -P` on both sides: the tmp/symlinked-path case must still compare equal.
|
|
20
|
+
ROOT="$(cd "$(dirname "$SELF")/.." && pwd -P)"
|
|
20
21
|
|
|
21
22
|
if [ -f "$ROOT/dist/cli/index.js" ] && [ -d "$ROOT/node_modules" ]; then
|
|
22
23
|
exec node "$ROOT/dist/cli/index.js" "$@"
|
|
23
24
|
fi
|
|
24
25
|
|
|
26
|
+
# No build here. If the working directory is inside this very tree, `npx` resolves
|
|
27
|
+
# the *local* project context first — it finds a package.json named
|
|
28
|
+
# qualiow-exploratory-testing with no linked bin and fails with a bare
|
|
29
|
+
# "sh: qualiow: command not found". Say what is actually wrong instead.
|
|
30
|
+
case "$(pwd -P)/" in
|
|
31
|
+
"$ROOT"/*)
|
|
32
|
+
cat >&2 <<MSG
|
|
33
|
+
qualiow: no CLI build in $ROOT (dist/ and node_modules are both missing), and the
|
|
34
|
+
working directory is inside that tree, so npx cannot resolve the published
|
|
35
|
+
package from here.
|
|
36
|
+
|
|
37
|
+
Build it once: cd "$ROOT" && npm install && npm run build
|
|
38
|
+
Or run from a project directory outside $ROOT.
|
|
39
|
+
MSG
|
|
40
|
+
exit 1
|
|
41
|
+
;;
|
|
42
|
+
esac
|
|
43
|
+
|
|
25
44
|
export CLAUDE_PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$ROOT}"
|
|
26
45
|
|
|
27
46
|
VER="$(node -p "try{require('$ROOT/.claude-plugin/plugin.json').version}catch{''}" 2>/dev/null || true)"
|
package/dist/cli/index.js
CHANGED
|
@@ -119,6 +119,22 @@ var ALL_BUGS_MD_HEADER = table(
|
|
|
119
119
|
"_Consolidated index across all exploratory testing sessions._",
|
|
120
120
|
ALL_BUGS_COLUMNS
|
|
121
121
|
);
|
|
122
|
+
function keysOf(columns) {
|
|
123
|
+
return columns.map((c) => c.trim().toLowerCase());
|
|
124
|
+
}
|
|
125
|
+
function headersMatchColumns(headers, columns) {
|
|
126
|
+
const a = keysOf(headers);
|
|
127
|
+
const b = keysOf(columns);
|
|
128
|
+
return a.length === b.length && a.every((h, i) => h === b[i]);
|
|
129
|
+
}
|
|
130
|
+
function missingColumns(headers, columns) {
|
|
131
|
+
const present = new Set(keysOf(headers));
|
|
132
|
+
return columns.filter((c) => !present.has(c.trim().toLowerCase()));
|
|
133
|
+
}
|
|
134
|
+
function buildTableRow(headers, values) {
|
|
135
|
+
const cells = keysOf(headers).map((key) => values[key] ?? "");
|
|
136
|
+
return `| ${cells.join(" | ")} |`;
|
|
137
|
+
}
|
|
122
138
|
|
|
123
139
|
// src/utils/gitignore.ts
|
|
124
140
|
var QUALIOW_GITIGNORE_HEADER = "# Qualiow";
|
|
@@ -1151,6 +1167,7 @@ function parseMarkdownTable(md, opts = {}) {
|
|
|
1151
1167
|
|
|
1152
1168
|
// src/utils/session-dir.ts
|
|
1153
1169
|
var SESSION_DIR_RE = /^(\d{4}-\d{2}-\d{2}-\d{4})-(explore|quick|mobile|backend)-([a-z0-9][a-z0-9-]*)$/;
|
|
1170
|
+
var LEGACY_SESSION_DIR_RE = /^\d{4}-\d{2}-\d{2}(?:-\d{4})?-.+/;
|
|
1154
1171
|
function slugify(input) {
|
|
1155
1172
|
let s = (input ?? "").trim();
|
|
1156
1173
|
try {
|
|
@@ -1176,6 +1193,17 @@ function parseSessionDirName(name) {
|
|
|
1176
1193
|
if (!m) return null;
|
|
1177
1194
|
return { timestamp: m[1], kind: m[2], slug: m[3] };
|
|
1178
1195
|
}
|
|
1196
|
+
var DATE_PREFIX_RE = /^(\d{4})-(\d{2})-(\d{2})(?:-(\d{2})(\d{2}))?(?=-|$)/;
|
|
1197
|
+
function describeSessionDir(name) {
|
|
1198
|
+
const parsed = parseSessionDirName(name);
|
|
1199
|
+
const legacy = !parsed;
|
|
1200
|
+
if (!parsed && !LEGACY_SESSION_DIR_RE.test(name)) return null;
|
|
1201
|
+
const m = DATE_PREFIX_RE.exec(name);
|
|
1202
|
+
if (!m) return null;
|
|
1203
|
+
const [, y, mo, d, h, mi] = m;
|
|
1204
|
+
const timestamp = new Date(Number(y), Number(mo) - 1, Number(d), Number(h ?? 0), Number(mi ?? 0));
|
|
1205
|
+
return { name, timestamp, legacy };
|
|
1206
|
+
}
|
|
1179
1207
|
|
|
1180
1208
|
// src/cli/commands/list.ts
|
|
1181
1209
|
function listCommand() {
|
|
@@ -1192,7 +1220,7 @@ function listCommand() {
|
|
|
1192
1220
|
async function runList(type, cwd, options = {}, log = (line) => console.log(line)) {
|
|
1193
1221
|
switch (type) {
|
|
1194
1222
|
case "sessions":
|
|
1195
|
-
listSessions(cwd);
|
|
1223
|
+
listSessions(cwd, log);
|
|
1196
1224
|
break;
|
|
1197
1225
|
case "knowledge":
|
|
1198
1226
|
listKnowledge(cwd, options, log);
|
|
@@ -1227,39 +1255,45 @@ function readSessionIndex(indexPath) {
|
|
|
1227
1255
|
}
|
|
1228
1256
|
return rows;
|
|
1229
1257
|
}
|
|
1230
|
-
function
|
|
1258
|
+
function reportDirName(report) {
|
|
1259
|
+
const link = /\]\(([^)]+)\)/.exec(report);
|
|
1260
|
+
const path = (link ? link[1] : report).trim();
|
|
1261
|
+
return basename4(path.replace(/\/session-report\.md$/, ""));
|
|
1262
|
+
}
|
|
1263
|
+
function listSessions(cwd, log) {
|
|
1231
1264
|
const sessionsDir = resolve5(cwd, "output", "sessions");
|
|
1232
1265
|
const indexPath = join6(sessionsDir, "INDEX.md");
|
|
1233
1266
|
if (!existsSync6(sessionsDir)) {
|
|
1234
|
-
|
|
1267
|
+
log(chalk3.yellow("No sessions directory. Run `npx qualiow init` first, then start a session."));
|
|
1235
1268
|
return;
|
|
1236
1269
|
}
|
|
1237
1270
|
const rows = readSessionIndex(indexPath);
|
|
1238
|
-
const indexedDirs = new Set(rows.map((r) =>
|
|
1239
|
-
const unindexed = readdirSync3(sessionsDir, { withFileTypes: true }).filter((d) => d.isDirectory()
|
|
1240
|
-
|
|
1241
|
-
|
|
1271
|
+
const indexedDirs = new Set(rows.map((r) => reportDirName(r.report)));
|
|
1272
|
+
const unindexed = readdirSync3(sessionsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => describeSessionDir(d.name)).filter((d) => d !== null && !indexedDirs.has(d.name)).sort((a, b) => a.name.localeCompare(b.name));
|
|
1273
|
+
log(chalk3.cyan.bold("\nSessions:"));
|
|
1274
|
+
log("");
|
|
1242
1275
|
if (rows.length === 0 && unindexed.length === 0) {
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1276
|
+
log(chalk3.yellow(" No sessions recorded yet."));
|
|
1277
|
+
log(chalk3.white(" Start one with: /qa-explore <url>"));
|
|
1278
|
+
log("");
|
|
1246
1279
|
return;
|
|
1247
1280
|
}
|
|
1248
|
-
const widths = [16, 8, 22, 5, 9,
|
|
1281
|
+
const widths = [16, 8, 22, 5, 9, 18];
|
|
1249
1282
|
const header = INDEX_COLUMNS.map((c, i) => i < widths.length ? pad2(c, widths[i]) : c).join(" ");
|
|
1250
|
-
|
|
1251
|
-
|
|
1283
|
+
log(chalk3.bold(` ${header}`));
|
|
1284
|
+
log(` ${widths.map((w) => "\u2500".repeat(w)).join(" ")} ${"\u2500".repeat(30)}`);
|
|
1252
1285
|
for (const r of rows) {
|
|
1253
|
-
|
|
1254
|
-
` ${pad2(r.date, 16)} ${pad2(r.kind, 8)} ${pad2(r.target, 22)} ${pad2(r.bugs, 5)} ${pad2(r.duration, 9)} ${pad2(r.status,
|
|
1286
|
+
log(
|
|
1287
|
+
` ${pad2(r.date, 16)} ${pad2(r.kind, 8)} ${pad2(r.target, 22)} ${pad2(r.bugs, 5)} ${pad2(r.duration, 9)} ${pad2(r.status, 18)} ${r.report}`
|
|
1255
1288
|
);
|
|
1256
1289
|
}
|
|
1257
1290
|
for (const d of unindexed) {
|
|
1258
|
-
|
|
1291
|
+
const status = d.legacy ? "unindexed (legacy)" : "unindexed";
|
|
1292
|
+
log(chalk3.gray(` ${pad2(d.name.slice(0, 15), 16)} ${pad2("", 8)} ${pad2("", 22)} ${pad2("", 5)} ${pad2("", 9)} ${pad2(status, 18)} ${d.name}`));
|
|
1259
1293
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1294
|
+
log("");
|
|
1295
|
+
log(chalk3.white(` Total: ${rows.length} session(s)` + (unindexed.length ? chalk3.gray(` (+${unindexed.length} unindexed)`) : "")));
|
|
1296
|
+
log("");
|
|
1263
1297
|
}
|
|
1264
1298
|
function listKnowledge(cwd, options, log) {
|
|
1265
1299
|
const dataDir = resolveDataDir(cwd, options.data);
|
|
@@ -3152,6 +3186,16 @@ ${result.violations.length} violation(s):`));
|
|
|
3152
3186
|
process.exit(1);
|
|
3153
3187
|
}
|
|
3154
3188
|
});
|
|
3189
|
+
cmd.command("repair-index").description(
|
|
3190
|
+
"Merge an INDEX.md / all-bugs.md table split into blocks by blank lines between its rows (dry run unless --yes)"
|
|
3191
|
+
).option("--yes", "Rewrite the files instead of a dry run", false).action((options) => {
|
|
3192
|
+
try {
|
|
3193
|
+
runSessionRepairIndex(options, { cwd: process.cwd() });
|
|
3194
|
+
} catch (err) {
|
|
3195
|
+
console.error(chalk7.red("Error:"), err instanceof Error ? err.message : err);
|
|
3196
|
+
process.exit(1);
|
|
3197
|
+
}
|
|
3198
|
+
});
|
|
3155
3199
|
cmd.command("prune").description("Delete sessions older than N days (dry run unless --yes)").requiredOption("--older-than <days>", "Delete sessions with a timestamp older than N days").option("--yes", "Perform the deletion instead of a dry run", false).action((options) => {
|
|
3156
3200
|
try {
|
|
3157
3201
|
runSessionPrune(options, { cwd: process.cwd() });
|
|
@@ -3240,27 +3284,44 @@ async function runSessionFinalize(dir, options, ctx) {
|
|
|
3240
3284
|
mkdirSync4(bugsOutputDir, { recursive: true });
|
|
3241
3285
|
const allBugsPath = join12(bugsOutputDir, "all-bugs.md");
|
|
3242
3286
|
ensureFileWithHeader(allBugsPath, ALL_BUGS_MD_HEADER);
|
|
3287
|
+
const appendIndexRow = tableRowAppender(indexPath, INDEX_COLUMNS, "INDEX.md", log);
|
|
3243
3288
|
let indexRowAdded = false;
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3289
|
+
if (!tableRowsText(indexPath).some((t) => t.includes(`${dirName}/`))) {
|
|
3290
|
+
appendIndexRow({
|
|
3291
|
+
date: finalStats.date,
|
|
3292
|
+
kind,
|
|
3293
|
+
target: finalStats.target,
|
|
3294
|
+
bugs: String(finalStats.bugs_found),
|
|
3295
|
+
duration: `${finalStats.duration_min} min`,
|
|
3296
|
+
status: "complete",
|
|
3297
|
+
report: `${dirName}/session-report.md`
|
|
3298
|
+
});
|
|
3249
3299
|
indexRowAdded = true;
|
|
3250
3300
|
}
|
|
3251
3301
|
const parsedSession = await parseSession(sessionDir);
|
|
3252
3302
|
const bugs = [...parsedSession.bugs].sort((a, b) => a.id.localeCompare(b.id));
|
|
3253
3303
|
const existingBugRows = readAllBugsRows(allBugsPath);
|
|
3304
|
+
const existingBugRowsText = tableRowsText(allBugsPath);
|
|
3305
|
+
const appendBugRow = tableRowAppender(allBugsPath, ALL_BUGS_COLUMNS, "all-bugs.md", log);
|
|
3254
3306
|
const bugRowsAdded = [];
|
|
3255
3307
|
for (const bug of bugs) {
|
|
3308
|
+
const reportPath = `${dirName}/bugs/${bug.id}.md`;
|
|
3256
3309
|
if (existingBugRows.some((r) => r.id === bug.id && r.session === dirName)) continue;
|
|
3310
|
+
if (existingBugRowsText.some((t) => t.includes(reportPath))) continue;
|
|
3257
3311
|
const title = bug.component ? `[${bug.component}] ${bug.title}` : bug.title;
|
|
3258
3312
|
const severity = bug.severity.charAt(0).toUpperCase() + bug.severity.slice(1);
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3313
|
+
appendBugRow({
|
|
3314
|
+
id: bug.id,
|
|
3315
|
+
session: dirName,
|
|
3316
|
+
title,
|
|
3317
|
+
severity,
|
|
3318
|
+
status: "open",
|
|
3319
|
+
report: reportPath
|
|
3320
|
+
});
|
|
3262
3321
|
bugRowsAdded.push(bug.id);
|
|
3263
3322
|
}
|
|
3323
|
+
warnSplitTable(indexPath, "INDEX.md", log);
|
|
3324
|
+
warnSplitTable(allBugsPath, "all-bugs.md", log);
|
|
3264
3325
|
if (appendSessionMetricsDeduped(resolve9(cwd, "output"), finalStats)) {
|
|
3265
3326
|
log(chalk7.green(" \u2713 Metrics appended to output/metrics.jsonl"));
|
|
3266
3327
|
}
|
|
@@ -3284,6 +3345,167 @@ function ensureFileWithHeader(path, header) {
|
|
|
3284
3345
|
mkdirSync4(dirname4(path), { recursive: true });
|
|
3285
3346
|
writeFileSync5(path, header);
|
|
3286
3347
|
}
|
|
3348
|
+
function readTableHeaders(path) {
|
|
3349
|
+
if (!existsSync12(path)) return null;
|
|
3350
|
+
return parseMarkdownTable(readFileSync10(path, "utf-8"))?.headers ?? null;
|
|
3351
|
+
}
|
|
3352
|
+
function isTableLine(line) {
|
|
3353
|
+
return line.trim().startsWith("|");
|
|
3354
|
+
}
|
|
3355
|
+
function isSeparatorLine(line) {
|
|
3356
|
+
const t = line.trim();
|
|
3357
|
+
return t.startsWith("|") && /^[|\s:-]+$/.test(t) && t.includes("--");
|
|
3358
|
+
}
|
|
3359
|
+
function isEmptyRowLine(line) {
|
|
3360
|
+
return /^[|\s]+$/.test(line.trim());
|
|
3361
|
+
}
|
|
3362
|
+
function tableBounds(lines) {
|
|
3363
|
+
let headerIdx = -1;
|
|
3364
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
|
3365
|
+
if (isTableLine(lines[i]) && isSeparatorLine(lines[i + 1])) {
|
|
3366
|
+
headerIdx = i;
|
|
3367
|
+
break;
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
if (headerIdx === -1) return { headerIdx, endIdx: lines.length };
|
|
3371
|
+
let endIdx = lines.length;
|
|
3372
|
+
for (let i = headerIdx + 2; i < lines.length; i++) {
|
|
3373
|
+
if (/^#{1,6}\s/.test(lines[i])) {
|
|
3374
|
+
endIdx = i;
|
|
3375
|
+
break;
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
return { headerIdx, endIdx };
|
|
3379
|
+
}
|
|
3380
|
+
function tableRowLines(lines) {
|
|
3381
|
+
const { headerIdx, endIdx } = tableBounds(lines);
|
|
3382
|
+
if (headerIdx === -1) return [];
|
|
3383
|
+
const out = [];
|
|
3384
|
+
for (let i = headerIdx + 1; i < endIdx; i++) {
|
|
3385
|
+
const line = lines[i];
|
|
3386
|
+
if (!isTableLine(line) || isSeparatorLine(line) || isEmptyRowLine(line)) continue;
|
|
3387
|
+
out.push({ index: i, text: line });
|
|
3388
|
+
}
|
|
3389
|
+
return out;
|
|
3390
|
+
}
|
|
3391
|
+
function tableRowsText(path) {
|
|
3392
|
+
if (!existsSync12(path)) return [];
|
|
3393
|
+
return tableRowLines(readFileSync10(path, "utf-8").split("\n")).map((r) => r.text);
|
|
3394
|
+
}
|
|
3395
|
+
function tableRowAppender(path, columns, label, log) {
|
|
3396
|
+
let headers;
|
|
3397
|
+
return (values) => {
|
|
3398
|
+
if (!headers) {
|
|
3399
|
+
headers = readTableHeaders(path) ?? [...columns];
|
|
3400
|
+
if (!headersMatchColumns(headers, columns)) {
|
|
3401
|
+
const missing = missingColumns(headers, columns);
|
|
3402
|
+
const detail = missing.length ? `an older column set (no ${missing.join(", ")})` : "a different column set";
|
|
3403
|
+
log(chalk7.yellow(` \u25CB ${label} uses ${detail}; row written in that layout`));
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
insertTableRow(path, buildTableRow(headers, values));
|
|
3407
|
+
};
|
|
3408
|
+
}
|
|
3409
|
+
function insertTableRow(path, row) {
|
|
3410
|
+
if (!existsSync12(path)) {
|
|
3411
|
+
appendFileSync2(path, `${row}
|
|
3412
|
+
`);
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3415
|
+
const lines = readFileSync10(path, "utf-8").split("\n");
|
|
3416
|
+
const { headerIdx, endIdx } = tableBounds(lines);
|
|
3417
|
+
let last = -1;
|
|
3418
|
+
for (let i = headerIdx === -1 ? 0 : headerIdx; i < endIdx; i++) {
|
|
3419
|
+
if (isTableLine(lines[i])) last = i;
|
|
3420
|
+
}
|
|
3421
|
+
if (last === -1) {
|
|
3422
|
+
appendFileSync2(path, `${row}
|
|
3423
|
+
`);
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3426
|
+
lines.splice(last + 1, 0, row);
|
|
3427
|
+
writeFileSync5(path, lines.join("\n"));
|
|
3428
|
+
}
|
|
3429
|
+
function nonBlankNeighbour(lines, from, step) {
|
|
3430
|
+
for (let i = from + step; i >= 0 && i < lines.length; i += step) {
|
|
3431
|
+
if (lines[i].trim() !== "") return i;
|
|
3432
|
+
}
|
|
3433
|
+
return -1;
|
|
3434
|
+
}
|
|
3435
|
+
function analyseTable(content) {
|
|
3436
|
+
const lines = content.split("\n");
|
|
3437
|
+
const { headerIdx, endIdx } = tableBounds(lines);
|
|
3438
|
+
if (headerIdx === -1) return { total: 0, visible: 0, blankLines: [] };
|
|
3439
|
+
const blankLines = [];
|
|
3440
|
+
for (let i = headerIdx + 1; i < endIdx; i++) {
|
|
3441
|
+
if (lines[i].trim() !== "") continue;
|
|
3442
|
+
const prev = nonBlankNeighbour(lines, i, -1);
|
|
3443
|
+
const next = nonBlankNeighbour(lines, i, 1);
|
|
3444
|
+
if (prev >= headerIdx && next !== -1 && isTableLine(lines[prev]) && isTableLine(lines[next])) {
|
|
3445
|
+
blankLines.push(i);
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
return {
|
|
3449
|
+
total: tableRowLines(lines).length,
|
|
3450
|
+
visible: parseMarkdownTable(content)?.rows.length ?? 0,
|
|
3451
|
+
blankLines
|
|
3452
|
+
};
|
|
3453
|
+
}
|
|
3454
|
+
function warnSplitTable(path, label, log) {
|
|
3455
|
+
if (!existsSync12(path)) return;
|
|
3456
|
+
const report = analyseTable(readFileSync10(path, "utf-8"));
|
|
3457
|
+
const hidden = report.total - report.visible;
|
|
3458
|
+
if (hidden <= 0) return;
|
|
3459
|
+
log(
|
|
3460
|
+
chalk7.yellow(
|
|
3461
|
+
` \u25CB ${label} has ${hidden} row(s) outside the first table block (blank lines split it); readers see ${report.visible} of ${report.total} \u2014 run \`qualiow session repair-index\``
|
|
3462
|
+
)
|
|
3463
|
+
);
|
|
3464
|
+
}
|
|
3465
|
+
function runSessionRepairIndex(options, ctx) {
|
|
3466
|
+
const cwd = ctx.cwd;
|
|
3467
|
+
const log = ctx.log ?? defaultLog;
|
|
3468
|
+
const targets = [
|
|
3469
|
+
{ path: resolve9(cwd, "output", "sessions", "INDEX.md"), label: "INDEX.md" },
|
|
3470
|
+
{ path: resolve9(cwd, "output", "bugs", "all-bugs.md"), label: "all-bugs.md" }
|
|
3471
|
+
];
|
|
3472
|
+
const files = [];
|
|
3473
|
+
for (const { path, label } of targets) {
|
|
3474
|
+
if (!existsSync12(path)) continue;
|
|
3475
|
+
const content = readFileSync10(path, "utf-8");
|
|
3476
|
+
const report = analyseTable(content);
|
|
3477
|
+
const hiddenRows = Math.max(report.total - report.visible, 0);
|
|
3478
|
+
const blankLines = report.blankLines.length;
|
|
3479
|
+
if (blankLines === 0) {
|
|
3480
|
+
log(chalk7.green(` \u2713 ${label}: nothing to repair`));
|
|
3481
|
+
files.push({ file: label, blankLines, hiddenRows: 0, repaired: false });
|
|
3482
|
+
continue;
|
|
3483
|
+
}
|
|
3484
|
+
if (!options.yes) {
|
|
3485
|
+
log(
|
|
3486
|
+
chalk7.cyan(
|
|
3487
|
+
` ${label}: ${blankLines} blank line(s) between table rows; ${hiddenRows} row(s) would become visible`
|
|
3488
|
+
)
|
|
3489
|
+
);
|
|
3490
|
+
files.push({ file: label, blankLines, hiddenRows, repaired: false });
|
|
3491
|
+
continue;
|
|
3492
|
+
}
|
|
3493
|
+
const drop = new Set(report.blankLines);
|
|
3494
|
+
writeFileSync5(path, content.split("\n").filter((_, i) => !drop.has(i)).join("\n"));
|
|
3495
|
+
log(
|
|
3496
|
+
chalk7.green(
|
|
3497
|
+
` \u2713 ${label}: removed ${blankLines} blank line(s) between table rows; ${hiddenRows} row(s) now visible`
|
|
3498
|
+
)
|
|
3499
|
+
);
|
|
3500
|
+
files.push({ file: label, blankLines, hiddenRows, repaired: true });
|
|
3501
|
+
}
|
|
3502
|
+
if (files.length === 0) {
|
|
3503
|
+
log(chalk7.yellow(" No output/sessions/INDEX.md or output/bugs/all-bugs.md found."));
|
|
3504
|
+
} else if (!options.yes && files.some((f) => f.blankLines > 0)) {
|
|
3505
|
+
log(chalk7.white(" Re-run with --yes to rewrite."));
|
|
3506
|
+
}
|
|
3507
|
+
return { ok: true, dryRun: !options.yes, files };
|
|
3508
|
+
}
|
|
3287
3509
|
function readAllBugsRows(path) {
|
|
3288
3510
|
if (!existsSync12(path)) return [];
|
|
3289
3511
|
const table2 = parseMarkdownTable(readFileSync10(path, "utf-8"));
|
|
@@ -3332,7 +3554,9 @@ function runSessionArchive(dir, options, ctx) {
|
|
|
3332
3554
|
}
|
|
3333
3555
|
function setIndexRowStatus(indexPath, dirName, status) {
|
|
3334
3556
|
if (!existsSync12(indexPath)) return;
|
|
3335
|
-
const
|
|
3557
|
+
const headers = readTableHeaders(indexPath) ?? [...INDEX_COLUMNS];
|
|
3558
|
+
const statusIdx = headers.findIndex((h) => h.trim().toLowerCase() === "status");
|
|
3559
|
+
if (statusIdx === -1) return;
|
|
3336
3560
|
const lines = readFileSync10(indexPath, "utf-8").split("\n");
|
|
3337
3561
|
const updated = lines.map((line) => {
|
|
3338
3562
|
if (!line.trim().startsWith("|")) return line;
|
|
@@ -3358,8 +3582,8 @@ function runSessionDelete(dir, options, ctx) {
|
|
|
3358
3582
|
const { fileCount, totalBytes } = dirStats(sessionDir);
|
|
3359
3583
|
const indexPath = join12(sessionsDir, "INDEX.md");
|
|
3360
3584
|
const allBugsPath = resolve9(cwd, "output", "bugs", "all-bugs.md");
|
|
3361
|
-
const indexRows =
|
|
3362
|
-
const bugRows =
|
|
3585
|
+
const indexRows = tableRowsText(indexPath).filter((t) => t.includes(`${dirName}/`));
|
|
3586
|
+
const bugRows = tableRowsText(allBugsPath).filter((t) => t.includes(`${dirName}/bugs/`));
|
|
3363
3587
|
if (!options.yes) {
|
|
3364
3588
|
log(chalk7.cyan(`
|
|
3365
3589
|
Dry run \u2014 would delete ${dirName}`));
|
|
@@ -3434,33 +3658,25 @@ function runSessionPrune(options, ctx) {
|
|
|
3434
3658
|
throw new Error("No output/sessions directory found. Run `npx qualiow init` first.");
|
|
3435
3659
|
}
|
|
3436
3660
|
const thresholdMs = days * 24 * 60 * 60 * 1e3;
|
|
3437
|
-
const dirs = readdirSync7(sessionsDir, { withFileTypes: true }).filter((d) => d.isDirectory()
|
|
3438
|
-
const
|
|
3439
|
-
|
|
3440
|
-
if (!parsed) return false;
|
|
3441
|
-
const dirDate = timestampToDate(parsed.timestamp);
|
|
3442
|
-
return now.getTime() - dirDate.getTime() > thresholdMs;
|
|
3443
|
-
});
|
|
3661
|
+
const dirs = readdirSync7(sessionsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => describeSessionDir(d.name)).filter((d) => d !== null).sort((a, b) => a.name.localeCompare(b.name));
|
|
3662
|
+
const selected = dirs.filter((d) => now.getTime() - d.timestamp.getTime() > thresholdMs);
|
|
3663
|
+
const candidates = selected.map((d) => d.name);
|
|
3444
3664
|
if (!options.yes) {
|
|
3445
3665
|
log(chalk7.cyan(`
|
|
3446
3666
|
Dry run \u2014 ${candidates.length} session(s) older than ${days} day(s):`));
|
|
3447
|
-
for (const
|
|
3667
|
+
for (const d of selected) {
|
|
3668
|
+
log(chalk7.white(` ${d.name}${d.legacy ? " (legacy name)" : ""}`));
|
|
3669
|
+
}
|
|
3448
3670
|
if (!candidates.length) log(chalk7.white(" (none)"));
|
|
3449
3671
|
log("");
|
|
3450
3672
|
return { ok: true, dryRun: true, candidates };
|
|
3451
3673
|
}
|
|
3452
|
-
for (const
|
|
3453
|
-
performDelete(cwd, join12(sessionsDir, name));
|
|
3454
|
-
log(chalk7.green(` \u2713 Deleted ${name}`));
|
|
3674
|
+
for (const d of selected) {
|
|
3675
|
+
performDelete(cwd, join12(sessionsDir, d.name));
|
|
3676
|
+
log(chalk7.green(` \u2713 Deleted ${d.name}${d.legacy ? " (legacy name)" : ""}`));
|
|
3455
3677
|
}
|
|
3456
3678
|
return { ok: true, dryRun: false, candidates };
|
|
3457
3679
|
}
|
|
3458
|
-
function timestampToDate(ts) {
|
|
3459
|
-
const m = /^(\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})$/.exec(ts);
|
|
3460
|
-
if (!m) return /* @__PURE__ */ new Date(NaN);
|
|
3461
|
-
const [, y, mo, d, h, mi] = m;
|
|
3462
|
-
return new Date(Number(y), Number(mo) - 1, Number(d), Number(h), Number(mi));
|
|
3463
|
-
}
|
|
3464
3680
|
|
|
3465
3681
|
// src/cli/index.ts
|
|
3466
3682
|
var program = new Command8().name("qualiow").description("qualiow \u2014 AI-powered exploratory testing (web, mobile, backend)").version(getPackageVersion());
|
package/dist/index.d.ts
CHANGED
|
@@ -879,6 +879,16 @@ declare function appendSessionMetricsDeduped(outputDir: string, metrics: Session
|
|
|
879
879
|
declare const SESSION_KINDS: readonly ["explore", "quick", "mobile", "backend"];
|
|
880
880
|
type SessionKind = (typeof SESSION_KINDS)[number];
|
|
881
881
|
declare const SESSION_DIR_RE: RegExp;
|
|
882
|
+
/**
|
|
883
|
+
* DISCOVERY ONLY — directories written before the current scheme existed:
|
|
884
|
+
* a `YYYY-MM-DD` prefix, an optional `HHmm`, then any remainder
|
|
885
|
+
* (`2026-05-22-1045-demo-target`, `2026-07-09-quick-preprod-product-search`).
|
|
886
|
+
*
|
|
887
|
+
* Never use this to create or validate a new directory name: `SESSION_DIR_RE`
|
|
888
|
+
* stays the only writer. It exists so `prune` and the unindexed scan can see
|
|
889
|
+
* output an upgraded project already has on disk.
|
|
890
|
+
*/
|
|
891
|
+
declare const LEGACY_SESSION_DIR_RE: RegExp;
|
|
882
892
|
/**
|
|
883
893
|
* Turns an arbitrary target id, ticket or URL into a filesystem-safe slug:
|
|
884
894
|
* lowercase, alphanumerics and single dashes, no leading/trailing dash,
|
|
@@ -896,6 +906,20 @@ interface ParsedSessionDir {
|
|
|
896
906
|
}
|
|
897
907
|
/** Parses a directory name back into its parts, or null if it does not match. */
|
|
898
908
|
declare function parseSessionDirName(name: string): ParsedSessionDir | null;
|
|
909
|
+
interface DiscoveredSessionDir {
|
|
910
|
+
/** The directory name as it is on disk. */
|
|
911
|
+
name: string;
|
|
912
|
+
/** Start of the session in local time; midnight when the name carries no `HHmm`. */
|
|
913
|
+
timestamp: Date;
|
|
914
|
+
/** True when the name predates the current `<YYYY-MM-DD-HHmm>-<kind>-<slug>` scheme. */
|
|
915
|
+
legacy: boolean;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Describes a session directory found on disk — current scheme or legacy — so
|
|
919
|
+
* `prune` and the unindexed scan can treat both. Returns null when the name
|
|
920
|
+
* carries no date prefix at all, which is what keeps unrelated directories out.
|
|
921
|
+
*/
|
|
922
|
+
declare function describeSessionDir(name: string): DiscoveredSessionDir | null;
|
|
899
923
|
|
|
900
924
|
/**
|
|
901
925
|
* Minimal GitHub-flavoured-markdown table parser.
|
|
@@ -940,6 +964,23 @@ declare const INDEX_COLUMNS: readonly ["Date", "Kind", "Target", "Bugs", "Durati
|
|
|
940
964
|
declare const ALL_BUGS_COLUMNS: readonly ["ID", "Session", "Title", "Severity", "Status", "Report"];
|
|
941
965
|
declare const INDEX_MD_HEADER: string;
|
|
942
966
|
declare const ALL_BUGS_MD_HEADER: string;
|
|
967
|
+
/**
|
|
968
|
+
* True when a table's own header is the canonical column set — same names in the
|
|
969
|
+
* same order, compared case-insensitively.
|
|
970
|
+
*/
|
|
971
|
+
declare function headersMatchColumns(headers: readonly string[], columns: readonly string[]): boolean;
|
|
972
|
+
/**
|
|
973
|
+
* Canonical columns a table's header does not carry, in canonical order — what a
|
|
974
|
+
* file written by an earlier version is missing.
|
|
975
|
+
*/
|
|
976
|
+
declare function missingColumns(headers: readonly string[], columns: readonly string[]): string[];
|
|
977
|
+
/**
|
|
978
|
+
* Renders one row in a table's OWN column order, taking each cell from `values`
|
|
979
|
+
* keyed by lower-cased column name. A column with no value is left empty, so an
|
|
980
|
+
* index written by an earlier version keeps its width instead of gaining cells
|
|
981
|
+
* that would shift every value one column to the right when read back.
|
|
982
|
+
*/
|
|
983
|
+
declare function buildTableRow(headers: readonly string[], values: Record<string, string>): string;
|
|
943
984
|
|
|
944
985
|
/**
|
|
945
986
|
* .gitignore merge for `qualiow init`.
|
|
@@ -1275,4 +1316,4 @@ interface KbDigestOptions {
|
|
|
1275
1316
|
*/
|
|
1276
1317
|
declare function runKbDigest(options: KbDigestOptions, cwd: string): string;
|
|
1277
1318
|
|
|
1278
|
-
export { ALL_BUGS_COLUMNS, ALL_BUGS_MD_HEADER, type AnyTargetConfig, type AuthConfig, AuthConfigSchema, type BrowserConfig, BrowserConfigSchema, type BugReport, type BugSeverity, CONFIDENTIALITY_HEADER_MD, CONFIDENTIALITY_LINES, CONFIDENTIALITY_NOTICE, type CopyRecord, type CopyStatus, type CoverageEntry, type DomainConfig, DomainConfigSchema, INDEX_COLUMNS, INDEX_MD_HEADER, type InitOptions, type InitResult, type Journey, JourneySchema, type KbDigestOptions, KnowledgeChangelogSchema, type KnowledgeEntry, type KnowledgeEntryContent, KnowledgeEntryContentSchema, KnowledgeEntrySchema, type KnowledgeManifest, type KnowledgeManifestEntry, KnowledgeManifestEntrySchema, KnowledgeManifestSchema, type KnowledgeManifestStats, KnowledgeManifestStatsSchema, KnowledgeReleaseSchema, type ListOptions, type LoadingStrategy, LoadingStrategySchema, type ManifestStats, type MobileAppConfig, MobileAppConfigSchema, type MobileDeviceConfig, MobileDeviceConfigSchema, type MobileScopeConfig, MobileScopeConfigSchema, type MobileTargetConfig, MobileTargetConfigSchema, type MobileWebConfig, MobileWebConfigSchema, type ParsedBug, type ParsedSession, type ParsedSessionDir, type ParsedTable, QUALIOW_GITIGNORE_ENTRIES, QUALIOW_GITIGNORE_HEADER, REDACTION_CATEGORIES, type RedactOptions, type RegistryEntry, type ReportMeta, type RiskRanking, SESSION_DIR_RE, SESSION_KINDS, type SafetyConfig, SafetyConfigSchema, type ScopeConfig, ScopeConfigSchema, type SessionKind, type SessionMetrics, SessionMetricsSchema, type SessionRow, type SeverityCounts, SeverityCountsSchema, type SourceRepoConfig, SourceRepoConfigSchema, type SyncResult, type TargetConfig, TargetConfigSchema, type ValidationError, type ValidationResult, WebTargetConfigSchema, appendSessionMetrics, appendSessionMetricsDeduped, buildManifestRegistry, computeStats, containsSecrets, csvEscape, extractCoverage, extractListSection, extractReportMeta, generateHtmlReport, generateJiraExport, generateJsonReport, generateMarkdownSummary, getPackageRoot, getPackageVersion, hasConfidentialityHeader, listReleaseDirs, loadSessionForOutput, mergeGitignore, parseBugReport, parseMarkdownTable, parseSession, parseSessionDirName, parseTimeBox, readAllMetrics, readSessionIndex, redact, resolveDataDir, resolveDomainPath, resolveSessionDir, resolveSkillsSource, resolveTargetPath, runExplore, runInit, runKb, runKbDigest, runList, runReport, runValidate, sessionDirName, sessionTimestamp, slugify, syncKnowledgeManifest, validateAllConfigs, validateDomainConfig, validateKnowledgeBase, validateKnowledgeEntry, validateTargetConfig };
|
|
1319
|
+
export { ALL_BUGS_COLUMNS, ALL_BUGS_MD_HEADER, type AnyTargetConfig, type AuthConfig, AuthConfigSchema, type BrowserConfig, BrowserConfigSchema, type BugReport, type BugSeverity, CONFIDENTIALITY_HEADER_MD, CONFIDENTIALITY_LINES, CONFIDENTIALITY_NOTICE, type CopyRecord, type CopyStatus, type CoverageEntry, type DiscoveredSessionDir, type DomainConfig, DomainConfigSchema, INDEX_COLUMNS, INDEX_MD_HEADER, type InitOptions, type InitResult, type Journey, JourneySchema, type KbDigestOptions, KnowledgeChangelogSchema, type KnowledgeEntry, type KnowledgeEntryContent, KnowledgeEntryContentSchema, KnowledgeEntrySchema, type KnowledgeManifest, type KnowledgeManifestEntry, KnowledgeManifestEntrySchema, KnowledgeManifestSchema, type KnowledgeManifestStats, KnowledgeManifestStatsSchema, KnowledgeReleaseSchema, LEGACY_SESSION_DIR_RE, type ListOptions, type LoadingStrategy, LoadingStrategySchema, type ManifestStats, type MobileAppConfig, MobileAppConfigSchema, type MobileDeviceConfig, MobileDeviceConfigSchema, type MobileScopeConfig, MobileScopeConfigSchema, type MobileTargetConfig, MobileTargetConfigSchema, type MobileWebConfig, MobileWebConfigSchema, type ParsedBug, type ParsedSession, type ParsedSessionDir, type ParsedTable, QUALIOW_GITIGNORE_ENTRIES, QUALIOW_GITIGNORE_HEADER, REDACTION_CATEGORIES, type RedactOptions, type RegistryEntry, type ReportMeta, type RiskRanking, SESSION_DIR_RE, SESSION_KINDS, type SafetyConfig, SafetyConfigSchema, type ScopeConfig, ScopeConfigSchema, type SessionKind, type SessionMetrics, SessionMetricsSchema, type SessionRow, type SeverityCounts, SeverityCountsSchema, type SourceRepoConfig, SourceRepoConfigSchema, type SyncResult, type TargetConfig, TargetConfigSchema, type ValidationError, type ValidationResult, WebTargetConfigSchema, appendSessionMetrics, appendSessionMetricsDeduped, buildManifestRegistry, buildTableRow, computeStats, containsSecrets, csvEscape, describeSessionDir, extractCoverage, extractListSection, extractReportMeta, generateHtmlReport, generateJiraExport, generateJsonReport, generateMarkdownSummary, getPackageRoot, getPackageVersion, hasConfidentialityHeader, headersMatchColumns, listReleaseDirs, loadSessionForOutput, mergeGitignore, missingColumns, parseBugReport, parseMarkdownTable, parseSession, parseSessionDirName, parseTimeBox, readAllMetrics, readSessionIndex, redact, resolveDataDir, resolveDomainPath, resolveSessionDir, resolveSkillsSource, resolveTargetPath, runExplore, runInit, runKb, runKbDigest, runList, runReport, runValidate, sessionDirName, sessionTimestamp, slugify, syncKnowledgeManifest, validateAllConfigs, validateDomainConfig, validateKnowledgeBase, validateKnowledgeEntry, validateTargetConfig };
|
package/dist/index.js
CHANGED
|
@@ -790,6 +790,7 @@ function appendSessionMetricsDeduped(outputDir, metrics) {
|
|
|
790
790
|
// src/utils/session-dir.ts
|
|
791
791
|
var SESSION_KINDS = ["explore", "quick", "mobile", "backend"];
|
|
792
792
|
var SESSION_DIR_RE = /^(\d{4}-\d{2}-\d{2}-\d{4})-(explore|quick|mobile|backend)-([a-z0-9][a-z0-9-]*)$/;
|
|
793
|
+
var LEGACY_SESSION_DIR_RE = /^\d{4}-\d{2}-\d{2}(?:-\d{4})?-.+/;
|
|
793
794
|
function slugify(input) {
|
|
794
795
|
let s = (input ?? "").trim();
|
|
795
796
|
try {
|
|
@@ -815,6 +816,17 @@ function parseSessionDirName(name) {
|
|
|
815
816
|
if (!m) return null;
|
|
816
817
|
return { timestamp: m[1], kind: m[2], slug: m[3] };
|
|
817
818
|
}
|
|
819
|
+
var DATE_PREFIX_RE = /^(\d{4})-(\d{2})-(\d{2})(?:-(\d{2})(\d{2}))?(?=-|$)/;
|
|
820
|
+
function describeSessionDir(name) {
|
|
821
|
+
const parsed = parseSessionDirName(name);
|
|
822
|
+
const legacy = !parsed;
|
|
823
|
+
if (!parsed && !LEGACY_SESSION_DIR_RE.test(name)) return null;
|
|
824
|
+
const m = DATE_PREFIX_RE.exec(name);
|
|
825
|
+
if (!m) return null;
|
|
826
|
+
const [, y, mo, d, h, mi] = m;
|
|
827
|
+
const timestamp = new Date(Number(y), Number(mo) - 1, Number(d), Number(h ?? 0), Number(mi ?? 0));
|
|
828
|
+
return { name, timestamp, legacy };
|
|
829
|
+
}
|
|
818
830
|
|
|
819
831
|
// src/utils/markdown-table.ts
|
|
820
832
|
function splitRow(line) {
|
|
@@ -926,6 +938,22 @@ var ALL_BUGS_MD_HEADER = table(
|
|
|
926
938
|
"_Consolidated index across all exploratory testing sessions._",
|
|
927
939
|
ALL_BUGS_COLUMNS
|
|
928
940
|
);
|
|
941
|
+
function keysOf(columns) {
|
|
942
|
+
return columns.map((c) => c.trim().toLowerCase());
|
|
943
|
+
}
|
|
944
|
+
function headersMatchColumns(headers, columns) {
|
|
945
|
+
const a = keysOf(headers);
|
|
946
|
+
const b = keysOf(columns);
|
|
947
|
+
return a.length === b.length && a.every((h, i) => h === b[i]);
|
|
948
|
+
}
|
|
949
|
+
function missingColumns(headers, columns) {
|
|
950
|
+
const present = new Set(keysOf(headers));
|
|
951
|
+
return columns.filter((c) => !present.has(c.trim().toLowerCase()));
|
|
952
|
+
}
|
|
953
|
+
function buildTableRow(headers, values) {
|
|
954
|
+
const cells = keysOf(headers).map((key) => values[key] ?? "");
|
|
955
|
+
return `| ${cells.join(" | ")} |`;
|
|
956
|
+
}
|
|
929
957
|
|
|
930
958
|
// src/utils/gitignore.ts
|
|
931
959
|
var QUALIOW_GITIGNORE_HEADER = "# Qualiow";
|
|
@@ -2428,7 +2456,7 @@ import chalk4 from "chalk";
|
|
|
2428
2456
|
async function runList(type, cwd, options = {}, log = (line) => console.log(line)) {
|
|
2429
2457
|
switch (type) {
|
|
2430
2458
|
case "sessions":
|
|
2431
|
-
listSessions(cwd);
|
|
2459
|
+
listSessions(cwd, log);
|
|
2432
2460
|
break;
|
|
2433
2461
|
case "knowledge":
|
|
2434
2462
|
listKnowledge(cwd, options, log);
|
|
@@ -2463,39 +2491,45 @@ function readSessionIndex(indexPath) {
|
|
|
2463
2491
|
}
|
|
2464
2492
|
return rows;
|
|
2465
2493
|
}
|
|
2466
|
-
function
|
|
2494
|
+
function reportDirName(report) {
|
|
2495
|
+
const link = /\]\(([^)]+)\)/.exec(report);
|
|
2496
|
+
const path = (link ? link[1] : report).trim();
|
|
2497
|
+
return basename6(path.replace(/\/session-report\.md$/, ""));
|
|
2498
|
+
}
|
|
2499
|
+
function listSessions(cwd, log) {
|
|
2467
2500
|
const sessionsDir = resolve6(cwd, "output", "sessions");
|
|
2468
2501
|
const indexPath = join9(sessionsDir, "INDEX.md");
|
|
2469
2502
|
if (!existsSync9(sessionsDir)) {
|
|
2470
|
-
|
|
2503
|
+
log(chalk4.yellow("No sessions directory. Run `npx qualiow init` first, then start a session."));
|
|
2471
2504
|
return;
|
|
2472
2505
|
}
|
|
2473
2506
|
const rows = readSessionIndex(indexPath);
|
|
2474
|
-
const indexedDirs = new Set(rows.map((r) =>
|
|
2475
|
-
const unindexed = readdirSync5(sessionsDir, { withFileTypes: true }).filter((d) => d.isDirectory()
|
|
2476
|
-
|
|
2477
|
-
|
|
2507
|
+
const indexedDirs = new Set(rows.map((r) => reportDirName(r.report)));
|
|
2508
|
+
const unindexed = readdirSync5(sessionsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => describeSessionDir(d.name)).filter((d) => d !== null && !indexedDirs.has(d.name)).sort((a, b) => a.name.localeCompare(b.name));
|
|
2509
|
+
log(chalk4.cyan.bold("\nSessions:"));
|
|
2510
|
+
log("");
|
|
2478
2511
|
if (rows.length === 0 && unindexed.length === 0) {
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2512
|
+
log(chalk4.yellow(" No sessions recorded yet."));
|
|
2513
|
+
log(chalk4.white(" Start one with: /qa-explore <url>"));
|
|
2514
|
+
log("");
|
|
2482
2515
|
return;
|
|
2483
2516
|
}
|
|
2484
|
-
const widths = [16, 8, 22, 5, 9,
|
|
2517
|
+
const widths = [16, 8, 22, 5, 9, 18];
|
|
2485
2518
|
const header = INDEX_COLUMNS.map((c, i) => i < widths.length ? pad2(c, widths[i]) : c).join(" ");
|
|
2486
|
-
|
|
2487
|
-
|
|
2519
|
+
log(chalk4.bold(` ${header}`));
|
|
2520
|
+
log(` ${widths.map((w) => "\u2500".repeat(w)).join(" ")} ${"\u2500".repeat(30)}`);
|
|
2488
2521
|
for (const r of rows) {
|
|
2489
|
-
|
|
2490
|
-
` ${pad2(r.date, 16)} ${pad2(r.kind, 8)} ${pad2(r.target, 22)} ${pad2(r.bugs, 5)} ${pad2(r.duration, 9)} ${pad2(r.status,
|
|
2522
|
+
log(
|
|
2523
|
+
` ${pad2(r.date, 16)} ${pad2(r.kind, 8)} ${pad2(r.target, 22)} ${pad2(r.bugs, 5)} ${pad2(r.duration, 9)} ${pad2(r.status, 18)} ${r.report}`
|
|
2491
2524
|
);
|
|
2492
2525
|
}
|
|
2493
2526
|
for (const d of unindexed) {
|
|
2494
|
-
|
|
2527
|
+
const status = d.legacy ? "unindexed (legacy)" : "unindexed";
|
|
2528
|
+
log(chalk4.gray(` ${pad2(d.name.slice(0, 15), 16)} ${pad2("", 8)} ${pad2("", 22)} ${pad2("", 5)} ${pad2("", 9)} ${pad2(status, 18)} ${d.name}`));
|
|
2495
2529
|
}
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2530
|
+
log("");
|
|
2531
|
+
log(chalk4.white(` Total: ${rows.length} session(s)` + (unindexed.length ? chalk4.gray(` (+${unindexed.length} unindexed)`) : "")));
|
|
2532
|
+
log("");
|
|
2499
2533
|
}
|
|
2500
2534
|
function listKnowledge(cwd, options, log) {
|
|
2501
2535
|
const dataDir = resolveDataDir(cwd, options.data);
|
|
@@ -3033,6 +3067,7 @@ export {
|
|
|
3033
3067
|
KnowledgeManifestSchema,
|
|
3034
3068
|
KnowledgeManifestStatsSchema,
|
|
3035
3069
|
KnowledgeReleaseSchema,
|
|
3070
|
+
LEGACY_SESSION_DIR_RE,
|
|
3036
3071
|
LoadingStrategySchema,
|
|
3037
3072
|
MobileAppConfigSchema,
|
|
3038
3073
|
MobileDeviceConfigSchema,
|
|
@@ -3054,9 +3089,11 @@ export {
|
|
|
3054
3089
|
appendSessionMetrics,
|
|
3055
3090
|
appendSessionMetricsDeduped,
|
|
3056
3091
|
buildManifestRegistry,
|
|
3092
|
+
buildTableRow,
|
|
3057
3093
|
computeStats,
|
|
3058
3094
|
containsSecrets,
|
|
3059
3095
|
csvEscape,
|
|
3096
|
+
describeSessionDir,
|
|
3060
3097
|
extractCoverage,
|
|
3061
3098
|
extractListSection,
|
|
3062
3099
|
extractReportMeta,
|
|
@@ -3067,9 +3104,11 @@ export {
|
|
|
3067
3104
|
getPackageRoot,
|
|
3068
3105
|
getPackageVersion,
|
|
3069
3106
|
hasConfidentialityHeader,
|
|
3107
|
+
headersMatchColumns,
|
|
3070
3108
|
listReleaseDirs,
|
|
3071
3109
|
loadSessionForOutput,
|
|
3072
3110
|
mergeGitignore,
|
|
3111
|
+
missingColumns,
|
|
3073
3112
|
parseBugReport,
|
|
3074
3113
|
parseMarkdownTable,
|
|
3075
3114
|
parseSession,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qualiow-exploratory-testing",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "qualiow — AI-powered exploratory testing skills for Claude Code: web via playwright-cli, iOS/Android simulators via Maestro/mobile-cli, and backend/API acceptance-criteria verification",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|