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,191 @@
|
|
|
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.NornInlayHintsProvider = void 0;
|
|
37
|
+
exports.buildNornScopeIndex = buildNornScopeIndex;
|
|
38
|
+
exports.getInScopeDecls = getInScopeDecls;
|
|
39
|
+
exports.findEnclosingSequence = findEnclosingSequence;
|
|
40
|
+
exports.buildScopedVariablesAtLine = buildScopedVariablesAtLine;
|
|
41
|
+
const vscode = __importStar(require("vscode"));
|
|
42
|
+
const environmentProvider_1 = require("./environmentProvider");
|
|
43
|
+
const sequenceRunner_1 = require("./sequenceRunner");
|
|
44
|
+
const inlayHintResolver_1 = require("./inlayHintResolver");
|
|
45
|
+
const TEMPLATE_TOKEN_REGEX = /\{\{([^{}]+)\}\}/g;
|
|
46
|
+
// `var name = <expr>` — captures the bare name and the trimmed right-hand side.
|
|
47
|
+
const VAR_DECL_REGEX = /^\s*var\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(.+?)\s*$/;
|
|
48
|
+
// Values that come from runtime sources we can't evaluate at edit time.
|
|
49
|
+
const RUNTIME_VALUE_REGEX = /^(\$\d+|run\s|POST\s|GET\s|PUT\s|DELETE\s|PATCH\s|HEAD\s|OPTIONS\s)/i;
|
|
50
|
+
const QUOTED_STRING_REGEX = /^"([^"\\]*(?:\\.[^"\\]*)*)"$/;
|
|
51
|
+
function parseVarDecl(line, lineNumber, scope, sequenceName) {
|
|
52
|
+
const match = line.match(VAR_DECL_REGEX);
|
|
53
|
+
if (!match) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
const name = match[1];
|
|
57
|
+
const rawValue = match[2].trim();
|
|
58
|
+
if (RUNTIME_VALUE_REGEX.test(rawValue)) {
|
|
59
|
+
return { name, rawValue, lineNumber, scope, sequenceName, isRuntime: true };
|
|
60
|
+
}
|
|
61
|
+
const quoted = rawValue.match(QUOTED_STRING_REGEX);
|
|
62
|
+
const staticValue = quoted ? quoted[1].replace(/\\"/g, '"').replace(/\\\\/g, '\\') : rawValue;
|
|
63
|
+
return { name, rawValue, lineNumber, scope, sequenceName, isRuntime: false, staticValue };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Walks the `.norn` document and indexes every `var` declaration into the right scope.
|
|
67
|
+
* File-level vars are anything before the first sequence; sequence-local vars belong to
|
|
68
|
+
* the enclosing `[test ]sequence X` / `end sequence` block.
|
|
69
|
+
*/
|
|
70
|
+
function buildNornScopeIndex(text) {
|
|
71
|
+
const lines = text.split('\n');
|
|
72
|
+
const sequences = (0, sequenceRunner_1.extractSequences)(text);
|
|
73
|
+
const decls = [];
|
|
74
|
+
const sequenceBoundaries = new Map();
|
|
75
|
+
// Build a line→sequence lookup using extractSequences's startLine + lines array length.
|
|
76
|
+
const lineToSequence = new Map();
|
|
77
|
+
for (const seq of sequences) {
|
|
78
|
+
const startLine = seq.startLine
|
|
79
|
+
?? seq.lineNumber
|
|
80
|
+
?? 0;
|
|
81
|
+
const lineCount = seq.lines?.length ?? 1;
|
|
82
|
+
const endLine = startLine + lineCount - 1;
|
|
83
|
+
sequenceBoundaries.set(seq.name, { startLine, endLine });
|
|
84
|
+
for (let i = startLine; i <= endLine; i++) {
|
|
85
|
+
lineToSequence.set(i, seq.name);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (let i = 0; i < lines.length; i++) {
|
|
89
|
+
const sequenceName = lineToSequence.get(i);
|
|
90
|
+
const scope = sequenceName ? 'sequence-local' : 'file-local';
|
|
91
|
+
const decl = parseVarDecl(lines[i], i, scope, sequenceName);
|
|
92
|
+
if (decl) {
|
|
93
|
+
decls.push(decl);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return { decls, sequenceBoundaries };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* For a given line, returns the var declarations that are in scope and visible at this point:
|
|
100
|
+
* - All file-level vars (regardless of position; they're top-of-file conceptually).
|
|
101
|
+
* - Sequence-local vars declared *before* `lineNumber` in the *same* enclosing sequence.
|
|
102
|
+
*/
|
|
103
|
+
function getInScopeDecls(index, lineNumber) {
|
|
104
|
+
const enclosingSequence = findEnclosingSequence(index, lineNumber);
|
|
105
|
+
return index.decls.filter(decl => {
|
|
106
|
+
if (decl.scope === 'file-local') {
|
|
107
|
+
return decl.lineNumber < lineNumber;
|
|
108
|
+
}
|
|
109
|
+
if (decl.scope === 'sequence-local') {
|
|
110
|
+
return decl.sequenceName === enclosingSequence && decl.lineNumber < lineNumber;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function findEnclosingSequence(index, lineNumber) {
|
|
116
|
+
for (const [name, { startLine, endLine }] of index.sequenceBoundaries) {
|
|
117
|
+
if (lineNumber >= startLine && lineNumber <= endLine) {
|
|
118
|
+
return name;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Builds the merged variables map for a given line in a `.norn` file:
|
|
125
|
+
* env (common + ancestor chain + self) ← file-locals ← sequence-locals.
|
|
126
|
+
* Runtime-only vars are deliberately omitted — references to them stay unresolvable
|
|
127
|
+
* so the inlay layer skips them silently.
|
|
128
|
+
*/
|
|
129
|
+
function buildScopedVariablesAtLine(envVariables, index, lineNumber) {
|
|
130
|
+
const merged = { ...envVariables };
|
|
131
|
+
for (const decl of getInScopeDecls(index, lineNumber)) {
|
|
132
|
+
if (decl.isRuntime || decl.staticValue === undefined) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
merged[decl.name] = decl.staticValue;
|
|
136
|
+
}
|
|
137
|
+
return merged;
|
|
138
|
+
}
|
|
139
|
+
class NornInlayHintsProvider {
|
|
140
|
+
emitter = new vscode.EventEmitter();
|
|
141
|
+
environmentSubscription;
|
|
142
|
+
onDidChangeInlayHints = this.emitter.event;
|
|
143
|
+
constructor() {
|
|
144
|
+
this.environmentSubscription = (0, environmentProvider_1.onDidChangeActiveEnvironment)(() => {
|
|
145
|
+
this.emitter.fire();
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
provideInlayHints(document, range) {
|
|
149
|
+
const hints = [];
|
|
150
|
+
try {
|
|
151
|
+
const filePath = document.uri.scheme === 'file' ? document.uri.fsPath : undefined;
|
|
152
|
+
if (!filePath) {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
const config = (0, environmentProvider_1.loadEnvironmentConfig)(filePath);
|
|
156
|
+
const envVariables = config ? (0, environmentProvider_1.getEnvironmentVariables)(filePath) : {};
|
|
157
|
+
const secretNames = config?.secretNames ?? new Set();
|
|
158
|
+
const index = buildNornScopeIndex(document.getText());
|
|
159
|
+
for (let lineNumber = range.start.line; lineNumber <= range.end.line; lineNumber++) {
|
|
160
|
+
const line = document.lineAt(lineNumber).text;
|
|
161
|
+
if (!line.includes('{{')) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const variables = buildScopedVariablesAtLine(envVariables, index, lineNumber);
|
|
165
|
+
TEMPLATE_TOKEN_REGEX.lastIndex = 0;
|
|
166
|
+
for (const match of line.matchAll(TEMPLATE_TOKEN_REGEX)) {
|
|
167
|
+
const resolved = (0, inlayHintResolver_1.resolveInlayValueLabel)(match[1], variables, secretNames);
|
|
168
|
+
if (!resolved) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
const tokenEnd = (match.index ?? 0) + match[0].length;
|
|
172
|
+
const hint = new vscode.InlayHint(new vscode.Position(lineNumber, tokenEnd), resolved.label, vscode.InlayHintKind.Parameter);
|
|
173
|
+
hint.tooltip = resolved.secret
|
|
174
|
+
? `'${match[1].trim()}' resolves from a secret value.`
|
|
175
|
+
: `'${match[1].trim()}' resolves to '${resolved.value}'.`;
|
|
176
|
+
hints.push(hint);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
return [];
|
|
182
|
+
}
|
|
183
|
+
return hints;
|
|
184
|
+
}
|
|
185
|
+
dispose() {
|
|
186
|
+
this.environmentSubscription.dispose();
|
|
187
|
+
this.emitter.dispose();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.NornInlayHintsProvider = NornInlayHintsProvider;
|
|
191
|
+
//# sourceMappingURL=nornInlayHintsProvider.js.map
|