directory->path

This commit is contained in:
Jack Amadeo
2026-05-07 19:25:50 -04:00
parent 313ddb64b3
commit da6ef6d243
2 changed files with 10 additions and 10 deletions
@@ -39,7 +39,7 @@ const source = {
name: "Scout",
description: "Agent",
content: "Research carefully.",
directory: "/Users/test/.agents/agents/scout.md",
path: "/Users/test/.agents/agents/scout.md",
global: true,
writable: true,
metadata: {
@@ -62,7 +62,7 @@ describe("agents API", () => {
expect(mockGooseSourcesList).toHaveBeenCalledWith({ type: "agent" });
expect(result).toEqual([
{
id: source.directory,
id: source.path,
displayName: "Scout",
avatar: { type: "url", value: source.metadata.avatar },
systemPrompt: "Research carefully.",
@@ -109,13 +109,13 @@ describe("agents API", () => {
source: { ...source, name: "Scout 2" },
});
const result = await updatePersona(source.directory, {
const result = await updatePersona(source.path, {
displayName: "Scout 2",
});
expect(mockGooseSourcesUpdate).toHaveBeenCalledWith({
type: "agent",
path: source.directory,
path: source.path,
name: "Scout 2",
description: "Agent",
content: "Research carefully.",
@@ -131,11 +131,11 @@ describe("agents API", () => {
it("deletePersona deletes an agent source by path", async () => {
mockGooseSourcesDelete.mockResolvedValue(undefined);
await deletePersona(source.directory);
await deletePersona(source.path);
expect(mockGooseSourcesDelete).toHaveBeenCalledWith({
type: "agent",
path: source.directory,
path: source.path,
});
});
@@ -145,11 +145,11 @@ describe("agents API", () => {
filename: "scout.agent.json",
});
const result = await exportPersona(source.directory);
const result = await exportPersona(source.path);
expect(mockGooseSourcesExport).toHaveBeenCalledWith({
type: "agent",
path: source.directory,
path: source.path,
});
expect(result).toEqual({
json: '{"type":"agent"}',
+2 -2
View File
@@ -52,7 +52,7 @@ function personaMetadata(
function toPersona(source: AgentSourceEntry): Persona {
const writable = source.writable !== false;
return {
id: source.directory,
id: source.path,
displayName: source.name,
avatar: metadataToAvatar(source.metadata?.avatar),
systemPrompt: source.content,
@@ -76,7 +76,7 @@ async function listAgentSources(): Promise<AgentSourceEntry[]> {
async function getAgentSource(id: string): Promise<AgentSourceEntry> {
const source = (await listAgentSources()).find(
(source) => source.directory === id,
(source) => source.path === id,
);
if (!source) {
throw new Error(`Agent '${id}' not found`);