From 578a3ae34f58c33ea989a2f97cb05ca9eb37131b Mon Sep 17 00:00:00 2001 From: Zahid Ali Date: Mon, 20 Jan 2025 21:54:36 +0500 Subject: [PATCH 01/11] Added redirects middleware (#880) ## Pull Request approval You will need to get your PR approved by at least one member of the Sourcegraph team. For reviews of docs formatting, styles, and component usage, please tag the docs team via the #docs Slack channel. --------- Co-authored-by: Maedah Batool --- .../{commands.mdx => prompts.mdx} | 0 next.config.js | 60 ++++++------- src/data/navigation.ts | 2 +- src/data/redirects.ts | 14 +++ src/middleware.ts | 88 +++++++++++++++++++ 5 files changed, 133 insertions(+), 31 deletions(-) rename docs/cody/capabilities/{commands.mdx => prompts.mdx} (100%) create mode 100644 src/middleware.ts diff --git a/docs/cody/capabilities/commands.mdx b/docs/cody/capabilities/prompts.mdx similarity index 100% rename from docs/cody/capabilities/commands.mdx rename to docs/cody/capabilities/prompts.mdx diff --git a/next.config.js b/next.config.js index 85bf27ef0..b521a8d58 100644 --- a/next.config.js +++ b/next.config.js @@ -14,36 +14,36 @@ const nextConfig = { // https://vercel.com/docs/projects/environment-variables/system-environment-variables // basePath: process.env.VERCEL_ENV === 'production' ? '/docs' : '', basePath: '/docs', - async redirects() { - return [ - ...updatedRedirectsData, - { - source: `/v/${config.DOCS_LATEST_VERSION}/:slug*`, - destination: `https://sourcegraph.com/docs/:slug*`, - permanent: false - }, - { - source: `/@${config.DOCS_LATEST_VERSION}/:slug*`, - destination: `https://sourcegraph.com/docs/:slug*`, - permanent: false - }, - { - source: '/v/:version(\\d+\\.\\d+)/:slug*', - destination: 'https://:version.sourcegraph.com/:slug*', - permanent: true - }, - { - source: '/@:version(\\d+\\.\\d+)/:slug*', - destination: 'https://:version.sourcegraph.com/:slug*', - permanent: true - }, - { - source: '/changelog.rss', - destination: '/technical-changelog.rss', - permanent: true - } - ]; - } + // async redirects() { + // return [ + // ...updatedRedirectsData, + // { + // source: `/v/${config.DOCS_LATEST_VERSION}/:slug*`, + // destination: `https://sourcegraph.com/docs/:slug*`, + // permanent: false + // }, + // { + // source: `/@${config.DOCS_LATEST_VERSION}/:slug*`, + // destination: `https://sourcegraph.com/docs/:slug*`, + // permanent: false + // }, + // { + // source: '/v/:version(\\d+\\.\\d+)/:slug*', + // destination: 'https://:version.sourcegraph.com/:slug*', + // permanent: true + // }, + // { + // source: '/@:version(\\d+\\.\\d+)/:slug*', + // destination: 'https://:version.sourcegraph.com/:slug*', + // permanent: true + // }, + // { + // source: '/changelog.rss', + // destination: '/technical-changelog.rss', + // permanent: true + // } + // ]; + // } }; module.exports = async () => { diff --git a/src/data/navigation.ts b/src/data/navigation.ts index fb8e6bd91..3f5e48333 100644 --- a/src/data/navigation.ts +++ b/src/data/navigation.ts @@ -55,7 +55,7 @@ export const navigation: NavigationItem[] = [ subsections: [ { title: "Chat", href: "/cody/capabilities/chat", }, { title: "Autocomplete", href: "/cody/capabilities/autocomplete", }, - { title: "Prompts", href: "/cody/capabilities/commands", }, + { title: "Prompts", href: "/cody/capabilities/prompts", }, { title: "OpenCtx", href: "/cody/capabilities/openctx", }, { title: "Debug Code", href: "/cody/capabilities/debug-code", }, { title: "Context Filters", href: "/cody/capabilities/ignore-context", }, diff --git a/src/data/redirects.ts b/src/data/redirects.ts index c6e331297..eeddb73bf 100644 --- a/src/data/redirects.ts +++ b/src/data/redirects.ts @@ -6717,6 +6717,20 @@ const redirectsData = [ destination: "/code-search/code-navigation/inference_configuration", permanent: true }, + // Model Config docs + { + source: "/cody/clients/model-configuration", + destination: "/cody/enterprise/model-configuration", + permanent: true + }, + + //Commands redirects + { + source: "/cody/capabilities/commands", + destination: "/cody/capabilities/prompts", + permanent: true + }, + ]; diff --git a/src/middleware.ts b/src/middleware.ts new file mode 100644 index 000000000..ea508acda --- /dev/null +++ b/src/middleware.ts @@ -0,0 +1,88 @@ +import { NextResponse } from 'next/server' +import type { NextRequest } from 'next/server' +import docsConfig from '../docs.config.js' + +const { updatedRedirectsData } = require('./data/redirects.ts'); + +function createRedirectUrl(request: NextRequest, destination: string, path: string): string { + // Handle absolute URLs + if (destination.startsWith('http')) { + // Handle dynamic slug replacements + if (destination.includes(':slug')) { + const slugMatch = path.match(/[^/]+$/) + const slug = slugMatch ? slugMatch[0] : '' + destination = destination.replace(':slug*', slug) + } + // Handle version replacements + if (destination.includes(':version')) { + const versionMatch = path.match(/\d+\.\d+/) + const version = versionMatch ? versionMatch[0] : '' + destination = destination.replace(':version', version) + } + + return destination + } + + // Handle relative paths + const basePath = '/docs' + return destination.startsWith('/') ? + `${request.nextUrl.origin}${basePath}${destination}` : + `${request.nextUrl.origin}${basePath}/${destination}` +} + +export function middleware(request: NextRequest) { + const path = request.nextUrl.pathname + const pathWithoutBase = path.replace('/docs', '') + + // Handle base redirects from redirects.ts + const redirect = updatedRedirectsData.find((r: any) => r.source === pathWithoutBase) + if (redirect) { + return NextResponse.redirect(createRedirectUrl(request, redirect.destination, path)) + } + // Handle version without slug + const versionOnlyMatch = pathWithoutBase.match(/^\/v\/(\d+\.\d+)$/) + if (versionOnlyMatch) { + return NextResponse.redirect(`https://${versionOnlyMatch[1]}.sourcegraph.com/`) + } + // Handle version-specific redirects + if (pathWithoutBase.startsWith(`/v/${docsConfig.DOCS_LATEST_VERSION}/`)) { + return NextResponse.redirect(createRedirectUrl( + request, + `https://sourcegraph.com/docs/:slug*`, + pathWithoutBase + )) + } + if (pathWithoutBase.startsWith(`/@${docsConfig.DOCS_LATEST_VERSION}/`)) { + return NextResponse.redirect(createRedirectUrl( + request, + `https://sourcegraph.com/docs/:slug*`, + pathWithoutBase + )) + } + const versionMatch = pathWithoutBase.match(/^\/v\/(\d+\.\d+)\/(.*)/) + if (versionMatch) { + return NextResponse.redirect(createRedirectUrl( + request, + 'https://:version.sourcegraph.com/:slug*', + pathWithoutBase + )) + } + const atVersionMatch = pathWithoutBase.match(/^\/@(\d+\.\d+)\/(.*)/) + if (atVersionMatch) { + return NextResponse.redirect(createRedirectUrl( + request, + 'https://:version.sourcegraph.com/:slug*', + pathWithoutBase + )) + } + if (pathWithoutBase === '/changelog.rss') + return NextResponse.redirect(createRedirectUrl(request, '/technical-changelog.rss', path)) + + return NextResponse.next() +} + +export const config = { + matcher: [ + '/((?!api|_next/static|_next/image|assets|favicon.ico|sw.js).*)', + ], +} From b3890e926404deb312ddd1fed4e9fcdff3d6bbbc Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 20 Jan 2025 11:37:25 -0800 Subject: [PATCH 02/11] feat: documentation for upgrading the single server container image to postgresql16 (#896) Completes documentation for a [PR](https://github.com/sourcegraph/sourcegraph/pull/2711) ## Pull Request approval You will need to get your PR approved by at least one member of the Sourcegraph team. For reviews of docs formatting, styles, and component usage, please tag the docs team via the #docs Slack channel. --- .../deploy/docker-single-container/index.mdx | 55 +++++++++++++++---- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/docs/admin/deploy/docker-single-container/index.mdx b/docs/admin/deploy/docker-single-container/index.mdx index b5da2f516..ab0090331 100644 --- a/docs/admin/deploy/docker-single-container/index.mdx +++ b/docs/admin/deploy/docker-single-container/index.mdx @@ -138,10 +138,34 @@ SELECT * FROM users; ## Upgrade +### Postgresql 16 > Warning: The 5.11 release updates the database container images from Postgres 12 to Postgres 16. Customers are advised to have a database backup before upgrading! See our [postgres 12 end of life](https://sourcegraph.com/docs/admin/postgres12_end_of_life_notice#postgres-12-end-of-life) notice! + +From sourcegraph version 5.11 onwards, the Sourcegraph single container Docker image uses Postgresql 16. Upgrading from Postgresql 12 to Postgresql 16 is a manual process, that is similar to the one outlined below for multi-version upgrades, but migrator has been merged into the container, allowing for a simpler upgrade. + +> NOTE: It is highly recommended to **take an up-to-date snapshot of your databases** prior to starting a multi-version upgrade. The upgrade process aggressively mutates the shape and contents of your database, and undiscovered errors in the migration process or unexpected environmental differences may cause an unusable instance or data loss. > -> Single-container *does not* support auto migration to postgres 16. If you are planning to upgrade to 5.11.0 and beyond on single-container, you will need to dump the postgres databases and restore them after the upgrade. -> In this event, we highly recommend you migrate to a production supported deployment method, or switch to our cloud offering. +> We recommend performing the entire upgrade procedure on an idle clone of the production instance and switch traffic over on success, if possible. This may be low-effort for installations with a canary environment or a blue/green deployment strategy. +> +> **If you do not feel confident running this process solo**, contact customer support team to help guide you thorough the process. + +**Before performing a multi-version upgrade**: + +- Read our [update policy](/admin/updates/#update-policy) to learn about Sourcegraph updates. +- Find the entries that apply to the version range you're passing through in the [update notes for Sourcegraph with Docker Single Container](/admin/updates/server#multi-version-upgrade-procedure). + +0. You must first shutdown the container instance via `docker stop [CONTAINER]`. +1. Start a temporary Postgres container on top of the Postgres data directory used by the old `sourcegraph/server` image. You must use the *new* postgresql-16-codeinsights image, which is based on the new Postgresql 16 image, and provides an automatic upgrade script to move from Postgresql 12 to Postgresql 16. + +`docker run --rm -it -v ~/.sourcegraph/data/postgresql:/data/pgdata-12 -e POSTGRES_USER=postgres -p 5432:5432 sourcegraph/postgresql-16-codeinsights:{CURRENT_VERSION_NO_V}` + +2. Once that temporary container marks that Postgresql has started, the migration is complete and you can stop the temporary container. +3. Start the new `sourcegraph/server` container. + +`docker run --publish 7080:7080 --publish 127.0.0.1:3370:3370 --rm --volume ~/.sourcegraph/config:/etc/sourcegraph --volume ~/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:{CURRENT_VERSION_NO_V}` + +You now have a single server Sourcegraph container image running on Postgresql 16. + ### Standard upgrades @@ -156,6 +180,16 @@ To update, just use the newer `sourcegraph/server:N.N.N` Docker image (where `N. ### Multi-version upgrades +> NOTE: It is no longer necessary to run Migrator outside of the single instance container. Migrator is now built into the container, and will be run via the `sourcegraph/server` image. +> +> We **still** recommend performing the entire upgrade procedure on an idle clone of the production instance and switch traffic over on success, if possible. This may be low-effort for installations with a canary environment or a blue/green deployment strategy. +> +> The below docs are kept for posterity for users on older versions of Sourcegraph that are looking to upgrade or run the migrator tool. + +To update, just use the newer `sourcegraph/server:N.N.N` Docker image in place of the older one, using the same Docker volumes. Your server's data will be migrated automatically if needed. You can always find the version number details of the latest release via the [technical changelog](/technical-changelog). + +### (Legacy) Multi-version upgrades + A [multi-version upgrade](/admin/updates/#multi-version-upgrades) is a downtime-incurring upgrade from version 3.20 or later to any future version. Multi-version upgrades will run both schema and data migrations to ensure the data available from the instance remains available post-upgrade. > NOTE: It is highly recommended to **take an up-to-date snapshot of your databases** prior to starting a multi-version upgrade. The upgrade process aggressively mutates the shape and contents of your database, and undiscovered errors in the migration process or unexpected environmental differences may cause an unusable instance or data loss. @@ -218,21 +252,22 @@ For example, `${PATH}` is `~/.sourcegraph/data` in `-v ~/.sourcegraph/data:/var/ ```sh $ docker run --rm -it \ - -v ${PATH}/postgresql:/data/pgdata-${PG_VERSION} \ + -v ${PATH}/postgresql:/data/pgdata-12 \ -u 70 \ -p 5432:5432 \ --entrypoint bash \ - sourcegraph/postgres-${PG_VERSION_TAG}:${SG_VERSION} \ - -c 'echo "host all all 0.0.0.0/0 trust" >> /data/pgdata-${PG_VERSION}/pg_hba.conf && postgres -c l listen_addresses="*" -D /data/pgdata-${PG_VERSION}' + sourcegraph/${PG_VERSION_TAG}:${SG_VERSION} \ + -c 'echo "host all all 0.0.0.0/0 trust" >> /data/pgdata-12/pg_hba.conf && postgres -c l listen_addresses="*" -D /data/pgdata-12' ``` The version of this Postgres container is dependent on the version of the instance prior to upgrade. -| `${SG_VERSION}` | `${PG_VERSION}` | `${PG_VERSION_TAG}` | -| ------------------- | --------------- | ------------------- | -| `3.20.X` - `3.29.X` | `12` | `12.6` | -| `3.30.X` - `3.37.X` | `12` | `12.6-alpine` | -| `3.38.X` - | `12` | `12-alpine` | +| `${SG_VERSION}` | `${PG_VERSION_TAG}` | +| ------------------- | ------------------- | +| `3.20.X` - `3.29.X` | `postgres-12.6` | +| `3.30.X` - `3.37.X` | `postgres-12.6-alpine`| +| `3.38.X` - `5.9.X` | `postgres-12-alpine` | +| `5.10.X` - | `postgresql-16` | ## Troubleshooting From 2f7476fcfbab2b8a09176d740905fb4ee0f30767 Mon Sep 17 00:00:00 2001 From: Michael Lin Date: Tue, 21 Jan 2025 10:09:03 -0800 Subject: [PATCH 03/11] cloud: clean up audit logs docs (#906) ## Pull Request approval You will need to get your PR approved by at least one member of the Sourcegraph team. For reviews of docs formatting, styles, and component usage, please tag the docs team via the #docs Slack channel. --- docs/admin/audit_log.mdx | 27 +-------------------------- docs/cloud/index.mdx | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/docs/admin/audit_log.mdx b/docs/admin/audit_log.mdx index 6375c8279..53e4ba577 100644 --- a/docs/admin/audit_log.mdx +++ b/docs/admin/audit_log.mdx @@ -98,33 +98,8 @@ There are two easy approaches to filtering the audit logs: - Message-based: we recommend going the JSON route, but if there's no easy way of parsing JSON using your SIEM or data processing stack, you can filter based on the following string: `auditId`. ### Cloud -[Cloud](/cloud/#audit-logs) - - -Audit Logs are a default feature for Cloud instances, with a standard retention policy of 30 days. Should you wish to -extend this period, please be aware that additional charges will apply. To request an extension, please contact -your assigned Customer Engineer (CE) or send an email to Sourcegraph Support at support@sourcegraph.com. - -#### Access Cloud intance audit logs - -##### Download audit logs ocassionally - -For requesting audit logs, please contact your assigned Sourcegraph representative or our support team. - -##### Instant audit logs access (experimental) - -Sourcegraph LogPush service is streaming audit logs to customer provided destination. - -Features: -- single tenant, dedicated per customer -- streaming only newly created logs -- streaming on schedule, every 1h - -Supported destinations: -- Google Cloud Storage - -If you are interested to use this feature or to stream to a different destination, please contact your assigned Sourcegraph representative or our support team. +For Sourcegraph Cloud customers, please refer to Cloud [documentations](/cloud/#audit-logs). ## Developing diff --git a/docs/cloud/index.mdx b/docs/cloud/index.mdx index ecd2f44de..4f3522138 100644 --- a/docs/cloud/index.mdx +++ b/docs/cloud/index.mdx @@ -151,6 +151,24 @@ To opt out of managed SMTP, please let your Sourcegraph Account team know when r To learn more about how the Sourcegraph team operates managed SMTP internally, refer to [our handbook](https://handbook.sourcegraph.com/departments/cloud/technical-docs/managed-smtp/). +### Audit Logs + +Our Cloud instances provide [audit logs](/admin/audit_log#cloud) to help you monitor and investigate actions taken by users and the system. These logs are available to download by request and are also sent to a [centralized logging service](https://about.sourcegraph.com/security#logging) for 30 day retention. Should you wish to +extend this period, please be aware that additional charges will apply. +To request an extension, please contact your assigned Customer Engineer (CE) or send an email to Sourcegraph Support at support@sourcegraph.com. + +#### Download audit logs + +For requesting audit logs, please contact your our support team. + +#### Deliver audit logs to customer-managed destination (LogPush) + +Sourcegraph LogPush is an optional add-on to deliver audit logs to a customer provided destination. To enable this feature, please contact your assigned Customer Engineer (CE) or support team. + +Supported destinations: + +- Google Cloud Storage (GCS) + ## Requirements ### Business @@ -190,10 +208,6 @@ Only essential Sourcegraph personnel will have access to the instance, server, c All Sourcegraph Cloud instances have Sourcegraph management access enabled by default, and customers may request to disable by contacting your Sourcegraph contact. -### Audit Logs - -Our Cloud instances provide [audit logs](/admin/audit_log#cloud) to help you monitor and investigate actions taken by users and the system. These logs are available to download by request and are also sent to a [centralized logging service](https://about.sourcegraph.com/security#logging) for 30 day retention (configurable for greater periods by request). - ## Accommodating special requirements We may be able to support special requests (network access policies, infrastructure requirements, custom version control systems, etc.) with additional time, support, and fees. [Contact us](https://about.sourcegraph.com/contact/sales) to discuss any special requirements you may have. From 933183f88c3519730e86d487b97f3e2aa54b2f93 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Wed, 22 Jan 2025 23:25:35 +0800 Subject: [PATCH 04/11] chore: Remove 'Indexers' entry from side menu (#907) The Writing an Indexer page is linked from the Precise Code Nav page. It doesn't make sense to link it from the overall Nav with the label 'Indexers' because the 'Indexers' title makes it seems like the page will describe the available indexers. --- docs/code-search/code-navigation/precise_code_navigation.mdx | 2 +- src/data/navigation.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/code-search/code-navigation/precise_code_navigation.mdx b/docs/code-search/code-navigation/precise_code_navigation.mdx index c6a7e1f32..3513a3908 100644 --- a/docs/code-search/code-navigation/precise_code_navigation.mdx +++ b/docs/code-search/code-navigation/precise_code_navigation.mdx @@ -67,6 +67,6 @@ The following repositories have precise code navigation enabled: ## More resources - + diff --git a/src/data/navigation.ts b/src/data/navigation.ts index 3f5e48333..d01a75831 100644 --- a/src/data/navigation.ts +++ b/src/data/navigation.ts @@ -102,7 +102,6 @@ export const navigation: NavigationItem[] = [ { title: "Features", href: "/code-search/code-navigation/features", }, { title: "Search-based code navigation", href: "/code-search/code-navigation/search_based_code_navigation", }, { title: "Precise code navigation", href: "/code-search/code-navigation/precise_code_navigation", }, - { title: "Indexers", href: "/code-search/code-navigation/writing_an_indexer", }, { title: "Auto-indexing", href: "/code-search/code-navigation/auto_indexing", }, { title: "Environment Variables", href: "/code-search/code-navigation/envvars", }, { title: "Troubleshooting", href: "/code-search/code-navigation/troubleshooting", }, From 7f28a519fbe08188fb0a8e91c0f2837fdd2bf51c Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Thu, 23 Jan 2025 02:41:19 +0800 Subject: [PATCH 05/11] chore: Delete old docs for package hosts (#908) Fixing remnants that were not deleted in the previous PR. https://github.com/sourcegraph/docs/pull/724 --- docs/admin/code_hosts/go.mdx | 84 --------------------------- docs/admin/code_hosts/rate_limits.mdx | 6 -- 2 files changed, 90 deletions(-) delete mode 100644 docs/admin/code_hosts/go.mdx diff --git a/docs/admin/code_hosts/go.mdx b/docs/admin/code_hosts/go.mdx deleted file mode 100644 index 4c61e5951..000000000 --- a/docs/admin/code_hosts/go.mdx +++ /dev/null @@ -1,84 +0,0 @@ -# Go dependencies - -This feature is experimental and might change or be removed in the future. - - -Site admins can sync Go modules from any from any Go module proxy, including open source code from proxy.golang.org or a private proxy such as [Athens](https://github.com/gomods/athens), to their Sourcegraph instance so that users can search and navigate the repositories. - -To add Go dependencies to Sourcegraph you need to setup a Go dependencies code host: - -1. As *site admin*: go to **Site admin > Global settings** and enable the experimental feature by adding: `{"experimentalFeatures": {"goPackages": "enabled"} }` -1. As *site admin*: go to **Site admin > Manage code hosts** -1. Select **JVM Dependencies**. -1. Configure the connection by following the instructions above the text field. Additional fields can be added using `Cmd/Ctrl+Space` for auto-completion. See the [configuration documentation below](#configuration). -1. Press **Add repositories**. - -## Repository syncing - -There are currently two ways to sync Go dependency repositories. - -* **Code host configuration**: manually list dependencies in the `"dependencies"` section of the JSON configuration when creating the Go dependency code host. This method can be useful to verify that the credentials are picked up correctly without having to run a dependencies search. - -Sourcegraph tries to find each dependency repository in all configured `"urls"` until it's found. This means you can configure a public proxy first and fallback to a private one second (e.g. `"urls": ["https://proxy.golang.org", "https://admin:foobar@athens.yourcorp.com"]`). - -## Credentials - -Each entry in the `"urls"` array can contain basic auth if needed (e.g. `https://user:password@athens.yourcorp.com`). - -## Rate limiting - -By default, requests to the Go module proxies will be rate-limited -based on a default internal limit. ([source](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/schema/go-modules.schema.json)) - -```json -"rateLimit": { - "enabled": true, - "requestsPerHour": 57600.0 -} -``` - -where the `requestsPerHour` field is set based on your requirements. - -**Not recommended**: Rate-limiting can be turned off entirely as well. -This increases the risk of overloading the proxy. - -```json -"rateLimit": { - "enabled": false -} -``` - -## Configuration - -Go dependencies code host connections support the following configuration options, which are specified in the JSON editor in the site admin "Manage code hosts" area. - -{/*
[View page on our docs](/integration/go) to see rendered content.
*/} - -### admin/code_hosts/go-modules.schema.json - -```json -{ - // An array of strings specifying Go modules to mirror in Sourcegraph. - "dependencies": null, - // Other example values: - // - [ - // "cloud.google.com/go/kms@v1.1.0" - // ] - - // Rate limit applied when making background API requests to the configured Go module proxies. - "rateLimit": { - "enabled": true, - "requestsPerHour": 57600 - }, - - // The list of Go module proxy URLs to fetch modules from. 404 Not found or 410 Gone responses will result in the next URL to be attempted. - "urls": [ - "https://proxy.golang.org" - ] - // Other example values: - // - [ - // "https://athens.mycorp.org", - // "https://proxy.golang.org" - // ] -} -``` diff --git a/docs/admin/code_hosts/rate_limits.mdx b/docs/admin/code_hosts/rate_limits.mdx index b0d1e60d3..c93f14ba4 100644 --- a/docs/admin/code_hosts/rate_limits.mdx +++ b/docs/admin/code_hosts/rate_limits.mdx @@ -72,9 +72,3 @@ Sourcegraph supports internal rate limit configuration for the following connect - [Bitbucket Cloud](/admin/code_hosts/bitbucket_cloud#rateLimit) - [Bitbucket Server](/admin/code_hosts/bitbucket_server#rateLimit) - [Perforce](/admin/repo/perforce#rateLimit) -- [Go Modules](/admin/code_hosts/go#rateLimit) -- [JVM Packages](/admin/code_hosts/jvm#rateLimit) -- [NPM Packages](/admin/code_hosts/npm#rateLimit) -- [Python Packages](/admin/code_hosts/python#rateLimit) -- [Ruby Packages](/admin/code_hosts/ruby#rateLimit) -- [Rust Packages](/admin/code_hosts/rust#rateLimit) From c21af21c719fdac29b8700ec2bb246351fdbb678 Mon Sep 17 00:00:00 2001 From: Justin Dorfman Date: Wed, 22 Jan 2025 11:25:55 -0800 Subject: [PATCH 06/11] Add troubleshooting steps for Kaspersky Antivirus sign-in issue (#908) (#909) The new content provides guidance for users experiencing a stuck sign-in dialog due to Kaspersky Antivirus interference. It includes the problem description, solution steps, and a warning to re-enable protection after signing in. ## Pull Request approval You will need to get your PR approved by at least one member of the Sourcegraph team. For reviews of docs formatting, styles, and component usage, please tag the docs team via the #docs Slack channel. --- docs/cody/faq.mdx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/cody/faq.mdx b/docs/cody/faq.mdx index fee3d1dff..f6637e032 100644 --- a/docs/cody/faq.mdx +++ b/docs/cody/faq.mdx @@ -137,6 +137,22 @@ cody chat --model '$name_of_the_model' -m 'Hi Cody!' For example, to use Claude 3.5 Sonnet, you'd pass the following command in your terminal, `cody chat --model 'claude-3.5-sonnet' -m 'Hi Cody!' +### Sign-in dialog gets stuck with Kaspersky Antivirus + +**Problem:** When attempting to sign in, users may encounter a perpetual `"Signing in to Sourcegraph..."` dialog that never completes. This issue persists across different VS Code extension versions (e.g. 1.40-1.48) and browsers (Chrome, Edge, Firefox). In the browser console at `accounts.sourcegraph.com/sign-in`, you might see an error: `"Uncaught ApolloError: value.toString is not a function"`. + +**Solution:** This issue is typically caused by Kaspersky Antivirus interfering with the authentication process. To resolve: + +- Locate the Kaspersky icon in your system tray +- Right-click on the Kaspersky icon +- Select "Stop Protection" +- Right-click the icon again +- Select "Exit" + + +Once you are signed in make sure to re-enable protection. + + ## OpenAI o1 ### What are OpenAI o1 best practices? From 65a83d4f2ac6c1c4780f2f05ed43bba7e6fd618b Mon Sep 17 00:00:00 2001 From: Michael Bahr Date: Thu, 23 Jan 2025 13:16:41 +0100 Subject: [PATCH 07/11] prompt editor now supports at mentions --- docs/cody/capabilities/prompts.mdx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/cody/capabilities/prompts.mdx b/docs/cody/capabilities/prompts.mdx index 171b5258d..dc679be29 100644 --- a/docs/cody/capabilities/prompts.mdx +++ b/docs/cody/capabilities/prompts.mdx @@ -37,7 +37,7 @@ Click the **New prompt** button from the **Prompt Library** page. - Select the **Owner** and **Prompt Name** - Write a prompt description - Next, fill out the **Prompt template** box with all your prompt instructions -- You can also add dynamic context that will allow your prompt to use content from different sources like current selection and current file +- You can also `@` mention [specific and dynamic context](#specific-and-dynamic-context) that will allow your prompt to use content from different sources like current selection and current file - Select the visibility of the prompt, either **Public** or **Private** - You can mark your prompt as **draft**. Draft prompts are not visible to other users until you publish it - Choose the mode of the prompt, whether it will be **Chat only** or can **Edit code** @@ -90,6 +90,24 @@ Once site admins create tags, other users in your organization can assign tags t You can assign multiple tags to a prompt and group them based on their functionality, category, or any other criteria for your organization. In addition, with tags assigned to prompts, you can filter prompts by tags in the Prompt Library. +## Specific and dynamic context + +The `@` mention menu is available in the prompt editor starting with Sourcegraph 6.0. + +When writing prompts, you can leverage both specific and dynamic context through the `@` mention system. + +![A dropdown appears after typing `@` in the prompt editor.](https://storage.googleapis.com/sourcegraph-assets/Docs/at-mentions-dropdown.png) + +Type `@` to open a dropdown menu that lets you reference specific context like symbols, directories, files, repositories and web URLs. + +When selecting a Web URL, please type out the domain including the https:// prefix, for example https://sourcegraph.com. + +For dynamic context that adapts based on what the user is working on, the prompt editor provides special mentions for the current selection, current file, current repository, current directory, and open tabs. +When a user runs a prompt template containing dynamic context mentions, they are automatically resolved to the appropriate specific context based on the user's current workspace state. +To add dynamic context, please click on one of the buttons below the prompt editor. We will soon move the buttons into the `@` mention menu as well. + +This powerful combination allows prompt authors to create templates that can intelligently access both explicitly defined context as well as contextually relevant information at runtime. + ## Run prompts You can run prompts via: From 6879356e71662d831e05bb41c85cfd1babff5612 Mon Sep 17 00:00:00 2001 From: Michael Bahr <1830132+bahrmichael@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:53:55 +0100 Subject: [PATCH 08/11] Update docs/cody/capabilities/prompts.mdx Co-authored-by: Maedah Batool --- docs/cody/capabilities/prompts.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cody/capabilities/prompts.mdx b/docs/cody/capabilities/prompts.mdx index dc679be29..4af0d858a 100644 --- a/docs/cody/capabilities/prompts.mdx +++ b/docs/cody/capabilities/prompts.mdx @@ -100,7 +100,7 @@ When writing prompts, you can leverage both specific and dynamic context through Type `@` to open a dropdown menu that lets you reference specific context like symbols, directories, files, repositories and web URLs. -When selecting a Web URL, please type out the domain including the https:// prefix, for example https://sourcegraph.com. +When selecting a web URL, type out the domain, including the `https://` prefix, for example, https://sourcegraph.com. For dynamic context that adapts based on what the user is working on, the prompt editor provides special mentions for the current selection, current file, current repository, current directory, and open tabs. When a user runs a prompt template containing dynamic context mentions, they are automatically resolved to the appropriate specific context based on the user's current workspace state. From 216520a1626381cf5271b729a7917807a0f4c7af Mon Sep 17 00:00:00 2001 From: Michael Bahr <1830132+bahrmichael@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:54:01 +0100 Subject: [PATCH 09/11] Update docs/cody/capabilities/prompts.mdx Co-authored-by: Maedah Batool --- docs/cody/capabilities/prompts.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cody/capabilities/prompts.mdx b/docs/cody/capabilities/prompts.mdx index 4af0d858a..af630dcc5 100644 --- a/docs/cody/capabilities/prompts.mdx +++ b/docs/cody/capabilities/prompts.mdx @@ -106,7 +106,7 @@ For dynamic context that adapts based on what the user is working on, the prompt When a user runs a prompt template containing dynamic context mentions, they are automatically resolved to the appropriate specific context based on the user's current workspace state. To add dynamic context, please click on one of the buttons below the prompt editor. We will soon move the buttons into the `@` mention menu as well. -This powerful combination allows prompt authors to create templates that can intelligently access both explicitly defined context as well as contextually relevant information at runtime. +This powerful combination allows prompt authors to create templates that can intelligently access both explicitly defined context and contextually relevant information at runtime. ## Run prompts From 3214423b5d7d941c4553d50b9e51285977db1ff5 Mon Sep 17 00:00:00 2001 From: Michael Bahr <1830132+bahrmichael@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:54:06 +0100 Subject: [PATCH 10/11] Update docs/cody/capabilities/prompts.mdx Co-authored-by: Maedah Batool --- docs/cody/capabilities/prompts.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cody/capabilities/prompts.mdx b/docs/cody/capabilities/prompts.mdx index af630dcc5..721fddd08 100644 --- a/docs/cody/capabilities/prompts.mdx +++ b/docs/cody/capabilities/prompts.mdx @@ -104,7 +104,7 @@ When selecting a web URL, type out the domain, including the `https://` prefix, For dynamic context that adapts based on what the user is working on, the prompt editor provides special mentions for the current selection, current file, current repository, current directory, and open tabs. When a user runs a prompt template containing dynamic context mentions, they are automatically resolved to the appropriate specific context based on the user's current workspace state. -To add dynamic context, please click on one of the buttons below the prompt editor. We will soon move the buttons into the `@` mention menu as well. +To add dynamic context, click on one of the buttons below the prompt editor. We will soon move the buttons into the `@` mention menu as well. This powerful combination allows prompt authors to create templates that can intelligently access both explicitly defined context and contextually relevant information at runtime. From dacb98578ce23d24a6efbe80ab593d8b608fe94d Mon Sep 17 00:00:00 2001 From: Michael Bahr Date: Thu, 23 Jan 2025 16:45:11 +0100 Subject: [PATCH 11/11] beta label --- docs/cody/capabilities/prompts.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cody/capabilities/prompts.mdx b/docs/cody/capabilities/prompts.mdx index 721fddd08..184ac32df 100644 --- a/docs/cody/capabilities/prompts.mdx +++ b/docs/cody/capabilities/prompts.mdx @@ -90,9 +90,9 @@ Once site admins create tags, other users in your organization can assign tags t You can assign multiple tags to a prompt and group them based on their functionality, category, or any other criteria for your organization. In addition, with tags assigned to prompts, you can filter prompts by tags in the Prompt Library. -## Specific and dynamic context +## Specific and dynamic context (beta) -The `@` mention menu is available in the prompt editor starting with Sourcegraph 6.0. +Sourcegraph 6.0 adds beta support for the `@` mention menu in the prompt library. When writing prompts, you can leverage both specific and dynamic context through the `@` mention system.