Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions core/config/profile/LocalProfileLoader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ConfigResult } from "@continuedev/config-yaml";
import * as YAML from "yaml";

import { ControlPlaneClient } from "../../control-plane/client.js";
import { ContinueConfig, IDE, ILLMLogger } from "../../index.js";
Expand All @@ -10,6 +11,26 @@ import { getUriPathBasename } from "../../util/uri.js";
import doLoadConfig from "./doLoadConfig.js";
import { IProfileLoader } from "./IProfileLoader.js";

function getDisplayTitle(overrideAssistantFile?: {
path: string;
content: string;
}) {
if (!overrideAssistantFile?.path) {
return "Local Config";
}

try {
const parsed = YAML.parse(overrideAssistantFile.content);
if (typeof parsed?.name === "string" && parsed.name.trim()) {
return parsed.name;
}
} catch {
// Invalid YAML is handled during config loading; keep the selector usable.
}

return getUriPathBasename(overrideAssistantFile.path);
}

export default class LocalProfileLoader implements IProfileLoader {
static ID = "local";

Expand All @@ -32,9 +53,7 @@ export default class LocalProfileLoader implements IProfileLoader {
versionSlug: "",
},
iconUrl: "",
title: overrideAssistantFile?.path
? getUriPathBasename(overrideAssistantFile.path)
: "Local Config",
title: getDisplayTitle(overrideAssistantFile),
errors: undefined,
uri:
overrideAssistantFile?.path ??
Expand Down
32 changes: 32 additions & 0 deletions core/config/profile/LocalProfileLoader.vitest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,38 @@ describe("LocalProfileLoader", () => {
);
});

it("should initialize override file title from config name", () => {
const overrideFile = {
path: "file:///workspace/.continue/agents/example.yaml",
content: "name: My Custom Config\nversion: 1.0.0\nschema: v1\n",
};

const loader = new LocalProfileLoader(
testIde,
controlPlaneClient,
llmLogger,
overrideFile,
);

expect(loader.description.title).toBe("My Custom Config");
});

it("should fall back to filename when override file has no config name", () => {
const overrideFile = {
path: "file:///workspace/.continue/agents/example.yaml",
content: "version: 1.0.0\nschema: v1\n",
};

const loader = new LocalProfileLoader(
testIde,
controlPlaneClient,
llmLogger,
overrideFile,
);

expect(loader.description.title).toBe("example.yaml");
});

it("should not include content in packageIdentifier when no override file", async () => {
const loader = new LocalProfileLoader(
testIde,
Expand Down
Loading