diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..a59e535d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true + +[{*.yaml,*.yml}] +indent_style = space diff --git a/.github/workflows/algolia.yml b/.github/workflows/algolia.yaml similarity index 100% rename from .github/workflows/algolia.yml rename to .github/workflows/algolia.yaml diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..9a7f3698 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +.pnpm-store/ +build/ +dist/ +node_modules/ +package-lock.json +pnpm-lock.yaml diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 00000000..c0d38c98 --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,4 @@ +arrowParens: avoid +semi: false +trailingComma: all +useTabs: true diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..79054369 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "davidanson.vscode-markdownlint", + "editorconfig.editorconfig", + "esbenp.prettier-vscode" + ] +} diff --git a/babel.config.js b/babel.config.js index e00595da..e7e30692 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: [require.resolve('@docusaurus/core/lib/babel/preset')], -}; + presets: [require.resolve("@docusaurus/core/lib/babel/preset")], +} diff --git a/docs/Future Development.md b/docs/Future Development.md index 50dcc836..50172ef0 100644 --- a/docs/Future Development.md +++ b/docs/Future Development.md @@ -50,9 +50,9 @@ These are additional capabilities that can also be reviewed in the same PR to ac ### Finishing Touches - Finishing touches are about experience that often take developers time away from what they like doing best - coding. But adding finishing touches is crucial and should follow the ontology and taxonomy. We will start by looking into Docstring and expand to various areas to solve pain points for coders and reviewers. +Finishing touches are about experience that often take developers time away from what they like doing best - coding. But adding finishing touches is crucial and should follow the ontology and taxonomy. We will start by looking into Docstring and expand to various areas to solve pain points for coders and reviewers. -#### 1. DocString Review +#### 1. DocString Review - Automated checks for docstring presence and quality - AI-powered suggestions for improving documentation diff --git a/docs/about/features.md b/docs/about/features.md index 80ea221e..20345bc9 100644 --- a/docs/about/features.md +++ b/docs/about/features.md @@ -27,7 +27,7 @@ changes. changed for each file. > Code suggestions are given in a Diff format, which either -be copied or committed within the pull request with a single click. +> be copied or committed within the pull request with a single click. ![CodeRabbit- Code Review Feedback](/img/about/ReviewFeedback.png) @@ -38,16 +38,17 @@ additional comments generated for each review, and so on. :::info Review status is useful for understanding the auxiliary context of the review. ::: + ![CodeRabbit- Review Status](/img/about/ReviewStatus.png) ### 3. Chat with CodeRabbit {#chat-with-coderabbit} - **CodeRabbit** provides conversational capability that allows developers and the -reviewers to ask questions, generate code, and get feedback in the context of -changes. Just comment on the CodeRabbit review to start the conversation. + reviewers to ask questions, generate code, and get feedback in the context of + changes. Just comment on the CodeRabbit review to start the conversation. - **CodeRabbit** learns from your interactions and gets smarter over time. The more -you chat, the better it gets. + you chat, the better it gets. We support: @@ -85,8 +86,8 @@ changes. ### 7. Learnings {#learnings} - **CodeRabbit** learns from user chat interactions to gain tribal knowledge on your -repositories and organization. + repositories and organization. - **CodeRabbit** will apply and update these learnings -in future reviews. + in future reviews. ![Learnings from Interactions - CodeRabbit AI](/img/about/learnings.png) diff --git a/docs/about/pricing.md b/docs/about/pricing.md index 16cebf2d..0d8e25e0 100644 --- a/docs/about/pricing.md +++ b/docs/about/pricing.md @@ -76,16 +76,16 @@ These are the hourly usage limits for each developer per repository: ## Plan Comparison -| Feature | Free Plan | Pro Plan | -| ----------------------------- | ---------------- | --------------- | -| **Free Trial** | 14-day free trial| 14-day free trial| -| **Private Repos** | Limited access | Unlimited access| -| **Public Repos** | Unlimited access | Unlimited access| -| **Pull Request Summarization** | Included | Included | -| **Line-by-Line Reviews** | Public repos only | All repos | -| **Conversational Bot** | No | Yes | -| **Hourly Usage Limits** | Limited | 150 files/hour, 9 reviews/hour, 50 conversations/hour | -| **Price** | Free forever | $15 per seat/mo | +| Feature | Free Plan | Pro Plan | +| ------------------------------ | ----------------- | ----------------------------------------------------- | +| **Free Trial** | 14-day free trial | 14-day free trial | +| **Private Repos** | Limited access | Unlimited access | +| **Public Repos** | Unlimited access | Unlimited access | +| **Pull Request Summarization** | Included | Included | +| **Line-by-Line Reviews** | Public repos only | All repos | +| **Conversational Bot** | No | Yes | +| **Hourly Usage Limits** | Limited | 150 files/hour, 9 reviews/hour, 50 conversations/hour | +| **Price** | Free forever | $15 per seat/mo | --- diff --git a/docs/guides/delete-account.md b/docs/guides/delete-account.md index cd612445..5bed9528 100644 --- a/docs/guides/delete-account.md +++ b/docs/guides/delete-account.md @@ -26,9 +26,7 @@ will permanently erase all data associated with your account, including: ### Deleting the CodeRabbit Account via the UI :::info - Only accounts where the user has admin access will be deleted. - ::: Sign into your CodeRabbit account and navigate to the **Subscription** page. diff --git a/docs/guides/review-instructions.md b/docs/guides/review-instructions.md index 791a4e50..f86c5240 100644 --- a/docs/guides/review-instructions.md +++ b/docs/guides/review-instructions.md @@ -19,7 +19,7 @@ can provide tailored review guidelines based on the file paths. These instructions are needed only if you want CodeRabbit to follow specific instructions besides the standard review. ->For example, you may want to enforce a style guide by file types or directories. +> For example, you may want to enforce a style guide by file types or directories. ### Sample Usage diff --git a/docs/introduction.md b/docs/introduction.md index 1484af95..3e8eaaf0 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -8,14 +8,15 @@ description: feedback on pull requests, reducing manual effort in code reviews. slug: "/" --- + ## What is CodeRabbit? ->**CodeRabbit** is an AI-powered code reviewer that delivers context-aware feedback on pull requests within minutes, reducing the time and effort needed for manual code reviews. It provides a fresh perspective and catches issues that are often missed, enhancing the overall review quality. +> **CodeRabbit** is an AI-powered code reviewer that delivers context-aware feedback on pull requests within minutes, reducing the time and effort needed for manual code reviews. It provides a fresh perspective and catches issues that are often missed, enhancing the overall review quality. Developers can interact directly with the bot within the code, offering additional context, asking questions, or even having the bot generate code. Over time, **CodeRabbit** learns from user input and improves its suggestions. :::tip -> See CodeRabbit in action and watch the demo video below to see how it delivers real-time, context-aware feedback on your pull requests in just a few minutes. +See CodeRabbit in action and watch the demo video below to see how it delivers real-time, context-aware feedback on your pull requests in just a few minutes. :::
@@ -24,7 +25,7 @@ Developers can interact directly with the bot within the code, offering addition ## Integration with GitHub, GitLab and Azure DevOps ->**CodeRabbit** integrates with GitHub, GitLab and Azure DevOps repositories to deliver continuous and incremental reviews for each commit in a pull request (PR) or merge request (MR). Review feedback is automatically sent back to the PR/MR and can be committed directly. +> **CodeRabbit** integrates with GitHub, GitLab and Azure DevOps repositories to deliver continuous and incremental reviews for each commit in a pull request (PR) or merge request (MR). Review feedback is automatically sent back to the PR/MR and can be committed directly. It works via a webhook, monitoring Pull Request (PR) and Merge Request (MR) events. A comprehensive review is performed when a PR or MR is created, and for incremental commits and comments addressed to the bot. The feedback is then sent directly back to the Pull Request or Merge Request. @@ -33,7 +34,7 @@ incremental commits and comments addressed to the bot. The feedback is then sent ## Data Privacy and Security ->**CodeRabbit** does not use data collected from code reviews to train or influence its models. All queries to Large Language Models (LLMs) are ephemeral, with zero retention. No data is shared with third parties. +> **CodeRabbit** does not use data collected from code reviews to train or influence its models. All queries to Large Language Models (LLMs) are ephemeral, with zero retention. No data is shared with third parties. - **Temporary Storage**: Code is temporarily stored in memory during the review process and deleted afterward. - **Stored Embeddings**: While the code itself isn’t stored, **CodeRabbit** stores embeddings based on chat conversations and workflow systems (Linear, Jira, GitHub/GitLab issues) to improve future reviews. @@ -48,7 +49,7 @@ However, opting out may reduce the level of personalized review feedback. ## Try CodeRabbit Now ->Ready to experience **CodeRabbit** in action? +> Ready to experience **CodeRabbit** in action? :::tip For open source projects CodeRabbit Pro is **_FREE_**, forever. diff --git a/docs/platforms/platforms.md b/docs/platforms/platforms.md index b38c7bef..038b329c 100644 --- a/docs/platforms/platforms.md +++ b/docs/platforms/platforms.md @@ -9,9 +9,9 @@ CodeRabbit supports various Git platforms to provide code review for your reposi ## GitHub -| Host | Support | -| ------------------------ | ---------------------------------- | -| GitHub.com | [Supported][login] | +| Host | Support | +| ------------------------ | ---------------------------------------- | +| GitHub.com | [Supported][login] | | GitHub Enterprise Server | [Supported](github-enterprise-server.md) | ## GitLab @@ -23,10 +23,10 @@ CodeRabbit supports various Git platforms to provide code review for your reposi ## Azure DevOps -| Host | Support | -| ------------------- | ---------------------------------- | -| Azure DevOps | [Supported](azure-devops.md) | -| Azure DevOps Server | [Supported] | +| Host | Support | +| ------------------- | ---------------------------- | +| Azure DevOps | [Supported](azure-devops.md) | +| Azure DevOps Server | [Supported] | ## Bitbucket diff --git a/docs/self-hosted/azure-devops.md b/docs/self-hosted/azure-devops.md index 2e229ec4..215bf924 100644 --- a/docs/self-hosted/azure-devops.md +++ b/docs/self-hosted/azure-devops.md @@ -1,14 +1,14 @@ --- title: Use Self-Hosted CodeRabbit With Azure DevOps -sidebar_label: Azure DevOps +sidebar_label: Azure DevOps description: Instructions to self-host CodeRabbit and integrate it with Azure DevOps. sidebar_position: 3 --- ## Create a Azure DevOps User -* **Username**: Set the username to "CodeRabbit" for easier identification (optional). -* **Profile Image**: Use the CodeRabbitAI logo for the user image (optional). +- **Username**: Set the username to "CodeRabbit" for easier identification (optional). +- **Profile Image**: Use the CodeRabbitAI logo for the user image (optional). ## Add User to Projects @@ -20,8 +20,8 @@ Generate a personal access token for the CodeRabbit user to be added in the `.en **Necessary Scopes**: -* `Code` - Full -* `Work Items` - Read, write, and manage +- `Code` - Full +- `Work Items` - Read, write, and manage Consult official CodeRabbitAI documentation for a detailed [guide](https://docs.coderabbit.ai/platforms/azure-devops#generating-a-personal-access-token) on creating personal access tokens. @@ -30,9 +30,10 @@ Consult official CodeRabbitAI documentation for a detailed [guide](https://docs. 1. **Navigate to project's Service Hooks Page**: Go to the service hooks configuration page in the desired Azure DevOps project. 2. **Add the following webhooks:** - 1. Pull request created - 2. Pull request updated - 3. Pull request commented on + + 1. Pull request created + 2. Pull request updated + 3. Pull request commented on 3. **Add Webhook URL**: Enter the URL pointing to the CodeRabbit service, followed by `/azure_webhooks` (e.g., `http://127.0.0.1:8080/azure_webhooks`) for each webhook. @@ -86,9 +87,9 @@ LINEAR_PAT=[] :::note -* If you are using Azure OpenAI, verify that the model deployment names are in the .env file. -* Values marked with [] are not optional to provide. -* You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. +- If you are using Azure OpenAI, verify that the model deployment names are in the .env file. +- Values marked with [] are not optional to provide. +- You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. ::: diff --git a/docs/self-hosted/github.md b/docs/self-hosted/github.md index 2afcf984..d24cfcc6 100644 --- a/docs/self-hosted/github.md +++ b/docs/self-hosted/github.md @@ -1,6 +1,6 @@ --- title: Use Self-Hosted CodeRabbit With GitHub -sidebar_label: GitHub +sidebar_label: GitHub description: Instructions to self-host CodeRabbit and integrate it with GitHub. sidebar_position: 1 --- @@ -9,38 +9,38 @@ sidebar_position: 1 Set the following Repository permissions: -* Checks: Read-only -* Contents: Read and write -* Commit statuses: Read and write -* Discussions: Read-only -* Issues: Read & write -* Metadata: Read-only -* Pull requests: Read & write +- Checks: Read-only +- Contents: Read and write +- Commit statuses: Read and write +- Discussions: Read-only +- Issues: Read & write +- Metadata: Read-only +- Pull requests: Read & write Set the following Organization permissions: -* Members: Read-only +- Members: Read-only Set the following events: -* Meta -* Issue comment -* Issues -* Label -* Public -* Pull request -* Pull request review -* Pull request review comment -* Pull request review thread -* Push -* Release +- Meta +- Issue comment +- Issues +- Label +- Public +- Pull request +- Pull request review +- Pull request review comment +- Pull request review thread +- Push +- Release ## Gather information from the GitHub App -* App ID -* Client ID -* Client Secret -* Webhook Secret +- App ID +- Client ID +- Client Secret +- Webhook Secret ## Prepare an `.env` file @@ -98,18 +98,18 @@ JIRA_PAT=[] LINEAR_PAT=[] -OAUTH2_ENDPOINT=[] +OAUTH2_ENDPOINT=[] OAUTH2_CLIENT_ID=[] OAUTH2_CLIENT_SECRET=[] ``` :::note -* If you are using Azure OpenAI, verify that the model deployment names are in the .env file. -* Values marked with [] are optional to provide. -* For `GITHUB_APP_PEM_FILE`, flatten the PEM file by replacing newlines with `\n`. -* For `GITHUB_HOSTNAME`, use GitHub Enterprise server's hostname, for example, “github.acme-inc.com” -* You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. +- If you are using Azure OpenAI, verify that the model deployment names are in the .env file. +- Values marked with [] are optional to provide. +- For `GITHUB_APP_PEM_FILE`, flatten the PEM file by replacing newlines with `\n`. +- For `GITHUB_HOSTNAME`, use GitHub Enterprise server's hostname, for example, “github.acme-inc.com” +- You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. ::: @@ -117,7 +117,7 @@ OAUTH2_CLIENT_SECRET=[] Using the credentials file shared with you, first authenticate and then pull the image. -```bash +```bash cat coderabbit.json | docker login -u _json_key --password-stdin us-docker.pkg.dev docker pull /coderabbit-agent:latest ``` @@ -126,7 +126,7 @@ docker pull /coderabbit-agent:latest You can choose to host it on a server, serverless function, or a container environment and expose the port “8080”. Run the Docker image with the equivalent of the following command on the platform of your choice, replacing the “.env” file with the path to your “.env” file: -```bash +```bash docker run --env-file .env --publish 127.0.0.1:8080:8080 /coderabbit-agent:latest ``` @@ -134,7 +134,7 @@ docker run --env-file .env --publish 127.0.0.1:8080:8080 /coder You can query `/health` endpoint to verify that the coderabbit-agent service is up and running. -```bash +```bash curl 127.0.0.1:8080/health ``` diff --git a/docs/self-hosted/gitlab.md b/docs/self-hosted/gitlab.md index dc738721..b0eaeb04 100644 --- a/docs/self-hosted/gitlab.md +++ b/docs/self-hosted/gitlab.md @@ -1,14 +1,14 @@ --- title: Use Self-Hosted CodeRabbit With GitLab -sidebar_label: GitLab +sidebar_label: GitLab description: Instructions to self-host CodeRabbit and integrate it with GitLab. sidebar_position: 2 --- ## Create a GitLab User -* **Username**: Set the username to "CodeRabbit" for easier identification (optional). -* **Profile Image**: Use the CodeRabbitAI logo for the user image (optional). +- **Username**: Set the username to "CodeRabbit" for easier identification (optional). +- **Profile Image**: Use the CodeRabbitAI logo for the user image (optional). ## Add User to Projects @@ -20,7 +20,7 @@ Generate a personal access token for the CodeRabbit user to be added in the `.en **Necessary Scopes**: -* `api` +- `api` Consult official CodeRabbitAI documentation for a detailed [guide](https://docs.coderabbit.ai/integrations/self-hosted-gitlab#generating-personal-access-token) on creating personal access tokens. @@ -31,10 +31,10 @@ Consult official CodeRabbitAI documentation for a detailed [guide](https://docs. 3. **Generate and Save Secret Token**: Generate a secret token, add it to the webhook, and store it securely. This will be needed for the `.env` file as `GITLAB_WEBHOOK_SECRET` (you can use a single secret token for all projects). 4. Select triggers: - * Push events - * Comments - * Issues events - * Merge request events + - Push events + - Comments + - Issues events + - Merge request events ## Prepare an `.env` file @@ -92,9 +92,9 @@ LINEAR_PAT=[] :::note -* If you are using Azure OpenAI, verify that the model deployment names are in the .env file. -* Values marked with [] are not optional to provide. -* You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. +- If you are using Azure OpenAI, verify that the model deployment names are in the .env file. +- Values marked with [] are not optional to provide. +- You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. ::: diff --git a/docs/tools/cppcheck.md b/docs/tools/cppcheck.md index 04ac66d1..105d7bbd 100644 --- a/docs/tools/cppcheck.md +++ b/docs/tools/cppcheck.md @@ -4,7 +4,7 @@ sidebar_label: Cppcheck description: CodeRabbit's guide to Cppcheck. --- -[Cppcheck](https://cppcheck.sourceforge.io/) is a static code analysis tool for the C and C++ programming languages. +[Cppcheck](https://cppcheck.sourceforge.io/) is a static code analysis tool for the C and C++ programming languages. ## Files diff --git a/docs/tools/tools.md b/docs/tools/tools.md index 42c415bf..e58acd56 100644 --- a/docs/tools/tools.md +++ b/docs/tools/tools.md @@ -39,7 +39,7 @@ Remove extraneous f prefix | Technology | Tools | | :-------------------------- | :--------------------------------------------------------- | | All | [Gitleaks][Gitleaks] | -| CircleCi | [CircleCi][CircleCi] | +| CircleCi | [CircleCi][CircleCi] | | CloudFormation | [Checkov][Checkov] | | Cppcheck | [Cppcheck][Cppcheck] | | CSS | [Biome][Biome] | @@ -55,7 +55,7 @@ Remove extraneous f prefix | Markdown | [Markdownlint][Markdownlint], [LanguageTool][LanguageTool] | | PHP | [PHPStan][PHPStan] | | Plaintext | [LanguageTool][LanguageTool] | -| Java | [PMD][PMD] | +| Java | [PMD][PMD] | | Protobuf | [Buf][Buf] | | Python | [Ruff][Ruff] | | Regal | [Regal][Regal] | diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 96cdf6d1..97c6101f 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -1,199 +1,199 @@ -import { themes as prismThemes } from "prism-react-renderer"; -import { EnumChangefreq } from "sitemap"; +import { themes as prismThemes } from "prism-react-renderer" +import { EnumChangefreq } from "sitemap" -import type * as Preset from "@docusaurus/preset-classic"; -import type { Config } from "@docusaurus/types"; +import type * as Preset from "@docusaurus/preset-classic" +import type { Config } from "@docusaurus/types" -const baseUrl = "/"; +const baseUrl = "/" const config: Config = { - title: "CodeRabbit", - staticDirectories: ["static"], - tagline: "AI-powered Code Reviews", - favicon: "img/favIcon.png", - - // Set the production url of your site here - url: "https://docs.coderabbit.ai/", - // Set the // pathname under which your site is served - // For GitHub pages deployment, it is often '//' - baseUrl: baseUrl, - - // GitHub pages deployment config. - // If you aren't using GitHub pages, you don't need these. - organizationName: "coderabbit", // Usually your GitHub org/user name. - projectName: "coderabbit-docs", // Usually your repo name. - - onBrokenLinks: "throw", - onBrokenMarkdownLinks: "throw", - onDuplicateRoutes: "warn", - - // Even if you don't use internationalization, you can use this field to set - // useful metadata like html lang. For example, if your site is Chinese, you - // may want to replace "en" with "zh-Hans". - i18n: { - defaultLocale: "en", - locales: ["en"], - }, - - plugins: [ - [ - "@docusaurus/plugin-client-redirects", - { - redirects: [ - { - from: "/get-started", - to: "/configure-coderabbit", - }, - { - from: "/guides/customize-coderabbit", - to: "/configure-coderabbit", - }, - { - from: "/guides/prompt-customization", - to: "/guides/review-instructions", - }, - { - from: "/guides/configure-coderabbit", - to: "/configure-coderabbit", - }, - { - from: "/integrations/saas-gitlab", - to: "/platforms/gitlab-com", - }, - { - from: "/integrations/self-hosted-gitlab", - to: "/platforms/self-hosted-gitlab", - }, - { - from: "/integrations/self-hosted-github", - to: "/platforms/github-enterprise-server", - }, - { - from: "/platforms/saas-azure-devops", - to: "/platforms/azure-devops", - }, - { - from: "/platforms/saas-gitlab", - to: "/platforms/gitlab-com", - }, - { - from: "/platforms/self-hosted-github", - to: "/platforms/github-enterprise-server", - }, - ], - }, - ], - async function myPlugin(context, options) { - return { - name: "docusaurus-tailwindcss", - configurePostCss(postcssOptions) { - // Appends TailwindCSS and AutoPrefixer. - postcssOptions.plugins.push(require("tailwindcss")); - postcssOptions.plugins.push(require("autoprefixer")); - return postcssOptions; - }, - }; - }, - ], - - presets: [ - [ - "classic", - { - docs: { - editUrl: "https://github.com/coderabbitai/coderabbit-docs/edit/main/", - sidebarPath: "./sidebars.ts", - routeBasePath: "/", - breadcrumbs: true, - showLastUpdateTime: true, - }, - blog: false, - theme: { - customCss: "./src/css/custom.css", - }, - sitemap: { - changefreq: "weekly" as EnumChangefreq, - priority: 0.5, - ignorePatterns: ["/tags/**"], - filename: "sitemap.xml", - }, - googleTagManager: { - containerId: "GTM-5BWLXJRC", - }, - } satisfies Preset.Options, - ], - ], - - themes: ["docusaurus-json-schema-plugin"], - - scripts: [ - "https://buttons.github.io/buttons.js", - "https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js", - "/docs/js/code-block-buttons.js", - "https://cdnjs.cloudflare.com/ajax/libs/axios/1.2.1/axios.min.js", - { - src: "/js/segment.js", - async: false, - }, - { - src: "https://js.hs-scripts.com/43613284.js", - type: "text/javascript", - id: "hs-script-loader", - async: true, - defer: true, - }, - { - src: "https://cdnjs.cloudflare.com/ajax/libs/axios/1.2.1/axios.min.js", - async: true, - }, - ], - - themeConfig: { - image: "img/preview.png", - colorMode: { - defaultMode: "light", - disableSwitch: false, - respectPrefersColorScheme: false, - }, - docs: { - sidebar: { - hideable: true, - }, - }, - metadata: [{ name: "twitter:card", content: "summary_large_image" }], - navbar: { - title: "", - hideOnScroll: true, - logo: { - alt: "", - src: "img/coderabbit_nav_logo.svg", - href: "https://coderabbit.ai", - }, - items: [], - }, - prism: { - theme: prismThemes.github, - darkTheme: prismThemes.dracula, - }, - algolia: { - // The application ID provided by Algolia - appId: "4MKM4DJT5D", - - // Public API key: it is safe to commit it - apiKey: "b1d63b99cbda8ec3668777e644ecefa2", - - indexName: "coderabbit", - - // Optional: see doc section below - contextualSearch: false, - - // Optional: Algolia search parameters - searchParameters: {}, - - // Optional: path for search page that enabled by default (`false` to disable it) - searchPagePath: "search", - }, - } satisfies Preset.ThemeConfig, -}; - -export default config; + title: "CodeRabbit", + staticDirectories: ["static"], + tagline: "AI-powered Code Reviews", + favicon: "img/favIcon.png", + + // Set the production url of your site here + url: "https://docs.coderabbit.ai/", + // Set the // pathname under which your site is served + // For GitHub pages deployment, it is often '//' + baseUrl: baseUrl, + + // GitHub pages deployment config. + // If you aren't using GitHub pages, you don't need these. + organizationName: "coderabbit", // Usually your GitHub org/user name. + projectName: "coderabbit-docs", // Usually your repo name. + + onBrokenLinks: "throw", + onBrokenMarkdownLinks: "throw", + onDuplicateRoutes: "warn", + + // Even if you don't use internationalization, you can use this field to set + // useful metadata like html lang. For example, if your site is Chinese, you + // may want to replace "en" with "zh-Hans". + i18n: { + defaultLocale: "en", + locales: ["en"], + }, + + plugins: [ + [ + "@docusaurus/plugin-client-redirects", + { + redirects: [ + { + from: "/get-started", + to: "/configure-coderabbit", + }, + { + from: "/guides/customize-coderabbit", + to: "/configure-coderabbit", + }, + { + from: "/guides/prompt-customization", + to: "/guides/review-instructions", + }, + { + from: "/guides/configure-coderabbit", + to: "/configure-coderabbit", + }, + { + from: "/integrations/saas-gitlab", + to: "/platforms/gitlab-com", + }, + { + from: "/integrations/self-hosted-gitlab", + to: "/platforms/self-hosted-gitlab", + }, + { + from: "/integrations/self-hosted-github", + to: "/platforms/github-enterprise-server", + }, + { + from: "/platforms/saas-azure-devops", + to: "/platforms/azure-devops", + }, + { + from: "/platforms/saas-gitlab", + to: "/platforms/gitlab-com", + }, + { + from: "/platforms/self-hosted-github", + to: "/platforms/github-enterprise-server", + }, + ], + }, + ], + async function myPlugin(context, options) { + return { + name: "docusaurus-tailwindcss", + configurePostCss(postcssOptions) { + // Appends TailwindCSS and AutoPrefixer. + postcssOptions.plugins.push(require("tailwindcss")) + postcssOptions.plugins.push(require("autoprefixer")) + return postcssOptions + }, + } + }, + ], + + presets: [ + [ + "classic", + { + docs: { + editUrl: "https://github.com/coderabbitai/coderabbit-docs/edit/main/", + sidebarPath: "./sidebars.ts", + routeBasePath: "/", + breadcrumbs: true, + showLastUpdateTime: true, + }, + blog: false, + theme: { + customCss: "./src/css/custom.css", + }, + sitemap: { + changefreq: "weekly" as EnumChangefreq, + priority: 0.5, + ignorePatterns: ["/tags/**"], + filename: "sitemap.xml", + }, + googleTagManager: { + containerId: "GTM-5BWLXJRC", + }, + } satisfies Preset.Options, + ], + ], + + themes: ["docusaurus-json-schema-plugin"], + + scripts: [ + "https://buttons.github.io/buttons.js", + "https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js", + "/docs/js/code-block-buttons.js", + "https://cdnjs.cloudflare.com/ajax/libs/axios/1.2.1/axios.min.js", + { + src: "/js/segment.js", + async: false, + }, + { + src: "https://js.hs-scripts.com/43613284.js", + type: "text/javascript", + id: "hs-script-loader", + async: true, + defer: true, + }, + { + src: "https://cdnjs.cloudflare.com/ajax/libs/axios/1.2.1/axios.min.js", + async: true, + }, + ], + + themeConfig: { + image: "img/preview.png", + colorMode: { + defaultMode: "light", + disableSwitch: false, + respectPrefersColorScheme: false, + }, + docs: { + sidebar: { + hideable: true, + }, + }, + metadata: [{ name: "twitter:card", content: "summary_large_image" }], + navbar: { + title: "", + hideOnScroll: true, + logo: { + alt: "", + src: "img/coderabbit_nav_logo.svg", + href: "https://coderabbit.ai", + }, + items: [], + }, + prism: { + theme: prismThemes.github, + darkTheme: prismThemes.dracula, + }, + algolia: { + // The application ID provided by Algolia + appId: "4MKM4DJT5D", + + // Public API key: it is safe to commit it + apiKey: "b1d63b99cbda8ec3668777e644ecefa2", + + indexName: "coderabbit", + + // Optional: see doc section below + contextualSearch: false, + + // Optional: Algolia search parameters + searchParameters: {}, + + // Optional: path for search page that enabled by default (`false` to disable it) + searchPagePath: "search", + }, + } satisfies Preset.ThemeConfig, +} + +export default config diff --git a/package.json b/package.json index 07520c20..339c457e 100644 --- a/package.json +++ b/package.json @@ -1,67 +1,67 @@ { - "name": "@coderabbitai/coderabbit-docs", - "version": "0.0.0", - "private": true, - "scripts": { - "docusaurus": "docusaurus", - "start": "docusaurus start", - "build": "docusaurus build", - "swizzle": "docusaurus swizzle", - "deploy": "docusaurus deploy", - "clear": "docusaurus clear", - "serve": "docusaurus serve", - "lint": "markdownlint-cli2 \"**/*.md\"", - "lint:fix": "markdownlint-cli2 \"**/*.md\" --fix", - "write-translations": "docusaurus write-translations", - "write-heading-ids": "docusaurus write-heading-ids", - "typecheck": "tsc --noEmit" - }, - "dependencies": { - "@docusaurus/core": "^3.1.1", - "@docusaurus/plugin-client-redirects": "^3.1.1", - "@docusaurus/plugin-content-blog": "^3.1.1", - "@docusaurus/preset-classic": "^3.1.1", - "@mdx-js/react": "^3.0.0", - "autoprefixer": "^10.4.16", - "clsx": "^2.0.0", - "disqus-react": "^1.1.5", - "docusaurus-json-schema-plugin": "^1.12.1", - "postcss": "^8.4.32", - "prism-react-renderer": "^2.3.0", - "react-ace": "^12.0.0", - "react-dom": "^18.0.0", - "tailwindcss": "^3.4.0" - }, - "devDependencies": { - "@docusaurus/module-type-aliases": "^3.1.1", - "@docusaurus/theme-classic": "^3.5.2", - "@docusaurus/tsconfig": "^3.1.1", - "@docusaurus/types": "^3.1.1", - "@types/js-yaml": "^4.0.9", - "@types/node": "^22.8.4", - "@types/react": "^18.3.4", - "ace-builds": "^1.36.1", - "ajv": "^8.17.1", - "js-yaml": "^4.1.0", - "markdownlint-cli2": "^0.14.0", - "prettier": "^3.3.3", - "react": "^18.3.1", - "sitemap": "^8.0.0", - "typescript": "~5.2.2" - }, - "browserslist": { - "production": [ - ">0.5%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 3 chrome version", - "last 3 firefox version", - "last 5 safari version" - ] - }, - "engines": { - "node": ">=18.0" - } + "name": "@coderabbitai/coderabbit-docs", + "version": "0.0.0", + "private": true, + "scripts": { + "docusaurus": "docusaurus", + "start": "docusaurus start", + "build": "docusaurus build", + "swizzle": "docusaurus swizzle", + "deploy": "docusaurus deploy", + "clear": "docusaurus clear", + "serve": "docusaurus serve", + "lint": "markdownlint-cli2 \"**/*.md\" && prettier --check .", + "lint:fix": "markdownlint-cli2 \"**/*.md\" --fix; prettier --list-different --write .", + "write-translations": "docusaurus write-translations", + "write-heading-ids": "docusaurus write-heading-ids", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "@docusaurus/core": "^3.1.1", + "@docusaurus/plugin-client-redirects": "^3.1.1", + "@docusaurus/plugin-content-blog": "^3.1.1", + "@docusaurus/preset-classic": "^3.1.1", + "@mdx-js/react": "^3.0.0", + "autoprefixer": "^10.4.16", + "clsx": "^2.0.0", + "disqus-react": "^1.1.5", + "docusaurus-json-schema-plugin": "^1.12.1", + "postcss": "^8.4.32", + "prism-react-renderer": "^2.3.0", + "react-ace": "^12.0.0", + "react-dom": "^18.0.0", + "tailwindcss": "^3.4.0" + }, + "devDependencies": { + "@docusaurus/module-type-aliases": "^3.1.1", + "@docusaurus/theme-classic": "^3.5.2", + "@docusaurus/tsconfig": "^3.1.1", + "@docusaurus/types": "^3.1.1", + "@types/js-yaml": "^4.0.9", + "@types/node": "^22.8.4", + "@types/react": "^18.3.4", + "ace-builds": "^1.36.1", + "ajv": "^8.17.1", + "js-yaml": "^4.1.0", + "markdownlint-cli2": "^0.14.0", + "prettier": "^3.3.3", + "react": "^18.3.1", + "sitemap": "^8.0.0", + "typescript": "~5.2.2" + }, + "browserslist": { + "production": [ + ">0.5%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 3 chrome version", + "last 3 firefox version", + "last 5 safari version" + ] + }, + "engines": { + "node": ">=18.0" + } } diff --git a/plugins/blog-plugin.js b/plugins/blog-plugin.js index 98c9e921..f847d186 100644 --- a/plugins/blog-plugin.js +++ b/plugins/blog-plugin.js @@ -1,68 +1,68 @@ -const blogPluginExports = require("@docusaurus/plugin-content-blog"); +const blogPluginExports = require("@docusaurus/plugin-content-blog") -const defaultBlogPlugin = blogPluginExports.default; +const defaultBlogPlugin = blogPluginExports.default async function blogPluginExtended(...pluginOptions) { - const blogPluginInstance = await defaultBlogPlugin(...pluginOptions); + const blogPluginInstance = await defaultBlogPlugin(...pluginOptions) - return { - // Add all properties of the default blog plugin so existing functionality is preserved - ...blogPluginInstance, - /** - * Override the default `contentLoaded` hook to access blog posts data - */ - contentLoaded: async function (data) { - const { content, actions } = data; + return { + // Add all properties of the default blog plugin so existing functionality is preserved + ...blogPluginInstance, + /** + * Override the default `contentLoaded` hook to access blog posts data + */ + contentLoaded: async function (data) { + const { content, actions } = data - const allBlogPosts = content.blogPosts; + const allBlogPosts = content.blogPosts - async function createRecentPostModule(blogPost, index) { - return { - // Inject the metadata you need for each recent blog post - metadata: await actions.createData( - `blogpost-metadata-${index}.json`, - JSON.stringify({ - title: blogPost.metadata.title, - description: blogPost.metadata.description, - frontMatter: blogPost.metadata.frontMatter, - image: blogPost.metadata.frontMatter.image, - link: blogPost.metadata.permalink, - date: blogPost.metadata.date, - }), - ), + async function createRecentPostModule(blogPost, index) { + return { + // Inject the metadata you need for each recent blog post + metadata: await actions.createData( + `blogpost-metadata-${index}.json`, + JSON.stringify({ + title: blogPost.metadata.title, + description: blogPost.metadata.description, + frontMatter: blogPost.metadata.frontMatter, + image: blogPost.metadata.frontMatter.image, + link: blogPost.metadata.permalink, + date: blogPost.metadata.date, + }), + ), - // Inject the MDX excerpt as a JSX component prop - // (what's above the marker) - Preview: { - __import: true, - // The markdown file for the blog post will be loaded by webpack - path: blogPost.metadata.source, - query: { - truncated: true, - }, - }, - }; - } + // Inject the MDX excerpt as a JSX component prop + // (what's above the marker) + Preview: { + __import: true, + // The markdown file for the blog post will be loaded by webpack + path: blogPost.metadata.source, + query: { + truncated: true, + }, + }, + } + } - data.actions.addRoute({ - path: "/featured-posts", - exact: true, + data.actions.addRoute({ + path: "/featured-posts", + exact: true, - component: "@site/src/components/FeaturedPosts/FeaturedPosts.tsx", - modules: { - blogPosts: await Promise.all( - allBlogPosts.map(createRecentPostModule), - ), - }, - }); + component: "@site/src/components/FeaturedPosts/FeaturedPosts.tsx", + modules: { + blogPosts: await Promise.all( + allBlogPosts.map(createRecentPostModule), + ), + }, + }) - // Call the default overridden `contentLoaded` implementation - return blogPluginInstance.contentLoaded(data); - }, - }; + // Call the default overridden `contentLoaded` implementation + return blogPluginInstance.contentLoaded(data) + }, + } } module.exports = { - ...blogPluginExports, - default: blogPluginExtended, -}; + ...blogPluginExports, + default: blogPluginExtended, +} diff --git a/sidebars.ts b/sidebars.ts index a5294e6c..fbd68074 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -1,4 +1,4 @@ -import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; +import type { SidebarsConfig } from "@docusaurus/plugin-content-docs" /** * Creating a sidebar enables you to: @@ -11,27 +11,27 @@ import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; Create as many sidebars as you want. */ const sidebars: SidebarsConfig = { - docsSidebar: [ - { - type: "autogenerated", - dirName: ".", - }, - { - type: "link", - label: "API Reference", - href: "https://api.coderabbit.ai/api/swagger/" - }, - { - type: "link", - label: "Blog", - href: "https://blog.coderabbit.ai/blog", - }, - { - type: "link", - label: "Discord", - href: "https://discord.gg/GsXnASn26c", - }, - ], -}; + docsSidebar: [ + { + type: "autogenerated", + dirName: ".", + }, + { + type: "link", + label: "API Reference", + href: "https://api.coderabbit.ai/api/swagger/", + }, + { + type: "link", + label: "Blog", + href: "https://blog.coderabbit.ai/blog", + }, + { + type: "link", + label: "Discord", + href: "https://discord.gg/GsXnASn26c", + }, + ], +} -export default sidebars; +export default sidebars diff --git a/src/components/AiDisclaimer/AiDisclaimer.tsx b/src/components/AiDisclaimer/AiDisclaimer.tsx index c443c791..6786278b 100644 --- a/src/components/AiDisclaimer/AiDisclaimer.tsx +++ b/src/components/AiDisclaimer/AiDisclaimer.tsx @@ -1,24 +1,24 @@ -import React from "react"; -import "./style.css"; -import WriteIcon from "@site/static/img/write-icon.svg"; +import React from "react" +import "./style.css" +import WriteIcon from "@site/static/img/write-icon.svg" -type AiDisclaimerProps = {}; +type AiDisclaimerProps = {} -export const AiDisclaimer: React.FC = (props) => { - return ( -
-
- -
-
Disclaimer
-
- This piece has been written by humans; it has also been reviewed and - approved by humans. However, there was a touch of AI: it assisted us - in correcting grammar, enhancing syntax, and improving sentence - clarity. Thanks for reading! -
-
-
-
- ); -}; +export const AiDisclaimer: React.FC = props => { + return ( +
+
+ +
+
Disclaimer
+
+ This piece has been written by humans; it has also been reviewed and + approved by humans. However, there was a touch of AI: it assisted us + in correcting grammar, enhancing syntax, and improving sentence + clarity. Thanks for reading! +
+
+
+
+ ) +} diff --git a/src/components/AiDisclaimer/index.ts b/src/components/AiDisclaimer/index.ts index 74f0e194..382446c9 100644 --- a/src/components/AiDisclaimer/index.ts +++ b/src/components/AiDisclaimer/index.ts @@ -1 +1 @@ -export * from "./AiDisclaimer"; \ No newline at end of file +export * from "./AiDisclaimer" diff --git a/src/components/AiDisclaimer/style.css b/src/components/AiDisclaimer/style.css index 0a71d1ff..74a10792 100644 --- a/src/components/AiDisclaimer/style.css +++ b/src/components/AiDisclaimer/style.css @@ -1,61 +1,61 @@ .ai-disclaimer-wrapper { - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; } .ai-disclaimer-container { - display: flex; - max-width: 738px; - padding: 24px; - margin: 24px 0; - gap: 10px; - align-items: flex-start; - border-radius: 20px; - background: #F9F9F9; + display: flex; + max-width: 738px; + padding: 24px; + margin: 24px 0; + gap: 10px; + align-items: flex-start; + border-radius: 20px; + background: #f9f9f9; } [data-theme="dark"]:root .ai-disclaimer-container { - background: #5D5A59; + background: #5d5a59; } .ai-disclaimer-icon { - width: 24px; - height: 24px; - flex-shrink: 0; + width: 24px; + height: 24px; + flex-shrink: 0; } .ai-disclaimer-content { - display: flex; - flex-direction: column; - align-items: flex-start; - gap: 8px; - flex: 1 0 0; + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 8px; + flex: 1 0 0; } .ai-disclaimer-title { - align-self: stretch; - color: #2D333E; - margin-top: 2px; - font-size: 18px; - font-style: normal; - font-weight: 700; - line-height: normal; + align-self: stretch; + color: #2d333e; + margin-top: 2px; + font-size: 18px; + font-style: normal; + font-weight: 700; + line-height: normal; } [data-theme="dark"]:root .ai-disclaimer-title { - color: #DBD9D7; + color: #dbd9d7; } .ai-disclaimer-description { - color: #2D333E; - font-size: 16px; - font-style: normal; - font-weight: 400; - line-height: normal; + color: #2d333e; + font-size: 16px; + font-style: normal; + font-weight: 400; + line-height: normal; } [data-theme="dark"]:root .ai-disclaimer-description { - color: #DBD9D7; -} \ No newline at end of file + color: #dbd9d7; +} diff --git a/src/components/FeaturedPosts/FeaturedPosts.module.css b/src/components/FeaturedPosts/FeaturedPosts.module.css index 46aa71c2..0391b6d3 100644 --- a/src/components/FeaturedPosts/FeaturedPosts.module.css +++ b/src/components/FeaturedPosts/FeaturedPosts.module.css @@ -1,13 +1,13 @@ .blogCard { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); - grid-gap: 1rem; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); + grid-gap: 1rem; } .card { - /* border: 2px solid #e7e7e7; */ + /* border: 2px solid #e7e7e7; */ - /* border-radius: 4px; */ + /* border-radius: 4px; */ - padding: 0.5rem; + padding: 0.5rem; } diff --git a/src/components/FeaturedPosts/FeaturedPosts.tsx b/src/components/FeaturedPosts/FeaturedPosts.tsx index 38460bef..1491d5d9 100644 --- a/src/components/FeaturedPosts/FeaturedPosts.tsx +++ b/src/components/FeaturedPosts/FeaturedPosts.tsx @@ -1,52 +1,52 @@ -import React from "react"; -import styles from "./FeaturedPosts.module.css"; -import Layout from "@theme/Layout"; -import { Content } from "@theme/BlogPostPage"; -import clsx from "clsx"; +import React from "react" +import styles from "./FeaturedPosts.module.css" +import Layout from "@theme/Layout" +import { Content } from "@theme/BlogPostPage" +import clsx from "clsx" interface FeaturedPostsProps { - readonly blogPosts: readonly { readonly Preview: Content; metadata: any }[]; + readonly blogPosts: readonly { readonly Preview: Content; metadata: any }[] } function FeaturedPosts({ blogPosts }: FeaturedPostsProps): JSX.Element { - return ( - -
-
-
-

Featured Posts

-
-
-
- {blogPosts.map(({ metadata }, index) => ( - - ))} -
-
-
- ); + return ( + +
+
+
+

Featured Posts

+
+
+
+ {blogPosts.map(({ metadata }, index) => ( + + ))} +
+
+
+ ) } -export default FeaturedPosts; +export default FeaturedPosts export function FeaturedPostsCard({ index, metadata, context }): JSX.Element { - return ( -
-
- {metadata.title} -
-
-

{metadata.title}

-

{metadata.description}

- - Read more - -
-
- ); + return ( +
+
+ {metadata.title} +
+
+

{metadata.title}

+

{metadata.description}

+ + Read more + +
+
+ ) } diff --git a/src/components/ReportSchema.tsx b/src/components/ReportSchema.tsx index 8972ef3c..94f188aa 100644 --- a/src/components/ReportSchema.tsx +++ b/src/components/ReportSchema.tsx @@ -1,6 +1,6 @@ -import Schema from "@site/static/schema/reporting.json"; -import JSONSchemaViewer from "@theme/JSONSchemaViewer"; +import Schema from "@site/static/schema/reporting.json" +import JSONSchemaViewer from "@theme/JSONSchemaViewer" export default function Viewer(): JSX.Element { - return ; + return } diff --git a/src/components/SchemaViewer.tsx b/src/components/SchemaViewer.tsx index 55c6a3f4..0c9eb96b 100644 --- a/src/components/SchemaViewer.tsx +++ b/src/components/SchemaViewer.tsx @@ -1,6 +1,6 @@ -import Schema from "@site/static/schema/schema.v2.json"; -import JSONSchemaViewer from "@theme/JSONSchemaViewer"; +import Schema from "@site/static/schema/schema.v2.json" +import JSONSchemaViewer from "@theme/JSONSchemaViewer" export default function Viewer(): JSX.Element { - return ; + return } diff --git a/src/components/YamlEditor/YamlEditor.tsx b/src/components/YamlEditor/YamlEditor.tsx index 1b483547..6e3abfdb 100644 --- a/src/components/YamlEditor/YamlEditor.tsx +++ b/src/components/YamlEditor/YamlEditor.tsx @@ -1,20 +1,20 @@ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect } from "react" -import AceEditor from "react-ace"; -import "ace-builds/src-noconflict/theme-github"; -import "ace-builds/src-noconflict/ext-language_tools"; +import AceEditor from "react-ace" +import "ace-builds/src-noconflict/theme-github" +import "ace-builds/src-noconflict/ext-language_tools" -import "ace-builds/webpack-resolver"; -import "ace-builds/src-noconflict/mode-yaml"; +import "ace-builds/webpack-resolver" +import "ace-builds/src-noconflict/mode-yaml" -import jsYaml from "js-yaml"; +import jsYaml from "js-yaml" -import Ajv from "ajv"; -const ajv = new Ajv({ allErrors: true }); +import Ajv from "ajv" +const ajv = new Ajv({ allErrors: true }) -import Schema from "../../../static/schema/schema.v2.json"; +import Schema from "../../../static/schema/schema.v2.json" -const validate = ajv.compile(Schema.definitions.schema); +const validate = ajv.compile(Schema.definitions.schema) const initialValue = `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json language: "en-US" early_access: false @@ -30,130 +30,129 @@ reviews: drafts: false chat: auto_reply: true -`; +` export default function YamlEditor() { - const [value, setValue] = useState(initialValue); - const [annotations, setAnnotations] = useState([]); - - useEffect(() => { - setValue(initialValue); - validateAndSetAnnotations(initialValue); - }, []); - - function validateAndSetAnnotations(yaml) { - try { - const doc = jsYaml.load(yaml, { strict: true }); - const isValid = validate(doc); - - if (!isValid && validate.errors) { - setAnnotations( - validate.errors.map((err) => { - const instancePathArr = err?.instancePath?.split("/"); - const key = - instancePathArr && instancePathArr[instancePathArr.length - 1]; - return { - row: err.instancePath ? getLineNumber(yaml, err.instancePath) : 0, - column: 0, - text: `${key}: ${err.message} ${ - err?.params?.allowedValues - ? `Allowed values: ${err.params.allowedValues.join(", ")}` - : "" - }`, - type: "error", - }; - }) - ); - } else { - setAnnotations([]); - } - } catch (err) { - const instancePathArr = err?.instancePath?.split("/"); - const key = - instancePathArr && instancePathArr[instancePathArr.length - 1]; - - setAnnotations([ - { - row: err.instancePath ? getLineNumber(yaml, err.instancePath) : 0, - column: 0, - text: - `${key}: ${err.message} ${ - err?.params?.allowedValues - ? `Allowed values: ${err.params.allowedValues.join(", ")}` - : "" - }` || "YAML parsing error", - type: "error", - }, - ]); - } - } - - function getLineNumber(yaml, instancePath) { - const lines = yaml.split("\n"); - const pathParts = instancePath.split("/").filter(Boolean); - let currentObj = jsYaml.load(yaml); - let lineNumber = 0; - - const lastPathPart = pathParts[pathParts.length - 1]; - const lastPathPartIndex = pathParts.length - 1; - - for (let i = 0; i < lines.length; i++) { - if (lines[i].trim().startsWith(pathParts[0] + ":")) { - // Found the top-level field - lineNumber = i; - currentObj = currentObj[pathParts[0]]; - - for (let j = 1; j < lastPathPartIndex; j++) { - // Go through the nested fields - for (let k = lineNumber + 1; k < lines.length; k++) { - if (lines[k].trim().startsWith(pathParts[j] + ":")) { - lineNumber = k; - currentObj = currentObj[pathParts[j]]; - break; - } - } - } - - // look for the last path part with array syntax as well as object syntax - for (let l = lineNumber + 1; l < lines.length; l++) { - if (lines[l].trim().startsWith(`- ${lastPathPart}:`)) { - lineNumber = l; - break; - } else if (lines[l].trim().startsWith(lastPathPart + ":")) { - lineNumber = l; - break; - } - } - break; - } - } - - return lineNumber; - } - - function onChange(newValue) { - setValue(newValue); - validateAndSetAnnotations(newValue); - } - - return ( -
- -
-
- ); + const [value, setValue] = useState(initialValue) + const [annotations, setAnnotations] = useState([]) + + useEffect(() => { + setValue(initialValue) + validateAndSetAnnotations(initialValue) + }, []) + + function validateAndSetAnnotations(yaml) { + try { + const doc = jsYaml.load(yaml, { strict: true }) + const isValid = validate(doc) + + if (!isValid && validate.errors) { + setAnnotations( + validate.errors.map(err => { + const instancePathArr = err?.instancePath?.split("/") + const key = + instancePathArr && instancePathArr[instancePathArr.length - 1] + return { + row: err.instancePath ? getLineNumber(yaml, err.instancePath) : 0, + column: 0, + text: `${key}: ${err.message} ${ + err?.params?.allowedValues + ? `Allowed values: ${err.params.allowedValues.join(", ")}` + : "" + }`, + type: "error", + } + }), + ) + } else { + setAnnotations([]) + } + } catch (err) { + const instancePathArr = err?.instancePath?.split("/") + const key = instancePathArr && instancePathArr[instancePathArr.length - 1] + + setAnnotations([ + { + row: err.instancePath ? getLineNumber(yaml, err.instancePath) : 0, + column: 0, + text: + `${key}: ${err.message} ${ + err?.params?.allowedValues + ? `Allowed values: ${err.params.allowedValues.join(", ")}` + : "" + }` || "YAML parsing error", + type: "error", + }, + ]) + } + } + + function getLineNumber(yaml, instancePath) { + const lines = yaml.split("\n") + const pathParts = instancePath.split("/").filter(Boolean) + let currentObj = jsYaml.load(yaml) + let lineNumber = 0 + + const lastPathPart = pathParts[pathParts.length - 1] + const lastPathPartIndex = pathParts.length - 1 + + for (let i = 0; i < lines.length; i++) { + if (lines[i].trim().startsWith(pathParts[0] + ":")) { + // Found the top-level field + lineNumber = i + currentObj = currentObj[pathParts[0]] + + for (let j = 1; j < lastPathPartIndex; j++) { + // Go through the nested fields + for (let k = lineNumber + 1; k < lines.length; k++) { + if (lines[k].trim().startsWith(pathParts[j] + ":")) { + lineNumber = k + currentObj = currentObj[pathParts[j]] + break + } + } + } + + // look for the last path part with array syntax as well as object syntax + for (let l = lineNumber + 1; l < lines.length; l++) { + if (lines[l].trim().startsWith(`- ${lastPathPart}:`)) { + lineNumber = l + break + } else if (lines[l].trim().startsWith(lastPathPart + ":")) { + lineNumber = l + break + } + } + break + } + } + + return lineNumber + } + + function onChange(newValue) { + setValue(newValue) + validateAndSetAnnotations(newValue) + } + + return ( +
+ +
+
+ ) } diff --git a/src/css/custom.css b/src/css/custom.css index 767d9410..fec0e271 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -9,140 +9,140 @@ /* You can override the default Infima variables here. */ :root { - --ifm-color-primary: #ff4702; - --ifm-color-primary-dark: #29784c; - --ifm-color-primary-darker: #277148; - --ifm-color-primary-darkest: #205d3b; - --ifm-color-primary-light: #33925d; - --ifm-color-primary-lighter: #359962; - --ifm-color-primary-lightest: #3cad6e; - --ifm-code-font-size: 95%; - --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); - --ifm-navbar-height: 5rem; + --ifm-color-primary: #ff4702; + --ifm-color-primary-dark: #29784c; + --ifm-color-primary-darker: #277148; + --ifm-color-primary-darkest: #205d3b; + --ifm-color-primary-light: #33925d; + --ifm-color-primary-lighter: #359962; + --ifm-color-primary-lightest: #3cad6e; + --ifm-code-font-size: 95%; + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); + --ifm-navbar-height: 5rem; } /* For readability concerns, you should choose a lighter palette in dark mode. */ [data-theme="dark"] { - --ifm-color-primary: #ff4702; - --ifm-color-primary-dark: #21af90; - --ifm-color-primary-darker: #1fa588; - --ifm-color-primary-darkest: #1a8870; - --ifm-color-primary-light: #29d5b0; - --ifm-color-primary-lighter: #32d8b4; - --ifm-color-primary-lightest: #4fddbf; - --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); + --ifm-color-primary: #ff4702; + --ifm-color-primary-dark: #21af90; + --ifm-color-primary-darker: #1fa588; + --ifm-color-primary-darkest: #1a8870; + --ifm-color-primary-light: #29d5b0; + --ifm-color-primary-lighter: #32d8b4; + --ifm-color-primary-lightest: #4fddbf; + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); } .navbar .navbar__item { - align-items: center; - display: flex; - font-size: 1.25rem; - font-weight: 700; + align-items: center; + display: flex; + font-size: 1.25rem; + font-weight: 700; } a[docid="docs"] > svg { - display: none; + display: none; } /* Adjustments for mobile view */ @media (max-width: 768px) { - /* Reduce the logo size for smaller screens */ - .navbar__logo img { - height: 32px; - align-items: center; - } + /* Reduce the logo size for smaller screens */ + .navbar__logo img { + height: 32px; + align-items: center; + } - /* Reduce the padding around the logo for smaller screens */ - .navbar__logo { - padding: 2px; /* Adjust the padding for smaller screens */ - } + /* Reduce the padding around the logo for smaller screens */ + .navbar__logo { + padding: 2px; /* Adjust the padding for smaller screens */ + } } /* Center the Discord link within its parent */ .navbar__items.navbar__items--right { - display: flex; - justify-content: center; - align-items: center; + display: flex; + justify-content: center; + align-items: center; } @media screen and (max-width: 480px) { - a.navbar__item.navbar__link[docid="docs"] { - display: none !important; - } + a.navbar__item.navbar__link[docid="docs"] { + display: none !important; + } } @media screen and (max-width: 480px) { - a.navbar__item.navbar__link[href="https://blog.coderabbit.ai/blog"] - { - display: none; - } + a.navbar__item.navbar__link[href="https://blog.coderabbit.ai/blog"] + { + display: none; + } } [data-theme="light"] img[src$="#gh-dark-mode-only"], [data-theme="dark"] img[src$="#gh-light-mode-only"] { - display: none; + display: none; } .video-container { - position: relative; - padding-bottom: 56.25%; /* 16:9 aspect ratio */ - height: 0; - overflow: hidden; - max-width: 100%; - background: #000; + position: relative; + padding-bottom: 56.25%; /* 16:9 aspect ratio */ + height: 0; + overflow: hidden; + max-width: 100%; + background: #000; } .video-container iframe { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; } .navbar .navbar__item { - align-items: center; - display: flex; - font-size: 1.25rem; - font-weight: 700; + align-items: center; + display: flex; + font-size: 1.25rem; + font-weight: 700; } a[docid="docs"] > svg { - display: none; + display: none; } /* Adjustments for mobile view */ @media (max-width: 768px) { - /* Reduce the logo size for smaller screens */ - .navbar__logo img { - height: 32px; - align-items: center; - } + /* Reduce the logo size for smaller screens */ + .navbar__logo img { + height: 32px; + align-items: center; + } - /* Reduce the padding around the logo for smaller screens */ - .navbar__logo { - padding: 2px; /* Adjust the padding for smaller screens */ - } + /* Reduce the padding around the logo for smaller screens */ + .navbar__logo { + padding: 2px; /* Adjust the padding for smaller screens */ + } } /* Center the Discord link within its parent */ .navbar__items.navbar__items--right { - display: flex; - justify-content: center; - align-items: center; + display: flex; + justify-content: center; + align-items: center; } @media screen and (max-width: 480px) { - a.navbar__item.navbar__link[docid="docs"] { - display: none !important; - } + a.navbar__item.navbar__link[docid="docs"] { + display: none !important; + } } @media screen and (max-width: 480px) { - a.navbar__item.navbar__link[href="https://blog.coderabbit.ai/blog"] - { - display: none; - } + a.navbar__item.navbar__link[href="https://blog.coderabbit.ai/blog"] + { + display: none; + } } /* Light mode Discord icon */ diff --git a/src/pages/index.module.css b/src/pages/index.module.css index b1fb774d..d7160c1b 100644 --- a/src/pages/index.module.css +++ b/src/pages/index.module.css @@ -4,20 +4,20 @@ */ .heroBanner { - padding: 4rem 0; - text-align: center; - position: relative; - overflow: hidden; + padding: 4rem 0; + text-align: center; + position: relative; + overflow: hidden; } @media screen and (max-width: 996px) { - .heroBanner { - padding: 2rem; - } + .heroBanner { + padding: 2rem; + } } .buttons { - display: flex; - align-items: center; - justify-content: center; + display: flex; + align-items: center; + justify-content: center; } diff --git a/src/theme/BlogPostItem/index.js b/src/theme/BlogPostItem/index.js index 6488a635..61ff84be 100644 --- a/src/theme/BlogPostItem/index.js +++ b/src/theme/BlogPostItem/index.js @@ -1,32 +1,32 @@ -import { useBlogPost } from "@docusaurus/theme-common/internal"; -import { AiDisclaimer } from "@site/src/components/AiDisclaimer"; -import BlogPostItem from "@theme-original/BlogPostItem"; -import { DiscussionEmbed } from "disqus-react"; +import { useBlogPost } from "@docusaurus/theme-common/internal" +import { AiDisclaimer } from "@site/src/components/AiDisclaimer" +import BlogPostItem from "@theme-original/BlogPostItem" +import { DiscussionEmbed } from "disqus-react" export default function BlogPostItemWrapper(props) { - // useBlogPost is a hook provided by Docusaurus to access blog post metadata and context - const { metadata, isBlogPostPage } = useBlogPost(); - // Extract necessary properties from the metadata - const { frontMatter, slug, title } = metadata; - // Check if comments are enabled in the front matter (default to true if not specified) - // Check if ai disclaimer should be shown or not (default to true if not specified) - const { comments = true, aiDisclaimer = true } = frontMatter; + // useBlogPost is a hook provided by Docusaurus to access blog post metadata and context + const { metadata, isBlogPostPage } = useBlogPost() + // Extract necessary properties from the metadata + const { frontMatter, slug, title } = metadata + // Check if comments are enabled in the front matter (default to true if not specified) + // Check if ai disclaimer should be shown or not (default to true if not specified) + const { comments = true, aiDisclaimer = true } = frontMatter - return ( - <> - - {isBlogPostPage && aiDisclaimer && } - {isBlogPostPage && comments && ( - - )} - - ); + return ( + <> + + {isBlogPostPage && aiDisclaimer && } + {isBlogPostPage && comments && ( + + )} + + ) } diff --git a/src/theme/Footer/index.js b/src/theme/Footer/index.js index ca747376..832683aa 100644 --- a/src/theme/Footer/index.js +++ b/src/theme/Footer/index.js @@ -1,132 +1,143 @@ -import OriginalFooter from "@theme-original/Footer"; -import React from "react"; +import OriginalFooter from "@theme-original/Footer" +import React from "react" // Create your custom Footer component by extending the original Footer function CustomFooter(props) { - // You can add your custom JSX or styles here - return ( -
- {/* Include original Footer props */} - {/* Add your custom content here */} -
-
-
-
- -
- CodeRabbit -
-
-
- CodeRabbit is an innovative, AI-driven platform that transforms - the way code reviews are done. Its automated reviews elevate the - code quality while significantly reducing the time and effort tied - to extensive manual code reviews. -
-
- The platform offers insightful, line-by-line feedback on code - changes, suggesting improvements and corrections that can enhance - the efficiency and robustness of the code. -
-
- -
-
-
-
- CodeRabbit © {new Date().getFullYear()} -
- -
-
-
- ); + // You can add your custom JSX or styles here + return ( +
+ {/* Include original Footer props */} + {/* Add your custom content here */} +
+
+
+
+ +
+ CodeRabbit +
+
+
+ CodeRabbit is an innovative, AI-driven platform that transforms + the way code reviews are done. Its automated reviews elevate the + code quality while significantly reducing the time and effort tied + to extensive manual code reviews. +
+
+ The platform offers insightful, line-by-line feedback on code + changes, suggesting improvements and corrections that can enhance + the efficiency and robustness of the code. +
+
+ +
+
+
+
+ CodeRabbit © {new Date().getFullYear()} +
+ +
+
+
+ ) } export default function CustomFooterWrapper(props) { - return ( - - - - ); + return ( + + + + ) } diff --git a/static/schema/reporting.json b/static/schema/reporting.json index bcce0369..bb34aa75 100644 --- a/static/schema/reporting.json +++ b/static/schema/reporting.json @@ -3,9 +3,7 @@ "properties": { "scheduleRange": { "type": "string", - "enum": [ - "Dates" - ] + "enum": ["Dates"] }, "from": { "type": "string", @@ -34,19 +32,11 @@ "properties": { "parameter": { "type": "string", - "enum": [ - "REPOSITORY", - "LABEL", - "TEAM", - "USER" - ] + "enum": ["REPOSITORY", "LABEL", "TEAM", "USER"] }, "operator": { "type": "string", - "enum": [ - "IN", - "ALL" - ] + "enum": ["IN", "ALL"] }, "values": { "type": "array", @@ -55,39 +45,20 @@ } } }, - "required": [ - "parameter", - "operator", - "values" - ], + "required": ["parameter", "operator", "values"], "additionalProperties": false } }, "groupBy": { "type": "string", - "enum": [ - "NONE", - "REPOSITORY", - "LABEL", - "TEAM", - "USER" - ] + "enum": ["NONE", "REPOSITORY", "LABEL", "TEAM", "USER"] }, "subgroupBy": { "type": "string", - "enum": [ - "NONE", - "REPOSITORY", - "LABEL", - "TEAM", - "USER" - ] + "enum": ["NONE", "REPOSITORY", "LABEL", "TEAM", "USER"] } }, - "required": [ - "from", - "to" - ], + "required": ["from", "to"], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } diff --git a/tailwind.config.js b/tailwind.config.js index d89c59f3..e47142da 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,22 +1,22 @@ // tailwind.config.js /** @type {import('tailwindcss').Config} */ module.exports = { - corePlugins: { - preflight: false, // disable Tailwind's reset - }, - content: ["./src/**/*.{js,jsx,ts,tsx}", "../docs/**/*.mdx"], // my markdown stuff is in ../docs, not /src - darkMode: ["class", '[data-theme="dark"]'], // hooks into docusaurus' dark mode settigns - theme: { - fontFamily: { - figtree: ["Figtree", "sans-serif"], - satoshi: ["Satoshi", "Satoshi Placeholder", "sans-serif"], - }, - extend: { - colors: { - customGray: "rgb(189, 189, 189)", - customWhite: "rgb(255, 255, 255)", - }, - }, - }, - plugins: [], -}; + corePlugins: { + preflight: false, // disable Tailwind's reset + }, + content: ["./src/**/*.{js,jsx,ts,tsx}", "../docs/**/*.mdx"], // my markdown stuff is in ../docs, not /src + darkMode: ["class", '[data-theme="dark"]'], // hooks into docusaurus' dark mode settigns + theme: { + fontFamily: { + figtree: ["Figtree", "sans-serif"], + satoshi: ["Satoshi", "Satoshi Placeholder", "sans-serif"], + }, + extend: { + colors: { + customGray: "rgb(189, 189, 189)", + customWhite: "rgb(255, 255, 255)", + }, + }, + }, + plugins: [], +} diff --git a/tsconfig.json b/tsconfig.json index 6cc8cddd..bab806a7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,15 +1,15 @@ { - // This file is not used in compilation. It is here just for a nice editor experience. - "extends": "@docusaurus/tsconfig", - "compilerOptions": { - "baseUrl": ".", - "resolveJsonModule": true, - // Extending "@tsconfig/docusaurus/tsconfig.json".types with "docusaurus-json-schema-plugin" - "types": [ - "node", - "@docusaurus/module-type-aliases", - "@docusaurus/theme-classic", - "docusaurus-json-schema-plugin" - ] - } + // This file is not used in compilation. It is here just for a nice editor experience. + "extends": "@docusaurus/tsconfig", + "compilerOptions": { + "baseUrl": ".", + "resolveJsonModule": true, + // Extending "@tsconfig/docusaurus/tsconfig.json".types with "docusaurus-json-schema-plugin" + "types": [ + "node", + "@docusaurus/module-type-aliases", + "@docusaurus/theme-classic", + "docusaurus-json-schema-plugin" + ] + } }