agent-workflow-kit-cli 1.3.3 โ 1.3.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 +158 -9
- package/dist/cli/commands/add.js +1 -1
- package/dist/cli/commands/doctor.js +145 -47
- package/dist/cli/commands/ui.js +192 -0
- package/dist/cli/index.js +15 -1
- package/package.json +4 -2
- package/templates/devops/AGENTS.md.hbs +32 -0
- package/templates/devops/skills/devops/SKILL.md +477 -0
- package/templates/diagram/AGENTS.md.hbs +30 -0
- package/templates/diagram/skills/drawio-diagram/SKILL.md +427 -0
- package/templates/dotnet/AGENTS.md.hbs +11 -7
- package/templates/express/AGENTS.md.hbs +13 -9
- package/templates/fastapi/AGENTS.md.hbs +25 -3
- package/templates/fastapi/rules/api-testing.md +24 -0
- package/templates/fastapi/rules/database-async.md +26 -0
- package/templates/golang/AGENTS.md.hbs +15 -9
- package/templates/golang/skills/golang-db/SKILL.md +27 -0
- package/templates/golang/skills/golang-feature/SKILL.md +42 -0
- package/templates/nestjs/AGENTS.md.hbs +13 -9
- package/templates/next-js/AGENTS.md.hbs +13 -9
- package/templates/rust/AGENTS.md.hbs +16 -9
- package/templates/rust/skills/rust-db/SKILL.md +27 -0
- package/templates/rust/skills/rust-feature/SKILL.md +34 -0
- package/ui-dist/assets/Antigravity-IRHfUNd0.webp +0 -0
- package/ui-dist/assets/Codex-B3jt494H.png +0 -0
- package/ui-dist/assets/Logo-DARneFJW.png +0 -0
- package/ui-dist/assets/ReactTS-Cv7D5v-r.png +0 -0
- package/ui-dist/assets/devops-DfKGji1l.png +0 -0
- package/ui-dist/assets/drawio-D1K35acK.png +0 -0
- package/ui-dist/assets/expressjs-cjiJ1MIq.png +0 -0
- package/ui-dist/assets/fastapi-x75ez5Tf.png +0 -0
- package/ui-dist/assets/golang-DWpOzDNa.png +0 -0
- package/ui-dist/assets/index-BhHU4Khx.js +372 -0
- package/ui-dist/assets/index-C0BHmZv8.css +1 -0
- package/ui-dist/assets/nestjs-CZk_FY6t.png +0 -0
- package/ui-dist/assets/nextjs-DIQjv1J3.png +0 -0
- package/ui-dist/assets/python-CfV_cs4B.png +0 -0
- package/ui-dist/assets/rust-A_NnBwqP.png +0 -0
- package/ui-dist/assets/springbootjava--7jHXzq_.jpg +0 -0
- package/ui-dist/index.html +47 -0
package/dist/cli/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
import { runInit } from "./commands/init.js";
|
|
8
|
+
import { runUiServer } from "./commands/ui.js";
|
|
8
9
|
import { runAdd } from "./commands/add.js";
|
|
9
10
|
import { runSync } from "./commands/sync.js";
|
|
10
11
|
import { runDoctor } from "./commands/doctor.js";
|
|
@@ -19,7 +20,7 @@ export function runCli() {
|
|
|
19
20
|
program
|
|
20
21
|
.name("agent-workflow-kit")
|
|
21
22
|
.description("Generate AI coding workflows/rules/templates for Codex and Antigravity")
|
|
22
|
-
.version("1.3.
|
|
23
|
+
.version("1.3.5");
|
|
23
24
|
program
|
|
24
25
|
.command("init")
|
|
25
26
|
.description("Initialize agent guidelines and skills for the repository")
|
|
@@ -35,6 +36,19 @@ export function runCli() {
|
|
|
35
36
|
process.exit(1);
|
|
36
37
|
}
|
|
37
38
|
});
|
|
39
|
+
program
|
|
40
|
+
.command("ui")
|
|
41
|
+
.description("Launch the local configuration wizard web dashboard")
|
|
42
|
+
.option("-p, --port <port>", "Port to run the UI server on", "4321")
|
|
43
|
+
.action(async (options) => {
|
|
44
|
+
try {
|
|
45
|
+
await runUiServer(options);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
console.error(chalk.red(`Error running ui: ${err instanceof Error ? err.message : String(err)}`));
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
38
52
|
program
|
|
39
53
|
.command("add <stack>")
|
|
40
54
|
.description("Manually add/install a stack pack to a specific folder")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-workflow-kit-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "AI-Ready Repository Workflow Generator & Guideline Optimizer for Codex and Antigravity",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,14 +11,16 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
13
13
|
"templates",
|
|
14
|
+
"ui-dist",
|
|
14
15
|
"LICENSE",
|
|
15
16
|
"README.md"
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
18
19
|
"build": "tsc",
|
|
20
|
+
"build:ui": "node scripts/copy-ui.js",
|
|
19
21
|
"start": "node dist/index.js",
|
|
20
22
|
"test": "vitest run",
|
|
21
|
-
"prepublishOnly": "npm run build && npm test"
|
|
23
|
+
"prepublishOnly": "npm run build && npm run build:ui && npm test"
|
|
22
24
|
},
|
|
23
25
|
"author": "Truong & Cat",
|
|
24
26
|
"license": "MIT",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
## ๐ DevOps & Deployment Automation Guide
|
|
2
|
+
|
|
3
|
+
### ๐ DevOps Workflow
|
|
4
|
+
When setting up CI/CD pipelines or containerizing applications, apply these core principles:
|
|
5
|
+
1. **Analyze Project Runtime:** Identify the language ecosystem (Node.js, Python, Go, Rust, Java, .NET) and detect package manager/lockfiles (e.g. `package-lock.json`, `poetry.lock`, `Cargo.lock`, `go.sum`).
|
|
6
|
+
2. **Implement Secure Multi-Stage Builds:** Separate build dependencies from runtime dependencies. The runtime image must be minimal (e.g., alpine, distroless) and must never run as `root`.
|
|
7
|
+
3. **Establish CI/CD Pipelines:** Setup linting, automated testing, and secure Docker image publication workflows inside GitHub Actions.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### ๐๏ธ Available DevOps Templates
|
|
12
|
+
Refer to the detailed rules below:
|
|
13
|
+
- Scaffolding secure Dockerfiles and GitHub Actions workflows: `@devops`
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### ๐๏ธ Strict Container & Pipeline Standards
|
|
18
|
+
|
|
19
|
+
#### 1. Dockerfile Guidelines
|
|
20
|
+
- **Multi-Stage Builds:** Always use a builder stage to download tools, compile source code, and install development headers, then copy only the compiled binaries/compiled assets to the final stage.
|
|
21
|
+
- **Rootless Execution:** Declare a non-privileged user (e.g., `nobody`, `appuser`, `node`) using the `USER` directive in the final stage.
|
|
22
|
+
- **Caching Optimization:** Copy dependency manifest files (like `package.json`, `go.mod`, `Cargo.toml`) and perform installation steps *before* copying the source code directory to maximize layer caching efficiency.
|
|
23
|
+
- **Base Images:** Prefer minimal, stable base images (like `node:20-alpine`, `python:3.11-slim`, `gcr.io/distroless/static`).
|
|
24
|
+
|
|
25
|
+
#### 2. GitHub Actions CI/CD Rules
|
|
26
|
+
- **Security:** Use secrets (`secrets.GITHUB_TOKEN` or custom registry credentials) to authenticate with registries. Never hardcode credentials.
|
|
27
|
+
- **Phases:** Ensure the pipeline follows a clear linear progression: `Lint` -> `Test` -> `Build Docker` -> `Publish Image` -> `Verify`.
|
|
28
|
+
- **Environment:** Run tests inside appropriate isolation, specifying necessary environment variables as configuration variables.
|
|
29
|
+
|
|
30
|
+
### ๐งช Verification
|
|
31
|
+
- Validate the Dockerfile builds locally: `docker build -t app:local .`
|
|
32
|
+
- Ensure GitHub Actions workflow schema checks out correctly using visual validators or linting tools.
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: devops
|
|
3
|
+
description: Generate optimized production Dockerfiles and GitHub Actions CI/CD workflows tailored to the project stack
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Follow this process to generate production-ready Dockerfile configurations and GitHub Actions workflows (.github/workflows/ci-cd.yml) for the codebase.
|
|
7
|
+
|
|
8
|
+
Inputs:
|
|
9
|
+
- targetStack: One of `node`, `python`, `go`, `rust`, `java`, `dotnet`
|
|
10
|
+
- containerRegistry: Where to push the image (`ghcr.io` or `docker.io`)
|
|
11
|
+
- imageRepository: Repository/image name path (e.g. `username/repo-name`)
|
|
12
|
+
|
|
13
|
+
Steps:
|
|
14
|
+
1. **Detect Framework Details:**
|
|
15
|
+
- Scan root files to identify dependency management tools (e.g., `package.json`, `requirements.txt`/`pyproject.toml`, `go.mod`, `Cargo.toml`, `pom.xml`/`build.gradle`, `.csproj`).
|
|
16
|
+
- Match the target stack configuration rules below.
|
|
17
|
+
|
|
18
|
+
2. **Generate Multi-Stage Dockerfile:**
|
|
19
|
+
- Construct a `Dockerfile` at the root of the project using multi-stage builds.
|
|
20
|
+
- Enforce:
|
|
21
|
+
- **Layer caching:** Copy lockfiles/manifests first and install dependencies before copying source files.
|
|
22
|
+
- **Non-root execution:** Setup a dedicated non-root user and assign permissions.
|
|
23
|
+
- **Security:** Do not use full development/SDK base images for final running stages. Use slim, minimal alpine or distroless images.
|
|
24
|
+
|
|
25
|
+
3. **Generate GitHub Actions CI/CD Pipeline:**
|
|
26
|
+
- Create a workflow file at `.github/workflows/ci-cd.yml`.
|
|
27
|
+
- Setup:
|
|
28
|
+
- Triggers: Push to main/master, Pull Request to main/master.
|
|
29
|
+
- Pipeline Steps: checkout -> setup toolchain -> cache packages -> lint -> test -> setup Docker buildx -> login to registry -> build and push.
|
|
30
|
+
|
|
31
|
+
4. **Verify Files:**
|
|
32
|
+
- Print output file paths and summarize configuration details for the user.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## ๐๏ธ DevOps Templates by Stack
|
|
37
|
+
|
|
38
|
+
### 1. Node.js Ecosystem (Express, NestJS, Next.js, React-TS)
|
|
39
|
+
|
|
40
|
+
#### Dockerfile
|
|
41
|
+
```dockerfile
|
|
42
|
+
# Stage 1: Build dependencies and compile
|
|
43
|
+
FROM node:20-alpine AS builder
|
|
44
|
+
WORKDIR /app
|
|
45
|
+
COPY package*.json ./
|
|
46
|
+
RUN npm ci
|
|
47
|
+
COPY . .
|
|
48
|
+
RUN npm run build && npm prune --production
|
|
49
|
+
|
|
50
|
+
# Stage 2: Minimal runtime image
|
|
51
|
+
FROM node:20-alpine AS runner
|
|
52
|
+
WORKDIR /app
|
|
53
|
+
ENV NODE_ENV=production
|
|
54
|
+
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
|
|
55
|
+
COPY --from=builder /app/package*.json ./
|
|
56
|
+
COPY --from=builder /app/node_modules ./node_modules
|
|
57
|
+
COPY --from=builder /app/dist ./dist
|
|
58
|
+
# If Next.js, copy public/next files as appropriate
|
|
59
|
+
USER nextjs
|
|
60
|
+
EXPOSE 3000
|
|
61
|
+
CMD ["node", "dist/main.js"]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### GitHub Actions
|
|
65
|
+
```yaml
|
|
66
|
+
name: CI/CD Pipeline
|
|
67
|
+
|
|
68
|
+
on:
|
|
69
|
+
push:
|
|
70
|
+
branches: [ main, master ]
|
|
71
|
+
pull_request:
|
|
72
|
+
branches: [ main, master ]
|
|
73
|
+
|
|
74
|
+
jobs:
|
|
75
|
+
validate:
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
steps:
|
|
78
|
+
- uses: actions/checkout@v4
|
|
79
|
+
- name: Setup Node.js
|
|
80
|
+
uses: actions/setup-node@v4
|
|
81
|
+
with:
|
|
82
|
+
node-version: 20
|
|
83
|
+
cache: 'npm'
|
|
84
|
+
- name: Install Dependencies
|
|
85
|
+
run: npm ci
|
|
86
|
+
- name: Run Lint
|
|
87
|
+
run: npm run lint --if-present
|
|
88
|
+
- name: Run Tests
|
|
89
|
+
run: npm run test --if-present
|
|
90
|
+
|
|
91
|
+
build-and-push:
|
|
92
|
+
needs: validate
|
|
93
|
+
runs-on: ubuntu-latest
|
|
94
|
+
if: github.event_name == 'push'
|
|
95
|
+
steps:
|
|
96
|
+
- uses: actions/checkout@v4
|
|
97
|
+
- name: Set up Docker Buildx
|
|
98
|
+
uses: docker/setup-buildx-action@v3
|
|
99
|
+
- name: Login to GitHub Container Registry
|
|
100
|
+
uses: docker/login-action@v3
|
|
101
|
+
with:
|
|
102
|
+
registry: ghcr.io
|
|
103
|
+
username: $\{{ github.actor }}
|
|
104
|
+
password: $\{{ secrets.GITHUB_TOKEN }}
|
|
105
|
+
- name: Build and Push
|
|
106
|
+
uses: docker/build-push-action@v5
|
|
107
|
+
with:
|
|
108
|
+
context: .
|
|
109
|
+
push: true
|
|
110
|
+
tags: ghcr.io/$\{{ github.repository }}:latest
|
|
111
|
+
cache-from: type=gha
|
|
112
|
+
cache-to: type=gha,mode=max
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### 2. Python Ecosystem (FastAPI, Flask, AI/Data Science)
|
|
118
|
+
|
|
119
|
+
#### Dockerfile
|
|
120
|
+
```dockerfile
|
|
121
|
+
# Stage 1: Install packages
|
|
122
|
+
FROM python:3.11-slim AS builder
|
|
123
|
+
WORKDIR /app
|
|
124
|
+
RUN pip install --no-cache-dir poetry
|
|
125
|
+
COPY pyproject.toml poetry.lock* ./
|
|
126
|
+
RUN poetry config virtualenvs.create false && poetry install --no-dev --no-interaction --no-ansi
|
|
127
|
+
|
|
128
|
+
# Stage 2: Minimal runtime
|
|
129
|
+
FROM python:3.11-slim AS runner
|
|
130
|
+
WORKDIR /app
|
|
131
|
+
RUN useradd -u 1001 appuser && chown -R appuser /app
|
|
132
|
+
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
|
|
133
|
+
COPY --from=builder /usr/local/bin /usr/local/bin
|
|
134
|
+
COPY . .
|
|
135
|
+
USER appuser
|
|
136
|
+
EXPOSE 8000
|
|
137
|
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### GitHub Actions
|
|
141
|
+
```yaml
|
|
142
|
+
name: Python CI/CD
|
|
143
|
+
|
|
144
|
+
on:
|
|
145
|
+
push:
|
|
146
|
+
branches: [ main ]
|
|
147
|
+
pull_request:
|
|
148
|
+
branches: [ main ]
|
|
149
|
+
|
|
150
|
+
jobs:
|
|
151
|
+
test:
|
|
152
|
+
runs-on: ubuntu-latest
|
|
153
|
+
steps:
|
|
154
|
+
- uses: actions/checkout@v4
|
|
155
|
+
- name: Setup Python
|
|
156
|
+
uses: actions/setup-python@v5
|
|
157
|
+
with:
|
|
158
|
+
python-version: '3.11'
|
|
159
|
+
- name: Install dependencies
|
|
160
|
+
run: |
|
|
161
|
+
python -m pip install --upgrade pip
|
|
162
|
+
pip install ruff pytest
|
|
163
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
164
|
+
- name: Lint
|
|
165
|
+
run: ruff check .
|
|
166
|
+
- name: Test
|
|
167
|
+
run: pytest
|
|
168
|
+
|
|
169
|
+
publish:
|
|
170
|
+
needs: test
|
|
171
|
+
runs-on: ubuntu-latest
|
|
172
|
+
if: github.event_name == 'push'
|
|
173
|
+
steps:
|
|
174
|
+
- uses: actions/checkout@v4
|
|
175
|
+
- name: Set up Docker Buildx
|
|
176
|
+
uses: docker/setup-buildx-action@v3
|
|
177
|
+
- name: Login to GHCR
|
|
178
|
+
uses: docker/login-action@v3
|
|
179
|
+
with:
|
|
180
|
+
registry: ghcr.io
|
|
181
|
+
username: $\{{ github.actor }}
|
|
182
|
+
password: $\{{ secrets.GITHUB_TOKEN }}
|
|
183
|
+
- name: Build and Push
|
|
184
|
+
uses: docker/build-push-action@v5
|
|
185
|
+
with:
|
|
186
|
+
context: .
|
|
187
|
+
push: true
|
|
188
|
+
tags: ghcr.io/$\{{ github.repository }}:latest
|
|
189
|
+
cache-from: type=gha
|
|
190
|
+
cache-to: type=gha,mode=max
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### 3. Go Ecosystem
|
|
196
|
+
|
|
197
|
+
#### Dockerfile
|
|
198
|
+
```dockerfile
|
|
199
|
+
# Stage 1: Build the binary
|
|
200
|
+
FROM golang:1.22-alpine AS builder
|
|
201
|
+
WORKDIR /app
|
|
202
|
+
COPY go.mod go.sum ./
|
|
203
|
+
RUN go mod download
|
|
204
|
+
COPY . .
|
|
205
|
+
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o main .
|
|
206
|
+
|
|
207
|
+
# Stage 2: Distroless secure runner
|
|
208
|
+
FROM gcr.io/distroless/static-debian12:nonroot
|
|
209
|
+
WORKDIR /
|
|
210
|
+
COPY --from=builder /app/main /main
|
|
211
|
+
EXPOSE 8080
|
|
212
|
+
USER nonroot:nonroot
|
|
213
|
+
ENTRYPOINT ["/main"]
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### GitHub Actions
|
|
217
|
+
```yaml
|
|
218
|
+
name: Go Pipeline
|
|
219
|
+
|
|
220
|
+
on:
|
|
221
|
+
push:
|
|
222
|
+
branches: [ main ]
|
|
223
|
+
pull_request:
|
|
224
|
+
branches: [ main ]
|
|
225
|
+
|
|
226
|
+
jobs:
|
|
227
|
+
test:
|
|
228
|
+
runs-on: ubuntu-latest
|
|
229
|
+
steps:
|
|
230
|
+
- uses: actions/checkout@v4
|
|
231
|
+
- name: Setup Go
|
|
232
|
+
uses: actions/setup-go@v5
|
|
233
|
+
with:
|
|
234
|
+
go-version: '1.22'
|
|
235
|
+
- name: Get dependencies
|
|
236
|
+
run: go mod download
|
|
237
|
+
- name: Lint & Test
|
|
238
|
+
run: |
|
|
239
|
+
go vet ./...
|
|
240
|
+
go test -v ./...
|
|
241
|
+
|
|
242
|
+
publish:
|
|
243
|
+
needs: test
|
|
244
|
+
runs-on: ubuntu-latest
|
|
245
|
+
if: github.event_name == 'push'
|
|
246
|
+
steps:
|
|
247
|
+
- uses: actions/checkout@v4
|
|
248
|
+
- name: Set up Docker Buildx
|
|
249
|
+
uses: docker/setup-buildx-action@v3
|
|
250
|
+
- name: Login to GHCR
|
|
251
|
+
uses: docker/login-action@v3
|
|
252
|
+
with:
|
|
253
|
+
registry: ghcr.io
|
|
254
|
+
username: $\{{ github.actor }}
|
|
255
|
+
password: $\{{ secrets.GITHUB_TOKEN }}
|
|
256
|
+
- name: Build and Push
|
|
257
|
+
uses: docker/build-push-action@v5
|
|
258
|
+
with:
|
|
259
|
+
context: .
|
|
260
|
+
push: true
|
|
261
|
+
tags: ghcr.io/$\{{ github.repository }}:latest
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
### 4. Rust Ecosystem
|
|
267
|
+
|
|
268
|
+
#### Dockerfile
|
|
269
|
+
```dockerfile
|
|
270
|
+
# Stage 1: Build dependencies and source
|
|
271
|
+
FROM rust:1.76-alpine AS builder
|
|
272
|
+
RUN apk add --no-cache musl-dev
|
|
273
|
+
WORKDIR /app
|
|
274
|
+
COPY Cargo.toml Cargo.lock ./
|
|
275
|
+
# Create dummy main to compile dependencies first for layer caching
|
|
276
|
+
RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release
|
|
277
|
+
COPY . .
|
|
278
|
+
RUN touch src/main.rs && cargo build --release
|
|
279
|
+
|
|
280
|
+
# Stage 2: Final runtime
|
|
281
|
+
FROM alpine:3.19
|
|
282
|
+
WORKDIR /app
|
|
283
|
+
RUN adduser -D -u 1001 appuser
|
|
284
|
+
COPY --from=builder /app/target/release/app-name /app/app-binary
|
|
285
|
+
USER appuser
|
|
286
|
+
EXPOSE 8080
|
|
287
|
+
ENTRYPOINT ["/app/app-binary"]
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
#### GitHub Actions
|
|
291
|
+
```yaml
|
|
292
|
+
name: Rust CI/CD
|
|
293
|
+
|
|
294
|
+
on:
|
|
295
|
+
push:
|
|
296
|
+
branches: [ main ]
|
|
297
|
+
pull_request:
|
|
298
|
+
branches: [ main ]
|
|
299
|
+
|
|
300
|
+
jobs:
|
|
301
|
+
test:
|
|
302
|
+
runs-on: ubuntu-latest
|
|
303
|
+
steps:
|
|
304
|
+
- uses: actions/checkout@v4
|
|
305
|
+
- name: Setup Rust toolchain
|
|
306
|
+
uses: dtolnay/rust-toolchain@stable
|
|
307
|
+
- name: Cache dependencies
|
|
308
|
+
uses: swatinem/rust-cache@v2
|
|
309
|
+
- name: Lint and Test
|
|
310
|
+
run: |
|
|
311
|
+
cargo check
|
|
312
|
+
cargo test
|
|
313
|
+
|
|
314
|
+
publish:
|
|
315
|
+
needs: test
|
|
316
|
+
runs-on: ubuntu-latest
|
|
317
|
+
if: github.event_name == 'push'
|
|
318
|
+
steps:
|
|
319
|
+
- uses: actions/checkout@v4
|
|
320
|
+
- name: Set up Docker Buildx
|
|
321
|
+
uses: docker/setup-buildx-action@v3
|
|
322
|
+
- name: Login to GHCR
|
|
323
|
+
uses: docker/login-action@v3
|
|
324
|
+
with:
|
|
325
|
+
registry: ghcr.io
|
|
326
|
+
username: $\{{ github.actor }}
|
|
327
|
+
password: $\{{ secrets.GITHUB_TOKEN }}
|
|
328
|
+
- name: Build and Push
|
|
329
|
+
uses: docker/build-push-action@v5
|
|
330
|
+
with:
|
|
331
|
+
context: .
|
|
332
|
+
push: true
|
|
333
|
+
tags: ghcr.io/$\{{ github.repository }}:latest
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
### 5. Java Spring Boot Ecosystem
|
|
339
|
+
|
|
340
|
+
#### Dockerfile
|
|
341
|
+
```dockerfile
|
|
342
|
+
# Stage 1: Compile application
|
|
343
|
+
FROM eclipse-temurin:17-jdk-alpine AS builder
|
|
344
|
+
WORKDIR /app
|
|
345
|
+
COPY mvnw .
|
|
346
|
+
COPY .mvn .mvn
|
|
347
|
+
COPY pom.xml .
|
|
348
|
+
RUN ./mvnw dependency:go-offline
|
|
349
|
+
COPY src src
|
|
350
|
+
RUN ./mvnw clean package -DskipTests
|
|
351
|
+
|
|
352
|
+
# Stage 2: Running environment
|
|
353
|
+
FROM eclipse-temurin:17-jre-alpine AS runner
|
|
354
|
+
WORKDIR /app
|
|
355
|
+
RUN addgroup -S spring && adduser -S spring -G spring
|
|
356
|
+
COPY --from=builder /app/target/*.jar app.jar
|
|
357
|
+
USER spring:spring
|
|
358
|
+
EXPOSE 8080
|
|
359
|
+
ENTRYPOINT ["java", "-jar", "app.jar"]
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
#### GitHub Actions
|
|
363
|
+
```yaml
|
|
364
|
+
name: Java Spring Boot Pipeline
|
|
365
|
+
|
|
366
|
+
on:
|
|
367
|
+
push:
|
|
368
|
+
branches: [ main ]
|
|
369
|
+
pull_request:
|
|
370
|
+
branches: [ main ]
|
|
371
|
+
|
|
372
|
+
jobs:
|
|
373
|
+
test:
|
|
374
|
+
runs-on: ubuntu-latest
|
|
375
|
+
steps:
|
|
376
|
+
- uses: actions/checkout@v4
|
|
377
|
+
- name: Setup JDK
|
|
378
|
+
uses: actions/setup-java@v4
|
|
379
|
+
with:
|
|
380
|
+
java-version: '17'
|
|
381
|
+
distribution: 'temurin'
|
|
382
|
+
cache: 'maven'
|
|
383
|
+
- name: Compile and Test
|
|
384
|
+
run: ./mvnw clean test
|
|
385
|
+
|
|
386
|
+
publish:
|
|
387
|
+
needs: test
|
|
388
|
+
runs-on: ubuntu-latest
|
|
389
|
+
if: github.event_name == 'push'
|
|
390
|
+
steps:
|
|
391
|
+
- uses: actions/checkout@v4
|
|
392
|
+
- name: Set up Docker Buildx
|
|
393
|
+
uses: docker/setup-buildx-action@v3
|
|
394
|
+
- name: Login to GHCR
|
|
395
|
+
uses: docker/login-action@v3
|
|
396
|
+
with:
|
|
397
|
+
registry: ghcr.io
|
|
398
|
+
username: $\{{ github.actor }}
|
|
399
|
+
password: $\{{ secrets.GITHUB_TOKEN }}
|
|
400
|
+
- name: Build and Push
|
|
401
|
+
uses: docker/build-push-action@v5
|
|
402
|
+
with:
|
|
403
|
+
context: .
|
|
404
|
+
push: true
|
|
405
|
+
tags: ghcr.io/$\{{ github.repository }}:latest
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
### 6. .NET Ecosystem (C#)
|
|
411
|
+
|
|
412
|
+
#### Dockerfile
|
|
413
|
+
```dockerfile
|
|
414
|
+
# Stage 1: Compile app
|
|
415
|
+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS builder
|
|
416
|
+
WORKDIR /app
|
|
417
|
+
COPY *.sln ./
|
|
418
|
+
COPY *.csproj ./
|
|
419
|
+
RUN dotnet restore
|
|
420
|
+
COPY . .
|
|
421
|
+
RUN dotnet publish -c Release -o out
|
|
422
|
+
|
|
423
|
+
# Stage 2: ASP.NET Core Runtime
|
|
424
|
+
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS runner
|
|
425
|
+
WORKDIR /app
|
|
426
|
+
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
|
427
|
+
COPY --from=builder /app/out .
|
|
428
|
+
USER appuser
|
|
429
|
+
EXPOSE 8080
|
|
430
|
+
ENTRYPOINT ["dotnet", "App.dll"]
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
#### GitHub Actions
|
|
434
|
+
```yaml
|
|
435
|
+
name: .NET CI/CD
|
|
436
|
+
|
|
437
|
+
on:
|
|
438
|
+
push:
|
|
439
|
+
branches: [ main ]
|
|
440
|
+
pull_request:
|
|
441
|
+
branches: [ main ]
|
|
442
|
+
|
|
443
|
+
jobs:
|
|
444
|
+
test:
|
|
445
|
+
runs-on: ubuntu-latest
|
|
446
|
+
steps:
|
|
447
|
+
- uses: actions/checkout@v4
|
|
448
|
+
- name: Setup .NET SDK
|
|
449
|
+
uses: actions/setup-dotnet@v4
|
|
450
|
+
with:
|
|
451
|
+
dotnet-version: '8.0'
|
|
452
|
+
- name: Restore and Test
|
|
453
|
+
run: |
|
|
454
|
+
dotnet restore
|
|
455
|
+
dotnet test --no-restore
|
|
456
|
+
|
|
457
|
+
publish:
|
|
458
|
+
needs: test
|
|
459
|
+
runs-on: ubuntu-latest
|
|
460
|
+
if: github.event_name == 'push'
|
|
461
|
+
steps:
|
|
462
|
+
- uses: actions/checkout@v4
|
|
463
|
+
- name: Set up Docker Buildx
|
|
464
|
+
uses: docker/setup-buildx-action@v3
|
|
465
|
+
- name: Login to GHCR
|
|
466
|
+
uses: docker/login-action@v3
|
|
467
|
+
with:
|
|
468
|
+
registry: ghcr.io
|
|
469
|
+
username: $\{{ github.actor }}
|
|
470
|
+
password: $\{{ secrets.GITHUB_TOKEN }}
|
|
471
|
+
- name: Build and Push
|
|
472
|
+
uses: docker/build-push-action@v5
|
|
473
|
+
with:
|
|
474
|
+
context: .
|
|
475
|
+
push: true
|
|
476
|
+
tags: ghcr.io/$\{{ github.repository }}:latest
|
|
477
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
## ๐ Diagram & System Architecture Design Guide
|
|
2
|
+
|
|
3
|
+
### ๐ Diagram Lifecycle & Modeling Process
|
|
4
|
+
When creating system design assets or documenting architecture, follow this structured process:
|
|
5
|
+
1. **Analyze Codebase Context:** Read the existing modules, packages, database schemas, and workflows to ensure the diagram reflects the physical system 100% accurately.
|
|
6
|
+
2. **Choose the Right Diagram Type:** Align the visualization with the specific architectural need (e.g., Use Case for business scopes, Sequence for dynamic interactions, ERD for data models, Peter Chen for high-level conceptual mapping).
|
|
7
|
+
3. **Monochrome Design System:** Enforce simple black and white styling (`fillColor=#ffffff;strokeColor=#000000;`). Do not use flashy colors or gradients unless explicitly requested by the user. Focus strictly on correct UML/structure notations.
|
|
8
|
+
4. **Generate & Output Draw.io XML:** Construct the diagram structure using clean native Draw.io XML markup `<mxfile>...</mxfile>` with unique cell IDs and non-overlapping coordinate grids.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
### ๐๏ธ Available Design Templates
|
|
13
|
+
Refer to the detailed rules below:
|
|
14
|
+
- Scaffolding native Draw.io XML diagrams with correct syntax: `@drawio-diagram`
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
### ๐๏ธ Diagram Standards & Syntax Constraints
|
|
19
|
+
|
|
20
|
+
#### 1. Formatting & ID Integrity
|
|
21
|
+
- **Unique IDs:** Every visual node (`mxCell`) must possess a unique, consistent ID. The base nodes must declare `id="0"` and `id="1" parent="0"`.
|
|
22
|
+
- **Coordinate Spacing:** Calculate `x`, `y`, `width`, and `height` dimensions carefully to prevent node overlap. Ensure generous margins for readable text.
|
|
23
|
+
|
|
24
|
+
#### 2. Structural Relationships
|
|
25
|
+
- **Arrowheads & Connections:** Use exact UML arrow representations (e.g., Generalization `endArrow=block;endFill=0;`, Composition `endArrow=diamond;endFill=1;`, Crow's foot `endArrow=ERoneToMany;`).
|
|
26
|
+
- **Separation of Concerns:** Keep distinct actors, microservices, databases, and third-party systems separated by boundaries or swimlanes in workflow layouts.
|
|
27
|
+
|
|
28
|
+
### ๐งช Verification
|
|
29
|
+
- Confirm that the generated XML tags match the schema of Draw.io.
|
|
30
|
+
- Ensure the XML is raw and can be copy-pasted directly into the Draw.io UI (`File` -> `Import` or paste into the XML text editor panel) without formatting errors.
|