The Open Framework for Building Agents
fix(eve): search registry suggestions by item name (#2152)
Casey Gowriefe1ad3bf550c
diff --git a/.changeset/tidy-registry-suggestions.md b/.changeset/tidy-registry-suggestions.mdnew file mode 100644index 000000000..717949014--- /dev/null+++ b/.changeset/tidy-registry-suggestions.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Search by item name when suggesting registry matches, so path typos such as `channels/slack` can still suggest `channel/slack`.diff --git a/packages/eve/src/cli/commands/registry.test.ts b/packages/eve/src/cli/commands/registry.test.tsindex b2486b146..90e14e648 100644--- a/packages/eve/src/cli/commands/registry.test.ts+++ b/packages/eve/src/cli/commands/registry.test.ts@@ -133,7 +133,7 @@ describe("registry commands", () => {getRegistryItems.mockRejectedValue(Object.assign(new Error(- "The item at https://eve.dev/r/channel/salk.json was not found. It may not exist at the registry.",+ "The item at https://eve.dev/r/channels/slack.json was not found. It may not exist at the registry.",),{ code: "NOT_FOUND" },),@@ -158,14 +158,14 @@ describe("registry commands", () => {},}));- await runAddCommand(logger, "/project", "channel/salk", {});+ await runAddCommand(logger, "/project", "channels/slack", {});expect(logger.errors).toEqual([- "The item at https://eve.dev/r/channel/salk.json was not found. It may not exist at the registry.",+ "The item at https://eve.dev/r/channels/slack.json was not found. It may not exist at the registry.",]);expect(searchRegistries).toHaveBeenCalledWith(["https://eve.dev/r/registry.json"],- expect.objectContaining({ limit: 5, query: "channel/salk" }),+ expect.objectContaining({ limit: 5, query: "slack" }),);expect(logger.logs).toEqual(["Did you mean?",diff --git a/packages/eve/src/cli/commands/registry.ts b/packages/eve/src/cli/commands/registry.tsindex fe6518115..dedf61040 100644--- a/packages/eve/src/cli/commands/registry.ts+++ b/packages/eve/src/cli/commands/registry.ts@@ -249,9 +249,10 @@ function searchPresentationSections(async function printAddSuggestions(logger: RegistryCommandLogger,appRoot: string,- query: string,+ item: string,): Promise<void> {try {+ const query = item.split("/").at(-1) || item;const { resultsBySource, sources, metadataByAddress } = await searchRegistryCatalog(appRoot, {limit: ADD_SUGGESTION_LIMIT,query,