mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
feat: Add run init script functionality for worktrees
This commit introduces the ability to run initialization scripts for worktrees, enhancing the setup process. Key changes include: 1. **New API Endpoint**: Added a POST endpoint to run the init script for a specified worktree. 2. **Worktree Routes**: Updated worktree routes to include the new run init script handler. 3. **Init Script Service**: Enhanced the Init Script Service to support running scripts asynchronously and handling errors. 4. **UI Updates**: Added UI components to check for the existence of init scripts and trigger their execution, providing user feedback through toast notifications. 5. **Event Handling**: Implemented event handling for init script execution status, allowing real-time updates in the UI. This feature streamlines the workflow for users by automating the execution of setup scripts, improving overall project management.
This commit is contained in:
@@ -96,6 +96,7 @@ export {
|
||||
getCodexCliPaths,
|
||||
getCodexConfigDir,
|
||||
getCodexAuthPath,
|
||||
getGitBashPaths,
|
||||
getOpenCodeCliPaths,
|
||||
getOpenCodeConfigDir,
|
||||
getOpenCodeAuthPath,
|
||||
@@ -129,6 +130,7 @@ export {
|
||||
findCodexCliPath,
|
||||
getCodexAuthIndicators,
|
||||
type CodexAuthIndicators,
|
||||
findGitBashPath,
|
||||
findOpenCodeCliPath,
|
||||
getOpenCodeAuthIndicators,
|
||||
type OpenCodeAuthIndicators,
|
||||
|
||||
@@ -232,6 +232,57 @@ export function getClaudeProjectsDir(): string {
|
||||
return path.join(getClaudeConfigDir(), 'projects');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get common Git Bash installation paths on Windows
|
||||
* Git Bash is needed for running shell scripts cross-platform
|
||||
*/
|
||||
export function getGitBashPaths(): string[] {
|
||||
if (process.platform !== 'win32') {
|
||||
return [];
|
||||
}
|
||||
|
||||
const homeDir = os.homedir();
|
||||
return [
|
||||
// Standard Git for Windows installations
|
||||
'C:\\Program Files\\Git\\bin\\bash.exe',
|
||||
'C:\\Program Files (x86)\\Git\\bin\\bash.exe',
|
||||
// User-local installations
|
||||
path.join(process.env.LOCALAPPDATA || '', 'Programs', 'Git', 'bin', 'bash.exe'),
|
||||
// Scoop package manager
|
||||
path.join(homeDir, 'scoop', 'apps', 'git', 'current', 'bin', 'bash.exe'),
|
||||
// Chocolatey
|
||||
path.join(
|
||||
process.env.ChocolateyInstall || 'C:\\ProgramData\\chocolatey',
|
||||
'lib',
|
||||
'git',
|
||||
'tools',
|
||||
'bin',
|
||||
'bash.exe'
|
||||
),
|
||||
// winget typical location
|
||||
path.join(
|
||||
process.env.LOCALAPPDATA || '',
|
||||
'Microsoft',
|
||||
'WinGet',
|
||||
'Packages',
|
||||
'Git.Git_*',
|
||||
'bin',
|
||||
'bash.exe'
|
||||
),
|
||||
// GitHub Desktop bundled Git
|
||||
path.join(
|
||||
process.env.LOCALAPPDATA || '',
|
||||
'GitHubDesktop',
|
||||
'app-*',
|
||||
'resources',
|
||||
'app',
|
||||
'git',
|
||||
'cmd',
|
||||
'bash.exe'
|
||||
),
|
||||
].filter(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get common shell paths for shell detection
|
||||
* Includes both full paths and short names to match $SHELL or PATH entries
|
||||
@@ -550,6 +601,8 @@ function getAllAllowedSystemPaths(): string[] {
|
||||
getOpenCodeAuthPath(),
|
||||
// Shell paths
|
||||
...getShellPaths(),
|
||||
// Git Bash paths (for Windows cross-platform shell script execution)
|
||||
...getGitBashPaths(),
|
||||
// Node.js system paths
|
||||
...getNodeSystemPaths(),
|
||||
getScoopNodePath(),
|
||||
@@ -883,6 +936,13 @@ export async function findCodexCliPath(): Promise<string | null> {
|
||||
return findFirstExistingPath(getCodexCliPaths());
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Git Bash on Windows and return its path
|
||||
*/
|
||||
export async function findGitBashPath(): Promise<string | null> {
|
||||
return findFirstExistingPath(getGitBashPaths());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Claude authentication status by checking various indicators
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user