feat(coding-agent): run npm install after cloning git repos with package.json

This commit is contained in:
Mario Zechner
2026-01-21 00:32:15 +01:00
Unverified
parent 5c047c351d
commit ca7be6929d
@@ -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> {