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.
- package/AGENTS.md +9 -1
- package/CHANGELOG.md +23 -0
- package/dist/cli.js +246 -80
- package/package.json +1 -1
- package/out/assertionRunner.js +0 -537
- package/out/chatParticipant.js +0 -722
- package/out/cli/colors.js +0 -129
- package/out/cli/formatters/assertion.js +0 -75
- package/out/cli/formatters/index.js +0 -23
- package/out/cli/formatters/response.js +0 -106
- package/out/cli/formatters/summary.js +0 -187
- package/out/cli/redaction.js +0 -237
- package/out/cli/reporters/html.js +0 -634
- package/out/cli/reporters/index.js +0 -22
- package/out/cli/reporters/junit.js +0 -211
- package/out/cli.js +0 -989
- package/out/codeLensProvider.js +0 -248
- package/out/compareContentProvider.js +0 -85
- package/out/completionProvider.js +0 -2404
- package/out/contractDecorationProvider.js +0 -243
- package/out/coverageCalculator.js +0 -837
- package/out/coveragePanel.js +0 -545
- package/out/diagnosticProvider.js +0 -1113
- package/out/environmentProvider.js +0 -442
- package/out/extension.js +0 -1114
- package/out/httpClient.js +0 -269
- package/out/jsonFileReader.js +0 -320
- package/out/nornPrompt.js +0 -580
- package/out/nornapiParser.js +0 -326
- package/out/parser.js +0 -725
- package/out/responsePanel.js +0 -4674
- package/out/schemaGenerator.js +0 -393
- package/out/scriptRunner.js +0 -419
- package/out/sequenceRunner.js +0 -3046
- package/out/swaggerBodyIntellisenseCache.js +0 -147
- package/out/swaggerParser.js +0 -419
- package/out/test/coverageCalculator.test.js +0 -100
- package/out/test/extension.test.js +0 -48
- package/out/testProvider.js +0 -658
- package/out/validationCache.js +0 -245
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Contract Decoration Provider - Visual indicators for schema assertion lines
|
|
4
|
-
* Shows pass/fail/stale status as colored decorations in the editor gutter
|
|
5
|
-
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.ContractDecorationProvider = void 0;
|
|
41
|
-
exports.createContractHoverProvider = createContractHoverProvider;
|
|
42
|
-
const vscode = __importStar(require("vscode"));
|
|
43
|
-
const validationCache_1 = require("./validationCache");
|
|
44
|
-
/**
|
|
45
|
-
* Creates decoration types with appropriate colors and icons
|
|
46
|
-
*/
|
|
47
|
-
function createDecorationTypes() {
|
|
48
|
-
return {
|
|
49
|
-
pass: vscode.window.createTextEditorDecorationType({
|
|
50
|
-
gutterIconPath: vscode.Uri.parse('data:image/svg+xml,' + encodeURIComponent(`
|
|
51
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="#4ec9b0">
|
|
52
|
-
<path d="M4 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H4zm1 2h6v1H5V4zm0 2h6v1H5V6zm0 2h4v1H5V8z"/>
|
|
53
|
-
<path d="M10.5 10l-2 2-1-1-.7.7 1.7 1.7 2.7-2.7-.7-.7z"/>
|
|
54
|
-
</svg>
|
|
55
|
-
`)),
|
|
56
|
-
gutterIconSize: 'contain',
|
|
57
|
-
backgroundColor: 'rgba(78, 201, 176, 0.08)',
|
|
58
|
-
isWholeLine: true,
|
|
59
|
-
overviewRulerColor: '#4ec9b0',
|
|
60
|
-
overviewRulerLane: vscode.OverviewRulerLane.Right
|
|
61
|
-
}),
|
|
62
|
-
fail: vscode.window.createTextEditorDecorationType({
|
|
63
|
-
gutterIconPath: vscode.Uri.parse('data:image/svg+xml,' + encodeURIComponent(`
|
|
64
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="#f14c4c">
|
|
65
|
-
<path d="M4 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H4zm1 2h6v1H5V4zm0 2h6v1H5V6zm0 2h4v1H5V8z"/>
|
|
66
|
-
<path d="M9.5 10l1.5 1.5-1 1-1.5-1.5-1.5 1.5-1-1 1.5-1.5-1.5-1.5 1-1 1.5 1.5 1.5-1.5 1 1-1.5 1.5z"/>
|
|
67
|
-
</svg>
|
|
68
|
-
`)),
|
|
69
|
-
gutterIconSize: 'contain',
|
|
70
|
-
backgroundColor: 'rgba(241, 76, 76, 0.1)',
|
|
71
|
-
isWholeLine: true,
|
|
72
|
-
overviewRulerColor: '#f14c4c',
|
|
73
|
-
overviewRulerLane: vscode.OverviewRulerLane.Right
|
|
74
|
-
}),
|
|
75
|
-
warn: vscode.window.createTextEditorDecorationType({
|
|
76
|
-
gutterIconPath: vscode.Uri.parse('data:image/svg+xml,' + encodeURIComponent(`
|
|
77
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="#cca700">
|
|
78
|
-
<path d="M4 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H4zm1 2h6v1H5V4zm0 2h6v1H5V6zm0 2h4v1H5V8z"/>
|
|
79
|
-
<path d="M10.5 10.5a.5.5 0 0 1-1 0v-1a.5.5 0 0 1 1 0v1zm-.5 2a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1z"/>
|
|
80
|
-
</svg>
|
|
81
|
-
`)),
|
|
82
|
-
gutterIconSize: 'contain',
|
|
83
|
-
backgroundColor: 'rgba(204, 167, 0, 0.08)',
|
|
84
|
-
isWholeLine: true,
|
|
85
|
-
overviewRulerColor: '#cca700',
|
|
86
|
-
overviewRulerLane: vscode.OverviewRulerLane.Right
|
|
87
|
-
}),
|
|
88
|
-
stale: vscode.window.createTextEditorDecorationType({
|
|
89
|
-
gutterIconPath: vscode.Uri.parse('data:image/svg+xml,' + encodeURIComponent(`
|
|
90
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="#808080">
|
|
91
|
-
<path d="M4 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H4zm1 2h6v1H5V4zm0 2h6v1H5V6zm0 2h4v1H5V8z"/>
|
|
92
|
-
<path d="M10.5 10.5a.5.5 0 0 1-1 0v-1a.5.5 0 0 1 1 0v1zm-.5 2a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1z"/>
|
|
93
|
-
</svg>
|
|
94
|
-
`)),
|
|
95
|
-
gutterIconSize: 'contain',
|
|
96
|
-
backgroundColor: 'rgba(128, 128, 128, 0.05)',
|
|
97
|
-
isWholeLine: true,
|
|
98
|
-
overviewRulerColor: '#808080',
|
|
99
|
-
overviewRulerLane: vscode.OverviewRulerLane.Right
|
|
100
|
-
}),
|
|
101
|
-
unknown: vscode.window.createTextEditorDecorationType({
|
|
102
|
-
gutterIconPath: vscode.Uri.parse('data:image/svg+xml,' + encodeURIComponent(`
|
|
103
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="#808080" opacity="0.5">
|
|
104
|
-
<path d="M4 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H4zm1 2h6v1H5V4zm0 2h6v1H5V6zm0 2h4v1H5V8z" stroke="#808080" stroke-dasharray="2,2" fill="none"/>
|
|
105
|
-
</svg>
|
|
106
|
-
`)),
|
|
107
|
-
gutterIconSize: 'contain'
|
|
108
|
-
})
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Pattern to match matchesSchema assertions
|
|
113
|
-
*/
|
|
114
|
-
const MATCHES_SCHEMA_PATTERN = /^\s*assert\s+.+\s+matchesSchema\s+/i;
|
|
115
|
-
/**
|
|
116
|
-
* Find all matchesSchema assertion lines in a document
|
|
117
|
-
*/
|
|
118
|
-
function findSchemaAssertionLines(document) {
|
|
119
|
-
const lines = [];
|
|
120
|
-
for (let i = 0; i < document.lineCount; i++) {
|
|
121
|
-
const lineText = document.lineAt(i).text;
|
|
122
|
-
if (MATCHES_SCHEMA_PATTERN.test(lineText)) {
|
|
123
|
-
lines.push(i);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return lines;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Contract Decoration Provider class
|
|
130
|
-
*/
|
|
131
|
-
class ContractDecorationProvider {
|
|
132
|
-
decorationTypes;
|
|
133
|
-
disposables = [];
|
|
134
|
-
constructor() {
|
|
135
|
-
this.decorationTypes = createDecorationTypes();
|
|
136
|
-
// Update decorations when active editor changes
|
|
137
|
-
this.disposables.push(vscode.window.onDidChangeActiveTextEditor(editor => {
|
|
138
|
-
if (editor?.document.languageId === 'norn') {
|
|
139
|
-
this.updateDecorations(editor);
|
|
140
|
-
}
|
|
141
|
-
}));
|
|
142
|
-
// Update decorations when document changes (with debounce)
|
|
143
|
-
let updateTimeout;
|
|
144
|
-
this.disposables.push(vscode.workspace.onDidChangeTextDocument(event => {
|
|
145
|
-
const editor = vscode.window.activeTextEditor;
|
|
146
|
-
if (editor && event.document === editor.document && editor.document.languageId === 'norn') {
|
|
147
|
-
if (updateTimeout) {
|
|
148
|
-
clearTimeout(updateTimeout);
|
|
149
|
-
}
|
|
150
|
-
updateTimeout = setTimeout(() => {
|
|
151
|
-
this.updateDecorations(editor);
|
|
152
|
-
}, 300);
|
|
153
|
-
}
|
|
154
|
-
}));
|
|
155
|
-
// Initial decoration for active editor
|
|
156
|
-
const activeEditor = vscode.window.activeTextEditor;
|
|
157
|
-
if (activeEditor?.document.languageId === 'norn') {
|
|
158
|
-
this.updateDecorations(activeEditor);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Update decorations for a text editor
|
|
163
|
-
* Disabled - no gutter icons or line highlights for contract assertions
|
|
164
|
-
*/
|
|
165
|
-
updateDecorations(editor) {
|
|
166
|
-
// Contract decorations disabled - user requested clean editor without gutter icons/highlights
|
|
167
|
-
// Clear any existing decorations
|
|
168
|
-
editor.setDecorations(this.decorationTypes.pass, []);
|
|
169
|
-
editor.setDecorations(this.decorationTypes.fail, []);
|
|
170
|
-
editor.setDecorations(this.decorationTypes.warn, []);
|
|
171
|
-
editor.setDecorations(this.decorationTypes.stale, []);
|
|
172
|
-
editor.setDecorations(this.decorationTypes.unknown, []);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Refresh decorations on all visible editors
|
|
176
|
-
*/
|
|
177
|
-
refreshAllDecorations() {
|
|
178
|
-
for (const editor of vscode.window.visibleTextEditors) {
|
|
179
|
-
if (editor.document.languageId === 'norn') {
|
|
180
|
-
this.updateDecorations(editor);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
dispose() {
|
|
185
|
-
// Dispose decoration types
|
|
186
|
-
Object.values(this.decorationTypes).forEach(dt => dt.dispose());
|
|
187
|
-
// Dispose other subscriptions
|
|
188
|
-
this.disposables.forEach(d => d.dispose());
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
exports.ContractDecorationProvider = ContractDecorationProvider;
|
|
192
|
-
/**
|
|
193
|
-
* Create a hover provider for schema assertion decorations
|
|
194
|
-
*/
|
|
195
|
-
function createContractHoverProvider() {
|
|
196
|
-
return {
|
|
197
|
-
provideHover(document, position) {
|
|
198
|
-
const line = document.lineAt(position.line);
|
|
199
|
-
if (!MATCHES_SCHEMA_PATTERN.test(line.text)) {
|
|
200
|
-
return undefined;
|
|
201
|
-
}
|
|
202
|
-
const result = (0, validationCache_1.getResultForAssertion)(document.uri.fsPath, position.line);
|
|
203
|
-
if (!result) {
|
|
204
|
-
return new vscode.Hover([
|
|
205
|
-
new vscode.MarkdownString('**Contract Status:** ⚪ Not validated\n\nRun the sequence to validate this assertion.')
|
|
206
|
-
]);
|
|
207
|
-
}
|
|
208
|
-
const statusIcon = {
|
|
209
|
-
pass: '🟢',
|
|
210
|
-
fail: '🔴',
|
|
211
|
-
warn: '🟡',
|
|
212
|
-
stale: '⚪'
|
|
213
|
-
}[result.status] || '⚪';
|
|
214
|
-
const statusText = {
|
|
215
|
-
pass: 'Passed',
|
|
216
|
-
fail: 'Failed',
|
|
217
|
-
warn: 'Warning',
|
|
218
|
-
stale: 'Stale (re-run to update)'
|
|
219
|
-
}[result.status] || 'Unknown';
|
|
220
|
-
const md = new vscode.MarkdownString();
|
|
221
|
-
md.appendMarkdown(`**Contract Status:** ${statusIcon} ${statusText}\n\n`);
|
|
222
|
-
md.appendMarkdown(`**Schema:** \`${result.schemaPath}\`\n\n`);
|
|
223
|
-
if (result.lastRunTime) {
|
|
224
|
-
const date = new Date(result.lastRunTime);
|
|
225
|
-
md.appendMarkdown(`**Last Run:** ${date.toLocaleString()}\n\n`);
|
|
226
|
-
}
|
|
227
|
-
if (result.environment) {
|
|
228
|
-
md.appendMarkdown(`**Environment:** ${result.environment}\n\n`);
|
|
229
|
-
}
|
|
230
|
-
if (result.status === 'fail' && result.errorCount) {
|
|
231
|
-
md.appendMarkdown(`**Errors:** ${result.errorCount}\n\n`);
|
|
232
|
-
if (result.errorSummary) {
|
|
233
|
-
md.appendMarkdown(`> ${result.errorSummary}\n\n`);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
// Add action link
|
|
237
|
-
md.appendMarkdown(`[Open Contract View](command:norn.openContractView?${encodeURIComponent(JSON.stringify({ schemaPath: result.schemaPath }))})`);
|
|
238
|
-
md.isTrusted = true;
|
|
239
|
-
return new vscode.Hover(md);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
//# sourceMappingURL=contractDecorationProvider.js.map
|