norn-cli 1.6.0 → 1.6.2

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 (40) hide show
  1. package/AGENTS.md +9 -1
  2. package/CHANGELOG.md +23 -0
  3. package/dist/cli.js +246 -80
  4. package/package.json +1 -1
  5. package/out/assertionRunner.js +0 -537
  6. package/out/chatParticipant.js +0 -722
  7. package/out/cli/colors.js +0 -129
  8. package/out/cli/formatters/assertion.js +0 -75
  9. package/out/cli/formatters/index.js +0 -23
  10. package/out/cli/formatters/response.js +0 -106
  11. package/out/cli/formatters/summary.js +0 -187
  12. package/out/cli/redaction.js +0 -237
  13. package/out/cli/reporters/html.js +0 -634
  14. package/out/cli/reporters/index.js +0 -22
  15. package/out/cli/reporters/junit.js +0 -211
  16. package/out/cli.js +0 -989
  17. package/out/codeLensProvider.js +0 -248
  18. package/out/compareContentProvider.js +0 -85
  19. package/out/completionProvider.js +0 -2404
  20. package/out/contractDecorationProvider.js +0 -243
  21. package/out/coverageCalculator.js +0 -837
  22. package/out/coveragePanel.js +0 -545
  23. package/out/diagnosticProvider.js +0 -1113
  24. package/out/environmentProvider.js +0 -442
  25. package/out/extension.js +0 -1114
  26. package/out/httpClient.js +0 -269
  27. package/out/jsonFileReader.js +0 -320
  28. package/out/nornPrompt.js +0 -580
  29. package/out/nornapiParser.js +0 -326
  30. package/out/parser.js +0 -725
  31. package/out/responsePanel.js +0 -4674
  32. package/out/schemaGenerator.js +0 -393
  33. package/out/scriptRunner.js +0 -419
  34. package/out/sequenceRunner.js +0 -3046
  35. package/out/swaggerBodyIntellisenseCache.js +0 -147
  36. package/out/swaggerParser.js +0 -419
  37. package/out/test/coverageCalculator.test.js +0 -100
  38. package/out/test/extension.test.js +0 -48
  39. package/out/testProvider.js +0 -658
  40. package/out/validationCache.js +0 -245
package/out/cli/colors.js DELETED
@@ -1,129 +0,0 @@
1
- "use strict";
2
- /**
3
- * CLI color utilities using chalk with NO_COLOR support
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.initColors = initColors;
7
- exports.getStatusColor = getStatusColor;
8
- exports.formatDuration = formatDuration;
9
- exports.line = line;
10
- exports.doubleLine = doubleLine;
11
- // Chalk v5 is ESM-only, so we need dynamic import
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
- let chalkInstance = null;
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- async function getChalk() {
16
- if (!chalkInstance) {
17
- const chalk = await import('chalk');
18
- chalkInstance = chalk.default;
19
- }
20
- return chalkInstance;
21
- }
22
- /**
23
- * Check if colors should be disabled
24
- * Respects NO_COLOR environment variable (https://no-color.org/)
25
- */
26
- function shouldDisableColors() {
27
- return (process.env.NO_COLOR !== undefined ||
28
- process.env.FORCE_COLOR === '0' ||
29
- !process.stdout.isTTY);
30
- }
31
- /**
32
- * Create a no-op color function for when colors are disabled
33
- */
34
- function noColor(text) {
35
- return text;
36
- }
37
- /**
38
- * Plain text colors (no ANSI codes)
39
- */
40
- const plainColors = {
41
- success: noColor,
42
- error: noColor,
43
- warning: noColor,
44
- info: noColor,
45
- dim: noColor,
46
- bold: noColor,
47
- httpSuccess: noColor,
48
- httpRedirect: noColor,
49
- httpClientError: noColor,
50
- httpServerError: noColor,
51
- url: noColor,
52
- method: noColor,
53
- duration: noColor,
54
- header: noColor,
55
- headerValue: noColor,
56
- checkmark: '✓',
57
- cross: '✗',
58
- bullet: '•',
59
- arrow: '→',
60
- };
61
- /**
62
- * Initialize colors - call this once at CLI startup
63
- */
64
- async function initColors() {
65
- if (shouldDisableColors()) {
66
- return plainColors;
67
- }
68
- const chalk = await getChalk();
69
- return {
70
- success: (text) => chalk.green(text),
71
- error: (text) => chalk.red(text),
72
- warning: (text) => chalk.yellow(text),
73
- info: (text) => chalk.cyan(text),
74
- dim: (text) => chalk.dim(text),
75
- bold: (text) => chalk.bold(text),
76
- httpSuccess: (text) => chalk.green(text),
77
- httpRedirect: (text) => chalk.cyan(text),
78
- httpClientError: (text) => chalk.red(text),
79
- httpServerError: (text) => chalk.magenta(text),
80
- url: (text) => chalk.underline(text),
81
- method: (text) => chalk.bold.cyan(text),
82
- duration: (text) => chalk.dim(text),
83
- header: (text) => chalk.dim(text),
84
- headerValue: (text) => chalk.dim(text),
85
- checkmark: chalk.green('✓'),
86
- cross: chalk.red('✗'),
87
- bullet: chalk.dim('•'),
88
- arrow: chalk.dim('→'),
89
- };
90
- }
91
- /**
92
- * Get HTTP status color based on status code
93
- */
94
- function getStatusColor(colors, status) {
95
- if (status >= 200 && status < 300) {
96
- return colors.httpSuccess;
97
- }
98
- else if (status >= 300 && status < 400) {
99
- return colors.httpRedirect;
100
- }
101
- else if (status >= 400 && status < 500) {
102
- return colors.httpClientError;
103
- }
104
- else {
105
- return colors.httpServerError;
106
- }
107
- }
108
- /**
109
- * Format duration in human-readable form
110
- */
111
- function formatDuration(ms) {
112
- if (ms < 1000) {
113
- return `${ms}ms`;
114
- }
115
- return `${(ms / 1000).toFixed(2)}s`;
116
- }
117
- /**
118
- * Create a horizontal line
119
- */
120
- function line(char = '─', length = 50) {
121
- return char.repeat(length);
122
- }
123
- /**
124
- * Create a double horizontal line
125
- */
126
- function doubleLine(length = 50) {
127
- return '═'.repeat(length);
128
- }
129
- //# sourceMappingURL=colors.js.map
@@ -1,75 +0,0 @@
1
- "use strict";
2
- /**
3
- * Assertion formatter for CLI output
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.formatAssertion = formatAssertion;
7
- exports.formatAssertionSummary = formatAssertionSummary;
8
- /**
9
- * Format a single assertion result
10
- */
11
- function formatAssertion(assertion, options) {
12
- const { colors, verbose } = options;
13
- const lines = [];
14
- const icon = assertion.passed ? colors.checkmark : colors.cross;
15
- // Build display expression with friendly name when available
16
- let displayExpr = assertion.expression;
17
- if (assertion.friendlyName && assertion.responseIndex) {
18
- // Replace $N with the friendly variable name
19
- displayExpr = displayExpr.replace('$' + assertion.responseIndex, assertion.friendlyName);
20
- }
21
- const displayMessage = assertion.message || displayExpr;
22
- lines.push(`${icon} assert ${displayMessage}`);
23
- // Show details for failures, or for all assertions in verbose mode
24
- if (!assertion.passed || verbose) {
25
- if (assertion.error) {
26
- lines.push(` ${colors.error(`Error: ${assertion.error}`)}`);
27
- }
28
- else if (!assertion.passed) {
29
- // Show expected vs actual for failures
30
- lines.push(` ${colors.dim('Expected:')} ${formatValue(assertion.rightExpression ?? assertion.operator)}`);
31
- lines.push(` ${colors.dim('Actual:')} ${formatValue(assertion.leftValue)}`);
32
- // If expressions differ from values, show original expressions
33
- if (verbose && assertion.leftExpression !== String(assertion.leftValue)) {
34
- lines.push(` ${colors.dim('Expression:')} ${assertion.leftExpression}`);
35
- }
36
- }
37
- else if (verbose) {
38
- // In verbose mode, show values for passing assertions too
39
- lines.push(` ${colors.dim('Value:')} ${formatValue(assertion.leftValue)}`);
40
- }
41
- }
42
- return lines;
43
- }
44
- /**
45
- * Format a value for display (handles objects, arrays, primitives)
46
- */
47
- function formatValue(value) {
48
- if (value === undefined) {
49
- return 'undefined';
50
- }
51
- if (value === null) {
52
- return 'null';
53
- }
54
- if (typeof value === 'object') {
55
- try {
56
- return JSON.stringify(value);
57
- }
58
- catch {
59
- return String(value);
60
- }
61
- }
62
- return String(value);
63
- }
64
- /**
65
- * Format assertion summary (passed/failed counts)
66
- */
67
- function formatAssertionSummary(results, colors) {
68
- const passed = results.filter(a => a.passed).length;
69
- const failed = results.length - passed;
70
- if (failed > 0) {
71
- return `${colors.error(`${passed}/${results.length} assertions passed`)} (${failed} failed)`;
72
- }
73
- return `${colors.success(`${passed}/${results.length} assertions passed`)}`;
74
- }
75
- //# sourceMappingURL=assertion.js.map
@@ -1,23 +0,0 @@
1
- "use strict";
2
- /**
3
- * CLI formatters index - re-exports all formatter functions
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- __exportStar(require("./response"), exports);
21
- __exportStar(require("./assertion"), exports);
22
- __exportStar(require("./summary"), exports);
23
- //# sourceMappingURL=index.js.map
@@ -1,106 +0,0 @@
1
- "use strict";
2
- /**
3
- * HTTP Response formatter for CLI output
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.formatResponse = formatResponse;
7
- exports.formatResponseCompact = formatResponseCompact;
8
- const colors_1 = require("../colors");
9
- const redaction_1 = require("../redaction");
10
- /**
11
- * Format a single HTTP response for CLI output
12
- */
13
- function formatResponse(response, options) {
14
- const { colors, redaction, verbose, showDetails, index, method, url } = options;
15
- const lines = [];
16
- const prefix = index !== undefined ? `[${index}] ` : '';
17
- const statusColor = (0, colors_1.getStatusColor)(colors, response.status);
18
- const isSuccess = response.status >= 200 && response.status < 300;
19
- const icon = isSuccess ? colors.checkmark : colors.cross;
20
- // Status line with optional method/url
21
- if (method && url) {
22
- const displayUrl = (0, redaction_1.redactUrl)(url, redaction);
23
- const retryInfo = response.retryInfo && response.retryInfo.attemptsMade > 1
24
- ? ` ${colors.warning(`[retried ${response.retryInfo.attemptsMade - 1}x]`)}`
25
- : '';
26
- lines.push(`${prefix}${icon} ${colors.method(method)} ${displayUrl} ` +
27
- `${statusColor(`(${response.status} ${response.statusText})`)} ` +
28
- `${colors.duration((0, colors_1.formatDuration)(response.duration))}${retryInfo}`);
29
- }
30
- else {
31
- const retryInfo = response.retryInfo && response.retryInfo.attemptsMade > 1
32
- ? ` ${colors.warning(`[retried ${response.retryInfo.attemptsMade - 1}x]`)}`
33
- : '';
34
- lines.push(`${prefix}${statusColor(`${response.status} ${response.statusText}`)} ` +
35
- `${colors.duration(`(${(0, colors_1.formatDuration)(response.duration)})`)}${retryInfo}`);
36
- }
37
- // Only show details in verbose mode OR when there's an error/showDetails is true
38
- if (verbose || showDetails) {
39
- lines.push((0, colors_1.line)());
40
- // Request details (if available and showing details)
41
- if (showDetails && (options.requestHeaders || options.requestBody)) {
42
- lines.push(colors.bold('Request:'));
43
- if (options.requestHeaders) {
44
- const redactedHeaders = (0, redaction_1.redactHeaders)(options.requestHeaders, redaction);
45
- for (const [key, value] of Object.entries(redactedHeaders)) {
46
- lines.push(` ${colors.header(key)}: ${colors.headerValue(value)}`);
47
- }
48
- }
49
- if (options.requestBody) {
50
- lines.push('');
51
- lines.push(colors.dim(' Body:'));
52
- const redactedBody = (0, redaction_1.redactBody)(options.requestBody, redaction);
53
- const bodyStr = typeof redactedBody === 'object'
54
- ? JSON.stringify(redactedBody, null, 2)
55
- : String(redactedBody);
56
- for (const bodyLine of bodyStr.split('\n')) {
57
- lines.push(` ${colors.dim(bodyLine)}`);
58
- }
59
- }
60
- lines.push('');
61
- lines.push(colors.bold('Response:'));
62
- }
63
- // Response headers (verbose or on error)
64
- if (verbose && response.headers) {
65
- lines.push(colors.dim('Headers:'));
66
- const redactedHeaders = (0, redaction_1.redactHeaders)(response.headers, redaction);
67
- for (const [key, value] of Object.entries(redactedHeaders)) {
68
- lines.push(` ${colors.header(key)}: ${colors.headerValue(value)}`);
69
- }
70
- lines.push((0, colors_1.line)());
71
- }
72
- // Response body
73
- if (response.body !== undefined && response.body !== null) {
74
- const redactedBody = (0, redaction_1.redactBody)(response.body, redaction);
75
- if (typeof redactedBody === 'object') {
76
- lines.push(JSON.stringify(redactedBody, null, 2));
77
- }
78
- else {
79
- lines.push(String(redactedBody));
80
- }
81
- }
82
- }
83
- return lines;
84
- }
85
- /**
86
- * Format a compact one-line response (for quiet mode on success)
87
- */
88
- function formatResponseCompact(response, options) {
89
- const { colors, redaction, method, url, index } = options;
90
- const prefix = index !== undefined ? `[${index}] ` : '';
91
- const statusColor = (0, colors_1.getStatusColor)(colors, response.status);
92
- const isSuccess = response.status >= 200 && response.status < 300;
93
- const icon = isSuccess ? colors.checkmark : colors.cross;
94
- const retryInfo = response.retryInfo && response.retryInfo.attemptsMade > 1
95
- ? ` ${colors.warning(`[retried ${response.retryInfo.attemptsMade - 1}x]`)}`
96
- : '';
97
- if (method && url) {
98
- const displayUrl = (0, redaction_1.redactUrl)(url, redaction);
99
- return (`${prefix}${icon} ${colors.method(method)} ${displayUrl} ` +
100
- `${statusColor(`${response.status}`)} ` +
101
- `${colors.duration((0, colors_1.formatDuration)(response.duration))}${retryInfo}`);
102
- }
103
- return (`${prefix}${icon} ${statusColor(`${response.status} ${response.statusText}`)} ` +
104
- `${colors.duration((0, colors_1.formatDuration)(response.duration))}${retryInfo}`);
105
- }
106
- //# sourceMappingURL=response.js.map
@@ -1,187 +0,0 @@
1
- "use strict";
2
- /**
3
- * Summary formatter for CLI output - formats sequence results and overall run summaries
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.formatSequenceResult = formatSequenceResult;
7
- exports.formatRunSummary = formatRunSummary;
8
- exports.formatProgressLine = formatProgressLine;
9
- const colors_1 = require("../colors");
10
- const response_1 = require("./response");
11
- const assertion_1 = require("./assertion");
12
- /**
13
- * Format a single sequence result
14
- */
15
- function formatSequenceResult(result, options) {
16
- const { colors, redaction, verbose } = options;
17
- const lines = [];
18
- // Sequence header
19
- const statusIcon = result.success ? colors.checkmark : colors.cross;
20
- const statusColor = result.success ? colors.success : colors.error;
21
- lines.push('');
22
- lines.push(`${statusIcon} ${statusColor(`Sequence: ${result.name}`)}`);
23
- lines.push(`${colors.dim('Duration:')} ${(0, colors_1.formatDuration)(result.duration)}`);
24
- // Assertion summary if any
25
- if (result.assertionResults && result.assertionResults.length > 0) {
26
- lines.push(`${colors.dim('Assertions:')} ${(0, assertion_1.formatAssertionSummary)(result.assertionResults, colors)}`);
27
- }
28
- // Request count
29
- const requestCount = result.steps.filter(s => s.type === 'request').length;
30
- lines.push(`${colors.dim('Requests:')} ${requestCount}`);
31
- lines.push((0, colors_1.doubleLine)());
32
- // Track if we've shown any expanded details
33
- let requestIdx = 0;
34
- // Print steps in order
35
- for (const step of result.steps) {
36
- const stepLines = formatStep(step, {
37
- colors,
38
- redaction,
39
- verbose,
40
- requestIndex: step.type === 'request' ? ++requestIdx : undefined,
41
- });
42
- lines.push(...stepLines);
43
- }
44
- // Show accumulated errors/warnings at the end
45
- if (result.errors.length > 0) {
46
- lines.push('');
47
- lines.push(colors.warning('Warnings/Errors:'));
48
- for (const err of result.errors) {
49
- lines.push(` ${colors.bullet} ${err}`);
50
- }
51
- }
52
- return lines;
53
- }
54
- /**
55
- * Format a single step result
56
- */
57
- function formatStep(step, options) {
58
- const { colors, redaction, verbose, requestIndex } = options;
59
- switch (step.type) {
60
- case 'print':
61
- return formatPrintStep(step, colors);
62
- case 'request':
63
- return formatRequestStep(step, { colors, redaction, verbose, requestIndex });
64
- case 'assertion':
65
- return formatAssertionStep(step, { colors, verbose });
66
- case 'script':
67
- return formatScriptStep(step, colors, verbose);
68
- case 'json':
69
- return formatJsonStep(step, colors, verbose);
70
- default:
71
- return [];
72
- }
73
- }
74
- function formatPrintStep(step, colors) {
75
- const lines = [];
76
- if (step.print) {
77
- lines.push(`${colors.warning('[print]')} ${step.print.title}`);
78
- if (step.print.body) {
79
- lines.push(` ${step.print.body}`);
80
- }
81
- }
82
- return lines;
83
- }
84
- function formatRequestStep(step, options) {
85
- const { colors, redaction, verbose, requestIndex } = options;
86
- if (!step.response) {
87
- return [];
88
- }
89
- const isSuccess = step.response.status >= 200 && step.response.status < 300;
90
- // In quiet mode (not verbose), only show compact line for successful requests
91
- // Show full details for failures
92
- if (!verbose && isSuccess) {
93
- return [(0, response_1.formatResponseCompact)(step.response, {
94
- colors,
95
- redaction,
96
- method: step.requestMethod,
97
- url: step.requestUrl,
98
- index: requestIndex,
99
- })];
100
- }
101
- // Show full details for failures or in verbose mode
102
- return (0, response_1.formatResponse)(step.response, {
103
- colors,
104
- redaction,
105
- verbose,
106
- showDetails: !isSuccess || verbose, // Show request details on failure or verbose
107
- index: requestIndex,
108
- method: step.requestMethod,
109
- url: step.requestUrl,
110
- requestBody: step.response.requestBody,
111
- requestHeaders: step.response.requestHeaders,
112
- });
113
- }
114
- function formatAssertionStep(step, options) {
115
- if (!step.assertion) {
116
- return [];
117
- }
118
- return (0, assertion_1.formatAssertion)(step.assertion, {
119
- colors: options.colors,
120
- verbose: options.verbose,
121
- });
122
- }
123
- function formatScriptStep(step, colors, verbose) {
124
- const lines = [];
125
- if (step.script) {
126
- const icon = step.script.success ? colors.checkmark : colors.cross;
127
- lines.push(`${icon} ${colors.dim('[script]')} ${step.script.type}`);
128
- if (!step.script.success || verbose) {
129
- if (step.script.error) {
130
- lines.push(` ${colors.error(`Error: ${step.script.error}`)}`);
131
- }
132
- if (verbose && step.script.output) {
133
- lines.push(` ${colors.dim('output:')} ${step.script.output}`);
134
- }
135
- }
136
- }
137
- return lines;
138
- }
139
- function formatJsonStep(step, colors, verbose) {
140
- const lines = [];
141
- if (step.json) {
142
- const icon = step.json.success ? colors.checkmark : colors.cross;
143
- lines.push(`${icon} ${colors.dim('[json]')} Loaded: ${step.json.varName}`);
144
- if (!step.json.success) {
145
- lines.push(` ${colors.error(`Error: ${step.json.error}`)}`);
146
- }
147
- else if (verbose) {
148
- lines.push(` ${colors.dim('File:')} ${step.json.filePath}`);
149
- }
150
- }
151
- return lines;
152
- }
153
- /**
154
- * Format the overall run summary (for multiple sequences)
155
- */
156
- function formatRunSummary(results, totalDuration, colors) {
157
- const lines = [];
158
- const passed = results.filter(r => r.success).length;
159
- const failed = results.length - passed;
160
- lines.push('');
161
- lines.push((0, colors_1.doubleLine)());
162
- lines.push(colors.bold('Summary'));
163
- lines.push((0, colors_1.line)());
164
- lines.push(`${colors.dim('Total sequences:')} ${results.length}`);
165
- lines.push(`${colors.success(`Passed: ${passed}`)}`);
166
- if (failed > 0) {
167
- lines.push(`${colors.error(`Failed: ${failed}`)}`);
168
- // List failed sequences
169
- lines.push('');
170
- lines.push(colors.error('Failed sequences:'));
171
- for (const result of results.filter(r => !r.success)) {
172
- lines.push(` ${colors.cross} ${result.name}`);
173
- }
174
- }
175
- lines.push('');
176
- lines.push(`${colors.dim('Total duration:')} ${(0, colors_1.formatDuration)(totalDuration)}`);
177
- return lines;
178
- }
179
- /**
180
- * Format a single-line progress indicator (for streaming output)
181
- */
182
- function formatProgressLine(sequenceName, currentStep, totalSteps, stepDescription, colors) {
183
- return (`${colors.info(`[${sequenceName}]`)} ` +
184
- `${colors.dim(`Step ${currentStep}/${totalSteps}:`)} ` +
185
- `${stepDescription}`);
186
- }
187
- //# sourceMappingURL=summary.js.map