task-master-neo-sdlc
Version:
Enhanced task management system with Neo SDLC agents and MCP tools for comprehensive, AI-driven software development lifecycle management.
39 lines (35 loc) • 971 B
JavaScript
import fs from 'fs';
import path from 'path';
/**
* Read a JSON file
* @param {string} filePath - Path to the JSON file
* @returns {Object} Parsed JSON object
*/
export function readJSON(filePath) {
try {
const data = fs.readFileSync(filePath, 'utf8');
return JSON.parse(data);
} catch (error) {
console.error(`Error reading JSON file ${filePath}: ${error.message}`);
return null;
}
}
/**
* Write a JSON file
* @param {string} filePath - Path to the JSON file
* @param {Object} data - Data to write
* @returns {boolean} Success status
*/
export function writeJSON(filePath, data) {
try {
const dirPath = path.dirname(filePath);
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath, { recursive: true });
}
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf8');
return true;
} catch (error) {
console.error(`Error writing JSON file ${filePath}: ${error.message}`);
return false;
}
}