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.
- package/.claude/skills/norn-social-campaign/SKILL.md +70 -0
- package/CHANGELOG.md +6 -0
- package/demos/nornenv-region-refactor/README.md +64 -0
- package/dist/cli.js +360 -1
- package/out/apiResponseIntellisenseCache.js +394 -0
- package/out/assertionRunner.js +567 -0
- package/out/cacheDir.js +136 -0
- package/out/chatParticipant.js +763 -0
- package/out/cli/colors.js +127 -0
- package/out/cli/formatters/assertion.js +102 -0
- package/out/cli/formatters/index.js +23 -0
- package/out/cli/formatters/response.js +106 -0
- package/out/cli/formatters/summary.js +246 -0
- package/out/cli/redaction.js +237 -0
- package/out/cli/reporters/html.js +689 -0
- package/out/cli/reporters/index.js +22 -0
- package/out/cli/reporters/junit.js +226 -0
- package/out/codeLensProvider.js +351 -0
- package/out/compareContentProvider.js +85 -0
- package/out/completionProvider.js +3739 -0
- package/out/contractAssertionSummary.js +225 -0
- package/out/contractDecorationProvider.js +243 -0
- package/out/coverageCalculator.js +879 -0
- package/out/coveragePanel.js +597 -0
- package/out/debug/breakpointResolver.js +84 -0
- package/out/debug/breakpoints.js +52 -0
- package/out/debug/nornDebugAdapter.js +166 -0
- package/out/debug/nornDebugSession.js +613 -0
- package/out/debug/sequenceLocationIndex.js +77 -0
- package/out/debug/types.js +3 -0
- package/out/deepClone.js +21 -0
- package/out/diagnosticProvider.js +2554 -0
- package/out/environmentParser.js +736 -0
- package/out/environmentProvider.js +544 -0
- package/out/environmentTemplates.js +146 -0
- package/out/errors/formatError.js +113 -0
- package/out/errors/nornError.js +29 -0
- package/out/formUrlEncoded.js +89 -0
- package/out/httpClient.js +348 -0
- package/out/httpRuntimeOptions.js +16 -0
- package/out/importErrors.js +31 -0
- package/out/inlayHintResolver.js +70 -0
- package/out/jsonFileReader.js +323 -0
- package/out/mcpClient.js +193 -0
- package/out/mcpConfig.js +184 -0
- package/out/mcpToolIntellisenseCache.js +96 -0
- package/out/mcpToolSchema.js +50 -0
- package/out/nornConfig.js +132 -0
- package/out/nornHoverProvider.js +124 -0
- package/out/nornInlayHintsProvider.js +191 -0
- package/out/nornPrompt.js +755 -0
- package/out/nornSqlParser.js +286 -0
- package/out/nornapiHoverProvider.js +135 -0
- package/out/nornapiInlayHintsProvider.js +94 -0
- package/out/nornapiParser.js +324 -0
- package/out/nornenvCodeActionProvider.js +101 -0
- package/out/nornenvDecorationProvider.js +239 -0
- package/out/nornenvFoldingProvider.js +63 -0
- package/out/nornenvHoverProvider.js +114 -0
- package/out/nornenvInlayHintsProvider.js +99 -0
- package/out/nornenvLanguageModel.js +187 -0
- package/out/nornenvRegionRefactor.js +267 -0
- package/out/nornsqlHoverProvider.js +95 -0
- package/out/nornsqlInlayHintsProvider.js +114 -0
- package/out/parser.js +839 -0
- package/out/pathAccess.js +28 -0
- package/out/postmanImportPanel.js +732 -0
- package/out/postmanImportPlanner.js +1155 -0
- package/out/postmanImportSidebarView.js +532 -0
- package/out/quotedString.js +35 -0
- package/out/requestPreparation.js +179 -0
- package/out/requestValidation.js +146 -0
- package/out/responsePanel.js +7754 -0
- package/out/schemaGenerator.js +562 -0
- package/out/scriptRunner.js +419 -0
- package/out/secrets/cliSecrets.js +415 -0
- package/out/secrets/crypto.js +105 -0
- package/out/secrets/envFileSecrets.js +177 -0
- package/out/secrets/keyStore.js +259 -0
- package/out/sequenceDeclaration.js +15 -0
- package/out/sequenceRunner.js +3590 -0
- package/out/sqlAdapterRunner.js +122 -0
- package/out/sqlBuiltInAdapters.js +604 -0
- package/out/sqlConfig.js +184 -0
- package/out/starterCatalog.js +554 -0
- package/out/stringUtils.js +25 -0
- package/out/swaggerBodyIntellisenseCache.js +114 -0
- package/out/swaggerParser.js +464 -0
- package/out/testProvider.js +767 -0
- package/out/theoryCaseLoader.js +113 -0
- package/out/validationCache.js +211 -0
- package/package.json +6 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.formatTheoryCaseLabel = formatTheoryCaseLabel;
|
|
37
|
+
exports.normalizeTheoryCase = normalizeTheoryCase;
|
|
38
|
+
exports.loadTheoryCasesFromSource = loadTheoryCasesFromSource;
|
|
39
|
+
exports.resolveTheoryCases = resolveTheoryCases;
|
|
40
|
+
exports.buildTheoryCaseArgs = buildTheoryCaseArgs;
|
|
41
|
+
exports.resolveSequenceRunCases = resolveSequenceRunCases;
|
|
42
|
+
const fs = __importStar(require("fs/promises"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
function formatTheoryCaseLabel(params, index) {
|
|
45
|
+
const entries = Object.entries(params);
|
|
46
|
+
if (entries.length === 0) {
|
|
47
|
+
return index === undefined ? '[]' : `Case ${index + 1}`;
|
|
48
|
+
}
|
|
49
|
+
const parts = entries.map(([key, value]) => {
|
|
50
|
+
if (typeof value === 'string') {
|
|
51
|
+
return `${key}="${value}"`;
|
|
52
|
+
}
|
|
53
|
+
return `${key}=${value}`;
|
|
54
|
+
});
|
|
55
|
+
return `[${parts.join(', ')}]`;
|
|
56
|
+
}
|
|
57
|
+
function normalizeTheoryCase(caseValue, sequenceParamNames) {
|
|
58
|
+
if (caseValue && typeof caseValue === 'object' && !Array.isArray(caseValue)) {
|
|
59
|
+
return caseValue;
|
|
60
|
+
}
|
|
61
|
+
if (sequenceParamNames.length === 1) {
|
|
62
|
+
return { [sequenceParamNames[0]]: caseValue };
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
async function loadTheoryCasesFromSource(sourcePath, workingDir, sequenceParamNames) {
|
|
67
|
+
const resolvedPath = path.resolve(workingDir, sourcePath);
|
|
68
|
+
const content = await fs.readFile(resolvedPath, 'utf-8');
|
|
69
|
+
const parsed = JSON.parse(content);
|
|
70
|
+
if (!Array.isArray(parsed)) {
|
|
71
|
+
throw new Error(`Theory file "${sourcePath}" must contain a JSON array of test cases`);
|
|
72
|
+
}
|
|
73
|
+
const cases = [];
|
|
74
|
+
for (let index = 0; index < parsed.length; index++) {
|
|
75
|
+
const normalized = normalizeTheoryCase(parsed[index], sequenceParamNames);
|
|
76
|
+
if (!normalized) {
|
|
77
|
+
throw new Error(`Theory file "${sourcePath}" has invalid case at index ${index}. ` +
|
|
78
|
+
'Use objects for multi-parameter sequences.');
|
|
79
|
+
}
|
|
80
|
+
cases.push(normalized);
|
|
81
|
+
}
|
|
82
|
+
return cases;
|
|
83
|
+
}
|
|
84
|
+
async function resolveTheoryCases(sequence, workingDir) {
|
|
85
|
+
const inlineCases = sequence.theoryData?.cases ?? [];
|
|
86
|
+
if (inlineCases.length > 0) {
|
|
87
|
+
return inlineCases;
|
|
88
|
+
}
|
|
89
|
+
if (!sequence.theoryData?.source) {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
return loadTheoryCasesFromSource(sequence.theoryData.source, workingDir, sequence.parameters.map(parameter => parameter.name));
|
|
93
|
+
}
|
|
94
|
+
function buildTheoryCaseArgs(defaultArgs, caseParams) {
|
|
95
|
+
const args = { ...defaultArgs };
|
|
96
|
+
for (const [key, value] of Object.entries(caseParams)) {
|
|
97
|
+
if (value !== undefined) {
|
|
98
|
+
args[key] = String(value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return args;
|
|
102
|
+
}
|
|
103
|
+
async function resolveSequenceRunCases(sequence, workingDir, defaultArgs) {
|
|
104
|
+
const cases = await resolveTheoryCases(sequence, workingDir);
|
|
105
|
+
if (cases.length === 0) {
|
|
106
|
+
return [{ args: { ...defaultArgs } }];
|
|
107
|
+
}
|
|
108
|
+
return cases.map((caseParams, index) => ({
|
|
109
|
+
label: formatTheoryCaseLabel(caseParams, index),
|
|
110
|
+
args: buildTheoryCaseArgs(defaultArgs, caseParams)
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=theoryCaseLoader.js.map
|
|
@@ -0,0 +1,211 @@
|
|
|
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 vscode = __importStar(require("vscode"));
|
|
48
|
+
const cacheDir_1 = require("./cacheDir");
|
|
49
|
+
const CACHE_VERSION = 1;
|
|
50
|
+
const CACHE_FILE = 'validation-results.json';
|
|
51
|
+
/**
|
|
52
|
+
* Get the workspace root folder
|
|
53
|
+
*/
|
|
54
|
+
function getWorkspaceRoot() {
|
|
55
|
+
const workspaceFolders = vscode.workspace.workspaceFolders;
|
|
56
|
+
if (workspaceFolders && workspaceFolders.length > 0) {
|
|
57
|
+
return workspaceFolders[0].uri.fsPath;
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get the path to the cache file
|
|
63
|
+
*/
|
|
64
|
+
function getCachePath() {
|
|
65
|
+
const root = getWorkspaceRoot();
|
|
66
|
+
if (!root) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
return (0, cacheDir_1.getNornCacheFilePath)(root, CACHE_FILE);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Ensure the cache directory exists
|
|
73
|
+
*/
|
|
74
|
+
function ensureCacheDir() {
|
|
75
|
+
const root = getWorkspaceRoot();
|
|
76
|
+
if (!root) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return !!(0, cacheDir_1.ensureNornCacheDir)(root);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Load the validation cache from disk
|
|
83
|
+
*/
|
|
84
|
+
function loadCache() {
|
|
85
|
+
return (0, cacheDir_1.loadVersionedJsonCache)({
|
|
86
|
+
cachePath: getCachePath(),
|
|
87
|
+
version: CACHE_VERSION,
|
|
88
|
+
createDefault: () => ({ version: CACHE_VERSION, results: {} }),
|
|
89
|
+
isValid: cache => typeof cache.results === 'object' && cache.results !== null
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Save the cache to disk
|
|
94
|
+
*/
|
|
95
|
+
function saveCache(cache) {
|
|
96
|
+
return (0, cacheDir_1.saveVersionedJsonCache)(getCachePath(), cache, ensureCacheDir);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Generate a cache key from source file and line number
|
|
100
|
+
*/
|
|
101
|
+
function getCacheKey(sourceFile, line) {
|
|
102
|
+
// Normalize to workspace-relative path
|
|
103
|
+
const root = getWorkspaceRoot();
|
|
104
|
+
let relativePath = sourceFile;
|
|
105
|
+
if (root && sourceFile.startsWith(root)) {
|
|
106
|
+
relativePath = sourceFile.slice(root.length + 1);
|
|
107
|
+
}
|
|
108
|
+
return `${relativePath}:${line}`;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Save a validation result to the cache
|
|
112
|
+
*/
|
|
113
|
+
function saveValidationResult(result) {
|
|
114
|
+
const cache = loadCache();
|
|
115
|
+
const key = getCacheKey(result.sourceFile, result.assertionLine);
|
|
116
|
+
// Normalize paths
|
|
117
|
+
const root = getWorkspaceRoot();
|
|
118
|
+
if (root) {
|
|
119
|
+
if (result.sourceFile.startsWith(root)) {
|
|
120
|
+
result.sourceFile = result.sourceFile.slice(root.length + 1);
|
|
121
|
+
}
|
|
122
|
+
if (result.schemaPath.startsWith(root)) {
|
|
123
|
+
result.schemaPath = result.schemaPath.slice(root.length + 1);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
cache.results[key] = result;
|
|
127
|
+
saveCache(cache);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get validation result for a specific assertion
|
|
131
|
+
* @param sourceFile Absolute path to the .norn file
|
|
132
|
+
* @param line Line number (0-based)
|
|
133
|
+
*/
|
|
134
|
+
function getResultForAssertion(sourceFile, line) {
|
|
135
|
+
const cache = loadCache();
|
|
136
|
+
const key = getCacheKey(sourceFile, line);
|
|
137
|
+
return cache.results[key];
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get all validation results for a source file
|
|
141
|
+
* @param sourceFile Absolute path to the .norn file
|
|
142
|
+
*/
|
|
143
|
+
function getResultsForFile(sourceFile) {
|
|
144
|
+
const cache = loadCache();
|
|
145
|
+
const results = [];
|
|
146
|
+
// Normalize path for comparison
|
|
147
|
+
const root = getWorkspaceRoot();
|
|
148
|
+
let normalizedPath = sourceFile;
|
|
149
|
+
if (root && sourceFile.startsWith(root)) {
|
|
150
|
+
normalizedPath = sourceFile.slice(root.length + 1);
|
|
151
|
+
}
|
|
152
|
+
for (const [key, result] of Object.entries(cache.results)) {
|
|
153
|
+
const [filePath] = key.split(':');
|
|
154
|
+
if (filePath === normalizedPath) {
|
|
155
|
+
results.push(result);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return results;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Clear all cached results for a specific file
|
|
162
|
+
*/
|
|
163
|
+
function clearResultsForFile(sourceFile) {
|
|
164
|
+
const cache = loadCache();
|
|
165
|
+
// Normalize path for comparison
|
|
166
|
+
const root = getWorkspaceRoot();
|
|
167
|
+
let normalizedPath = sourceFile;
|
|
168
|
+
if (root && sourceFile.startsWith(root)) {
|
|
169
|
+
normalizedPath = sourceFile.slice(root.length + 1);
|
|
170
|
+
}
|
|
171
|
+
const keysToDelete = [];
|
|
172
|
+
for (const key of Object.keys(cache.results)) {
|
|
173
|
+
const [filePath] = key.split(':');
|
|
174
|
+
if (filePath === normalizedPath) {
|
|
175
|
+
keysToDelete.push(key);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
keysToDelete.forEach(key => delete cache.results[key]);
|
|
179
|
+
saveCache(cache);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Clear all cached results
|
|
183
|
+
*/
|
|
184
|
+
function clearAllResults() {
|
|
185
|
+
const cache = { version: CACHE_VERSION, results: {} };
|
|
186
|
+
saveCache(cache);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Mark all results for a file as stale (used when file changes)
|
|
190
|
+
*/
|
|
191
|
+
function markResultsAsStale(sourceFile) {
|
|
192
|
+
const cache = loadCache();
|
|
193
|
+
// Normalize path for comparison
|
|
194
|
+
const root = getWorkspaceRoot();
|
|
195
|
+
let normalizedPath = sourceFile;
|
|
196
|
+
if (root && sourceFile.startsWith(root)) {
|
|
197
|
+
normalizedPath = sourceFile.slice(root.length + 1);
|
|
198
|
+
}
|
|
199
|
+
let modified = false;
|
|
200
|
+
for (const [key, result] of Object.entries(cache.results)) {
|
|
201
|
+
const [filePath] = key.split(':');
|
|
202
|
+
if (filePath === normalizedPath && result.status !== 'stale') {
|
|
203
|
+
result.status = 'stale';
|
|
204
|
+
modified = true;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (modified) {
|
|
208
|
+
saveCache(cache);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=validationCache.js.map
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "norn-cli",
|
|
3
3
|
"displayName": "Norn — API Tests in Your Repo",
|
|
4
4
|
"description": "Version-controlled API tests your team can keep. Author and debug HTTP sequences in VS Code, then run the same files in CI.",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.4.0",
|
|
6
6
|
"publisher": "Norn-PeterKrustanov",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Peter Krastanov"
|
|
@@ -103,6 +103,11 @@
|
|
|
103
103
|
"title": "Peek Inherited Norn Environment Variables",
|
|
104
104
|
"category": "Norn"
|
|
105
105
|
},
|
|
106
|
+
{
|
|
107
|
+
"command": "norn.nornenv.refactorRegionPattern",
|
|
108
|
+
"title": "Refactor Region Pattern To Templates",
|
|
109
|
+
"category": "Norn"
|
|
110
|
+
},
|
|
106
111
|
{
|
|
107
112
|
"command": "norn.showCoverage",
|
|
108
113
|
"title": "Show API Coverage",
|