norn-cli 1.6.1 → 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 +12 -0
  3. package/dist/cli.js +161 -59
  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
@@ -1,245 +0,0 @@
1
- "use strict";
2
- /**
3
- * Validation Cache - Stores schema validation results for decorations and status tracking
4
- * Results are persisted in .norn-cache/validation-results.json
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.loadCache = loadCache;
41
- exports.saveValidationResult = saveValidationResult;
42
- exports.getResultForAssertion = getResultForAssertion;
43
- exports.getResultsForFile = getResultsForFile;
44
- exports.clearResultsForFile = clearResultsForFile;
45
- exports.clearAllResults = clearAllResults;
46
- exports.markResultsAsStale = markResultsAsStale;
47
- const fs = __importStar(require("fs"));
48
- const path = __importStar(require("path"));
49
- const vscode = __importStar(require("vscode"));
50
- const CACHE_VERSION = 1;
51
- const CACHE_FOLDER = '.norn-cache';
52
- const CACHE_FILE = 'validation-results.json';
53
- /**
54
- * Get the workspace root folder
55
- */
56
- function getWorkspaceRoot() {
57
- const workspaceFolders = vscode.workspace.workspaceFolders;
58
- if (workspaceFolders && workspaceFolders.length > 0) {
59
- return workspaceFolders[0].uri.fsPath;
60
- }
61
- return undefined;
62
- }
63
- /**
64
- * Get the path to the cache file
65
- */
66
- function getCachePath() {
67
- const root = getWorkspaceRoot();
68
- if (!root) {
69
- return undefined;
70
- }
71
- return path.join(root, CACHE_FOLDER, CACHE_FILE);
72
- }
73
- /**
74
- * Ensure the cache directory exists
75
- */
76
- function ensureCacheDir() {
77
- const root = getWorkspaceRoot();
78
- if (!root) {
79
- return false;
80
- }
81
- const cacheDir = path.join(root, CACHE_FOLDER);
82
- if (!fs.existsSync(cacheDir)) {
83
- try {
84
- fs.mkdirSync(cacheDir, { recursive: true });
85
- }
86
- catch {
87
- return false;
88
- }
89
- }
90
- return true;
91
- }
92
- /**
93
- * Load the validation cache from disk
94
- */
95
- function loadCache() {
96
- const cachePath = getCachePath();
97
- if (!cachePath || !fs.existsSync(cachePath)) {
98
- return { version: CACHE_VERSION, results: {} };
99
- }
100
- try {
101
- const content = fs.readFileSync(cachePath, 'utf-8');
102
- const data = JSON.parse(content);
103
- // Handle version mismatch - clear cache
104
- if (data.version !== CACHE_VERSION) {
105
- return { version: CACHE_VERSION, results: {} };
106
- }
107
- return data;
108
- }
109
- catch {
110
- return { version: CACHE_VERSION, results: {} };
111
- }
112
- }
113
- /**
114
- * Save the cache to disk
115
- */
116
- function saveCache(cache) {
117
- if (!ensureCacheDir()) {
118
- return false;
119
- }
120
- const cachePath = getCachePath();
121
- if (!cachePath) {
122
- return false;
123
- }
124
- try {
125
- fs.writeFileSync(cachePath, JSON.stringify(cache, null, 2), 'utf-8');
126
- return true;
127
- }
128
- catch {
129
- return false;
130
- }
131
- }
132
- /**
133
- * Generate a cache key from source file and line number
134
- */
135
- function getCacheKey(sourceFile, line) {
136
- // Normalize to workspace-relative path
137
- const root = getWorkspaceRoot();
138
- let relativePath = sourceFile;
139
- if (root && sourceFile.startsWith(root)) {
140
- relativePath = sourceFile.slice(root.length + 1);
141
- }
142
- return `${relativePath}:${line}`;
143
- }
144
- /**
145
- * Save a validation result to the cache
146
- */
147
- function saveValidationResult(result) {
148
- const cache = loadCache();
149
- const key = getCacheKey(result.sourceFile, result.assertionLine);
150
- // Normalize paths
151
- const root = getWorkspaceRoot();
152
- if (root) {
153
- if (result.sourceFile.startsWith(root)) {
154
- result.sourceFile = result.sourceFile.slice(root.length + 1);
155
- }
156
- if (result.schemaPath.startsWith(root)) {
157
- result.schemaPath = result.schemaPath.slice(root.length + 1);
158
- }
159
- }
160
- cache.results[key] = result;
161
- saveCache(cache);
162
- }
163
- /**
164
- * Get validation result for a specific assertion
165
- * @param sourceFile Absolute path to the .norn file
166
- * @param line Line number (0-based)
167
- */
168
- function getResultForAssertion(sourceFile, line) {
169
- const cache = loadCache();
170
- const key = getCacheKey(sourceFile, line);
171
- return cache.results[key];
172
- }
173
- /**
174
- * Get all validation results for a source file
175
- * @param sourceFile Absolute path to the .norn file
176
- */
177
- function getResultsForFile(sourceFile) {
178
- const cache = loadCache();
179
- const results = [];
180
- // Normalize path for comparison
181
- const root = getWorkspaceRoot();
182
- let normalizedPath = sourceFile;
183
- if (root && sourceFile.startsWith(root)) {
184
- normalizedPath = sourceFile.slice(root.length + 1);
185
- }
186
- for (const [key, result] of Object.entries(cache.results)) {
187
- const [filePath] = key.split(':');
188
- if (filePath === normalizedPath) {
189
- results.push(result);
190
- }
191
- }
192
- return results;
193
- }
194
- /**
195
- * Clear all cached results for a specific file
196
- */
197
- function clearResultsForFile(sourceFile) {
198
- const cache = loadCache();
199
- // Normalize path for comparison
200
- const root = getWorkspaceRoot();
201
- let normalizedPath = sourceFile;
202
- if (root && sourceFile.startsWith(root)) {
203
- normalizedPath = sourceFile.slice(root.length + 1);
204
- }
205
- const keysToDelete = [];
206
- for (const key of Object.keys(cache.results)) {
207
- const [filePath] = key.split(':');
208
- if (filePath === normalizedPath) {
209
- keysToDelete.push(key);
210
- }
211
- }
212
- keysToDelete.forEach(key => delete cache.results[key]);
213
- saveCache(cache);
214
- }
215
- /**
216
- * Clear all cached results
217
- */
218
- function clearAllResults() {
219
- const cache = { version: CACHE_VERSION, results: {} };
220
- saveCache(cache);
221
- }
222
- /**
223
- * Mark all results for a file as stale (used when file changes)
224
- */
225
- function markResultsAsStale(sourceFile) {
226
- const cache = loadCache();
227
- // Normalize path for comparison
228
- const root = getWorkspaceRoot();
229
- let normalizedPath = sourceFile;
230
- if (root && sourceFile.startsWith(root)) {
231
- normalizedPath = sourceFile.slice(root.length + 1);
232
- }
233
- let modified = false;
234
- for (const [key, result] of Object.entries(cache.results)) {
235
- const [filePath] = key.split(':');
236
- if (filePath === normalizedPath && result.status !== 'stale') {
237
- result.status = 'stale';
238
- modified = true;
239
- }
240
- }
241
- if (modified) {
242
- saveCache(cache);
243
- }
244
- }
245
- //# sourceMappingURL=validationCache.js.map