Skip to content

Commit ce08264

Browse files
committed
feat(core): Complete DevGuardian v2 rollout with CI/CD and branding
This commit finalizes the DevGuardian v2 rollout, incorporating: - Project-wide "Core Module" branding. - New CI/CD pipeline with linting, testing, building, and Docker image creation. - Dockerfile for containerizing the application.
1 parent e2562d4 commit ce08264

18 files changed

Lines changed: 267 additions & 16 deletions

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python 3.10
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.10"
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install uv
24+
uv pip install -e .[cli] --all-extras
25+
- name: Lint with ruff
26+
run: |
27+
uv pip install ruff
28+
ruff check .
29+
- name: Format with ruff
30+
run: |
31+
ruff format .
32+
33+
test:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Set up Python 3.10
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: "3.10"
41+
- name: Install dependencies
42+
run: |
43+
python -m pip install --upgrade pip
44+
pip install uv
45+
uv pip install -e .[cli] --all-extras
46+
- name: Install pytest and pytest-cov
47+
run: |
48+
uv pip install pytest pytest-cov
49+
- name: Run tests with pytest
50+
run: |
51+
pytest --cov=devguardian --cov-report term-missing
52+
53+
build:
54+
runs-on: ubuntu-latest
55+
needs: [lint, test]
56+
steps:
57+
- uses: actions/checkout@v4
58+
- name: Set up Python 3.10
59+
uses: actions/setup-python@v5
60+
with:
61+
python-version: "3.10"
62+
- name: Install dependencies
63+
run: |
64+
python -m pip install --upgrade pip
65+
pip install hatchling
66+
- name: Build package
67+
run: |
68+
python -m hatchling build
69+
70+
docker:
71+
runs-on: ubuntu-latest
72+
needs: [lint, test]
73+
steps:
74+
- uses: actions/checkout@v4
75+
- name: Build the Docker image
76+
run: docker build . --file Dockerfile --tag devguardian:latest

Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Use a multi-stage build to reduce the final image size.
2+
3+
# --- Builder Stage: Install Dependencies and Package the Application ---
4+
FROM python:3.11-slim-bookworm AS builder
5+
6+
# Set the working directory
7+
WORKDIR /app
8+
9+
# Copy the pyproject.toml and poetry.lock files
10+
COPY pyproject.toml .
11+
COPY uv.lock .
12+
13+
# Install uv and use it to install project dependencies
14+
RUN pip install uv
15+
RUN uv pip install --no-cache-dir --no-index --find-links=. .
16+
17+
# Copy the application code
18+
COPY devguardian /app/devguardian
19+
COPY README.md .
20+
21+
# --- Final Stage: Create the Production Image ---
22+
FROM python:3.11-slim-bookworm
23+
24+
# Set the working directory
25+
WORKDIR /app
26+
27+
# Copy the dependencies from the builder stage
28+
COPY --from=builder /app/.venv ./.venv
29+
COPY --from=builder /app/devguardian /app/devguardian
30+
COPY --from=builder /app/README.md /app/README.md
31+
32+
# Make .venv executable
33+
ENV PATH="/app/.venv/bin:${PATH}"
34+
35+
# Set environment variables (optional, but good practice)
36+
ENV PYTHONUNBUFFERED=1
37+
38+
# Expose the port (if necessary - determine from server.py)
39+
EXPOSE 8000
40+
41+
# Command to run the application
42+
CMD ["devguardian"]

devguardian/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
"""DevGuardian MCP Server - Package Init"""
1+
# 🛡️ DevGuardian Project — Core Module
2+
"""DevGuardian MCP Server - Package Init"""

devguardian/agents/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
"""DevGuardian Agents Package"""
1+
# 🛡️ DevGuardian Project — Core Module
2+
"""DevGuardian Agents Package"""

devguardian/agents/engineer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# 🛡️ DevGuardian Project — Core Module
12
"""
23
🛠️ DevGuardian Engineering Agent (Stateful)
34
Powered by LangGraph, LangChain, and SQLite.
@@ -90,4 +91,4 @@ def should_continue(state: AgentState):
9091
workflow.add_conditional_edges("agent", should_continue)
9192
workflow.add_edge("tools", "agent")
9293

93-
return workflow.compile()
94+
return workflow.compile()

devguardian/agents/swarm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# 🛡️ DevGuardian Project — Core Module
12
"""
23
🤖 DevGuardian Agent Swarm
34
===========================
@@ -44,7 +45,7 @@ def _get_llm(temperature: float = 0.2) -> ChatGoogleGenerativeAI:
4445
)
4546

4647

47-
# ---------------------------------------------------------------------------
48+
# ----------------------------------------------------------------及ひ-------------------------------------
4849
# Node: Load Project DNA (runs once at start)
4950
# ---------------------------------------------------------------------------
5051
def load_dna(state: SwarmState) -> SwarmState:
@@ -205,4 +206,4 @@ async def run_swarm(task: str, project_path: str) -> str:
205206
f"## 🧪 Tester's Notes\n{test_notes}\n\n"
206207
f"---\n\n"
207208
f"{final}"
208-
)
209+
)

devguardian/tools/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
"""DevGuardian Tools Package"""
1+
# 🛡️ DevGuardian Project — Core Module
2+
"""DevGuardian Tools Package"""

devguardian/tools/code_helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# 🛡️ DevGuardian Project — Core Module
12
"""
23
Code helper tool — explain, review, generate, and improve code via Gemini.
34
@@ -153,4 +154,4 @@ def improve_code(
153154
f"\nImprove and refactor the following code:\n\n```\n{code}\n```\n\n"
154155
"Return the improved code and a clear summary of every change made."
155156
)
156-
return ask_gemini(prompt, system_instruction=_SYSTEM)
157+
return ask_gemini(prompt, system_instruction=_SYSTEM)

devguardian/tools/debugger.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# 🛡️ DevGuardian Project — Core Module
12
"""
23
Debug tool — sends error messages / stack traces to Gemini and returns a fix.
34
@@ -44,7 +45,7 @@ def debug_error(
4445
"""
4546
ctx = ""
4647
if project_path:
47-
ctx = f"\n\n{build_project_context(project_path, code=code_snippet)}\n"
48+
ctx = f"\n\n🛡️ DevGuardian — Project Context:\n{build_project_context(project_path, code_snippet)}\n"
4849

4950
lang_hint = f"Language: {language}\n" if language else ""
5051

@@ -58,4 +59,4 @@ def debug_error(
5859

5960
prompt += "\nPlease debug this and provide a clear fix."
6061

61-
return ask_gemini(prompt, system_instruction=_SYSTEM)
62+
return ask_gemini(prompt, system_instruction=_SYSTEM)

devguardian/tools/github_review.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# 🛡️ DevGuardian Project — Core Module
12
"""
23
🌐 GitHub PR Reviewer
34
======================
@@ -121,4 +122,4 @@ def review_pull_request(
121122
f"# 🌐 DevGuardian PR Review — #{pr_number}\n"
122123
f"**{title}** by @{author}\n\n"
123124
f"{review}"
124-
)
125+
)

0 commit comments

Comments
 (0)