Run oxfmt across repo, add format script and docs

Add .oxfmtignore to skip generated bindings and wasm-pack output.
Add npm format script, update DEVELOPMENT.md for Vite+ toolchain,
and format all non-generated files with oxfmt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-03-13 10:15:49 -07:00
parent 45262edfbd
commit b4a1c418bb
664 changed files with 13638 additions and 13492 deletions

View File

@@ -1,20 +1,20 @@
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import * as z from 'zod';
import type { McpServerContext } from '../types.js';
import { getWorkspaceContext } from './helpers.js';
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import * as z from "zod";
import type { McpServerContext } from "../types.js";
import { getWorkspaceContext } from "./helpers.js";
import {
authenticationSchema,
authenticationTypeSchema,
headersSchema,
workspaceIdSchema,
} from './schemas.js';
} from "./schemas.js";
export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
server.registerTool(
'list_folders',
"list_folders",
{
title: 'List Folders',
description: 'List all folders in a workspace',
title: "List Folders",
description: "List all folders in a workspace",
inputSchema: {
workspaceId: workspaceIdSchema,
},
@@ -26,7 +26,7 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
return {
content: [
{
type: 'text' as const,
type: "text" as const,
text: JSON.stringify(folders, null, 2),
},
],
@@ -35,12 +35,12 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
);
server.registerTool(
'get_folder',
"get_folder",
{
title: 'Get Folder',
description: 'Get details of a specific folder by ID',
title: "Get Folder",
description: "Get details of a specific folder by ID",
inputSchema: {
id: z.string().describe('The folder ID'),
id: z.string().describe("The folder ID"),
workspaceId: workspaceIdSchema,
},
},
@@ -51,7 +51,7 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
return {
content: [
{
type: 'text' as const,
type: "text" as const,
text: JSON.stringify(folder, null, 2),
},
],
@@ -60,17 +60,17 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
);
server.registerTool(
'create_folder',
"create_folder",
{
title: 'Create Folder',
description: 'Create a new folder in a workspace',
title: "Create Folder",
description: "Create a new folder in a workspace",
inputSchema: {
workspaceId: workspaceIdSchema,
name: z.string().describe('Folder name'),
folderId: z.string().optional().describe('Parent folder ID (for nested folders)'),
description: z.string().optional().describe('Folder description'),
sortPriority: z.number().optional().describe('Sort priority for ordering'),
headers: headersSchema.describe('Default headers to apply to requests in this folder'),
name: z.string().describe("Folder name"),
folderId: z.string().optional().describe("Parent folder ID (for nested folders)"),
description: z.string().optional().describe("Folder description"),
sortPriority: z.number().optional().describe("Sort priority for ordering"),
headers: headersSchema.describe("Default headers to apply to requests in this folder"),
authenticationType: authenticationTypeSchema,
authentication: authenticationSchema,
},
@@ -79,7 +79,7 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
const workspaceCtx = await getWorkspaceContext(ctx, ogWorkspaceId);
const workspaceId = await workspaceCtx.yaak.window.workspaceId();
if (!workspaceId) {
throw new Error('No workspace is open');
throw new Error("No workspace is open");
}
const folder = await workspaceCtx.yaak.folder.create({
@@ -88,24 +88,24 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
});
return {
content: [{ type: 'text' as const, text: JSON.stringify(folder, null, 2) }],
content: [{ type: "text" as const, text: JSON.stringify(folder, null, 2) }],
};
},
);
server.registerTool(
'update_folder',
"update_folder",
{
title: 'Update Folder',
description: 'Update an existing folder',
title: "Update Folder",
description: "Update an existing folder",
inputSchema: {
id: z.string().describe('Folder ID to update'),
id: z.string().describe("Folder ID to update"),
workspaceId: workspaceIdSchema,
name: z.string().optional().describe('Folder name'),
folderId: z.string().optional().describe('Parent folder ID (for nested folders)'),
description: z.string().optional().describe('Folder description'),
sortPriority: z.number().optional().describe('Sort priority for ordering'),
headers: headersSchema.describe('Default headers to apply to requests in this folder'),
name: z.string().optional().describe("Folder name"),
folderId: z.string().optional().describe("Parent folder ID (for nested folders)"),
description: z.string().optional().describe("Folder description"),
sortPriority: z.number().optional().describe("Sort priority for ordering"),
headers: headersSchema.describe("Default headers to apply to requests in this folder"),
authenticationType: authenticationTypeSchema,
authentication: authenticationSchema,
},
@@ -124,24 +124,24 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
id,
});
return {
content: [{ type: 'text' as const, text: JSON.stringify(folder, null, 2) }],
content: [{ type: "text" as const, text: JSON.stringify(folder, null, 2) }],
};
},
);
server.registerTool(
'delete_folder',
"delete_folder",
{
title: 'Delete Folder',
description: 'Delete a folder by ID',
title: "Delete Folder",
description: "Delete a folder by ID",
inputSchema: {
id: z.string().describe('Folder ID to delete'),
id: z.string().describe("Folder ID to delete"),
},
},
async ({ id }) => {
const folder = await ctx.yaak.folder.delete({ id });
return {
content: [{ type: 'text' as const, text: `Deleted: ${folder.name} (${folder.id})` }],
content: [{ type: "text" as const, text: `Deleted: ${folder.name} (${folder.id})` }],
};
},
);

View File

@@ -1,4 +1,4 @@
import type { McpServerContext } from '../types.js';
import type { McpServerContext } from "../types.js";
export async function getWorkspaceContext(
ctx: McpServerContext,
@@ -7,7 +7,7 @@ export async function getWorkspaceContext(
const workspaces = await ctx.yaak.workspace.list();
if (!workspaceId && workspaces.length > 1) {
const workspaceList = workspaces.map((w, i) => `${i + 1}. ${w.name} (ID: ${w.id})`).join('\n');
const workspaceList = workspaces.map((w, i) => `${i + 1}. ${w.name} (ID: ${w.id})`).join("\n");
throw new Error(
`Multiple workspaces are open. Please specify which workspace to use.\n\n` +
`Currently open workspaces:\n${workspaceList}\n\n` +
@@ -19,7 +19,7 @@ export async function getWorkspaceContext(
const workspace = workspaceId ? workspaces.find((w) => w.id === workspaceId) : workspaces[0];
if (!workspace) {
const workspaceList = workspaces.map((w) => `- ${w.name} (ID: ${w.id})`).join('\n');
const workspaceList = workspaces.map((w) => `- ${w.name} (ID: ${w.id})`).join("\n");
throw new Error(
`Workspace with ID "${workspaceId}" not found.\n\n` +
`Available workspaces:\n${workspaceList}`,

View File

@@ -1,7 +1,7 @@
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import * as z from 'zod';
import type { McpServerContext } from '../types.js';
import { getWorkspaceContext } from './helpers.js';
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import * as z from "zod";
import type { McpServerContext } from "../types.js";
import { getWorkspaceContext } from "./helpers.js";
import {
authenticationSchema,
authenticationTypeSchema,
@@ -10,14 +10,14 @@ import {
headersSchema,
urlParametersSchema,
workspaceIdSchema,
} from './schemas.js';
} from "./schemas.js";
export function registerHttpRequestTools(server: McpServer, ctx: McpServerContext) {
server.registerTool(
'list_http_requests',
"list_http_requests",
{
title: 'List HTTP Requests',
description: 'List all HTTP requests in a workspace',
title: "List HTTP Requests",
description: "List all HTTP requests in a workspace",
inputSchema: {
workspaceId: workspaceIdSchema,
},
@@ -29,7 +29,7 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
return {
content: [
{
type: 'text' as const,
type: "text" as const,
text: JSON.stringify(requests, null, 2),
},
],
@@ -38,12 +38,12 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
);
server.registerTool(
'get_http_request',
"get_http_request",
{
title: 'Get HTTP Request',
description: 'Get details of a specific HTTP request by ID',
title: "Get HTTP Request",
description: "Get details of a specific HTTP request by ID",
inputSchema: {
id: z.string().describe('The HTTP request ID'),
id: z.string().describe("The HTTP request ID"),
workspaceId: workspaceIdSchema,
},
},
@@ -54,7 +54,7 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
return {
content: [
{
type: 'text' as const,
type: "text" as const,
text: JSON.stringify(request, null, 2),
},
],
@@ -63,13 +63,13 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
);
server.registerTool(
'send_http_request',
"send_http_request",
{
title: 'Send HTTP Request',
description: 'Send an HTTP request and get the response',
title: "Send HTTP Request",
description: "Send an HTTP request and get the response",
inputSchema: {
id: z.string().describe('The HTTP request ID to send'),
environmentId: z.string().optional().describe('Optional environment ID to use'),
id: z.string().describe("The HTTP request ID to send"),
environmentId: z.string().optional().describe("Optional environment ID to use"),
workspaceId: workspaceIdSchema,
},
},
@@ -85,7 +85,7 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
return {
content: [
{
type: 'text' as const,
type: "text" as const,
text: JSON.stringify(response, null, 2),
},
],
@@ -94,21 +94,21 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
);
server.registerTool(
'create_http_request',
"create_http_request",
{
title: 'Create HTTP Request',
description: 'Create a new HTTP request',
title: "Create HTTP Request",
description: "Create a new HTTP request",
inputSchema: {
workspaceId: workspaceIdSchema,
name: z
.string()
.optional()
.describe('Request name (empty string to auto-generate from URL)'),
url: z.string().describe('Request URL'),
method: z.string().optional().describe('HTTP method (defaults to GET)'),
folderId: z.string().optional().describe('Parent folder ID'),
description: z.string().optional().describe('Request description'),
headers: headersSchema.describe('Request headers'),
.describe("Request name (empty string to auto-generate from URL)"),
url: z.string().describe("Request URL"),
method: z.string().optional().describe("HTTP method (defaults to GET)"),
folderId: z.string().optional().describe("Parent folder ID"),
description: z.string().optional().describe("Request description"),
headers: headersSchema.describe("Request headers"),
urlParameters: urlParametersSchema,
bodyType: bodyTypeSchema,
body: bodySchema,
@@ -120,7 +120,7 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
const workspaceCtx = await getWorkspaceContext(ctx, ogWorkspaceId);
const workspaceId = await workspaceCtx.yaak.window.workspaceId();
if (!workspaceId) {
throw new Error('No workspace is open');
throw new Error("No workspace is open");
}
const httpRequest = await workspaceCtx.yaak.httpRequest.create({
@@ -129,25 +129,25 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
});
return {
content: [{ type: 'text' as const, text: JSON.stringify(httpRequest, null, 2) }],
content: [{ type: "text" as const, text: JSON.stringify(httpRequest, null, 2) }],
};
},
);
server.registerTool(
'update_http_request',
"update_http_request",
{
title: 'Update HTTP Request',
description: 'Update an existing HTTP request',
title: "Update HTTP Request",
description: "Update an existing HTTP request",
inputSchema: {
id: z.string().describe('HTTP request ID to update'),
id: z.string().describe("HTTP request ID to update"),
workspaceId: workspaceIdSchema,
name: z.string().optional().describe('Request name'),
url: z.string().optional().describe('Request URL'),
method: z.string().optional().describe('HTTP method'),
folderId: z.string().optional().describe('Parent folder ID'),
description: z.string().optional().describe('Request description'),
headers: headersSchema.describe('Request headers'),
name: z.string().optional().describe("Request name"),
url: z.string().optional().describe("Request URL"),
method: z.string().optional().describe("HTTP method"),
folderId: z.string().optional().describe("Parent folder ID"),
description: z.string().optional().describe("Request description"),
headers: headersSchema.describe("Request headers"),
urlParameters: urlParametersSchema,
bodyType: bodyTypeSchema,
body: bodySchema,
@@ -169,25 +169,25 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
id,
});
return {
content: [{ type: 'text' as const, text: JSON.stringify(httpRequest, null, 2) }],
content: [{ type: "text" as const, text: JSON.stringify(httpRequest, null, 2) }],
};
},
);
server.registerTool(
'delete_http_request',
"delete_http_request",
{
title: 'Delete HTTP Request',
description: 'Delete an HTTP request by ID',
title: "Delete HTTP Request",
description: "Delete an HTTP request by ID",
inputSchema: {
id: z.string().describe('HTTP request ID to delete'),
id: z.string().describe("HTTP request ID to delete"),
},
},
async ({ id }) => {
const httpRequest = await ctx.yaak.httpRequest.delete({ id });
return {
content: [
{ type: 'text' as const, text: `Deleted: ${httpRequest.name} (${httpRequest.id})` },
{ type: "text" as const, text: `Deleted: ${httpRequest.name} (${httpRequest.id})` },
],
};
},

View File

@@ -1,9 +1,9 @@
import * as z from 'zod';
import * as z from "zod";
export const workspaceIdSchema = z
.string()
.optional()
.describe('Workspace ID (required if multiple workspaces are open)');
.describe("Workspace ID (required if multiple workspaces are open)");
export const headersSchema = z
.array(
@@ -24,7 +24,7 @@ export const urlParametersSchema = z
}),
)
.optional()
.describe('URL query parameters');
.describe("URL query parameters");
export const bodyTypeSchema = z
.string()
@@ -37,7 +37,7 @@ export const bodySchema = z
.record(z.string(), z.any())
.optional()
.describe(
'Body content object. Structure varies by bodyType:\n' +
"Body content object. Structure varies by bodyType:\n" +
'- "binary": { filePath: "/path/to/file" }\n' +
'- "graphql": { query: "{ users { name } }", variables: "{\\"id\\": \\"123\\"}" }\n' +
'- "application/x-www-form-urlencoded": { form: [{ name: "key", value: "val", enabled: true }] }\n' +
@@ -56,7 +56,7 @@ export const authenticationSchema = z
.record(z.string(), z.any())
.optional()
.describe(
'Authentication configuration object. Structure varies by authenticationType:\n' +
"Authentication configuration object. Structure varies by authenticationType:\n" +
'- "basic": { username: "user", password: "pass" }\n' +
'- "bearer": { token: "abc123", prefix: "Bearer" }\n' +
'- "oauth2": { clientId: "...", clientSecret: "...", grantType: "authorization_code", authorizationUrl: "...", accessTokenUrl: "...", scope: "...", ... }\n' +

View File

@@ -1,41 +1,41 @@
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import type { Color, Icon } from '@yaakapp/api';
import * as z from 'zod';
import type { McpServerContext } from '../types.js';
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import type { Color, Icon } from "@yaakapp/api";
import * as z from "zod";
import type { McpServerContext } from "../types.js";
const ICON_VALUES = [
'alert_triangle',
'check',
'check_circle',
'chevron_down',
'copy',
'info',
'pin',
'search',
'trash',
"alert_triangle",
"check",
"check_circle",
"chevron_down",
"copy",
"info",
"pin",
"search",
"trash",
] as const satisfies readonly Icon[];
const COLOR_VALUES = [
'primary',
'secondary',
'info',
'success',
'notice',
'warning',
'danger',
"primary",
"secondary",
"info",
"success",
"notice",
"warning",
"danger",
] as const satisfies readonly Color[];
export function registerToastTools(server: McpServer, ctx: McpServerContext) {
server.registerTool(
'show_toast',
"show_toast",
{
title: 'Show Toast',
description: 'Show a toast notification in Yaak',
title: "Show Toast",
description: "Show a toast notification in Yaak",
inputSchema: {
message: z.string().describe('The message to display'),
icon: z.enum(ICON_VALUES).optional().describe('Icon name'),
color: z.enum(COLOR_VALUES).optional().describe('Toast color'),
timeout: z.number().optional().describe('Timeout in milliseconds'),
message: z.string().describe("The message to display"),
icon: z.enum(ICON_VALUES).optional().describe("Icon name"),
color: z.enum(COLOR_VALUES).optional().describe("Toast color"),
timeout: z.number().optional().describe("Timeout in milliseconds"),
},
},
async ({ message, icon, color, timeout }) => {
@@ -49,7 +49,7 @@ export function registerToastTools(server: McpServer, ctx: McpServerContext) {
return {
content: [
{
type: 'text' as const,
type: "text" as const,
text: `✓ Toast shown: "${message}"`,
},
],

View File

@@ -1,13 +1,13 @@
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import type { McpServerContext } from '../types.js';
import { getWorkspaceContext } from './helpers.js';
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import type { McpServerContext } from "../types.js";
import { getWorkspaceContext } from "./helpers.js";
export function registerWindowTools(server: McpServer, ctx: McpServerContext) {
server.registerTool(
'get_workspace_id',
"get_workspace_id",
{
title: 'Get Workspace ID',
description: 'Get the current workspace ID',
title: "Get Workspace ID",
description: "Get the current workspace ID",
},
async () => {
const workspaceCtx = await getWorkspaceContext(ctx);
@@ -16,8 +16,8 @@ export function registerWindowTools(server: McpServer, ctx: McpServerContext) {
return {
content: [
{
type: 'text' as const,
text: workspaceId || 'No workspace open',
type: "text" as const,
text: workspaceId || "No workspace open",
},
],
};
@@ -25,10 +25,10 @@ export function registerWindowTools(server: McpServer, ctx: McpServerContext) {
);
server.registerTool(
'get_environment_id',
"get_environment_id",
{
title: 'Get Environment ID',
description: 'Get the current environment ID',
title: "Get Environment ID",
description: "Get the current environment ID",
},
async () => {
const workspaceCtx = await getWorkspaceContext(ctx);
@@ -37,8 +37,8 @@ export function registerWindowTools(server: McpServer, ctx: McpServerContext) {
return {
content: [
{
type: 'text' as const,
text: environmentId || 'No environment selected',
type: "text" as const,
text: environmentId || "No environment selected",
},
],
};

View File

@@ -1,12 +1,12 @@
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import type { McpServerContext } from '../types.js';
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import type { McpServerContext } from "../types.js";
export function registerWorkspaceTools(server: McpServer, ctx: McpServerContext) {
server.registerTool(
'list_workspaces',
"list_workspaces",
{
title: 'List Workspaces',
description: 'List all open workspaces in Yaak',
title: "List Workspaces",
description: "List all open workspaces in Yaak",
},
async () => {
const workspaces = await ctx.yaak.workspace.list();
@@ -14,7 +14,7 @@ export function registerWorkspaceTools(server: McpServer, ctx: McpServerContext)
return {
content: [
{
type: 'text' as const,
type: "text" as const,
text: JSON.stringify(workspaces, null, 2),
},
],