fix(coding-agent): only update extension in scope it's in

update(source) unconditionally called updateSourceForScope for both
user and project scopes, creating a local install even when the source
was only registered globally. Unify into a single code path that
iterates settings per scope, filtering by identity when a source is
provided.
This commit is contained in:
Aliou Diallo 2026-02-01 21:43:54 +01:00 committed by Mario Zechner
parent 7f78c383c9
commit bc3fda518d
2 changed files with 5 additions and 6 deletions

View file

@ -742,20 +742,18 @@ export class DefaultPackageManager implements PackageManager {
}
async update(source?: string): Promise<void> {
if (source) {
await this.updateSourceForScope(source, "user");
await this.updateSourceForScope(source, "project");
return;
}
const globalSettings = this.settingsManager.getGlobalSettings();
const projectSettings = this.settingsManager.getProjectSettings();
const identity = source ? this.getPackageIdentity(source) : undefined;
for (const pkg of globalSettings.packages ?? []) {
const sourceStr = typeof pkg === "string" ? pkg : pkg.source;
if (identity && this.getPackageIdentity(sourceStr) !== identity) continue;
await this.updateSourceForScope(sourceStr, "user");
}
for (const pkg of projectSettings.packages ?? []) {
const sourceStr = typeof pkg === "string" ? pkg : pkg.source;
if (identity && this.getPackageIdentity(sourceStr) !== identity) continue;
await this.updateSourceForScope(sourceStr, "project");
}
}