@cubocicloide/stack-react-django 3.0.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.
- package/LICENSE +33 -0
- package/README.md +66 -0
- package/dist/commands/lint/checks/BE/001.d.ts +6 -0
- package/dist/commands/lint/checks/BE/001.js +94 -0
- package/dist/commands/lint/checks/BE/001.js.map +1 -0
- package/dist/commands/lint/checks/BE/002.d.ts +6 -0
- package/dist/commands/lint/checks/BE/002.js +136 -0
- package/dist/commands/lint/checks/BE/002.js.map +1 -0
- package/dist/commands/lint/checks/BE/003.d.ts +6 -0
- package/dist/commands/lint/checks/BE/003.js +89 -0
- package/dist/commands/lint/checks/BE/003.js.map +1 -0
- package/dist/commands/lint/checks/BE/004.d.ts +6 -0
- package/dist/commands/lint/checks/BE/004.js +68 -0
- package/dist/commands/lint/checks/BE/004.js.map +1 -0
- package/dist/commands/lint/checks/BE/005.d.ts +6 -0
- package/dist/commands/lint/checks/BE/005.js +55 -0
- package/dist/commands/lint/checks/BE/005.js.map +1 -0
- package/dist/commands/lint/checks/BE/006.d.ts +6 -0
- package/dist/commands/lint/checks/BE/006.js +95 -0
- package/dist/commands/lint/checks/BE/006.js.map +1 -0
- package/dist/commands/lint/checks/BE/007.d.ts +6 -0
- package/dist/commands/lint/checks/BE/007.js +53 -0
- package/dist/commands/lint/checks/BE/007.js.map +1 -0
- package/dist/commands/lint/checks/BE/008.d.ts +6 -0
- package/dist/commands/lint/checks/BE/008.js +70 -0
- package/dist/commands/lint/checks/BE/008.js.map +1 -0
- package/dist/commands/lint/checks/BE/009.d.ts +6 -0
- package/dist/commands/lint/checks/BE/009.js +112 -0
- package/dist/commands/lint/checks/BE/009.js.map +1 -0
- package/dist/commands/lint/checks/BE/010.d.ts +6 -0
- package/dist/commands/lint/checks/BE/010.js +76 -0
- package/dist/commands/lint/checks/BE/010.js.map +1 -0
- package/dist/commands/lint/checks/BE/011.d.ts +6 -0
- package/dist/commands/lint/checks/BE/011.js +76 -0
- package/dist/commands/lint/checks/BE/011.js.map +1 -0
- package/dist/commands/lint/checks/BE/012.d.ts +6 -0
- package/dist/commands/lint/checks/BE/012.js +61 -0
- package/dist/commands/lint/checks/BE/012.js.map +1 -0
- package/dist/commands/lint/checks/BE/013.d.ts +6 -0
- package/dist/commands/lint/checks/BE/013.js +98 -0
- package/dist/commands/lint/checks/BE/013.js.map +1 -0
- package/dist/commands/lint/checks/BE/014.d.ts +6 -0
- package/dist/commands/lint/checks/BE/014.js +64 -0
- package/dist/commands/lint/checks/BE/014.js.map +1 -0
- package/dist/commands/lint/checks/E2E/001.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/001.js +35 -0
- package/dist/commands/lint/checks/E2E/001.js.map +1 -0
- package/dist/commands/lint/checks/E2E/002.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/002.js +37 -0
- package/dist/commands/lint/checks/E2E/002.js.map +1 -0
- package/dist/commands/lint/checks/E2E/003.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/003.js +42 -0
- package/dist/commands/lint/checks/E2E/003.js.map +1 -0
- package/dist/commands/lint/checks/E2E/004.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/004.js +37 -0
- package/dist/commands/lint/checks/E2E/004.js.map +1 -0
- package/dist/commands/lint/checks/E2E/005.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/005.js +47 -0
- package/dist/commands/lint/checks/E2E/005.js.map +1 -0
- package/dist/commands/lint/checks/E2E/006.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/006.js +28 -0
- package/dist/commands/lint/checks/E2E/006.js.map +1 -0
- package/dist/commands/lint/checks/E2E/007.d.ts +6 -0
- package/dist/commands/lint/checks/E2E/007.js +47 -0
- package/dist/commands/lint/checks/E2E/007.js.map +1 -0
- package/dist/commands/lint/checks/FE/001.d.ts +6 -0
- package/dist/commands/lint/checks/FE/001.js +56 -0
- package/dist/commands/lint/checks/FE/001.js.map +1 -0
- package/dist/commands/lint/checks/FE/002.d.ts +6 -0
- package/dist/commands/lint/checks/FE/002.js +80 -0
- package/dist/commands/lint/checks/FE/002.js.map +1 -0
- package/dist/commands/lint/checks/FE/003.d.ts +6 -0
- package/dist/commands/lint/checks/FE/003.js +65 -0
- package/dist/commands/lint/checks/FE/003.js.map +1 -0
- package/dist/commands/lint/checks/FE/004.d.ts +6 -0
- package/dist/commands/lint/checks/FE/004.js +72 -0
- package/dist/commands/lint/checks/FE/004.js.map +1 -0
- package/dist/commands/lint/checks/FE/005.d.ts +6 -0
- package/dist/commands/lint/checks/FE/005.js +103 -0
- package/dist/commands/lint/checks/FE/005.js.map +1 -0
- package/dist/commands/lint/checks/FE/006.d.ts +6 -0
- package/dist/commands/lint/checks/FE/006.js +102 -0
- package/dist/commands/lint/checks/FE/006.js.map +1 -0
- package/dist/commands/lint/checks/FE/007.d.ts +6 -0
- package/dist/commands/lint/checks/FE/007.js +60 -0
- package/dist/commands/lint/checks/FE/007.js.map +1 -0
- package/dist/commands/lint/checks/FE/008.d.ts +6 -0
- package/dist/commands/lint/checks/FE/008.js +115 -0
- package/dist/commands/lint/checks/FE/008.js.map +1 -0
- package/dist/commands/lint/checks/FE/009.d.ts +6 -0
- package/dist/commands/lint/checks/FE/009.js +83 -0
- package/dist/commands/lint/checks/FE/009.js.map +1 -0
- package/dist/commands/lint/checks/FE/010.d.ts +6 -0
- package/dist/commands/lint/checks/FE/010.js +105 -0
- package/dist/commands/lint/checks/FE/010.js.map +1 -0
- package/dist/commands/lint/checks/FE/011.d.ts +6 -0
- package/dist/commands/lint/checks/FE/011.js +43 -0
- package/dist/commands/lint/checks/FE/011.js.map +1 -0
- package/dist/commands/lint/checks/FE/012.d.ts +6 -0
- package/dist/commands/lint/checks/FE/012.js +150 -0
- package/dist/commands/lint/checks/FE/012.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3436 -0
- package/dist/index.js.map +1 -0
- package/dude.stack.json +13 -0
- package/package.json +43 -0
- package/templates/aws-ecs/backend/Dockerfile.prod +34 -0
- package/templates/aws-ecs/docs/docs/deploy.md.hbs +54 -0
- package/templates/aws-ecs/frontend/Dockerfile.prod +28 -0
- package/templates/aws-ecs/frontend/nginx.conf +21 -0
- package/templates/aws-ecs/iac/README.md.hbs +75 -0
- package/templates/aws-ecs/iac/_gitignore +14 -0
- package/templates/aws-ecs/iac/runner/Dockerfile +35 -0
- package/templates/aws-ecs/iac/terraform/bootstrap/main.tf.hbs +102 -0
- package/templates/aws-ecs/iac/terraform/bootstrap/outputs.tf +19 -0
- package/templates/aws-ecs/iac/terraform/bootstrap/variables.tf.hbs +17 -0
- package/templates/aws-ecs/iac/terraform/environments/dev/backend.hcl.hbs +12 -0
- package/templates/aws-ecs/iac/terraform/environments/dev/terraform.tfvars.hbs +43 -0
- package/templates/aws-ecs/iac/terraform/main.tf.hbs +949 -0
- package/templates/aws-ecs/iac/terraform/outputs.tf.hbs +71 -0
- package/templates/aws-ecs/iac/terraform/providers.tf +19 -0
- package/templates/aws-ecs/iac/terraform/variables.tf.hbs +113 -0
- package/templates/aws-ecs/iac/terraform/versions.tf +19 -0
- package/templates/base/.claude/agents/issue-fixer.md +190 -0
- package/templates/base/.claude/agents/security-fixer.md +250 -0
- package/templates/base/.claude/rules/BE/001.md +19 -0
- package/templates/base/.claude/rules/BE/002.md +21 -0
- package/templates/base/.claude/rules/BE/003.md +19 -0
- package/templates/base/.claude/rules/BE/004.md +16 -0
- package/templates/base/.claude/rules/BE/005.md +23 -0
- package/templates/base/.claude/rules/BE/006.md +13 -0
- package/templates/base/.claude/rules/BE/007.md +24 -0
- package/templates/base/.claude/rules/BE/008.md +19 -0
- package/templates/base/.claude/rules/BE/009.md +18 -0
- package/templates/base/.claude/rules/BE/010.md +15 -0
- package/templates/base/.claude/rules/BE/011.md +17 -0
- package/templates/base/.claude/rules/BE/012.md +18 -0
- package/templates/base/.claude/rules/BE/013.md +22 -0
- package/templates/base/.claude/rules/BE/014.md +15 -0
- package/templates/base/.claude/rules/E2E/001.md +13 -0
- package/templates/base/.claude/rules/E2E/002.md +14 -0
- package/templates/base/.claude/rules/E2E/003.md +10 -0
- package/templates/base/.claude/rules/E2E/004.md +23 -0
- package/templates/base/.claude/rules/E2E/005.md +15 -0
- package/templates/base/.claude/rules/E2E/006.md +13 -0
- package/templates/base/.claude/rules/E2E/007.md +18 -0
- package/templates/base/.claude/rules/FE/001.md +22 -0
- package/templates/base/.claude/rules/FE/002.md +39 -0
- package/templates/base/.claude/rules/FE/003.md +19 -0
- package/templates/base/.claude/rules/FE/004.md +21 -0
- package/templates/base/.claude/rules/FE/005.md +33 -0
- package/templates/base/.claude/rules/FE/006.md +24 -0
- package/templates/base/.claude/rules/FE/007.md +19 -0
- package/templates/base/.claude/rules/FE/008.md +26 -0
- package/templates/base/.claude/rules/FE/009.md +30 -0
- package/templates/base/.claude/rules/FE/010.md +25 -0
- package/templates/base/.claude/rules/FE/011.md +22 -0
- package/templates/base/.claude/rules/FE/012.md +32 -0
- package/templates/base/.claude/settings.json +53 -0
- package/templates/base/.claude/skills/clean-branches/SKILL.md +100 -0
- package/templates/base/.claude/skills/create/SKILL.md +47 -0
- package/templates/base/.claude/skills/create-jira-issue/SKILL.md +174 -0
- package/templates/base/.claude/skills/create-page/SKILL.md +195 -0
- package/templates/base/.claude/skills/create-route/SKILL.md +156 -0
- package/templates/base/.claude/skills/draft-email/SKILL.md +104 -0
- package/templates/base/.claude/skills/fix-issues/SKILL.md +238 -0
- package/templates/base/.claude/skills/security-scan/SKILL.md +297 -0
- package/templates/base/.claude/skills/verify-security-fixes/SKILL.md +180 -0
- package/templates/base/.dude/commands/README.md +85 -0
- package/templates/base/.dude/commands/hello.ts +34 -0
- package/templates/base/.dude/lint/checks/PRJ/001.ts +26 -0
- package/templates/base/.dude/lint/checks/README.md +69 -0
- package/templates/base/.vscode/tasks.json +44 -0
- package/templates/base/.worktreeinclude +2 -0
- package/templates/base/CLAUDE.md.hbs +391 -0
- package/templates/base/README.md.hbs +188 -0
- package/templates/base/_env.example.hbs +39 -0
- package/templates/base/_env.hbs +35 -0
- package/templates/base/_gitignore +31 -0
- package/templates/base/_npmrc +2 -0
- package/templates/base/backend/Dockerfile +16 -0
- package/templates/base/backend/README.md.hbs +90 -0
- package/templates/base/backend/_dockerignore +12 -0
- package/templates/base/backend/apps/__init__.py +0 -0
- package/templates/base/backend/apps/core/__init__.py +0 -0
- package/templates/base/backend/apps/core/apps.py +6 -0
- package/templates/base/backend/apps/core/serializers.py +7 -0
- package/templates/base/backend/apps/core/tests/__init__.py +0 -0
- package/templates/base/backend/apps/core/tests/test_views.py +16 -0
- package/templates/base/backend/apps/core/urls.py +9 -0
- package/templates/base/backend/apps/core/views.py +24 -0
- package/templates/base/backend/apps/users/__init__.py +0 -0
- package/templates/base/backend/apps/users/admin.py +6 -0
- package/templates/base/backend/apps/users/apps.py +6 -0
- package/templates/base/backend/apps/users/migrations/0001_initial.py +41 -0
- package/templates/base/backend/apps/users/migrations/__init__.py +0 -0
- package/templates/base/backend/apps/users/models.py +15 -0
- package/templates/base/backend/apps/users/serializers.py +16 -0
- package/templates/base/backend/apps/users/services.py +25 -0
- package/templates/base/backend/apps/users/tests/__init__.py +0 -0
- package/templates/base/backend/apps/users/tests/test_models.py +30 -0
- package/templates/base/backend/apps/users/tests/test_views.py +55 -0
- package/templates/base/backend/apps/users/urls.py +10 -0
- package/templates/base/backend/apps/users/views.py +20 -0
- package/templates/base/backend/config/__init__.py.hbs +5 -0
- package/templates/base/backend/config/asgi.py +9 -0
- package/templates/base/backend/config/settings/__init__.py +0 -0
- package/templates/base/backend/config/settings/base.py.hbs +197 -0
- package/templates/base/backend/config/settings/local.py +31 -0
- package/templates/base/backend/config/settings/production.py.hbs +37 -0
- package/templates/base/backend/config/urls.py.hbs +22 -0
- package/templates/base/backend/config/wsgi.py +9 -0
- package/templates/base/backend/manage.py +23 -0
- package/templates/base/backend/pyproject.toml.hbs +48 -0
- package/templates/base/backend/start.sh +5 -0
- package/templates/base/docker-compose.yml.hbs +196 -0
- package/templates/base/docs/docs/api.md +21 -0
- package/templates/base/docs/docs/dude.md.hbs +305 -0
- package/templates/base/docs/docs/index.md.hbs +92 -0
- package/templates/base/docs/docs/mkdocs.md +231 -0
- package/templates/base/docs/mkdocs.yml.hbs +52 -0
- package/templates/base/e2e/.prettierrc.json +1 -0
- package/templates/base/e2e/_prettierignore +3 -0
- package/templates/base/e2e/cucumber.js +21 -0
- package/templates/base/e2e/eslint.config.mjs +14 -0
- package/templates/base/e2e/features/example.feature +13 -0
- package/templates/base/e2e/package.json.hbs +30 -0
- package/templates/base/e2e/pages/ExamplePage.ts +16 -0
- package/templates/base/e2e/playwright.config.ts +27 -0
- package/templates/base/e2e/steps/common.steps.ts +32 -0
- package/templates/base/e2e/steps/example.steps.ts +4 -0
- package/templates/base/e2e/support/hooks.ts +72 -0
- package/templates/base/e2e/support/world.ts +24 -0
- package/templates/base/e2e/tsconfig.json +22 -0
- package/templates/base/frontend/.prettierrc.json +6 -0
- package/templates/base/frontend/Dockerfile +10 -0
- package/templates/base/frontend/_dockerignore +4 -0
- package/templates/base/frontend/eslint.config.js +32 -0
- package/templates/base/frontend/index.html.hbs +13 -0
- package/templates/base/frontend/package.json.hbs +38 -0
- package/templates/base/frontend/public/favicon.svg +5 -0
- package/templates/base/frontend/src/$components/Layout/$assets/logo.svg +5 -0
- package/templates/base/frontend/src/$components/Layout/constants.tsx +8 -0
- package/templates/base/frontend/src/$components/Layout/index.tsx +80 -0
- package/templates/base/frontend/src/$components/Layout/types.tsx +9 -0
- package/templates/base/frontend/src/$components/index.tsx +1 -0
- package/templates/base/frontend/src/$hooks/index.tsx +2 -0
- package/templates/base/frontend/src/$hooks/useCounterStore/index.tsx +28 -0
- package/templates/base/frontend/src/$hooks/useCounterStore/types.tsx +7 -0
- package/templates/base/frontend/src/$hooks/usePageTitle/index.tsx +21 -0
- package/templates/base/frontend/src/$types/vite-env.d.ts +10 -0
- package/templates/base/frontend/src/App.tsx +36 -0
- package/templates/base/frontend/src/main.tsx +10 -0
- package/templates/base/frontend/src/openapi/utils/openapi.yaml.hbs +129 -0
- package/templates/base/frontend/src/pages/constants.tsx +31 -0
- package/templates/base/frontend/src/pages/index.tsx +192 -0
- package/templates/base/frontend/src/pages/types.tsx +6 -0
- package/templates/base/frontend/src/pages/users/[id]/index.tsx +53 -0
- package/templates/base/frontend/src/pages/users/index.tsx +57 -0
- package/templates/base/frontend/src/pages/users/types.tsx +4 -0
- package/templates/base/frontend/src/styles.module.css +7 -0
- package/templates/base/frontend/src/utils/constants.tsx +11 -0
- package/templates/base/frontend/src/utils/formatters/index.tsx +49 -0
- package/templates/base/frontend/src/utils/functions.tsx +70 -0
- package/templates/base/frontend/src/utils/index.tsx +3 -0
- package/templates/base/frontend/tsconfig.json +24 -0
- package/templates/base/frontend/vite.config.ts +20 -0
- package/templates/base/package.json.hbs +11 -0
- package/templates/base/security/baseline.json +4 -0
- package/templates/celery/backend/apps/core/tasks.py +14 -0
- package/templates/celery/backend/apps/core/tests/test_tasks.py +6 -0
- package/templates/celery/backend/config/celery.py.hbs +26 -0
- package/templates/celerybeat/backend/apps/core/tasks_scheduled.py +18 -0
- package/templates/celerybeat/backend/apps/core/tests/test_tasks_scheduled.py +6 -0
- package/templates/postgres/.dude/commands/reset.ts +83 -0
- package/templates/s3/backend/apps/files/__init__.py +0 -0
- package/templates/s3/backend/apps/files/admin.py +9 -0
- package/templates/s3/backend/apps/files/apps.py +6 -0
- package/templates/s3/backend/apps/files/migrations/0001_initial.py +29 -0
- package/templates/s3/backend/apps/files/migrations/__init__.py +0 -0
- package/templates/s3/backend/apps/files/models.py +21 -0
- package/templates/s3/backend/apps/files/serializers.py +27 -0
- package/templates/s3/backend/apps/files/services.py +19 -0
- package/templates/s3/backend/apps/files/tests/__init__.py +0 -0
- package/templates/s3/backend/apps/files/tests/test_models.py +10 -0
- package/templates/s3/backend/apps/files/tests/test_views.py +32 -0
- package/templates/s3/backend/apps/files/urls.py +10 -0
- package/templates/s3/backend/apps/files/views.py +29 -0
- package/templates/s3/frontend/src/openapi/utils/openapi.yaml.hbs +253 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-scan
|
|
3
|
+
description: Run the full security scan (bandit + semgrep + trivy-fs + trivy-image), triage new findings, fix HIGH/CRITICAL in-repo issues in parallel branches, open a PR, create Jira bugs for unfixable findings, and update the baseline.
|
|
4
|
+
disable-model-invocation: false
|
|
5
|
+
allowed-tools: "Bash(git *) Bash(dude *) Bash(docker *) Bash(find *) Bash(cat *) Bash(mkdir *) Bash(rm *) Read Write mcp__atlassian__createJiraIssue mcp__atlassian__searchJiraIssuesUsingJql mcp__atlassian__atlassianUserInfo mcp__atlassian__getAccessibleAtlassianResources mcp__atlassian__createPullRequest PushNotification"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Security Scan
|
|
9
|
+
|
|
10
|
+
Runs `dude security scan`, triages new findings, fixes HIGH/CRITICAL in-repo
|
|
11
|
+
issues via parallel agents in isolated git worktrees, consolidates into one
|
|
12
|
+
branch, opens a PR, creates Jira bugs for unfixable findings, and updates the
|
|
13
|
+
baseline with `dude security accept`.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Step 0 — Autodiscovery
|
|
18
|
+
|
|
19
|
+
### Project root
|
|
20
|
+
|
|
21
|
+
Locate `dude.json` by searching from the current working directory upward:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
find . -maxdepth 3 -name "dude.json" | head -1
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If not found, report: _"No dude.json found — are you inside a dude project?"_ and stop.
|
|
28
|
+
Set `PROJECT_ROOT` to the directory containing `dude.json`.
|
|
29
|
+
|
|
30
|
+
### Docker
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
docker info > /dev/null 2>&1 && echo "ok" || echo "not running"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
If Docker is not running, report: _"Docker is required (trivy, semgrep). Start Docker and retry."_ and stop.
|
|
37
|
+
|
|
38
|
+
### Jira configuration
|
|
39
|
+
|
|
40
|
+
Read `.claude/skills/create-jira-issue/SKILL.md` and look for `## Saved configuration`.
|
|
41
|
+
|
|
42
|
+
- If a `project` key is present, use it silently.
|
|
43
|
+
- If absent, ask: **"What is the Jira project key? (leave blank to skip Jira issue creation)"**
|
|
44
|
+
- If provided, offer to save it in `create-jira-issue/SKILL.md`.
|
|
45
|
+
- If blank, proceed without creating Jira issues.
|
|
46
|
+
|
|
47
|
+
Resolve automatically — do not ask the user:
|
|
48
|
+
- **Reporter**: `atlassianUserInfo` → account ID
|
|
49
|
+
- **Jira URL**: `getAccessibleAtlassianResources` → first site URL
|
|
50
|
+
|
|
51
|
+
### Repository configuration
|
|
52
|
+
|
|
53
|
+
Read `## Saved configuration` at the bottom of this file.
|
|
54
|
+
|
|
55
|
+
- If `workspace` and `repo` keys are present, use them silently.
|
|
56
|
+
- If absent, ask:
|
|
57
|
+
- **"What is the Bitbucket workspace slug?"** (e.g. `myteam`)
|
|
58
|
+
- **"What is the repository slug?"** (e.g. `my-project`)
|
|
59
|
+
- Then offer to save both in this file (same append mechanism as `create-jira-issue`).
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Step 1 — Run the scan
|
|
64
|
+
|
|
65
|
+
From `PROJECT_ROOT`:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
dude security scan
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Classifies findings into **new / known / resolved** and writes:
|
|
72
|
+
- `private/sast-reports/latest/findings.json`
|
|
73
|
+
- `private/sast-reports/latest/summary.md`
|
|
74
|
+
|
|
75
|
+
Show `summary.md` to the user.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Step 2 — Triage new findings
|
|
80
|
+
|
|
81
|
+
Read `findings.json`, filter `status = "new"`, classify each:
|
|
82
|
+
|
|
83
|
+
| Class | Criteria |
|
|
84
|
+
|-------|----------|
|
|
85
|
+
| **fixable** | HIGH or CRITICAL, source in `backend/` or `frontend/` (not a dependency CVE), fix is actionable |
|
|
86
|
+
| **jira-only** | HIGH or CRITICAL, dependency CVE or infra issue — cannot be fixed in-repo |
|
|
87
|
+
| **accept** | LOW or MEDIUM, or false positive |
|
|
88
|
+
|
|
89
|
+
Present the triage table:
|
|
90
|
+
|
|
91
|
+
| # | Fingerprint | Tool | Severity | File | Title | Action |
|
|
92
|
+
|---|-------------|------|----------|------|-------|--------|
|
|
93
|
+
| … | … | … | … | … | … | fixable / jira-only / accept |
|
|
94
|
+
|
|
95
|
+
Ask: _"Does this triage look right? Adjust any action before I proceed."_
|
|
96
|
+
|
|
97
|
+
Wait for confirmation. If there are no **fixable** findings, skip Steps 3–5 and go to Step 6.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Step 3 — Fix agents (parallel, one per fixable finding)
|
|
102
|
+
|
|
103
|
+
### Branch naming
|
|
104
|
+
|
|
105
|
+
Each fixable finding gets its own branch:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
security/fix-<fingerprint>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
where `<fingerprint>` is the first 8 characters of the finding's fingerprint field.
|
|
112
|
+
|
|
113
|
+
### Launch parallel agents
|
|
114
|
+
|
|
115
|
+
Launch one **sub-agent per fixable finding in the same message** (so they run in parallel), each with `isolation: "worktree"`.
|
|
116
|
+
|
|
117
|
+
Prompt template for each agent:
|
|
118
|
+
|
|
119
|
+
> You are fixing a security finding in an isolated git worktree.
|
|
120
|
+
>
|
|
121
|
+
> **Project root**: `<PROJECT_ROOT>`
|
|
122
|
+
> **Base branch**: `develop`
|
|
123
|
+
> **Your branch**: `security/fix-<fingerprint>`
|
|
124
|
+
>
|
|
125
|
+
> **Finding**:
|
|
126
|
+
> - Tool: `<tool>`
|
|
127
|
+
> - Rule: `<rule_id>`
|
|
128
|
+
> - Severity: `<severity>`
|
|
129
|
+
> - File: `<file>` line `<line>`
|
|
130
|
+
> - Message: `<message>`
|
|
131
|
+
>
|
|
132
|
+
> **Instructions**:
|
|
133
|
+
> 1. `git fetch origin && git checkout -b security/fix-<fingerprint> origin/develop`
|
|
134
|
+
> 2. Read the affected file at the reported line.
|
|
135
|
+
> 3. Apply the minimal correct fix that resolves the finding without breaking surrounding logic.
|
|
136
|
+
> 4. If the fix is not safe or the root cause is unclear, output `CANNOT_FIX: <reason>` and stop.
|
|
137
|
+
> 5. `git add -p` → stage only the relevant changes.
|
|
138
|
+
> 6. `git commit -m "fix(security): <rule_id> in <file>"`
|
|
139
|
+
> 7. `git push -u origin security/fix-<fingerprint>`
|
|
140
|
+
> 8. Output `FIXED: security/fix-<fingerprint> — <one-line description of the fix>`
|
|
141
|
+
|
|
142
|
+
Wait for **all agents** to finish before proceeding.
|
|
143
|
+
|
|
144
|
+
Collect results:
|
|
145
|
+
- `FIXED: <branch>` → add to **fixed** list
|
|
146
|
+
- `CANNOT_FIX: <reason>` → reclassify that finding as **jira-only**
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Step 4 — Consolidation
|
|
151
|
+
|
|
152
|
+
If only one branch was fixed, use it directly as the source branch (skip merge step).
|
|
153
|
+
|
|
154
|
+
If two or more branches were fixed:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
git fetch origin
|
|
158
|
+
git checkout develop && git pull origin develop --rebase
|
|
159
|
+
git checkout -b security/fix-<YYYYMMDD>
|
|
160
|
+
|
|
161
|
+
git merge --no-ff security/fix-<fp1>
|
|
162
|
+
git merge --no-ff security/fix-<fp2>
|
|
163
|
+
# … one per fixed branch
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
If any merge produces a conflict:
|
|
167
|
+
- Report which branch caused it and the conflicting files.
|
|
168
|
+
- Stop — do **not** force-push or discard.
|
|
169
|
+
- Ask the user how to proceed.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Step 5 — Tests and PR
|
|
174
|
+
|
|
175
|
+
### Run tests
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
dude test
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
If tests fail, report the output and stop — do **not** open a PR.
|
|
182
|
+
|
|
183
|
+
### Push and open PR
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
git push -u origin <source-branch>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Create a pull request via MCP:
|
|
190
|
+
- **Title**: `[security] Fix <n> HIGH/CRITICAL finding(s) from scan <YYYY-MM-DD>`
|
|
191
|
+
- **Source branch**: `<source-branch>`
|
|
192
|
+
- **Destination branch**: `develop`
|
|
193
|
+
- **Description**:
|
|
194
|
+
```
|
|
195
|
+
## Security fixes
|
|
196
|
+
|
|
197
|
+
Automated fixes from `dude security scan` run on <date>.
|
|
198
|
+
|
|
199
|
+
| Fingerprint | Tool | Severity | File | Fix summary |
|
|
200
|
+
|-------------|------|----------|------|-------------|
|
|
201
|
+
| <fp> | <tool> | <severity> | <file> | <one-line> |
|
|
202
|
+
|
|
203
|
+
## Testing
|
|
204
|
+
- `dude test`: ✓
|
|
205
|
+
|
|
206
|
+
## Baseline
|
|
207
|
+
Remaining findings (jira-only + accept) will be baselined with
|
|
208
|
+
`dude security accept` after this PR is merged.
|
|
209
|
+
```
|
|
210
|
+
- **Close source branch**: `true`
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Step 6 — Create Jira issues (jira-only findings)
|
|
215
|
+
|
|
216
|
+
Skip if no Jira project key is configured.
|
|
217
|
+
|
|
218
|
+
For each **jira-only** finding:
|
|
219
|
+
|
|
220
|
+
1. Check for duplicates:
|
|
221
|
+
```jql
|
|
222
|
+
project = <KEY> AND statusCategory != Done AND summary ~ "<tool> <rule_id>"
|
|
223
|
+
```
|
|
224
|
+
If a match exists, skip and note the existing key.
|
|
225
|
+
|
|
226
|
+
2. Create a Bug:
|
|
227
|
+
- **Summary**: `[security] <tool>: <short title> (<severity>)`
|
|
228
|
+
- **Description**:
|
|
229
|
+
```
|
|
230
|
+
## Finding
|
|
231
|
+
|
|
232
|
+
- **Tool**: <tool>
|
|
233
|
+
- **Rule**: <rule_id>
|
|
234
|
+
- **Severity**: <severity>
|
|
235
|
+
- **File**: <file> (line <line>)
|
|
236
|
+
- **Fingerprint**: <fingerprint>
|
|
237
|
+
|
|
238
|
+
## Description
|
|
239
|
+
<message>
|
|
240
|
+
|
|
241
|
+
## Why not fixed inline
|
|
242
|
+
<reason: dependency CVE / infrastructure / unclear root cause>
|
|
243
|
+
|
|
244
|
+
## Suggested remediation
|
|
245
|
+
<package to update, advisory link, or mitigation>
|
|
246
|
+
|
|
247
|
+
## References
|
|
248
|
+
- Scan timestamp: <timestamp from findings.json>
|
|
249
|
+
```
|
|
250
|
+
- **Labels**: `security` + `<severity-lowercase>` + `<tool>`
|
|
251
|
+
- **Priority**: CRITICAL → Blocker, HIGH → High
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Step 7 — Accept remaining findings
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
dude security accept
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Merges **accept** findings (and **jira-only** findings that now have a Jira issue) into `security/baseline.json`.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Step 8 — Summary report
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
Security scan complete
|
|
269
|
+
══════════════════════════════════════════════════
|
|
270
|
+
Fixed in-repo (PR): <n> findings → <PR URL>
|
|
271
|
+
Jira issues: <n> created, <n> already existed
|
|
272
|
+
Accepted: <n> findings added to baseline
|
|
273
|
+
Resolved: <n> findings no longer present
|
|
274
|
+
──────────────────────────────────────────────────
|
|
275
|
+
Next steps:
|
|
276
|
+
• Review and merge the PR above
|
|
277
|
+
• After merge: run `dude security verify` to confirm baseline is clean
|
|
278
|
+
• Individual fix branches will be deleted when PR is merged
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Notes
|
|
284
|
+
|
|
285
|
+
- Docker must be running — trivy and semgrep run in containers.
|
|
286
|
+
- The skill does **not** commit or push anything outside the fix agents.
|
|
287
|
+
- Adapter scope can be narrowed: `dude security scan --only bandit` if a full scan is too slow.
|
|
288
|
+
- Each fix agent runs in its own git worktree (`isolation: "worktree"`) — git operations never conflict between agents.
|
|
289
|
+
- `security/baseline.json` is **not** touched by fix agents — baseline is updated only in Step 7 after the PR is ready.
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
<!-- ------------------------------------------------------------------ -->
|
|
294
|
+
<!-- Everything below this line is written automatically by the skill. -->
|
|
295
|
+
<!-- Do not edit manually. -->
|
|
296
|
+
<!-- ------------------------------------------------------------------ -->
|
|
297
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify-security-fixes
|
|
3
|
+
description: After a security fix PR is merged, verify that the targeted findings are resolved, remove them from the baseline, and close the corresponding Jira issues — all in a single scan run.
|
|
4
|
+
disable-model-invocation: false
|
|
5
|
+
allowed-tools: "Bash(git *) Bash(dude *) Bash(docker *) Bash(cat *) Read Write mcp__atlassian__getJiraIssue mcp__atlassian__getTransitionsForJiraIssue mcp__atlassian__transitionJiraIssue mcp__atlassian__addCommentToJiraIssue"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Verify Security Fixes
|
|
9
|
+
|
|
10
|
+
After a security fix PR is merged into `develop`, this skill:
|
|
11
|
+
|
|
12
|
+
1. Fetches one or more Jira issues and extracts the rule_id(s) from their descriptions.
|
|
13
|
+
2. Runs **a single `dude security verify` scan** for all rule_ids at once.
|
|
14
|
+
3. Removes resolved findings from `security/baseline.json` and commits.
|
|
15
|
+
4. Closes the Jira issues whose findings are fully resolved.
|
|
16
|
+
|
|
17
|
+
Run this on `develop` **after** the fix PR has been merged.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
/verify-security-fixes PROJ-52
|
|
23
|
+
/verify-security-fixes PROJ-52 PROJ-55 PROJ-59
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Step 0 — Prerequisites
|
|
29
|
+
|
|
30
|
+
### Project root
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
find . -maxdepth 3 -name "dude.json" | head -1
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
If not found, report: _"No dude.json found — are you inside a dude project?"_ and stop.
|
|
37
|
+
|
|
38
|
+
### Current branch
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git branch --show-current
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Must be `develop` (or a branch that tracks `develop`). If not, warn:
|
|
45
|
+
_"This skill should run on develop after the fix PR is merged."_ — ask whether to continue anyway.
|
|
46
|
+
|
|
47
|
+
### Docker
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
docker info > /dev/null 2>&1 && echo "ok" || echo "not running"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If not running, stop with: _"Docker is required for the scan. Start Docker and retry."_
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Step 1 — Fetch issues and extract rule_ids
|
|
58
|
+
|
|
59
|
+
For each issue key provided by the user:
|
|
60
|
+
|
|
61
|
+
1. Call `getJiraIssue` to read the full issue.
|
|
62
|
+
2. Parse the description for the `**Rule**: <rule_id>` line — this is the rule_id to verify.
|
|
63
|
+
3. Also note `**Fingerprint**: <fingerprint>` for the summary report.
|
|
64
|
+
4. If the description does not contain a `**Rule**:` line, fall back to parsing the summary
|
|
65
|
+
field: `[security] <tool>: <short title> (<severity>)` — derive the rule_id from `<short title>`.
|
|
66
|
+
5. If no rule_id can be extracted, report the issue key with a warning and skip it.
|
|
67
|
+
|
|
68
|
+
Collect all unique rule_ids across all issues into one flat list (`R1`, `R2`, …).
|
|
69
|
+
|
|
70
|
+
Show the mapping before proceeding:
|
|
71
|
+
|
|
72
|
+
| Issue | Rule ID | Fingerprint |
|
|
73
|
+
|-------|---------|-------------|
|
|
74
|
+
| PROJ-52 | B105 | a3f9c1d2 |
|
|
75
|
+
| PROJ-55 | CVE-2026-33750 | e7b2f041 |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Step 2 — Run a single verify scan
|
|
80
|
+
|
|
81
|
+
From `PROJECT_ROOT`:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
dude security verify --rule-id <R1>,<R2>,... --remove-resolved
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
One full scan run, results filtered per rule_id.
|
|
88
|
+
|
|
89
|
+
- **Exit 0**: all specified rule_ids are resolved.
|
|
90
|
+
- **Non-zero exit**: at least one rule_id is still present — capture the full output.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Step 3 — Decide outcome
|
|
95
|
+
|
|
96
|
+
Inspect the `dude security verify` output for each rule_id:
|
|
97
|
+
|
|
98
|
+
| Outcome | Criteria |
|
|
99
|
+
|---------|----------|
|
|
100
|
+
| **resolved** | Output shows `✓ RESOLVED` for this rule_id |
|
|
101
|
+
| **still present** | Output shows `✗ STILL PRESENT` for this rule_id |
|
|
102
|
+
|
|
103
|
+
Classify each issue accordingly:
|
|
104
|
+
- Issues whose **all** rule_ids are resolved → **fully resolved**
|
|
105
|
+
- Issues where at least one rule_id is still present → **not yet fixed**
|
|
106
|
+
|
|
107
|
+
If **no** rule_ids are resolved, do not touch the baseline. Report to the user and stop.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Step 4 — Commit baseline update
|
|
112
|
+
|
|
113
|
+
`--remove-resolved` already modified `security/baseline.json` in memory; commit it:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git add security/baseline.json
|
|
117
|
+
git commit -m "fix(security): remove resolved findings from baseline — <issue list>"
|
|
118
|
+
git push origin develop
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Where `<issue list>` is a space-separated list of all **fully resolved** issue keys.
|
|
122
|
+
|
|
123
|
+
If git reports nothing to commit (e.g. `--remove-resolved` found nothing to remove),
|
|
124
|
+
skip this step and note it in the summary.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Step 5 — Close fully-resolved Jira issues
|
|
129
|
+
|
|
130
|
+
For each **fully resolved** issue:
|
|
131
|
+
|
|
132
|
+
1. `getTransitionsForJiraIssue` → find the transition whose name matches `Done` (case-insensitive).
|
|
133
|
+
2. `transitionJiraIssue` to that transition ID.
|
|
134
|
+
3. `addCommentToJiraIssue`:
|
|
135
|
+
> Security finding verified as resolved by `dude security verify` on `<date>`.
|
|
136
|
+
> Baseline updated: fingerprint `<fingerprint>` removed from `security/baseline.json`.
|
|
137
|
+
|
|
138
|
+
If the "Done" transition is not found (e.g. issue is already Done, or workflow differs),
|
|
139
|
+
log a warning and skip — do **not** fail the skill.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Step 6 — Report
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
Verify security fixes — complete
|
|
147
|
+
══════════════════════════════════════════════════════════
|
|
148
|
+
|
|
149
|
+
Resolved (N rule_id(s) across M issue(s))
|
|
150
|
+
PROJ-52 B105 fingerprint a3f9c1d2 removed from baseline → Done
|
|
151
|
+
PROJ-55 CVE-2026-33750 fingerprint e7b2f041 removed from baseline → Done
|
|
152
|
+
|
|
153
|
+
Still present (K finding(s))
|
|
154
|
+
PROJ-59 G202 file.py:42 — <message>
|
|
155
|
+
→ The finding was not eliminated; the fix may need revision.
|
|
156
|
+
|
|
157
|
+
Baseline
|
|
158
|
+
security/baseline.json updated and pushed to develop.
|
|
159
|
+
(no changes needed — no resolved fingerprints found) ← if applicable
|
|
160
|
+
|
|
161
|
+
Jira
|
|
162
|
+
PROJ-52 → Done
|
|
163
|
+
PROJ-55 → Done
|
|
164
|
+
PROJ-59 → left open (still present)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Notes
|
|
170
|
+
|
|
171
|
+
- Running one scan for N issues costs the same as one scan for 1 issue — this is the
|
|
172
|
+
main efficiency gain over verifying each issue separately.
|
|
173
|
+
- `--rule-id` accepts comma-separated values: `B105,G202,CVE-2026-33750` — all are
|
|
174
|
+
checked in a single invocation.
|
|
175
|
+
- If a rule_id appears in multiple issues, it is included only once in the
|
|
176
|
+
`--rule-id` list; both issues benefit from the single result.
|
|
177
|
+
- The skill does **not** re-run `dude security scan` — it calls `dude security verify`,
|
|
178
|
+
which is scope-aware and only reports on the baseline entries that match the provided
|
|
179
|
+
rule_ids.
|
|
180
|
+
- If Docker or the scan fails entirely, no baseline changes are committed.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Custom `dude` commands
|
|
2
|
+
|
|
3
|
+
Drop a file in this directory and it becomes a `dude` command. The command name
|
|
4
|
+
is the file's base name:
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
.dude/commands/reset.ts → dude reset
|
|
8
|
+
.dude/commands/seed.ts → dude seed
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
No registration step — this directory **is** the registry.
|
|
12
|
+
|
|
13
|
+
## Writing a command
|
|
14
|
+
|
|
15
|
+
Each file must `export default` a command object. Use the `defineCommand` helper
|
|
16
|
+
from `@cubocicloide/dude` (already a dev dependency of this project) for full
|
|
17
|
+
type-checking and autocomplete:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { defineCommand } from '@cubocicloide/dude'
|
|
21
|
+
|
|
22
|
+
export default defineCommand({
|
|
23
|
+
description: 'Reset the database to a clean state.',
|
|
24
|
+
args: {
|
|
25
|
+
force: { type: 'boolean', description: 'Skip the confirmation prompt.' },
|
|
26
|
+
},
|
|
27
|
+
async run({ projectRoot, args }) {
|
|
28
|
+
// your logic here
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### The command context
|
|
34
|
+
|
|
35
|
+
`run()` receives:
|
|
36
|
+
|
|
37
|
+
| Field | Description |
|
|
38
|
+
| ------------- | -------------------------------------------------------- |
|
|
39
|
+
| `projectRoot` | Absolute path to this project (where `dude.json` lives). |
|
|
40
|
+
| `stackRoot` | Absolute path to the installed stack package. |
|
|
41
|
+
| `args` | Parsed flags, keyed by the names you declare in `args`. |
|
|
42
|
+
|
|
43
|
+
### Arguments
|
|
44
|
+
|
|
45
|
+
Each entry in `args` declares a flag of `type: 'string'` or `type: 'boolean'`,
|
|
46
|
+
with an optional `description` and `default`. They show up in `dude help <cmd>`.
|
|
47
|
+
|
|
48
|
+
## TypeScript & extra packages
|
|
49
|
+
|
|
50
|
+
Commands are loaded with [jiti](https://github.com/unjs/jiti), so you can write
|
|
51
|
+
real TypeScript and `import` any package you add to the project:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pnpm add -D execa
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { defineCommand } from '@cubocicloide/dude'
|
|
59
|
+
import { execa } from 'execa'
|
|
60
|
+
|
|
61
|
+
export default defineCommand({
|
|
62
|
+
description: 'Tail the backend logs.',
|
|
63
|
+
async run() {
|
|
64
|
+
await execa('docker', ['compose', 'logs', '-f', 'backend'], { stdio: 'inherit' })
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`.mjs` and `.js` files work too.
|
|
70
|
+
|
|
71
|
+
## Overriding built-in commands
|
|
72
|
+
|
|
73
|
+
A custom command overrides a stack command of the same name. For example, a
|
|
74
|
+
`.dude/commands/up.ts` replaces the default `dude up`. Overrides are marked in
|
|
75
|
+
`dude help`.
|
|
76
|
+
|
|
77
|
+
The core commands `init`, `upgrade`, `version`, and `help` are reserved and
|
|
78
|
+
cannot be overridden.
|
|
79
|
+
|
|
80
|
+
## Listing your commands
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
dude help # shows a "PROJECT COMMANDS" section
|
|
84
|
+
dude help <command> # shows a command's flags
|
|
85
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example custom command — `dude hello`.
|
|
3
|
+
*
|
|
4
|
+
* This file is a starting point: rename it, edit it, or delete it. Every file
|
|
5
|
+
* under `.dude/commands/` becomes a `dude` command named after the file
|
|
6
|
+
* (`hello.ts` → `dude hello`). See `.dude/commands/README.md` for the full
|
|
7
|
+
* contract.
|
|
8
|
+
*/
|
|
9
|
+
import { defineCommand } from '@cubocicloide/dude'
|
|
10
|
+
|
|
11
|
+
export default defineCommand({
|
|
12
|
+
description: 'Example custom command — prints a greeting.',
|
|
13
|
+
args: {
|
|
14
|
+
name: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Who to greet.',
|
|
17
|
+
default: 'world',
|
|
18
|
+
},
|
|
19
|
+
shout: {
|
|
20
|
+
type: 'boolean',
|
|
21
|
+
description: 'Greet in uppercase.',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
// `projectRoot` is the absolute path to this project; `args` holds the parsed
|
|
25
|
+
// flags above. You can import any package you add to the project here.
|
|
26
|
+
async run({ projectRoot, args }) {
|
|
27
|
+
const name = typeof args.name === 'string' ? args.name : 'world'
|
|
28
|
+
let message = `Hello, ${name}! 👋`
|
|
29
|
+
if (args.shout) message = message.toUpperCase()
|
|
30
|
+
|
|
31
|
+
process.stdout.write(message + '\n')
|
|
32
|
+
process.stdout.write(`(running in ${projectRoot})\n`)
|
|
33
|
+
},
|
|
34
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example project lint check — PRJ001.
|
|
3
|
+
*
|
|
4
|
+
* This file is a starting point: rename it, edit it, or delete it. Every
|
|
5
|
+
* module under `.dude/lint/checks/<GROUP>/<id>.ts` becomes a lint rule coded
|
|
6
|
+
* `<GROUP><id>` (this one is `PRJ001`) and runs on every `dude lint`, right
|
|
7
|
+
* after the stack's built-in checks. See `.dude/lint/checks/README.md` for
|
|
8
|
+
* the full contract.
|
|
9
|
+
*/
|
|
10
|
+
import type { RawDiagnostic } from '@cubocicloide/dude'
|
|
11
|
+
|
|
12
|
+
export default function check(root: string): RawDiagnostic[] {
|
|
13
|
+
const diagnostics: RawDiagnostic[] = []
|
|
14
|
+
|
|
15
|
+
// Emit a diagnostic for each violation you find under `root`, e.g.:
|
|
16
|
+
//
|
|
17
|
+
// diagnostics.push({
|
|
18
|
+
// file: 'backend/app/main.py', // path relative to the project root
|
|
19
|
+
// line: 1,
|
|
20
|
+
// col: 1,
|
|
21
|
+
// severity: 'error', // 'error' fails `dude lint`; 'warning' doesn't
|
|
22
|
+
// message: 'What is wrong and how to fix it.',
|
|
23
|
+
// })
|
|
24
|
+
|
|
25
|
+
return diagnostics
|
|
26
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Project lint checks
|
|
2
|
+
|
|
3
|
+
Drop a file in this directory and it becomes a lint rule that `dude lint` runs
|
|
4
|
+
alongside the stack's built-in checks. The rule's code is derived from the
|
|
5
|
+
path:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.dude/lint/checks/PRJ/001.ts → PRJ001
|
|
9
|
+
.dude/lint/checks/SEC/002.ts → SEC002
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
No registration step — this directory **is** the registry (groups are the
|
|
13
|
+
sub-directories, ids are the file names).
|
|
14
|
+
|
|
15
|
+
## Writing a check
|
|
16
|
+
|
|
17
|
+
Each file must `export default` a function that receives the project root and
|
|
18
|
+
returns diagnostics (synchronously or as a Promise). Use the types from
|
|
19
|
+
`@cubocicloide/dude` (already a dev dependency of this project):
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// .dude/lint/checks/PRJ/001.ts
|
|
23
|
+
import type { RawDiagnostic } from '@cubocicloide/dude'
|
|
24
|
+
|
|
25
|
+
export default function check(root: string): RawDiagnostic[] {
|
|
26
|
+
return [
|
|
27
|
+
// {
|
|
28
|
+
// file: 'backend/app/main.py', // path relative to the project root
|
|
29
|
+
// line: 1,
|
|
30
|
+
// col: 1,
|
|
31
|
+
// severity: 'error', // 'error' fails the build; 'warning' doesn't
|
|
32
|
+
// message: 'What is wrong and how to fix it.',
|
|
33
|
+
// },
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Checks are loaded with [jiti](https://github.com/unjs/jiti), so you can write
|
|
39
|
+
real TypeScript and `import` any package you add to the project.
|
|
40
|
+
|
|
41
|
+
You can document a rule with a Markdown file next to it
|
|
42
|
+
(`PRJ/001.md`) — `dude lint` ignores non-module files. Co-located tests
|
|
43
|
+
(`001.test.ts`) are ignored too.
|
|
44
|
+
|
|
45
|
+
## Choosing codes
|
|
46
|
+
|
|
47
|
+
Use your own groups (e.g. `PRJ`, `SEC`, your project's initials). A code
|
|
48
|
+
already claimed by the stack (e.g. `BE001`) is a **hard error** — project
|
|
49
|
+
checks extend the stack's rule set, they never shadow it.
|
|
50
|
+
|
|
51
|
+
## Disabling a stack rule
|
|
52
|
+
|
|
53
|
+
To drop a built-in rule, list its code in `dude.json`:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"lint": { "disable": ["BE003"] }
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
To *replace* a stack rule, disable it and add your adapted version under a
|
|
62
|
+
project-owned code (e.g. `PRJ/001.ts`).
|
|
63
|
+
|
|
64
|
+
## Running
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
dude lint # stack checks + project checks, minus disabled codes
|
|
68
|
+
dude lint --quiet # errors only
|
|
69
|
+
```
|