@jjdenhertog/ai-driven-development
Version:
AI-driven development workflow with learning capabilities for Claude
59 lines • 2.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TASKS_OUTPUT_DIR = exports.TASKS_DIR = exports.STORAGE_PATH = exports.STORAGE_BRANCH = exports.MAIN_BRANCH = exports.BRANCH_STARTING_POINT = exports.CONFIG_PATH = exports.TARGET_ROOT = exports.CONFIG_FILE = exports.STORAGE_FOLDER = void 0;
const fs_extra_1 = require("fs-extra");
const node_path_1 = require("node:path");
exports.STORAGE_FOLDER = '.aidev-storage';
exports.CONFIG_FILE = '.aidev.json';
/**
* Load and parse the .aidev.json configuration file if it exists
*/
function loadAidevConfig() {
if ((0, fs_extra_1.existsSync)(exports.CONFIG_PATH)) {
try {
const configContent = (0, fs_extra_1.readFileSync)(exports.CONFIG_PATH, 'utf8');
const data = JSON.parse(configContent);
return {
branchStartingPoint: data.branchStartingPoint || 'main',
mainBranch: data.mainBranch || 'main',
storageBranch: data.storageBranch || 'aidev-storage'
};
}
catch (_error) {
}
}
return {
branchStartingPoint: 'main',
mainBranch: 'main',
storageBranch: 'aidev-storage'
};
}
exports.TARGET_ROOT = process.cwd();
exports.CONFIG_PATH = (0, node_path_1.join)(exports.TARGET_ROOT, exports.CONFIG_FILE);
const aidevConfig = loadAidevConfig();
/**
* Get the branch starting point from config or default to 'main'
*/
exports.BRANCH_STARTING_POINT = aidevConfig.branchStartingPoint;
exports.MAIN_BRANCH = aidevConfig.mainBranch;
exports.STORAGE_BRANCH = aidevConfig.storageBranch;
/**
* Get the absolute path to the aidev worktree directory.
* First checks ./.aidev-storage, then ../.aidev-storage
*/
function getStoragePath() {
const localPath = (0, node_path_1.resolve)(process.cwd(), exports.STORAGE_FOLDER);
if ((0, fs_extra_1.existsSync)(localPath)) {
return localPath;
}
const parentPath = (0, node_path_1.resolve)(process.cwd(), '..', exports.STORAGE_FOLDER);
if ((0, fs_extra_1.existsSync)(parentPath)) {
return parentPath;
}
// Default to local path even if it doesn't exist yet
return localPath;
}
exports.STORAGE_PATH = getStoragePath();
exports.TASKS_DIR = (0, node_path_1.join)(exports.STORAGE_PATH, 'tasks');
exports.TASKS_OUTPUT_DIR = (0, node_path_1.join)(exports.STORAGE_PATH, 'tasks_output');
//# sourceMappingURL=config.js.map