mirror of
https://github.com/earendil-works/pi.git
synced 2026-06-18 15:54:04 +08:00
feat(coding-agent): run npm install after cloning git repos with package.json
This commit is contained in:
@@ -405,6 +405,11 @@ export class DefaultPackageManager implements PackageManager {
|
||||
if (source.ref) {
|
||||
await this.runCommand("git", ["checkout", source.ref], { cwd: targetDir });
|
||||
}
|
||||
// Install npm dependencies if package.json exists
|
||||
const packageJsonPath = join(targetDir, "package.json");
|
||||
if (existsSync(packageJsonPath)) {
|
||||
await this.runCommand("npm", ["install"], { cwd: targetDir });
|
||||
}
|
||||
}
|
||||
|
||||
private async updateGit(source: GitSource, scope: SourceScope): Promise<void> {
|
||||
@@ -414,6 +419,11 @@ export class DefaultPackageManager implements PackageManager {
|
||||
return;
|
||||
}
|
||||
await this.runCommand("git", ["pull"], { cwd: targetDir });
|
||||
// Reinstall npm dependencies if package.json exists (in case deps changed)
|
||||
const packageJsonPath = join(targetDir, "package.json");
|
||||
if (existsSync(packageJsonPath)) {
|
||||
await this.runCommand("npm", ["install"], { cwd: targetDir });
|
||||
}
|
||||
}
|
||||
|
||||
private async removeGit(source: GitSource, scope: SourceScope): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user