norn-cli 2.3.0 → 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 (92) hide show
  1. package/.claude/skills/norn-social-campaign/SKILL.md +70 -0
  2. package/CHANGELOG.md +6 -0
  3. package/demos/nornenv-region-refactor/README.md +64 -0
  4. package/dist/cli.js +360 -1
  5. package/out/apiResponseIntellisenseCache.js +394 -0
  6. package/out/assertionRunner.js +567 -0
  7. package/out/cacheDir.js +136 -0
  8. package/out/chatParticipant.js +763 -0
  9. package/out/cli/colors.js +127 -0
  10. package/out/cli/formatters/assertion.js +102 -0
  11. package/out/cli/formatters/index.js +23 -0
  12. package/out/cli/formatters/response.js +106 -0
  13. package/out/cli/formatters/summary.js +246 -0
  14. package/out/cli/redaction.js +237 -0
  15. package/out/cli/reporters/html.js +689 -0
  16. package/out/cli/reporters/index.js +22 -0
  17. package/out/cli/reporters/junit.js +226 -0
  18. package/out/codeLensProvider.js +351 -0
  19. package/out/compareContentProvider.js +85 -0
  20. package/out/completionProvider.js +3739 -0
  21. package/out/contractAssertionSummary.js +225 -0
  22. package/out/contractDecorationProvider.js +243 -0
  23. package/out/coverageCalculator.js +879 -0
  24. package/out/coveragePanel.js +597 -0
  25. package/out/debug/breakpointResolver.js +84 -0
  26. package/out/debug/breakpoints.js +52 -0
  27. package/out/debug/nornDebugAdapter.js +166 -0
  28. package/out/debug/nornDebugSession.js +613 -0
  29. package/out/debug/sequenceLocationIndex.js +77 -0
  30. package/out/debug/types.js +3 -0
  31. package/out/deepClone.js +21 -0
  32. package/out/diagnosticProvider.js +2554 -0
  33. package/out/environmentParser.js +736 -0
  34. package/out/environmentProvider.js +544 -0
  35. package/out/environmentTemplates.js +146 -0
  36. package/out/errors/formatError.js +113 -0
  37. package/out/errors/nornError.js +29 -0
  38. package/out/formUrlEncoded.js +89 -0
  39. package/out/httpClient.js +348 -0
  40. package/out/httpRuntimeOptions.js +16 -0
  41. package/out/importErrors.js +31 -0
  42. package/out/inlayHintResolver.js +70 -0
  43. package/out/jsonFileReader.js +323 -0
  44. package/out/mcpClient.js +193 -0
  45. package/out/mcpConfig.js +184 -0
  46. package/out/mcpToolIntellisenseCache.js +96 -0
  47. package/out/mcpToolSchema.js +50 -0
  48. package/out/nornConfig.js +132 -0
  49. package/out/nornHoverProvider.js +124 -0
  50. package/out/nornInlayHintsProvider.js +191 -0
  51. package/out/nornPrompt.js +755 -0
  52. package/out/nornSqlParser.js +286 -0
  53. package/out/nornapiHoverProvider.js +135 -0
  54. package/out/nornapiInlayHintsProvider.js +94 -0
  55. package/out/nornapiParser.js +324 -0
  56. package/out/nornenvCodeActionProvider.js +101 -0
  57. package/out/nornenvDecorationProvider.js +239 -0
  58. package/out/nornenvFoldingProvider.js +63 -0
  59. package/out/nornenvHoverProvider.js +114 -0
  60. package/out/nornenvInlayHintsProvider.js +99 -0
  61. package/out/nornenvLanguageModel.js +187 -0
  62. package/out/nornenvRegionRefactor.js +267 -0
  63. package/out/nornsqlHoverProvider.js +95 -0
  64. package/out/nornsqlInlayHintsProvider.js +114 -0
  65. package/out/parser.js +839 -0
  66. package/out/pathAccess.js +28 -0
  67. package/out/postmanImportPanel.js +732 -0
  68. package/out/postmanImportPlanner.js +1155 -0
  69. package/out/postmanImportSidebarView.js +532 -0
  70. package/out/quotedString.js +35 -0
  71. package/out/requestPreparation.js +179 -0
  72. package/out/requestValidation.js +146 -0
  73. package/out/responsePanel.js +7754 -0
  74. package/out/schemaGenerator.js +562 -0
  75. package/out/scriptRunner.js +419 -0
  76. package/out/secrets/cliSecrets.js +415 -0
  77. package/out/secrets/crypto.js +105 -0
  78. package/out/secrets/envFileSecrets.js +177 -0
  79. package/out/secrets/keyStore.js +259 -0
  80. package/out/sequenceDeclaration.js +15 -0
  81. package/out/sequenceRunner.js +3590 -0
  82. package/out/sqlAdapterRunner.js +122 -0
  83. package/out/sqlBuiltInAdapters.js +604 -0
  84. package/out/sqlConfig.js +184 -0
  85. package/out/starterCatalog.js +554 -0
  86. package/out/stringUtils.js +25 -0
  87. package/out/swaggerBodyIntellisenseCache.js +114 -0
  88. package/out/swaggerParser.js +464 -0
  89. package/out/testProvider.js +767 -0
  90. package/out/theoryCaseLoader.js +113 -0
  91. package/out/validationCache.js +211 -0
  92. package/package.json +6 -1
@@ -0,0 +1,127 @@
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
+ let chalkInstance = null;
13
+ async function getChalk() {
14
+ if (!chalkInstance) {
15
+ const chalk = await import('chalk');
16
+ chalkInstance = chalk.default;
17
+ }
18
+ return chalkInstance;
19
+ }
20
+ /**
21
+ * Check if colors should be disabled
22
+ * Respects NO_COLOR environment variable (https://no-color.org/)
23
+ */
24
+ function shouldDisableColors() {
25
+ return (process.env.NO_COLOR !== undefined ||
26
+ process.env.FORCE_COLOR === '0' ||
27
+ !process.stdout.isTTY);
28
+ }
29
+ /**
30
+ * Create a no-op color function for when colors are disabled
31
+ */
32
+ function noColor(text) {
33
+ return text;
34
+ }
35
+ /**
36
+ * Plain text colors (no ANSI codes)
37
+ */
38
+ const plainColors = {
39
+ success: noColor,
40
+ error: noColor,
41
+ warning: noColor,
42
+ info: noColor,
43
+ dim: noColor,
44
+ bold: noColor,
45
+ httpSuccess: noColor,
46
+ httpRedirect: noColor,
47
+ httpClientError: noColor,
48
+ httpServerError: noColor,
49
+ url: noColor,
50
+ method: noColor,
51
+ duration: noColor,
52
+ header: noColor,
53
+ headerValue: noColor,
54
+ checkmark: '✓',
55
+ cross: '✗',
56
+ bullet: '•',
57
+ arrow: '→',
58
+ };
59
+ /**
60
+ * Initialize colors - call this once at CLI startup
61
+ */
62
+ async function initColors() {
63
+ if (shouldDisableColors()) {
64
+ return plainColors;
65
+ }
66
+ const chalk = await getChalk();
67
+ return {
68
+ success: (text) => chalk.green(text),
69
+ error: (text) => chalk.red(text),
70
+ warning: (text) => chalk.yellow(text),
71
+ info: (text) => chalk.cyan(text),
72
+ dim: (text) => chalk.dim(text),
73
+ bold: (text) => chalk.bold(text),
74
+ httpSuccess: (text) => chalk.green(text),
75
+ httpRedirect: (text) => chalk.cyan(text),
76
+ httpClientError: (text) => chalk.red(text),
77
+ httpServerError: (text) => chalk.magenta(text),
78
+ url: (text) => chalk.underline(text),
79
+ method: (text) => chalk.bold.cyan(text),
80
+ duration: (text) => chalk.dim(text),
81
+ header: (text) => chalk.dim(text),
82
+ headerValue: (text) => chalk.dim(text),
83
+ checkmark: chalk.green('✓'),
84
+ cross: chalk.red('✗'),
85
+ bullet: chalk.dim('•'),
86
+ arrow: chalk.dim('→'),
87
+ };
88
+ }
89
+ /**
90
+ * Get HTTP status color based on status code
91
+ */
92
+ function getStatusColor(colors, status) {
93
+ if (status >= 200 && status < 300) {
94
+ return colors.httpSuccess;
95
+ }
96
+ else if (status >= 300 && status < 400) {
97
+ return colors.httpRedirect;
98
+ }
99
+ else if (status >= 400 && status < 500) {
100
+ return colors.httpClientError;
101
+ }
102
+ else {
103
+ return colors.httpServerError;
104
+ }
105
+ }
106
+ /**
107
+ * Format duration in human-readable form
108
+ */
109
+ function formatDuration(ms) {
110
+ if (ms < 1000) {
111
+ return `${ms}ms`;
112
+ }
113
+ return `${(ms / 1000).toFixed(2)}s`;
114
+ }
115
+ /**
116
+ * Create a horizontal line
117
+ */
118
+ function line(char = '─', length = 50) {
119
+ return char.repeat(length);
120
+ }
121
+ /**
122
+ * Create a double horizontal line
123
+ */
124
+ function doubleLine(length = 50) {
125
+ return '═'.repeat(length);
126
+ }
127
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1,102 @@
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
+ const contractAssertionSummary_1 = require("../../contractAssertionSummary");
9
+ /**
10
+ * Format a single assertion result
11
+ */
12
+ function formatAssertion(assertion, options) {
13
+ const { colors, verbose } = options;
14
+ const lines = [];
15
+ const icon = assertion.passed ? colors.checkmark : colors.cross;
16
+ // Build display expression with friendly name when available
17
+ let displayExpr = assertion.expression;
18
+ if (assertion.friendlyName && assertion.responseIndex) {
19
+ // Replace $N with the friendly variable name
20
+ displayExpr = displayExpr.replace('$' + assertion.responseIndex, assertion.friendlyName);
21
+ }
22
+ const displayMessage = assertion.message || displayExpr;
23
+ const contractDisplay = (0, contractAssertionSummary_1.buildContractAssertionDisplay)(assertion);
24
+ if (contractDisplay) {
25
+ const summaryColor = assertion.passed ? colors.success : colors.warning;
26
+ lines.push(`${icon} ${summaryColor(contractDisplay.titleText)}`);
27
+ if (assertion.message) {
28
+ lines.push(` ${colors.dim('Note:')} ${assertion.message}`);
29
+ }
30
+ if (verbose && contractDisplay.schemaPath && contractDisplay.schemaPath !== contractDisplay.schemaName) {
31
+ lines.push(` ${colors.dim('Schema path:')} ${contractDisplay.schemaPath}`);
32
+ }
33
+ if (!assertion.passed) {
34
+ if (contractDisplay.issueTexts.length > 0) {
35
+ lines.push(` ${colors.dim('Issues:')}`);
36
+ for (const issue of contractDisplay.issueTexts) {
37
+ lines.push(` ${colors.cross} ${colors.error(issue)}`);
38
+ }
39
+ if (contractDisplay.remainingIssueCount > 0) {
40
+ lines.push(` ${colors.dim(`+${contractDisplay.remainingIssueCount} more`)}`);
41
+ }
42
+ }
43
+ else if (assertion.error) {
44
+ lines.push(` ${colors.error(`Error: ${assertion.error}`)}`);
45
+ }
46
+ }
47
+ return lines;
48
+ }
49
+ lines.push(`${icon} assert ${displayMessage}`);
50
+ // Show details for failures, or for all assertions in verbose mode
51
+ if (!assertion.passed || verbose) {
52
+ if (assertion.error) {
53
+ lines.push(` ${colors.error(`Error: ${assertion.error}`)}`);
54
+ }
55
+ else if (!assertion.passed) {
56
+ // Show expected vs actual for failures
57
+ lines.push(` ${colors.dim('Expected:')} ${formatValue(assertion.rightExpression ?? assertion.operator)}`);
58
+ lines.push(` ${colors.dim('Actual:')} ${formatValue(assertion.leftValue)}`);
59
+ // If expressions differ from values, show original expressions
60
+ if (verbose && assertion.leftExpression !== String(assertion.leftValue)) {
61
+ lines.push(` ${colors.dim('Expression:')} ${assertion.leftExpression}`);
62
+ }
63
+ }
64
+ else if (verbose) {
65
+ // In verbose mode, show values for passing assertions too
66
+ lines.push(` ${colors.dim('Value:')} ${formatValue(assertion.leftValue)}`);
67
+ }
68
+ }
69
+ return lines;
70
+ }
71
+ /**
72
+ * Format a value for display (handles objects, arrays, primitives)
73
+ */
74
+ function formatValue(value) {
75
+ if (value === undefined) {
76
+ return 'undefined';
77
+ }
78
+ if (value === null) {
79
+ return 'null';
80
+ }
81
+ if (typeof value === 'object') {
82
+ try {
83
+ return JSON.stringify(value);
84
+ }
85
+ catch {
86
+ return String(value);
87
+ }
88
+ }
89
+ return String(value);
90
+ }
91
+ /**
92
+ * Format assertion summary (passed/failed counts)
93
+ */
94
+ function formatAssertionSummary(results, colors) {
95
+ const passed = results.filter(a => a.passed).length;
96
+ const failed = results.length - passed;
97
+ if (failed > 0) {
98
+ return `${colors.error(`${passed}/${results.length} assertions passed`)} (${failed} failed)`;
99
+ }
100
+ return `${colors.success(`${passed}/${results.length} assertions passed`)}`;
101
+ }
102
+ //# sourceMappingURL=assertion.js.map
@@ -0,0 +1,23 @@
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
@@ -0,0 +1,106 @@
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
@@ -0,0 +1,246 @@
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
+ const mcpCount = result.steps.filter(s => s.type === 'mcp').length;
32
+ if (mcpCount > 0) {
33
+ lines.push(`${colors.dim('MCP steps:')} ${mcpCount}`);
34
+ }
35
+ lines.push((0, colors_1.doubleLine)());
36
+ // Track if we've shown any expanded details
37
+ let requestIdx = 0;
38
+ // Print steps in order
39
+ for (const step of result.steps) {
40
+ const stepLines = formatStep(step, {
41
+ colors,
42
+ redaction,
43
+ verbose,
44
+ requestIndex: step.type === 'request' ? ++requestIdx : undefined,
45
+ });
46
+ lines.push(...stepLines);
47
+ }
48
+ // Show accumulated errors/warnings at the end
49
+ if (result.errors.length > 0) {
50
+ lines.push('');
51
+ lines.push(colors.warning('Warnings/Errors:'));
52
+ for (const err of result.errors) {
53
+ const errLines = String(err ?? '').split('\n');
54
+ if (errLines.length === 0) {
55
+ continue;
56
+ }
57
+ lines.push(` ${colors.bullet} ${errLines[0]}`);
58
+ for (const line of errLines.slice(1)) {
59
+ lines.push(` ${line}`);
60
+ }
61
+ }
62
+ }
63
+ return lines;
64
+ }
65
+ /**
66
+ * Format a single step result
67
+ */
68
+ function formatStep(step, options) {
69
+ const { colors, redaction, verbose, requestIndex } = options;
70
+ switch (step.type) {
71
+ case 'print':
72
+ return formatPrintStep(step, colors);
73
+ case 'request':
74
+ return formatRequestStep(step, { colors, redaction, verbose, requestIndex });
75
+ case 'assertion':
76
+ return formatAssertionStep(step, { colors, verbose });
77
+ case 'script':
78
+ return formatScriptStep(step, colors, verbose);
79
+ case 'json':
80
+ return formatJsonStep(step, colors, verbose);
81
+ case 'sql':
82
+ return formatSqlStep(step, colors, verbose);
83
+ case 'mcp':
84
+ return formatMcpStep(step, colors, verbose);
85
+ default:
86
+ return [];
87
+ }
88
+ }
89
+ function formatPrintStep(step, colors) {
90
+ const lines = [];
91
+ if (step.print) {
92
+ lines.push(`${colors.warning('[print]')} ${step.print.title}`);
93
+ if (step.print.body) {
94
+ lines.push(` ${step.print.body}`);
95
+ }
96
+ }
97
+ return lines;
98
+ }
99
+ function formatRequestStep(step, options) {
100
+ const { colors, redaction, verbose, requestIndex } = options;
101
+ if (!step.response) {
102
+ return [];
103
+ }
104
+ const isSuccess = step.response.status >= 200 && step.response.status < 300;
105
+ // In quiet mode (not verbose), only show compact line for successful requests
106
+ // Show full details for failures
107
+ if (!verbose && isSuccess) {
108
+ return [(0, response_1.formatResponseCompact)(step.response, {
109
+ colors,
110
+ redaction,
111
+ method: step.requestMethod,
112
+ url: step.requestUrl,
113
+ index: requestIndex,
114
+ })];
115
+ }
116
+ // Show full details for failures or in verbose mode
117
+ return (0, response_1.formatResponse)(step.response, {
118
+ colors,
119
+ redaction,
120
+ verbose,
121
+ showDetails: !isSuccess || verbose, // Show request details on failure or verbose
122
+ index: requestIndex,
123
+ method: step.requestMethod,
124
+ url: step.requestUrl,
125
+ requestBody: step.response.requestBody,
126
+ requestHeaders: step.response.requestHeaders,
127
+ });
128
+ }
129
+ function formatAssertionStep(step, options) {
130
+ if (!step.assertion) {
131
+ return [];
132
+ }
133
+ return (0, assertion_1.formatAssertion)(step.assertion, {
134
+ colors: options.colors,
135
+ verbose: options.verbose,
136
+ });
137
+ }
138
+ function formatScriptStep(step, colors, verbose) {
139
+ const lines = [];
140
+ if (step.script) {
141
+ const icon = step.script.success ? colors.checkmark : colors.cross;
142
+ lines.push(`${icon} ${colors.dim('[script]')} ${step.script.type}`);
143
+ if (!step.script.success || verbose) {
144
+ if (step.script.error) {
145
+ lines.push(` ${colors.error(`Error: ${step.script.error}`)}`);
146
+ }
147
+ if (verbose && step.script.output) {
148
+ lines.push(` ${colors.dim('output:')} ${step.script.output}`);
149
+ }
150
+ }
151
+ }
152
+ return lines;
153
+ }
154
+ function formatJsonStep(step, colors, verbose) {
155
+ const lines = [];
156
+ if (step.json) {
157
+ const icon = step.json.success ? colors.checkmark : colors.cross;
158
+ lines.push(`${icon} ${colors.dim('[json]')} Loaded: ${step.json.varName}`);
159
+ if (!step.json.success) {
160
+ lines.push(` ${colors.error(`Error: ${step.json.error}`)}`);
161
+ }
162
+ else if (verbose) {
163
+ lines.push(` ${colors.dim('File:')} ${step.json.filePath}`);
164
+ }
165
+ }
166
+ return lines;
167
+ }
168
+ function formatSqlStep(step, colors, verbose) {
169
+ const lines = [];
170
+ if (!step.sql) {
171
+ return lines;
172
+ }
173
+ const icon = colors.checkmark;
174
+ if (step.sql.operationType === 'query') {
175
+ lines.push(`${icon} ${colors.dim('[sql]')} ${step.sql.operationName} (${step.sql.rowCount ?? 0} rows)`);
176
+ if (verbose && step.variableName) {
177
+ lines.push(` ${colors.dim('captured as:')} ${step.variableName}`);
178
+ }
179
+ }
180
+ else {
181
+ lines.push(`${icon} ${colors.dim('[sql]')} ${step.sql.operationName} (${step.sql.affectedRows ?? 0} affected)`);
182
+ if (verbose && step.variableName) {
183
+ lines.push(` ${colors.dim('captured as:')} ${step.variableName}`);
184
+ }
185
+ }
186
+ return lines;
187
+ }
188
+ function formatMcpStep(step, colors, verbose) {
189
+ const lines = [];
190
+ if (!step.mcp) {
191
+ return lines;
192
+ }
193
+ if (step.mcp.operation === 'list') {
194
+ lines.push(`${colors.checkmark} ${colors.dim('[mcp]')} list ${step.mcp.serverAlias} (${step.mcp.tools?.length || 0} tools)`);
195
+ if (verbose && step.variableName) {
196
+ lines.push(` ${colors.dim('captured as:')} ${step.variableName}`);
197
+ }
198
+ if (verbose && step.mcp.tools && step.mcp.tools.length > 0) {
199
+ lines.push(` ${colors.dim('tools:')} ${step.mcp.tools.map(tool => tool.name).join(', ')}`);
200
+ }
201
+ return lines;
202
+ }
203
+ lines.push(`${colors.checkmark} ${colors.dim('[mcp]')} call ${step.mcp.serverAlias}.${step.mcp.toolName || ''}`);
204
+ if (verbose && step.variableName) {
205
+ lines.push(` ${colors.dim('captured as:')} ${step.variableName}`);
206
+ }
207
+ if (verbose && step.mcp.result?.text) {
208
+ lines.push(` ${colors.dim('text:')} ${step.mcp.result.text}`);
209
+ }
210
+ return lines;
211
+ }
212
+ /**
213
+ * Format the overall run summary (for multiple sequences)
214
+ */
215
+ function formatRunSummary(results, totalDuration, colors) {
216
+ const lines = [];
217
+ const passed = results.filter(r => r.success).length;
218
+ const failed = results.length - passed;
219
+ lines.push('');
220
+ lines.push((0, colors_1.doubleLine)());
221
+ lines.push(colors.bold('Summary'));
222
+ lines.push((0, colors_1.line)());
223
+ lines.push(`${colors.dim('Total sequences:')} ${results.length}`);
224
+ lines.push(`${colors.success(`Passed: ${passed}`)}`);
225
+ if (failed > 0) {
226
+ lines.push(`${colors.error(`Failed: ${failed}`)}`);
227
+ // List failed sequences
228
+ lines.push('');
229
+ lines.push(colors.error('Failed sequences:'));
230
+ for (const result of results.filter(r => !r.success)) {
231
+ lines.push(` ${colors.cross} ${result.name}`);
232
+ }
233
+ }
234
+ lines.push('');
235
+ lines.push(`${colors.dim('Total duration:')} ${(0, colors_1.formatDuration)(totalDuration)}`);
236
+ return lines;
237
+ }
238
+ /**
239
+ * Format a single-line progress indicator (for streaming output)
240
+ */
241
+ function formatProgressLine(sequenceName, currentStep, totalSteps, stepDescription, colors) {
242
+ return (`${colors.info(`[${sequenceName}]`)} ` +
243
+ `${colors.dim(`Step ${currentStep}/${totalSteps}:`)} ` +
244
+ `${stepDescription}`);
245
+ }
246
+ //# sourceMappingURL=summary.js.map