Skip to content

Commit d62d682

Browse files
authored
fix: default output dir should be cwd (#64)
* fix: default output dir should be cwd - Changed the default output directory to the current working directory instead of a predefined cursor path. - Updated the cursor rules path to use the current working directory for improved flexibility in file downloads. * refactor: Change default output directory to current working directory * fix: update output directory for downloadSelected Rules from 'rules' to '.cursor/rules'
1 parent 7c0fec7 commit d62d682

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

cli/commands.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict'
22
import * as fs from 'node:fs/promises';
3-
import { homedir } from 'node:os';
43
import { dirname, resolve } from 'node:path';
54
import { fileURLToPath } from 'node:url';
65
import { styleText } from 'node:util';
@@ -13,7 +12,7 @@ import { validateDirname } from './utils/validate-dirname.mjs';
1312
export const __dirname = dirname(fileURLToPath(import.meta.url));
1413
export const packageJsonPath = resolve(__dirname, '..', 'package.json');
1514
export const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
16-
const defaultOutput = resolve(homedir(), 'Downloads', '.cursor');
15+
const defaultOutput = process.cwd();
1716

1817
/** @returns {void} */
1918
export const help = () => {

cli/index.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ async function main() {
6868
await interactiveMode(values);
6969
process.exit(0);
7070
case 'output':
71-
const outputDir = values[key]?.toString() ?? defaultCursorPath;
71+
const outputDir = values[key]?.toString() ?? process.cwd();
7272
await output(outputDir);
7373
break;
7474
case 'flat':
75-
const cursorRulesPath = process.env.npm_config_prefix?.toString() ?? `${defaultCursorPath}/rules`;
75+
const cursorRulesPath = process.cwd();
7676
await downloadFiles(cursorRulesPath);
7777
break;
7878
}

cli/utils/download-files.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ export const downloadSelectedFiles = async (folderName, selectedRules) => {
7575
try {
7676
// Create output directory structure
7777
await mkdir(outputDir, { recursive: true });
78-
await mkdir(join(outputDir, 'rules'), { recursive: true });
78+
await mkdir(join(outputDir, '.cursor'), { recursive: true });
7979

8080
// Copy selected rules
8181
for (const rule of selectedRules) {
8282
const sourcePath = join(sourceRulesBasePath, rule.path);
83-
const destPath = join(outputDir, 'rules', rule.path);
83+
const destPath = join(outputDir, '.cursor', 'rules', rule.path);
8484
const destDir = dirname(destPath);
8585

8686
// Ensure destination directory exists

0 commit comments

Comments
 (0)