From b1a1bab69ed189aa1235d28ad9427c47f5adec96 Mon Sep 17 00:00:00 2001 From: Z9RTM Date: Tue, 1 Apr 2025 16:35:44 +0000 Subject: [PATCH 1/4] chore: devcontainer setting --- .devcontainer/devcontainer.json | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..b109313 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/rust +{ + "name": "Rust", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye", + "features": { + "ghcr.io/devcontainers/features/node:1": {} + } + + // Use 'mounts' to make the cargo cache persistent in a Docker Volume. + // "mounts": [ + // { + // "source": "devcontainer-cargo-cache-${devcontainerId}", + // "target": "/usr/local/cargo", + // "type": "volume" + // } + // ] + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "rustc --version", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} From 06955cb189db1d7ba920e6fab571ebce761cba91 Mon Sep 17 00:00:00 2001 From: Z9RTM Date: Tue, 1 Apr 2025 16:40:54 +0000 Subject: [PATCH 2/4] chore: add formatter settings --- .devcontainer/devcontainer.json | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b109313..f97a02b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,6 +6,17 @@ "image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye", "features": { "ghcr.io/devcontainers/features/node:1": {} + }, + // Configure tool-specific properties. + "customizations": { + "vscode": { + "settings": { + "editor.formatOnSave": true, + "[rust]": { + "editor.defaultFormatter": "rust-lang.rust-analyzer" + } + } + } } // Use 'mounts' to make the cargo cache persistent in a Docker Volume. @@ -26,9 +37,6 @@ // Use 'postCreateCommand' to run commands after the container is created. // "postCreateCommand": "rustc --version", - // Configure tool-specific properties. - // "customizations": {}, - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "root" } From 007d6ea3240f604eb8bad7a519a70ec8f604e2c6 Mon Sep 17 00:00:00 2001 From: Z9RTM Date: Tue, 1 Apr 2025 18:06:56 +0000 Subject: [PATCH 3/4] chore: clear all tests passed --- .devcontainer/devcontainer.json | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f97a02b..8ac58ca 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,11 @@ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye", "features": { - "ghcr.io/devcontainers/features/node:1": {} + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers/features/python:1": { + "version": "3.10", + "toolsToInstall": "uv" + } }, // Configure tool-specific properties. "customizations": { @@ -17,8 +21,9 @@ } } } - } - + }, + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "uv venv" // Use 'mounts' to make the cargo cache persistent in a Docker Volume. // "mounts": [ // { @@ -27,16 +32,10 @@ // "type": "volume" // } // ] - // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "rustc --version", - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "root" -} +} \ No newline at end of file From 98a460b45534e75a7278720dd1d6c9e75697d039 Mon Sep 17 00:00:00 2001 From: Z9RTM Date: Wed, 2 Apr 2025 02:31:42 +0000 Subject: [PATCH 4/4] docs: add Dev Container setup instructions to README and create DEVCONTAINER.md --- README.md | 4 ++++ docs/DEVCONTAINER.md | 55 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 docs/DEVCONTAINER.md diff --git a/README.md b/README.md index 99c12a9..96e55dd 100644 --- a/README.md +++ b/README.md @@ -188,3 +188,7 @@ See [examples](examples/README.md) - [MCP Specification](https://spec.modelcontextprotocol.io/specification/2024-11-05/) - [Schema](https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.ts) + +## Development with Dev Container + +See [docs/DEVCONTAINER.md](docs/DEVCONTAINER.md) for instructions on using Dev Container for development. \ No newline at end of file diff --git a/docs/DEVCONTAINER.md b/docs/DEVCONTAINER.md new file mode 100644 index 0000000..8795924 --- /dev/null +++ b/docs/DEVCONTAINER.md @@ -0,0 +1,55 @@ +## Development with Dev Container and GitHub Codespaces + +This repository provides a Dev Container to easily set up a development environment. Using Dev Container allows you to work in a consistent development environment with pre-configured dependencies and tools, whether locally or in the cloud with GitHub Codespaces. + +### Prerequisites + +**For Local Development:** + +* [Docker Desktop](https://www.docker.com/products/docker-desktop/) or any other compatible container runtime (e.g., Podman, OrbStack) installed. +* [Visual Studio Code](https://code.visualstudio.com/) with the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) installed. + +**For GitHub Codespaces:** + +* A GitHub account. + +### Starting Dev Container + +**Using Visual Studio Code (Local):** + +1. Clone the repository. +2. Open the repository in Visual Studio Code. +3. Open the command palette in Visual Studio Code (`Ctrl + Shift + P` or `Cmd + Shift + P`) and execute `Dev Containers: Reopen in Container`. + +**Using GitHub Codespaces (Cloud):** + +1. Navigate to the repository on GitHub. +2. Click the "<> Code" button. +3. Select the "Codespaces" tab. +4. Click "Create codespace on main" (or your desired branch). + +### Dev Container Configuration + +Dev Container settings are configured in `.devcontainer/devcontainer.json`. In this file, you can set the Docker image to use, extensions to install, port forwarding, and more. This configuration is used both for local development and GitHub Codespaces. + +### Development + +Once the Dev Container is started, you can proceed with development as usual. The container already has the necessary tools and libraries installed. In GitHub Codespaces, you will have a fully configured VS Code in your browser or desktop application. + +### Stopping Dev Container + +**Using Visual Studio Code (Local):** + +To stop the Dev Container, open the command palette in Visual Studio Code and execute `Remote: Close Remote Connection`. + +**Using GitHub Codespaces (Cloud):** + +GitHub Codespaces will automatically stop after a period of inactivity. You can also manually stop the codespace from the Codespaces menu in GitHub. + +### More Information + +* [Visual Studio Code Dev Containers](https://code.visualstudio.com/docs/remote/containers) +* [Dev Container Specification](https://containers.dev/implementors/json_reference/) +* [GitHub Codespaces](https://github.com/features/codespaces) + +This document describes the basic usage of Dev Container and GitHub Codespaces. Add project-specific settings and procedures as needed. \ No newline at end of file