Skip to content

Commit fca4c7b

Browse files
committed
feat: Implement template engine for generating a2a servers
- Added a new template engine in `internal/templates/engine.go` to handle template execution with context. - Introduced enterprise template files in `internal/templates/enterprise.go`, including middleware, metrics, logging, and authentication features. - Created minimal template files in `internal/templates/minimal.go` for a basic A2A server without AI capabilities. - Implemented main application entry point in `main.go` to initialize and execute the command. Signed-off-by: Eden Reich <eden.reich@gmail.com>
1 parent e6e6b90 commit fca4c7b

31 files changed

+4916
-2
lines changed

.devcontainer/Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
FROM mcr.microsoft.com/devcontainers/go:1-1.24-bookworm
2+
3+
ENV TASK_VERSION=v3.43.3 \
4+
GOLANG_CI_LINT_VERSION=v2.1.6 \
5+
GITHUB_CLI_VERSION=2.74.0 \
6+
NODE_VERSION=lts \
7+
SEMANTIC_RELEASE_VERSION=v24.2.5
8+
9+
RUN apt-get update && \
10+
# Determine architecture
11+
architecture=$(uname -m); \
12+
architecture_pretty="arm64"; \
13+
if [ "$architecture" = "x86_64" ]; then \
14+
architecture_pretty="amd64"; \
15+
fi && \
16+
echo "Installing depenenices for ${architecture}" && \
17+
# Install networking utilities
18+
apt-get install -y file iputils-ping dnsutils && \
19+
# Install Node.js for Spectral
20+
curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \
21+
apt-get install -y nodejs && \
22+
# Install Task
23+
curl -s https://taskfile.dev/install.sh | sh -s -- -b /usr/local/bin ${TASK_VERSION} && \
24+
# Install golangci-lint
25+
curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin ${GOLANG_CI_LINT_VERSION} && \
26+
# Install GitHub CLI
27+
curl -fsSL https://github.com/cli/cli/releases/download/v${GITHUB_CLI_VERSION}/gh_${GITHUB_CLI_VERSION}_linux_${architecture_pretty}.tar.gz -o /tmp/gh_${GITHUB_CLI_VERSION}_linux_${architecture_pretty}.tar.gz && \
28+
tar -xzf /tmp/gh_${GITHUB_CLI_VERSION}_linux_${architecture_pretty}.tar.gz -C /tmp && \
29+
chmod +x /tmp/gh_${GITHUB_CLI_VERSION}_linux_${architecture_pretty}/bin/gh && \
30+
mv /tmp/gh_${GITHUB_CLI_VERSION}_linux_${architecture_pretty}/bin/gh /usr/local/bin/gh && \
31+
# Install semantic-release and plugins
32+
npm install -g semantic-release@${SEMANTIC_RELEASE_VERSION} \
33+
@semantic-release/changelog \
34+
@semantic-release/git \
35+
@semantic-release/github \
36+
conventional-changelog-cli \
37+
conventional-changelog-conventionalcommits && \
38+
# Install js-yaml for converting JSON RPC schema to YAML
39+
npm i -g js-yaml@4.1.0 && \
40+
# Install Claude code
41+
npm i -g @anthropic-ai/claude-code && \
42+
# Clean up
43+
apt-get clean && \
44+
rm -rf /var/lib/apt/lists/*
45+
46+
USER vscode
47+
48+
# Use Powerlevel10k theme
49+
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/vscode/.powerlevel10k
50+
51+
# Configure Powerlevel10k
52+
RUN echo 'source /home/vscode/.powerlevel10k/powerlevel10k.zsh-theme' >> /home/vscode/.zshrc && \
53+
echo 'POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true' >> /home/vscode/.zshrc && \
54+
echo 'POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)' >> /home/vscode/.zshrc && \
55+
echo 'POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time status)' >> /home/vscode/.zshrc && \
56+
echo 'POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0' >> /home/vscode/.zshrc && \
57+
echo 'POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=2' >> /home/vscode/.zshrc && \
58+
echo 'POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT="duration"' >> /home/vscode/.zshrc
59+
60+
61+
# Shell completion
62+
RUN echo "source <(gh completion -s zsh)" >> /home/vscode/.zshrc && \
63+
echo "source <(task --completion zsh)" >> /home/vscode/.zshrc

.devcontainer/devcontainer.json

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"name": "Debian with Go",
3+
"dockerFile": "Dockerfile",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:latest": {}
6+
},
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"task.vscode-task",
11+
"redhat.vscode-yaml",
12+
"ms-azuretools.vscode-docker",
13+
"streetsidesoftware.code-spell-checker",
14+
"esbenp.prettier-vscode",
15+
"github.vscode-github-actions",
16+
"github.vscode-pull-request-github",
17+
"golang.go",
18+
"ms-vscode.go"
19+
],
20+
"settings": {
21+
"terminal.integrated.defaultProfile.linux": "zsh",
22+
"editor.renderWhitespace": "all",
23+
"cSpell.enabled": true,
24+
"cSpell.files": ["**/*.md"],
25+
"editor.defaultFormatter": "esbenp.prettier-vscode",
26+
"[go]": {
27+
"editor.formatOnSave": true,
28+
"editor.defaultFormatter": "golang.go"
29+
},
30+
"git.enableCommitSigning": true,
31+
"dev.containers.copyGitConfig": true,
32+
"githubPullRequests.experimental.chat": true,
33+
"githubPullRequests.experimental.notificationsView": true,
34+
"files.insertFinalNewline": true,
35+
"github.copilot.enable": {
36+
"*": true
37+
},
38+
"github.copilot.advanced": {
39+
"authProvider": "github"
40+
},
41+
"github.copilot.chat.codeGeneration.useInstructionFiles": true,
42+
"github.copilot.chat.codeGeneration.instructions": [
43+
{
44+
"file": ".github/copilot-instructions.md"
45+
},
46+
{
47+
"file": "../README.md"
48+
}
49+
],
50+
"github.copilot.chat.commitMessageGeneration.instructions": [
51+
{
52+
"text": "Always use conventional commit message format."
53+
}
54+
],
55+
"mcp": {
56+
"servers": {
57+
"context7": {
58+
"command": "docker",
59+
"args": [
60+
"run",
61+
"-i",
62+
"--rm",
63+
"node:lts",
64+
"npx",
65+
"-y",
66+
"@upstash/context7-mcp@latest"
67+
]
68+
},
69+
"github": {
70+
"command": "docker",
71+
"args": [
72+
"run",
73+
"-i",
74+
"--rm",
75+
"-e",
76+
"GITHUB_TOKEN=${localEnv:GITHUB_TOKEN}",
77+
"mcp/github"
78+
]
79+
}
80+
}
81+
}
82+
}
83+
}
84+
},
85+
"remoteEnv": {
86+
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
87+
}
88+
}

.github/copilot-instructions.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Custom Instructions for Copilot
2+
3+
Today is Jul 20, 2025.
4+
5+
- Always use context7 to check for the latest updates, features, or best practices of a library relevant to the task at hand.
6+
- Always prefer Table-Driven Testing: When writing tests.
7+
- Always use Early Returns: Favor early returns to simplify logic and avoid deep nesting with if-else structures.
8+
- Always prefer switch statements over if-else chains: Use switch statements for cleaner and more readable code when checking multiple conditions.
9+
- Always run `task lint` before committing code to ensure it adheres to the project's linting rules.
10+
- Always run `task test` before committing code to ensure all tests pass.
11+
- Always search for the simplest solution first before considering more complex alternatives.
12+
- Always prefer type safety over dynamic typing: Use strong typing and interfaces to ensure type safety and reduce runtime errors.
13+
- Always use lowercase log messages for consistency and readability.
14+
- When possible code to an interface so it's easier to mock in tests.
15+
- When writing tests, each test case should have it's own isolated mock server mock dependencies so it's easier to understand and maintain.
16+
17+
## Development Workflow
18+
19+
1. Run `task lint` to ensure code quality.
20+
2. Run `task test` to ensure all tests pass.
21+
22+
## Available Tools and MCPs
23+
24+
- context7 - Helps by finding the latest updates, features, or best practices of a library relevant to the task at hand.
25+
26+
## Related Repositories
27+
28+
### Core Inference Gateway
29+
30+
- **[Main Repository](https://github.com/inference-gateway)** - The main inference gateway org.
31+
- **[Documentation](https://docs.inference-gateway.com)** - Official documentation and guides
32+
- **[UI](https://github.com/inference-gateway/ui)** - Web interface for the inference gateway
33+
- **[Schemas](https://github.com/inference-gateway/schemas)** - Shared schemas and type definitions
34+
35+
### SDKs & Client Libraries
36+
37+
- **[Go SDK](https://github.com/inference-gateway/go-sdk)** - Go client library
38+
- **[Rust SDK](https://github.com/inference-gateway/rust-sdk)** - Rust client library
39+
- **[TypeScript SDK](https://github.com/inference-gateway/typescript-sdk)** - TypeScript/JavaScript client library
40+
- **[Python SDK](https://github.com/inference-gateway/python-sdk)** - Python client library
41+
42+
### A2A (Agent-to-Agent) Ecosystem
43+
44+
- **[Awesome A2A](https://github.com/inference-gateway/awesome-a2a)** - Curated list of A2A-compatible agents
45+
- **[Google Calendar Agent](https://github.com/inference-gateway/google-calendar-agent)** - Agent for Google Calendar integration
46+
47+
### Internal Tools
48+
49+
- **[Internal Tools](https://github.com/inference-gateway/tools)** - Collection of internal tools and utilities
50+
51+
## A2A Official Documentation
52+
53+
- **[A2A Official Docs](https://google-a2a.github.io/A2A/latest/)** - Official documentation for A2A agents and integrations

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
ci:
13+
runs-on: ubuntu-24.04
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4.2.2
18+
with:
19+
persist-credentials: false
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5.5.0
23+
with:
24+
go-version: '1.24'
25+
cache: true
26+
27+
- name: Install golangci-lint
28+
run: |
29+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v2.1.6
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4.4.0
33+
with:
34+
node-version: 'lts/*'
35+
36+
- name: Tidy Go modules
37+
run: find . -name 'go.mod' -execdir go mod tidy \;
38+
39+
- name: Check dirty
40+
run: git diff --exit-code
41+
42+
- name: Run Lint
43+
run: golangci-lint run
44+
45+
- name: Build
46+
run: go build .
47+
48+
- name: Test
49+
run: go test -v ./...
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Claude Code Review
2+
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
8+
jobs:
9+
claude-review:
10+
if: |
11+
github.event_name == 'issue_comment' &&
12+
github.event.issue.pull_request &&
13+
contains(github.event.comment.body, '@claude /review')
14+
runs-on: ubuntu-24.04
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
issues: write
19+
id-token: write
20+
actions: read
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 1
27+
28+
- name: Run Claude Code Review
29+
id: claude-review
30+
uses: anthropics/claude-code-action@beta
31+
with:
32+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
33+
additional_permissions: |
34+
actions: read
35+
use_commit_signing: true
36+
base_branch: main
37+
branch_prefix: "claude/"
38+
mcp_config: |
39+
{
40+
"mcpServers": {
41+
"context7": {
42+
"command": "npx",
43+
"args": ["-y", "@upstash/context7-mcp@latest"],
44+
"env": {}
45+
}
46+
}
47+
}
48+
direct_prompt: |
49+
Please review this pull request and provide feedback on:
50+
- Code quality and best practices
51+
- Potential bugs or issues
52+
- Performance considerations
53+
- Security concerns
54+
- Test coverage
55+
56+
Be constructive and helpful in your feedback.

.github/workflows/claude.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
pull_request_review_comment:
8+
types:
9+
- created
10+
issues:
11+
types:
12+
- opened
13+
- assigned
14+
pull_request_review:
15+
types:
16+
- submitted
17+
18+
jobs:
19+
claude:
20+
if: |
21+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude /review')) ||
22+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude /review')) ||
23+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && !contains(github.event.review.body, '@claude /review')) ||
24+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
25+
runs-on: ubuntu-24.04
26+
permissions:
27+
contents: write
28+
pull-requests: write
29+
issues: write
30+
id-token: write
31+
actions: read
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 1
37+
38+
- name: Install golangci-lint
39+
run: |
40+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v2.1.6
41+
42+
- name: Install task
43+
run: |
44+
curl -s https://taskfile.dev/install.sh | sh -s -- -b /usr/local/bin v3.43.3
45+
46+
- name: Run Claude Code
47+
id: claude
48+
uses: anthropics/claude-code-action@beta
49+
with:
50+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
51+
additional_permissions: |
52+
actions: read
53+
use_commit_signing: true
54+
base_branch: main
55+
branch_prefix: "claude/"
56+
allowed_tools: |
57+
Bash(task:*)
58+
Bash(go:*)
59+
Bash(gh:*)
60+
Bash(git:*)
61+
custom_instructions: |
62+
IMPORTANT: You must NEVER push directly to the main branch. Always:
63+
1. Create a new feature branch (claude/feature-name)
64+
2. Make your changes on the feature branch
65+
3. Open a pull request to main
66+
4. Wait for review and approval before merging
67+
68+
COMMIT MESSAGE FORMAT: Always use conventional commits with capital letters.
69+
Follow the format: "type(scope): Description" where the description starts with a capital letter.
70+
Examples: "feat(a2a): Add retry mechanism for agent connections", "fix(auth): Resolve token validation issue"
71+
72+
Follow the development workflow specified in the coding instructions.
73+
mcp_config: |
74+
{
75+
"mcpServers": {
76+
"context7": {
77+
"command": "npx",
78+
"args": ["-y", "@upstash/context7-mcp@latest"],
79+
"env": {}
80+
}
81+
}
82+
}

0 commit comments

Comments
 (0)