From 972b40d57e701e06722377651c85bdada19a6281 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 19 Nov 2025 21:42:48 +0000 Subject: [PATCH 1/2] Add documentation for testing utilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add API reference documentation for the testDocsSync() and validateDocsSyncBot() functions that help validate the automated documentation synchronization workflow. Synced from cloudflare/agents PR #666 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../api-reference/testing-utilities.mdx | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 src/content/docs/agents/api-reference/testing-utilities.mdx diff --git a/src/content/docs/agents/api-reference/testing-utilities.mdx b/src/content/docs/agents/api-reference/testing-utilities.mdx new file mode 100644 index 000000000000000..fc95e32426ddbb6 --- /dev/null +++ b/src/content/docs/agents/api-reference/testing-utilities.mdx @@ -0,0 +1,142 @@ +--- +title: Testing utilities +pcx_content_type: concept +sidebar: + order: 8 +--- + +import { TypeScriptExample, PackageManagers } from "~/components"; + +The Agents SDK provides utilities for testing and validating the automated documentation synchronization workflow. These tools help verify that changes to the SDK are properly reflected in the documentation. + +## Overview + +The documentation sync utilities are designed to test the integration between the `cloudflare/agents` repository and the `cloudflare/cloudflare-docs` repository. When changes are made to the SDK, these utilities can help verify that documentation updates are triggered correctly. + +## Functions + +### testDocsSync() + +Tests the documentation sync workflow with configurable options. + + + +```ts +import { testDocsSync } from "@cloudflare/agents"; + +// Basic usage +const result = testDocsSync(); +console.log(result.message); +// Output: "Docs sync test successful: Default test" + +// With custom options +const customResult = testDocsSync({ + message: "Testing PR #123", + includeTimestamp: true +}); +console.log(customResult.message); +// Output: "Docs sync test successful: Testing PR #123" +console.log(customResult.timestamp); +// Output: 1731974400000 +``` + + + +#### Parameters + +- `options` (optional): Configuration options for the test + - `message` (string, optional): Custom message to include in the test result + - `includeTimestamp` (boolean, optional): Whether to include a timestamp in the result + +#### Returns + +- `TestDocsSyncResult`: Object containing test results + - `success` (boolean): Whether the test succeeded + - `message` (string): Description of the test result + - `timestamp` (number, optional): Unix timestamp when the test was run (if `includeTimestamp` was true) + +### validateDocsSyncBot() + +Validates that the documentation sync bot is configured and working correctly. + + + +```ts +import { validateDocsSyncBot } from "@cloudflare/agents"; + +if (validateDocsSyncBot()) { + console.log("Documentation sync bot is working correctly"); +} else { + console.log("Documentation sync bot validation failed"); +} +``` + + + +#### Returns + +- `boolean`: `true` if the bot validation passes, `false` otherwise + +## Use cases + +### CI/CD integration + +You can use these utilities in your CI/CD pipeline to verify documentation sync: + + + +```ts +import { testDocsSync, validateDocsSyncBot } from "@cloudflare/agents"; + +// Validate bot configuration +if (!validateDocsSyncBot()) { + throw new Error("Docs sync bot is not configured correctly"); +} + +// Run test +const result = testDocsSync({ + message: `PR #${process.env.PR_NUMBER}`, + includeTimestamp: true +}); + +console.log(`Test completed at ${new Date(result.timestamp)}`); +``` + + + +### Local development + +Use these utilities during local development to ensure your changes will trigger proper documentation updates: + + + +```ts +import { testDocsSync } from "@cloudflare/agents"; + +const result = testDocsSync({ + message: "Local development test" +}); + +if (result.success) { + console.log("Ready to commit - docs sync will work"); +} +``` + + + +## How it works + +These utilities are part of the automated documentation synchronization system that: + +1. Detects changes to the Agents SDK +2. Triggers the documentation sync workflow +3. Creates or updates pull requests in `cloudflare/cloudflare-docs` +4. Maintains a comment on the source PR with a link to the docs PR + +The test utilities validate that this workflow is functioning correctly. + +## Related resources + +- [Agent class](/agents/concepts/agent-class/) +- [Model Context Protocol](/agents/model-context-protocol/) +- [Configuration](/agents/api-reference/configuration/) From f7a5600964a064e01c435190bf3aa2998a508ed8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 19 Nov 2025 21:56:22 +0000 Subject: [PATCH 2/2] Add documentation for testing utilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Syncs documentation for the new testing utilities added to the Agents SDK, including testDocsSync() and validateDocsSyncBot() functions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../docs/agents/api-reference/testing.mdx | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 src/content/docs/agents/api-reference/testing.mdx diff --git a/src/content/docs/agents/api-reference/testing.mdx b/src/content/docs/agents/api-reference/testing.mdx new file mode 100644 index 000000000000000..c2f815943225c19 --- /dev/null +++ b/src/content/docs/agents/api-reference/testing.mdx @@ -0,0 +1,145 @@ +--- +title: Testing +pcx_content_type: concept +sidebar: + order: 101 +--- + +import { TypeScriptExample } from "~/components"; + +The Agents SDK provides utilities for testing the automated documentation synchronization workflow. These tools help validate that changes to the SDK are properly reflected in the documentation. + +## Overview + +The documentation sync utilities are designed to test the integration between the `cloudflare/agents` repository and the `cloudflare/cloudflare-docs` repository. When changes are made to the SDK, these utilities can help verify that documentation updates are triggered correctly. + +## Functions + +### `testDocsSync()` + +Tests the documentation sync workflow with configurable options. + +**Parameters:** + +- `options` (optional): Configuration options for the test + - `message` (string, optional): Custom message to include in the test result + - `includeTimestamp` (boolean, optional): Whether to include a timestamp in the result + +**Returns:** + +- `TestDocsSyncResult`: Object containing test results + - `success` (boolean): Whether the test succeeded + - `message` (string): Description of the test result + - `timestamp` (number, optional): Unix timestamp when the test was run (if `includeTimestamp` was true) + +**Example:** + + + +```ts +import { testDocsSync } from "@cloudflare/agents"; + +// Basic usage +const result = testDocsSync(); +console.log(result.message); +// Output: "Docs sync test successful: Default test" + +// With custom options +const customResult = testDocsSync({ + message: "Testing PR #123", + includeTimestamp: true +}); +console.log(customResult.message); +// Output: "Docs sync test successful: Testing PR #123" +console.log(customResult.timestamp); +// Output: 1731974400000 +``` + + + +### `validateDocsSyncBot()` + +Validates that the documentation sync bot is configured and working correctly. + +**Returns:** + +- `boolean`: `true` if the bot validation passes, `false` otherwise + +**Example:** + + + +```ts +import { validateDocsSyncBot } from "@cloudflare/agents"; + +if (validateDocsSyncBot()) { + console.log("Documentation sync bot is working correctly"); +} else { + console.log("Documentation sync bot validation failed"); +} +``` + + + +## Use cases + +### CI/CD integration + +You can use these utilities in your CI/CD pipeline to verify documentation sync: + + + +```ts +import { testDocsSync, validateDocsSyncBot } from "@cloudflare/agents"; + +// Validate bot configuration +if (!validateDocsSyncBot()) { + throw new Error("Docs sync bot is not configured correctly"); +} + +// Run test +const result = testDocsSync({ + message: `PR #${process.env.PR_NUMBER}`, + includeTimestamp: true +}); + +console.log(`Test completed at ${new Date(result.timestamp)}`); +``` + + + +### Local development + +Use these utilities during local development to ensure your changes will trigger proper documentation updates: + + + +```ts +import { testDocsSync } from "@cloudflare/agents"; + +const result = testDocsSync({ + message: "Local development test" +}); + +if (result.success) { + console.log("Ready to commit - docs sync will work"); +} +``` + + + +## How it works + +These utilities are part of the automated documentation synchronization system that: + +1. Detects changes to the Agents SDK +2. Triggers the documentation sync workflow +3. Creates or updates pull requests in `cloudflare/cloudflare-docs` +4. Maintains a comment on the source PR with a link to the docs PR + +The test utilities validate that this workflow is functioning correctly. + +## Related resources + +- [Agent class](/agents/api-reference/agents-api/) +- [Configuration](/agents/api-reference/configuration/)