store tasks in git by default (#835)

This commit is contained in:
Joe Danziger
2025-06-20 12:49:38 -04:00
committed by GitHub
parent 648353794e
commit 727f1ec4eb
4 changed files with 11 additions and 6 deletions

View File

@@ -0,0 +1,5 @@
---
"task-master-ai": patch
---
Store tasks in Git by default

View File

@@ -33,7 +33,7 @@ export function registerInitializeProjectTool(server) {
storeTasksInGit: z storeTasksInGit: z
.boolean() .boolean()
.optional() .optional()
.default(false) .default(true)
.describe('Store tasks in Git (tasks.json and tasks/ directory).'), .describe('Store tasks in Git (tasks.json and tasks/ directory).'),
yes: z yes: z
.boolean() .boolean()

View File

@@ -373,7 +373,7 @@ async function initializeProject(options = {}) {
options.addAliases !== undefined ? options.addAliases : true; // Default to true if not specified options.addAliases !== undefined ? options.addAliases : true; // Default to true if not specified
const initGit = options.initGit !== undefined ? options.initGit : true; // Default to true if not specified const initGit = options.initGit !== undefined ? options.initGit : true; // Default to true if not specified
const storeTasksInGit = const storeTasksInGit =
options.storeTasksInGit !== undefined ? options.storeTasksInGit : false; // Default to false if not specified options.storeTasksInGit !== undefined ? options.storeTasksInGit : true; // Default to true if not specified
if (dryRun) { if (dryRun) {
log('info', 'DRY RUN MODE: No files will be modified'); log('info', 'DRY RUN MODE: No files will be modified');
@@ -443,17 +443,17 @@ async function initializeProject(options = {}) {
} }
// Prompt for Git tasks storage (skip if --git-tasks or --no-git-tasks flag was provided) // Prompt for Git tasks storage (skip if --git-tasks or --no-git-tasks flag was provided)
let storeGitPrompted = false; // Default to false let storeGitPrompted = true; // Default to true
if (options.storeTasksInGit !== undefined) { if (options.storeTasksInGit !== undefined) {
storeGitPrompted = options.storeTasksInGit; // Use flag value if provided storeGitPrompted = options.storeTasksInGit; // Use flag value if provided
} else { } else {
const gitTasksInput = await promptQuestion( const gitTasksInput = await promptQuestion(
rl, rl,
chalk.cyan( chalk.cyan(
'Store tasks in Git (tasks.json and tasks/ directory)? (y/N): ' 'Store tasks in Git (tasks.json and tasks/ directory)? (Y/n): '
) )
); );
storeGitPrompted = gitTasksInput.trim().toLowerCase() === 'y'; storeGitPrompted = gitTasksInput.trim().toLowerCase() !== 'n';
} }
// Confirm settings... // Confirm settings...

View File

@@ -255,7 +255,7 @@ function mergeWithExistingFile(
function manageGitignoreFile( function manageGitignoreFile(
targetPath, targetPath,
content, content,
storeTasksInGit = false, storeTasksInGit = true,
log = null log = null
) { ) {
// Validate inputs // Validate inputs