diff --git a/.github/workflows/check-redirects.yml b/.github/workflows/check-redirects.yml new file mode 100644 index 000000000..7dc81af70 --- /dev/null +++ b/.github/workflows/check-redirects.yml @@ -0,0 +1,126 @@ +name: Check Redirects for Deleted Pages + +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + - "app/**/*.md" + - "app/**/*.mdx" + - "next.config.ts" + +permissions: + contents: read + pull-requests: write + +jobs: + check-redirects: + name: Verify Deleted Pages Have Redirects + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Full history needed for branch comparison + + - name: Fetch base branch + run: git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} + + - name: Check for missing redirects + id: check + run: | + chmod +x ./scripts/check-redirects.sh + ./scripts/check-redirects.sh ${{ github.base_ref }} 2>&1 | tee redirect-check-output.txt + continue-on-error: true + + - name: Comment on PR if redirects are missing + if: steps.check.outcome == 'failure' + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const output = fs.readFileSync('redirect-check-output.txt', 'utf8'); + + // Extract the missing redirects and suggestions from output + const body = `## 🔗 Missing Redirects Detected + + This PR deletes markdown files that don't have corresponding redirects in \`next.config.ts\`. + + When you delete a page, you must add a redirect to prevent broken links for users who have bookmarked the old URL. + +
+ 📋 View Details + + \`\`\` + ${output} + \`\`\` + +
+ + ### How to fix + + 1. Open \`next.config.ts\` + 2. Find the \`redirects()\` function + 3. Add redirect entries for each deleted file (see suggestions above) + 4. Push the changes + + --- + *This check ensures we maintain URL stability for our documentation.*`; + + // Check if we already commented + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + + const botComment = comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('Missing Redirects Detected') + ); + + if (botComment) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: body + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: body + }); + } + + - name: Remove outdated comment if check passes + if: steps.check.outcome == 'success' + uses: actions/github-script@v7 + with: + script: | + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + + const botComment = comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('Missing Redirects Detected') + ); + + if (botComment) { + await github.rest.issues.deleteComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + }); + } + + - name: Fail if redirects are missing + if: steps.check.outcome == 'failure' + run: | + echo "❌ Missing redirects for deleted pages. See PR comment for details." + exit 1 diff --git a/app/en/guides/agent-frameworks/_meta.tsx b/app/en/get-started/agent-frameworks/_meta.tsx similarity index 100% rename from app/en/guides/agent-frameworks/_meta.tsx rename to app/en/get-started/agent-frameworks/_meta.tsx diff --git a/app/en/guides/agent-frameworks/crewai/_meta.tsx b/app/en/get-started/agent-frameworks/crewai/_meta.tsx similarity index 100% rename from app/en/guides/agent-frameworks/crewai/_meta.tsx rename to app/en/get-started/agent-frameworks/crewai/_meta.tsx diff --git a/app/en/guides/agent-frameworks/crewai/custom-auth-flow/page.mdx b/app/en/get-started/agent-frameworks/crewai/custom-auth-flow/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/crewai/custom-auth-flow/page.mdx rename to app/en/get-started/agent-frameworks/crewai/custom-auth-flow/page.mdx diff --git a/app/en/guides/agent-frameworks/crewai/use-arcade-tools/page.mdx b/app/en/get-started/agent-frameworks/crewai/use-arcade-tools/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/crewai/use-arcade-tools/page.mdx rename to app/en/get-started/agent-frameworks/crewai/use-arcade-tools/page.mdx diff --git a/app/en/guides/agent-frameworks/google-adk/_meta.tsx b/app/en/get-started/agent-frameworks/google-adk/_meta.tsx similarity index 100% rename from app/en/guides/agent-frameworks/google-adk/_meta.tsx rename to app/en/get-started/agent-frameworks/google-adk/_meta.tsx diff --git a/app/en/guides/agent-frameworks/google-adk/overview/page.mdx b/app/en/get-started/agent-frameworks/google-adk/overview/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/google-adk/overview/page.mdx rename to app/en/get-started/agent-frameworks/google-adk/overview/page.mdx diff --git a/app/en/guides/agent-frameworks/google-adk/use-arcade-tools/page.mdx b/app/en/get-started/agent-frameworks/google-adk/use-arcade-tools/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/google-adk/use-arcade-tools/page.mdx rename to app/en/get-started/agent-frameworks/google-adk/use-arcade-tools/page.mdx diff --git a/app/en/guides/agent-frameworks/langchain/_meta.tsx b/app/en/get-started/agent-frameworks/langchain/_meta.tsx similarity index 100% rename from app/en/guides/agent-frameworks/langchain/_meta.tsx rename to app/en/get-started/agent-frameworks/langchain/_meta.tsx diff --git a/app/en/guides/agent-frameworks/langchain/auth-langchain-tools/page.mdx b/app/en/get-started/agent-frameworks/langchain/auth-langchain-tools/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/langchain/auth-langchain-tools/page.mdx rename to app/en/get-started/agent-frameworks/langchain/auth-langchain-tools/page.mdx diff --git a/app/en/guides/agent-frameworks/langchain/use-arcade-tools/page.mdx b/app/en/get-started/agent-frameworks/langchain/use-arcade-tools/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/langchain/use-arcade-tools/page.mdx rename to app/en/get-started/agent-frameworks/langchain/use-arcade-tools/page.mdx diff --git a/app/en/guides/agent-frameworks/langchain/use-arcade-with-langchain/page.mdx b/app/en/get-started/agent-frameworks/langchain/use-arcade-with-langchain/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/langchain/use-arcade-with-langchain/page.mdx rename to app/en/get-started/agent-frameworks/langchain/use-arcade-with-langchain/page.mdx diff --git a/app/en/guides/agent-frameworks/langchain/user-auth-interrupts/page.mdx b/app/en/get-started/agent-frameworks/langchain/user-auth-interrupts/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/langchain/user-auth-interrupts/page.mdx rename to app/en/get-started/agent-frameworks/langchain/user-auth-interrupts/page.mdx diff --git a/app/en/guides/agent-frameworks/mastra/_meta.tsx b/app/en/get-started/agent-frameworks/mastra/_meta.tsx similarity index 100% rename from app/en/guides/agent-frameworks/mastra/_meta.tsx rename to app/en/get-started/agent-frameworks/mastra/_meta.tsx diff --git a/app/en/guides/agent-frameworks/mastra/overview/page.mdx b/app/en/get-started/agent-frameworks/mastra/overview/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/mastra/overview/page.mdx rename to app/en/get-started/agent-frameworks/mastra/overview/page.mdx diff --git a/app/en/guides/agent-frameworks/mastra/use-arcade-tools/page.mdx b/app/en/get-started/agent-frameworks/mastra/use-arcade-tools/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/mastra/use-arcade-tools/page.mdx rename to app/en/get-started/agent-frameworks/mastra/use-arcade-tools/page.mdx diff --git a/app/en/guides/agent-frameworks/mastra/user-auth-interrupts/page.mdx b/app/en/get-started/agent-frameworks/mastra/user-auth-interrupts/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/mastra/user-auth-interrupts/page.mdx rename to app/en/get-started/agent-frameworks/mastra/user-auth-interrupts/page.mdx diff --git a/app/en/guides/agent-frameworks/openai-agents/_meta.tsx b/app/en/get-started/agent-frameworks/openai-agents/_meta.tsx similarity index 100% rename from app/en/guides/agent-frameworks/openai-agents/_meta.tsx rename to app/en/get-started/agent-frameworks/openai-agents/_meta.tsx diff --git a/app/en/guides/agent-frameworks/openai-agents/overview/page.mdx b/app/en/get-started/agent-frameworks/openai-agents/overview/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/openai-agents/overview/page.mdx rename to app/en/get-started/agent-frameworks/openai-agents/overview/page.mdx diff --git a/app/en/guides/agent-frameworks/openai-agents/use-arcade-tools/page.mdx b/app/en/get-started/agent-frameworks/openai-agents/use-arcade-tools/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/openai-agents/use-arcade-tools/page.mdx rename to app/en/get-started/agent-frameworks/openai-agents/use-arcade-tools/page.mdx diff --git a/app/en/guides/agent-frameworks/openai-agents/user-auth-interrupts/page.mdx b/app/en/get-started/agent-frameworks/openai-agents/user-auth-interrupts/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/openai-agents/user-auth-interrupts/page.mdx rename to app/en/get-started/agent-frameworks/openai-agents/user-auth-interrupts/page.mdx diff --git a/app/en/guides/agent-frameworks/page.mdx b/app/en/get-started/agent-frameworks/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/page.mdx rename to app/en/get-started/agent-frameworks/page.mdx diff --git a/app/en/guides/agent-frameworks/vercelai/page.mdx b/app/en/get-started/agent-frameworks/vercelai/page.mdx similarity index 100% rename from app/en/guides/agent-frameworks/vercelai/page.mdx rename to app/en/get-started/agent-frameworks/vercelai/page.mdx diff --git a/app/en/guides/tool-calling/mcp-clients/_meta.tsx b/app/en/get-started/mcp-clients/_meta.tsx similarity index 100% rename from app/en/guides/tool-calling/mcp-clients/_meta.tsx rename to app/en/get-started/mcp-clients/_meta.tsx diff --git a/app/en/guides/tool-calling/mcp-clients/claude-desktop/page.mdx b/app/en/get-started/mcp-clients/claude-desktop/page.mdx similarity index 100% rename from app/en/guides/tool-calling/mcp-clients/claude-desktop/page.mdx rename to app/en/get-started/mcp-clients/claude-desktop/page.mdx diff --git a/app/en/guides/tool-calling/mcp-clients/cursor/page.mdx b/app/en/get-started/mcp-clients/cursor/page.mdx similarity index 100% rename from app/en/guides/tool-calling/mcp-clients/cursor/page.mdx rename to app/en/get-started/mcp-clients/cursor/page.mdx diff --git a/app/en/guides/tool-calling/mcp-clients/mcp-client-grid.tsx b/app/en/get-started/mcp-clients/mcp-client-grid.tsx similarity index 100% rename from app/en/guides/tool-calling/mcp-clients/mcp-client-grid.tsx rename to app/en/get-started/mcp-clients/mcp-client-grid.tsx diff --git a/app/en/guides/tool-calling/mcp-clients/page.mdx b/app/en/get-started/mcp-clients/page.mdx similarity index 100% rename from app/en/guides/tool-calling/mcp-clients/page.mdx rename to app/en/get-started/mcp-clients/page.mdx diff --git a/app/en/guides/tool-calling/mcp-clients/visual-studio-code/page.mdx b/app/en/get-started/mcp-clients/visual-studio-code/page.mdx similarity index 100% rename from app/en/guides/tool-calling/mcp-clients/visual-studio-code/page.mdx rename to app/en/get-started/mcp-clients/visual-studio-code/page.mdx diff --git a/app/en/guides/_meta.tsx b/app/en/guides/_meta.tsx index bf2e1073b..3c8f69763 100644 --- a/app/en/guides/_meta.tsx +++ b/app/en/guides/_meta.tsx @@ -7,9 +7,6 @@ export const meta: MetaRecord = { "create-tools": { title: "Create tools", }, - "agent-frameworks": { - title: "Agent frameworks", - }, "user-facing-agents": { title: "User-facing agents", }, diff --git a/app/en/guides/tool-calling/_meta.tsx b/app/en/guides/tool-calling/_meta.tsx index bfef9282b..4afb60e1a 100644 --- a/app/en/guides/tool-calling/_meta.tsx +++ b/app/en/guides/tool-calling/_meta.tsx @@ -7,9 +7,6 @@ export const meta: MetaRecord = { "call-third-party-apis": { title: "Call third-party APIs", }, - "mcp-clients": { - title: "Connect to MCP clients", - }, "custom-apps": { title: "In custom applications", }, diff --git a/next.config.ts b/next.config.ts index 4cd7690c0..cf2124e77 100644 --- a/next.config.ts +++ b/next.config.ts @@ -495,6 +495,28 @@ const nextConfig: NextConfig = withLlmsTxt({ destination: "/:locale/guides/create-tools/:path*", permanent: true, }, + // Agent frameworks moved from guides to get-started + { + source: "/:locale/guides/agent-frameworks", + destination: "/:locale/get-started/agent-frameworks", + permanent: true, + }, + { + source: "/:locale/guides/agent-frameworks/:path*", + destination: "/:locale/get-started/agent-frameworks/:path*", + permanent: true, + }, + // MCP clients moved from guides/tool-calling to get-started + { + source: "/:locale/guides/tool-calling/mcp-clients", + destination: "/:locale/get-started/mcp-clients", + permanent: true, + }, + { + source: "/:locale/guides/tool-calling/mcp-clients/:path*", + destination: "/:locale/get-started/mcp-clients/:path*", + permanent: true, + }, ]; }, headers: async () => [ diff --git a/public/llms.txt b/public/llms.txt index 39f89d763..a13003e34 100644 --- a/public/llms.txt +++ b/public/llms.txt @@ -1,4 +1,4 @@ - + # Arcade @@ -70,9 +70,9 @@ Arcade delivers three core capabilities: Deploy agents even your security team w - [Arcade for Slack](https://docs.arcade.dev/en/resources/integrations/social-communication/slack/install.md): The documentation page for Arcade for Slack provides users with guidance on integrating Arcade's AI tools into their Slack workspace to enhance team efficiency. It outlines the installation process, functionalities such as sending messages, finding information, and generating content, while also advising on the - [Arcade for Zoom](https://docs.arcade.dev/en/resources/integrations/social-communication/zoom/install.md): The "Arcade for Zoom" documentation page provides users with guidance on integrating Arcade's AI tools with their Zoom accounts to enhance meeting management and information retrieval. It outlines the functionalities available, such as listing upcoming meetings and retrieving invitation details, while also addressing - [Arcade Glossary](https://docs.arcade.dev/en/resources/glossary.md): The Arcade Glossary documentation provides definitions and explanations of key terms and concepts related to the Arcade platform, including agents, tools, and MCP servers. It aims to help users understand the components necessary for building, testing, and deploying applications that utilize large language -- [Arcade with Agent Frameworks and MCP Clients](https://docs.arcade.dev/en/guides/agent-frameworks.md): This documentation page provides guidance on integrating Arcade with various agent frameworks and MCP clients, enabling users to enhance their AI applications with tool-calling capabilities. It features a list of supported agent frameworks, including LangChain, CrewAI, and OpenAI Agents, -- [Arcade with Google ADK](https://docs.arcade.dev/en/guides/agent-frameworks/google-adk/overview.md): This documentation page provides a comprehensive guide on integrating the `google-adk-arcade` package with Arcade, enabling users to enhance their AI agents with various tools such as Google Mail and GitHub. It covers installation, key features, basic usage examples -- [Arcade with OpenAI Agents](https://docs.arcade.dev/en/guides/agent-frameworks/openai-agents/overview.md): This documentation page provides a comprehensive guide for integrating Arcade with the OpenAI Agents library, enabling users to enhance their AI agents with various tools such as Gmail, LinkedIn, and GitHub. It covers installation, key features, basic usage examples, and +- [Arcade with Agent Frameworks and MCP Clients](https://docs.arcade.dev/en/get-started/agent-frameworks.md): This documentation page provides guidance on integrating Arcade with various agent frameworks and MCP clients, enabling users to effectively implement and manage their arcade systems. It includes code examples and best practices to facilitate seamless interaction between the components. Users will learn how to optimize their arcade +- [Arcade with Google ADK](https://docs.arcade.dev/en/get-started/agent-frameworks/google-adk/overview.md): This documentation page provides a comprehensive guide for integrating the `google-adk-arcade` package with Arcade, enabling users to enhance their AI agents using various tools such as Google Mail and GitHub. It covers installation, key features, basic usage examples +- [Arcade with OpenAI Agents](https://docs.arcade.dev/en/get-started/agent-frameworks/openai-agents/overview.md): This documentation page provides a comprehensive guide for integrating Arcade with the OpenAI Agents library, enabling users to enhance their AI agents with various tools such as Gmail and GitHub. It covers installation, key features, basic usage examples, and user authorization handling, - [ArcadeEngineApi](https://docs.arcade.dev/en/resources/integrations/development/arcade-engine-api.md): The ArcadeEngineApi documentation provides users with a comprehensive guide to the tools available for interacting with the Arcade Engine API, focusing on managing authentication providers, secrets, and worker configurations. It outlines various actions users and LLMs can perform, such as retrieving - [Asana](https://docs.arcade.dev/en/resources/integrations/productivity/asana.md): This documentation page provides users with a comprehensive guide to the Arcade Asana MCP Server, enabling them to build agents and AI applications that interact with Asana tasks, projects, and workspaces. Users can learn how to manage teams, create and update tasks - [Asana Reference](https://docs.arcade.dev/en/resources/integrations/productivity/asana/reference.md): The Asana Reference documentation provides a comprehensive list of enumerations related to tag colors, task sorting options, and sort orders used in the Asana MCP Server. Users can utilize this reference to understand and implement the various color codes and sorting parameters effectively in @@ -82,7 +82,7 @@ Arcade delivers three core capabilities: Deploy agents even your security team w - [BoxApi](https://docs.arcade.dev/en/resources/integrations/productivity/box-api.md): The BoxApi documentation provides users with tools to manage and automate various aspects of Box content, including file management, metadata handling, collaboration, document generation, and enterprise operations. It outlines capabilities for interacting with Box's API, enabling users to build applications or - [Brightdata](https://docs.arcade.dev/en/resources/integrations/development/brightdata.md): The Brightdata documentation page provides users with tools and guidance for scraping, searching, and extracting structured data from various websites at scale without being blocked. It outlines specific functionalities such as scraping web pages in Markdown format, performing advanced searches across major search engines, - [Build a Tool](https://docs.arcade.dev/en/guides/create-tools/tool-basics.md): This documentation page provides a comprehensive guide on building custom tools using Arcade's MCP Server framework, enabling users to enhance AI agents with new functionalities. It serves as a starting point for those looking to create their first tool or expand existing capabilities. Users will learn -- [Build an AI Chatbot with Arcade and Vercel AI SDK](https://docs.arcade.dev/en/guides/agent-frameworks/vercelai.md): This documentation page provides a step-by-step guide for building a browser-based AI chatbot using the Vercel AI SDK and Arcade tools, enabling users to interact with Gmail and Slack through a conversational interface. Users will learn how to set up a Next.js +- [Build an AI Chatbot with Arcade and Vercel AI SDK](https://docs.arcade.dev/en/get-started/agent-frameworks/vercelai.md): This documentation page guides users in building a browser-based AI chatbot using the Vercel AI SDK and Arcade tools for Gmail and Slack integration. It provides step-by-step instructions on setting up a Next.js project, configuring environment variables, and implementing key features - [Build MCP Server QuickStart](https://docs.arcade.dev/en/get-started/quickstarts/mcp-server-quickstart.md): The "Build MCP Server QuickStart" documentation provides a step-by-step guide for users to create and run a custom MCP Server using the Arcade MCP framework. It covers prerequisites, installation instructions, server setup, and how to connect and authorize tools, enabling - [CalendlyApi](https://docs.arcade.dev/en/resources/integrations/productivity/calendly-api.md): The CalendlyApi documentation provides tools and resources for developers to integrate and manage scheduling and event-related tasks within the Calendly platform using OAuth2 authentication. Users can learn how to create, retrieve, and update event types, manage invitees, and handle - [Call a tool in your IDE/MCP Client](https://docs.arcade.dev/en/get-started/quickstarts/call-tool-client.md): This documentation page guides users on how to create and utilize an MCP Gateway in their IDE or MCP Client to streamline the process of calling tools from multiple MCP servers. It covers the steps to set up the gateway, select relevant tools, and connect it to @@ -99,9 +99,9 @@ Arcade delivers three core capabilities: Deploy agents even your security team w - [Comparative evaluations](https://docs.arcade.dev/en/guides/create-tools/evaluate-tools/comparative-evaluations.md): The "Comparative Evaluations" documentation page guides users in testing and comparing the performance of AI models across different tool implementations using isolated tool registries, known as tracks. It outlines how to set up comparative evaluations, register tools, create test cases, - [Compare MCP Server Types](https://docs.arcade.dev/en/guides/create-tools/tool-basics/compare-server-types.md): This documentation page provides a comparative overview of different MCP server types offered by Arcade, detailing their functionalities based on transport method and deployment options. Users can learn about the capabilities of each server type, including the availability of tools with or without authentication and secrets. - [Confluence](https://docs.arcade.dev/en/resources/integrations/productivity/confluence.md): This documentation page provides a comprehensive overview of the Arcade Confluence MCP Server, which enables users to build agents and AI applications that interact with Confluence. It details various tools available for managing pages, spaces, and attachments, as well as searching for content -- [Connect to MCP Clients](https://docs.arcade.dev/en/guides/tool-calling/mcp-clients.md): This documentation page provides guidance on connecting Arcade MCP servers to various MCP-compatible clients and development environments, enabling users to enhance their agent workflows. +- [Connect to MCP Clients](https://docs.arcade.dev/en/get-started/mcp-clients.md): This documentation page provides guidance on connecting MCP servers to various MCP-compatible clients and development environments, enabling users to enhance their agent workflows. - [Contact Us](https://docs.arcade.dev/en/resources/contact-us.md): This documentation page provides users with information on how to connect with the Arcade team for support through various channels. It aims to facilitate communication and assistance for users and their agents. -- [Create a new Mastra project](https://docs.arcade.dev/en/guides/agent-frameworks/mastra/use-arcade-tools.md): This documentation page provides a step-by-step guide for integrating Arcade tools into a new Mastra project, enabling users to leverage these tools within their Mastra applications. It covers prerequisites, project setup, installation of the Arcade client, API key configuration, and +- [Create a new Mastra project](https://docs.arcade.dev/en/get-started/agent-frameworks/mastra/use-arcade-tools.md): This documentation page provides a step-by-step guide for integrating Arcade tools into a new Mastra project, enabling users to leverage these tools within their Mastra applications. It covers prerequisites, project setup, API key configuration, and interaction methods with the Mastra - [Create an evaluation suite](https://docs.arcade.dev/en/guides/create-tools/evaluate-tools/create-evaluation-suite.md): This documentation page provides a comprehensive guide on creating an evaluation suite to test AI models' tool usage through Arcade. Users will learn how to set up prerequisites, define evaluation files and suites, run evaluations, and interpret results, ensuring accurate tool selection and parameter - [Create an MCP tool with secrets](https://docs.arcade.dev/en/guides/create-tools/tool-basics/create-tool-secrets.md): This documentation page guides users on how to create custom MCP tools that securely handle sensitive information, or "secrets," using the Arcade platform. It covers the process of reading secrets from various sources, such as environment variables and the Arcade Dashboard, and provides - [Creating an MCP Server with Arcade](https://docs.arcade.dev/en/guides/create-tools/tool-basics/build-mcp-server.md): This documentation page provides a comprehensive guide for users to create, test, deploy, and publish a custom MCP Server using the Arcade framework. It details the installation of necessary tools, the scaffolding of a server project, and the setup of environment configurations, @@ -119,7 +119,7 @@ Arcade delivers three core capabilities: Deploy agents even your security team w - [Environment Variables](https://docs.arcade.dev/en/resources/integrations/social-communication/slack/environment-variables.md): This documentation page provides guidance on configuring environment variables related to Slack API interactions, specifically `SLACK_MAX_CONCURRENT_REQUESTS`, `MAX_PAGINATION_SIZE_LIMIT`, and `MAX_PAGINATION_TIMEOUT_SECONDS`. Users will learn how to adjust these settings - [Evaluate Tools](https://docs.arcade.dev/en/guides/create-tools/evaluate-tools.md): The "Evaluate Tools" documentation page provides guidance on systematically testing and enhancing tools using Arcade's evaluation framework. It helps users validate the performance of their tools after initial development and offers techniques for iterative improvements to ensure reliability in production. - [ExaApi](https://docs.arcade.dev/en/resources/integrations/search/exa-api.md): The ExaApi documentation provides users with a comprehensive guide to utilizing the Exa.ai Search API, enabling them to conduct searches, manage websets, and handle research requests effectively. It outlines various tools available within the API, detailing their functionalities such as -- [Fetch the "ScrapeUrl" tool from the "Firecrawl" MCP Server](https://docs.arcade.dev/en/guides/agent-frameworks/langchain/use-arcade-tools.md): This documentation page provides a comprehensive guide for integrating Arcade tools into LangGraph applications, detailing prerequisites, environment setup, API key configuration, and tool management. Users will learn how to create and manage AI models, configure agents, and stream responses while utilizing code +- [Fetch the "ScrapeUrl" tool from the "Firecrawl" MCP Server](https://docs.arcade.dev/en/get-started/agent-frameworks/langchain/use-arcade-tools.md): This documentation page provides a comprehensive guide on integrating Arcade tools into LangGraph applications, enabling users to enhance their AI projects with specific functionalities. It includes step-by-step instructions for setting up the environment, configuring API keys, managing tools, and creating agents, - [Figma](https://docs.arcade.dev/en/resources/integrations/development/figma.md): This documentation page provides users with a comprehensive guide to the Figma MCP Server, enabling interaction with Figma's design files, components, and collaboration features through the Figma REST API. Users can learn to access file structures, manage components, add comments - [FigmaApi](https://docs.arcade.dev/en/resources/integrations/productivity/figma-api.md): The FigmaApi documentation provides a comprehensive guide for developers to utilize tools that enable interaction with the Figma API, facilitating efficient management of design assets and collaboration on projects. Users can learn how to perform various actions such as retrieving Figma files, managing - [Firecrawl](https://docs.arcade.dev/en/resources/integrations/development/firecrawl.md): The Firecrawl documentation provides users with a comprehensive guide to utilizing the Arcade Firecrawl MCP Server, enabling them to build agents and AI applications for scraping, crawling, and mapping websites. It outlines available tools, including functionalities for scraping URLs, crawling websites, @@ -164,9 +164,9 @@ Arcade delivers three core capabilities: Deploy agents even your security team w - [HubspotUsersApi](https://docs.arcade.dev/en/resources/integrations/sales/hubspot-users-api.md): The HubspotUsersApi documentation provides users with tools to efficiently manage users and teams within a HubSpot account, including functionalities for retrieving user lists, creating and updating user accounts, and removing users. It offers detailed descriptions of available API tools, along with - [Imgflip](https://docs.arcade.dev/en/resources/integrations/entertainment/imgflip.md): The Imgflip documentation provides users with tools to create and manage memes using the Imgflip API, enabling the development of agents and AI applications. Users can search for meme templates, retrieve popular memes, and create custom memes by adding text to existing templates. - [Imgflip](https://docs.arcade.dev/en/resources/integrations/entertainment/spotify/imgflip.md): The Imgflip documentation page provides users with tools to create and manage memes using the Imgflip API, allowing them to search for meme templates, retrieve popular templates, and create custom memes. It outlines the available features, including a premium search option and customizable -- [Import necessary classes and modules](https://docs.arcade.dev/en/guides/agent-frameworks/langchain/user-auth-interrupts.md): This documentation page guides users in creating a LangGraph workflow that integrates user authorization for specific Arcade tools, ensuring that only authorized tools are accessible to the language model. It provides step-by-step instructions on setting up the necessary environment, installing required packages, and +- [Import necessary classes and modules](https://docs.arcade.dev/en/get-started/agent-frameworks/langchain/user-auth-interrupts.md): This documentation page guides users in creating a LangGraph workflow that incorporates user authorization for accessing specific Arcade tools. It outlines the necessary prerequisites, installation steps, and code configurations needed to implement tool authorization, ensuring that only authorized tools are available for use with the - [In Custom Applications](https://docs.arcade.dev/en/guides/tool-calling/custom-apps.md): This documentation page provides guidance on integrating Arcade tools into custom applications, focusing on user authentication, authorization status checking, and managing tool definitions. It serves as a resource for developers building tool-calling interfaces to ensure proper implementation and functionality. -- [Initialize the Arcade client](https://docs.arcade.dev/en/guides/agent-frameworks/google-adk/use-arcade-tools.md): This documentation page provides a comprehensive guide for integrating Arcade tools into Google ADK applications, outlining the necessary prerequisites, setup procedures, and configuration steps. Users will learn how to manage and authorize Arcade tools, create agents, and run them effectively within their applications +- [Initialize the Arcade client](https://docs.arcade.dev/en/get-started/agent-frameworks/google-adk/use-arcade-tools.md): This documentation page provides a step-by-step guide for integrating Arcade tools into Google ADK applications, including prerequisites, environment setup, API key configuration, and agent management. Users will learn how to authorize tools, run agents with user context, and explore various - [IntercomApi](https://docs.arcade.dev/en/resources/integrations/customer-support/intercom-api.md): The IntercomApi documentation provides a comprehensive guide to tools that enable users to interact with the Intercom platform using OAuth2 authentication. It details various functionalities, such as managing admin information, creating and updating articles, and handling company data, allowing users to - [Jira](https://docs.arcade.dev/en/resources/integrations/productivity/jira.md): This documentation page provides a comprehensive overview of the Jira MCP Server, which enables users and AI applications to efficiently manage Jira issues and projects. It outlines various functionalities such as creating, updating, and searching for issues, managing labels and attachments, and transitioning issues - [Jira Environment Variables](https://docs.arcade.dev/en/resources/integrations/productivity/jira/environment-variables.md): This documentation page provides essential information on configuring Jira environment variables to optimize API interactions, specifically focusing on controlling the maximum concurrent requests, API request timeout, and cache size for improved performance during tool execution. Users will learn how to set numeric string values for these @@ -185,23 +185,23 @@ Arcade delivers three core capabilities: Deploy agents even your security team w - [Notion](https://docs.arcade.dev/en/resources/integrations/productivity/notion.md): This documentation page provides users with a comprehensive guide to the Arcade Notion MCP Server, which enables the creation and management of agents and AI applications that interact with Notion. Users can learn how to utilize various tools to retrieve page content, create new pages - [Obsidian](https://docs.arcade.dev/en/resources/integrations/productivity/obsidian.md): This documentation page provides an overview of the Arcade Obsidian Toolkit, a community-contributed MCP Sever verified by the Arcade team. It guides users to learn more about the toolkit by directing them to the associated GitHub repository. - [On-premise MCP Servers](https://docs.arcade.dev/en/guides/deployment-hosting/on-prem.md): This documentation page provides guidance on deploying on-premises MCP servers within a hybrid architecture, enabling users to utilize Arcade's cloud infrastructure while maintaining control over their private resources and data security. Users will learn how to set up their MCP servers, create secure tunnels -- [Or set it directly when initializing the client](https://docs.arcade.dev/en/guides/agent-frameworks/openai-agents/use-arcade-tools.md): This documentation page provides a comprehensive guide on integrating Arcade tools into OpenAI Agents applications, detailing the necessary prerequisites, environment setup, and configuration steps. Users will learn how to create and manage Arcade tools, set up agents, handle authentication, and run their +- [Or set it directly when initializing the client](https://docs.arcade.dev/en/get-started/agent-frameworks/openai-agents/use-arcade-tools.md): This documentation page provides a comprehensive guide on integrating Arcade tools into OpenAI Agents applications, detailing the setup process, environment configuration, and agent management. Users will learn how to obtain an Arcade API key, configure their environment, create and manage tools, and - [Organize your MCP server and tools](https://docs.arcade.dev/en/guides/create-tools/tool-basics/organize-mcp-tools.md): This documentation page provides best practices for organizing your MCP server and tools, including how to define and import tools from separate files and other packages. Users will learn to maintain a clean project structure by keeping tools in a dedicated directory and using decorators effectively. Additionally - [Outlook Calendar](https://docs.arcade.dev/en/resources/integrations/productivity/outlook-calendar.md): The Outlook Calendar documentation page provides users with tools to create, list, and retrieve events in their Outlook Calendar using the Outlook API. It includes detailed descriptions of available tools, such as creating events and fetching event details, along with example code snippets for implementation - [Outlook Mail](https://docs.arcade.dev/en/resources/integrations/productivity/outlook-mail.md): The Outlook Mail documentation page provides users with tools to interact with the Outlook API, enabling them to read, write, and send emails efficiently. It details various functionalities, such as creating drafts, sending emails, and listing messages, along with code examples for - [OutlookMail Reference](https://docs.arcade.dev/en/resources/integrations/productivity/outlook-mail/reference.md): The OutlookMail Reference documentation provides a comprehensive list of enumerations, folder names, email filter properties, and filter operators used in the OutlookMail MCP Server. It helps users understand and utilize these elements effectively when working with OutlookMail tools. This reference is - [page](https://docs.arcade.dev/en/resources/examples.md): This documentation page showcases a collection of example applications that utilize Arcade's tools and MCP servers, providing users with practical implementations and templates for various workflows and agent functionalities. Users can explore detailed descriptions and links to GitHub repositories for each app, enabling them to - [page](https://docs.arcade.dev/en/resources/integrations.md): This documentation page provides a comprehensive registry of all MCP Servers within the Arcade ecosystem, helping users to easily identify and access the available servers. -- [page](https://docs.arcade.dev/en/guides/agent-frameworks/crewai/use-arcade-tools.md): This documentation page provides a comprehensive guide for integrating Arcade tools into CrewAI applications, detailing the necessary prerequisites, environment setup, and configuration steps. Users will learn how to authorize and utilize these tools within their CrewAI agent teams, ensuring tailored functionality for their -- [page](https://docs.arcade.dev/en/guides/agent-frameworks/langchain/auth-langchain-tools.md): This documentation page provides a step-by-step guide on how to authorize existing LangChain tools, such as the `GmailToolkit`, using the Arcade platform. It outlines the necessary prerequisites, installation of required packages, and detailed instructions for the authorization process in -- [page](https://docs.arcade.dev/en/guides/agent-frameworks/mastra/overview.md): This documentation page guides users on integrating Arcade's tool ecosystem with Mastra applications, enabling enhanced functionality for AI agents. It outlines how to access various pre-built tools, simplifies tool management, and details the processes for tool discovery, schema conversion, and execution -- [page](https://docs.arcade.dev/en/guides/agent-frameworks/mastra/user-auth-interrupts.md): This documentation page provides guidance on managing user-specific authorization for Arcade tools within Mastra applications, focusing on dynamic tool loading and per-user authentication flows. It outlines the steps to set up agents and API endpoints, ensuring each user has a secure and tailored experience +- [page](https://docs.arcade.dev/en/get-started/agent-frameworks/crewai/use-arcade-tools.md): This documentation page provides a comprehensive guide for integrating Arcade tools into CrewAI applications, detailing the necessary prerequisites, setup, and configuration steps. Users will learn how to authorize tools, manage API keys, and create a Crew that utilizes these tools effectively. Additionally +- [page](https://docs.arcade.dev/en/get-started/agent-frameworks/langchain/auth-langchain-tools.md): This documentation page provides a step-by-step guide for users to authorize existing LangChain tools, such as the `GmailToolkit`, using the Arcade platform. It outlines the prerequisites, necessary installations, and detailed instructions for the authorization process in both Python and +- [page](https://docs.arcade.dev/en/get-started/agent-frameworks/mastra/overview.md): This documentation page guides users on integrating Arcade's tool ecosystem with Mastra applications, enabling enhanced functionality for AI agents. It outlines how to access a variety of pre-built tools, manage tool complexities, and build sophisticated agents by leveraging Arcade's capabilities. Users +- [page](https://docs.arcade.dev/en/get-started/agent-frameworks/mastra/user-auth-interrupts.md): This documentation page provides guidance on managing user-specific authorization for Arcade tools within Mastra applications, enabling dynamic tool loading and user authentication flows in web environments. It outlines the steps for setting up configurations, creating API endpoints, and handling tool authorization to ensure a - [page](https://docs.arcade.dev/en/resources/integrations/productivity/dropbox/reference.md): This documentation page defines the various item categories used in Dropbox, including types such as image, document, PDF, spreadsheet, presentation, audio, video, folder, and paper. It helps users understand the classification of files within the Dropbox system. - [PagerDuty](https://docs.arcade.dev/en/resources/integrations/customer-support/pagerduty.md): This documentation page provides guidance on using the PagerDuty MCP Server, which enables agents to access and manage incidents, on-call information, services, and teams through read-only API tools. It includes details on OAuth configuration, available tools with descriptions, and code - [PagerdutyApi](https://docs.arcade.dev/en/resources/integrations/development/pagerduty-api.md): The PagerDutyApi documentation provides a comprehensive overview of tools that enable users to manage incidents, services, and integrations within the PagerDuty platform using the API. It outlines various functionalities, such as assigning tags, retrieving metrics, and managing add-ons, allowing - [Postgres](https://docs.arcade.dev/en/resources/integrations/databases/postgres.md): This documentation page provides users with a comprehensive guide to the Arcade Postgres MCP Server, which enables agents to interact with PostgreSQL databases in a read-only manner. Users can learn how to discover database schemas, explore table structures, and execute safe SELECT queries - [PosthogApi](https://docs.arcade.dev/en/resources/integrations/development/posthog-api.md): The PosthogApi documentation provides users with tools and guidance for managing and analyzing data within the PostHog platform via its API. It details the necessary configuration, including authentication secrets, and outlines various available tools for retrieving metrics, managing exports, and handling -- [Provide the tool manager callback to the ArcadeToolManager](https://docs.arcade.dev/en/guides/agent-frameworks/crewai/custom-auth-flow.md): This documentation page provides a step-by-step guide on creating a custom authorization flow for executing Arcade tools within a CrewAI agent team. It outlines the prerequisites, environment setup, and configuration needed to implement a tailored approach to tool authorization, allowing for unique interfaces +- [Provide the tool manager callback to the ArcadeToolManager](https://docs.arcade.dev/en/get-started/agent-frameworks/crewai/custom-auth-flow.md): This documentation page guides users on how to implement a custom authorization flow for the ArcadeToolManager within their CrewAI agent teams. It provides step-by-step instructions for setting up the environment, configuring API keys, defining the custom auth flow, and integrating Arcade - [Providing useful tool errors](https://docs.arcade.dev/en/guides/create-tools/error-handling/useful-tool-errors.md): This documentation page teaches developers how to effectively handle errors when building tools with Arcade MCP, emphasizing the automatic error adaptation feature that reduces boilerplate code. It outlines the error handling philosophy, explains the use of error adapters, and provides guidance on when to raise - [Pylon](https://docs.arcade.dev/en/resources/integrations/customer-support/pylon.md): The Pylon documentation provides agents with the necessary tools and API functionalities to manage issues, contacts, users, and teams within the Pylon MCP Server. Users can learn how to list and search issues, assign ownership, and interact with user and team data - [Reddit](https://docs.arcade.dev/en/resources/integrations/social-communication/reddit.md): This documentation page provides users with a comprehensive guide to the Arcade Reddit MCP Server, which enables the development of agents and AI applications that can interact with Reddit. It details various tools available for actions such as submitting posts, commenting, retrieving content, and checking @@ -216,8 +216,8 @@ Arcade delivers three core capabilities: Deploy agents even your security team w - [Security](https://docs.arcade.dev/en/guides/security.md): This documentation page provides users with best practices for ensuring the security of MCP servers and Arcade tools, particularly when handling sensitive data or operating in production environments. It also highlights the importance of security in tool development and outlines the resources available for implementing robust security measures - [Security Research Program](https://docs.arcade.dev/en/guides/security/security-research-program.md): The Security Research Program documentation page outlines how users can report security vulnerabilities in Arcade's tools and services, emphasizing the importance of community involvement in enhancing security. It details the types of vulnerabilities sought, the reporting process, and guidelines for responsible disclosure. Additionally, - [Server-Level vs Tool-Level Authorization](https://docs.arcade.dev/en/learn/server-level-vs-tool-level-auth.md): This documentation page explains the differences between server-level authorization (Resource Server auth) and tool-level authorization in Arcade MCP servers, highlighting their roles in securing access to the server and third-party APIs. It provides guidance on when to implement each type of authorization, -- [Set your API key](https://docs.arcade.dev/en/guides/agent-frameworks/openai-agents/user-auth-interrupts.md): This documentation page provides guidance on managing user authorization for Arcade tools within OpenAI Agents applications. It covers obtaining an API key, configuring the environment, handling authorization errors, and ensuring persistence of user authorization. Users will learn how to effectively implement and manage the -- [Setup Arcade with LangChain](https://docs.arcade.dev/en/guides/agent-frameworks/langchain/use-arcade-with-langchain.md): This documentation page provides a comprehensive guide on integrating Arcade tools within LangChain agents, enabling users to build and manage AI agents effectively. It covers the necessary prerequisites, key concepts like agents and interrupts, and detailed steps for setting up a project, importing required +- [Set your API key](https://docs.arcade.dev/en/get-started/agent-frameworks/openai-agents/user-auth-interrupts.md): This documentation page provides a comprehensive guide on managing user authorization for Arcade tools within OpenAI Agents applications. Users will learn how to set up their environment with an Arcade API key, handle authorization errors, and implement a complete authorization flow, ensuring smooth integration of +- [Setup Arcade with LangChain](https://docs.arcade.dev/en/get-started/agent-frameworks/langchain/use-arcade-with-langchain.md): This documentation page guides users on how to integrate Arcade tools into LangChain agents, enabling them to build AI agents with enhanced capabilities. It covers the prerequisites, key concepts, and step-by-step instructions for setting up a project, importing necessary packages, and - [Sharepoint](https://docs.arcade.dev/en/resources/integrations/productivity/sharepoint.md): This documentation page provides a comprehensive guide for using the SharePoint MCP Server, enabling users to efficiently interact with SharePoint sites and their contents through various tools. Users can learn to retrieve lists, items, pages, and metadata, as well as search for - [Slack](https://docs.arcade.dev/en/resources/integrations/social-communication/slack.md): This documentation page provides users with tools and functionalities to integrate and interact with the Slack platform, enabling efficient management of conversations and user information. It outlines various capabilities, such as retrieving user details, sending messages, and accessing conversation metadata, all aimed at enhancing - [SlackApi](https://docs.arcade.dev/en/resources/integrations/social-communication/slack_api.md): The SlackApi documentation provides a comprehensive guide for administrators and applications to manage and automate various aspects of Slack workspaces, including user management, messaging, channel operations, and file sharing. It outlines key functionalities such as creating teams, managing user profiles, sending @@ -236,9 +236,9 @@ Arcade delivers three core capabilities: Deploy agents even your security team w - [Twitch auth provider](https://docs.arcade.dev/en/resources/integrations/entertainment/twitch.md): The Twitch auth provider documentation page guides users in creating a custom authentication provider to access the Twitch API using their own OAuth 2.0 credentials. It outlines the steps to configure Twitch authentication within the Arcade platform, including creating a Twitch application and integrating it - [Types of Tools](https://docs.arcade.dev/en/guides/create-tools/improve/types-of-tools.md): This documentation page explains the two types of tools offered by Arcade: Optimized tools and Starter tools. It highlights the differences in design and functionality, emphasizing that Optimized tools are tailored for AI-powered chat interfaces to improve performance, while Starter tools provide more - [Understanding `Context` and tools](https://docs.arcade.dev/en/guides/create-tools/tool-basics/runtime-data-access.md): This documentation page explains the `Context` class used in Arcade tools, detailing how to access runtime capabilities and tool-specific data securely. Users will learn how to utilize the `Context` object to retrieve OAuth tokens, secrets, user information, and to log -- [Use Arcade in Cursor](https://docs.arcade.dev/en/guides/tool-calling/mcp-clients/cursor.md): This documentation page provides a step-by-step guide for users to connect Cursor to an Arcade MCP Gateway, enabling the use of Arcade tools within Cursor. It outlines the prerequisites needed for setup, including creating an Arcade account and obtaining an API key, as well -- [Use Arcade in Visual Studio Code](https://docs.arcade.dev/en/guides/tool-calling/mcp-clients/visual-studio-code.md): This documentation page provides a step-by-step guide for connecting Visual Studio Code to an Arcade MCP Gateway, enabling users to integrate and utilize Arcade tools within the IDE. It outlines the prerequisites for setup, including creating an Arcade account and obtaining an API key, -- [Use Arcade with Claude Desktop](https://docs.arcade.dev/en/guides/tool-calling/mcp-clients/claude-desktop.md): This documentation page is intended to guide users on how to utilize Arcade with Claude Desktop. However, it currently indicates that the content is forthcoming and does not provide any detailed instructions or information at this time. +- [Use Arcade in Claude Desktop](https://docs.arcade.dev/en/get-started/mcp-clients/claude-desktop.md): This documentation page provides a step-by-step guide for users to connect Claude Desktop to an Arcade MCP Gateway, enabling them to utilize Arcade tools effectively. It outlines the prerequisites for setup, including account creation and API key acquisition, and details the necessary configuration steps +- [Use Arcade in Cursor](https://docs.arcade.dev/en/get-started/mcp-clients/cursor.md): This documentation page guides users on how to connect Cursor to an Arcade MCP Gateway, detailing the prerequisites needed, such as creating an Arcade account and obtaining an API key. It provides step-by-step instructions for setting up Cursor and configuring the MCP settings, ensuring +- [Use Arcade in Visual Studio Code](https://docs.arcade.dev/en/get-started/mcp-clients/visual-studio-code.md): This documentation page provides a step-by-step guide for connecting Visual Studio Code to an Arcade MCP Gateway, enabling users to set up and start their MCP server within the IDE. It outlines the prerequisites, setup process, and authentication steps required to successfully integrate Arcade - [VercelApi](https://docs.arcade.dev/en/resources/integrations/development/vercel-api.md): The VercelApi documentation provides a comprehensive guide for users to manage their Vercel projects, domains, and integrations through various API tools. It outlines available functionalities such as creating and managing access groups, handling deployments, and managing DNS records, enabling - [Walmart Search](https://docs.arcade.dev/en/resources/integrations/search/walmart.md): The Walmart Search documentation provides tools for developers to integrate product search and details retrieval from Walmart into their applications. It outlines how to use the `Walmart.SearchProducts` and `Walmart.GetProductDetails` tools, including parameters for customizing searches and retrieving - [WeaviateApi](https://docs.arcade.dev/en/resources/integrations/databases/weaviate-api.md): The WeaviateApi documentation provides users with essential tools and instructions for managing and interacting with the Weaviate vector search engine via its API. It covers authentication requirements, including obtaining API keys, and offers a comprehensive list of available API endpoints for various diff --git a/scripts/check-redirects.sh b/scripts/check-redirects.sh new file mode 100755 index 000000000..4d648a37c --- /dev/null +++ b/scripts/check-redirects.sh @@ -0,0 +1,372 @@ +#!/bin/bash +# +# Check that deleted markdown files have corresponding redirects in next.config.ts +# Usage: ./scripts/check-redirects.sh [base_branch] +# +# This script compares the current branch to main (or specified base branch) +# and ensures any deleted .md/.mdx files have redirect entries. +# +# Features: +# - Detects deleted markdown files without redirects +# - Interactive mode: prompts for redirect destinations when run in a terminal +# - Validates existing redirects for circular references and invalid destinations +# + +set -e + +BASE_BRANCH="${1:-main}" +CONFIG_FILE="next.config.ts" +EXIT_CODE=0 + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Check if running interactively +IS_INTERACTIVE=false +if [ -t 0 ] && [ -t 1 ]; then + IS_INTERACTIVE=true +fi + +echo "Checking for deleted markdown files without redirects..." +echo "Comparing current branch to: $BASE_BRANCH" +echo "" + +# Ensure we have the base branch available for comparison +if ! git rev-parse --verify "$BASE_BRANCH" >/dev/null 2>&1; then + echo "Fetching $BASE_BRANCH branch..." + if ! git fetch origin "$BASE_BRANCH:$BASE_BRANCH" 2>/dev/null; then + echo -e "${RED}ERROR: Could not fetch base branch '$BASE_BRANCH'${NC}" + echo "Please ensure you have network access and the branch exists." + exit 1 + fi +fi + +# Verify base branch is now available +if ! git rev-parse --verify "$BASE_BRANCH" >/dev/null 2>&1; then + echo -e "${RED}ERROR: Base branch '$BASE_BRANCH' is not available${NC}" + echo "Cannot compare branches. Please check your git configuration." + exit 1 +fi + +# Get list of deleted/renamed page files (comparing to base branch) +# Include both committed changes and uncommitted working tree changes +# D = deleted, R = renamed (old path needs redirect too) +# Only match page.md or page.mdx files (actual routable pages in Next.js App Router) +# For renames (R100old-pathnew-path), we need to check the OLD path (field 2), +# not the new path. Extract field 2 first, then filter for page files. +COMMITTED_DELETES=$(git diff --name-status "$BASE_BRANCH"...HEAD 2>/dev/null | grep -E "^D|^R" | cut -f2 | grep -E 'page\.(md|mdx)$' || true) +UNCOMMITTED_DELETES=$(git diff --name-status HEAD 2>/dev/null | grep -E "^D|^R" | cut -f2 | grep -E 'page\.(md|mdx)$' || true) + +# Combine and deduplicate +DELETED_FILES=$(echo -e "${COMMITTED_DELETES}\n${UNCOMMITTED_DELETES}" | sort -u | grep -v '^$' || true) + +# Function to convert file path to URL path +# e.g., app/en/guides/foo/page.mdx -> /:locale/guides/foo +# e.g., app/en/page.mdx -> /:locale (root page) +file_to_url() { + local file_path="$1" + # Remove app/en/ prefix and page.mdx or page.md suffix (with or without leading /) + # Using separate sed commands for portability (BSD vs GNU sed) + local url_path=$(echo "$file_path" | sed -E 's|^app/[a-z]{2}/||' | sed -E 's|/?page\.mdx$||' | sed -E 's|/?page\.md$||') + # Handle root page case (empty url_path after stripping) + if [ -z "$url_path" ]; then + echo "/:locale" + else + echo "/:locale/$url_path" + fi +} + +# Function to convert URL path to file path for validation +# e.g., /:locale/guides/foo -> app/en/guides/foo/page.mdx +url_to_file() { + local url_path="$1" + # Remove /:locale/ prefix and add app/en/ prefix + local file_path=$(echo "$url_path" | sed 's|^/:locale/||') + echo "app/en/$file_path/page.mdx" +} + +# Function to check if a page exists (considering both new and existing files) +page_exists() { + local url_path="$1" + local file_path=$(url_to_file "$url_path") + + # Check if file exists on disk + if [ -f "$file_path" ]; then + return 0 + fi + + # Also check for .md extension + local md_path=$(echo "$file_path" | sed 's|\.mdx$|.md|') + if [ -f "$md_path" ]; then + return 0 + fi + + # Check if it's a wildcard destination (valid by definition) + if [[ "$url_path" == *":path*"* ]]; then + return 0 + fi + + return 1 +} + +# Read the config file content +CONFIG_CONTENT=$(cat "$CONFIG_FILE" 2>/dev/null || echo "") + +# ============================================================ +# PART 1: Validate existing redirects in the config +# ============================================================ +echo -e "${BLUE}Validating existing redirects in $CONFIG_FILE...${NC}" +echo "" + +declare -a INVALID_REDIRECTS=() + +# Extract redirect pairs using a more robust method +# Join lines and extract source/destination pairs +REDIRECT_PAIRS=$(cat "$CONFIG_FILE" | tr '\n' ' ' | grep -oE '\{[^}]*source:[^}]*destination:[^}]*\}' || true) + +while IFS= read -r redirect_block; do + [ -z "$redirect_block" ] && continue + + # Extract source and destination from the block + source_path=$(echo "$redirect_block" | sed -n 's/.*source:[[:space:]]*"\([^"]*\)".*/\1/p') + dest_path=$(echo "$redirect_block" | sed -n 's/.*destination:[[:space:]]*"\([^"]*\)".*/\1/p') + + [ -z "$source_path" ] && continue + [ -z "$dest_path" ] && continue + + # Check for placeholder text + if [[ "$dest_path" == *"REPLACE_WITH"* ]] || [[ "$dest_path" == *"TODO"* ]] || [[ "$dest_path" == *"FIXME"* ]]; then + echo -e "${RED}✗ Invalid redirect: $source_path${NC}" + echo -e " ${YELLOW}Destination contains placeholder text: $dest_path${NC}" + INVALID_REDIRECTS+=("$source_path -> $dest_path (placeholder text)") + EXIT_CODE=1 + # Check for circular redirect + elif [ "$source_path" = "$dest_path" ]; then + echo -e "${RED}✗ Circular redirect: $source_path${NC}" + echo -e " ${YELLOW}Source and destination are the same!${NC}" + INVALID_REDIRECTS+=("$source_path -> $dest_path (circular)") + EXIT_CODE=1 + # Check if destination exists (skip wildcards and other dynamic segments) + # Skip paths with :path* or :path wildcards + # Skip paths with dynamic segments OTHER than :locale (check after stripping /:locale/) + elif [[ "$dest_path" != *":path*"* ]] && [[ "$dest_path" != *":path"* ]]; then + # Strip the /:locale/ prefix and check for remaining dynamic segments + dest_without_locale=$(echo "$dest_path" | sed 's|^/:locale/||') + if [[ "$dest_without_locale" != *":"* ]]; then + if ! page_exists "$dest_path"; then + echo -e "${RED}✗ Invalid redirect: $source_path${NC}" + echo -e " ${YELLOW}Destination does not exist: $dest_path${NC}" + INVALID_REDIRECTS+=("$source_path -> $dest_path (destination not found)") + EXIT_CODE=1 + fi + fi + fi +done <<< "$REDIRECT_PAIRS" + +if [ ${#INVALID_REDIRECTS[@]} -eq 0 ]; then + echo -e "${GREEN}✓ All existing redirects are valid.${NC}" +fi +echo "" + +# ============================================================ +# PART 2: Check for deleted files without redirects +# ============================================================ + +if [ -z "$DELETED_FILES" ]; then + echo -e "${GREEN}✓ No deleted markdown files found.${NC}" + exit $EXIT_CODE +fi + +echo "Found deleted markdown files:" +echo "$DELETED_FILES" +echo "" + +# Check if next.config.ts was modified (committed or uncommitted) +CONFIG_MODIFIED_COMMITTED=$(git diff --name-only "$BASE_BRANCH"...HEAD 2>/dev/null | grep -c "$CONFIG_FILE" || true) +CONFIG_MODIFIED_UNCOMMITTED=$(git diff --name-only HEAD 2>/dev/null | grep -c "$CONFIG_FILE" || true) +CONFIG_MODIFIED=$((${CONFIG_MODIFIED_COMMITTED:-0} + ${CONFIG_MODIFIED_UNCOMMITTED:-0})) + +# Arrays to track missing redirects +declare -a MISSING_REDIRECTS=() +declare -a SUGGESTED_ENTRIES=() + +# Function to check if a wildcard redirect covers this path +check_wildcard_match() { + local path="$1" + # Extract path segments (remove /:locale/ prefix for matching) + local path_without_locale=$(echo "$path" | sed 's|^/:locale/||') + + # Look for wildcard patterns that could match + # Pattern: source: "/:locale/some/path/:path*" + while IFS= read -r line; do + # Extract the source pattern + local source_pattern=$(echo "$line" | sed -n 's/.*source:.*"\(.*\)".*/\1/p') + [ -z "$source_pattern" ] && continue + + # Check if it's a wildcard pattern + if [[ "$source_pattern" == *":path*"* ]]; then + # Convert wildcard to prefix (remove :path* and everything after) + local prefix=$(echo "$source_pattern" | sed 's|/:path\*.*||' | sed 's|^/:locale/||') + + # Check if our path starts with this prefix + if [[ "$path_without_locale" == "$prefix"/* ]] || [[ "$path_without_locale" == "$prefix" ]]; then + return 0 # Match found + fi + fi + done <<< "$(echo "$CONFIG_CONTENT" | grep 'source:')" + + return 1 # No match +} + +# Function to prompt for a destination path +prompt_for_destination() { + local source_path="$1" + local destination="" + + # All informational messages go to stderr so only the destination goes to stdout + echo "" >&2 + echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" >&2 + echo -e "${YELLOW}Redirect needed for: $source_path${NC}" >&2 + echo "" >&2 + echo "Where should this URL redirect to?" >&2 + echo " - Enter a path like: /:locale/get-started/quickstarts" >&2 + echo " - Or press Enter to skip (you'll need to add it manually)" >&2 + echo "" >&2 + read -p "> " destination + + if [ -z "$destination" ]; then + echo -e "${YELLOW}Skipped. You'll need to add this redirect manually.${NC}" >&2 + return 1 + fi + + # Validate the destination + if [[ "$destination" != "/:locale/"* ]]; then + echo -e "${YELLOW}Note: Adding /:locale/ prefix to your path${NC}" >&2 + destination="/:locale/$destination" + fi + + # Check if destination exists + if ! page_exists "$destination"; then + echo -e "${YELLOW}Warning: Destination '$destination' does not appear to exist.${NC}" >&2 + read -p "Use it anyway? (y/n) " confirm + if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then + return 1 + fi + fi + + # Return the destination (only this goes to stdout for capture) + echo "$destination" + return 0 +} + +# Check each deleted file +while IFS= read -r deleted_file; do + [ -z "$deleted_file" ] && continue + + # Only check files in the app directory (actual page files) + if [[ ! "$deleted_file" =~ ^app/ ]]; then + continue + fi + + # Convert to URL path + url_path=$(file_to_url "$deleted_file") + + # Create a search pattern for the source in redirects + search_pattern=$(echo "$url_path" | sed 's/[[\.*^$()+?{|]/\\&/g') + + # Check if this path exists as a redirect source in the config (exact or wildcard) + if echo "$CONFIG_CONTENT" | grep -q "source:.*\"$search_pattern\""; then + echo -e "${GREEN}✓ Redirect exists for: $url_path${NC}" + elif check_wildcard_match "$url_path"; then + echo -e "${GREEN}✓ Redirect exists for: $url_path (via wildcard)${NC}" + else + echo -e "${RED}✗ Missing redirect for: $url_path${NC}" + MISSING_REDIRECTS+=("$url_path") + + # If interactive, prompt for destination + if [ "$IS_INTERACTIVE" = true ]; then + destination=$(prompt_for_destination "$url_path") + if [ $? -eq 0 ] && [ -n "$destination" ]; then + SUGGESTED_ENTRIES+=(" { + source: \"$url_path\", + destination: \"$destination\", + permanent: true, + },") + else + SUGGESTED_ENTRIES+=(" { + source: \"$url_path\", + destination: \"/:locale/REPLACE_WITH_NEW_PATH\", + permanent: true, + },") + fi + else + # Non-interactive: use placeholder + SUGGESTED_ENTRIES+=(" { + source: \"$url_path\", + destination: \"/:locale/REPLACE_WITH_NEW_PATH\", + permanent: true, + },") + fi + + EXIT_CODE=1 + fi +done <<< "$DELETED_FILES" + +echo "" + +# Report results +if [ ${#MISSING_REDIRECTS[@]} -gt 0 ]; then + echo -e "${RED}══════════════════════════════════════════════════════════════${NC}" + echo -e "${RED}ERROR: Found ${#MISSING_REDIRECTS[@]} deleted file(s) without redirects!${NC}" + echo -e "${RED}══════════════════════════════════════════════════════════════${NC}" + echo "" + echo "When you delete a markdown file, you must add a redirect in next.config.ts" + echo "to prevent broken links for users who have bookmarked the old URL." + echo "" + echo -e "${YELLOW}Missing redirects for:${NC}" + for path in "${MISSING_REDIRECTS[@]}"; do + echo " - $path" + done + echo "" + echo -e "${YELLOW}Add the following to the redirects array in next.config.ts:${NC}" + echo "" + for entry in "${SUGGESTED_ENTRIES[@]}"; do + echo "$entry" + done + echo "" + + if [ "$IS_INTERACTIVE" = false ]; then + echo "Replace 'REPLACE_WITH_NEW_PATH' with the actual destination path." + echo "If the content was removed entirely, redirect to a relevant parent page." + echo "" + fi + + if [ "$CONFIG_MODIFIED" -eq "0" ]; then + echo -e "${YELLOW}Note: next.config.ts was not modified in this branch.${NC}" + fi +fi + +if [ ${#INVALID_REDIRECTS[@]} -gt 0 ]; then + echo "" + echo -e "${RED}══════════════════════════════════════════════════════════════${NC}" + echo -e "${RED}ERROR: Found ${#INVALID_REDIRECTS[@]} invalid redirect(s) in config!${NC}" + echo -e "${RED}══════════════════════════════════════════════════════════════${NC}" + echo "" + for invalid in "${INVALID_REDIRECTS[@]}"; do + echo " - $invalid" + done + echo "" + echo "Please fix these redirects before merging." +fi + +if [ $EXIT_CODE -eq 0 ]; then + echo -e "${GREEN}══════════════════════════════════════════════════════════════${NC}" + echo -e "${GREEN}SUCCESS: All redirects are valid!${NC}" + echo -e "${GREEN}══════════════════════════════════════════════════════════════${NC}" +fi + +exit $EXIT_CODE