mcp-chain-of-thought
Version:
Chain of Thought is a tool built for AI Agents, emphasizing chain-of-thought, reflection, and style consistency. It converts natural language into structured dev tasks with dependency tracking and iterative refinement, enabling agent-like developer behavi
33 lines • 1.2 kB
JavaScript
import fs from "fs/promises";
import path from "path";
import { fileURLToPath } from "url";
// Get project root directory path
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const PROJECT_ROOT = path.resolve(__dirname, "../..");
// Get data directory path
const DATA_DIR = process.env.DATA_DIR || path.join(PROJECT_ROOT, "data");
/**
* Get rules file path
* @returns Complete path to the rules file
*/
export function getRulesFilePath() {
return path.join(DATA_DIR, "rules.md");
}
/**
* Ensure rules file exists
* If the file doesn't exist, it will try to copy from root directory or create an empty file
*/
export async function ensureRulesFileExists() {
const dataRulesPath = getRulesFilePath();
try {
// Check if rules file exists in DATA_DIR directory
await fs.access(dataRulesPath);
}
catch (error) {
// Rules file doesn't exist in DATA_DIR directory
await fs.mkdir(path.dirname(dataRulesPath), { recursive: true });
await fs.writeFile(dataRulesPath, "# Development Guidelines\n\nPlease define project standards in this file.", "utf-8");
}
}
//# sourceMappingURL=pathUtils.js.map