ma-agents 3.2.0 → 3.4.0
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/.opencode/skills/.ma-agents.json +99 -99
- package/.roo/rules/00-ma-agents.md +13 -0
- package/.roo/skills/.ma-agents.json +241 -0
- package/.roo/skills/MANIFEST.yaml +254 -0
- package/.roo/skills/ai-audit-trail/SKILL.md +23 -0
- package/.roo/skills/auto-bug-detection/SKILL.md +169 -0
- package/.roo/skills/cmake-best-practices/SKILL.md +64 -0
- package/.roo/skills/cmake-best-practices/examples/cmake.md +59 -0
- package/.roo/skills/code-documentation/SKILL.md +57 -0
- package/.roo/skills/code-documentation/examples/cpp.md +29 -0
- package/.roo/skills/code-documentation/examples/csharp.md +28 -0
- package/.roo/skills/code-documentation/examples/javascript_typescript.md +28 -0
- package/.roo/skills/code-documentation/examples/python.md +57 -0
- package/.roo/skills/code-review/SKILL.md +43 -0
- package/.roo/skills/commit-message/SKILL.md +79 -0
- package/.roo/skills/cpp-best-practices/SKILL.md +234 -0
- package/.roo/skills/cpp-best-practices/examples/modern-idioms.md +189 -0
- package/.roo/skills/cpp-best-practices/examples/naming-and-organization.md +102 -0
- package/.roo/skills/cpp-concurrency-safety/SKILL.md +60 -0
- package/.roo/skills/cpp-concurrency-safety/examples/concurrency.md +73 -0
- package/.roo/skills/cpp-const-correctness/SKILL.md +63 -0
- package/.roo/skills/cpp-const-correctness/examples/const_correctness.md +54 -0
- package/.roo/skills/cpp-memory-handling/SKILL.md +42 -0
- package/.roo/skills/cpp-memory-handling/examples/modern-cpp.md +49 -0
- package/.roo/skills/cpp-memory-handling/examples/smart-pointers.md +46 -0
- package/.roo/skills/cpp-modern-composition/SKILL.md +64 -0
- package/.roo/skills/cpp-modern-composition/examples/composition.md +51 -0
- package/.roo/skills/cpp-robust-interfaces/SKILL.md +55 -0
- package/.roo/skills/cpp-robust-interfaces/examples/interfaces.md +56 -0
- package/.roo/skills/create-hardened-docker-skill/SKILL.md +637 -0
- package/.roo/skills/create-hardened-docker-skill/scripts/create-all.sh +489 -0
- package/.roo/skills/csharp-best-practices/SKILL.md +278 -0
- package/.roo/skills/docker-hardening-verification/SKILL.md +28 -0
- package/.roo/skills/docker-hardening-verification/scripts/verify-hardening.sh +39 -0
- package/.roo/skills/docker-image-signing/SKILL.md +28 -0
- package/.roo/skills/docker-image-signing/scripts/sign-image.sh +33 -0
- package/.roo/skills/document-revision-history/SKILL.md +104 -0
- package/.roo/skills/git-workflow-skill/SKILL.md +194 -0
- package/.roo/skills/git-workflow-skill/hooks/commit-msg +61 -0
- package/.roo/skills/git-workflow-skill/hooks/pre-commit +38 -0
- package/.roo/skills/git-workflow-skill/hooks/prepare-commit-msg +56 -0
- package/.roo/skills/git-workflow-skill/scripts/finish-feature.sh +192 -0
- package/.roo/skills/git-workflow-skill/scripts/install-hooks.sh +55 -0
- package/.roo/skills/git-workflow-skill/scripts/start-feature.sh +110 -0
- package/.roo/skills/git-workflow-skill/scripts/validate-workflow.sh +229 -0
- package/.roo/skills/js-ts-dependency-mgmt/SKILL.md +49 -0
- package/.roo/skills/js-ts-dependency-mgmt/examples/dependency_mgmt.md +60 -0
- package/.roo/skills/js-ts-security-skill/SKILL.md +64 -0
- package/.roo/skills/js-ts-security-skill/scripts/verify-security.sh +136 -0
- package/.roo/skills/logging-best-practices/SKILL.md +50 -0
- package/.roo/skills/logging-best-practices/examples/cpp.md +36 -0
- package/.roo/skills/logging-best-practices/examples/csharp.md +49 -0
- package/.roo/skills/logging-best-practices/examples/javascript.md +77 -0
- package/.roo/skills/logging-best-practices/examples/python.md +57 -0
- package/.roo/skills/logging-best-practices/references/logging-standards.md +29 -0
- package/.roo/skills/open-presentation/SKILL.md +35 -0
- package/.roo/skills/opentelemetry-best-practices/SKILL.md +34 -0
- package/.roo/skills/opentelemetry-best-practices/examples/go.md +32 -0
- package/.roo/skills/opentelemetry-best-practices/examples/javascript.md +58 -0
- package/.roo/skills/opentelemetry-best-practices/examples/python.md +37 -0
- package/.roo/skills/opentelemetry-best-practices/references/otel-standards.md +37 -0
- package/.roo/skills/python-best-practices/SKILL.md +385 -0
- package/.roo/skills/python-dependency-mgmt/SKILL.md +42 -0
- package/.roo/skills/python-dependency-mgmt/examples/dependency_mgmt.md +67 -0
- package/.roo/skills/python-security-skill/SKILL.md +56 -0
- package/.roo/skills/python-security-skill/examples/security.md +56 -0
- package/.roo/skills/self-signed-cert/SKILL.md +42 -0
- package/.roo/skills/self-signed-cert/scripts/generate-cert.ps1 +45 -0
- package/.roo/skills/self-signed-cert/scripts/generate-cert.sh +43 -0
- package/.roo/skills/skill-creator/SKILL.md +196 -0
- package/.roo/skills/skill-creator/references/output-patterns.md +82 -0
- package/.roo/skills/skill-creator/references/workflows.md +28 -0
- package/.roo/skills/skill-creator/scripts/init_skill.py +208 -0
- package/.roo/skills/skill-creator/scripts/package_skill.py +99 -0
- package/.roo/skills/skill-creator/scripts/quick_validate.py +113 -0
- package/.roo/skills/story-status-lookup/SKILL.md +78 -0
- package/.roo/skills/test-accompanied-development/SKILL.md +50 -0
- package/.roo/skills/test-generator/SKILL.md +65 -0
- package/.roo/skills/vercel-react-best-practices/SKILL.md +109 -0
- package/.roo/skills/verify-hardened-docker-skill/SKILL.md +442 -0
- package/.roo/skills/verify-hardened-docker-skill/scripts/verify-docker-hardening.sh +439 -0
- package/README.md +21 -2
- package/bin/cli.js +55 -0
- package/lib/agents.js +46 -0
- package/lib/bmad-cache/cache-manifest.json +1 -1
- package/lib/bmad-customizations/bmm-demerzel.customize.yaml +36 -0
- package/lib/bmad-customizations/demerzel.md +32 -0
- package/lib/bmad-extension/module-help.csv +13 -0
- package/lib/bmad-extension/skills/bmad-ma-agent-ml/.gitkeep +0 -0
- package/lib/bmad-extension/skills/bmad-ma-agent-ml/SKILL.md +59 -0
- package/lib/bmad-extension/skills/bmad-ma-agent-ml/bmad-skill-manifest.yaml +11 -0
- package/lib/bmad-extension/skills/generate-backlog/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-advise/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-advise/SKILL.md +76 -0
- package/lib/bmad-extension/skills/ml-advise/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-advise/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-analysis/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-analysis/SKILL.md +60 -0
- package/lib/bmad-extension/skills/ml-analysis/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-analysis/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-architecture/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-architecture/SKILL.md +55 -0
- package/lib/bmad-extension/skills/ml-architecture/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-architecture/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-detailed-design/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-detailed-design/SKILL.md +67 -0
- package/lib/bmad-extension/skills/ml-detailed-design/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-detailed-design/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-eda/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-eda/SKILL.md +56 -0
- package/lib/bmad-extension/skills/ml-eda/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-eda/scripts/baseline_classifier.py +522 -0
- package/lib/bmad-extension/skills/ml-eda/scripts/class_weights_calculator.py +295 -0
- package/lib/bmad-extension/skills/ml-eda/scripts/clustering_explorer.py +383 -0
- package/lib/bmad-extension/skills/ml-eda/scripts/eda_analyzer.py +654 -0
- package/lib/bmad-extension/skills/ml-eda/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-experiment/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-experiment/SKILL.md +74 -0
- package/lib/bmad-extension/skills/ml-experiment/assets/advanced_trainer_configs.py +430 -0
- package/lib/bmad-extension/skills/ml-experiment/assets/quick_trainer_setup.py +233 -0
- package/lib/bmad-extension/skills/ml-experiment/assets/template_datamodule.py +219 -0
- package/lib/bmad-extension/skills/ml-experiment/assets/template_gnn_module.py +341 -0
- package/lib/bmad-extension/skills/ml-experiment/assets/template_lightning_module.py +158 -0
- package/lib/bmad-extension/skills/ml-experiment/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-experiment/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-hparam/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-hparam/SKILL.md +81 -0
- package/lib/bmad-extension/skills/ml-hparam/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-hparam/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-ideation/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-ideation/SKILL.md +50 -0
- package/lib/bmad-extension/skills/ml-ideation/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-ideation/scripts/validate_ml_prd.py +287 -0
- package/lib/bmad-extension/skills/ml-ideation/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-infra/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-infra/SKILL.md +58 -0
- package/lib/bmad-extension/skills/ml-infra/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-infra/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-retrospective/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-retrospective/SKILL.md +63 -0
- package/lib/bmad-extension/skills/ml-retrospective/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-retrospective/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-revision/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-revision/SKILL.md +82 -0
- package/lib/bmad-extension/skills/ml-revision/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-revision/skill.json +7 -0
- package/lib/bmad-extension/skills/ml-techspec/.gitkeep +0 -0
- package/lib/bmad-extension/skills/ml-techspec/SKILL.md +80 -0
- package/lib/bmad-extension/skills/ml-techspec/bmad-skill-manifest.yaml +3 -0
- package/lib/bmad-extension/skills/ml-techspec/skill.json +7 -0
- package/lib/bmad.js +85 -8
- package/lib/skill-authoring.js +1 -1
- package/package.json +5 -4
- package/test/agent-injection-strategy.test.js +4 -4
- package/test/bmad-version-bump.test.js +34 -34
- package/test/build-bmad-args.test.js +13 -6
- package/test/convert-agents-to-skills.test.js +11 -1
- package/test/extension-module-restructure.test.js +31 -7
- package/test/migration-validation.test.js +14 -11
- package/test/roo-code-agent.test.js +166 -0
- package/test/roo-code-injection.test.js +172 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Git Workflow
|
|
3
|
+
description: MANDATORY worktree-based workflow for ALL file-changing activities. Enforces isolated feature branches, conventional commits, and PR-based merging.
|
|
4
|
+
---
|
|
5
|
+
# Mandatory Usage Policy (CRITICAL)
|
|
6
|
+
|
|
7
|
+
**This skill is MANDATORY for all activities that modify tracked files in this repository.**
|
|
8
|
+
|
|
9
|
+
1. **Before starting ANY work** that changes source code, config files, or documentation: You MUST run `./scripts/start-feature.sh` (or the equivalent `git worktree add`) to create an isolated feature branch and worktree.
|
|
10
|
+
2. **During development**: You MUST perform all file-writing activities inside the newly created worktree directory.
|
|
11
|
+
3. **After completing work**: You MUST run `./scripts/finish-feature.sh` (or the equivalent rebase/push/PR/cleanup sequence) to integrate your changes and clean up the worktree.
|
|
12
|
+
|
|
13
|
+
**Failure to follow this workflow is a violation of repository standards.**
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Git Workflow (Worktree-Based)
|
|
18
|
+
|
|
19
|
+
Multi-agent parallel development using git worktrees. Each agent gets an isolated working directory — no branch switching, no conflicts between agents.
|
|
20
|
+
|
|
21
|
+
## Bundled Tools
|
|
22
|
+
|
|
23
|
+
### Scripts (scripts/)
|
|
24
|
+
| Script | Purpose |
|
|
25
|
+
|--------|---------|
|
|
26
|
+
| `start-feature.sh <type> <desc>` | Create worktree + feature branch from dev |
|
|
27
|
+
| `finish-feature.sh [path]` | Rebase, push, create PR, remove worktree |
|
|
28
|
+
| `validate-workflow.sh [--list]` | Check workflow compliance / list worktrees |
|
|
29
|
+
| `install-hooks.sh` | Install git hooks to repo |
|
|
30
|
+
|
|
31
|
+
### Git Hooks (hooks/)
|
|
32
|
+
| Hook | Purpose |
|
|
33
|
+
|------|---------|
|
|
34
|
+
| `pre-commit` | Blocks commits on dev/main (shared across worktrees) |
|
|
35
|
+
| `commit-msg` | Validates conventional commit format |
|
|
36
|
+
| `prepare-commit-msg` | Adds commit message template |
|
|
37
|
+
|
|
38
|
+
**Install hooks:** Run `scripts/install-hooks.sh` in target repository.
|
|
39
|
+
|
|
40
|
+
### Requirements
|
|
41
|
+
- Git (2.15+ for worktree support)
|
|
42
|
+
- GitHub CLI (`gh`) - Required for automatic PR creation
|
|
43
|
+
```bash
|
|
44
|
+
# macOS
|
|
45
|
+
brew install gh
|
|
46
|
+
# Windows
|
|
47
|
+
winget install --id GitHub.cli
|
|
48
|
+
# Linux
|
|
49
|
+
apt install gh
|
|
50
|
+
|
|
51
|
+
# Authenticate
|
|
52
|
+
gh auth login
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Mandatory Pre-Change Check
|
|
58
|
+
|
|
59
|
+
Before making ANY change to repository files (that are not in .gitignore):
|
|
60
|
+
|
|
61
|
+
1. Check if files to be changed are tracked:
|
|
62
|
+
```bash
|
|
63
|
+
git check-ignore -v <file-path>
|
|
64
|
+
```
|
|
65
|
+
If file is ignored → proceed without this workflow
|
|
66
|
+
If file is tracked → continue with steps below
|
|
67
|
+
|
|
68
|
+
2. Verify `dev` branch exists:
|
|
69
|
+
```bash
|
|
70
|
+
git fetch origin
|
|
71
|
+
git branch -a | grep -E '(^|\/)dev$'
|
|
72
|
+
```
|
|
73
|
+
3. If `dev` does not exist → **STOP and ask user** to create it or specify base branch
|
|
74
|
+
|
|
75
|
+
## Multi-Agent Development Flow
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
Main repo (stays on dev) ─── always clean, never modified directly
|
|
79
|
+
│
|
|
80
|
+
├── .worktrees/auth-system/ ← Agent 1: feature/auth-system
|
|
81
|
+
│ └── (isolated copy of repo, own branch, own changes)
|
|
82
|
+
│
|
|
83
|
+
├── .worktrees/api-refactor/ ← Agent 2: bugfix/api-refactor
|
|
84
|
+
│ └── (isolated copy of repo, own branch, own changes)
|
|
85
|
+
│
|
|
86
|
+
└── .worktrees/update-docs/ ← Agent 3: chore/update-docs
|
|
87
|
+
└── (isolated copy of repo, own branch, own changes)
|
|
88
|
+
|
|
89
|
+
Each worktree:
|
|
90
|
+
1. Has its own directory and branch
|
|
91
|
+
2. Shares git history with the main repo
|
|
92
|
+
3. Can commit, push, and create PRs independently
|
|
93
|
+
4. Gets cleaned up automatically after finish-feature.sh
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Starting Work
|
|
97
|
+
|
|
98
|
+
**Using script (recommended):**
|
|
99
|
+
```bash
|
|
100
|
+
./scripts/start-feature.sh feature my-feature-name
|
|
101
|
+
# Output: .worktrees/my-feature-name/ created
|
|
102
|
+
cd .worktrees/my-feature-name/
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Manual:**
|
|
106
|
+
```bash
|
|
107
|
+
git worktree add .worktrees/<desc> -b feature/<desc> origin/dev
|
|
108
|
+
cd .worktrees/<desc>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Branch Naming
|
|
112
|
+
|
|
113
|
+
| Type | Use Case |
|
|
114
|
+
|------|----------|
|
|
115
|
+
| `feature/<desc>` | New functionality |
|
|
116
|
+
| `bugfix/<desc>` | Bug fixes |
|
|
117
|
+
| `hotfix/<desc>` | Urgent production fixes |
|
|
118
|
+
| `chore/<desc>` | Maintenance tasks |
|
|
119
|
+
|
|
120
|
+
### Completing Work
|
|
121
|
+
|
|
122
|
+
**Using script (recommended):**
|
|
123
|
+
```bash
|
|
124
|
+
# Run from inside the worktree
|
|
125
|
+
./scripts/finish-feature.sh
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This script will:
|
|
129
|
+
1. Validate you're on a feature branch
|
|
130
|
+
2. Validate commit messages (conventional commits)
|
|
131
|
+
3. Rebase on latest `dev` branch
|
|
132
|
+
4. Push the feature branch
|
|
133
|
+
5. **Automatically create a PR to `dev`** (requires `gh` CLI)
|
|
134
|
+
6. **Remove the worktree** (auto-cleanup)
|
|
135
|
+
|
|
136
|
+
**Note:** If `gh` CLI is not installed, the script will skip PR creation. The branch will still be pushed.
|
|
137
|
+
|
|
138
|
+
**Manual:**
|
|
139
|
+
```bash
|
|
140
|
+
# From inside the worktree
|
|
141
|
+
git fetch origin dev
|
|
142
|
+
git rebase origin/dev
|
|
143
|
+
git push -u origin <branch-name>
|
|
144
|
+
gh pr create --base dev --head <branch-name>
|
|
145
|
+
|
|
146
|
+
# Clean up from main repo
|
|
147
|
+
cd /path/to/main/repo
|
|
148
|
+
git worktree remove .worktrees/<desc>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Managing Worktrees
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# List all active worktrees
|
|
155
|
+
git worktree list
|
|
156
|
+
# or
|
|
157
|
+
./scripts/validate-workflow.sh --list
|
|
158
|
+
|
|
159
|
+
# Remove a specific worktree
|
|
160
|
+
git worktree remove .worktrees/<desc>
|
|
161
|
+
|
|
162
|
+
# Clean up stale references
|
|
163
|
+
git worktree prune
|
|
164
|
+
|
|
165
|
+
# Validate workflow compliance
|
|
166
|
+
./scripts/validate-workflow.sh
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Commit Format (Conventional Commits)
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
<type>(<scope>): <description>
|
|
173
|
+
|
|
174
|
+
[optional body]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Types:** `feat`, `fix`, `chore`, `docs`, `refactor`, `test`
|
|
178
|
+
|
|
179
|
+
**Examples:**
|
|
180
|
+
- `feat(auth): add OAuth2 flow support`
|
|
181
|
+
- `fix(api): handle null response from endpoint`
|
|
182
|
+
- `chore(deps): update Helm chart dependencies`
|
|
183
|
+
- `docs(readme): add deployment instructions`
|
|
184
|
+
|
|
185
|
+
## Critical Rules
|
|
186
|
+
|
|
187
|
+
- **NEVER** modify tracked files without being in a worktree on a feature branch.
|
|
188
|
+
- **NEVER** commit directly to `dev` or `main`.
|
|
189
|
+
- **ALWAYS** check if a file is gitignored before applying this workflow.
|
|
190
|
+
- **ALWAYS** create a worktree **BEFORE** calling any file-writing tools (write_to_file, replace_file_content, etc.).
|
|
191
|
+
- **ALWAYS** rebase on `dev` before pushing.
|
|
192
|
+
- **ALWAYS** use conventional commit format.
|
|
193
|
+
- **ALWAYS** add `.worktrees/` to your `.gitignore`.
|
|
194
|
+
- **ALWAYS** finish the workflow by creating a PR and removing the worktree once work is verified.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# commit-msg hook - Validate conventional commit format
|
|
3
|
+
# Install: cp this file to .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg
|
|
4
|
+
|
|
5
|
+
RED='\033[0;31m'
|
|
6
|
+
GREEN='\033[0;32m'
|
|
7
|
+
YELLOW='\033[1;33m'
|
|
8
|
+
NC='\033[0m'
|
|
9
|
+
|
|
10
|
+
COMMIT_MSG_FILE="$1"
|
|
11
|
+
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
|
|
12
|
+
|
|
13
|
+
# Skip merge commits
|
|
14
|
+
if echo "$COMMIT_MSG" | grep -qE '^Merge '; then
|
|
15
|
+
exit 0
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Skip fixup/squash commits
|
|
19
|
+
if echo "$COMMIT_MSG" | grep -qE '^(fixup|squash)! '; then
|
|
20
|
+
exit 0
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# Conventional commit regex
|
|
24
|
+
# Format: type(scope): description
|
|
25
|
+
# Types: feat, fix, chore, docs, refactor, test
|
|
26
|
+
PATTERN='^(feat|fix|chore|docs|refactor|test)(\([a-zA-Z0-9_-]+\))?: .{1,}'
|
|
27
|
+
|
|
28
|
+
if ! echo "$COMMIT_MSG" | head -1 | grep -qE "$PATTERN"; then
|
|
29
|
+
echo -e "${RED}=================================================${NC}"
|
|
30
|
+
echo -e "${RED}ERROR: Commit message doesn't follow conventional format${NC}"
|
|
31
|
+
echo -e "${RED}=================================================${NC}"
|
|
32
|
+
echo ""
|
|
33
|
+
echo "Your message: $(head -1 "$COMMIT_MSG_FILE")"
|
|
34
|
+
echo ""
|
|
35
|
+
echo "Expected format:"
|
|
36
|
+
echo " <type>(<scope>): <description>"
|
|
37
|
+
echo ""
|
|
38
|
+
echo "Types:"
|
|
39
|
+
echo " feat - New feature"
|
|
40
|
+
echo " fix - Bug fix"
|
|
41
|
+
echo " chore - Maintenance task"
|
|
42
|
+
echo " docs - Documentation"
|
|
43
|
+
echo " refactor - Code refactoring"
|
|
44
|
+
echo " test - Tests"
|
|
45
|
+
echo ""
|
|
46
|
+
echo "Examples:"
|
|
47
|
+
echo " feat(auth): add OAuth2 flow support"
|
|
48
|
+
echo " fix(api): handle null response from endpoint"
|
|
49
|
+
echo " chore(deps): update Helm dependencies"
|
|
50
|
+
echo " docs: update README with deployment steps"
|
|
51
|
+
echo ""
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Check description length (warn if too long)
|
|
56
|
+
FIRST_LINE=$(head -1 "$COMMIT_MSG_FILE")
|
|
57
|
+
if [[ ${#FIRST_LINE} -gt 72 ]]; then
|
|
58
|
+
echo -e "${YELLOW}WARNING: First line is ${#FIRST_LINE} characters (recommended: 72 max)${NC}"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
exit 0
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# pre-commit hook - Block commits on protected branches
|
|
3
|
+
# Works in both main repo and worktrees.
|
|
4
|
+
# Install: ./scripts/install-hooks.sh
|
|
5
|
+
|
|
6
|
+
RED='\033[0;31m'
|
|
7
|
+
YELLOW='\033[1;33m'
|
|
8
|
+
NC='\033[0m'
|
|
9
|
+
|
|
10
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
11
|
+
|
|
12
|
+
# Block commits on protected branches
|
|
13
|
+
PROTECTED_BRANCHES="dev main master"
|
|
14
|
+
|
|
15
|
+
for branch in $PROTECTED_BRANCHES; do
|
|
16
|
+
if [[ "$CURRENT_BRANCH" == "$branch" ]]; then
|
|
17
|
+
echo -e "${RED}=================================================${NC}"
|
|
18
|
+
echo -e "${RED}ERROR: Direct commits to '$branch' are not allowed${NC}"
|
|
19
|
+
echo -e "${RED}=================================================${NC}"
|
|
20
|
+
echo ""
|
|
21
|
+
echo "Create an isolated worktree for your changes:"
|
|
22
|
+
echo " ./scripts/start-feature.sh feature <description>"
|
|
23
|
+
echo ""
|
|
24
|
+
echo "Or manually:"
|
|
25
|
+
echo " git worktree add .worktrees/<desc> -b feature/<desc> origin/dev"
|
|
26
|
+
echo ""
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
done
|
|
30
|
+
|
|
31
|
+
# Warn if branch doesn't follow naming convention
|
|
32
|
+
if ! echo "$CURRENT_BRANCH" | grep -qE '^(feature|bugfix|hotfix|chore)/'; then
|
|
33
|
+
echo -e "${YELLOW}WARNING: Branch '$CURRENT_BRANCH' doesn't follow naming convention${NC}"
|
|
34
|
+
echo -e "${YELLOW}Expected: feature|bugfix|hotfix|chore/<description>${NC}"
|
|
35
|
+
echo ""
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
exit 0
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# prepare-commit-msg hook - Add template for conventional commits
|
|
3
|
+
# Install: cp this file to .git/hooks/prepare-commit-msg && chmod +x .git/hooks/prepare-commit-msg
|
|
4
|
+
|
|
5
|
+
COMMIT_MSG_FILE="$1"
|
|
6
|
+
COMMIT_SOURCE="$2"
|
|
7
|
+
|
|
8
|
+
# Only add template for new commits (not amend, merge, etc.)
|
|
9
|
+
if [[ -z "$COMMIT_SOURCE" ]]; then
|
|
10
|
+
# Get current branch to suggest type
|
|
11
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
12
|
+
|
|
13
|
+
# Extract type from branch name if possible
|
|
14
|
+
SUGGESTED_TYPE=""
|
|
15
|
+
if echo "$CURRENT_BRANCH" | grep -qE '^feature/'; then
|
|
16
|
+
SUGGESTED_TYPE="feat"
|
|
17
|
+
elif echo "$CURRENT_BRANCH" | grep -qE '^bugfix/'; then
|
|
18
|
+
SUGGESTED_TYPE="fix"
|
|
19
|
+
elif echo "$CURRENT_BRANCH" | grep -qE '^hotfix/'; then
|
|
20
|
+
SUGGESTED_TYPE="fix"
|
|
21
|
+
elif echo "$CURRENT_BRANCH" | grep -qE '^chore/'; then
|
|
22
|
+
SUGGESTED_TYPE="chore"
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# Only add template if commit message is empty or just comments
|
|
26
|
+
if ! grep -qv '^#' "$COMMIT_MSG_FILE" 2>/dev/null || [[ ! -s "$COMMIT_MSG_FILE" ]]; then
|
|
27
|
+
{
|
|
28
|
+
if [[ -n "$SUGGESTED_TYPE" ]]; then
|
|
29
|
+
echo "${SUGGESTED_TYPE}(scope): "
|
|
30
|
+
else
|
|
31
|
+
echo "type(scope): "
|
|
32
|
+
fi
|
|
33
|
+
echo ""
|
|
34
|
+
echo "# Conventional Commit Format"
|
|
35
|
+
echo "# --------------------------"
|
|
36
|
+
echo "# <type>(<scope>): <description>"
|
|
37
|
+
echo "#"
|
|
38
|
+
echo "# Types:"
|
|
39
|
+
echo "# feat - New feature"
|
|
40
|
+
echo "# fix - Bug fix"
|
|
41
|
+
echo "# chore - Maintenance"
|
|
42
|
+
echo "# docs - Documentation"
|
|
43
|
+
echo "# refactor - Code refactoring"
|
|
44
|
+
echo "# test - Tests"
|
|
45
|
+
echo "#"
|
|
46
|
+
echo "# Scope: Component or area (optional)"
|
|
47
|
+
echo "# Description: Short summary in present tense"
|
|
48
|
+
echo "#"
|
|
49
|
+
echo "# Examples:"
|
|
50
|
+
echo "# feat(auth): add OAuth2 support"
|
|
51
|
+
echo "# fix(api): handle null response"
|
|
52
|
+
} > "$COMMIT_MSG_FILE"
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
exit 0
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# finish-feature.sh - Rebase, validate, push, create PR, and clean up worktree
|
|
3
|
+
# Usage: finish-feature.sh [worktree-path]
|
|
4
|
+
#
|
|
5
|
+
# Run from inside a worktree, or pass the worktree path as an argument.
|
|
6
|
+
# After creating the PR, the worktree is removed automatically.
|
|
7
|
+
|
|
8
|
+
set -e
|
|
9
|
+
|
|
10
|
+
RED='\033[0;31m'
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
YELLOW='\033[1;33m'
|
|
13
|
+
CYAN='\033[0;36m'
|
|
14
|
+
NC='\033[0m'
|
|
15
|
+
|
|
16
|
+
error() { echo -e "${RED}ERROR: $1${NC}" >&2; exit 1; }
|
|
17
|
+
warn() { echo -e "${YELLOW}WARNING: $1${NC}" >&2; }
|
|
18
|
+
success() { echo -e "${GREEN}$1${NC}"; }
|
|
19
|
+
info() { echo -e "${CYAN}$1${NC}"; }
|
|
20
|
+
|
|
21
|
+
# Determine working directory
|
|
22
|
+
WORK_DIR="${1:-$(pwd)}"
|
|
23
|
+
cd "$WORK_DIR"
|
|
24
|
+
|
|
25
|
+
# Check we're in a git repo
|
|
26
|
+
git rev-parse --git-dir > /dev/null 2>&1 || error "Not in a git repository"
|
|
27
|
+
|
|
28
|
+
# Detect if we're in a worktree
|
|
29
|
+
GIT_COMMON=$(git rev-parse --git-common-dir 2>/dev/null)
|
|
30
|
+
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
|
|
31
|
+
WORKTREE_PATH=$(git rev-parse --show-toplevel)
|
|
32
|
+
|
|
33
|
+
IS_WORKTREE=false
|
|
34
|
+
if [[ "$GIT_COMMON" != "$GIT_DIR" && "$GIT_COMMON" != "." ]]; then
|
|
35
|
+
IS_WORKTREE=true
|
|
36
|
+
MAIN_REPO=$(cd "$GIT_COMMON/.." && pwd)
|
|
37
|
+
info "Working in worktree: ${WORKTREE_PATH}"
|
|
38
|
+
else
|
|
39
|
+
MAIN_REPO="$WORKTREE_PATH"
|
|
40
|
+
info "Working in main repository (not a worktree)"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Get current branch
|
|
44
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
45
|
+
|
|
46
|
+
# Validate we're on a feature branch
|
|
47
|
+
if [[ "$CURRENT_BRANCH" == "dev" || "$CURRENT_BRANCH" == "main" || "$CURRENT_BRANCH" == "master" ]]; then
|
|
48
|
+
error "You are on '$CURRENT_BRANCH'. Switch to a feature branch first."
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
if ! echo "$CURRENT_BRANCH" | grep -qE '^(feature|bugfix|hotfix|chore)/'; then
|
|
52
|
+
warn "Branch '$CURRENT_BRANCH' doesn't follow naming convention (feature|bugfix|hotfix|chore)/<description>"
|
|
53
|
+
read -p "Continue anyway? (y/N) " -n 1 -r
|
|
54
|
+
echo
|
|
55
|
+
[[ $REPLY =~ ^[Yy]$ ]] || exit 1
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# Check for uncommitted changes
|
|
59
|
+
if ! git diff-index --quiet HEAD -- 2>/dev/null; then
|
|
60
|
+
error "You have uncommitted changes. Please commit them first."
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Check there are commits to push
|
|
64
|
+
COMMITS_AHEAD=$(git rev-list --count origin/dev..HEAD 2>/dev/null || echo "0")
|
|
65
|
+
if [[ "$COMMITS_AHEAD" == "0" ]]; then
|
|
66
|
+
error "No commits to push. Make some changes first."
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
echo "Found $COMMITS_AHEAD commit(s) to push"
|
|
70
|
+
|
|
71
|
+
# Validate commit messages
|
|
72
|
+
echo ""
|
|
73
|
+
echo "Validating commit messages..."
|
|
74
|
+
INVALID_COMMITS=0
|
|
75
|
+
while IFS= read -r commit_msg; do
|
|
76
|
+
if ! echo "$commit_msg" | grep -qE '^(feat|fix|chore|docs|refactor|test)(\([^)]+\))?: .+'; then
|
|
77
|
+
echo -e "${RED} x Invalid: $commit_msg${NC}"
|
|
78
|
+
INVALID_COMMITS=$((INVALID_COMMITS + 1))
|
|
79
|
+
else
|
|
80
|
+
echo -e "${GREEN} + Valid: $commit_msg${NC}"
|
|
81
|
+
fi
|
|
82
|
+
done < <(git log origin/dev..HEAD --pretty=format:"%s")
|
|
83
|
+
|
|
84
|
+
if [[ $INVALID_COMMITS -gt 0 ]]; then
|
|
85
|
+
warn "$INVALID_COMMITS commit(s) don't follow conventional commit format"
|
|
86
|
+
read -p "Continue anyway? (y/N) " -n 1 -r
|
|
87
|
+
echo
|
|
88
|
+
[[ $REPLY =~ ^[Yy]$ ]] || exit 1
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Fetch and rebase on dev
|
|
92
|
+
echo ""
|
|
93
|
+
echo "Fetching latest from origin..."
|
|
94
|
+
git fetch origin dev
|
|
95
|
+
|
|
96
|
+
echo "Rebasing on dev..."
|
|
97
|
+
if ! git rebase origin/dev; then
|
|
98
|
+
error "Rebase failed. Resolve conflicts, then run 'git rebase --continue' and try again."
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
success "Rebased successfully on dev"
|
|
102
|
+
|
|
103
|
+
# Push to remote
|
|
104
|
+
echo ""
|
|
105
|
+
echo "Pushing branch to origin..."
|
|
106
|
+
git push -u origin "$CURRENT_BRANCH" --force-with-lease
|
|
107
|
+
|
|
108
|
+
success "Branch '${CURRENT_BRANCH}' pushed to origin"
|
|
109
|
+
|
|
110
|
+
# Create Pull Request using gh CLI
|
|
111
|
+
echo ""
|
|
112
|
+
echo "Creating Pull Request..."
|
|
113
|
+
|
|
114
|
+
PR_CREATED=false
|
|
115
|
+
|
|
116
|
+
if ! command -v gh &> /dev/null; then
|
|
117
|
+
warn "GitHub CLI (gh) not installed. Skipping PR creation."
|
|
118
|
+
echo "Install gh: https://cli.github.com/"
|
|
119
|
+
elif ! gh auth status &> /dev/null; then
|
|
120
|
+
warn "GitHub CLI not authenticated. Run: gh auth login"
|
|
121
|
+
else
|
|
122
|
+
# Generate PR title from branch name
|
|
123
|
+
PR_TITLE=$(echo "$CURRENT_BRANCH" | sed 's/^[^/]*\///' | sed 's/-/ /g' | sed 's/\b\(.\)/\u\1/g')
|
|
124
|
+
|
|
125
|
+
# Get commit messages for PR body
|
|
126
|
+
FIRST_COMMIT=$(git log origin/dev..HEAD --reverse --pretty=format:"%s" | head -1)
|
|
127
|
+
|
|
128
|
+
if gh pr create --base dev --head "$CURRENT_BRANCH" --title "$PR_TITLE" --body "## Changes
|
|
129
|
+
|
|
130
|
+
$FIRST_COMMIT
|
|
131
|
+
|
|
132
|
+
## Commits
|
|
133
|
+
$(git log origin/dev..HEAD --pretty=format:"- %s")
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
Generated with [AI Agent Skills](https://github.com/mayafit/AI_Agents)"; then
|
|
137
|
+
success "Pull Request created successfully"
|
|
138
|
+
PR_URL=$(gh pr view "$CURRENT_BRANCH" --json url -q .url 2>/dev/null || echo "")
|
|
139
|
+
if [[ -n "$PR_URL" ]]; then
|
|
140
|
+
echo ""
|
|
141
|
+
info "PR URL: ${PR_URL}"
|
|
142
|
+
fi
|
|
143
|
+
PR_CREATED=true
|
|
144
|
+
else
|
|
145
|
+
warn "Failed to create PR. You may need to create it manually."
|
|
146
|
+
fi
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
# Clean up worktree
|
|
150
|
+
if [[ "$IS_WORKTREE" == true ]]; then
|
|
151
|
+
echo ""
|
|
152
|
+
echo "Cleaning up worktree..."
|
|
153
|
+
|
|
154
|
+
# Move back to main repo before removing the worktree
|
|
155
|
+
cd "$MAIN_REPO"
|
|
156
|
+
|
|
157
|
+
# Remove the worktree
|
|
158
|
+
if git worktree remove "$WORKTREE_PATH" 2>/dev/null; then
|
|
159
|
+
success "Worktree removed: ${WORKTREE_PATH}"
|
|
160
|
+
else
|
|
161
|
+
warn "Could not auto-remove worktree. Remove manually:"
|
|
162
|
+
echo " cd ${MAIN_REPO}"
|
|
163
|
+
echo " git worktree remove ${WORKTREE_PATH}"
|
|
164
|
+
fi
|
|
165
|
+
else
|
|
166
|
+
# Not a worktree — switch back to dev (legacy behavior)
|
|
167
|
+
echo ""
|
|
168
|
+
echo "Switching back to dev branch..."
|
|
169
|
+
git checkout dev
|
|
170
|
+
git pull origin dev
|
|
171
|
+
success "Switched back to dev branch"
|
|
172
|
+
fi
|
|
173
|
+
|
|
174
|
+
# Prune stale worktree references
|
|
175
|
+
git worktree prune 2>/dev/null || true
|
|
176
|
+
|
|
177
|
+
echo ""
|
|
178
|
+
success "Done!"
|
|
179
|
+
echo ""
|
|
180
|
+
echo "Next steps:"
|
|
181
|
+
if [[ "$PR_CREATED" == true ]]; then
|
|
182
|
+
echo " 1. Request code review on the PR"
|
|
183
|
+
echo " 2. Merge after approval"
|
|
184
|
+
else
|
|
185
|
+
echo " 1. Create a Pull Request to merge '${CURRENT_BRANCH}' into 'dev'"
|
|
186
|
+
echo " 2. Request code review"
|
|
187
|
+
echo " 3. Merge after approval"
|
|
188
|
+
fi
|
|
189
|
+
echo " Start new work: ./scripts/start-feature.sh <type> <description>"
|
|
190
|
+
echo ""
|
|
191
|
+
echo "Active worktrees:"
|
|
192
|
+
git worktree list
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# install-hooks.sh - Install git hooks for workflow enforcement
|
|
3
|
+
# Usage: install-hooks.sh [hooks-source-dir]
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
RED='\033[0;31m'
|
|
8
|
+
GREEN='\033[0;32m'
|
|
9
|
+
YELLOW='\033[1;33m'
|
|
10
|
+
NC='\033[0m'
|
|
11
|
+
|
|
12
|
+
error() { echo -e "${RED}ERROR: $1${NC}" >&2; exit 1; }
|
|
13
|
+
success() { echo -e "${GREEN}✓ $1${NC}"; }
|
|
14
|
+
warn() { echo -e "${YELLOW}WARNING: $1${NC}"; }
|
|
15
|
+
|
|
16
|
+
# Check we're in a git repo
|
|
17
|
+
git rev-parse --git-dir > /dev/null 2>&1 || error "Not in a git repository"
|
|
18
|
+
|
|
19
|
+
# Find hooks source directory
|
|
20
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
21
|
+
HOOKS_SOURCE="${1:-$SCRIPT_DIR/../hooks}"
|
|
22
|
+
|
|
23
|
+
if [[ ! -d "$HOOKS_SOURCE" ]]; then
|
|
24
|
+
error "Hooks source directory not found: $HOOKS_SOURCE"
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Get git hooks directory
|
|
28
|
+
GIT_DIR=$(git rev-parse --git-dir)
|
|
29
|
+
HOOKS_DEST="$GIT_DIR/hooks"
|
|
30
|
+
|
|
31
|
+
echo "Installing git hooks..."
|
|
32
|
+
echo "Source: $HOOKS_SOURCE"
|
|
33
|
+
echo "Destination: $HOOKS_DEST"
|
|
34
|
+
echo ""
|
|
35
|
+
|
|
36
|
+
# Install each hook
|
|
37
|
+
for hook in pre-commit commit-msg prepare-commit-msg; do
|
|
38
|
+
if [[ -f "$HOOKS_SOURCE/$hook" ]]; then
|
|
39
|
+
if [[ -f "$HOOKS_DEST/$hook" ]]; then
|
|
40
|
+
warn "Hook '$hook' already exists, backing up to ${hook}.backup"
|
|
41
|
+
cp "$HOOKS_DEST/$hook" "$HOOKS_DEST/${hook}.backup"
|
|
42
|
+
fi
|
|
43
|
+
cp "$HOOKS_SOURCE/$hook" "$HOOKS_DEST/$hook"
|
|
44
|
+
chmod +x "$HOOKS_DEST/$hook"
|
|
45
|
+
success "Installed: $hook"
|
|
46
|
+
fi
|
|
47
|
+
done
|
|
48
|
+
|
|
49
|
+
echo ""
|
|
50
|
+
success "Git hooks installed successfully"
|
|
51
|
+
echo ""
|
|
52
|
+
echo "Installed hooks:"
|
|
53
|
+
echo " - pre-commit: Blocks commits on dev/main branches"
|
|
54
|
+
echo " - commit-msg: Validates conventional commit format"
|
|
55
|
+
echo " - prepare-commit-msg: Adds commit template"
|