Skip to content

Commit d6b1d93

Browse files
author
nik
committed
Ensure prompts text are in pack
1 parent 19c6d5f commit d6b1d93

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Source
22
src/
3+
!src/prompts/
34
tests/
45

56
# CI/CD

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"type": "module",
1111
"files": [
1212
"lib/**/*",
13-
"bin/**/*"
13+
"bin/**/*",
14+
"src/prompts/**/*"
1415
],
1516
"scripts": {
1617
"build": "rimraf lib && tsc -p tsconfig.json --sourceMap --declaration",

src/rulesGenerate.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,19 @@ export async function rulesGenerate(
4040
// 4. Read guidelines file
4141
let guidelinesText: string;
4242
try {
43-
guidelinesText = await readGuidelines('./src/prompts/cursor_mdc.md');
43+
guidelinesText = await readGuidelines('../src/prompts/cursor_mdc.md');
4444
} catch (_error) {
45-
console.log(pc.yellow('Warning: Could not read guidelines. Error: ' + _error + '. Using built-in guidelines.'));
46-
guidelinesText = generateMockGuidelines();
45+
// If not found in src/prompts, try with a path relative to the current file
46+
try {
47+
const modulePath = new URL(import.meta.url).pathname;
48+
const moduleDir = path.dirname(modulePath);
49+
const alternativePath = path.resolve(moduleDir, '../src/prompts/cursor_mdc.md');
50+
51+
guidelinesText = await fs.readFile(alternativePath, 'utf-8');
52+
} catch (innerError) {
53+
console.log(pc.yellow('Warning: Could not read guidelines. Error: ' + innerError + '. Using built-in guidelines.'));
54+
guidelinesText = generateMockGuidelines();
55+
}
4756
}
4857

4958
console.log(pc.cyan('3. Generating cursor rules...'));

0 commit comments

Comments
 (0)