container-superposition 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -1014
- package/dist/scripts/init.js +512 -238
- package/dist/scripts/init.js.map +1 -1
- package/dist/tool/commands/adopt.d.ts +62 -0
- package/dist/tool/commands/adopt.d.ts.map +1 -0
- package/dist/tool/commands/adopt.js +767 -0
- package/dist/tool/commands/adopt.js.map +1 -0
- package/dist/tool/commands/doctor.js +2 -2
- package/dist/tool/commands/explain.d.ts.map +1 -1
- package/dist/tool/commands/explain.js +88 -0
- package/dist/tool/commands/explain.js.map +1 -1
- package/dist/tool/commands/hash.d.ts +36 -0
- package/dist/tool/commands/hash.d.ts.map +1 -0
- package/dist/tool/commands/hash.js +242 -0
- package/dist/tool/commands/hash.js.map +1 -0
- package/dist/tool/commands/plan.d.ts +53 -0
- package/dist/tool/commands/plan.d.ts.map +1 -1
- package/dist/tool/commands/plan.js +784 -42
- package/dist/tool/commands/plan.js.map +1 -1
- package/dist/tool/questionnaire/composer.d.ts +12 -3
- package/dist/tool/questionnaire/composer.d.ts.map +1 -1
- package/dist/tool/questionnaire/composer.js +133 -20
- package/dist/tool/questionnaire/composer.js.map +1 -1
- package/dist/tool/schema/project-config.d.ts +15 -0
- package/dist/tool/schema/project-config.d.ts.map +1 -0
- package/dist/tool/schema/project-config.js +359 -0
- package/dist/tool/schema/project-config.js.map +1 -0
- package/dist/tool/schema/types.d.ts +57 -1
- package/dist/tool/schema/types.d.ts.map +1 -1
- package/dist/tool/utils/backup.d.ts +23 -0
- package/dist/tool/utils/backup.d.ts.map +1 -0
- package/dist/tool/utils/backup.js +123 -0
- package/dist/tool/utils/backup.js.map +1 -0
- package/dist/tool/utils/gitignore.d.ts +15 -0
- package/dist/tool/utils/gitignore.d.ts.map +1 -0
- package/dist/tool/utils/gitignore.js +41 -0
- package/dist/tool/utils/gitignore.js.map +1 -0
- package/dist/tool/utils/services-export.d.ts +14 -0
- package/dist/tool/utils/services-export.d.ts.map +1 -0
- package/dist/tool/utils/services-export.js +478 -0
- package/dist/tool/utils/services-export.js.map +1 -0
- package/dist/tool/utils/summary.d.ts +69 -0
- package/dist/tool/utils/summary.d.ts.map +1 -0
- package/dist/tool/utils/summary.js +260 -0
- package/dist/tool/utils/summary.js.map +1 -0
- package/docs/README.md +12 -2
- package/docs/adopt.md +196 -0
- package/docs/custom-patches.md +1 -1
- package/docs/discovery-commands.md +55 -3
- package/docs/examples.md +40 -6
- package/docs/filesystem-contract.md +58 -0
- package/docs/hash.md +183 -0
- package/docs/minimal-and-editor.md +1 -1
- package/docs/overlays.md +108 -5
- package/docs/presets-architecture.md +1 -1
- package/docs/presets.md +1 -1
- package/docs/publishing.md +36 -23
- package/docs/security.md +43 -0
- package/docs/specs/001-verbose-plan-graph/checklists/requirements.md +36 -0
- package/docs/specs/001-verbose-plan-graph/contracts/plan-verbose-output.md +96 -0
- package/docs/specs/001-verbose-plan-graph/data-model.md +111 -0
- package/docs/specs/001-verbose-plan-graph/plan.md +127 -0
- package/docs/specs/001-verbose-plan-graph/quickstart.md +106 -0
- package/docs/specs/001-verbose-plan-graph/research.md +100 -0
- package/docs/specs/001-verbose-plan-graph/spec.md +128 -0
- package/docs/specs/001-verbose-plan-graph/tasks.md +223 -0
- package/docs/specs/002-superposition-config-file/checklists/requirements.md +36 -0
- package/docs/specs/002-superposition-config-file/contracts/init-project-config.md +98 -0
- package/docs/specs/002-superposition-config-file/data-model.md +126 -0
- package/docs/specs/002-superposition-config-file/plan.md +208 -0
- package/docs/specs/002-superposition-config-file/quickstart.md +140 -0
- package/docs/specs/002-superposition-config-file/research.md +144 -0
- package/docs/specs/002-superposition-config-file/spec.md +130 -0
- package/docs/specs/002-superposition-config-file/tasks.md +213 -0
- package/docs/team-workflow.md +27 -1
- package/docs/workflows.md +136 -0
- package/overlays/.presets/microservice.yml +32 -6
- package/overlays/.presets/sdd.yml +84 -0
- package/overlays/.presets/web-api.yml +76 -56
- package/overlays/README.md +7 -1
- package/overlays/amp/README.md +70 -0
- package/overlays/amp/devcontainer.patch.json +3 -0
- package/overlays/amp/overlay.yml +15 -0
- package/overlays/amp/setup.sh +21 -0
- package/overlays/amp/verify.sh +21 -0
- package/overlays/claude-code/README.md +83 -0
- package/overlays/claude-code/devcontainer.patch.json +3 -0
- package/overlays/claude-code/overlay.yml +15 -0
- package/overlays/claude-code/setup.sh +21 -0
- package/overlays/claude-code/verify.sh +21 -0
- package/overlays/cloudflared/README.md +190 -0
- package/overlays/cloudflared/devcontainer.patch.json +3 -0
- package/overlays/cloudflared/overlay.yml +15 -0
- package/overlays/cloudflared/setup.sh +49 -0
- package/overlays/cloudflared/verify.sh +21 -0
- package/overlays/direnv/README.md +6 -4
- package/overlays/direnv/setup.sh +0 -12
- package/overlays/gemini-cli/README.md +77 -0
- package/overlays/gemini-cli/devcontainer.patch.json +3 -0
- package/overlays/gemini-cli/overlay.yml +15 -0
- package/overlays/gemini-cli/setup.sh +21 -0
- package/overlays/gemini-cli/verify.sh +21 -0
- package/overlays/grpc-tools/README.md +242 -0
- package/overlays/grpc-tools/devcontainer.patch.json +14 -0
- package/overlays/grpc-tools/overlay.yml +14 -0
- package/overlays/grpc-tools/setup.sh +57 -0
- package/overlays/grpc-tools/verify.sh +47 -0
- package/overlays/keycloak/.env.example +5 -0
- package/overlays/keycloak/README.md +238 -0
- package/overlays/keycloak/devcontainer.patch.json +17 -0
- package/overlays/keycloak/docker-compose.yml +32 -0
- package/overlays/keycloak/overlay.yml +23 -0
- package/overlays/keycloak/verify.sh +54 -0
- package/overlays/mailpit/.env.example +4 -0
- package/overlays/mailpit/README.md +191 -0
- package/overlays/mailpit/devcontainer.patch.json +20 -0
- package/overlays/mailpit/docker-compose.yml +17 -0
- package/overlays/mailpit/overlay.yml +26 -0
- package/overlays/mailpit/verify.sh +52 -0
- package/overlays/ngrok/overlay.yml +2 -1
- package/overlays/opencode/README.md +76 -0
- package/overlays/opencode/devcontainer.patch.json +3 -0
- package/overlays/opencode/overlay.yml +14 -0
- package/overlays/opencode/setup.sh +21 -0
- package/overlays/opencode/verify.sh +21 -0
- package/overlays/python/README.md +51 -35
- package/overlays/python/devcontainer.patch.json +7 -4
- package/overlays/python/setup.sh +50 -23
- package/overlays/python/verify.sh +29 -1
- package/overlays/spec-kit/README.md +181 -0
- package/overlays/spec-kit/devcontainer.patch.json +6 -0
- package/overlays/spec-kit/overlay.yml +19 -0
- package/overlays/spec-kit/setup.sh +45 -0
- package/overlays/spec-kit/verify.sh +33 -0
- package/overlays/windsurf-cli/README.md +69 -0
- package/overlays/windsurf-cli/devcontainer.patch.json +3 -0
- package/overlays/windsurf-cli/overlay.yml +15 -0
- package/overlays/windsurf-cli/setup.sh +21 -0
- package/overlays/windsurf-cli/verify.sh +21 -0
- package/package.json +1 -1
- package/tool/schema/config.schema.json +138 -9
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Cloudflared setup script
|
|
3
|
+
# Installs cloudflared from official repository
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🌐 Setting up Cloudflared..."
|
|
8
|
+
|
|
9
|
+
# Install cloudflared using official package
|
|
10
|
+
echo "📦 Installing cloudflared..."
|
|
11
|
+
|
|
12
|
+
# Pin to a specific version for reproducibility and security
|
|
13
|
+
# Check https://github.com/cloudflare/cloudflared/releases for newer versions
|
|
14
|
+
CF_VERSION="${CLOUDFLARED_VERSION:-2025.2.1}"
|
|
15
|
+
|
|
16
|
+
# Detect architecture
|
|
17
|
+
ARCH=$(uname -m)
|
|
18
|
+
case "$ARCH" in
|
|
19
|
+
x86_64) CF_ARCH="amd64" ;;
|
|
20
|
+
aarch64 | arm64) CF_ARCH="arm64" ;;
|
|
21
|
+
*) echo " ⚠️ Unsupported architecture: $ARCH" ; CF_ARCH="amd64" ;;
|
|
22
|
+
esac
|
|
23
|
+
|
|
24
|
+
CF_URL="https://github.com/cloudflare/cloudflared/releases/download/${CF_VERSION}/cloudflared-linux-${CF_ARCH}"
|
|
25
|
+
curl -sSL "$CF_URL" -o /tmp/cloudflared
|
|
26
|
+
sudo install -m 755 /tmp/cloudflared /usr/local/bin/cloudflared
|
|
27
|
+
rm -f /tmp/cloudflared
|
|
28
|
+
|
|
29
|
+
# Verify installation
|
|
30
|
+
if command -v cloudflared &> /dev/null; then
|
|
31
|
+
echo " ✅ cloudflared installed: $(cloudflared --version)"
|
|
32
|
+
else
|
|
33
|
+
echo " ❌ cloudflared installation failed"
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
echo ""
|
|
38
|
+
echo "✅ Cloudflared setup complete"
|
|
39
|
+
echo ""
|
|
40
|
+
echo "💡 Quick start (no account required):"
|
|
41
|
+
echo " cloudflared tunnel --url http://localhost:3000"
|
|
42
|
+
echo ""
|
|
43
|
+
echo "💡 Named tunnel (persistent URL, requires Cloudflare account):"
|
|
44
|
+
echo " cloudflared login"
|
|
45
|
+
echo " cloudflared tunnel create my-tunnel"
|
|
46
|
+
echo " cloudflared tunnel route dns my-tunnel myapp.example.com"
|
|
47
|
+
echo " cloudflared tunnel run my-tunnel"
|
|
48
|
+
echo ""
|
|
49
|
+
echo "📚 Documentation: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Verification script for Cloudflared overlay
|
|
3
|
+
# Confirms cloudflared is installed
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🔍 Verifying Cloudflared overlay..."
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
# Check cloudflared
|
|
11
|
+
echo "1️⃣ Checking cloudflared..."
|
|
12
|
+
if command -v cloudflared &> /dev/null; then
|
|
13
|
+
echo " ✅ cloudflared found: $(cloudflared --version)"
|
|
14
|
+
else
|
|
15
|
+
echo " ❌ cloudflared not found"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
echo ""
|
|
20
|
+
echo "✅ Cloudflared overlay verification complete"
|
|
21
|
+
echo " Quick start: cloudflared tunnel --url http://localhost:3000"
|
|
@@ -214,7 +214,7 @@ dotenv_if_exists .env
|
|
|
214
214
|
source_env_if_exists .envrc.local
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
Create `.envrc.local` (
|
|
217
|
+
Create `.envrc.local` (automatically gitignored at generation time):
|
|
218
218
|
|
|
219
219
|
```bash
|
|
220
220
|
export PERSONAL_API_KEY="my-secret-key"
|
|
@@ -293,7 +293,7 @@ export NODE_ENV="development"
|
|
|
293
293
|
dotenv_if_exists .env
|
|
294
294
|
```
|
|
295
295
|
|
|
296
|
-
**.env** - Do NOT commit (
|
|
296
|
+
**.env** - Do NOT commit (automatically gitignored at generation time):
|
|
297
297
|
|
|
298
298
|
```bash
|
|
299
299
|
# Secrets - never commit
|
|
@@ -447,16 +447,18 @@ Settings are automatically loaded. Reload window if needed:
|
|
|
447
447
|
|
|
448
448
|
### Git
|
|
449
449
|
|
|
450
|
-
|
|
450
|
+
When this overlay is selected, the following patterns are automatically added to your project’s `.gitignore` at generation time — no manual step required:
|
|
451
451
|
|
|
452
452
|
```bash
|
|
453
|
-
# .gitignore
|
|
453
|
+
# .gitignore (managed automatically)
|
|
454
454
|
.env
|
|
455
455
|
.env.local
|
|
456
456
|
.envrc.local
|
|
457
457
|
.direnv/
|
|
458
458
|
```
|
|
459
459
|
|
|
460
|
+
This ensures environment secrets are never accidentally committed.
|
|
461
|
+
|
|
460
462
|
### Docker Compose
|
|
461
463
|
|
|
462
464
|
```bash
|
package/overlays/direnv/setup.sh
CHANGED
|
@@ -117,18 +117,6 @@ EOF
|
|
|
117
117
|
echo "✓ Sample .env.example created"
|
|
118
118
|
fi
|
|
119
119
|
|
|
120
|
-
# Create .gitignore entries for environment files
|
|
121
|
-
if [ -f .gitignore ]; then
|
|
122
|
-
if ! grep -q ".envrc" .gitignore; then
|
|
123
|
-
echo "" >> .gitignore
|
|
124
|
-
echo "# Direnv" >> .gitignore
|
|
125
|
-
echo ".envrc.local" >> .gitignore
|
|
126
|
-
echo ".env" >> .gitignore
|
|
127
|
-
echo ".env.local" >> .gitignore
|
|
128
|
-
echo "✓ Added direnv entries to .gitignore"
|
|
129
|
-
fi
|
|
130
|
-
fi
|
|
131
|
-
|
|
132
120
|
echo "✓ direnv setup complete"
|
|
133
121
|
echo ""
|
|
134
122
|
echo "💡 Usage:"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Gemini CLI Overlay
|
|
2
|
+
|
|
3
|
+
Adds the Google Gemini CLI (`gemini`) for AI-powered development assistance directly in the terminal.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Gemini CLI** — Google's AI-powered coding assistant for the terminal
|
|
8
|
+
- **Gemini 2.0 Flash** — Free tier available with Google account
|
|
9
|
+
|
|
10
|
+
## What is Gemini CLI?
|
|
11
|
+
|
|
12
|
+
The Google Gemini CLI is an open-source AI agent that brings Google's Gemini models directly to your terminal workflow:
|
|
13
|
+
|
|
14
|
+
- **Code generation** — Generate code from natural language descriptions
|
|
15
|
+
- **Codebase queries** — Ask questions about your code
|
|
16
|
+
- **Agentic tasks** — Execute multi-step coding tasks autonomously
|
|
17
|
+
- **Web grounding** — Access Google Search for up-to-date information
|
|
18
|
+
|
|
19
|
+
## How It Works
|
|
20
|
+
|
|
21
|
+
This overlay installs `@google/gemini-cli` globally via npm, making the `gemini` command available in your devcontainer.
|
|
22
|
+
|
|
23
|
+
## Common Commands
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Start an interactive session
|
|
27
|
+
gemini
|
|
28
|
+
|
|
29
|
+
# Ask a one-off question
|
|
30
|
+
gemini "how do I implement a binary search tree in TypeScript?"
|
|
31
|
+
|
|
32
|
+
# Check version
|
|
33
|
+
gemini --version
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Use Cases
|
|
37
|
+
|
|
38
|
+
- **Code generation** — Describe features, Gemini implements them
|
|
39
|
+
- **Codebase exploration** — Understand large or unfamiliar codebases
|
|
40
|
+
- **Debugging** — Diagnose and fix errors with AI help
|
|
41
|
+
- **Spec-Driven Development** — Works with `spec-kit` overlay via `specify init --ai gemini`
|
|
42
|
+
|
|
43
|
+
**Integrates well with:**
|
|
44
|
+
|
|
45
|
+
- `spec-kit` — Use Gemini CLI with the SDD workflow
|
|
46
|
+
- `nodejs` — Required for installation
|
|
47
|
+
- `git-helpers` — Git integration for AI-generated code
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
Authenticate using your Google account or a Gemini API key:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Interactive authentication (opens browser)
|
|
55
|
+
gemini auth
|
|
56
|
+
|
|
57
|
+
# Or set API key
|
|
58
|
+
export GEMINI_API_KEY=your-api-key
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Verification
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bash .devcontainer/scripts/verify-gemini-cli.sh
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## References
|
|
68
|
+
|
|
69
|
+
- [Gemini CLI GitHub](https://github.com/google-gemini/gemini-cli)
|
|
70
|
+
- [Google AI Studio](https://aistudio.google.com/)
|
|
71
|
+
|
|
72
|
+
**Related Overlays:**
|
|
73
|
+
|
|
74
|
+
- `spec-kit` — Spec-Driven Development with Gemini as the AI agent
|
|
75
|
+
- `codex` — OpenAI Codex CLI (alternative AI assistant)
|
|
76
|
+
- `claude-code` — Anthropic Claude Code (alternative AI assistant)
|
|
77
|
+
- `nodejs` — Required for npm-based installation
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
id: gemini-cli
|
|
2
|
+
name: Gemini CLI
|
|
3
|
+
description: Google Gemini CLI for AI-powered development assistance
|
|
4
|
+
category: dev
|
|
5
|
+
supports: []
|
|
6
|
+
requires:
|
|
7
|
+
- nodejs
|
|
8
|
+
suggests: []
|
|
9
|
+
conflicts: []
|
|
10
|
+
tags:
|
|
11
|
+
- dev
|
|
12
|
+
- ai
|
|
13
|
+
- gemini
|
|
14
|
+
- google
|
|
15
|
+
ports: []
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# gemini-cli setup script - Install Google Gemini CLI
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
echo "📦 Installing Google Gemini CLI..."
|
|
7
|
+
|
|
8
|
+
# Install @google/gemini-cli globally
|
|
9
|
+
npm install -g @google/gemini-cli
|
|
10
|
+
|
|
11
|
+
# Verify installation
|
|
12
|
+
if command -v gemini &>/dev/null; then
|
|
13
|
+
echo "✓ Gemini CLI installed successfully: $(gemini --version 2>/dev/null || echo 'installed')"
|
|
14
|
+
else
|
|
15
|
+
echo "✗ Gemini CLI installation failed"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
echo "✓ gemini-cli setup complete"
|
|
20
|
+
echo "ℹ️ Google Gemini CLI: https://github.com/google-gemini/gemini-cli"
|
|
21
|
+
echo "ℹ️ Run 'gemini --help' to get started"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# gemini-cli overlay verification script
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
echo "🔍 Verifying gemini-cli overlay setup..."
|
|
7
|
+
|
|
8
|
+
# Check if gemini CLI is installed
|
|
9
|
+
if ! command -v gemini &>/dev/null; then
|
|
10
|
+
echo "✗ gemini CLI is not installed or not in PATH"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
echo "✓ gemini CLI is installed: $(gemini --version 2>/dev/null || echo 'installed')"
|
|
15
|
+
|
|
16
|
+
echo ""
|
|
17
|
+
echo "✅ gemini-cli overlay verification complete!"
|
|
18
|
+
echo ""
|
|
19
|
+
echo "💡 Tips:"
|
|
20
|
+
echo " - Run 'gemini --help' to see available commands"
|
|
21
|
+
echo " - Authenticate with your Google account or API key"
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# gRPC Tools Overlay
|
|
2
|
+
|
|
3
|
+
Protocol Buffers compiler, Buf schema management CLI, and grpcurl for gRPC API development.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **protoc** - Protocol Buffers compiler (from system packages)
|
|
8
|
+
- **buf** - Modern schema management, linting, and breaking change detection
|
|
9
|
+
- **grpcurl** - Command-line tool for interacting with gRPC servers (like curl for gRPC)
|
|
10
|
+
- **VS Code Extensions:**
|
|
11
|
+
- [vscode-proto3](https://marketplace.visualstudio.com/items?itemName=zxh404.vscode-proto3) - Proto3 syntax highlighting and validation
|
|
12
|
+
- [vscode-buf](https://marketplace.visualstudio.com/items?itemName=bufbuild.vscode-buf) - Buf integration for VS Code
|
|
13
|
+
|
|
14
|
+
## How It Works
|
|
15
|
+
|
|
16
|
+
This overlay installs the gRPC development toolchain into the dev container. `protoc` is installed via system packages, while `buf` and `grpcurl` are downloaded from their official GitHub releases.
|
|
17
|
+
|
|
18
|
+
## Common Commands
|
|
19
|
+
|
|
20
|
+
### protoc (Protocol Buffers Compiler)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Compile .proto files to Go
|
|
24
|
+
protoc --go_out=. --go-grpc_out=. api/v1/service.proto
|
|
25
|
+
|
|
26
|
+
# Compile to Python
|
|
27
|
+
protoc --python_out=. api/v1/service.proto
|
|
28
|
+
|
|
29
|
+
# Compile to JavaScript/TypeScript
|
|
30
|
+
protoc --js_out=import_style=commonjs,binary:. api/v1/service.proto
|
|
31
|
+
|
|
32
|
+
# Check version
|
|
33
|
+
protoc --version
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### buf (Schema Management)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Initialize buf workspace
|
|
40
|
+
buf config init
|
|
41
|
+
|
|
42
|
+
# Lint .proto files
|
|
43
|
+
buf lint
|
|
44
|
+
|
|
45
|
+
# Detect breaking changes
|
|
46
|
+
buf breaking --against .git#branch=main
|
|
47
|
+
|
|
48
|
+
# Generate code from .proto files
|
|
49
|
+
buf generate
|
|
50
|
+
|
|
51
|
+
# Format .proto files
|
|
52
|
+
buf format -w
|
|
53
|
+
|
|
54
|
+
# Push schema to Buf Schema Registry
|
|
55
|
+
buf push
|
|
56
|
+
|
|
57
|
+
# Check version
|
|
58
|
+
buf --version
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### grpcurl (gRPC Testing)
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# List all services on a gRPC server
|
|
65
|
+
grpcurl -plaintext localhost:50051 list
|
|
66
|
+
|
|
67
|
+
# List methods on a service
|
|
68
|
+
grpcurl -plaintext localhost:50051 list mypackage.MyService
|
|
69
|
+
|
|
70
|
+
# Describe a method
|
|
71
|
+
grpcurl -plaintext localhost:50051 describe mypackage.MyService.MyMethod
|
|
72
|
+
|
|
73
|
+
# Call a method
|
|
74
|
+
grpcurl -plaintext -d '{"name": "World"}' localhost:50051 mypackage.MyService/SayHello
|
|
75
|
+
|
|
76
|
+
# Call with headers
|
|
77
|
+
grpcurl -plaintext \
|
|
78
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
79
|
+
-d '{"id": 1}' \
|
|
80
|
+
localhost:50051 mypackage.MyService/GetUser
|
|
81
|
+
|
|
82
|
+
# Stream response
|
|
83
|
+
grpcurl -plaintext localhost:50051 mypackage.MyService/ListUsers
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Example .proto File
|
|
87
|
+
|
|
88
|
+
```protobuf
|
|
89
|
+
syntax = "proto3";
|
|
90
|
+
|
|
91
|
+
package myservice.v1;
|
|
92
|
+
|
|
93
|
+
option go_package = "github.com/myorg/myservice/gen/go/myservice/v1";
|
|
94
|
+
|
|
95
|
+
service UserService {
|
|
96
|
+
rpc GetUser(GetUserRequest) returns (GetUserResponse);
|
|
97
|
+
rpc ListUsers(ListUsersRequest) returns (stream User);
|
|
98
|
+
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
message User {
|
|
102
|
+
string id = 1;
|
|
103
|
+
string name = 2;
|
|
104
|
+
string email = 3;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
message GetUserRequest {
|
|
108
|
+
string id = 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
message GetUserResponse {
|
|
112
|
+
User user = 1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
message ListUsersRequest {}
|
|
116
|
+
|
|
117
|
+
message CreateUserRequest {
|
|
118
|
+
string name = 1;
|
|
119
|
+
string email = 2;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
message CreateUserResponse {
|
|
123
|
+
User user = 1;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## buf.yaml Configuration
|
|
128
|
+
|
|
129
|
+
```yaml
|
|
130
|
+
version: v2
|
|
131
|
+
modules:
|
|
132
|
+
- path: proto
|
|
133
|
+
lint:
|
|
134
|
+
use:
|
|
135
|
+
- DEFAULT
|
|
136
|
+
breaking:
|
|
137
|
+
use:
|
|
138
|
+
- FILE
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## buf.gen.yaml (Code Generation)
|
|
142
|
+
|
|
143
|
+
```yaml
|
|
144
|
+
version: v2
|
|
145
|
+
plugins:
|
|
146
|
+
# Go
|
|
147
|
+
- remote: buf.build/protocolbuffers/go
|
|
148
|
+
out: gen/go
|
|
149
|
+
opt:
|
|
150
|
+
- paths=source_relative
|
|
151
|
+
- remote: buf.build/grpc/go
|
|
152
|
+
out: gen/go
|
|
153
|
+
opt:
|
|
154
|
+
- paths=source_relative
|
|
155
|
+
|
|
156
|
+
# Python
|
|
157
|
+
- remote: buf.build/protocolbuffers/python
|
|
158
|
+
out: gen/python
|
|
159
|
+
|
|
160
|
+
# TypeScript (Node.js)
|
|
161
|
+
- remote: buf.build/connectrpc/node
|
|
162
|
+
out: gen/typescript
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Language-Specific Setup
|
|
166
|
+
|
|
167
|
+
### Go
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Install Go gRPC plugins
|
|
171
|
+
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
|
172
|
+
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Node.js
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Install grpc-tools for Node.js
|
|
179
|
+
npm install --save-dev grpc-tools @grpc/grpc-js @grpc/proto-loader
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Python
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Install Python gRPC tools
|
|
186
|
+
pip install grpcio grpcio-tools
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Use Cases
|
|
190
|
+
|
|
191
|
+
- **gRPC API development** - Design, implement, and test gRPC services
|
|
192
|
+
- **Protocol Buffers schema management** - Lint, format, and version schemas
|
|
193
|
+
- **gRPC endpoint testing** - Test services without a full client implementation
|
|
194
|
+
- **Microservice communication** - Develop services that communicate via gRPC
|
|
195
|
+
- **API documentation** - Describe and explore gRPC service contracts
|
|
196
|
+
|
|
197
|
+
## Troubleshooting
|
|
198
|
+
|
|
199
|
+
### protoc plugins not found
|
|
200
|
+
|
|
201
|
+
After installing language-specific plugins, ensure they are in your `PATH`:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Go plugins
|
|
205
|
+
export PATH="$PATH:$(go env GOPATH)/bin"
|
|
206
|
+
|
|
207
|
+
# Verify
|
|
208
|
+
which protoc-gen-go
|
|
209
|
+
which protoc-gen-go-grpc
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### buf lint errors
|
|
213
|
+
|
|
214
|
+
Run `buf lint` to see all lint errors:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
buf lint
|
|
218
|
+
# proto/api/v1/service.proto:10:1:Service name "userService" should be PascalCase
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### grpcurl: server does not support the reflection API
|
|
222
|
+
|
|
223
|
+
Enable gRPC server reflection in your service:
|
|
224
|
+
|
|
225
|
+
```go
|
|
226
|
+
// Go example
|
|
227
|
+
import "google.golang.org/grpc/reflection"
|
|
228
|
+
reflection.Register(grpcServer)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## References
|
|
232
|
+
|
|
233
|
+
- [Protocol Buffers Documentation](https://protobuf.dev/)
|
|
234
|
+
- [Buf Documentation](https://buf.build/docs/)
|
|
235
|
+
- [grpcurl GitHub](https://github.com/fullstorydev/grpcurl)
|
|
236
|
+
- [gRPC Documentation](https://grpc.io/docs/)
|
|
237
|
+
|
|
238
|
+
**Related Overlays:**
|
|
239
|
+
|
|
240
|
+
- `go` - Go language runtime
|
|
241
|
+
- `nodejs` - Node.js runtime
|
|
242
|
+
- `python` - Python runtime
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.base.schema.json",
|
|
3
|
+
"features": {
|
|
4
|
+
"./features/cross-distro-packages": {
|
|
5
|
+
"apt": "protobuf-compiler",
|
|
6
|
+
"apk": "protobuf"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"customizations": {
|
|
10
|
+
"vscode": {
|
|
11
|
+
"extensions": ["zxh404.vscode-proto3", "bufbuild.vscode-buf"]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
id: grpc-tools
|
|
2
|
+
name: gRPC Tools
|
|
3
|
+
description: Protocol Buffers compiler, Buf, and grpcurl for gRPC development
|
|
4
|
+
category: dev
|
|
5
|
+
supports: []
|
|
6
|
+
requires: []
|
|
7
|
+
suggests: []
|
|
8
|
+
conflicts: []
|
|
9
|
+
tags:
|
|
10
|
+
- dev
|
|
11
|
+
- grpc
|
|
12
|
+
- protobuf
|
|
13
|
+
- api
|
|
14
|
+
ports: []
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# gRPC Tools setup script
|
|
3
|
+
# Installs buf CLI and grpcurl
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🔧 Setting up gRPC Tools..."
|
|
8
|
+
|
|
9
|
+
# Install buf CLI
|
|
10
|
+
echo "📦 Installing buf CLI..."
|
|
11
|
+
BUF_VERSION="${BUF_VERSION:-1.47.2}"
|
|
12
|
+
|
|
13
|
+
# Detect architecture
|
|
14
|
+
ARCH=$(uname -m)
|
|
15
|
+
case "$ARCH" in
|
|
16
|
+
x86_64) BUF_ARCH="x86_64" ;;
|
|
17
|
+
aarch64 | arm64) BUF_ARCH="aarch64" ;;
|
|
18
|
+
*) echo " ⚠️ Unsupported architecture: $ARCH, skipping buf installation" ; BUF_ARCH="" ;;
|
|
19
|
+
esac
|
|
20
|
+
|
|
21
|
+
if [ -n "$BUF_ARCH" ]; then
|
|
22
|
+
BUF_URL="https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-${BUF_ARCH}"
|
|
23
|
+
curl -sSL "$BUF_URL" -o /tmp/buf
|
|
24
|
+
sudo install -m 755 /tmp/buf /usr/local/bin/buf
|
|
25
|
+
rm -f /tmp/buf
|
|
26
|
+
echo " ✅ buf installed: $(buf --version)"
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Install grpcurl
|
|
30
|
+
echo "📦 Installing grpcurl..."
|
|
31
|
+
GRPCURL_VERSION="${GRPCURL_VERSION:-1.9.2}"
|
|
32
|
+
|
|
33
|
+
GRPCURL_ARCH="$(uname -m)"
|
|
34
|
+
case "$GRPCURL_ARCH" in
|
|
35
|
+
x86_64) GRPCURL_ARCH="x86_64" ;;
|
|
36
|
+
aarch64 | arm64) GRPCURL_ARCH="arm64" ;;
|
|
37
|
+
*) echo " ⚠️ Unsupported architecture: $GRPCURL_ARCH, skipping grpcurl installation" ; GRPCURL_ARCH="" ;;
|
|
38
|
+
esac
|
|
39
|
+
|
|
40
|
+
if [ -n "$GRPCURL_ARCH" ]; then
|
|
41
|
+
GRPCURL_URL="https://github.com/fullstorydev/grpcurl/releases/download/v${GRPCURL_VERSION}/grpcurl_${GRPCURL_VERSION}_linux_${GRPCURL_ARCH}.tar.gz"
|
|
42
|
+
curl -sSL "$GRPCURL_URL" | sudo tar -xz -C /usr/local/bin grpcurl
|
|
43
|
+
echo " ✅ grpcurl installed: $(grpcurl --version 2>&1 | head -1)"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
echo ""
|
|
47
|
+
echo "✅ gRPC Tools setup complete"
|
|
48
|
+
echo ""
|
|
49
|
+
echo "💡 Quick start:"
|
|
50
|
+
echo " protoc --version # Protocol Buffers compiler"
|
|
51
|
+
echo " buf --version # Buf CLI (schema management)"
|
|
52
|
+
echo " grpcurl --version # gRPC curl"
|
|
53
|
+
echo ""
|
|
54
|
+
echo "📚 Resources:"
|
|
55
|
+
echo " https://protobuf.dev/ # Protocol Buffers documentation"
|
|
56
|
+
echo " https://buf.build/docs/ # Buf CLI documentation"
|
|
57
|
+
echo " https://github.com/fullstorydev/grpcurl # grpcurl documentation"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Verification script for gRPC Tools overlay
|
|
3
|
+
# Confirms protoc, buf, and grpcurl are installed
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🔍 Verifying gRPC Tools overlay..."
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
ALL_CHECKS_PASSED=true
|
|
11
|
+
|
|
12
|
+
# Check protoc
|
|
13
|
+
echo "1️⃣ Checking protoc (Protocol Buffers compiler)..."
|
|
14
|
+
if command -v protoc &> /dev/null; then
|
|
15
|
+
echo " ✅ protoc found: $(protoc --version)"
|
|
16
|
+
else
|
|
17
|
+
echo " ❌ protoc not found"
|
|
18
|
+
ALL_CHECKS_PASSED=false
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Check buf
|
|
22
|
+
echo ""
|
|
23
|
+
echo "2️⃣ Checking buf CLI..."
|
|
24
|
+
if command -v buf &> /dev/null; then
|
|
25
|
+
echo " ✅ buf found: $(buf --version)"
|
|
26
|
+
else
|
|
27
|
+
echo " ❌ buf not found"
|
|
28
|
+
ALL_CHECKS_PASSED=false
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Check grpcurl
|
|
32
|
+
echo ""
|
|
33
|
+
echo "3️⃣ Checking grpcurl..."
|
|
34
|
+
if command -v grpcurl &> /dev/null; then
|
|
35
|
+
echo " ✅ grpcurl found: $(grpcurl --version 2>&1 | head -1)"
|
|
36
|
+
else
|
|
37
|
+
echo " ❌ grpcurl not found"
|
|
38
|
+
ALL_CHECKS_PASSED=false
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
echo ""
|
|
42
|
+
if [ "$ALL_CHECKS_PASSED" = true ]; then
|
|
43
|
+
echo "✅ gRPC Tools overlay verification complete"
|
|
44
|
+
else
|
|
45
|
+
echo "❌ Some gRPC tools are missing"
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|