norn-cli 2.2.2 → 2.4.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 (113) hide show
  1. package/.claude/settings.local.json +18 -0
  2. package/.claude/skills/norn-social-campaign/SKILL.md +70 -0
  3. package/CHANGELOG.md +22 -1
  4. package/LICENSE +20 -29
  5. package/README.md +32 -1
  6. package/demos/nornenv-region-refactor/README.md +64 -0
  7. package/demos/nornenv-showcase/README.md +62 -0
  8. package/demos/nornenv-showcase/norn.config.json +16 -0
  9. package/demos/nornenv-showcase/showcase.norn +70 -0
  10. package/demos/nornenv-showcase/showcase.nornapi +26 -0
  11. package/demos/nornenv-showcase/showcase.nornsql +20 -0
  12. package/dist/cli.js +564 -54
  13. package/out/apiResponseIntellisenseCache.js +394 -0
  14. package/out/assertionRunner.js +567 -0
  15. package/out/cacheDir.js +136 -0
  16. package/out/chatParticipant.js +763 -0
  17. package/out/cli/colors.js +127 -0
  18. package/out/cli/formatters/assertion.js +102 -0
  19. package/out/cli/formatters/index.js +23 -0
  20. package/out/cli/formatters/response.js +106 -0
  21. package/out/cli/formatters/summary.js +246 -0
  22. package/out/cli/redaction.js +237 -0
  23. package/out/cli/reporters/html.js +689 -0
  24. package/out/cli/reporters/index.js +22 -0
  25. package/out/cli/reporters/junit.js +226 -0
  26. package/out/codeLensProvider.js +351 -0
  27. package/out/compareContentProvider.js +85 -0
  28. package/out/completionProvider.js +3739 -0
  29. package/out/contractAssertionSummary.js +225 -0
  30. package/out/contractDecorationProvider.js +243 -0
  31. package/out/coverageCalculator.js +879 -0
  32. package/out/coveragePanel.js +597 -0
  33. package/out/debug/breakpointResolver.js +84 -0
  34. package/out/debug/breakpoints.js +52 -0
  35. package/out/debug/nornDebugAdapter.js +166 -0
  36. package/out/debug/nornDebugSession.js +613 -0
  37. package/out/debug/sequenceLocationIndex.js +77 -0
  38. package/out/debug/types.js +3 -0
  39. package/out/deepClone.js +21 -0
  40. package/out/diagnosticProvider.js +2554 -0
  41. package/out/environmentParser.js +736 -0
  42. package/out/environmentProvider.js +544 -0
  43. package/out/environmentTemplates.js +146 -0
  44. package/out/errors/formatError.js +113 -0
  45. package/out/errors/nornError.js +29 -0
  46. package/out/formUrlEncoded.js +89 -0
  47. package/out/httpClient.js +348 -0
  48. package/out/httpRuntimeOptions.js +16 -0
  49. package/out/importErrors.js +31 -0
  50. package/out/inlayHintResolver.js +70 -0
  51. package/out/jsonFileReader.js +323 -0
  52. package/out/mcpClient.js +193 -0
  53. package/out/mcpConfig.js +184 -0
  54. package/out/mcpToolIntellisenseCache.js +96 -0
  55. package/out/mcpToolSchema.js +50 -0
  56. package/out/nornConfig.js +132 -0
  57. package/out/nornHoverProvider.js +124 -0
  58. package/out/nornInlayHintsProvider.js +191 -0
  59. package/out/nornPrompt.js +755 -0
  60. package/out/nornSqlParser.js +286 -0
  61. package/out/nornapiHoverProvider.js +135 -0
  62. package/out/nornapiInlayHintsProvider.js +94 -0
  63. package/out/nornapiParser.js +324 -0
  64. package/out/nornenvCodeActionProvider.js +101 -0
  65. package/out/nornenvDecorationProvider.js +239 -0
  66. package/out/nornenvFoldingProvider.js +63 -0
  67. package/out/nornenvHoverProvider.js +114 -0
  68. package/out/nornenvInlayHintsProvider.js +99 -0
  69. package/out/nornenvLanguageModel.js +187 -0
  70. package/out/nornenvRegionRefactor.js +267 -0
  71. package/out/nornsqlHoverProvider.js +95 -0
  72. package/out/nornsqlInlayHintsProvider.js +114 -0
  73. package/out/parser.js +839 -0
  74. package/out/pathAccess.js +28 -0
  75. package/out/postmanImportPanel.js +732 -0
  76. package/out/postmanImportPlanner.js +1155 -0
  77. package/out/postmanImportSidebarView.js +532 -0
  78. package/out/quotedString.js +35 -0
  79. package/out/requestPreparation.js +179 -0
  80. package/out/requestValidation.js +146 -0
  81. package/out/responsePanel.js +7754 -0
  82. package/out/schemaGenerator.js +562 -0
  83. package/out/scriptRunner.js +419 -0
  84. package/out/secrets/cliSecrets.js +415 -0
  85. package/out/secrets/crypto.js +105 -0
  86. package/out/secrets/envFileSecrets.js +177 -0
  87. package/out/secrets/keyStore.js +259 -0
  88. package/out/sequenceDeclaration.js +15 -0
  89. package/out/sequenceRunner.js +3590 -0
  90. package/out/sqlAdapterRunner.js +122 -0
  91. package/out/sqlBuiltInAdapters.js +604 -0
  92. package/out/sqlConfig.js +184 -0
  93. package/out/starterCatalog.js +554 -0
  94. package/out/stringUtils.js +25 -0
  95. package/out/swaggerBodyIntellisenseCache.js +114 -0
  96. package/out/swaggerParser.js +464 -0
  97. package/out/testProvider.js +767 -0
  98. package/out/theoryCaseLoader.js +113 -0
  99. package/out/validationCache.js +211 -0
  100. package/package.json +38 -11
  101. package/.kanbn/index.md +0 -31
  102. package/.kanbn/tasks/book-first-mentor-session.md +0 -13
  103. package/.kanbn/tasks/decide-what-success-in-a-pilot-looks-like.md +0 -9
  104. package/.kanbn/tasks/do-5-customer-conversations.md +0 -9
  105. package/.kanbn/tasks/finalise-the-one-line-pitch.md +0 -11
  106. package/.kanbn/tasks/interview-script.md +0 -49
  107. package/.kanbn/tasks/make-a-list-of-10-people-to-speak-to.md +0 -11
  108. package/.kanbn/tasks/prepare-your-customer-interview-questions.md +0 -11
  109. package/.kanbn/tasks/recruit-2/342/200/2233-pilot-users.md +0 -9
  110. package/.kanbn/tasks/refine-your-pitch.md +0 -9
  111. package/.kanbn/tasks/use-the-shiplight-website-as-a-template-to-improve-norn-website.md +0 -9
  112. package/.kanbn/tasks/write-down-repeated-wording.md +0 -9
  113. package/.kanbn/tasks/write-the-one-pager.md +0 -27
@@ -0,0 +1,689 @@
1
+ "use strict";
2
+ /**
3
+ * HTML reporter - generates self-contained HTML reports
4
+ *
5
+ * Features:
6
+ * - Fully self-contained (embedded CSS/JS, no external dependencies)
7
+ * - Collapsible sections for requests/responses
8
+ * - Color-coded pass/fail status
9
+ * - Request/response details expandable on click
10
+ * - Summary statistics with charts
11
+ * - Works offline
12
+ */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.generateHtmlReport = generateHtmlReport;
48
+ exports.generateHtmlReportFromResponse = generateHtmlReportFromResponse;
49
+ const fs = __importStar(require("fs"));
50
+ const redaction_1 = require("../redaction");
51
+ /**
52
+ * Escape HTML special characters
53
+ */
54
+ function escapeHtml(text) {
55
+ return text
56
+ .replace(/&/g, '&amp;')
57
+ .replace(/</g, '&lt;')
58
+ .replace(/>/g, '&gt;')
59
+ .replace(/"/g, '&quot;')
60
+ .replace(/'/g, '&#039;');
61
+ }
62
+ /**
63
+ * Format duration in human-readable form
64
+ */
65
+ function formatDuration(ms) {
66
+ if (ms < 1000) {
67
+ return `${ms}ms`;
68
+ }
69
+ return `${(ms / 1000).toFixed(2)}s`;
70
+ }
71
+ /**
72
+ * Format timestamp
73
+ */
74
+ function formatTimestamp() {
75
+ return new Date().toISOString().replace('T', ' ').replace(/\.\d+Z$/, ' UTC');
76
+ }
77
+ /**
78
+ * Generate HTML report from sequence results
79
+ */
80
+ function generateHtmlReport(results, options) {
81
+ const { outputPath, redaction, title = 'Norn Test Report', environment } = options;
82
+ const totalSequences = results.length;
83
+ const passedSequences = results.filter(r => r.success).length;
84
+ const failedSequences = totalSequences - passedSequences;
85
+ const totalAssertions = results.reduce((sum, r) => sum + (r.assertionResults?.length || 0), 0);
86
+ const passedAssertions = results.reduce((sum, r) => sum + (r.assertionResults?.filter(a => a.passed).length || 0), 0);
87
+ const failedAssertions = totalAssertions - passedAssertions;
88
+ const totalRequests = results.reduce((sum, r) => sum + r.steps.filter(s => s.type === 'request').length, 0);
89
+ const totalDuration = results.reduce((sum, r) => sum + r.duration, 0);
90
+ // Sort results: failed first, then by name
91
+ const sortedResults = [...results].sort((a, b) => {
92
+ if (a.success !== b.success) {
93
+ return a.success ? 1 : -1;
94
+ }
95
+ return a.name.localeCompare(b.name);
96
+ });
97
+ const passRate = totalSequences > 0 ? Math.round((passedSequences / totalSequences) * 100) : 100;
98
+ const html = `<!DOCTYPE html>
99
+ <html lang="en">
100
+ <head>
101
+ <meta charset="UTF-8">
102
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
103
+ <title>${escapeHtml(title)}</title>
104
+ <style>
105
+ ${getEmbeddedCSS()}
106
+ </style>
107
+ </head>
108
+ <body>
109
+ <div class="container">
110
+ <header>
111
+ <h1>${escapeHtml(title)}</h1>
112
+ <div class="header-meta">
113
+ <span class="timestamp">Generated: ${formatTimestamp()}</span>
114
+ ${environment ? `<span class="environment">Environment: <strong>${escapeHtml(environment)}</strong></span>` : ''}
115
+ </div>
116
+ </header>
117
+
118
+ <section class="summary">
119
+ <div class="summary-header">
120
+ <h2>Summary</h2>
121
+ <div class="pass-rate ${passRate === 100 ? 'perfect' : passRate >= 80 ? 'good' : 'poor'}">
122
+ <span class="rate-value">${passRate}%</span>
123
+ <span class="rate-label">Pass Rate</span>
124
+ </div>
125
+ </div>
126
+ <div class="stats-grid">
127
+ <div class="stat-card clickable ${failedSequences > 0 ? 'has-failures' : 'all-passed'}" onclick="filterByStatus('all')" data-filter="all">
128
+ <div class="stat-value">${totalSequences}</div>
129
+ <div class="stat-label">Total Tests</div>
130
+ </div>
131
+ <div class="stat-card clickable ${passedSequences > 0 ? 'all-passed' : ''}" onclick="filterByStatus('passed')" data-filter="passed">
132
+ <div class="stat-value">${passedSequences}</div>
133
+ <div class="stat-label">Passed</div>
134
+ </div>
135
+ <div class="stat-card clickable ${failedSequences > 0 ? 'has-failures' : ''}" onclick="filterByStatus('failed')" data-filter="failed">
136
+ <div class="stat-value">${failedSequences}</div>
137
+ <div class="stat-label">Failed</div>
138
+ </div>
139
+ <div class="stat-card">
140
+ <div class="stat-value">${formatDuration(totalDuration)}</div>
141
+ <div class="stat-label">Total Duration</div>
142
+ </div>
143
+ </div>
144
+
145
+ <div class="progress-bar">
146
+ <div class="progress-fill ${failedSequences > 0 ? 'has-failures' : 'all-passed'}"
147
+ style="width: ${totalSequences > 0 ? (passedSequences / totalSequences * 100) : 100}%"></div>
148
+ </div>
149
+ </section>
150
+
151
+ <section class="controls">
152
+ <div class="filter-bar">
153
+ <input type="text" id="search-input" placeholder="Search tests..." onkeyup="filterTests()">
154
+ <div class="filter-buttons">
155
+ <button class="filter-btn active" data-filter="all" onclick="setFilter('all')">All (${totalSequences})</button>
156
+ <button class="filter-btn" data-filter="passed" onclick="setFilter('passed')">Passed (${passedSequences})</button>
157
+ <button class="filter-btn" data-filter="failed" onclick="setFilter('failed')">Failed (${failedSequences})</button>
158
+ </div>
159
+ </div>
160
+ <div class="action-buttons">
161
+ <button class="action-btn" onclick="expandAll()">Expand All</button>
162
+ <button class="action-btn" onclick="collapseAll()">Collapse All</button>
163
+ </div>
164
+ </section>
165
+
166
+ <section class="results">
167
+ <h2>Test Results</h2>
168
+ <div id="results-container">
169
+ ${sortedResults.map((r, i) => generateSequenceHtml(r, i, redaction)).join('\n')}
170
+ </div>
171
+ <div id="no-results" class="no-results" style="display: none;">
172
+ No tests match your filter criteria.
173
+ </div>
174
+ </section>
175
+ </div>
176
+
177
+ <script>
178
+ ${getEmbeddedJS()}
179
+ </script>
180
+ </body>
181
+ </html>`;
182
+ fs.writeFileSync(outputPath, html, 'utf-8');
183
+ }
184
+ /**
185
+ * Generate HTML for a single sequence result
186
+ */
187
+ function generateSequenceHtml(result, index, redaction) {
188
+ const statusClass = result.success ? 'passed' : 'failed';
189
+ const statusIcon = result.success ? '✓' : '✗';
190
+ const assertionCount = result.assertionResults?.length || 0;
191
+ const passedAssertions = result.assertionResults?.filter(a => a.passed).length || 0;
192
+ const requestCount = result.steps.filter(s => s.type === 'request').length;
193
+ const mcpCount = result.steps.filter(s => s.type === 'mcp').length;
194
+ return `
195
+ <div class="sequence ${statusClass}" data-sequence="${index}">
196
+ <div class="sequence-header" onclick="toggleSequence(${index})">
197
+ <span class="status-icon">${statusIcon}</span>
198
+ <span class="sequence-name">${escapeHtml(result.name)}</span>
199
+ <span class="sequence-meta">
200
+ <span class="badge">${requestCount} requests</span>
201
+ ${mcpCount > 0 ? `<span class="badge">${mcpCount} MCP</span>` : ''}
202
+ ${assertionCount > 0 ? `<span class="badge ${passedAssertions === assertionCount ? 'passed' : 'failed'}">${passedAssertions}/${assertionCount} assertions</span>` : ''}
203
+ <span class="badge duration">${formatDuration(result.duration)}</span>
204
+ </span>
205
+ <span class="chevron">▼</span>
206
+ </div>
207
+ <div class="sequence-body" id="sequence-body-${index}" style="display: none;">
208
+ ${generateStepsHtml(result.steps, index, redaction)}
209
+ ${result.errors.length > 0 ? generateErrorsHtml(result.errors, redaction) : ''}
210
+ </div>
211
+ </div>`;
212
+ }
213
+ /**
214
+ * Generate HTML for sequence steps
215
+ */
216
+ function generateStepsHtml(steps, sequenceIndex, redaction) {
217
+ let html = '<div class="steps">';
218
+ let requestIndex = 0;
219
+ for (let i = 0; i < steps.length; i++) {
220
+ const step = steps[i];
221
+ switch (step.type) {
222
+ case 'request':
223
+ html += generateRequestHtml(step, sequenceIndex, requestIndex++, redaction);
224
+ break;
225
+ case 'assertion':
226
+ html += generateAssertionHtml(step, redaction);
227
+ break;
228
+ case 'print':
229
+ html += generatePrintHtml(step);
230
+ break;
231
+ case 'script':
232
+ html += generateScriptHtml(step);
233
+ break;
234
+ case 'sql':
235
+ html += generateSqlHtml(step);
236
+ break;
237
+ case 'mcp':
238
+ html += generateMcpHtml(step);
239
+ break;
240
+ }
241
+ }
242
+ html += '</div>';
243
+ return html;
244
+ }
245
+ /**
246
+ * Generate HTML for a request step
247
+ */
248
+ function generateRequestHtml(step, seqIndex, reqIndex, redaction) {
249
+ if (!step.response) {
250
+ return '';
251
+ }
252
+ const response = step.response;
253
+ const isSuccess = response.status >= 200 && response.status < 300;
254
+ const statusClass = isSuccess ? 'passed' : 'failed';
255
+ const method = step.requestMethod || 'REQUEST';
256
+ const url = step.requestUrl ? (0, redaction_1.redactUrl)(step.requestUrl, redaction) : 'unknown';
257
+ // Show variable name if available (e.g., "user = GET /api/users/1")
258
+ const varLabel = step.variableName ? `<span class="var-label">${escapeHtml(step.variableName)}</span><span class="var-equals">=</span>` : '';
259
+ const bodyHtml = response.body ? generateBodyHtml(response.body, redaction) : '<em>No body</em>';
260
+ const headersHtml = response.headers ? generateHeadersHtml(response.headers, redaction) : '';
261
+ return `
262
+ <div class="step request ${statusClass}">
263
+ <div class="step-header" onclick="toggleStep('step-${seqIndex}-${reqIndex}')">
264
+ ${varLabel}
265
+ <span class="method">${escapeHtml(method)}</span>
266
+ <span class="url">${escapeHtml(url)}</span>
267
+ <span class="status-code">${response.status} ${escapeHtml(response.statusText)}</span>
268
+ <span class="duration">${formatDuration(response.duration)}</span>
269
+ <span class="chevron">▶</span>
270
+ </div>
271
+ <div class="step-body" id="step-${seqIndex}-${reqIndex}" style="display: none;">
272
+ <div class="response-section">
273
+ <h4>Response Headers</h4>
274
+ ${headersHtml || '<em>No headers</em>'}
275
+ </div>
276
+ <div class="response-section">
277
+ <h4>Response Body</h4>
278
+ <pre class="body-content">${bodyHtml}</pre>
279
+ </div>
280
+ </div>
281
+ </div>`;
282
+ }
283
+ function generateMcpHtml(step) {
284
+ if (!step.mcp) {
285
+ return '';
286
+ }
287
+ const isList = step.mcp.operation === 'list';
288
+ const summary = isList
289
+ ? `${step.mcp.tools?.length || 0} tools`
290
+ : (step.mcp.result?.isError ? 'Error' : 'OK');
291
+ const title = isList ? 'mcp list' : 'mcp call';
292
+ const target = isList
293
+ ? step.mcp.serverAlias
294
+ : `${step.mcp.serverAlias}.${step.mcp.toolName || ''}`;
295
+ const output = isList ? (step.mcp.tools || []) : (step.mcp.result || {});
296
+ return `
297
+ <div class="step script">
298
+ <div class="step-header" onclick="toggleNested(this)">
299
+ <span class="step-type">${escapeHtml(title)}</span>
300
+ <span class="step-label">${escapeHtml(target)}</span>
301
+ ${step.variableName ? `<span class="var-label">→ ${escapeHtml(step.variableName)}</span>` : ''}
302
+ <span class="status-badge ${step.mcp.result?.isError ? 'failed' : 'passed'}">${escapeHtml(summary)}</span>
303
+ </div>
304
+ <div class="step-content" style="display: none;">
305
+ <pre>${escapeHtml(JSON.stringify(output, null, 2))}</pre>
306
+ </div>
307
+ </div>`;
308
+ }
309
+ function generateSqlHtml(step) {
310
+ if (!step.sql) {
311
+ return '';
312
+ }
313
+ const summary = step.sql.operationType === 'query'
314
+ ? `${step.sql.rowCount ?? 0} rows`
315
+ : `${step.sql.affectedRows ?? 0} affected`;
316
+ return `
317
+ <div class="step print">
318
+ <div class="step-line">
319
+ <span class="step-icon">🗄</span>
320
+ <span class="step-label">SQL</span>
321
+ <span class="step-text">${escapeHtml(step.sql.operationName)} (${escapeHtml(summary)})</span>
322
+ </div>
323
+ </div>`;
324
+ }
325
+ /**
326
+ * Generate HTML for response headers
327
+ */
328
+ function generateHeadersHtml(headers, redaction) {
329
+ const redactedHeaders = (0, redaction_1.redactHeaders)(headers, redaction);
330
+ return '<table class="headers-table">' +
331
+ Object.entries(redactedHeaders)
332
+ .map(([k, v]) => `<tr><td class="header-name">${escapeHtml(k)}</td><td class="header-value">${escapeHtml(v)}</td></tr>`)
333
+ .join('') +
334
+ '</table>';
335
+ }
336
+ /**
337
+ * Generate HTML for response body
338
+ */
339
+ function generateBodyHtml(body, redaction) {
340
+ const redactedBody = (0, redaction_1.redactBody)(body, redaction);
341
+ if (typeof redactedBody === 'object') {
342
+ try {
343
+ return escapeHtml(JSON.stringify(redactedBody, null, 2));
344
+ }
345
+ catch {
346
+ return escapeHtml(String(redactedBody));
347
+ }
348
+ }
349
+ return escapeHtml(String(redactedBody));
350
+ }
351
+ /**
352
+ * Generate HTML for an assertion step
353
+ */
354
+ function generateAssertionHtml(step, redaction) {
355
+ if (!step.assertion) {
356
+ return '';
357
+ }
358
+ const assertion = step.assertion;
359
+ const statusClass = assertion.passed ? 'passed' : 'failed';
360
+ const statusIcon = assertion.passed ? '✓' : '✗';
361
+ // Use friendly name if available, otherwise fall back to expression
362
+ const displayText = assertion.friendlyName || assertion.message || assertion.expression;
363
+ let detailsHtml = '';
364
+ if (!assertion.passed) {
365
+ // Format actual value nicely
366
+ let actualDisplay = '';
367
+ if (assertion.leftValue === undefined) {
368
+ actualDisplay = 'undefined';
369
+ }
370
+ else if (assertion.leftValue === null) {
371
+ actualDisplay = 'null';
372
+ }
373
+ else if (typeof assertion.leftValue === 'object') {
374
+ actualDisplay = JSON.stringify(assertion.leftValue, null, 2);
375
+ }
376
+ else {
377
+ actualDisplay = String(assertion.leftValue);
378
+ }
379
+ // Show jsonPath if available for context
380
+ const pathInfo = assertion.jsonPath ? `<div class="assertion-path"><strong>Path:</strong> <code>${escapeHtml(assertion.jsonPath)}</code></div>` : '';
381
+ detailsHtml = `
382
+ <div class="assertion-details">
383
+ ${pathInfo}
384
+ <div><strong>Expected:</strong> <code>${escapeHtml(String(assertion.rightExpression || assertion.rightValue))}</code></div>
385
+ <div><strong>Actual:</strong> <code>${escapeHtml(actualDisplay)}</code></div>
386
+ ${assertion.error ? `<div class="error"><strong>Error:</strong> ${escapeHtml((0, redaction_1.redactString)(assertion.error, redaction))}</div>` : ''}
387
+ </div>`;
388
+ }
389
+ return `
390
+ <div class="step assertion ${statusClass}">
391
+ <span class="status-icon">${statusIcon}</span>
392
+ <span class="assertion-text">${escapeHtml(displayText)}</span>
393
+ ${detailsHtml}
394
+ </div>`;
395
+ }
396
+ /**
397
+ * Generate HTML for a print step
398
+ */
399
+ function generatePrintHtml(step) {
400
+ if (!step.print) {
401
+ return '';
402
+ }
403
+ return `
404
+ <div class="step print">
405
+ <span class="print-icon">📝</span>
406
+ <span class="print-text">${escapeHtml(step.print.title)}</span>
407
+ ${step.print.body ? `<div class="print-body">${escapeHtml(step.print.body)}</div>` : ''}
408
+ </div>`;
409
+ }
410
+ /**
411
+ * Generate HTML for a script step
412
+ */
413
+ function generateScriptHtml(step) {
414
+ if (!step.script) {
415
+ return '';
416
+ }
417
+ const statusClass = step.script.success ? 'passed' : 'failed';
418
+ const statusIcon = step.script.success ? '✓' : '✗';
419
+ return `
420
+ <div class="step script ${statusClass}">
421
+ <span class="status-icon">${statusIcon}</span>
422
+ <span class="script-type">[${escapeHtml(step.script.type)}]</span>
423
+ ${step.script.error ? `<div class="error">${escapeHtml(step.script.error)}</div>` : ''}
424
+ </div>`;
425
+ }
426
+ /**
427
+ * Generate HTML for errors
428
+ */
429
+ function generateErrorsHtml(errors, redaction) {
430
+ return `
431
+ <div class="errors">
432
+ <h4>Errors</h4>
433
+ <ul>
434
+ ${errors.map(e => `<li>${escapeHtml((0, redaction_1.redactString)(e, redaction)).replace(/\n/g, '<br>')}</li>`).join('\n')}
435
+ </ul>
436
+ </div>`;
437
+ }
438
+ /**
439
+ * Get embedded CSS styles
440
+ */
441
+ function getEmbeddedCSS() {
442
+ return `
443
+ * { box-sizing: border-box; margin: 0; padding: 0; }
444
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif; background: #1e1e1e; color: #d4d4d4; line-height: 1.6; }
445
+ .container { max-width: 1200px; margin: 0 auto; padding: 20px; }
446
+ header { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #333; }
447
+ header h1 { color: #fff; font-size: 2em; margin-bottom: 10px; }
448
+ .header-meta { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
449
+ .timestamp { color: #888; font-size: 0.9em; }
450
+ .environment { color: #888; font-size: 0.9em; }
451
+ .environment strong { color: #569cd6; }
452
+ h2 { color: #fff; margin-bottom: 15px; font-size: 1.4em; }
453
+
454
+ .summary { background: #252526; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
455
+ .summary-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
456
+ .pass-rate { text-align: center; padding: 10px 20px; border-radius: 8px; }
457
+ .pass-rate.perfect { background: #1e3a2f; }
458
+ .pass-rate.good { background: #2a3a1e; }
459
+ .pass-rate.poor { background: #3a1e1e; }
460
+ .rate-value { display: block; font-size: 2em; font-weight: bold; }
461
+ .pass-rate.perfect .rate-value { color: #4ec9b0; }
462
+ .pass-rate.good .rate-value { color: #b5cea8; }
463
+ .pass-rate.poor .rate-value { color: #f14c4c; }
464
+ .rate-label { font-size: 0.8em; color: #888; }
465
+
466
+ .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 20px; }
467
+ .stat-card { background: #1e1e1e; border-radius: 6px; padding: 15px; text-align: center; transition: transform 0.2s, box-shadow 0.2s; }
468
+ .stat-card.clickable { cursor: pointer; }
469
+ .stat-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
470
+ .stat-card.all-passed { border-left: 4px solid #4ec9b0; }
471
+ .stat-card.has-failures { border-left: 4px solid #f14c4c; }
472
+ .stat-value { font-size: 2em; font-weight: bold; color: #fff; }
473
+ .stat-label { color: #888; font-size: 0.85em; margin-top: 5px; }
474
+
475
+ .controls { background: #252526; border-radius: 8px; padding: 15px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
476
+ .filter-bar { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; flex: 1; }
477
+ #search-input { background: #1e1e1e; border: 1px solid #333; border-radius: 4px; padding: 8px 12px; color: #d4d4d4; min-width: 200px; font-size: 0.9em; }
478
+ #search-input:focus { outline: none; border-color: #569cd6; }
479
+ #search-input::placeholder { color: #666; }
480
+ .filter-buttons { display: flex; gap: 5px; }
481
+ .filter-btn { background: #1e1e1e; border: 1px solid #333; border-radius: 4px; padding: 8px 16px; color: #888; cursor: pointer; font-size: 0.9em; transition: all 0.2s; }
482
+ .filter-btn:hover { border-color: #569cd6; color: #d4d4d4; }
483
+ .filter-btn.active { background: #264f78; border-color: #264f78; color: #fff; }
484
+ .action-buttons { display: flex; gap: 10px; }
485
+ .action-btn { background: transparent; border: 1px solid #444; border-radius: 4px; padding: 8px 16px; color: #888; cursor: pointer; font-size: 0.85em; transition: all 0.2s; }
486
+ .action-btn:hover { border-color: #666; color: #d4d4d4; }
487
+
488
+ .no-results { text-align: center; padding: 40px; color: #888; font-size: 1.1em; }
489
+
490
+ .progress-bar { height: 8px; background: #333; border-radius: 4px; overflow: hidden; }
491
+ .progress-fill { height: 100%; transition: width 0.3s; }
492
+ .progress-fill.all-passed { background: #4ec9b0; }
493
+ .progress-fill.has-failures { background: linear-gradient(90deg, #4ec9b0, #f14c4c); }
494
+
495
+ .sequence { background: #252526; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
496
+ .sequence.passed .sequence-header { border-left: 4px solid #4ec9b0; }
497
+ .sequence.failed .sequence-header { border-left: 4px solid #f14c4c; }
498
+ .sequence-header { padding: 15px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
499
+ .sequence-header:hover { background: #2d2d2d; }
500
+ .status-icon { font-size: 1.2em; }
501
+ .sequence.passed .status-icon { color: #4ec9b0; }
502
+ .sequence.failed .status-icon { color: #f14c4c; }
503
+ .sequence-name { font-weight: 600; color: #fff; flex: 1; }
504
+ .sequence-meta { display: flex; gap: 8px; }
505
+ .badge { background: #333; padding: 2px 8px; border-radius: 4px; font-size: 0.8em; }
506
+ .badge.passed { background: #1e3a2f; color: #4ec9b0; }
507
+ .badge.failed { background: #3a1e1e; color: #f14c4c; }
508
+ .badge.duration { background: #1e2d3a; color: #569cd6; }
509
+ .chevron { color: #888; transition: transform 0.2s; }
510
+ .sequence.open .chevron { transform: rotate(180deg); }
511
+
512
+ .sequence-body { padding: 15px; border-top: 1px solid #333; }
513
+ .steps { display: flex; flex-direction: column; gap: 8px; }
514
+
515
+ .step { padding: 10px 15px; border-radius: 4px; background: #1e1e1e; }
516
+ .step.request { border-left: 3px solid #569cd6; }
517
+ .step.request.failed { border-left-color: #f14c4c; }
518
+ .step.assertion { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
519
+ .step.assertion.passed { border-left: 3px solid #4ec9b0; }
520
+ .step.assertion.failed { border-left: 3px solid #f14c4c; }
521
+ .step.print { border-left: 3px solid #dcdcaa; }
522
+ .step.script { border-left: 3px solid #c586c0; }
523
+
524
+ .step-header { display: flex; align-items: center; gap: 10px; cursor: pointer; }
525
+ .step-header:hover { opacity: 0.9; }
526
+ .var-label { color: #4fc1ff; font-family: monospace; font-weight: 500; }
527
+ .var-equals { color: #d4d4d4; margin-right: 5px; }
528
+ .method { background: #264f78; color: #fff; padding: 2px 6px; border-radius: 3px; font-size: 0.8em; font-weight: 600; }
529
+ .url { flex: 1; color: #9cdcfe; font-family: monospace; font-size: 0.9em; word-break: break-all; }
530
+ .status-code { font-weight: 600; }
531
+ .step.request.passed .status-code { color: #4ec9b0; }
532
+ .step.request.failed .status-code { color: #f14c4c; }
533
+ .duration { color: #888; font-size: 0.85em; }
534
+
535
+ .step-body { margin-top: 15px; padding-top: 15px; border-top: 1px solid #333; }
536
+ .response-section { margin-bottom: 15px; }
537
+ .response-section h4 { color: #888; font-size: 0.9em; margin-bottom: 8px; }
538
+ .headers-table { width: 100%; font-size: 0.85em; }
539
+ .headers-table td { padding: 4px 8px; border-bottom: 1px solid #333; }
540
+ .header-name { color: #9cdcfe; font-family: monospace; width: 200px; }
541
+ .header-value { color: #ce9178; font-family: monospace; word-break: break-all; }
542
+ .body-content { background: #1a1a1a; padding: 15px; border-radius: 4px; overflow-x: auto; font-size: 0.85em; color: #d4d4d4; white-space: pre-wrap; word-break: break-word; }
543
+
544
+ .assertion-text { font-family: monospace; }
545
+ .assertion-details { width: 100%; margin-top: 8px; padding: 10px; background: #1a1a1a; border-radius: 4px; font-size: 0.9em; }
546
+ .assertion-details div { margin-bottom: 5px; }
547
+ .assertion-details code { background: #2d2d2d; padding: 2px 6px; border-radius: 3px; font-family: monospace; color: #ce9178; }
548
+ .assertion-path { color: #888; }
549
+ .assertion-path code { color: #9cdcfe; }
550
+
551
+ .print-icon { font-size: 1em; }
552
+ .print-text { color: #dcdcaa; }
553
+ .print-body { margin-top: 5px; color: #888; font-size: 0.9em; }
554
+
555
+ .script-type { color: #c586c0; font-family: monospace; }
556
+
557
+ .error { color: #f14c4c; }
558
+ .errors { margin-top: 15px; padding: 15px; background: #3a1e1e; border-radius: 4px; }
559
+ .errors h4 { color: #f14c4c; margin-bottom: 10px; }
560
+ .errors ul { padding-left: 20px; }
561
+ .errors li { margin-bottom: 5px; }
562
+ `;
563
+ }
564
+ /**
565
+ * Get embedded JavaScript
566
+ */
567
+ function getEmbeddedJS() {
568
+ return `
569
+ let currentFilter = 'all';
570
+
571
+ function toggleSequence(index) {
572
+ const body = document.getElementById('sequence-body-' + index);
573
+ const sequence = body.closest('.sequence');
574
+ if (body.style.display === 'none') {
575
+ body.style.display = 'block';
576
+ sequence.classList.add('open');
577
+ } else {
578
+ body.style.display = 'none';
579
+ sequence.classList.remove('open');
580
+ }
581
+ }
582
+
583
+ function toggleStep(id) {
584
+ const body = document.getElementById(id);
585
+ const step = body.closest('.step');
586
+ const chevron = step.querySelector('.chevron');
587
+ if (body.style.display === 'none') {
588
+ body.style.display = 'block';
589
+ if (chevron) chevron.textContent = '▼';
590
+ } else {
591
+ body.style.display = 'none';
592
+ if (chevron) chevron.textContent = '▶';
593
+ }
594
+ }
595
+
596
+ function setFilter(filter) {
597
+ currentFilter = filter;
598
+ document.querySelectorAll('.filter-btn').forEach(btn => {
599
+ btn.classList.toggle('active', btn.dataset.filter === filter);
600
+ });
601
+ filterTests();
602
+ }
603
+
604
+ function filterByStatus(filter) {
605
+ setFilter(filter);
606
+ }
607
+
608
+ function filterTests() {
609
+ const searchTerm = document.getElementById('search-input').value.toLowerCase();
610
+ const sequences = document.querySelectorAll('.sequence');
611
+ let visibleCount = 0;
612
+
613
+ sequences.forEach(seq => {
614
+ const name = seq.querySelector('.sequence-name').textContent.toLowerCase();
615
+ const isPassed = seq.classList.contains('passed');
616
+ const isFailed = seq.classList.contains('failed');
617
+
618
+ let matchesFilter = currentFilter === 'all' ||
619
+ (currentFilter === 'passed' && isPassed) ||
620
+ (currentFilter === 'failed' && isFailed);
621
+
622
+ let matchesSearch = !searchTerm || name.includes(searchTerm);
623
+
624
+ if (matchesFilter && matchesSearch) {
625
+ seq.style.display = 'block';
626
+ visibleCount++;
627
+ } else {
628
+ seq.style.display = 'none';
629
+ }
630
+ });
631
+
632
+ document.getElementById('no-results').style.display = visibleCount === 0 ? 'block' : 'none';
633
+ }
634
+
635
+ function expandAll() {
636
+ document.querySelectorAll('.sequence').forEach(seq => {
637
+ if (seq.style.display !== 'none') {
638
+ const index = seq.dataset.sequence;
639
+ const body = document.getElementById('sequence-body-' + index);
640
+ if (body) {
641
+ body.style.display = 'block';
642
+ seq.classList.add('open');
643
+ }
644
+ }
645
+ });
646
+ }
647
+
648
+ function collapseAll() {
649
+ document.querySelectorAll('.sequence').forEach(seq => {
650
+ const index = seq.dataset.sequence;
651
+ const body = document.getElementById('sequence-body-' + index);
652
+ if (body) {
653
+ body.style.display = 'none';
654
+ seq.classList.remove('open');
655
+ }
656
+ });
657
+ }
658
+
659
+ // Expand all failed sequences by default
660
+ document.querySelectorAll('.sequence.failed').forEach((seq, i) => {
661
+ const index = seq.dataset.sequence;
662
+ if (index) toggleSequence(index);
663
+ });
664
+ `;
665
+ }
666
+ /**
667
+ * Generate HTML report from a single HTTP response
668
+ */
669
+ function generateHtmlReportFromResponse(response, testName, options) {
670
+ // Create a mock sequence result for the single request
671
+ const mockResult = {
672
+ name: testName,
673
+ success: response.status >= 200 && response.status < 300,
674
+ responses: [response],
675
+ scriptResults: [],
676
+ assertionResults: [],
677
+ steps: [{
678
+ type: 'request',
679
+ stepIndex: 0,
680
+ response,
681
+ requestMethod: 'REQUEST',
682
+ requestUrl: 'unknown'
683
+ }],
684
+ errors: [],
685
+ duration: response.duration
686
+ };
687
+ generateHtmlReport([mockResult], options);
688
+ }
689
+ //# sourceMappingURL=html.js.map