chore: task management some more

This commit is contained in:
Eyal Toledano
2025-06-11 14:28:25 -04:00
parent 153b190e0d
commit f43b5fdd75
6 changed files with 418 additions and 30 deletions

View File

@@ -33,6 +33,7 @@ import {
TASKMASTER_TASKS_DIR,
TASKMASTER_DOCS_DIR,
TASKMASTER_REPORTS_DIR,
TASKMASTER_STATE_FILE,
ENV_EXAMPLE_FILE,
GITIGNORE_FILE
} from '../src/constants/paths.js';
@@ -183,6 +184,37 @@ alias taskmaster='task-master'
}
}
// Function to create initial state.json file for tag management
function createInitialStateFile(targetDir) {
const stateFilePath = path.join(targetDir, TASKMASTER_STATE_FILE);
// Check if state.json already exists
if (fs.existsSync(stateFilePath)) {
log('info', 'State file already exists, preserving current configuration');
return;
}
// Create initial state configuration
const initialState = {
currentTag: 'master',
lastSwitched: new Date().toISOString(),
autoSwitchOnBranch: false, // Future feature for git branch integration
gitIntegration: {
enabled: false,
autoCreateTags: false,
branchTagMapping: {}
}
};
try {
fs.writeFileSync(stateFilePath, JSON.stringify(initialState, null, 2));
log('success', `Created initial state file: ${stateFilePath}`);
log('info', 'Default tag set to "master" for task organization');
} catch (error) {
log('error', `Failed to create state file: ${error.message}`);
}
}
// Function to copy a file from the package to the target directory
function copyTemplateFile(templateName, targetPath, replacements = {}) {
// Get the file content from the appropriate source directory
@@ -494,6 +526,9 @@ function createProjectStructure(addAliases, dryRun, options) {
ensureDirectoryExists(path.join(targetDir, TASKMASTER_REPORTS_DIR));
ensureDirectoryExists(path.join(targetDir, TASKMASTER_TEMPLATES_DIR));
// Create initial state.json file for tag management
createInitialStateFile(targetDir);
// Setup MCP configuration for integration with Cursor
setupMCPConfiguration(targetDir);