feat: Enhanced project initialization with Git worktree detection (#743)
* Fix Cursor deeplink installation with copy-paste instructions (#723) * detect git worktree * add changeset * add aliases and git flags * add changeset * rename and update test * add store tasks in git functionality * update changeset * fix newline * remove unused import * update command wording * update command option text
This commit is contained in:
@@ -3342,6 +3342,11 @@ ${result.result}
|
||||
.option('--skip-install', 'Skip installing dependencies')
|
||||
.option('--dry-run', 'Show what would be done without making changes')
|
||||
.option('--aliases', 'Add shell aliases (tm, taskmaster)')
|
||||
.option('--no-aliases', 'Skip shell aliases (tm, taskmaster)')
|
||||
.option('--git', 'Initialize Git repository')
|
||||
.option('--no-git', 'Skip Git repository initialization')
|
||||
.option('--git-tasks', 'Store tasks in Git')
|
||||
.option('--no-git-tasks', 'No Git storage of tasks')
|
||||
.action(async (cmdOptions) => {
|
||||
// cmdOptions contains parsed arguments
|
||||
// Parse rules: accept space or comma separated, default to all available rules
|
||||
|
||||
@@ -349,6 +349,25 @@ function getCurrentBranchSync(projectRoot) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current working directory is inside a Git work-tree.
|
||||
* Uses `git rev-parse --is-inside-work-tree` which is more specific than --git-dir
|
||||
* for detecting work-trees (excludes bare repos and .git directories).
|
||||
* This is ideal for preventing accidental git init in existing work-trees.
|
||||
* @returns {boolean} True if inside a Git work-tree, false otherwise.
|
||||
*/
|
||||
function insideGitWorkTree() {
|
||||
try {
|
||||
execSync('git rev-parse --is-inside-work-tree', {
|
||||
stdio: 'ignore',
|
||||
cwd: process.cwd()
|
||||
});
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Export all functions
|
||||
export {
|
||||
isGitRepository,
|
||||
@@ -366,5 +385,6 @@ export {
|
||||
checkAndAutoSwitchGitTag,
|
||||
checkAndAutoSwitchGitTagSync,
|
||||
isGitRepositorySync,
|
||||
getCurrentBranchSync
|
||||
getCurrentBranchSync,
|
||||
insideGitWorkTree
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user