@sun-asterisk/sungen 3.0.0-beta.75 → 3.0.0-beta.78
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/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +10 -0
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/delivery.d.ts.map +1 -1
- package/dist/cli/commands/delivery.js +30 -14
- package/dist/cli/commands/delivery.js.map +1 -1
- package/dist/cli/commands/ingest.d.ts +3 -0
- package/dist/cli/commands/ingest.d.ts.map +1 -0
- package/dist/cli/commands/ingest.js +179 -0
- package/dist/cli/commands/ingest.js.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/dashboard/templates/index.html +54 -54
- package/dist/harness/audit.d.ts +2 -0
- package/dist/harness/audit.d.ts.map +1 -1
- package/dist/harness/audit.js +15 -4
- package/dist/harness/audit.js.map +1 -1
- package/dist/harness/capability-plan.d.ts +6 -0
- package/dist/harness/capability-plan.d.ts.map +1 -1
- package/dist/harness/capability-plan.js +13 -0
- package/dist/harness/capability-plan.js.map +1 -1
- package/dist/harness/spec-coverage.d.ts +37 -0
- package/dist/harness/spec-coverage.d.ts.map +1 -0
- package/dist/harness/spec-coverage.js +159 -0
- package/dist/harness/spec-coverage.js.map +1 -0
- package/dist/ingest/baseline-audit.d.ts +38 -0
- package/dist/ingest/baseline-audit.d.ts.map +1 -0
- package/dist/ingest/baseline-audit.js +85 -0
- package/dist/ingest/baseline-audit.js.map +1 -0
- package/dist/ingest/gsheet-fetch.d.ts +9 -0
- package/dist/ingest/gsheet-fetch.d.ts.map +1 -0
- package/dist/ingest/gsheet-fetch.js +180 -0
- package/dist/ingest/gsheet-fetch.js.map +1 -0
- package/dist/ingest/index.d.ts +6 -0
- package/dist/ingest/index.d.ts.map +1 -0
- package/dist/ingest/index.js +22 -0
- package/dist/ingest/index.js.map +1 -0
- package/dist/ingest/legacy-parser.d.ts +39 -0
- package/dist/ingest/legacy-parser.d.ts.map +1 -0
- package/dist/ingest/legacy-parser.js +218 -0
- package/dist/ingest/legacy-parser.js.map +1 -0
- package/dist/ingest/reconcile.d.ts +30 -0
- package/dist/ingest/reconcile.d.ts.map +1 -0
- package/dist/ingest/reconcile.js +65 -0
- package/dist/ingest/reconcile.js.map +1 -0
- package/dist/ingest/to-gherkin.d.ts +33 -0
- package/dist/ingest/to-gherkin.d.ts.map +1 -0
- package/dist/ingest/to-gherkin.js +93 -0
- package/dist/ingest/to-gherkin.js.map +1 -0
- package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
- package/dist/orchestrator/ai-rules-updater.js +2 -0
- package/dist/orchestrator/ai-rules-updater.js.map +1 -1
- package/dist/orchestrator/templates/ai-instructions/claude-skill-delivery.md +10 -0
- package/dist/orchestrator/templates/ai-instructions/claude-skill-ingest-legacy.md +79 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +10 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-ingest-legacy.md +79 -0
- package/package.json +3 -3
- package/src/cli/commands/audit.ts +7 -0
- package/src/cli/commands/delivery.ts +31 -15
- package/src/cli/commands/ingest.ts +141 -0
- package/src/cli/index.ts +2 -0
- package/src/dashboard/templates/index.html +54 -54
- package/src/harness/audit.ts +17 -4
- package/src/harness/capability-plan.ts +11 -0
- package/src/harness/spec-coverage.ts +139 -0
- package/src/ingest/baseline-audit.ts +100 -0
- package/src/ingest/gsheet-fetch.ts +152 -0
- package/src/ingest/index.ts +5 -0
- package/src/ingest/legacy-parser.ts +184 -0
- package/src/ingest/reconcile.ts +80 -0
- package/src/ingest/to-gherkin.ts +108 -0
- package/src/orchestrator/ai-rules-updater.ts +2 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-delivery.md +10 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-ingest-legacy.md +79 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +10 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-ingest-legacy.md +79 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.parseSpreadsheetId = parseSpreadsheetId;
|
|
37
|
+
exports.fetchGoogleSheet = fetchGoogleSheet;
|
|
38
|
+
/**
|
|
39
|
+
* Fetch a Google Sheet's tabs as a sheet-bundle — runs under the USER's own Google
|
|
40
|
+
* identity (Application Default Credentials), read-only. This is NOT an AI context, so
|
|
41
|
+
* it is not subject to the "ineligible for generative AI contexts" DLP that blocks AI
|
|
42
|
+
* connectors; and read access (Viewer/Commenter is enough) is all it needs.
|
|
43
|
+
*
|
|
44
|
+
* `googleapis` is an OPTIONAL dependency (lazy-required) — the core install stays lean;
|
|
45
|
+
* users who want the Google fetch run `npm i googleapis` + authenticate once with
|
|
46
|
+
* `gcloud auth application-default login` (or set GOOGLE_APPLICATION_CREDENTIALS).
|
|
47
|
+
*/
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const readline = __importStar(require("readline"));
|
|
50
|
+
const child_process_1 = require("child_process");
|
|
51
|
+
const SCOPE = 'https://www.googleapis.com/auth/spreadsheets.readonly';
|
|
52
|
+
/** Accept a full Sheets URL or a bare spreadsheet ID. */
|
|
53
|
+
function parseSpreadsheetId(idOrUrl) {
|
|
54
|
+
const m = idOrUrl.match(/\/spreadsheets\/d\/([a-zA-Z0-9_-]+)/);
|
|
55
|
+
return m ? m[1] : idOrUrl.trim();
|
|
56
|
+
}
|
|
57
|
+
function ask(prompt) {
|
|
58
|
+
return new Promise((resolve) => {
|
|
59
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
60
|
+
rl.question(prompt, (a) => { rl.close(); resolve(a.trim()); });
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** Load `googleapis`; if missing, ask to install it (default Yes) and install into the
|
|
64
|
+
* sungen package dir, then load it. Throws with manual instructions if declined/failed. */
|
|
65
|
+
async function ensureGoogleapis() {
|
|
66
|
+
try {
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
68
|
+
return require('googleapis').google;
|
|
69
|
+
}
|
|
70
|
+
catch { /* not installed → offer to install */ }
|
|
71
|
+
const manual = '\n Install it manually: npm i googleapis\n' +
|
|
72
|
+
' Then authenticate: gcloud auth application-default login --scopes=' + SCOPE;
|
|
73
|
+
if (!process.stdin.isTTY) {
|
|
74
|
+
throw new Error('`--gsheet` needs the optional dependency `googleapis` (non-interactive shell — cannot prompt).' + manual);
|
|
75
|
+
}
|
|
76
|
+
const answer = (await ask(' `--gsheet` needs the `googleapis` package (read-only Google Sheets). Install it now? [Y/n] ')).toLowerCase();
|
|
77
|
+
if (answer && !/^y(es)?$/.test(answer)) {
|
|
78
|
+
throw new Error('Skipped install — `--gsheet` needs `googleapis`.' + manual);
|
|
79
|
+
}
|
|
80
|
+
const pkgDir = path.resolve(__dirname, '..', '..'); // dist/ingest|src/ingest → package root
|
|
81
|
+
console.log(' Installing googleapis (local to sungen, not saved to your project)…');
|
|
82
|
+
try {
|
|
83
|
+
// --no-save: keep sungen's core lean; this machine gets googleapis without declaring a dep.
|
|
84
|
+
(0, child_process_1.execSync)('npm install googleapis --no-save', { cwd: pkgDir, stdio: 'inherit' });
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
throw new Error('npm install googleapis failed (permissions?).' + manual);
|
|
88
|
+
}
|
|
89
|
+
// Node caches the negative module lookup from process start, so requiring a just-installed
|
|
90
|
+
// package in THIS process is unreliable. Ask for a clean re-run (next process finds it).
|
|
91
|
+
try {
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
93
|
+
return require(require.resolve('googleapis', { paths: [pkgDir] })).google;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
console.log('\n ✓ googleapis installed. Please re-run the same `sungen ingest --gsheet …` command.\n');
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** Open the Google login in the browser (via gcloud ADC) so the user picks THEIR
|
|
101
|
+
* account, then store read-only credentials. Returns false if gcloud is unavailable. */
|
|
102
|
+
async function tryInteractiveLogin() {
|
|
103
|
+
try {
|
|
104
|
+
(0, child_process_1.execSync)('gcloud --version', { stdio: 'ignore' });
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
console.log('\n (gcloud not found — install the Google Cloud SDK, or export the sheet to .xlsx and use --legacy.)');
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
const ans = (await ask(' Open Google login in your browser now (pick the account that can see the sheet)? [Y/n] ')).toLowerCase();
|
|
111
|
+
if (ans && !/^y(es)?$/.test(ans))
|
|
112
|
+
return false;
|
|
113
|
+
try {
|
|
114
|
+
(0, child_process_1.execSync)(`gcloud auth application-default login --scopes=${SCOPE},https://www.googleapis.com/auth/cloud-platform`, { stdio: 'inherit' });
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function fetchGoogleSheet(idOrUrl) {
|
|
122
|
+
const google = await ensureGoogleapis();
|
|
123
|
+
const spreadsheetId = parseSpreadsheetId(idOrUrl);
|
|
124
|
+
const doFetch = async () => {
|
|
125
|
+
// ADC: the user's own credentials (gcloud ADC). Fresh client each attempt so a
|
|
126
|
+
// just-completed login is picked up.
|
|
127
|
+
const auth = new google.auth.GoogleAuth({ scopes: [SCOPE] });
|
|
128
|
+
const sheets = google.sheets({ version: 'v4', auth });
|
|
129
|
+
const m = await sheets.spreadsheets.get({ spreadsheetId, fields: 'properties.title,sheets.properties.title' });
|
|
130
|
+
const tabs = (m.data?.sheets || []).map((s) => s.properties.title);
|
|
131
|
+
const r = await sheets.spreadsheets.values.batchGet({ spreadsheetId, ranges: tabs, majorDimension: 'ROWS' });
|
|
132
|
+
return { m, r };
|
|
133
|
+
};
|
|
134
|
+
let meta, resp;
|
|
135
|
+
try {
|
|
136
|
+
({ m: meta, r: resp } = await doFetch());
|
|
137
|
+
}
|
|
138
|
+
catch (e) {
|
|
139
|
+
const msg = String(e?.message || e);
|
|
140
|
+
const noCreds = /default credentials|could not load|invalid_grant|reauth|unauthenticated/i.test(msg);
|
|
141
|
+
// Tool-driven browser login: on missing/expired creds, offer to open the Google
|
|
142
|
+
// login (gcloud ADC) so the user picks THEIR account, then retry once.
|
|
143
|
+
if (noCreds && process.stdin.isTTY && await tryInteractiveLogin()) {
|
|
144
|
+
({ m: meta, r: resp } = await doFetch());
|
|
145
|
+
}
|
|
146
|
+
else if (noCreds) {
|
|
147
|
+
throw new Error('Google login needed (no usable credentials for your account).\n' +
|
|
148
|
+
' Run: gcloud auth application-default login --scopes=' + SCOPE + '\n' +
|
|
149
|
+
' (opens a browser — pick the account that can see the sheet). Then re-run.\n' +
|
|
150
|
+
' No gcloud? Export the sheet to .xlsx and use --legacy instead.');
|
|
151
|
+
}
|
|
152
|
+
else if (/access_denied|app is blocked|blocked this access|disallowed_useragent|admin|policy|org_internal|403/i.test(msg)) {
|
|
153
|
+
throw new Error('Blocked by your organization\'s Google Workspace policy (admin App-access control):\n' +
|
|
154
|
+
' "' + msg.split('\n')[0] + '"\n' +
|
|
155
|
+
' Your org blocks OAuth apps from reading Sheets (a sensitive scope). This affects gcloud,\n' +
|
|
156
|
+
' a custom OAuth app, AND the AI connector equally — it is an admin decision, not a sungen bug.\n' +
|
|
157
|
+
' → Use the local path instead: have an owner export the sheet to .xlsx and run\n' +
|
|
158
|
+
' sungen ingest --legacy <file>.xlsx\n' +
|
|
159
|
+
' (no API, no admin needed). Or ask a Workspace admin to trust an app for the\n' +
|
|
160
|
+
' spreadsheets.readonly scope (Admin Console → Security → API controls).');
|
|
161
|
+
}
|
|
162
|
+
else if (/no access|permission|not found|insufficient|API has not been used/i.test(msg)) {
|
|
163
|
+
throw new Error('Google access failed: ' + msg.split('\n')[0] + '\n' +
|
|
164
|
+
' Ensure the logged-in account has Viewer/Commenter on the sheet and the Sheets API is enabled.\n' +
|
|
165
|
+
' If your org blocks programmatic access to this file, ask an owner to export .xlsx → use --legacy.');
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
throw e;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const title = meta.data?.properties?.title || spreadsheetId;
|
|
172
|
+
const tabNames = (meta.data?.sheets || []).map((s) => s.properties.title);
|
|
173
|
+
const ranges = resp.data?.valueRanges || [];
|
|
174
|
+
const out = tabNames.map((name, i) => ({
|
|
175
|
+
name,
|
|
176
|
+
rows: (ranges[i]?.values || []).map((row) => row.map((c) => (c == null ? '' : String(c)))),
|
|
177
|
+
}));
|
|
178
|
+
return { source: title, sheets: out };
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=gsheet-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gsheet-fetch.js","sourceRoot":"","sources":["../../src/ingest/gsheet-fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,gDAGC;AAiED,4CA+DC;AAvJD;;;;;;;;;GASG;AACH,2CAA6B;AAC7B,mDAAqC;AACrC,iDAAyC;AAKzC,MAAM,KAAK,GAAG,uDAAuD,CAAC;AAEtE,yDAAyD;AACzD,SAAgB,kBAAkB,CAAC,OAAe;IAChD,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAC/D,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AACnC,CAAC;AAED,SAAS,GAAG,CAAC,MAAc;IACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACtF,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,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,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAU,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAClG,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ingest/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./legacy-parser"), exports);
|
|
18
|
+
__exportStar(require("./baseline-audit"), exports);
|
|
19
|
+
__exportStar(require("./to-gherkin"), exports);
|
|
20
|
+
__exportStar(require("./reconcile"), exports);
|
|
21
|
+
__exportStar(require("./gsheet-fetch"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ingest/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC;AACjC,+CAA6B;AAC7B,8CAA4B;AAC5B,iDAA+B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type SheetType = 'testcase' | 'viewpoint-matrix' | 'ui-checklist' | 'unknown';
|
|
2
|
+
export type Priority = 'high' | 'normal' | 'low' | 'unknown';
|
|
3
|
+
export interface LegacyTestcase {
|
|
4
|
+
id: string;
|
|
5
|
+
page: string;
|
|
6
|
+
category: string;
|
|
7
|
+
subCategory?: string;
|
|
8
|
+
precondition?: string;
|
|
9
|
+
testData?: string;
|
|
10
|
+
steps: string;
|
|
11
|
+
expected: string;
|
|
12
|
+
priority: Priority;
|
|
13
|
+
type?: string;
|
|
14
|
+
result?: string;
|
|
15
|
+
sheet: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SheetInfo {
|
|
18
|
+
name: string;
|
|
19
|
+
type: SheetType;
|
|
20
|
+
rows: number;
|
|
21
|
+
}
|
|
22
|
+
export interface LegacyInventory {
|
|
23
|
+
source: {
|
|
24
|
+
file: string;
|
|
25
|
+
};
|
|
26
|
+
sheets: SheetInfo[];
|
|
27
|
+
testcases: LegacyTestcase[];
|
|
28
|
+
}
|
|
29
|
+
export declare function parseCSV(text: string): string[][];
|
|
30
|
+
export interface RawSheet {
|
|
31
|
+
name: string;
|
|
32
|
+
rows: string[][];
|
|
33
|
+
}
|
|
34
|
+
/** Classify sheets without parsing testcases — for `--list-sheets`. */
|
|
35
|
+
export declare function listSheets(filePaths: string | string[]): Promise<SheetInfo[]>;
|
|
36
|
+
/** Parse one or more inputs (CSV/XLSX/JSON-bundle) into an inventory. Optionally
|
|
37
|
+
* restrict to a set of tab names (`onlySheets`) — workbooks carry many tabs. */
|
|
38
|
+
export declare function parseLegacyFile(filePaths: string | string[], onlySheets?: string[]): Promise<LegacyInventory>;
|
|
39
|
+
//# sourceMappingURL=legacy-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-parser.d.ts","sourceRoot":"","sources":["../../src/ingest/legacy-parser.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,kBAAkB,GAAG,cAAc,GAAG,SAAS,CAAC;AACrF,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAE1E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B;AAGD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAcjD;AA8DD,MAAM,WAAW,QAAQ;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAA;CAAE;AAsC5D,uEAAuE;AACvE,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAUnF;AAED;gFACgF;AAChF,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAmBnH"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.parseCSV = parseCSV;
|
|
37
|
+
exports.listSheets = listSheets;
|
|
38
|
+
exports.parseLegacyFile = parseLegacyFile;
|
|
39
|
+
/**
|
|
40
|
+
* Legacy testcase ingest (P-A) — parse a manual testcase workbook (CSV or XLSX)
|
|
41
|
+
* into a normalized inventory. Deterministic: pure function of the input file
|
|
42
|
+
* (no network, no MCP). The AI skill handles the Google-Sheets/MCP fetch upstream.
|
|
43
|
+
*/
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
// ---- quote-aware CSV parser (embedded commas + newlines) ----
|
|
47
|
+
function parseCSV(text) {
|
|
48
|
+
const rows = [];
|
|
49
|
+
let row = [], field = '', q = false;
|
|
50
|
+
for (let i = 0; i < text.length; i++) {
|
|
51
|
+
const c = text[i];
|
|
52
|
+
if (q) {
|
|
53
|
+
if (c === '"') {
|
|
54
|
+
if (text[i + 1] === '"') {
|
|
55
|
+
field += '"';
|
|
56
|
+
i++;
|
|
57
|
+
}
|
|
58
|
+
else
|
|
59
|
+
q = false;
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
field += c;
|
|
63
|
+
}
|
|
64
|
+
else if (c === '"')
|
|
65
|
+
q = true;
|
|
66
|
+
else if (c === ',') {
|
|
67
|
+
row.push(field);
|
|
68
|
+
field = '';
|
|
69
|
+
}
|
|
70
|
+
else if (c === '\n') {
|
|
71
|
+
row.push(field);
|
|
72
|
+
rows.push(row);
|
|
73
|
+
row = [];
|
|
74
|
+
field = '';
|
|
75
|
+
}
|
|
76
|
+
else if (c !== '\r')
|
|
77
|
+
field += c;
|
|
78
|
+
}
|
|
79
|
+
if (field.length || row.length) {
|
|
80
|
+
row.push(field);
|
|
81
|
+
rows.push(row);
|
|
82
|
+
}
|
|
83
|
+
return rows;
|
|
84
|
+
}
|
|
85
|
+
const norm = (s) => (s || '').replace(/\*/g, '').trim().toLowerCase();
|
|
86
|
+
function detectSheetType(rows) {
|
|
87
|
+
for (let i = 0; i < Math.min(rows.length, 40); i++) {
|
|
88
|
+
const cells = rows[i].map(norm);
|
|
89
|
+
if (cells.some((c) => /^tc\s*id$/.test(c)) && cells.some((c) => /steps?|expected/.test(c)))
|
|
90
|
+
return { type: 'testcase', headerRow: i };
|
|
91
|
+
if (cells.some((c) => /item type/.test(c)) || (cells[0] === 'id' && cells.some((c) => /^item/.test(c))))
|
|
92
|
+
return { type: 'ui-checklist', headerRow: i };
|
|
93
|
+
if (cells.some((c) => /^id\/function$/.test(c)) || cells.some((c) => /viewpoint/.test(c)))
|
|
94
|
+
return { type: 'viewpoint-matrix', headerRow: i };
|
|
95
|
+
}
|
|
96
|
+
return { type: 'unknown', headerRow: -1 };
|
|
97
|
+
}
|
|
98
|
+
function colMap(header) {
|
|
99
|
+
const m = {};
|
|
100
|
+
header.forEach((h, i) => { const k = norm(h); if (k && !(k in m))
|
|
101
|
+
m[k] = i; });
|
|
102
|
+
return m;
|
|
103
|
+
}
|
|
104
|
+
function toPriority(raw) {
|
|
105
|
+
const p = (raw || '').toLowerCase();
|
|
106
|
+
if (/high|cao/.test(p))
|
|
107
|
+
return 'high';
|
|
108
|
+
if (/low|thấp/.test(p))
|
|
109
|
+
return 'low';
|
|
110
|
+
if (/medium|normal|trung/.test(p))
|
|
111
|
+
return 'normal';
|
|
112
|
+
return 'unknown';
|
|
113
|
+
}
|
|
114
|
+
function parseTestcaseSheet(rows, headerRow, sheet) {
|
|
115
|
+
const cm = colMap(rows[headerRow]);
|
|
116
|
+
if (cm['tc id'] == null)
|
|
117
|
+
return [];
|
|
118
|
+
const col = (r, key) => (cm[key] != null ? (r[cm[key]] || '').trim() : '');
|
|
119
|
+
const out = [];
|
|
120
|
+
// Fill-down ONLY the grouping columns (genuinely merged across rows). Precondition is
|
|
121
|
+
// kept PER-ROW: filling it down would bleed one row's "needs API/DB/login" into unrelated
|
|
122
|
+
// rows and falsely inflate the capability/driver signal.
|
|
123
|
+
const fd = { page: '', category: '', sub: '' };
|
|
124
|
+
for (let i = headerRow + 1; i < rows.length; i++) {
|
|
125
|
+
const r = rows[i];
|
|
126
|
+
const id = col(r, 'tc id');
|
|
127
|
+
if (!id || /^(total|module|test environment)/i.test(id))
|
|
128
|
+
continue;
|
|
129
|
+
fd.page = col(r, 'page name') || fd.page;
|
|
130
|
+
fd.category = col(r, 'category') || fd.category;
|
|
131
|
+
fd.sub = col(r, 'sub-category') || fd.sub;
|
|
132
|
+
const steps = col(r, 'steps');
|
|
133
|
+
const expected = col(r, 'expected results') || col(r, 'expected result');
|
|
134
|
+
if (!steps && !expected)
|
|
135
|
+
continue; // skip noise / spacer rows
|
|
136
|
+
out.push({
|
|
137
|
+
id, sheet, page: fd.page, category: fd.category || '(uncategorized)',
|
|
138
|
+
subCategory: fd.sub || undefined, precondition: col(r, 'pre-condition') || undefined,
|
|
139
|
+
testData: col(r, 'test data') || undefined, steps, expected,
|
|
140
|
+
priority: toPriority(col(r, 'priority')),
|
|
141
|
+
type: col(r, 'testcase type') || undefined,
|
|
142
|
+
result: col(r, 'test result') || col(r, 'test result\nchrome (100%)') || undefined,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
/** Load sheets from one input file: CSV (1 sheet), XLSX (all sheets), or a JSON
|
|
148
|
+
* sheet-bundle (the shape the Google-Sheets/MCP skill produces). */
|
|
149
|
+
async function loadSheets(filePath) {
|
|
150
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
151
|
+
if (ext === '.csv') {
|
|
152
|
+
return [{ name: path.basename(filePath, '.csv'), rows: parseCSV(fs.readFileSync(filePath, 'utf8')) }];
|
|
153
|
+
}
|
|
154
|
+
if (ext === '.json') {
|
|
155
|
+
// Bundle shapes: { sheets: [{name, rows}] } | [{name, rows}] | { "<tab>": [[..]] }
|
|
156
|
+
const data = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
157
|
+
const arr = Array.isArray(data) ? data : Array.isArray(data.sheets) ? data.sheets : null;
|
|
158
|
+
if (arr)
|
|
159
|
+
return arr.map((s) => ({ name: String(s.name), rows: s.rows }));
|
|
160
|
+
if (data && typeof data === 'object')
|
|
161
|
+
return Object.entries(data).map(([name, rows]) => ({ name, rows: rows }));
|
|
162
|
+
throw new Error('Invalid JSON sheet-bundle: expected { sheets: [{name, rows}] }');
|
|
163
|
+
}
|
|
164
|
+
if (ext === '.xlsx') {
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
166
|
+
const ExcelJS = require('exceljs');
|
|
167
|
+
const wb = new ExcelJS.Workbook();
|
|
168
|
+
await wb.xlsx.readFile(filePath);
|
|
169
|
+
const out = [];
|
|
170
|
+
wb.eachSheet((ws) => {
|
|
171
|
+
const rows = [];
|
|
172
|
+
ws.eachRow((row) => {
|
|
173
|
+
const cells = [];
|
|
174
|
+
row.eachCell({ includeEmpty: true }, (cell) => { cells.push(cell.text != null ? String(cell.text) : ''); });
|
|
175
|
+
rows.push(cells);
|
|
176
|
+
});
|
|
177
|
+
out.push({ name: ws.name, rows });
|
|
178
|
+
});
|
|
179
|
+
return out;
|
|
180
|
+
}
|
|
181
|
+
throw new Error(`Unsupported file type: ${ext} (use .csv, .xlsx, or a .json sheet-bundle)`);
|
|
182
|
+
}
|
|
183
|
+
/** Classify sheets without parsing testcases — for `--list-sheets`. */
|
|
184
|
+
async function listSheets(filePaths) {
|
|
185
|
+
const files = Array.isArray(filePaths) ? filePaths : [filePaths];
|
|
186
|
+
const out = [];
|
|
187
|
+
for (const f of files) {
|
|
188
|
+
for (const s of await loadSheets(f)) {
|
|
189
|
+
const { type } = detectSheetType(s.rows);
|
|
190
|
+
out.push({ name: s.name, type, rows: s.rows.length });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return out;
|
|
194
|
+
}
|
|
195
|
+
/** Parse one or more inputs (CSV/XLSX/JSON-bundle) into an inventory. Optionally
|
|
196
|
+
* restrict to a set of tab names (`onlySheets`) — workbooks carry many tabs. */
|
|
197
|
+
async function parseLegacyFile(filePaths, onlySheets) {
|
|
198
|
+
const files = Array.isArray(filePaths) ? filePaths : [filePaths];
|
|
199
|
+
const want = onlySheets && onlySheets.length ? new Set(onlySheets.map((s) => s.trim().toLowerCase())) : null;
|
|
200
|
+
const inv = {
|
|
201
|
+
source: { file: files.map((f) => path.basename(f)).join(', ') },
|
|
202
|
+
sheets: [], testcases: [],
|
|
203
|
+
};
|
|
204
|
+
for (const f of files) {
|
|
205
|
+
for (const s of await loadSheets(f)) {
|
|
206
|
+
if (want && !want.has(s.name.trim().toLowerCase()))
|
|
207
|
+
continue;
|
|
208
|
+
const { type, headerRow } = detectSheetType(s.rows);
|
|
209
|
+
let tcs = [];
|
|
210
|
+
if (type === 'testcase' && headerRow >= 0)
|
|
211
|
+
tcs = parseTestcaseSheet(s.rows, headerRow, s.name);
|
|
212
|
+
inv.sheets.push({ name: s.name, type, rows: tcs.length || s.rows.length });
|
|
213
|
+
inv.testcases.push(...tcs);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return inv;
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=legacy-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-parser.js","sourceRoot":"","sources":["../../src/ingest/legacy-parser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;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AAE,CAAC,CAAC,IAAI,CAAC,CAAC;YAC/F,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3E,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewpoint Reconciliation (P-C) — the link between a legacy suite and the Harness.
|
|
3
|
+
*
|
|
4
|
+
* A 1:1 convert reproduces the legacy suite's blind spots. Reconciliation runs the
|
|
5
|
+
* harness viewpoint-gate over the legacy-derived scenarios to answer: which catalog-
|
|
6
|
+
* expected viewpoints does the legacy suite ALREADY cover, and which are MISSING
|
|
7
|
+
* (blind spots the old QA never wrote)? It emits a draft viewpoint overview that
|
|
8
|
+
* seeds `/sungen:create-test` + the harness coverage-gate, so the generated suite is
|
|
9
|
+
* raised to catalog quality instead of merely mirroring the legacy.
|
|
10
|
+
*/
|
|
11
|
+
import { LegacyInventory } from './legacy-parser';
|
|
12
|
+
export interface Reconciliation {
|
|
13
|
+
pageType: string | null;
|
|
14
|
+
coverageRatio: number;
|
|
15
|
+
themesCovered: number;
|
|
16
|
+
themesTotal: number;
|
|
17
|
+
blindSpots: {
|
|
18
|
+
theme: string;
|
|
19
|
+
status: 'missing' | 'shallow';
|
|
20
|
+
}[];
|
|
21
|
+
universalGaps: string[];
|
|
22
|
+
legacyViewpoints: {
|
|
23
|
+
vpGroup: string;
|
|
24
|
+
count: number;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
export declare function reconcileViewpoints(inv: LegacyInventory): Reconciliation;
|
|
28
|
+
/** A draft test-viewpoint.md: legacy-derived viewpoints + catalog blind-spots to fill. */
|
|
29
|
+
export declare function renderViewpointOverview(featureName: string, r: Reconciliation): string;
|
|
30
|
+
//# sourceMappingURL=reconcile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../../src/ingest/reconcile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAA;KAAE,EAAE,CAAC;IAC/D,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACxD;AAaD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,eAAe,GAAG,cAAc,CAqBxE;AAED,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,GAAG,MAAM,CAoBtF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reconcileViewpoints = reconcileViewpoints;
|
|
4
|
+
exports.renderViewpointOverview = renderViewpointOverview;
|
|
5
|
+
const baseline_audit_1 = require("./baseline-audit");
|
|
6
|
+
const sensors_1 = require("../harness/sensors");
|
|
7
|
+
function vpGroupOf(category) {
|
|
8
|
+
const c = (category || '').toLowerCase();
|
|
9
|
+
if (/search|filter|điều kiện|条件/.test(c))
|
|
10
|
+
return 'SEARCH';
|
|
11
|
+
if (/input|validation|nhập|入力/.test(c))
|
|
12
|
+
return 'VAL';
|
|
13
|
+
if (/display|hiển thị|表示|data/.test(c))
|
|
14
|
+
return 'DISPLAY';
|
|
15
|
+
if (/layout|responsive|tab order|ui|giao diện/.test(c))
|
|
16
|
+
return 'UI';
|
|
17
|
+
if (/flow|navigation|遷移|chuyển|event/.test(c))
|
|
18
|
+
return 'NAV';
|
|
19
|
+
if (/paging|sort|phân trang/.test(c))
|
|
20
|
+
return 'LIST';
|
|
21
|
+
return (c.replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '').toUpperCase().slice(0, 8)) || 'GEN';
|
|
22
|
+
}
|
|
23
|
+
function reconcileViewpoints(inv) {
|
|
24
|
+
const scenarios = inv.testcases.map(baseline_audit_1.legacyToScenarioInfo);
|
|
25
|
+
const catalog = (0, sensors_1.loadCatalog)();
|
|
26
|
+
const gate = (0, sensors_1.viewpointGate)(scenarios, [], catalog);
|
|
27
|
+
const groups = {};
|
|
28
|
+
for (const tc of inv.testcases) {
|
|
29
|
+
const g = vpGroupOf(tc.category);
|
|
30
|
+
groups[g] = (groups[g] || 0) + 1;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
pageType: gate.pageType,
|
|
34
|
+
coverageRatio: gate.coverageRatio,
|
|
35
|
+
themesCovered: gate.themesCovered,
|
|
36
|
+
themesTotal: gate.themesTotal,
|
|
37
|
+
blindSpots: gate.gaps.map((g) => ({ theme: g.theme, status: g.status })),
|
|
38
|
+
universalGaps: gate.universalGaps,
|
|
39
|
+
legacyViewpoints: Object.entries(groups).map(([vpGroup, count]) => ({ vpGroup, count }))
|
|
40
|
+
.sort((a, b) => b.count - a.count),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** A draft test-viewpoint.md: legacy-derived viewpoints + catalog blind-spots to fill. */
|
|
44
|
+
function renderViewpointOverview(featureName, r) {
|
|
45
|
+
const L = [];
|
|
46
|
+
L.push(`# Test Viewpoint — ${featureName} (drafted from legacy + reconciled with the catalog)`, '');
|
|
47
|
+
L.push('> Auto-drafted by `sungen ingest`. Rows from the legacy suite are listed first;');
|
|
48
|
+
L.push('> rows marked **⚠ BLIND-SPOT** are catalog-expected viewpoints the legacy suite does');
|
|
49
|
+
L.push('> NOT cover — add scenarios for them via `/sungen:create-test`. Refine before use.', '');
|
|
50
|
+
L.push(`Detected page-type: \`${r.pageType ?? 'unknown'}\` · legacy covers ${r.themesCovered}/${r.themesTotal} catalog themes (${(r.coverageRatio * 100).toFixed(0)}%)`, '');
|
|
51
|
+
L.push('## Priority Viewpoints', '', '| VP | Priority | Reason |', '|---|---|---|');
|
|
52
|
+
let n = 1;
|
|
53
|
+
for (const v of r.legacyViewpoints) {
|
|
54
|
+
L.push(`| VP-${v.vpGroup}-${String(n).padStart(3, '0')} | Medium | legacy suite: ${v.count} testcase(s) |`);
|
|
55
|
+
n++;
|
|
56
|
+
}
|
|
57
|
+
for (const b of r.blindSpots) {
|
|
58
|
+
L.push(`| VP-GAP-${String(n).padStart(3, '0')} | High | ⚠ BLIND-SPOT — catalog expects "${b.theme}" (${b.status}); legacy has none |`);
|
|
59
|
+
n++;
|
|
60
|
+
}
|
|
61
|
+
if (r.universalGaps.length)
|
|
62
|
+
L.push('', `> Universal reminders not covered: ${r.universalGaps.join(', ')}`);
|
|
63
|
+
return L.join('\n') + '\n';
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=reconcile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.js","sourceRoot":"","sources":["../../src/ingest/reconcile.ts"],"names":[],"mappings":";;AAmCA,kDAqBC;AAGD,0DAoBC;AApED,qDAAwD;AACxD,gDAAgE;AAYhE,SAAS,SAAS,CAAC,QAAgB;IACjC,MAAM,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACzC,IAAI,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,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