agent-workflow-kit-cli 1.3.2 โ†’ 1.3.4

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.
Files changed (51) hide show
  1. package/dist/cli/commands/add.js +3 -1
  2. package/dist/cli/commands/doctor.js +145 -47
  3. package/dist/cli/commands/init.js +6 -0
  4. package/dist/core/analyzer.js +70 -0
  5. package/dist/core/detector.js +22 -0
  6. package/package.json +1 -1
  7. package/templates/common/AGENTS.md.hbs +4 -0
  8. package/templates/common/GLOBAL_RULES.md +101 -0
  9. package/templates/devops/AGENTS.md.hbs +32 -0
  10. package/templates/devops/skills/devops/SKILL.md +477 -0
  11. package/templates/diagram/AGENTS.md.hbs +30 -0
  12. package/templates/diagram/skills/drawio-diagram/SKILL.md +427 -0
  13. package/templates/dotnet/AGENTS.md.hbs +38 -34
  14. package/templates/dotnet/rules/api-structure.md +15 -15
  15. package/templates/dotnet/rules/csharp-style.md +17 -17
  16. package/templates/dotnet/rules/dependency-injection.md +12 -12
  17. package/templates/dotnet/rules/error-handling-validation.md +15 -15
  18. package/templates/dotnet/skills/dotnet-controller/SKILL.md +16 -16
  19. package/templates/express/AGENTS.md.hbs +37 -33
  20. package/templates/express/rules/error-handling.md +18 -18
  21. package/templates/express/rules/express-style.md +19 -19
  22. package/templates/express/rules/router-controller.md +16 -16
  23. package/templates/express/skills/express-endpoint/SKILL.md +14 -14
  24. package/templates/fastapi/AGENTS.md.hbs +25 -3
  25. package/templates/fastapi/rules/api-testing.md +24 -0
  26. package/templates/fastapi/rules/database-async.md +26 -0
  27. package/templates/golang/AGENTS.md.hbs +42 -0
  28. package/templates/golang/rules/concurrency.md +71 -0
  29. package/templates/golang/rules/error-handling.md +42 -0
  30. package/templates/golang/rules/golang-style.md +24 -0
  31. package/templates/golang/rules/project-layout.md +39 -0
  32. package/templates/golang/skills/golang-db/SKILL.md +27 -0
  33. package/templates/golang/skills/golang-feature/SKILL.md +42 -0
  34. package/templates/nestjs/AGENTS.md.hbs +33 -29
  35. package/templates/nestjs/rules/module-architecture.md +14 -14
  36. package/templates/nestjs/rules/nestjs-style.md +12 -12
  37. package/templates/nestjs/rules/validation-errors.md +15 -15
  38. package/templates/nestjs/skills/nestjs-module/SKILL.md +15 -15
  39. package/templates/next-js/AGENTS.md.hbs +39 -35
  40. package/templates/next-js/rules/data-fetching-mutations.md +17 -17
  41. package/templates/next-js/rules/next-style.md +17 -17
  42. package/templates/next-js/rules/seo-metadata.md +18 -18
  43. package/templates/next-js/rules/server-client-components.md +17 -17
  44. package/templates/next-js/skills/next-feature/SKILL.md +16 -16
  45. package/templates/rust/AGENTS.md.hbs +41 -0
  46. package/templates/rust/rules/error-handling.md +36 -0
  47. package/templates/rust/rules/memory-concurrency.md +47 -0
  48. package/templates/rust/rules/project-layout.md +49 -0
  49. package/templates/rust/rules/rust-style.md +26 -0
  50. package/templates/rust/skills/rust-db/SKILL.md +27 -0
  51. package/templates/rust/skills/rust-feature/SKILL.md +34 -0
@@ -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.