diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 36f8214..a0c24c3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.26" + ".": "0.1.0-alpha.27" } diff --git a/.stats.yml b/.stats.yml index ce01a9c..852af64 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 1 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/benchify%2Fbenchify-2a67e842b87576472f1969d75642637db0f0f42fc805a61ab3b880e544941595.yml -openapi_spec_hash: 7cf70aa93bf241c1d1460f48182e9819 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/benchify%2Fbenchify-882428dc42061ac58fad8814f920a7afec0a8fb54bb744e8e709b27156b8afb3.yml +openapi_spec_hash: 4778a24a07fa3aafa7a9befb36579c19 config_hash: 935baad1727a1116efdc14e9ce6e4405 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ade691..fb94a12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## 0.1.0-alpha.27 (2025-08-18) + +Full Changelog: [v0.1.0-alpha.26...v0.1.0-alpha.27](https://github.com/Benchify/benchify-sdk/compare/v0.1.0-alpha.26...v0.1.0-alpha.27) + +### Features + +* **api:** api update ([38868ee](https://github.com/Benchify/benchify-sdk/commit/38868ee05dcb933892f6832bf774a82920b3e859)) +* **api:** api update ([dc63afb](https://github.com/Benchify/benchify-sdk/commit/dc63afb29c6736cabe999255ecb8e92d3bfbb763)) +* **api:** api update ([8d0d58a](https://github.com/Benchify/benchify-sdk/commit/8d0d58adfb215d36ffbc970a8bd28f1ad4e6da78)) +* **api:** api update ([585d01e](https://github.com/Benchify/benchify-sdk/commit/585d01e40f89c2d7a4cde9cbda7efcb65b5b70b4)) + + +### Bug Fixes + +* **mcp:** generate additionalProperties=true for map schemas to avoid validation issues ([cf925ad](https://github.com/Benchify/benchify-sdk/commit/cf925ad24dc8709fe0ed65ea1616fec5571496e9)) + + +### Chores + +* **deps:** update dependency @types/node to v20.17.58 ([6efc5bf](https://github.com/Benchify/benchify-sdk/commit/6efc5bfe43b91566e490952b551dbd3bb5a33085)) +* **internal:** codegen related update ([2c2d91b](https://github.com/Benchify/benchify-sdk/commit/2c2d91b26fc1c2084ebe5fefe223ba3533ee1e20)) +* **internal:** formatting change ([bf8be45](https://github.com/Benchify/benchify-sdk/commit/bf8be452e307ff976370b534681457ca5bcb52c0)) +* **mcp:** document remote server in README.md ([a9436b7](https://github.com/Benchify/benchify-sdk/commit/a9436b77e2c2e5880a66c7e56202284bf52b2118)) +* **mcp:** minor cleanup of types and package.json ([4457795](https://github.com/Benchify/benchify-sdk/commit/4457795b4f1314342ab309c840ad1fe3a3ae1f31)) +* **mcp:** update README ([bf15c28](https://github.com/Benchify/benchify-sdk/commit/bf15c28363dcbed6ca86e84358efff64631893b4)) + ## 0.1.0-alpha.26 (2025-08-11) Full Changelog: [v0.1.0-alpha.25...v0.1.0-alpha.26](https://github.com/Benchify/benchify-sdk/compare/v0.1.0-alpha.25...v0.1.0-alpha.26) diff --git a/package.json b/package.json index 878137d..dedb30d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "benchify", - "version": "0.1.0-alpha.26", + "version": "0.1.0-alpha.27", "description": "The official TypeScript library for the Benchify API", "author": "Benchify <>", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/README.md b/packages/mcp-server/README.md index 6571eb2..457e5b9 100644 --- a/packages/mcp-server/README.md +++ b/packages/mcp-server/README.md @@ -126,6 +126,32 @@ over time, you can manually enable or disable certain capabilities: --resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards ``` +## Running remotely + +Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket. + +Authorization can be provided via the `Authorization` header using the Bearer scheme. + +Additionally, authorization can be provided via the following headers: +| Header | Equivalent client option | Security scheme | +| -------------------- | ------------------------ | --------------- | +| `x-benchify-api-key` | `apiKey` | ApiKeyAuth | + +A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`: + +```json +{ + "mcpServers": { + "benchify_api": { + "url": "http://localhost:3000", + "headers": { + "Authorization": "Bearer " + } + } + } +} +``` + ## Importing the tools and server individually ```js diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index 3a0b672..eceecd4 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,6 +1,6 @@ { "name": "benchify-mcp", - "version": "0.1.0-alpha.26", + "version": "0.1.0-alpha.27", "description": "The official MCP Server for the Benchify API", "author": "Benchify <>", "types": "dist/index.d.ts", @@ -30,7 +30,7 @@ "benchify": "file:../../dist/", "@modelcontextprotocol/sdk": "^1.11.5", "express": "^5.1.0", - "jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.2/jq-web.tar.gz", + "jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.6/jq-web.tar.gz", "yargs": "^17.7.2", "@cloudflare/cabidela": "^0.2.4", "zod": "^3.25.20", @@ -42,6 +42,7 @@ "devDependencies": { "@types/jest": "^29.4.0", "@types/express": "^5.0.3", + "@types/yargs": "^17.0.8", "@typescript-eslint/eslint-plugin": "8.31.1", "@typescript-eslint/parser": "8.31.1", "eslint": "^8.49.0", diff --git a/packages/mcp-server/src/filtering.ts b/packages/mcp-server/src/filtering.ts index 87eab2d..1aa9a40 100644 --- a/packages/mcp-server/src/filtering.ts +++ b/packages/mcp-server/src/filtering.ts @@ -1,8 +1,7 @@ // @ts-nocheck import initJq from 'jq-web'; -export async function maybeFilter(args: Record | undefined, response: any): Promise { - const jqFilter = args?.['jq_filter']; +export async function maybeFilter(jqFilter: unknown | undefined, response: any): Promise { if (jqFilter && typeof jqFilter === 'string') { return await jq(response, jqFilter); } else { diff --git a/packages/mcp-server/src/http.ts b/packages/mcp-server/src/http.ts index 900e131..e188c9e 100644 --- a/packages/mcp-server/src/http.ts +++ b/packages/mcp-server/src/http.ts @@ -69,7 +69,7 @@ const del = async (req: express.Request, res: express.Response) => { }); }; -export const streamableHTTPApp = (options: McpOptions) => { +export const streamableHTTPApp = (options: McpOptions): express.Express => { const app = express(); app.use(express.json()); diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index d5e1de2..73bac13 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -26,7 +26,7 @@ export const newMcpServer = () => new McpServer( { name: 'benchify_api', - version: '0.1.0-alpha.26', + version: '0.1.0-alpha.27', }, { capabilities: { tools: {}, logging: {} } }, ); diff --git a/packages/mcp-server/src/tools/fixer/run-fixer.ts b/packages/mcp-server/src/tools/fixer/run-fixer.ts index bd0ebc3..f236202 100644 --- a/packages/mcp-server/src/tools/fixer/run-fixer.ts +++ b/packages/mcp-server/src/tools/fixer/run-fixer.ts @@ -18,7 +18,7 @@ export const metadata: Metadata = { export const tool: Tool = { name: 'run_fixer', description: - "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nHandle fixer requests to process and fix TypeScript files.\n\n# Response Schema\n```json\n{\n type: 'object',\n title: 'WrappedFixerResponse',\n description: 'Wrapped response model for benchify-api compatibility',\n properties: {\n data: {\n type: 'object',\n title: 'FixerResponse',\n description: 'The actual response data',\n properties: {\n files_processed: {\n type: 'integer',\n title: 'Files Processed',\n description: 'Number of files processed'\n },\n status: {\n type: 'object',\n title: 'FixerStatus',\n description: 'Final per-file status after fixing',\n properties: {\n file_to_status: {\n type: 'object',\n title: 'File To Status',\n description: 'Fix status of each file sent.'\n }\n }\n },\n fixed_files: {\n type: 'object',\n title: 'Fixed Files',\n description: 'Information about fixed files'\n },\n suggested_changes: {\n anyOf: [ {\n type: 'object',\n title: 'DiffFormat',\n properties: {\n diff: {\n type: 'string',\n title: 'Diff',\n description: 'Git diff of changes made'\n }\n }\n },\n {\n type: 'object',\n title: 'ChangedFilesFormat',\n properties: {\n changed_files: {\n type: 'array',\n title: 'Changed Files',\n description: 'List of changed files with their new contents',\n items: {\n $ref: '#/$defs/file_change'\n }\n }\n }\n },\n {\n type: 'object',\n title: 'AllFilesFormat',\n properties: {\n all_files: {\n type: 'array',\n title: 'All Files',\n description: 'List of all files with their current contents',\n items: {\n $ref: '#/$defs/file_change'\n }\n }\n }\n }\n ],\n title: 'Suggested Changes',\n description: 'Changes made by the fixer in the requested format'\n }\n },\n required: [ 'files_processed',\n 'status'\n ]\n },\n error: {\n type: 'object',\n title: 'ResponseError',\n description: 'The error from the API query',\n properties: {\n code: {\n type: 'string',\n title: 'Code',\n description: 'The error code'\n },\n message: {\n type: 'string',\n title: 'Message',\n description: 'The error message'\n },\n details: {\n type: 'string',\n title: 'Details',\n description: 'Details about what caused the error, if available'\n },\n suggestions: {\n type: 'array',\n title: 'Suggestions',\n description: 'Potential suggestions about how to fix the error, if applicable',\n items: {\n type: 'string'\n }\n }\n },\n required: [ 'code',\n 'message'\n ]\n },\n meta: {\n $ref: '#/$defs/response_meta'\n }\n },\n required: [ 'data'\n ],\n $defs: {\n file_change: {\n type: 'object',\n title: 'FileChange',\n description: 'Model for a single file change',\n properties: {\n contents: {\n type: 'string',\n title: 'Contents',\n description: 'Contents of the file'\n },\n path: {\n type: 'string',\n title: 'Path',\n description: 'Path of the file'\n }\n },\n required: [ 'contents',\n 'path'\n ]\n },\n response_meta: {\n type: 'object',\n title: 'ResponseMeta',\n description: 'Meta information for API responses',\n properties: {\n external_id: {\n type: 'string',\n title: 'External Id',\n description: 'Customer tracking identifier'\n },\n trace_id: {\n type: 'string',\n title: 'Trace Id',\n description: 'Unique trace identifier for the request'\n }\n }\n }\n }\n}\n```", + "When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nHandle fixer requests to process and fix TypeScript files.\n\n# Response Schema\n```json\n{\n type: 'object',\n title: 'WrappedFixerResponse',\n description: 'Wrapped response model for benchify-api compatibility',\n properties: {\n data: {\n type: 'object',\n title: 'FixerResponse',\n description: 'The actual response data',\n properties: {\n status: {\n type: 'object',\n title: 'FixerStatus',\n description: 'Final per-file status after fixing',\n properties: {\n file_to_status: {\n type: 'object',\n title: 'File To Status',\n description: 'Fix status of each file sent.',\n additionalProperties: true\n }\n }\n },\n bundled_files: {\n type: 'array',\n title: 'Bundled Files',\n description: 'Bundled files',\n items: {\n $ref: '#/$defs/file_change'\n }\n },\n suggested_changes: {\n anyOf: [ {\n type: 'object',\n title: 'DiffFormat',\n properties: {\n diff: {\n type: 'string',\n title: 'Diff',\n description: 'Git diff of changes made'\n }\n }\n },\n {\n type: 'object',\n title: 'ChangedFilesFormat',\n properties: {\n changed_files: {\n type: 'array',\n title: 'Changed Files',\n description: 'List of changed files with their new contents',\n items: {\n $ref: '#/$defs/file_change'\n }\n }\n }\n },\n {\n type: 'object',\n title: 'AllFilesFormat',\n properties: {\n all_files: {\n type: 'array',\n title: 'All Files',\n description: 'List of all files with their current contents',\n items: {\n $ref: '#/$defs/file_change'\n }\n }\n }\n }\n ],\n title: 'Suggested Changes',\n description: 'Changes made by the fixer in the requested format'\n }\n },\n required: [ 'status'\n ]\n },\n error: {\n type: 'object',\n title: 'ResponseError',\n description: 'The error from the API query',\n properties: {\n code: {\n type: 'string',\n title: 'Code',\n description: 'The error code'\n },\n message: {\n type: 'string',\n title: 'Message',\n description: 'The error message'\n },\n details: {\n type: 'string',\n title: 'Details',\n description: 'Details about what caused the error, if available'\n },\n suggestions: {\n type: 'array',\n title: 'Suggestions',\n description: 'Potential suggestions about how to fix the error, if applicable',\n items: {\n type: 'string'\n }\n }\n },\n required: [ 'code',\n 'message'\n ]\n },\n meta: {\n $ref: '#/$defs/response_meta'\n }\n },\n required: [ 'data'\n ],\n $defs: {\n file_change: {\n type: 'object',\n title: 'FileChange',\n description: 'Model for a single file change',\n properties: {\n contents: {\n type: 'string',\n title: 'Contents',\n description: 'Contents of the file'\n },\n path: {\n type: 'string',\n title: 'Path',\n description: 'Path of the file'\n }\n },\n required: [ 'contents',\n 'path'\n ]\n },\n response_meta: {\n type: 'object',\n title: 'ResponseMeta',\n description: 'Meta information for API responses',\n properties: {\n external_id: {\n type: 'string',\n title: 'External Id',\n description: 'Customer tracking identifier'\n },\n trace_id: {\n type: 'string',\n title: 'Trace Id',\n description: 'Unique trace identifier for the request'\n }\n }\n }\n }\n}\n```", inputSchema: { type: 'object', properties: { @@ -45,10 +45,26 @@ export const tool: Tool = { required: ['contents', 'path'], }, }, + bundle: { + type: 'boolean', + title: 'Bundle', + description: 'Whether to bundle the project (experimental)', + }, + fix_types: { + type: 'array', + title: 'Fix Types', + description: 'Configuration for which fix types to apply', + items: { + type: 'string', + title: 'FixTypeName', + description: 'Enumeration of available fix types', + enum: ['import_export', 'string_literals', 'css', 'tailwind', 'ai_fallback', 'types'], + }, + }, fixes: { type: 'object', title: 'FixConfigObject', - description: 'Configuration object for specifying which fixes to apply', + description: 'DEPRECATED: legacy boolean flags for which fixes to apply.', properties: { css: { type: 'boolean', diff --git a/src/client.ts b/src/client.ts index 203c543..0932b56 100644 --- a/src/client.ts +++ b/src/client.ts @@ -786,7 +786,9 @@ export class Benchify { }); } } + Benchify.Fixer = Fixer; + export declare namespace Benchify { export type RequestOptions = Opts.RequestOptions; diff --git a/src/resources/fixer.ts b/src/resources/fixer.ts index 560b91b..7aa2fa7 100644 --- a/src/resources/fixer.ts +++ b/src/resources/fixer.ts @@ -30,16 +30,6 @@ export interface DiagnosticResponse { * Diagnostics grouped by file */ file_to_diagnostics?: { [key: string]: Array }; - - /** - * Human-readable summary of issues - */ - summary?: string; - - /** - * Total number of diagnostics - */ - total_count?: number; } export namespace DiagnosticResponse { @@ -47,11 +37,6 @@ export namespace DiagnosticResponse { * Enhanced diagnostic model for external API */ export interface FileToDiagnostic { - /** - * Category of diagnostic - */ - category: 'typescript'; - /** * File where diagnostic occurs */ @@ -67,6 +52,18 @@ export namespace DiagnosticResponse { */ message: string; + /** + * Type of the diagnostic + */ + type: + | 'type_error' + | 'string_literal' + | 'import_export' + | 'implicit_any' + | 'implicit_any_array' + | 'invalid_jsx' + | 'unclassified'; + /** * Code given by the diagnostic generator */ @@ -76,11 +73,6 @@ export namespace DiagnosticResponse { * Surrounding code context */ context?: string | null; - - /** - * Diagnostic category - */ - severity?: 'error' | 'warning'; } export namespace FileToDiagnostic { @@ -151,20 +143,15 @@ export namespace FixerRunResponse { * The actual response data */ export interface Data { - /** - * Number of files processed - */ - files_processed: number; - /** * Final per-file status after fixing */ status: Data.Status; /** - * Information about fixed files + * Bundled files */ - fixed_files?: { [key: string]: unknown } | null; + bundled_files?: Array | null; /** * Changes made by the fixer in the requested format @@ -238,7 +225,17 @@ export interface FixerRunParams { files: Array; /** - * Configuration object for specifying which fixes to apply + * Whether to bundle the project (experimental) + */ + bundle?: boolean; + + /** + * Configuration for which fix types to apply + */ + fix_types?: Array<'import_export' | 'string_literals' | 'css' | 'tailwind' | 'ai_fallback' | 'types'>; + + /** + * @deprecated DEPRECATED: legacy boolean flags for which fixes to apply. */ fixes?: FixerRunParams.Fixes | null; @@ -275,38 +272,38 @@ export namespace FixerRunParams { } /** - * Configuration object for specifying which fixes to apply + * @deprecated DEPRECATED: legacy boolean flags for which fixes to apply. */ export interface Fixes { /** - * Whether to fix CSS issues + * @deprecated Whether to fix CSS issues */ - css?: boolean; + css?: boolean | null; /** - * Whether to fix import issues + * @deprecated Whether to fix import issues */ - imports?: boolean; + imports?: boolean | null; /** - * Whether to fix React issues + * @deprecated Whether to fix React issues */ - react?: boolean; + react?: boolean | null; /** - * Whether to fix string literal issues + * @deprecated Whether to fix string literal issues */ - stringLiterals?: boolean; + stringLiterals?: boolean | null; /** - * Whether to fix Tailwind issues + * @deprecated Whether to fix Tailwind issues */ - tailwind?: boolean; + tailwind?: boolean | null; /** - * Whether to fix TypeScript suggestions + * @deprecated Whether to fix TypeScript suggestions */ - tsSuggestions?: boolean; + tsSuggestions?: boolean | null; } /** diff --git a/src/version.ts b/src/version.ts index 4aa2b2f..3287b08 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.1.0-alpha.26'; // x-release-please-version +export const VERSION = '0.1.0-alpha.27'; // x-release-please-version diff --git a/tests/api-resources/fixer.test.ts b/tests/api-resources/fixer.test.ts index ff84308..444cbf0 100644 --- a/tests/api-resources/fixer.test.ts +++ b/tests/api-resources/fixer.test.ts @@ -8,7 +8,7 @@ const client = new Benchify({ }); describe('resource fixer', () => { - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('run: only required params', async () => { const responsePromise = client.fixer.run({ files: [{ contents: 'contents', path: 'x' }] }); const rawResponse = await responsePromise.asResponse(); @@ -20,10 +20,12 @@ describe('resource fixer', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // skipped: tests are disabled for the time being + // Prism tests are disabled test.skip('run: required and optional params', async () => { const response = await client.fixer.run({ files: [{ contents: 'contents', path: 'x' }], + bundle: true, + fix_types: ['import_export'], fixes: { css: true, imports: true, diff --git a/yarn.lock b/yarn.lock index 0ac56c3..dbc8e63 100644 --- a/yarn.lock +++ b/yarn.lock @@ -963,11 +963,11 @@ undici-types "~5.26.4" "@types/node@^20.17.6": - version "20.17.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.17.6.tgz#6e4073230c180d3579e8c60141f99efdf5df0081" - integrity sha512-VEI7OdvK2wP7XHnsuXbAJnEpEkF6NjSN45QJlL4VGqZSXsnicpesdTWsg9RISeSdYd3yeRj/y3k5KGjUXYnFwQ== + version "20.19.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.19.11.tgz#728cab53092bd5f143beed7fbba7ba99de3c16c4" + integrity sha512-uug3FEEGv0r+jrecvUUpbY8lLisvIjg6AAic6a2bSP5OEOLeJsDSnvhCDov7ipFFMXS3orMpzlmi0ZcuGkBbow== dependencies: - undici-types "~6.19.2" + undici-types "~6.21.0" "@types/stack-utils@^2.0.0": version "2.0.3" @@ -3317,6 +3317,7 @@ ts-node@^10.5.0: "tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz": version "1.1.8" + uid f544b359b8f05e607771ffacc280e58201476b04 resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz#f544b359b8f05e607771ffacc280e58201476b04" dependencies: debug "^4.3.7" @@ -3385,10 +3386,10 @@ undici-types@~5.26.4: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -undici-types@~6.19.2: - version "6.19.8" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" - integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== +undici-types@~6.21.0: + version "6.21.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" + integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== unicode-emoji-modifier-base@^1.0.0: version "1.0.0"