### Quickstart Guide for Sourcegraph Source: https://5.3.sourcegraph.com/ This section provides a quickstart guide for using Sourcegraph, likely detailing initial setup or common starting points for new users. It links to further resources for getting started with the platform. ```text Quickstart This section likely contains instructions or links to begin using Sourcegraph's features, such as setting up Cody or performing initial code searches. ``` -------------------------------- ### Install scip-java with Java Launcher (Windows) Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html Installs and launches scip-java using the Coursier CLI on Windows. It downloads the Coursier executable and its batch script, then launches scip-java. Arguments after '--' are passed to scip-java. ```batch bitsadmin /transfer downloadCoursierCli https://git.io/coursier-cli "%cd%\coursier" bitsadmin /transfer downloadCoursierBat https://git.io/coursier-bat "%cd%\coursier.bat" ./coursier launch com.sourcegraph:scip-java_2.13:0.11.1 -- --help ``` -------------------------------- ### Getting Started with Sourcegraph Code Intelligence Platform Source: https://sourcegraph.com/docs/getting-started This snippet outlines the initial setup and understanding of Sourcegraph, a Code Intelligence platform designed for deep code understanding across large codebases. It's suitable for companies with a significant number of developers who regularly search, read, or review code. ```text This page will help you learn and understand about Sourcegraph and how to use it. Sourcegraph is a Code Intelligence platform that deeply understands your code, no matter how large or where it's hosted, to power modern developer experiences. In addition to the companies listed on about.sourcegraph.com, companies with a few hundred developers up to those with more than 40,000 use Sourcegraph daily. More specifically, Sourcegraph is great for all developers except: - those on smaller teams with a small amount of code - those who rarely search, read, or review code Why do I need Code Search? Facebook and Google provide their employees with an in-house Sourcegraph ``` -------------------------------- ### Install scip-java with Java Launcher (macOS/Linux) Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html Installs and launches scip-java using the Coursier CLI on macOS and Linux. It downloads the necessary artifacts from Maven Central and makes the scip-java executable available. The command-line arguments after '--' are passed directly to scip-java. ```bash curl -fLo coursier https://git.io/coursier-cli \ && chmod +x coursier \ && ./coursier launch com.sourcegraph:scip-java_2.13:0.11.1 -- --help ``` -------------------------------- ### Getting Started with the REST API Source: https://docs.github.com/en/rest/overview/resources-in-the-rest-api This section covers the foundational aspects of using the GitHub REST API, including an overview, quickstart guide, authentication methods, and best practices for efficient and secure API interactions. ```APIDOC ## Getting Started with the REST API ### Description Learn how to use the GitHub REST API to interact with GitHub resources programmatically. This guide covers initial setup, authentication, and basic usage patterns. ### Method N/A (This is a guide, not a specific endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## Quickstart ### Description Follow this quickstart guide to make your first API request to GitHub. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## About the REST API ### Description This section provides general information about the GitHub REST API, including its versioning, available endpoints, and how it compares to the GraphQL API. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## Using the REST API ### Description This section details how to effectively use the GitHub REST API, covering topics such as rate limits, pagination, available libraries, best practices, and troubleshooting common issues. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## Authentication ### Description Learn about the different methods to authenticate your requests to the GitHub REST API, including personal access tokens and GitHub App authentication, and how to keep your credentials secure. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## Guides ### Description Explore guides on specific use cases for the REST API, such as scripting with JavaScript. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Install and Configure AWS CLI, kubectl, and eksctl Source: https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html Before proceeding with the Amazon EKS setup, ensure you have installed and configured the necessary command-line tools: AWS CLI, kubectl, and eksctl. These tools are essential for interacting with AWS services and Kubernetes clusters. ```text Set up to use Amazon EKS ``` -------------------------------- ### Install scip-java with Java Launcher (Homebrew) Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html Installs scip-java using the Coursier Homebrew formula on macOS. This method simplifies installation by leveraging Homebrew for managing Coursier and then launching scip-java. ```bash brew install coursier/formulas/coursier \ && coursier launch com.sourcegraph:scip-java_2.13:0.11.1 -- --help ``` -------------------------------- ### Create EKS Cluster using eksctl Source: https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html This guide demonstrates the fastest and simplest way to get started with Amazon EKS by using `eksctl`, a command-line utility for cluster creation and management. Upon completion, you will have a functional Amazon EKS cluster ready for application deployment. It assumes the user has set up their AWS environment. ```bash # Example command (actual command not provided in text, this is illustrative) # eksctl create cluster --name my-cluster --region us-west-2 ``` -------------------------------- ### Example of Sourcegraph Configuration (Conceptual) Source: https://sourcegraph.com/docs/getting-started/ This snippet represents a conceptual configuration for Sourcegraph, illustrating how it might be set up. It includes parameters for build ID, asset prefix, and URL routing. This is illustrative and not directly executable code. ```json { "buildId": "oERWjJmi_lzqgcEictRht", "assetPrefix": "/docs", "urlParts": [ "", "getting-started" ], "initialTree": [ "", { "children": [ ["slug", "getting-started", "c"], { "children": [ "__PAGE__", {} ] } ] } ], "initialSeedData": [ "", { "children": [ ["slug", "getting-started", "c"], { "children": [ "__PAGE__", {}, [ ["$La", [ ["$S", "div", null, { "className": "min-w-0 max-w-2xl flex-auto px-4 py-16 lg:max-w-none lg:pl-8 lg:pr-0 xl:px-16", "children": [ ["$S", "$Lb", null, { "path": ["getting-started"] }], ["$S", "article", null, { "children": [ ["$S", "div", null, { "className": "$c", "children": [ ["$S", "h1", null, { "id": "getting-started", "children": [ [ "$S", "a", null, { "href": "#getting-started", "aria-hidden": "true", "tabIndex": "-1", "className": "underline dark:visited:text-[#606060] dark:hover:visited-text-dark-text-secondary text-vermilion-00 dark:text-vermilion-11 hover:text-[#606060] dark:hover:text-dark-text-secondary visited:text-[#4A4A4A] hover:visited:text-[#606060]", "children": [ ["$S", "span", null, {"className": "icon icon-link"}] ] } ], "Getting Started" ] } ] } ] } ] } ]] ] ] } ] } ] } ``` -------------------------------- ### Kustomize Create Command for GKE Source: https://sourcegraph.com/docs/admin/deploy/kubernetes/kustomize/gke This command demonstrates how to use `kustomize create` to set up a new Sourcegraph deployment for GKE, pointing to the example repository for GKE configurations. ```bash $ kustomize create --resources https://github.com/sourcegraph/deploy-sourcegraph-k8s/examples/gke ``` -------------------------------- ### scip-java index command example Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html Demonstrates the basic usage of the `index` command for scip-java. This command is used to generate SCIP index files for a codebase. Running it without any flags is the most common scenario. ```bash $ scip-java index ``` -------------------------------- ### Setting Up Installation Access Tokens Source: https://developer.github.com/v3/guides/managing-deploy-keys/ A step-by-step guide to setting up installation access tokens for your GitHub App. ```APIDOC ## Set Up Installation Access Tokens ### Description This guide outlines the necessary steps to configure and obtain installation access tokens for your GitHub App. ### Steps 1. **Determine App Visibility**: Decide if your GitHub App should be public or private. 2. **Define Permissions**: Specify the required permissions for your GitHub App (e.g., read-only repository contents). 3. **Create GitHub App**: Create your GitHub App via your organization's settings page. Note your GitHub App `id`. 4. **Generate Private Key**: Download your GitHub App's private key and store it securely. 5. **Install App**: Install your GitHub App on the target repositories or organization. 6. **Identify Installation ID**: Obtain the `installation_id` for the connection between your GitHub App and the organization's repositories. This can be done using the `Get an organization installation for the authenticated app` API endpoint, which requires authenticating as a GitHub App using a JWT. 7. **Generate Access Token**: Create an installation access token using the `Create an installation access token for an app` REST API endpoint. This also requires authenticating as a GitHub App using a JWT. ``` -------------------------------- ### Customize scip-java index Build Command Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html This example shows how to customize the build command used by `scip-java index` by appending additional arguments after `--`. This allows for specific build tool configurations, such as overriding the default Maven goal. ```bash # Example: use `mvn package` instead of `mvn verify` scip-java index -- --batch-mode -DskipTests package ``` -------------------------------- ### Build scip-java Fat Jar (macOS/Linux) Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html Builds a standalone scip-java executable fat jar on macOS and Linux using Coursier's bootstrap command. This creates a self-contained binary that includes all dependencies, eliminating the need for further internet access after installation, though a Java runtime is still required. ```bash curl -fLo coursier https://git.io/coursier-cli \ && chmod +x coursier \ && ./coursier bootstrap --standalone -o scip-java com.sourcegraph:scip-java_2.13:0.11.1 --main com.sourcegraph.scip_java.ScipJava ./scip-java --help ``` -------------------------------- ### Install Docker Desktop via Command Line Source: https://docs.docker.com/docker-for-windows/install/ Commands to install Docker Desktop from the command line using different shells. These commands initiate the installation process and can be customized with flags. ```bash $ "Docker Desktop Installer.exe" install ``` ```powershell Start-Process 'Docker Desktop Installer.exe' -Wait install ``` ```cmd start /w "" "Docker Desktop Installer.exe" install ``` -------------------------------- ### Install Sourcegraph LLMs CLI on Linux Source: https://sourcegraph.com/docs/cli/quickstart This snippet shows how to install the Sourcegraph LLMs CLI on a Linux system using the provided command. It's a straightforward installation process. ```bash curl -L https://sourcegraph.com/.api/client/install.sh | bash ``` -------------------------------- ### Run scip-java using Docker with specific JVM versions Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html These commands demonstrate how to run the scip-java indexer via Docker, specifying different Java Virtual Machine (JVM) versions. This allows users to control the Java environment used for indexing, with examples for Java 8, 11, 17, and 21. ```bash # Java 8 docker run -v $(pwd):/sources --env JVM_VERSION=8 sourcegraph/scip-java:latest scip-java index # Java 11 docker run -v $(pwd):/sources --env JVM_VERSION=11 sourcegraph/scip-java:latest scip-java index # Java 17 (default) docker run -v $(pwd):/sources --env JVM_VERSION=17 sourcegraph/scip-java:latest scip-java index # Java 21 docker run -v $(pwd):/sources --env JVM_VERSION=21 sourcegraph/scip-java:latest scip-java index ``` -------------------------------- ### Install Docker and K3s Source: https://docs.k3s.io/advanced Installs Docker using a provided script and then installs K3s with the `--docker` flag to use Docker as the container runtime. This is a common setup for users who prefer Docker over containerd. ```shell curl https://releases.rancher.com/install-docker/20.10.sh | sh curl -sfL https://get.k3s.io | sh -s - --docker ``` -------------------------------- ### Install Sourcegraph CLI on macOS using curl Source: https://sourcegraph.com/docs/cli/quickstart This snippet demonstrates installing the Sourcegraph CLI on macOS by downloading a pre-compiled binary using curl. Ensure you have curl installed and sufficient permissions. ```bash curl -Lsf https://github.com/sourcegraph/src-cli/releases/latest/download/src_$(uname -s)_amd64.tar.gz | tar -xz ``` -------------------------------- ### Onboarding Prompt for Project Setup Source: https://context7_llms This prompt serves as an onboarding tool for new team members, asking Cody to describe a project and provide setup instructions. It helps new contributors quickly understand and initialize the project environment. ```text @repo tell me about this project and how to set it up. ``` -------------------------------- ### Batch Changes Quickstart Guide Source: https://context7_llms Get started and create your first batch change in 10 minutes or less using the local (CLI) method. ```APIDOC ## GET /batch-changes/quickstart ### Description Get started and create your first batch change in 10 minutes or less. This guide follows the local (CLI) method of running batch changes. ### Method GET ### Endpoint /batch-changes/quickstart ``` -------------------------------- ### Sourcegraph 101: Getting Started with Sourcegraph LLM Source: https://6.2.sourcegraph.com/ This section provides a basic introduction to using Sourcegraph's LLM features. It guides users on how to get started and understand the core functionalities. ```text Learn how to use Sourcegraph. ``` -------------------------------- ### PowerShell Docker Desktop Installation with Flags Source: https://docs.docker.com/docker-for-windows/install/ Example of using PowerShell to install Docker Desktop with specific flags, such as accepting the license agreement. The 'ArgumentList' parameter is crucial for passing flags in PowerShell. ```powershell Start-Process 'Docker Desktop Installer.exe' -Wait -ArgumentList 'install', '--accept-license' ``` -------------------------------- ### scip-java index Command Help Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html This displays the help message for the `scip-java index` command, outlining its usage, description, available options, and default values. Options include controlling output path, target root directory, verbosity, and text mode for the SemanticDB compiler plugin. ```bash $ scip-java index --help USAGE scip-java index [OPTIONS ...] -- [TRAILING_ARGUMENTS ...] DESCRIPTION Automatically generate an SCIP index in the current working directory. OPTIONS --help: Boolean Print this help message --output: Path = "index.scip" The path where to generate the SCIP index. --targetroot: Option[Path] The directory where to generate SemanticDB files. Defaults to a build-specific path. For example, the default value for Gradle is 'build/semanticdb-targetroot' and for Maven it's 'target/semanticdb-targetroot' --[no-]verbose: Boolean = false Whether to enable the -verbose flag in the SemanticDB compiler plugin. --[no-]text: Boolean = false Whether to enable the -text:on flag in the SemanticDB compiler plugin. --build-tool: Option[String] Explicitly specify which build tool to use. By default, the build tool is automatically detected. Use this flag if the automatic ``` -------------------------------- ### Component Paths for Sourcegraph Resources Source: https://sourcegraph.com/docs/admin/deploy/kubernetes/kustomize/gke This example lists file paths to common reusable components within a Sourcegraph project structure. These paths indicate where to find configurations for namespaces, sizes (like xs), and specific cluster configurations such as GKE for general setup and managed certificates. ```plaintext ../../components/resources/namespace ../../components/sizes/xs ../../components/clusters/gke/configure ../../components/clusters/gke/managed-cert ``` -------------------------------- ### Introduction to Kustomize (Markdown) Source: https://sourcegraph.com/docs/admin/install/kubernetes/operations Provides an introductory overview of Kustomize, likely for Kubernetes, with a link to its configuration. It includes a placeholder for additional details. ```markdown ## Introduction Introduction

$undefined

``` -------------------------------- ### Install Sourcegraph CLI for Linux Source: https://sourcegraph.com/docs/batch-changes/quickstart Installs the Sourcegraph CLI tool for Linux by downloading the binary and making it executable. Ensure you replace '' with your actual Sourcegraph instance URL. ```bash curl -L https:///.api/src-cli/src_linux_amd64 -o /usr/local/bin/src chmod +x /usr/local/bin/src ``` -------------------------------- ### Build scip-java Fat Jar (Windows) Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html Builds a standalone scip-java executable fat jar on Windows using Coursier's bootstrap command. This creates a self-contained binary that includes all dependencies, requiring no further internet access post-installation, though a Java runtime is necessary. ```batch bitsadmin /transfer downloadCoursierCli https://git.io/coursier-cli "%cd%\coursier" bitsadmin /transfer downloadCoursierBat https://git.io/coursier-bat "%cd%\coursier.bat" ./coursier bootstrap --standalone -o scip-java com.sourcegraph:scip-java_2.13:0.11.1 ./scip-java --help ``` -------------------------------- ### Install Sourcegraph CLI on Windows Source: https://sourcegraph.com/docs/cli/quickstart This snippet demonstrates the installation of the Sourcegraph CLI on Windows using PowerShell. It creates a directory for the CLI, downloads the executable, and sets up the necessary environment. ```powershell New-Item -ItemType Directory 'C:\Program Files\Sourcegraph' Invoke-WebRequest https://sourcegraph.com/.api/src-cli/src_windows_amd64 -OutFile 'C:\Program Files\Sourcegraph\src.exe' ``` -------------------------------- ### Bash Script for Sourcegraph Docker Deployment Setup Source: https://sourcegraph.com/docs/admin/deploy/docker-compose/digitalocean This script automates the setup of a Sourcegraph deployment using Docker. It clones the deployment repository, configures Docker to use a persistent disk for its data root, installs Docker and Docker Compose, and starts Sourcegraph using Docker Compose. Ensure you replace the placeholder URL and revision with your specific deployment details. ```bash #!/usr/bin/env bash set -euxo pipefail ############################################################################### # ACTION REQUIRED: REPLACE THE URL AND REVISION WITH YOUR DEPLOYMENT REPO INFO ############################################################################### # Please read the notes below the script if you are cloning a private repository DEPLOY_SOURCEGRAPH_DOCKER_FORK_CLONE_URL='https://github.com/sourcegraph/deploy-sourcegraph-docker.git' DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION=v6.8.0 ##################### NO CHANGES REQUIRED BELOW THIS LINE ##################### DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT='/root/deploy-sourcegraph-docker' DOCKER_DATA_ROOT='/mnt/docker-data' DOCKER_COMPOSE_VERSION='1.29.2' DOCKER_DAEMON_CONFIG_FILE='/etc/docker/daemon.json' PERSISTENT_DISK_DEVICE_NAME='/dev/sda' # Install git sudo apt-get update -y sudo apt-get install -y git # Clone the deployment repository git clone ("${DEPLOY_SOURCEGRAPH_DOCKER_FORK_CLONE_URL}") ("${DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT}") cd ("${DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT}") git checkout ("${DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION}") # Format (if unformatted) and then mount the attached volume device_fs=$(sudo lsblk ("${PERSISTENT_DISK_DEVICE_NAME}") --noheadings --output fsType) if [ ("${device_fs}") == "" ] then sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard ("${PERSISTENT_DISK_DEVICE_NAME}") fi sudo mkdir -p ("${DOCKER_DATA_ROOT}") sudo mount -o discard,defaults ("${PERSISTENT_DISK_DEVICE_NAME}") ("${DOCKER_DATA_ROOT}") # Mount file system by UUID on reboot DISK_UUID=$(sudo blkid -s UUID -o value ("${PERSISTENT_DISK_DEVICE_NAME}")) sudo echo "UUID=${DISK_UUID} ${DOCKER_DATA_ROOT} ext4 discard,defaults,nofail 0 2" >> '/etc/fstab' sudo umount ("${DOCKER_DATA_ROOT}") sudo mount -a # Install, configure, and enable Docker curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update -y apt-cache policy docker-ce apt-get install -y docker-ce docker-ce-cli containerd.io ## Enable Docker at startup sudo systemctl enable --now docker # Install jq for scripting sudo apt-get update -y sudo apt-get install -y jq ## Initialize the config file with empty json if it doesn't exist if [ ! -f ("${DOCKER_DAEMON_CONFIG_FILE}") ] then mkdir -p $(dirname ("${DOCKER_DAEMON_CONFIG_FILE}")) echo '{}' > ("${DOCKER_DAEMON_CONFIG_FILE}") fi ## Point Docker storage to mounted volume tmp_config=$(mktemp) trap "rm -f ${tmp_config}" EXIT sudo cat ("${DOCKER_DAEMON_CONFIG_FILE}") | sudo jq --arg DATA_ROOT ("${DOCKER_DATA_ROOT}") '.["data-root"]=$DATA_ROOT' > ("${tmp_config}") sudo cat ("${tmp_config}") > ("${DOCKER_DAEMON_CONFIG_FILE}") ## Restart Docker daemon to pick up new changes sudo systemctl restart --now docker # Install Docker Compose curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose curl -L "https://raw.githubusercontent.com/docker/compose/${DOCKER_COMPOSE_VERSION}/contrib/completion/bash/docker-compose" -o /etc/bash_completion.d/docker-compose # Start Sourcegraph with Docker Compose cd ("${DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT}")/docker-compose docker-compose up -d --remove-orphans ``` -------------------------------- ### Manual Bazel Indexing with scip-java and SemanticDB Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html Manually indexes Bazel codebases by integrating scip-java into the build configuration. This involves setting up dependencies in WORKSPACE and BUILD files, enabling the SemanticDB compiler plugin, generating the SCIP index, and optionally validating SemanticDB file generation. Finally, the SCIP index can be uploaded to Sourcegraph. ```bash bazel build //... --@scip_java//semanticdb-javac:enabled=true ``` ```bash bazel run @scip_java//scip-semanticdb:bazel -- --sourceroot $PWD ``` ```bash jar tf bazel-bin/src/main/java/example/libexample.jar | grep semanticdb$ ``` ```bash npm install -g @sourcegraph/src export SRC_ACCESS_TOKEN=sgp_YOUR_ACCESS_TOKEN export SRC_ENDPOINT=https://sourcegraph.example.com src login src code-intel upload ``` -------------------------------- ### Curl: Making Authenticated GitHub API Requests Source: https://docs.github.com/en/rest/overview/resources-in-the-rest-api This is a conceptual example showing how to make an authenticated request to the GitHub REST API using `curl`. It highlights the need for setup and installation of `curl`. ```shell # Example using curl to make an authenticated request # Requires curl to be installed. # curl --version # To check installation ``` -------------------------------- ### Configure External Redis Instance (No Authentication) Source: https://sourcegraph.com/docs/admin/deploy/kubernetes/ Example configuration for using an external Redis instance without authentication in Sourcegraph's `override.yaml`. This is a simplified setup where credentials are not required. ```yaml redis: host: "your-redis-host.com" port: "6379" ``` -------------------------------- ### scip-java Indexing Support by Build Tool Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html Overview of scip-java's automatic indexing support for different build tools across Java, Scala, and Kotlin. '✅' indicates full support, while '❌' suggests manual configuration might be needed. ```markdown | Build tool | Java | Scala | Kotlin | Tracking issue | |---|---|---|---|---| | Maven | ✅ | ❌ | ❌ | | | Gradle | ✅ | ✅ | ✅ | | | sbt | ✅ | ✅ | n/a | [sourcegraph/scip-java#305](https://github.com/sourcegraph/scip-java/issues/305) | | Ant | ❌ | ❌ | ❌ | | | Bazel | ✅ | ✅ | ❌ | | | Buck | ❌ | ❌ | ❌ | [sourcegraph/scip-java#99](https://github.com/sourcegraph/scip-java/issues/99) | | Mill | ✅ | ✅ | ❌ | | ``` -------------------------------- ### Initiate Cody Chat with Message (Shell) Source: https://sourcegraph.com/docs/cody/clients/install-cli Starts a Cody chat session, providing an initial message to guide the conversation. Supports both shorthand '-m' and the full '--message' flag. ```shell # use --message instead of -m cody chat --message 'Explain React hooks' # space separated arguments cody chat Explain React hooks ``` -------------------------------- ### Kubernetes Ingress Output Example Source: https://sourcegraph.com/docs/admin/deploy/kubernetes/kustomize/eks This is a sample output from the `kubectl describe ingress` command. It shows key details like the ingress name, namespace, and the address it is accessible from. ```text # Sample output: Name: sourcegraph-frontend Namespace: default Address: 12.345.678.0 ``` -------------------------------- ### Install and Initialize TUF Client Source: https://docs.sigstore.dev/cosign/system_config/installation/ Installs the go-tuf CLI client and initializes the TUF environment using a specified root JSON file. This is a prerequisite for verifying Cosign artifacts. ```shell go install github.com/theupdateframework/go-tuf/cmd/tuf-client@latest curl -o sigstore-root.json https://raw.githubusercontent.com/sigstore/root-signing/refs/heads/main/metadata/root_history/10.root.json tuf-client init https://tuf-repo-cdn.sigstore.dev sigstore-root.json ``` -------------------------------- ### Create EKS Cluster using AWS Management Console and CLI Source: https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html This guide details the process of creating an Amazon EKS cluster using the AWS Management Console and AWS Command Line Interface (CLI). It involves manually creating each required resource, providing visibility into resource creation and interaction. This method is suitable for users who want a deeper understanding of the underlying infrastructure. Prerequisites include AWS CLI installation and configuration. ```bash # Example AWS CLI command (actual commands not provided in text, this is illustrative) # aws eks create-cluster --name my-cluster --region us-west-2 --resources-vpc-config "{\"subnetIds\": [\"subnet-xxxxxxxxxxxxxxxxx\", \"subnet-yyyyyyyyyyyyyyyyy\"], \"securityGroupIds\": [\"sg-zzzzzzzzzzzzzzzzz\"]}" ``` -------------------------------- ### Configure External Object Storage using Helm Override (S3 Example) Source: https://sourcegraph.com/docs/admin/deploy/kubernetes/ This snippet illustrates how to configure Sourcegraph to utilize an external Object Storage service, such as AWS S3, by overriding Helm chart settings. It directs users to a comprehensive `override.yaml` example and general recommendations for external object storage setup. The example provided is tailored for AWS S3 but can be adapted for other S3-compatible or GCS services. ```yaml objectStorage: enabled: true external: type: "s3" bucket: "my-sourcegraph-bucket" region: "us-east-1" endpoint: "s3.amazonaws.com" accessKeyIdSecret: name: "my-s3-credentials" key: "accessKeyId" secretAccessKeySecret: name: "my-s3-credentials" key: "secretAccessKey" ``` -------------------------------- ### Compare Kustomize Overlays Examples Source: https://sourcegraph.com/docs/admin/install/kubernetes/operations Provides examples of comparing Kustomize overlays, including differences between k3s overlays for different instance sizes, base cluster vs. old cluster, and output files from different overlay builds. ```bash diff \ <(kubectl kustomize examples/k3s/xs) \ <(kubectl kustomize examples/k3s/xl) |\ more ``` ```bash diff \ <(kubectl kustomize examples/base) \ <(kubectl kustomize examples/old-cluster) |\ more ``` ```bash kubectl kustomize examples/old-cluster -o old-cluster.yaml kubectl kustomize examples/base -o new-cluster.yaml diff old-cluster.yaml new-cluster.yaml ``` -------------------------------- ### Install src-cli on Linux via direct download (Shell) Source: https://sourcegraph.com/docs/cli/quickstart Installs the Sourcegraph CLI ('src') on Linux by downloading a pre-compiled binary from Sourcegraph's servers and placing it in the system's PATH. This method requires manual execution of `chmod` to make the binary executable. ```shell curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src chmod +x /usr/local/bin/src ``` -------------------------------- ### Adding Remote Components to Kustomization Source: https://sourcegraph.com/docs/admin/deploy/kubernetes/kustomize/gke This example illustrates how to include remote components in your Sourcegraph kustomization. Note that components requiring additional input in buildConfig.yaml cannot be added remotely. ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - github.com/sourcegraph/deploy-sourcegraph-gke//base?ref=vX.Y.Z - github.com/sourcegraph/deploy-sourcegraph-gke//components/monitoring?ref=vX.Y.Z ``` -------------------------------- ### Get Environment Variable in Sourcegraph LLMs Source: https://sourcegraph.com/docs/cli/quickstart This snippet shows how to retrieve the value of an environment variable, specifically 'Path', within the Sourcegraph LLMs project. It also includes an example of using EnvironmentVariableTarget::Machine. ```shell GetEnvironmentVariable("Path", EnvironmentVariableTarget::Machine) ``` -------------------------------- ### Example Startup Script for Sourcegraph Deployment Source: https://sourcegraph.com/docs/admin/deploy/docker-compose/google_cloud This snippet demonstrates a typical startup script used for Sourcegraph deployments. It includes placeholders for Git clone URL and revision, which are crucial for managing custom configurations, especially in production environments. Ensure these are correctly set for private repositories and specific branches. ```shell STARTUP_SCRIPT= "git clone deployment cd deployment git checkout cp docker-compose.yml docker-compose.override.yml # Add any further customizations to docker-compose.override.yml here ./bin/sg up -d" ``` -------------------------------- ### Start Sourcegraph with Docker Compose Source: https://sourcegraph.com/docs/admin/deploy/docker-compose/ This command initiates the Sourcegraph services using Docker Compose. It is suitable for development or when you need to view logs directly in the terminal. Ensure Docker and Docker Compose are installed and configured. ```shell # Start Sourcegraph with Docker Compose docker compose up ``` ```shell # OR you can start Sourcegraph with Docker Compose in a detached mode docker compose up -d ``` -------------------------------- ### Install and Run Zoekt Web Server Source: https://github.com/sourcegraph/zoekt This command installs the zoekt-webserver binary and then runs it, exposing a search UI at http://localhost:6070. The web server can also be configured with the '-rpc' flag to expose a JSON search API. ```bash go install github.com/sourcegraph/zoekt/cmd/zoekt-webserver $GOPATH/bin/zoekt-webserver -index ~/.zoekt/ ``` -------------------------------- ### Install Cosign with Go 1.20+ Source: https://docs.sigstore.dev/cosign/system_config/installation/ Installs the Cosign binary using Go 1.20 or later. Requires Go to be installed and configured. The binary is placed in the Go binary directory. ```shell go install github.com/sigstore/cosign/v2/cmd/cosign@latest ``` -------------------------------- ### Verify Docker Installation with hello-world on Windows Source: https://docs.docker.com/engine/install/binaries/ This command runs the 'hello-world' Docker image on Windows (nanoserver variant) to confirm that Docker is installed and functioning correctly. It downloads the image and prints a confirmation message. ```powershell & $Env:ProgramFiles\Docker\docker run hello-world:nanoserver ``` -------------------------------- ### Example GitHub API GET Request (Shell) Source: https://docs.github.com/en/rest/overview/resources-in-the-rest-api This is a complete example of a GET request to the GitHub API's 'Get Octocat' endpoint using shell commands. It demonstrates the usage of the '--url' flag and implies the necessary headers and data are handled correctly by the tool. ```shell # Example request to Get Octocat endpoint: # --url https://api.github.com/users/octocat ``` -------------------------------- ### Apply Kustomize Configuration with Kubectl Source: https://sourcegraph.com/docs/admin/install/kubernetes/operations This command applies a Kustomize configuration from a specified directory. It's useful for deploying resources defined using Kustomize. Ensure Kustomize is installed and the path to the examples directory is correct. ```bash $ kubectl kustomize examples/k3s/xl | kubectl apply -f - ``` -------------------------------- ### Download and Install src-cli (macOS AMD64) (Shell) Source: https://sourcegraph.com/docs/cli/quickstart This command downloads the src-cli binary for macOS AMD64 architecture using curl, saves it to /usr/local/bin/src, and then makes it executable. ```bash curl -L https://sourcegraph.com/.api/src-cli/src_darwin_amd64 -o /usr/local/bin/src chmod +x ``` -------------------------------- ### Automated Executor Setup Script Source: https://sourcegraph.com/docs/admin/executors/deploy_executors_binary A command to automatically install dependencies and configure the machine for running workloads. This simplifies the setup process by handling necessary installations. ```shell sudo ./ ``` -------------------------------- ### Create and Share a Sourcegraph Notebook Source: https://sourcegraph.com/docs/notebooks/quickstart Instructions for creating a new notebook on Sourcegraph, adding markdown and query blocks, rendering code, and sharing the notebook publicly. ```text Navigate to https://sourcegraph.com/notebooks/ and click "Create notebook". Click on the name to edit and rename the Notebook "React components" Create a Markdown block and enter the text below. Click the render button, or press Cmd+Return to render the block Create a query block and enter the following query to find some examples of class components in the Sourcegraph codebase. Render the block with Cmd+Return Next, let's find some recent commits that include class components. Click the "duplicate" button to duplicate the block and modify the query to return commits that added our search phrase. Your Notebook should now look like this. Optional: share you notebook by clicking "Private" at the top right of the screen and select "Public" to share your Notebook with the community! ``` -------------------------------- ### Sourcegraph Docker Compose Startup Script (Bash) Source: https://context7_llms This bash script automates the deployment of Sourcegraph using Docker Compose. It handles environment setup, cloning the deployment repository, configuring persistent storage for Docker, installing Docker and Docker Compose, and finally starting Sourcegraph. ```bash #!/usr/bin/env bash set -euxo pipefail ############################################################################### # ACTION REQUIRED: REPLACE THE URL AND REVISION WITH YOUR DEPLOYMENT REPO INFO ############################################################################### # Please read the notes below the script if you are cloning a private repository DEPLOY_SOURCEGRAPH_DOCKER_FORK_CLONE_URL='https://github.com/sourcegraph/deploy-sourcegraph-docker.git' DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION={CURRENT_VERSION} ##################### NO CHANGES REQUIRED BELOW THIS LINE ##################### DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT='/root/deploy-sourcegraph-docker' DOCKER_COMPOSE_VERSION='1.29.2' DOCKER_DAEMON_CONFIG_FILE='/etc/docker/daemon.json' DOCKER_DATA_ROOT='/mnt/docker-data' PERSISTENT_DISK_DEVICE_NAME='/dev/sdb' PERSISTENT_DISK_LABEL='sourcegraph' # Install git sudo apt-get update -y sudo apt-get install -y git # Clone the deployment repository git clone "${DEPLOY_SOURCEGRAPH_DOCKER_FORK_CLONE_URL}" "${DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT}" cd "${DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT}" git checkout "${DEPLOY_SOURCEGRAPH_DOCKER_FORK_REVISION}" # Format (if unformatted) and then mount the attached volume device_fs=$(sudo lsblk "${PERSISTENT_DISK_DEVICE_NAME}" --noheadings --output fsType) if [ "${device_fs}" == "" ] then sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard "${PERSISTENT_DISK_DEVICE_NAME}" fi sudo e2label "${PERSISTENT_DISK_DEVICE_NAME}" "${PERSISTENT_DISK_LABEL}" sudo mkdir -p "${DOCKER_DATA_ROOT}" sudo mount -o discard,defaults "${PERSISTENT_DISK_DEVICE_NAME}" "${DOCKER_DATA_ROOT}" # Mount file system by label on reboot sudo echo "LABEL=${PERSISTENT_DISK_LABEL} ${DOCKER_DATA_ROOT} ext4 discard,defaults,nofail 0 2" | sudo tee -a /etc/fstab sudo umount "${DOCKER_DATA_ROOT}" sudo mount -a # Install, configure, and enable Docker curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt-get update -y sudo apt-get install -y software-properties-common sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update -y apt-cache policy docker-ce apt-get install -y docker-ce docker-ce-cli containerd.io ## Enable Docker at startup sudo systemctl enable --now docker ## Install jq for scripting sudo apt-get update -y sudo apt-get install -y jq ## Initialize the config file with empty json if it doesn't exist if [ ! -f "${DOCKER_DAEMON_CONFIG_FILE}" ] then mkdir -p $(dirname "${DOCKER_DAEMON_CONFIG_FILE}") echo '{}' >"${DOCKER_DAEMON_CONFIG_FILE}" fi ## Point Docker storage to mounted volume tmp_config=$(mktemp) trap "rm -f ${tmp_config}" EXIT sudo cat "${DOCKER_DAEMON_CONFIG_FILE}" | sudo jq --arg DATA_ROOT "${DOCKER_DATA_ROOT}" '.["data-root"]=$DATA_ROOT' >"${tmp_config}" sudo cat "${tmp_config}" >"${DOCKER_DAEMON_CONFIG_FILE}" ## Restart Docker daemon to pick up new changes sudo systemctl restart --now docker # Install Docker Compose curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose curl -L "https://raw.githubusercontent.com/docker/compose/${DOCKER_COMPOSE_VERSION}/contrib/completion/bash/docker-compose" -o /etc/bash_completion.d/docker-compose # Start Sourcegraph with Docker Compose cd "${DEPLOY_SOURCEGRAPH_DOCKER_CHECKOUT}"/docker-compose docker-compose up -d --remove-orphans ``` -------------------------------- ### Customizing Sourcegraph Deployment with Kustomize Source: https://sourcegraph.com/docs/admin/deploy/kubernetes/kustomize/eks This code snippet shows an example of a kustomization.yaml file used for customizing an existing Sourcegraph deployment on Kubernetes. It allows for modifications such as changing instance sizes or adding monitoring stacks. ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - github.com/sourcegraph/deploy-sourcegraph-k8s/examples/aws/eks?ref=main patches: - patch: - op: replace path: /spec/template/spec/containers/0/resources/limits/memory value: 8Gi target: kind: Deployment name: sourcegraph-frontend ``` -------------------------------- ### Caddy Build Steps with Go Source: https://github.com/caddyserver/caddy/wiki/v2:-Documentation This sequence of commands outlines the manual process of building Caddy from source. It involves creating a directory, copying Caddy's main.go, initializing a Go module, optionally pinning a version, adding custom plugin imports, and finally compiling the executable. It's useful for understanding the underlying build mechanics. ```bash mkdir caddy cd caddy go mod init caddy go get github.com/caddyserver/caddy/v2@version _ "import/path/here" go build -tags=nobadger,nomysql,nopgx ``` -------------------------------- ### Kubernetes Installation with kubeadm Source: https://kubernetes.io/docs/concepts/configuration/overview/ This snippet demonstrates the foundational steps for installing kubeadm, a tool used for bootstrapping Kubernetes clusters. It is a prerequisite for creating clusters and configuring components. ```shell # Example command for installing kubeadm, not directly present in text but implied by navigation. # Please refer to official Kubernetes documentation for exact commands. ``` -------------------------------- ### Get Project Avatar - GET Request Example Source: https://docs.atlassian.com/bitbucket-server/rest/6.1.2/bitbucket-rest.html This example demonstrates how to retrieve an avatar for a project using the GET method. The endpoint requires a hookKey as a path parameter and optionally accepts a version query parameter for caching purposes. The expected successful response is an image/png. ```http GET /rest/api/1.0/hooks/{hookKey}/avatar?version Host: your.sourcegraph.com Accept: image/png ``` -------------------------------- ### Create Amazon EKS Cluster and Nodes with eksctl Source: https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html This step involves using the eksctl command-line utility to create an Amazon EKS cluster and its associated worker nodes. This process automates the setup of required AWS resources and Kubernetes infrastructure. ```bash eksctl create cluster --name my-cluster --region us-west-2 ``` -------------------------------- ### Automatic Bazel Indexing with scip-java Source: https://sourcegraph.github.io/scip-java/docs/getting-started.html Indexes Bazel/Java codebases automatically by running an scip-java aspect within the Bazel action graph. Requires specifying the path to the scip-java binary. This method benefits from parallel compilation and the Bazel build cache but may rely on `--spawn_strategy=local` for hermeticity. ```bash scip-java index "--bazel-scip-java-binary=$(which scip-java)" ``` -------------------------------- ### Install src CLI for Windows (PowerShell) Source: https://sourcegraph.com/docs/cli/quickstart Installs the Sourcegraph CLI (src) on Windows using PowerShell. It creates a directory, downloads the executable, and adds it to the system's PATH environment variable. ```powershell New-Item -ItemType Directory 'C:\\Program Files\\Sourcegraph' Invoke-WebRequest https://sourcegraph.com/.api/src-cli/src_windows_amd64.exe -OutFile 'C:\\Program Files\\Sourcegraph\\src.exe' [Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine) + ';C:\\Program Files\\Sourcegraph', [EnvironmentVariableTarget]::Machine) $env:Path += ';C:\\Program Files\\Sourcegraph' ``` -------------------------------- ### Kubectl Apply Command for Sourcegraph GKE Deployment Source: https://sourcegraph.com/docs/admin/deploy/kubernetes/kustomize/gke This kubectl command applies a Kustomize configuration for Sourcegraph on GKE. It uses the `--prune` and `-l deploy=sourcegraph` flags to manage resources and targets the GKE example directory. ```bash $ kubectl apply --prune -l deploy=sourcegraph -k https://github.com/sourcegraph/deploy-sourcegraph-k8s/examples/gke ``` -------------------------------- ### Search Notebooks Quickstart Guide Source: https://context7_llms Notebooks enable powerful live–and persistent–documentation, shareable with your organization or the world. ```APIDOC ## GET /notebooks/quickstart ### Description Notebooks enable powerful live–and persistent–documentation, shareable with your organization or the world. ### Method GET ### Endpoint /notebooks/quickstart ```