chore(25-02): apply biome formatter to task 1 and 2 files

This commit is contained in:
2026-04-10 11:06:11 +02:00
parent e4a65314bd
commit fc9a9134e8
5 changed files with 195 additions and 151 deletions

View File

@@ -67,15 +67,15 @@ const GlobalItemsGlobalItemIdRoute = GlobalItemsGlobalItemIdRouteImport.update({
getParentRoute: () => rootRouteImport,
} as any)
const ThreadsThreadIdIndexRoute = ThreadsThreadIdIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => ThreadsThreadIdRoute,
id: '/threads/$threadId/',
path: '/threads/$threadId/',
getParentRoute: () => rootRouteImport,
} as any)
const ThreadsThreadIdCandidatesCandidateIdRoute =
ThreadsThreadIdCandidatesCandidateIdRouteImport.update({
id: '/candidates/$candidateId',
path: '/candidates/$candidateId',
getParentRoute: () => ThreadsThreadIdRoute,
id: '/threads/$threadId/candidates/$candidateId',
path: '/threads/$threadId/candidates/$candidateId',
getParentRoute: () => rootRouteImport,
} as any)
export interface FileRoutesByFullPath {
@@ -170,6 +170,8 @@ export interface RootRouteChildren {
UsersUserIdRoute: typeof UsersUserIdRoute
CollectionIndexRoute: typeof CollectionIndexRoute
GlobalItemsIndexRoute: typeof GlobalItemsIndexRoute
ThreadsThreadIdIndexRoute: typeof ThreadsThreadIdIndexRoute
ThreadsThreadIdCandidatesCandidateIdRoute: typeof ThreadsThreadIdCandidatesCandidateIdRoute
}
declare module '@tanstack/react-router' {
@@ -239,17 +241,17 @@ declare module '@tanstack/react-router' {
}
'/threads/$threadId/': {
id: '/threads/$threadId/'
path: '/'
path: '/threads/$threadId'
fullPath: '/threads/$threadId/'
preLoaderRoute: typeof ThreadsThreadIdIndexRouteImport
parentRoute: typeof ThreadsThreadIdRoute
parentRoute: typeof rootRouteImport
}
'/threads/$threadId/candidates/$candidateId': {
id: '/threads/$threadId/candidates/$candidateId'
path: '/candidates/$candidateId'
path: '/threads/$threadId/candidates/$candidateId'
fullPath: '/threads/$threadId/candidates/$candidateId'
preLoaderRoute: typeof ThreadsThreadIdCandidatesCandidateIdRouteImport
parentRoute: typeof ThreadsThreadIdRoute
parentRoute: typeof rootRouteImport
}
}
}
@@ -264,6 +266,9 @@ const rootRouteChildren: RootRouteChildren = {
UsersUserIdRoute: UsersUserIdRoute,
CollectionIndexRoute: CollectionIndexRoute,
GlobalItemsIndexRoute: GlobalItemsIndexRoute,
ThreadsThreadIdIndexRoute: ThreadsThreadIdIndexRoute,
ThreadsThreadIdCandidatesCandidateIdRoute:
ThreadsThreadIdCandidatesCandidateIdRoute,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)

View File

@@ -16,21 +16,43 @@ function textResult(data: unknown): ToolResult {
}
function errorResult(message: string): ToolResult {
return { content: [{ type: "text", text: JSON.stringify({ error: message }) }] };
return {
content: [{ type: "text", text: JSON.stringify({ error: message }) }],
};
}
const catalogItemInputSchema = {
brand: z.string().describe("Brand or manufacturer name"),
model: z.string().describe("Model name — combined with brand forms the unique identifier"),
category: z.string().optional().describe("Category name (e.g., 'Bags', 'Lights')"),
model: z
.string()
.describe("Model name — combined with brand forms the unique identifier"),
category: z
.string()
.optional()
.describe("Category name (e.g., 'Bags', 'Lights')"),
weightGrams: z.number().optional().describe("Weight in grams"),
priceCents: z.number().optional().describe("MSRP price in cents (e.g., 9999 = $99.99)"),
priceCents: z
.number()
.optional()
.describe("MSRP price in cents (e.g., 9999 = $99.99)"),
imageUrl: z.string().optional().describe("URL to the product image"),
description: z.string().optional().describe("Product description"),
sourceUrl: z.string().optional().describe("URL to the product page on manufacturer/retailer site"),
imageCredit: z.string().optional().describe("Image credit — photographer or source name"),
imageSourceUrl: z.string().optional().describe("Original URL where the image was sourced from"),
tags: z.array(z.string()).optional().describe("Tags for categorization (created automatically if new)"),
sourceUrl: z
.string()
.optional()
.describe("URL to the product page on manufacturer/retailer site"),
imageCredit: z
.string()
.optional()
.describe("Image credit — photographer or source name"),
imageSourceUrl: z
.string()
.optional()
.describe("Original URL where the image was sourced from"),
tags: z
.array(z.string())
.optional()
.describe("Tags for categorization (created automatically if new)"),
};
export const catalogToolDefinitions = [

View File

@@ -48,11 +48,15 @@ app.post("/", zValidator("json", upsertGlobalItemSchema), async (c) => {
});
// Bulk upsert — per D-06, D-07, D-08
app.post("/bulk", zValidator("json", bulkUpsertGlobalItemsSchema), async (c) => {
app.post(
"/bulk",
zValidator("json", bulkUpsertGlobalItemsSchema),
async (c) => {
const db = c.get("db");
const { items } = c.req.valid("json");
const result = await bulkUpsertGlobalItems(db, items);
return c.json(result);
});
},
);
export { app as globalItemRoutes };

View File

@@ -302,12 +302,17 @@ describe("MCP Catalog Tools", () => {
model: "PocketRocket 2",
sourceUrl: "https://www.cascadedesigns.com/msr/pocket-rocket-2",
imageCredit: "MSR Photography",
imageSourceUrl: "https://cdn.cascadedesigns.com/images/pocket-rocket-2.jpg",
imageSourceUrl:
"https://cdn.cascadedesigns.com/images/pocket-rocket-2.jpg",
});
const data = parseResult(result);
expect(data.sourceUrl).toBe("https://www.cascadedesigns.com/msr/pocket-rocket-2");
expect(data.sourceUrl).toBe(
"https://www.cascadedesigns.com/msr/pocket-rocket-2",
);
expect(data.imageCredit).toBe("MSR Photography");
expect(data.imageSourceUrl).toBe("https://cdn.cascadedesigns.com/images/pocket-rocket-2.jpg");
expect(data.imageSourceUrl).toBe(
"https://cdn.cascadedesigns.com/images/pocket-rocket-2.jpg",
);
});
test("bulk_upsert_catalog processes array and returns created/updated counts", async () => {
@@ -333,7 +338,10 @@ describe("MCP Catalog Tools", () => {
const tools = registerCatalogTools(db);
// Pre-create one item
await tools.upsert_catalog_item({ brand: "Revelate Designs", model: "Terrapin System" });
await tools.upsert_catalog_item({
brand: "Revelate Designs",
model: "Terrapin System",
});
const result = await tools.bulk_upsert_catalog({
items: [
@@ -348,7 +356,9 @@ describe("MCP Catalog Tools", () => {
});
test("catalog tool definitions include attribution fields in inputSchema", () => {
const { catalogToolDefinitions } = require("../../src/server/mcp/tools/catalog.ts");
const {
catalogToolDefinitions,
} = require("../../src/server/mcp/tools/catalog.ts");
const upsertDef = catalogToolDefinitions.find(
(d: { name: string }) => d.name === "upsert_catalog_item",
);

View File

@@ -116,7 +116,10 @@ describe("Global Item Routes", () => {
const res = await app.request("/api/global-items", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ brand: "Revelate Designs", model: "Terrapin System" }),
body: JSON.stringify({
brand: "Revelate Designs",
model: "Terrapin System",
}),
});
expect(res.status).toBe(200);