fix(coding-agent): display path of sibling dependent extensions (#6964)

fixes: #6619
This commit is contained in:
David Brailovsky
2026-07-22 16:08:21 +02:00
committed by GitHub
parent 75e6123aba
commit c55ae2faa5
2 changed files with 88 additions and 2 deletions
@@ -1019,6 +1019,84 @@ describe("InteractiveMode.showLoadedResources", () => {
"[Extensions]
pi-markdown-preview"`);
});
test("labels npm sibling extensions relative to the declaring package", () => {
const extensions: ExtensionFixture[] = [
{
path: "/tmp/project/.pi/npm/node_modules/primary-package/index.ts",
sourceInfo: createSourceInfo("/tmp/project/.pi/npm/node_modules/primary-package/index.ts", {
source: "npm:primary-package",
scope: "project",
origin: "package",
baseDir: "/tmp/project/.pi/npm/node_modules/primary-package",
}),
},
{
path: "/tmp/project/.pi/npm/node_modules/sibling-package/index.ts",
sourceInfo: createSourceInfo("/tmp/project/.pi/npm/node_modules/sibling-package/index.ts", {
source: "npm:primary-package",
scope: "project",
origin: "package",
baseDir: "/tmp/project/.pi/npm/node_modules/primary-package",
}),
},
];
const fakeThis = createShowLoadedResourcesThis({
quietStartup: false,
extensions,
useRealScopeGroups: true,
});
(InteractiveMode as any).prototype.showLoadedResources.call(fakeThis, {
force: false,
});
expect(normalizeRenderedOutput(fakeThis.loadedResourcesContainer)).toMatchInlineSnapshot(`
"[Extensions]
primary-package, primary-package:../sibling-package"`);
});
test("labels Windows npm sibling extensions relative to the declaring package", () => {
const primaryPath = "C:\\Users\\me\\.pi\\agent\\npm\\node_modules\\primary-package\\index.ts";
const siblingPath = "C:\\Users\\me\\.pi\\agent\\npm\\node_modules\\sibling-package\\index.ts";
const baseDir = "C:\\Users\\me\\.pi\\agent\\npm\\node_modules\\primary-package";
const extensions: ExtensionFixture[] = [
{
path: primaryPath,
sourceInfo: createSourceInfo(primaryPath, {
source: "npm:primary-package",
scope: "user",
origin: "package",
baseDir,
}),
},
{
path: siblingPath,
sourceInfo: createSourceInfo(siblingPath, {
source: "npm:primary-package",
scope: "user",
origin: "package",
baseDir,
}),
},
];
const fakeThis = createShowLoadedResourcesThis({
quietStartup: false,
extensions,
useRealScopeGroups: true,
});
(InteractiveMode as any).prototype.showLoadedResources.call(fakeThis, {
force: false,
});
expect(normalizeRenderedOutput(fakeThis.loadedResourcesContainer)).toMatchInlineSnapshot(`
"[Extensions]
primary-package, primary-package:../sibling-package"`);
});
test("captures mixed extension layouts in expanded output", () => {
const fakeThis = createShowLoadedResourcesThis({
quietStartup: false,