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,259 @@
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.resolveSecretKey = resolveSecretKey;
37
+ exports.setSessionSecretKey = setSessionSecretKey;
38
+ exports.clearSessionSecretKeys = clearSessionSecretKeys;
39
+ exports.listSessionSecretKeyIds = listSessionSecretKeyIds;
40
+ exports.saveSecretKeyToCache = saveSecretKeyToCache;
41
+ exports.removeSecretKeyFromCache = removeSecretKeyFromCache;
42
+ exports.listCachedSecretKeyIds = listCachedSecretKeyIds;
43
+ const fs = __importStar(require("fs"));
44
+ const path = __importStar(require("path"));
45
+ const cacheDir_1 = require("../cacheDir");
46
+ const CACHE_FILE = 'secret-keys.json';
47
+ const CACHE_VERSION = 1;
48
+ const CACHE_SCAN_IGNORED_DIRS = new Set(['node_modules', '.git', 'dist', 'out']);
49
+ const sessionKeys = new Map();
50
+ const projectSecretKeyCacheDirs = new Map();
51
+ function getCacheFilePath(cacheDir) {
52
+ return path.join(cacheDir, CACHE_FILE);
53
+ }
54
+ function cacheFileExists(cacheDir) {
55
+ const cacheFilePath = getCacheFilePath(cacheDir);
56
+ try {
57
+ return fs.existsSync(cacheFilePath) && fs.statSync(cacheFilePath).isFile();
58
+ }
59
+ catch {
60
+ return false;
61
+ }
62
+ }
63
+ function getProjectSecretKeyCacheDirs(projectRoot) {
64
+ const cached = projectSecretKeyCacheDirs.get(projectRoot);
65
+ if (cached && cached.every(cacheDir => cacheFileExists(cacheDir))) {
66
+ return cached;
67
+ }
68
+ const results = [];
69
+ const queue = [projectRoot];
70
+ while (queue.length > 0) {
71
+ const dir = queue.shift();
72
+ if (!dir) {
73
+ continue;
74
+ }
75
+ const cacheDir = path.join(dir, cacheDir_1.NORN_CACHE_DIR);
76
+ if (cacheFileExists(cacheDir)) {
77
+ results.push(cacheDir);
78
+ }
79
+ let entries;
80
+ try {
81
+ entries = fs.readdirSync(dir, { withFileTypes: true });
82
+ }
83
+ catch {
84
+ continue;
85
+ }
86
+ for (const entry of entries) {
87
+ if (!entry.isDirectory()) {
88
+ continue;
89
+ }
90
+ if (entry.name === cacheDir_1.NORN_CACHE_DIR || CACHE_SCAN_IGNORED_DIRS.has(entry.name)) {
91
+ continue;
92
+ }
93
+ queue.push(path.join(dir, entry.name));
94
+ }
95
+ }
96
+ results.sort();
97
+ projectSecretKeyCacheDirs.set(projectRoot, results);
98
+ return results;
99
+ }
100
+ function getCacheDistance(targetPath, cacheDir) {
101
+ const relative = path.relative((0, cacheDir_1.getSearchStartDirectory)(targetPath), cacheDir);
102
+ if (!relative || relative === '.') {
103
+ return 0;
104
+ }
105
+ return relative.split(path.sep).filter(segment => segment !== '').length;
106
+ }
107
+ function findExistingSecretKeyCacheDir(targetPath) {
108
+ const projectRoot = (0, cacheDir_1.findProjectRoot)(targetPath);
109
+ const candidates = getProjectSecretKeyCacheDirs(projectRoot);
110
+ let bestMatch;
111
+ let bestScore = Number.POSITIVE_INFINITY;
112
+ for (const candidate of candidates) {
113
+ const score = getCacheDistance(targetPath, candidate);
114
+ if (score < bestScore || (score === bestScore && candidate < (bestMatch ?? candidate))) {
115
+ bestMatch = candidate;
116
+ bestScore = score;
117
+ }
118
+ }
119
+ return bestMatch;
120
+ }
121
+ function rememberSecretKeyCacheDir(targetPath, cacheDir) {
122
+ const projectRoot = (0, cacheDir_1.findProjectRoot)(targetPath);
123
+ const cached = projectSecretKeyCacheDirs.get(projectRoot) ?? [];
124
+ if (cached.includes(cacheDir)) {
125
+ return;
126
+ }
127
+ projectSecretKeyCacheDirs.set(projectRoot, [...cached, cacheDir].sort());
128
+ }
129
+ function ensureCacheDir(targetPath) {
130
+ const existing = findExistingSecretKeyCacheDir(targetPath);
131
+ const projectRoot = (0, cacheDir_1.findProjectRoot)(targetPath);
132
+ const cacheDir = existing ?? path.join(projectRoot, cacheDir_1.NORN_CACHE_DIR);
133
+ if (!fs.existsSync(cacheDir)) {
134
+ fs.mkdirSync(cacheDir, { recursive: true });
135
+ }
136
+ (0, cacheDir_1.ensureNornCacheGitignore)(cacheDir);
137
+ rememberSecretKeyCacheDir(targetPath, cacheDir);
138
+ return cacheDir;
139
+ }
140
+ function getReadCachePath(targetPath) {
141
+ const existing = findExistingSecretKeyCacheDir(targetPath);
142
+ if (existing) {
143
+ return getCacheFilePath(existing);
144
+ }
145
+ const projectRoot = (0, cacheDir_1.findProjectRoot)(targetPath);
146
+ const projectCacheDir = path.join(projectRoot, cacheDir_1.NORN_CACHE_DIR);
147
+ if (fs.existsSync(projectCacheDir) && fs.statSync(projectCacheDir).isDirectory()) {
148
+ return getCacheFilePath(projectCacheDir);
149
+ }
150
+ return undefined;
151
+ }
152
+ function getWriteCachePath(targetPath) {
153
+ return getCacheFilePath(ensureCacheDir(targetPath));
154
+ }
155
+ function readCache(targetPath) {
156
+ const cachePath = getReadCachePath(targetPath);
157
+ if (!cachePath || !fs.existsSync(cachePath)) {
158
+ return { version: CACHE_VERSION, keys: {} };
159
+ }
160
+ try {
161
+ const parsed = JSON.parse(fs.readFileSync(cachePath, 'utf8'));
162
+ if (parsed.version !== CACHE_VERSION || typeof parsed.keys !== 'object' || parsed.keys === null) {
163
+ return { version: CACHE_VERSION, keys: {} };
164
+ }
165
+ return parsed;
166
+ }
167
+ catch {
168
+ return { version: CACHE_VERSION, keys: {} };
169
+ }
170
+ }
171
+ function writeCache(targetPath, cache) {
172
+ const cachePath = getWriteCachePath(targetPath);
173
+ fs.writeFileSync(cachePath, JSON.stringify(cache, null, 2), { encoding: 'utf8', mode: 0o600 });
174
+ try {
175
+ fs.chmodSync(cachePath, 0o600);
176
+ }
177
+ catch {
178
+ // Best-effort permission hardening.
179
+ }
180
+ }
181
+ function kidToEnvVarSuffix(kid) {
182
+ return kid.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase();
183
+ }
184
+ function getEnvMappedKeys() {
185
+ const raw = process.env.NORN_SECRET_KEYS;
186
+ if (!raw) {
187
+ return {};
188
+ }
189
+ try {
190
+ const parsed = JSON.parse(raw);
191
+ const mapped = {};
192
+ for (const [key, value] of Object.entries(parsed)) {
193
+ if (typeof value === 'string' && value.trim() !== '') {
194
+ mapped[key] = value;
195
+ }
196
+ }
197
+ return mapped;
198
+ }
199
+ catch {
200
+ return {};
201
+ }
202
+ }
203
+ function resolveSecretKey(kid, targetPath) {
204
+ const sessionValue = sessionKeys.get(kid);
205
+ if (sessionValue) {
206
+ return sessionValue;
207
+ }
208
+ const mapped = getEnvMappedKeys();
209
+ if (mapped[kid]) {
210
+ return mapped[kid];
211
+ }
212
+ const specific = process.env[`NORN_SECRET_KEY_${kidToEnvVarSuffix(kid)}`];
213
+ if (specific && specific.trim() !== '') {
214
+ return specific;
215
+ }
216
+ const cache = readCache(targetPath);
217
+ const cached = cache.keys[kid]?.value;
218
+ if (cached && cached.trim() !== '') {
219
+ return cached;
220
+ }
221
+ const fallback = process.env.NORN_SECRET_KEY;
222
+ if (fallback && fallback.trim() !== '') {
223
+ return fallback;
224
+ }
225
+ return undefined;
226
+ }
227
+ function setSessionSecretKey(kid, key) {
228
+ sessionKeys.set(kid, key);
229
+ }
230
+ function clearSessionSecretKeys() {
231
+ sessionKeys.clear();
232
+ }
233
+ function listSessionSecretKeyIds() {
234
+ return Array.from(sessionKeys.keys()).sort();
235
+ }
236
+ function saveSecretKeyToCache(kid, key, targetPath) {
237
+ const cache = readCache(targetPath);
238
+ cache.keys[kid] = {
239
+ value: key,
240
+ updatedAt: new Date().toISOString()
241
+ };
242
+ writeCache(targetPath, cache);
243
+ setSessionSecretKey(kid, key);
244
+ }
245
+ function removeSecretKeyFromCache(kid, targetPath) {
246
+ const cache = readCache(targetPath);
247
+ if (!cache.keys[kid]) {
248
+ return false;
249
+ }
250
+ delete cache.keys[kid];
251
+ writeCache(targetPath, cache);
252
+ sessionKeys.delete(kid);
253
+ return true;
254
+ }
255
+ function listCachedSecretKeyIds(targetPath) {
256
+ const cache = readCache(targetPath);
257
+ return Object.keys(cache.keys).sort();
258
+ }
259
+ //# sourceMappingURL=keyStore.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findSequenceDeclarationLine = findSequenceDeclarationLine;
4
+ function findSequenceDeclarationLine(lines, seqStartLine, seqEndLine, options = {}) {
5
+ const pattern = options.testOnly
6
+ ? /^\s*test\s+sequence\s+/
7
+ : /^\s*(test\s+)?sequence\s+/;
8
+ for (let index = seqStartLine; index <= seqEndLine; index++) {
9
+ if (pattern.test(lines[index])) {
10
+ return index;
11
+ }
12
+ }
13
+ return seqStartLine;
14
+ }
15
+ //# sourceMappingURL=sequenceDeclaration.js.map