use more generic function names
This commit is contained in:
@@ -126,7 +126,7 @@ function transformCursorToBrandRules(
|
|||||||
/**
|
/**
|
||||||
* Convert a single Cursor rule file to brand rule format
|
* Convert a single Cursor rule file to brand rule format
|
||||||
*/
|
*/
|
||||||
function convertCursorRuleToBrandRule(sourcePath, targetPath, profile) {
|
function convertRuleToBrandRule(sourcePath, targetPath, profile) {
|
||||||
const { conversionConfig, brandName, globalReplacements } = profile;
|
const { conversionConfig, brandName, globalReplacements } = profile;
|
||||||
try {
|
try {
|
||||||
log(
|
log(
|
||||||
@@ -170,7 +170,7 @@ function convertCursorRuleToBrandRule(sourcePath, targetPath, profile) {
|
|||||||
/**
|
/**
|
||||||
* Process all Cursor rules and convert to brand rules
|
* Process all Cursor rules and convert to brand rules
|
||||||
*/
|
*/
|
||||||
function convertAllCursorRulesToBrandRules(projectDir, profile) {
|
function convertAllRulesToBrandRules(projectDir, profile) {
|
||||||
const { fileMap, brandName, rulesDir } = profile;
|
const { fileMap, brandName, rulesDir } = profile;
|
||||||
// Use assets/rules as the source of rules instead of .cursor/rules
|
// Use assets/rules as the source of rules instead of .cursor/rules
|
||||||
const cursorRulesDir = path.join(projectDir, 'assets', 'rules');
|
const cursorRulesDir = path.join(projectDir, 'assets', 'rules');
|
||||||
@@ -204,7 +204,7 @@ function convertAllCursorRulesToBrandRules(projectDir, profile) {
|
|||||||
const targetPath = path.join(brandRulesDir, targetFilename);
|
const targetPath = path.join(brandRulesDir, targetFilename);
|
||||||
|
|
||||||
// Convert the file
|
// Convert the file
|
||||||
if (convertCursorRuleToBrandRule(sourcePath, targetPath, profile)) {
|
if (convertRuleToBrandRule(sourcePath, targetPath, profile)) {
|
||||||
success++;
|
success++;
|
||||||
} else {
|
} else {
|
||||||
failed++;
|
failed++;
|
||||||
@@ -272,7 +272,7 @@ function removeBrandRules(projectDir, profile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
convertAllCursorRulesToBrandRules,
|
convertAllRulesToBrandRules,
|
||||||
convertCursorRuleToBrandRule,
|
convertRuleToBrandRule,
|
||||||
removeBrandRules
|
removeBrandRules
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { dirname } from 'path';
|
import { dirname } from 'path';
|
||||||
import { convertCursorRuleToBrandRule } from '../../scripts/modules/rule-transformer.js';
|
import { convertRuleToBrandRule } from '../../scripts/modules/rule-transformer.js';
|
||||||
import * as rooProfile from '../../scripts/profiles/roo.js';
|
import * as rooProfile from '../../scripts/profiles/roo.js';
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
@@ -41,7 +41,7 @@ Also has references to .mdc files.`;
|
|||||||
|
|
||||||
// Convert it
|
// Convert it
|
||||||
const testRooRule = path.join(testDir, 'basic-terms.md');
|
const testRooRule = path.join(testDir, 'basic-terms.md');
|
||||||
convertCursorRuleToBrandRule(testCursorRule, testRooRule, rooProfile);
|
convertRuleToBrandRule(testCursorRule, testRooRule, rooProfile);
|
||||||
|
|
||||||
// Read the converted file
|
// Read the converted file
|
||||||
const convertedContent = fs.readFileSync(testRooRule, 'utf8');
|
const convertedContent = fs.readFileSync(testRooRule, 'utf8');
|
||||||
@@ -72,7 +72,7 @@ alwaysApply: true
|
|||||||
|
|
||||||
// Convert it
|
// Convert it
|
||||||
const testRooRule = path.join(testDir, 'tool-refs.md');
|
const testRooRule = path.join(testDir, 'tool-refs.md');
|
||||||
convertCursorRuleToBrandRule(testCursorRule, testRooRule, rooProfile);
|
convertRuleToBrandRule(testCursorRule, testRooRule, rooProfile);
|
||||||
|
|
||||||
// Read the converted file
|
// Read the converted file
|
||||||
const convertedContent = fs.readFileSync(testRooRule, 'utf8');
|
const convertedContent = fs.readFileSync(testRooRule, 'utf8');
|
||||||
@@ -100,7 +100,7 @@ This references [dev_workflow.mdc](mdc:.cursor/rules/dev_workflow.mdc) and
|
|||||||
|
|
||||||
// Convert it
|
// Convert it
|
||||||
const testRooRule = path.join(testDir, 'file-refs.md');
|
const testRooRule = path.join(testDir, 'file-refs.md');
|
||||||
convertCursorRuleToBrandRule(testCursorRule, testRooRule, rooProfile);
|
convertRuleToBrandRule(testCursorRule, testRooRule, rooProfile);
|
||||||
|
|
||||||
// Read the converted file
|
// Read the converted file
|
||||||
const convertedContent = fs.readFileSync(testRooRule, 'utf8');
|
const convertedContent = fs.readFileSync(testRooRule, 'utf8');
|
||||||
|
|||||||
Reference in New Issue
Block a user