cursortoys-cli 0.1.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/README.md +233 -0
- package/dist/assertionParser.d.ts +24 -0
- package/dist/assertionParser.d.ts.map +1 -0
- package/dist/assertionParser.js +234 -0
- package/dist/assertionParser.js.map +1 -0
- package/dist/assertionTypes.d.ts +36 -0
- package/dist/assertionTypes.d.ts.map +1 -0
- package/dist/assertionTypes.js +6 -0
- package/dist/assertionTypes.js.map +1 -0
- package/dist/assertionValidator.d.ts +16 -0
- package/dist/assertionValidator.d.ts.map +1 -0
- package/dist/assertionValidator.js +268 -0
- package/dist/assertionValidator.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +270 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/http-test.d.ts +34 -0
- package/dist/commands/http-test.d.ts.map +1 -0
- package/dist/commands/http-test.js +339 -0
- package/dist/commands/http-test.js.map +1 -0
- package/dist/commands/skill-add.d.ts +28 -0
- package/dist/commands/skill-add.d.ts.map +1 -0
- package/dist/commands/skill-add.js +145 -0
- package/dist/commands/skill-add.js.map +1 -0
- package/dist/httpRunner.d.ts +63 -0
- package/dist/httpRunner.d.ts.map +1 -0
- package/dist/httpRunner.js +576 -0
- package/dist/httpRunner.js.map +1 -0
- package/llms.txt +197 -0
- package/package.json +62 -0
|
@@ -0,0 +1,339 @@
|
|
|
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.runHttpTest = runHttpTest;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const httpRunner_1 = require("../httpRunner");
|
|
40
|
+
const assertionParser_1 = require("../assertionParser");
|
|
41
|
+
const assertionValidator_1 = require("../assertionValidator");
|
|
42
|
+
function getWorkspacePath(opts) {
|
|
43
|
+
return opts.project ? path.resolve(opts.project) : process.cwd();
|
|
44
|
+
}
|
|
45
|
+
function getBaseFolder(opts) {
|
|
46
|
+
return (opts.baseFolder ||
|
|
47
|
+
process.env.CURSORTOYS_BASE_FOLDER ||
|
|
48
|
+
'cursor').toLowerCase();
|
|
49
|
+
}
|
|
50
|
+
function getEnvironmentsFolder(opts) {
|
|
51
|
+
return (opts.environmentsFolder ||
|
|
52
|
+
process.env.CURSORTOYS_ENVIRONMENTS_FOLDER ||
|
|
53
|
+
'.environments');
|
|
54
|
+
}
|
|
55
|
+
function getHttpPath(workspacePath, baseFolder) {
|
|
56
|
+
return path.join(workspacePath, `.${baseFolder}`, 'http');
|
|
57
|
+
}
|
|
58
|
+
function getEnvironmentsPath(workspacePath, baseFolder, environmentsFolder) {
|
|
59
|
+
return path.join(workspacePath, `.${baseFolder}`, 'http', environmentsFolder);
|
|
60
|
+
}
|
|
61
|
+
function discoverRequestFiles(httpPath, singleFile, excludeSubfolderName = '.environments') {
|
|
62
|
+
if (singleFile) {
|
|
63
|
+
const resolved = path.resolve(singleFile);
|
|
64
|
+
if (fs.existsSync(resolved))
|
|
65
|
+
return [resolved];
|
|
66
|
+
const fromHttp = path.join(httpPath, singleFile);
|
|
67
|
+
if (fs.existsSync(fromHttp))
|
|
68
|
+
return [fromHttp];
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
const files = [];
|
|
72
|
+
if (!fs.existsSync(httpPath))
|
|
73
|
+
return files;
|
|
74
|
+
function walk(dir, excludeDirName) {
|
|
75
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
76
|
+
for (const e of entries) {
|
|
77
|
+
const full = path.join(dir, e.name);
|
|
78
|
+
if (e.isDirectory()) {
|
|
79
|
+
if (e.name !== excludeDirName)
|
|
80
|
+
walk(full, excludeDirName);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const ext = path.extname(e.name).toLowerCase();
|
|
84
|
+
if (ext === '.req' || e.name.endsWith('.request'))
|
|
85
|
+
files.push(full);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
walk(httpPath, excludeSubfolderName);
|
|
89
|
+
return files.sort();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Splits file content into blocks by ### (REST Client separator) OR by detecting new HTTP requests.
|
|
93
|
+
* ### separator must be on a line by itself (only whitespace allowed).
|
|
94
|
+
* Also splits by ## headers that precede HTTP requests.
|
|
95
|
+
*/
|
|
96
|
+
function getRequestBlocks(content) {
|
|
97
|
+
const trimmed = content.trim();
|
|
98
|
+
// Check if content uses ### as separator (must be alone on a line)
|
|
99
|
+
const lines = trimmed.split('\n');
|
|
100
|
+
const hasSeparator = lines.some(line => line.trim() === '###');
|
|
101
|
+
if (hasSeparator) {
|
|
102
|
+
return trimmed
|
|
103
|
+
.split(/^###\s*$/m)
|
|
104
|
+
.map((b) => b.trim())
|
|
105
|
+
.filter(Boolean);
|
|
106
|
+
}
|
|
107
|
+
// Split by ## headers (these typically mark new requests)
|
|
108
|
+
const blocks = [];
|
|
109
|
+
let currentBlock = [];
|
|
110
|
+
let foundFirstHeader = false;
|
|
111
|
+
let inVariableSection = true; // Track if we're still in the @var section at the top
|
|
112
|
+
// Regex patterns
|
|
113
|
+
const headerRegex = /^##\s+[^#]/; // ## Title (but not ### decorative)
|
|
114
|
+
const varRegex = /^#\s*@(?:var|env)\s+/; // # @var or # @env
|
|
115
|
+
const httpMethodRegex = /^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)\s+/i;
|
|
116
|
+
const curlRegex = /^\s*curl\s+/i;
|
|
117
|
+
for (let i = 0; i < lines.length; i++) {
|
|
118
|
+
const line = lines[i];
|
|
119
|
+
const trimmedLine = line.trim();
|
|
120
|
+
// Check if this is still a variable/env declaration at the top
|
|
121
|
+
if (inVariableSection && (varRegex.test(trimmedLine) || trimmedLine === '' || (trimmedLine.startsWith('#') && !headerRegex.test(trimmedLine)))) {
|
|
122
|
+
// Still in variable section, skip these lines (they'll be picked up by extractFileVariables)
|
|
123
|
+
// But don't skip ## headers - they end the variable section
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
inVariableSection = false; // We've moved past the variable section
|
|
128
|
+
}
|
|
129
|
+
// Check if this is a section header (## Title, but not ###)
|
|
130
|
+
const isHeader = headerRegex.test(trimmedLine);
|
|
131
|
+
// If we found a ## header and we already have collected content with a previous header,
|
|
132
|
+
// save the current block (WITHOUT this new header) and start fresh WITH the new header
|
|
133
|
+
if (isHeader && foundFirstHeader && currentBlock.length > 0) {
|
|
134
|
+
blocks.push(currentBlock.join('\n').trim());
|
|
135
|
+
currentBlock = [line]; // Start new block with this header
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
// Add line to current block
|
|
139
|
+
currentBlock.push(line);
|
|
140
|
+
}
|
|
141
|
+
// Mark that we found at least one header
|
|
142
|
+
if (isHeader) {
|
|
143
|
+
foundFirstHeader = true;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Add the last block
|
|
147
|
+
if (currentBlock.length > 0) {
|
|
148
|
+
blocks.push(currentBlock.join('\n').trim());
|
|
149
|
+
}
|
|
150
|
+
// Filter out blocks that don't contain actual requests
|
|
151
|
+
return blocks.filter(block => {
|
|
152
|
+
const blockLines = block.split('\n');
|
|
153
|
+
return blockLines.some(line => {
|
|
154
|
+
const t = line.trim();
|
|
155
|
+
return httpMethodRegex.test(t) || curlRegex.test(t);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Runs http test: discover files, run all requests per file, report pass/fail.
|
|
161
|
+
*/
|
|
162
|
+
async function runHttpTest(opts) {
|
|
163
|
+
const workspacePath = getWorkspacePath(opts);
|
|
164
|
+
const baseFolder = getBaseFolder(opts);
|
|
165
|
+
const environmentsFolder = getEnvironmentsFolder(opts);
|
|
166
|
+
const defaultEnv = 'dev';
|
|
167
|
+
const timeout = opts.timeout ?? 10;
|
|
168
|
+
const verbose = opts.verbose ?? false;
|
|
169
|
+
const varOverrides = opts.varOverrides
|
|
170
|
+
? new Map(Object.entries(opts.varOverrides))
|
|
171
|
+
: undefined;
|
|
172
|
+
const httpPath = getHttpPath(workspacePath, baseFolder);
|
|
173
|
+
const envBasePath = getEnvironmentsPath(workspacePath, baseFolder, environmentsFolder);
|
|
174
|
+
const files = discoverRequestFiles(httpPath, opts.file, environmentsFolder);
|
|
175
|
+
const results = [];
|
|
176
|
+
for (const filePath of files) {
|
|
177
|
+
let content;
|
|
178
|
+
try {
|
|
179
|
+
content = fs.readFileSync(filePath, 'utf8');
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
results.push({
|
|
183
|
+
file: filePath,
|
|
184
|
+
passed: false,
|
|
185
|
+
statusCode: 0,
|
|
186
|
+
statusText: 'Error',
|
|
187
|
+
error: err instanceof Error ? err.message : String(err),
|
|
188
|
+
});
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
const blocks = getRequestBlocks(content);
|
|
192
|
+
if (blocks.length === 0) {
|
|
193
|
+
results.push({
|
|
194
|
+
file: filePath,
|
|
195
|
+
passed: false,
|
|
196
|
+
statusCode: 0,
|
|
197
|
+
statusText: 'Error',
|
|
198
|
+
error: 'No request content found (empty or no method/URL before ###)',
|
|
199
|
+
});
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const fileVars = (0, httpRunner_1.extractFileVariables)(content);
|
|
203
|
+
const envName = opts.env ?? (0, httpRunner_1.getEnvNameFromContent)(content) ?? defaultEnv;
|
|
204
|
+
// Get env path relative to the request file, not the current working directory
|
|
205
|
+
const fileDir = path.dirname(filePath);
|
|
206
|
+
const fileBaseName = path.basename(fileDir); // Should be 'http'
|
|
207
|
+
// Determine the environments folder path relative to the file
|
|
208
|
+
let envBasePath;
|
|
209
|
+
if (fileBaseName === 'http') {
|
|
210
|
+
// File is directly in .cursor/http/ or .vscode/http/
|
|
211
|
+
envBasePath = path.join(fileDir, environmentsFolder);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
// File might be in a subdirectory, try to find the http folder
|
|
215
|
+
const parentDir = path.dirname(fileDir);
|
|
216
|
+
if (path.basename(parentDir) === 'http') {
|
|
217
|
+
envBasePath = path.join(parentDir, environmentsFolder);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
// Fallback to original behavior
|
|
221
|
+
envBasePath = getEnvironmentsPath(workspacePath, baseFolder, environmentsFolder);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const envFilePath = path.join(envBasePath, `.env.${envName}`);
|
|
225
|
+
const fallbackEnvPath = path.join(envBasePath, '.env');
|
|
226
|
+
let envVars = (0, httpRunner_1.loadEnvFile)(envFilePath);
|
|
227
|
+
if (envVars.size === 0 && fs.existsSync(fallbackEnvPath)) {
|
|
228
|
+
envVars = (0, httpRunner_1.loadEnvFile)(fallbackEnvPath);
|
|
229
|
+
}
|
|
230
|
+
let totalInFile = 0;
|
|
231
|
+
const configsWithIndex = [];
|
|
232
|
+
// Accumulated file-level + block-level variables (cascade effect)
|
|
233
|
+
const accumulatedVars = new Map(fileVars);
|
|
234
|
+
for (let bi = 0; bi < blocks.length; bi++) {
|
|
235
|
+
try {
|
|
236
|
+
// Extract block-specific variables and merge with accumulated (cascade)
|
|
237
|
+
const blockVars = (0, httpRunner_1.extractBlockVariables)(blocks[bi]);
|
|
238
|
+
for (const [key, value] of blockVars.entries()) {
|
|
239
|
+
accumulatedVars.set(key, value); // Override/add to accumulated
|
|
240
|
+
}
|
|
241
|
+
// Extract block title (## header) and line number
|
|
242
|
+
let blockTitle;
|
|
243
|
+
let blockLine;
|
|
244
|
+
const blockLines = blocks[bi].split('\n');
|
|
245
|
+
const headerRegex = /^##\s+(.+)/;
|
|
246
|
+
for (let i = 0; i < blockLines.length; i++) {
|
|
247
|
+
const match = blockLines[i].trim().match(headerRegex);
|
|
248
|
+
if (match) {
|
|
249
|
+
blockTitle = match[1].trim();
|
|
250
|
+
// Calculate line number in original file
|
|
251
|
+
const linesBeforeBlock = blocks.slice(0, bi).join('\n').split('\n').length;
|
|
252
|
+
blockLine = linesBeforeBlock + i + 1;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// Extract assertions for this block BEFORE removing them
|
|
257
|
+
const blockAssertions = (0, assertionParser_1.extractAssertions)(blocks[bi]);
|
|
258
|
+
// Remove assertion blocks from the content before processing
|
|
259
|
+
const { removeAssertionBlocks } = require('../assertionParser');
|
|
260
|
+
let cleanedBlock = removeAssertionBlocks(blocks[bi]);
|
|
261
|
+
// Apply variable substitution to cleaned block using accumulated variables
|
|
262
|
+
let substituted = (0, httpRunner_1.substituteVariables)(cleanedBlock, accumulatedVars, envVars);
|
|
263
|
+
if (varOverrides && varOverrides.size > 0) {
|
|
264
|
+
substituted = (0, httpRunner_1.applyVariableOverrides)(substituted, varOverrides);
|
|
265
|
+
}
|
|
266
|
+
const blockConfigs = (0, httpRunner_1.parseBlockAll)(substituted);
|
|
267
|
+
for (let ri = 0; ri < blockConfigs.length; ri++) {
|
|
268
|
+
configsWithIndex.push({
|
|
269
|
+
config: blockConfigs[ri],
|
|
270
|
+
blockIndex: bi,
|
|
271
|
+
requestIndexInBlock: ri,
|
|
272
|
+
assertions: blockAssertions,
|
|
273
|
+
blockTitle,
|
|
274
|
+
blockLine
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
totalInFile += blockConfigs.length;
|
|
278
|
+
}
|
|
279
|
+
catch (err) {
|
|
280
|
+
throw err;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (configsWithIndex.length === 0) {
|
|
284
|
+
results.push({
|
|
285
|
+
file: filePath,
|
|
286
|
+
passed: false,
|
|
287
|
+
statusCode: 0,
|
|
288
|
+
statusText: 'Error',
|
|
289
|
+
error: 'Failed to parse any HTTP request (check METHOD URL or curl format)',
|
|
290
|
+
});
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
let requestIndex = 0;
|
|
294
|
+
for (const { config, assertions, blockTitle, blockLine } of configsWithIndex) {
|
|
295
|
+
requestIndex++;
|
|
296
|
+
const result = await (0, httpRunner_1.executeHttpRequest)(config, timeout);
|
|
297
|
+
// Validate assertions if any
|
|
298
|
+
let assertionResults = [];
|
|
299
|
+
let assertionsPassed = 0;
|
|
300
|
+
let assertionsTotal = 0;
|
|
301
|
+
if (assertions.length > 0) {
|
|
302
|
+
assertionResults = (0, assertionValidator_1.validateAssertions)(assertions, result, result.headers);
|
|
303
|
+
assertionsPassed = assertionResults.filter(r => r.passed).length;
|
|
304
|
+
assertionsTotal = assertionResults.length;
|
|
305
|
+
}
|
|
306
|
+
// Request passes based on:
|
|
307
|
+
// - If there are assertions: all assertions must pass (ignore HTTP status)
|
|
308
|
+
// - If no assertions: HTTP status must be 2xx
|
|
309
|
+
const allAssertionsPassed = assertionsTotal === 0 || assertionsPassed === assertionsTotal;
|
|
310
|
+
const statusPassed = result.statusCode >= 200 && result.statusCode < 300;
|
|
311
|
+
const passed = assertionsTotal > 0 ? allAssertionsPassed : statusPassed;
|
|
312
|
+
const testResult = {
|
|
313
|
+
file: filePath,
|
|
314
|
+
passed,
|
|
315
|
+
statusCode: result.statusCode,
|
|
316
|
+
statusText: result.statusText,
|
|
317
|
+
error: result.error,
|
|
318
|
+
requestIndex,
|
|
319
|
+
requestTotal: totalInFile,
|
|
320
|
+
assertionResults,
|
|
321
|
+
assertionsPassed,
|
|
322
|
+
assertionsTotal,
|
|
323
|
+
blockTitle,
|
|
324
|
+
blockLine,
|
|
325
|
+
...(verbose && {
|
|
326
|
+
requestConfig: config,
|
|
327
|
+
responseBody: result.body,
|
|
328
|
+
}),
|
|
329
|
+
};
|
|
330
|
+
// Call progress callback if provided (for real-time feedback)
|
|
331
|
+
if (opts.onProgress) {
|
|
332
|
+
opts.onProgress(testResult);
|
|
333
|
+
}
|
|
334
|
+
results.push(testResult);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return results;
|
|
338
|
+
}
|
|
339
|
+
//# sourceMappingURL=http-test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-test.js","sourceRoot":"","sources":["../../src/commands/http-test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;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C;YAC5C,CAAC;YAED,2BAA2B;YAC3B,2EAA2E;YAC3E,8CAA8C;YAC9C,MAAM,mBAAmB,GAAG,eAAe,KAAK,CAAC,IAAI,gBAAgB,KAAK,eAAe,CAAC;YAC1F,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,IAAI,GAAG,IAAI,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC;YACzE,MAAM,MAAM,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAAC;YAExE,MAAM,UAAU,GAAmB;gBACjC,IAAI,EAAE,QAAQ;gBACd,MAAM;gBACN,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,YAAY;gBACZ,YAAY,EAAE,WAAW;gBACzB,gBAAgB;gBAChB,gBAAgB;gBAChB,eAAe;gBACf,UAAU;gBACV,SAAS;gBACT,GAAG,CAAC,OAAO,IAAI;oBACb,aAAa,EAAE,MAAM;oBACrB,YAAY,EAAE,MAAM,CAAC,IAAI;iBAC1B,CAAC;aACH,CAAC;YAEF,8DAA8D;YAC9D,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YAC9B,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for adding a skill
|
|
3
|
+
*/
|
|
4
|
+
export interface SkillAddOptions {
|
|
5
|
+
/** Skill name (e.g., "my-skill") */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Skill description */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Target directory (personal or project) */
|
|
10
|
+
target?: 'personal' | 'project';
|
|
11
|
+
/** Project directory (required if target is 'project') */
|
|
12
|
+
project?: string;
|
|
13
|
+
/** Base folder name (default: cursor) */
|
|
14
|
+
baseFolder?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Result of adding a skill
|
|
18
|
+
*/
|
|
19
|
+
export interface SkillAddResult {
|
|
20
|
+
success: boolean;
|
|
21
|
+
filePath?: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Add a new skill file
|
|
26
|
+
*/
|
|
27
|
+
export declare function addSkill(options: SkillAddOptions): Promise<SkillAddResult>;
|
|
28
|
+
//# sourceMappingURL=skill-add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-add.d.ts","sourceRoot":"","sources":["../../src/commands/skill-add.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqDD;;GAEG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAwDhF"}
|
|
@@ -0,0 +1,145 @@
|
|
|
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.addSkill = addSkill;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const os = __importStar(require("os"));
|
|
40
|
+
/**
|
|
41
|
+
* Default skill template
|
|
42
|
+
*/
|
|
43
|
+
function getSkillTemplate(name, description) {
|
|
44
|
+
const desc = description || 'Description of what this skill does and when to use it.';
|
|
45
|
+
return `# ${name}
|
|
46
|
+
|
|
47
|
+
## Description
|
|
48
|
+
|
|
49
|
+
${desc}
|
|
50
|
+
|
|
51
|
+
## When to Use
|
|
52
|
+
|
|
53
|
+
Use this skill when:
|
|
54
|
+
- Condition 1
|
|
55
|
+
- Condition 2
|
|
56
|
+
- Condition 3
|
|
57
|
+
|
|
58
|
+
## How It Works
|
|
59
|
+
|
|
60
|
+
1. Step 1: Explanation
|
|
61
|
+
2. Step 2: Explanation
|
|
62
|
+
3. Step 3: Explanation
|
|
63
|
+
|
|
64
|
+
## Examples
|
|
65
|
+
|
|
66
|
+
### Example 1
|
|
67
|
+
|
|
68
|
+
\`\`\`bash
|
|
69
|
+
# Example command or code
|
|
70
|
+
\`\`\`
|
|
71
|
+
|
|
72
|
+
### Example 2
|
|
73
|
+
|
|
74
|
+
\`\`\`bash
|
|
75
|
+
# Another example
|
|
76
|
+
\`\`\`
|
|
77
|
+
|
|
78
|
+
## Notes
|
|
79
|
+
|
|
80
|
+
- Additional notes or considerations
|
|
81
|
+
- Best practices
|
|
82
|
+
- Common pitfalls to avoid
|
|
83
|
+
|
|
84
|
+
## Related Skills
|
|
85
|
+
|
|
86
|
+
- [other-skill]: Description of related skill
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Add a new skill file
|
|
91
|
+
*/
|
|
92
|
+
async function addSkill(options) {
|
|
93
|
+
try {
|
|
94
|
+
const { name, description, target = 'personal', project, baseFolder = 'cursor' } = options;
|
|
95
|
+
// Sanitize skill name
|
|
96
|
+
const sanitizedName = name.toLowerCase().replace(/[^a-z0-9-_]/g, '-');
|
|
97
|
+
// Determine target directory
|
|
98
|
+
let targetDir;
|
|
99
|
+
if (target === 'personal') {
|
|
100
|
+
targetDir = path.join(os.homedir(), `.${baseFolder}`, 'skills', sanitizedName);
|
|
101
|
+
}
|
|
102
|
+
else if (target === 'project') {
|
|
103
|
+
if (!project) {
|
|
104
|
+
return {
|
|
105
|
+
success: false,
|
|
106
|
+
error: 'Project directory is required when target is "project"'
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
targetDir = path.join(project, `.${baseFolder}`, 'skills', sanitizedName);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return {
|
|
113
|
+
success: false,
|
|
114
|
+
error: `Invalid target: ${target}. Must be "personal" or "project"`
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
// Create directory if it doesn't exist
|
|
118
|
+
if (!fs.existsSync(targetDir)) {
|
|
119
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
120
|
+
}
|
|
121
|
+
// Create SKILL.md file
|
|
122
|
+
const filePath = path.join(targetDir, 'SKILL.md');
|
|
123
|
+
// Check if file already exists
|
|
124
|
+
if (fs.existsSync(filePath)) {
|
|
125
|
+
return {
|
|
126
|
+
success: false,
|
|
127
|
+
error: `Skill already exists at: ${filePath}`
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
// Write skill template
|
|
131
|
+
const content = getSkillTemplate(sanitizedName, description);
|
|
132
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
133
|
+
return {
|
|
134
|
+
success: true,
|
|
135
|
+
filePath
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
return {
|
|
140
|
+
success: false,
|
|
141
|
+
error: error instanceof Error ? error.message : String(error)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=skill-add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-add.js","sourceRoot":"","sources":["../../src/commands/skill-add.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,4BAwDC;AA3ID,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AA2BzB;;GAEG;AACH,SAAS,gBAAgB,CAAC,IAAY,EAAE,WAAoB;IAC1D,MAAM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,CAAC;QAC/C,CAAC;QAED,uBAAuB;QACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAElD,+BAA+B;QAC/B,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,4BAA4B,QAAQ,EAAE;aAC9C,CAAC;QACJ,CAAC;QAED,uBAAuB;QACvB,MAAM,OAAO,GAAG,gBAAgB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAC7D,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAE7C,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ;SACT,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP request configuration (method, url, headers, body).
|
|
3
|
+
* Exported for verbose output in CLI.
|
|
4
|
+
*/
|
|
5
|
+
export interface HttpRequestConfig {
|
|
6
|
+
method?: string;
|
|
7
|
+
url: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
body?: string | object;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Result of HTTP request execution
|
|
13
|
+
*/
|
|
14
|
+
export interface HttpRequestResult {
|
|
15
|
+
statusCode: number;
|
|
16
|
+
statusText: string;
|
|
17
|
+
body: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parses HTTP request content (REST Client or curl format). Returns the first request only.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseHttpRequest(content: string): HttpRequestConfig | null;
|
|
25
|
+
/**
|
|
26
|
+
* Parses all HTTP requests in a single block (REST: one request; curl: all curl commands in block).
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseBlockAll(block: string): HttpRequestConfig[];
|
|
29
|
+
/**
|
|
30
|
+
* Parses all HTTP requests in content (REST Client: split by ###; curl: all curl commands in every block).
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseHttpRequestAll(content: string): HttpRequestConfig[];
|
|
33
|
+
/**
|
|
34
|
+
* Loads variables from a .env file (KEY=VALUE, same format as extension).
|
|
35
|
+
*/
|
|
36
|
+
export declare function loadEnvFile(envPath: string): Map<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* Extracts file-level # @var VAR=value (or VAR value) from content (global, before first ### separator).
|
|
39
|
+
* Note: ### with text (decorative) is ignored. Only ### alone on a line is treated as separator.
|
|
40
|
+
*/
|
|
41
|
+
export declare function extractFileVariables(content: string): Map<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* Extracts block-level # @var variables from a specific block content.
|
|
44
|
+
* Used for variables defined after ### separators (cascade effect).
|
|
45
|
+
*/
|
|
46
|
+
export declare function extractBlockVariables(blockContent: string): Map<string, string>;
|
|
47
|
+
/**
|
|
48
|
+
* Finds # @env name in content (global: before first ## or ###).
|
|
49
|
+
*/
|
|
50
|
+
export declare function getEnvNameFromContent(content: string): string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Applies file variables first, then env variables (env case-insensitive).
|
|
53
|
+
*/
|
|
54
|
+
export declare function substituteVariables(content: string, fileVars: Map<string, string>, envVars: Map<string, string>): string;
|
|
55
|
+
/**
|
|
56
|
+
* Applies CLI overrides (KEY=value) to content. Overrides take precedence over file/env vars.
|
|
57
|
+
*/
|
|
58
|
+
export declare function applyVariableOverrides(content: string, overrides: Map<string, string>): string;
|
|
59
|
+
/**
|
|
60
|
+
* Executes HTTP request via curl and returns status/body.
|
|
61
|
+
*/
|
|
62
|
+
export declare function executeHttpRequest(config: HttpRequestConfig, timeoutSeconds?: number): Promise<HttpRequestResult>;
|
|
63
|
+
//# sourceMappingURL=httpRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpRunner.d.ts","sourceRoot":"","sources":["../src/httpRunner.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AA8OD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAG1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAWhE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAQxE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBhE;AA8FD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BzE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CA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