@phuc1403/musketeer 0.7.0 → 0.9.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/README.md +49 -49
- package/manifest.json +333 -301
- package/package.json +1 -1
- package/template/.claude/agents/code-reviewer.md +182 -166
- package/template/.claude/hooks/git-skill-reminder.cjs +53 -0
- package/template/.claude/hooks/inject-design-docs.cjs +13 -13
- package/template/.claude/hooks/inject-ubiquitous-language.cjs +52 -0
- package/template/.claude/hooks/lib/colors.cjs +180 -122
- package/template/.claude/hooks/lib/transcript-parser.cjs +300 -277
- package/template/.claude/skills/code-review/SKILL.md +201 -54
- package/template/.claude/skills/code-review/references/checklist-workflow.md +96 -0
- package/template/.claude/skills/code-review/references/checklists/api.md +52 -52
- package/template/.claude/skills/code-review/references/checklists/base.md +100 -100
- package/template/.claude/skills/code-review/references/checklists/web-app.md +54 -54
- package/template/.claude/skills/code-review/references/code-review-reception.md +113 -0
- package/template/.claude/skills/code-review/references/codebase-scan-workflow.md +30 -0
- package/template/.claude/skills/code-review/references/edge-case-scouting.md +119 -0
- package/template/.claude/skills/code-review/references/input-mode-resolution.md +135 -0
- package/template/.claude/skills/code-review/references/parallel-review-workflow.md +76 -0
- package/template/.claude/skills/code-review/references/requesting-code-review.md +116 -0
- package/template/.claude/skills/code-review/references/spec-compliance-review.md +43 -0
- package/template/.claude/skills/code-review/references/task-management-reviews.md +140 -0
- package/template/.claude/skills/code-review/references/verification-before-completion.md +139 -0
- package/template/.claude/skills/context-map/SKILL.md +1 -1
- package/template/.claude/skills/git/SKILL.md +131 -115
- package/template/.claude/skills/git/references/branch-management.md +88 -88
- package/template/.claude/skills/git/references/commit-standards.md +46 -46
- package/template/.claude/skills/git/references/context-efficiency.md +54 -0
- package/template/.claude/skills/git/references/gh-cli-guide.md +109 -109
- package/template/.claude/skills/git/references/safety-protocols.md +69 -69
- package/template/.claude/skills/git/references/workflow-commit.md +58 -58
- package/template/.claude/skills/git/references/workflow-merge-pr.md +136 -0
- package/template/.claude/skills/git/references/workflow-merge.md +48 -48
- package/template/.claude/skills/git/references/workflow-pr.md +58 -58
- package/template/.claude/skills/git/references/workflow-push.md +52 -52
- package/template/.claude/skills/knowledge-crunching/SKILL.md +56 -92
- package/template/.claude/skills/knowledge-crunching/assets/ubiquitous-language.template.md +3 -0
- package/template/.claude/skills/skill-creator/LICENSE.txt +201 -201
- package/template/.claude/skills/skill-creator/SKILL.md +154 -149
- package/template/.claude/skills/skill-creator/agents/analyzer.md +274 -274
- package/template/.claude/skills/skill-creator/agents/comparator.md +202 -202
- package/template/.claude/skills/skill-creator/agents/grader.md +223 -223
- package/template/.claude/skills/skill-creator/assets/eval_review.html +146 -146
- package/template/.claude/skills/skill-creator/eval-viewer/generate_review.py +471 -471
- package/template/.claude/skills/skill-creator/eval-viewer/viewer.html +1325 -1325
- package/template/.claude/skills/skill-creator/references/benchmark-optimization-guide.md +86 -86
- package/template/.claude/skills/skill-creator/references/distribution-guide.md +79 -79
- package/template/.claude/skills/skill-creator/references/eval-infrastructure-guide.md +129 -129
- package/template/.claude/skills/skill-creator/references/eval-schemas.md +121 -121
- package/template/.claude/skills/skill-creator/references/mcp-skills-integration.md +71 -71
- package/template/.claude/skills/skill-creator/references/metadata-quality-criteria.md +94 -94
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-hosting.md +104 -104
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-overview.md +89 -89
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-schema.md +93 -93
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-sources.md +103 -103
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +76 -76
- package/template/.claude/skills/skill-creator/references/script-quality-criteria.md +106 -106
- package/template/.claude/skills/skill-creator/references/skill-anatomy-and-requirements.md +77 -77
- package/template/.claude/skills/skill-creator/references/skill-creation-workflow.md +152 -151
- package/template/.claude/skills/skill-creator/references/skill-design-patterns.md +75 -75
- package/template/.claude/skills/skill-creator/references/skillmark-benchmark-criteria.md +102 -102
- package/template/.claude/skills/skill-creator/references/structure-organization-criteria.md +114 -114
- package/template/.claude/skills/skill-creator/references/testing-and-iteration.md +78 -78
- package/template/.claude/skills/skill-creator/references/token-efficiency-criteria.md +74 -74
- package/template/.claude/skills/skill-creator/references/troubleshooting-guide.md +81 -81
- package/template/.claude/skills/skill-creator/references/validation-checklist.md +83 -83
- package/template/.claude/skills/skill-creator/references/writing-effective-instructions.md +88 -88
- package/template/.claude/skills/skill-creator/references/yaml-frontmatter-reference.md +92 -92
- package/template/.claude/skills/skill-creator/scripts/aggregate_benchmark.py +401 -401
- package/template/.claude/skills/skill-creator/scripts/encoding_utils.py +36 -36
- package/template/.claude/skills/skill-creator/scripts/generate_report.py +326 -326
- package/template/.claude/skills/skill-creator/scripts/improve_description.py +248 -248
- package/template/.claude/skills/skill-creator/scripts/init_skill.py +360 -360
- package/template/.claude/skills/skill-creator/scripts/package_skill.py +143 -143
- package/template/.claude/skills/skill-creator/scripts/quick_validate.py +110 -110
- package/template/.claude/skills/skill-creator/scripts/run_eval.py +310 -310
- package/template/.claude/skills/skill-creator/scripts/run_loop.py +332 -332
- package/template/.claude/skills/skill-creator/scripts/utils.py +47 -47
- package/template/.claude/statusline.cjs +0 -0
- package/template/.claude/hooks/inject-context.cjs +0 -52
- package/template/.claude/skills/code-review/references/adversarial-review.md +0 -223
- package/template/.claude/skills/knowledge-crunching/assets/context.template.md +0 -59
- package/template/.claude/skills/knowledge-crunching/references/crunching-dialogue.md +0 -113
- /package/template/.claude/hooks/{usage-context-awareness.cjs → usage-quota-cache-refresh.cjs} +0 -0
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
# Branch Management
|
|
2
|
-
|
|
3
|
-
## Naming Convention
|
|
4
|
-
|
|
5
|
-
**Format:** `<type>/<descriptive-name>`
|
|
6
|
-
|
|
7
|
-
| Type | Purpose | Example |
|
|
8
|
-
|------|---------|---------|
|
|
9
|
-
| `feature/` | New features | `feature/oauth-login` |
|
|
10
|
-
| `fix/` | Bug fixes | `fix/db-timeout` |
|
|
11
|
-
| `refactor/` | Code restructure | `refactor/api-cleanup` |
|
|
12
|
-
| `docs/` | Documentation | `docs/api-reference` |
|
|
13
|
-
| `test/` | Test improvements | `test/integration-suite` |
|
|
14
|
-
| `chore/` | Maintenance | `chore/deps-update` |
|
|
15
|
-
| `hotfix/` | Production fixes | `hotfix/payment-crash` |
|
|
16
|
-
|
|
17
|
-
## Branch Lifecycle
|
|
18
|
-
|
|
19
|
-
### Create
|
|
20
|
-
```bash
|
|
21
|
-
git checkout main
|
|
22
|
-
git pull origin main
|
|
23
|
-
git checkout -b feature/new-feature
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### During Development
|
|
27
|
-
```bash
|
|
28
|
-
# Regular commits
|
|
29
|
-
git add <files> && git commit -m "feat(scope): description"
|
|
30
|
-
|
|
31
|
-
# Stay current with main
|
|
32
|
-
git fetch origin
|
|
33
|
-
git rebase origin/main
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Before Merge
|
|
37
|
-
```bash
|
|
38
|
-
# Push final state
|
|
39
|
-
git push origin feature/new-feature
|
|
40
|
-
|
|
41
|
-
# Or after rebase (feature branches only)
|
|
42
|
-
git push -f origin feature/new-feature
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### After Merge
|
|
46
|
-
```bash
|
|
47
|
-
# Delete local
|
|
48
|
-
git branch -d feature/new-feature
|
|
49
|
-
|
|
50
|
-
# Delete remote
|
|
51
|
-
git push origin --delete feature/new-feature
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Branch Strategies
|
|
55
|
-
|
|
56
|
-
### Simple (small teams)
|
|
57
|
-
```
|
|
58
|
-
main (production)
|
|
59
|
-
└─ feature/* (development)
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Git Flow (releases)
|
|
63
|
-
```
|
|
64
|
-
main (production)
|
|
65
|
-
develop (staging)
|
|
66
|
-
├─ feature/*
|
|
67
|
-
├─ bugfix/*
|
|
68
|
-
├─ hotfix/*
|
|
69
|
-
└─ release/*
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Trunk-Based (CI/CD)
|
|
73
|
-
```
|
|
74
|
-
main (always deployable)
|
|
75
|
-
└─ short-lived feature branches
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Quick Commands
|
|
79
|
-
|
|
80
|
-
| Task | Command |
|
|
81
|
-
|------|---------|
|
|
82
|
-
| List branches | `git branch -a` |
|
|
83
|
-
| Current branch | `git rev-parse --abbrev-ref HEAD` |
|
|
84
|
-
| Switch branch | `git checkout <branch>` |
|
|
85
|
-
| Create + switch | `git checkout -b <branch>` |
|
|
86
|
-
| Delete local | `git branch -d <branch>` |
|
|
87
|
-
| Delete remote | `git push origin --delete <branch>` |
|
|
88
|
-
| Rename | `git branch -m <old> <new>` |
|
|
1
|
+
# Branch Management
|
|
2
|
+
|
|
3
|
+
## Naming Convention
|
|
4
|
+
|
|
5
|
+
**Format:** `<type>/<descriptive-name>`
|
|
6
|
+
|
|
7
|
+
| Type | Purpose | Example |
|
|
8
|
+
|------|---------|---------|
|
|
9
|
+
| `feature/` | New features | `feature/oauth-login` |
|
|
10
|
+
| `fix/` | Bug fixes | `fix/db-timeout` |
|
|
11
|
+
| `refactor/` | Code restructure | `refactor/api-cleanup` |
|
|
12
|
+
| `docs/` | Documentation | `docs/api-reference` |
|
|
13
|
+
| `test/` | Test improvements | `test/integration-suite` |
|
|
14
|
+
| `chore/` | Maintenance | `chore/deps-update` |
|
|
15
|
+
| `hotfix/` | Production fixes | `hotfix/payment-crash` |
|
|
16
|
+
|
|
17
|
+
## Branch Lifecycle
|
|
18
|
+
|
|
19
|
+
### Create
|
|
20
|
+
```bash
|
|
21
|
+
git checkout main
|
|
22
|
+
git pull origin main
|
|
23
|
+
git checkout -b feature/new-feature
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### During Development
|
|
27
|
+
```bash
|
|
28
|
+
# Regular commits
|
|
29
|
+
git add <files> && git commit -m "feat(scope): description"
|
|
30
|
+
|
|
31
|
+
# Stay current with main
|
|
32
|
+
git fetch origin
|
|
33
|
+
git rebase origin/main
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Before Merge
|
|
37
|
+
```bash
|
|
38
|
+
# Push final state
|
|
39
|
+
git push origin feature/new-feature
|
|
40
|
+
|
|
41
|
+
# Or after rebase (feature branches only)
|
|
42
|
+
git push -f origin feature/new-feature
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### After Merge
|
|
46
|
+
```bash
|
|
47
|
+
# Delete local
|
|
48
|
+
git branch -d feature/new-feature
|
|
49
|
+
|
|
50
|
+
# Delete remote
|
|
51
|
+
git push origin --delete feature/new-feature
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Branch Strategies
|
|
55
|
+
|
|
56
|
+
### Simple (small teams)
|
|
57
|
+
```
|
|
58
|
+
main (production)
|
|
59
|
+
└─ feature/* (development)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Git Flow (releases)
|
|
63
|
+
```
|
|
64
|
+
main (production)
|
|
65
|
+
develop (staging)
|
|
66
|
+
├─ feature/*
|
|
67
|
+
├─ bugfix/*
|
|
68
|
+
├─ hotfix/*
|
|
69
|
+
└─ release/*
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Trunk-Based (CI/CD)
|
|
73
|
+
```
|
|
74
|
+
main (always deployable)
|
|
75
|
+
└─ short-lived feature branches
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick Commands
|
|
79
|
+
|
|
80
|
+
| Task | Command |
|
|
81
|
+
|------|---------|
|
|
82
|
+
| List branches | `git branch -a` |
|
|
83
|
+
| Current branch | `git rev-parse --abbrev-ref HEAD` |
|
|
84
|
+
| Switch branch | `git checkout <branch>` |
|
|
85
|
+
| Create + switch | `git checkout -b <branch>` |
|
|
86
|
+
| Delete local | `git branch -d <branch>` |
|
|
87
|
+
| Delete remote | `git push origin --delete <branch>` |
|
|
88
|
+
| Rename | `git branch -m <old> <new>` |
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
# Commit Message Standards
|
|
2
|
-
|
|
3
|
-
## Format
|
|
4
|
-
```
|
|
5
|
-
type(scope): description
|
|
6
|
-
```
|
|
7
|
-
|
|
8
|
-
## Types (priority order)
|
|
9
|
-
- `feat`: New feature
|
|
10
|
-
- `fix`: Bug fix
|
|
11
|
-
- `docs`: Documentation only
|
|
12
|
-
- `style`: Formatting (no logic change)
|
|
13
|
-
- `refactor`: Restructure without behavior change
|
|
14
|
-
- `test`: Tests
|
|
15
|
-
- `chore`: Maintenance, deps, config
|
|
16
|
-
- `perf`: Performance
|
|
17
|
-
- `build`: Build system
|
|
18
|
-
- `ci`: CI/CD
|
|
19
|
-
|
|
20
|
-
## Rules
|
|
21
|
-
- **<72 characters**
|
|
22
|
-
- **Present tense, imperative** ("add" not "added")
|
|
23
|
-
- **No period at end**
|
|
24
|
-
- **Scope optional but recommended**
|
|
25
|
-
- **Focus on WHAT, not HOW**
|
|
26
|
-
- Only use `feat`, `fix`, or `perf` prefixes for files in `.claude` directory (do not use `docs`).
|
|
27
|
-
|
|
28
|
-
## NEVER Include AI Attribution
|
|
29
|
-
- ❌ "Generated with Claude"
|
|
30
|
-
- ❌ "Co-Authored-By: Claude"
|
|
31
|
-
- ❌ Any AI reference
|
|
32
|
-
|
|
33
|
-
## Good Examples
|
|
34
|
-
- `feat(auth): add login validation`
|
|
35
|
-
- `fix(api): resolve query timeout`
|
|
36
|
-
- `docs(readme): update install guide`
|
|
37
|
-
- `refactor(utils): simplify date logic`
|
|
38
|
-
|
|
39
|
-
## Bad Examples
|
|
40
|
-
- ❌ `Updated files` (not descriptive)
|
|
41
|
-
- ❌ `feat(auth): added login using bcrypt with salt` (too long, describes HOW)
|
|
42
|
-
- ❌ `Fix bug` (not specific)
|
|
43
|
-
|
|
44
|
-
## Special Cases
|
|
45
|
-
- `.claude/` skill updates: `perf(skill): improve token efficiency`
|
|
46
|
-
- `.claude/` new skills: `feat(skill): add database-optimizer`
|
|
1
|
+
# Commit Message Standards
|
|
2
|
+
|
|
3
|
+
## Format
|
|
4
|
+
```
|
|
5
|
+
type(scope): description
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Types (priority order)
|
|
9
|
+
- `feat`: New feature
|
|
10
|
+
- `fix`: Bug fix
|
|
11
|
+
- `docs`: Documentation only
|
|
12
|
+
- `style`: Formatting (no logic change)
|
|
13
|
+
- `refactor`: Restructure without behavior change
|
|
14
|
+
- `test`: Tests
|
|
15
|
+
- `chore`: Maintenance, deps, config
|
|
16
|
+
- `perf`: Performance
|
|
17
|
+
- `build`: Build system
|
|
18
|
+
- `ci`: CI/CD
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
- **<72 characters**
|
|
22
|
+
- **Present tense, imperative** ("add" not "added")
|
|
23
|
+
- **No period at end**
|
|
24
|
+
- **Scope optional but recommended**
|
|
25
|
+
- **Focus on WHAT, not HOW**
|
|
26
|
+
- Only use `feat`, `fix`, or `perf` prefixes for files in `.claude` directory (do not use `docs`).
|
|
27
|
+
|
|
28
|
+
## NEVER Include AI Attribution
|
|
29
|
+
- ❌ "Generated with Claude"
|
|
30
|
+
- ❌ "Co-Authored-By: Claude"
|
|
31
|
+
- ❌ Any AI reference
|
|
32
|
+
|
|
33
|
+
## Good Examples
|
|
34
|
+
- `feat(auth): add login validation`
|
|
35
|
+
- `fix(api): resolve query timeout`
|
|
36
|
+
- `docs(readme): update install guide`
|
|
37
|
+
- `refactor(utils): simplify date logic`
|
|
38
|
+
|
|
39
|
+
## Bad Examples
|
|
40
|
+
- ❌ `Updated files` (not descriptive)
|
|
41
|
+
- ❌ `feat(auth): added login using bcrypt with salt` (too long, describes HOW)
|
|
42
|
+
- ❌ `Fix bug` (not specific)
|
|
43
|
+
|
|
44
|
+
## Special Cases
|
|
45
|
+
- `.claude/` skill updates: `perf(skill): improve token efficiency`
|
|
46
|
+
- `.claude/` new skills: `feat(skill): add database-optimizer`
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Context Efficiency for Git Workflows
|
|
2
|
+
|
|
3
|
+
Git and `gh` emit some of the largest output in any workflow: full diffs, log
|
|
4
|
+
walls, PR bodies, CI job logs. Left unfiltered they crowd out the reasoning that
|
|
5
|
+
actually decides the commit or merge. Keep the main context small and high-signal.
|
|
6
|
+
|
|
7
|
+
## Isolate
|
|
8
|
+
|
|
9
|
+
Run verbose git/gh work in the `git-manager` subagent and return only what the
|
|
10
|
+
decision needs — the file list, the verdict, the failing line. Never return a raw
|
|
11
|
+
diff, a full `git log`, or a complete CI log to the main context.
|
|
12
|
+
|
|
13
|
+
For a batch (several PRs), handle one PR per subagent pass so one noisy PR cannot
|
|
14
|
+
crowd out the rest.
|
|
15
|
+
|
|
16
|
+
## Select before you read
|
|
17
|
+
|
|
18
|
+
Ask the command for the narrow answer instead of filtering a wide one afterwards:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git log --oneline -10 # not: git log
|
|
22
|
+
git diff --name-only # not: git diff, when you only need the files
|
|
23
|
+
git diff --stat # size of change without the body
|
|
24
|
+
gh pr view 123 --json title,mergeStateStatus,statusCheckRollup
|
|
25
|
+
gh run view "$RUN_ID" --log-failed # not: --log, which returns every job
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`gh` has a built-in jq engine — `--json <fields> --jq '<filter>'` — so field
|
|
29
|
+
selection needs no external tool.
|
|
30
|
+
|
|
31
|
+
## Compress what you must keep
|
|
32
|
+
|
|
33
|
+
When output has to survive into the main context, summarize it: the failing test
|
|
34
|
+
name and assertion, not the whole runner output; the conflicting paths, not the
|
|
35
|
+
conflict bodies. Cite `file:line` and drop the surrounding text.
|
|
36
|
+
|
|
37
|
+
## Position what matters
|
|
38
|
+
|
|
39
|
+
Put the decision-relevant facts at the start or end of a subagent report, never
|
|
40
|
+
buried in the middle — attention degrades in the middle of long context.
|
|
41
|
+
|
|
42
|
+
## Budget
|
|
43
|
+
|
|
44
|
+
Watch context utilization: **70% is a warning** to start compacting, **90% is
|
|
45
|
+
critical** — stop expanding scope and summarize what you have. On a long merge
|
|
46
|
+
batch, checkpoint progress (which PRs are merged, which remain) to a file rather
|
|
47
|
+
than carrying the whole history forward.
|
|
48
|
+
|
|
49
|
+
## Anti-patterns
|
|
50
|
+
|
|
51
|
+
- Pasting a full diff or CI log into the main context "for reference"
|
|
52
|
+
- Re-running a wide command because the narrow output was discarded
|
|
53
|
+
- One subagent accumulating every PR in a batch
|
|
54
|
+
- Reading a file the command could have filtered for you
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
# GitHub CLI Guide
|
|
2
|
-
|
|
3
|
-
## Authentication
|
|
4
|
-
```bash
|
|
5
|
-
gh auth login # Interactive login
|
|
6
|
-
gh auth status # Check auth state
|
|
7
|
-
gh auth logout # Logout
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
## Pull Requests
|
|
11
|
-
|
|
12
|
-
### Create PR
|
|
13
|
-
```bash
|
|
14
|
-
# Basic
|
|
15
|
-
gh pr create --base main --head feature-branch --title "feat: add login" --body "Summary"
|
|
16
|
-
|
|
17
|
-
# With HEREDOC body
|
|
18
|
-
gh pr create --base main --title "feat(auth): add OAuth" --body "$(cat <<'EOF'
|
|
19
|
-
## Summary
|
|
20
|
-
- Added OAuth2 provider support
|
|
21
|
-
- Implemented token refresh
|
|
22
|
-
|
|
23
|
-
## Test plan
|
|
24
|
-
- [ ] Unit tests pass
|
|
25
|
-
- [ ] Manual login test
|
|
26
|
-
EOF
|
|
27
|
-
)"
|
|
28
|
-
|
|
29
|
-
# Draft mode
|
|
30
|
-
gh pr create --draft --title "WIP: new feature"
|
|
31
|
-
|
|
32
|
-
# Assign reviewers
|
|
33
|
-
gh pr create --reviewer @user1,@user2
|
|
34
|
-
|
|
35
|
-
# Add labels
|
|
36
|
-
gh pr create --label "bug,priority:high"
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### View/Review PR
|
|
40
|
-
```bash
|
|
41
|
-
gh pr list # List PRs
|
|
42
|
-
gh pr view 123 # View PR details
|
|
43
|
-
gh pr view 123 --web # Open in browser
|
|
44
|
-
gh pr checkout 123 # Checkout PR locally
|
|
45
|
-
gh pr diff 123 # View PR diff
|
|
46
|
-
gh pr status # Your PRs + reviews
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Merge PR
|
|
50
|
-
```bash
|
|
51
|
-
gh pr merge 123 # Default merge commit
|
|
52
|
-
gh pr merge 123 --squash # Squash commits
|
|
53
|
-
gh pr merge 123 --rebase # Rebase merge
|
|
54
|
-
gh pr merge 123 --auto # Auto-merge when checks pass
|
|
55
|
-
gh pr merge 123 --delete-branch # Delete branch after
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### PR Comments
|
|
59
|
-
```bash
|
|
60
|
-
gh pr comment 123 --body "LGTM!"
|
|
61
|
-
gh api repos/{owner}/{repo}/pulls/123/comments # View all
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Issues
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
gh issue list # List issues
|
|
68
|
-
gh issue view 42 # View issue
|
|
69
|
-
gh issue create --title "Bug" --body "Description"
|
|
70
|
-
gh issue develop 42 -c # Create branch from issue
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Repository
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
gh repo view # Current repo info
|
|
77
|
-
gh repo clone owner/repo # Clone
|
|
78
|
-
gh browse # Open repo in browser
|
|
79
|
-
gh browse path/to/file:42 # Open file at line
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Workflow Runs
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
gh run list # List workflow runs
|
|
86
|
-
gh run view <run-id> # View run details
|
|
87
|
-
gh run watch # Watch running workflow
|
|
88
|
-
gh run rerun <run-id> # Rerun failed workflow
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## JSON Output (scripting)
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
gh pr list --json number,title,author
|
|
95
|
-
gh pr view 123 --json commits,reviews
|
|
96
|
-
gh issue list --json number,title --jq '.[].title'
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Common Patterns
|
|
100
|
-
|
|
101
|
-
### Create PR with auto-merge
|
|
102
|
-
```bash
|
|
103
|
-
gh pr create --fill && gh pr merge --auto --squash
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Close stale PRs
|
|
107
|
-
```bash
|
|
108
|
-
gh pr list --state open --json number -q '.[].number' | xargs -I {} gh pr close {}
|
|
109
|
-
```
|
|
1
|
+
# GitHub CLI Guide
|
|
2
|
+
|
|
3
|
+
## Authentication
|
|
4
|
+
```bash
|
|
5
|
+
gh auth login # Interactive login
|
|
6
|
+
gh auth status # Check auth state
|
|
7
|
+
gh auth logout # Logout
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Pull Requests
|
|
11
|
+
|
|
12
|
+
### Create PR
|
|
13
|
+
```bash
|
|
14
|
+
# Basic
|
|
15
|
+
gh pr create --base main --head feature-branch --title "feat: add login" --body "Summary"
|
|
16
|
+
|
|
17
|
+
# With HEREDOC body
|
|
18
|
+
gh pr create --base main --title "feat(auth): add OAuth" --body "$(cat <<'EOF'
|
|
19
|
+
## Summary
|
|
20
|
+
- Added OAuth2 provider support
|
|
21
|
+
- Implemented token refresh
|
|
22
|
+
|
|
23
|
+
## Test plan
|
|
24
|
+
- [ ] Unit tests pass
|
|
25
|
+
- [ ] Manual login test
|
|
26
|
+
EOF
|
|
27
|
+
)"
|
|
28
|
+
|
|
29
|
+
# Draft mode
|
|
30
|
+
gh pr create --draft --title "WIP: new feature"
|
|
31
|
+
|
|
32
|
+
# Assign reviewers
|
|
33
|
+
gh pr create --reviewer @user1,@user2
|
|
34
|
+
|
|
35
|
+
# Add labels
|
|
36
|
+
gh pr create --label "bug,priority:high"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### View/Review PR
|
|
40
|
+
```bash
|
|
41
|
+
gh pr list # List PRs
|
|
42
|
+
gh pr view 123 # View PR details
|
|
43
|
+
gh pr view 123 --web # Open in browser
|
|
44
|
+
gh pr checkout 123 # Checkout PR locally
|
|
45
|
+
gh pr diff 123 # View PR diff
|
|
46
|
+
gh pr status # Your PRs + reviews
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Merge PR
|
|
50
|
+
```bash
|
|
51
|
+
gh pr merge 123 # Default merge commit
|
|
52
|
+
gh pr merge 123 --squash # Squash commits
|
|
53
|
+
gh pr merge 123 --rebase # Rebase merge
|
|
54
|
+
gh pr merge 123 --auto # Auto-merge when checks pass
|
|
55
|
+
gh pr merge 123 --delete-branch # Delete branch after
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### PR Comments
|
|
59
|
+
```bash
|
|
60
|
+
gh pr comment 123 --body "LGTM!"
|
|
61
|
+
gh api repos/{owner}/{repo}/pulls/123/comments # View all
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Issues
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
gh issue list # List issues
|
|
68
|
+
gh issue view 42 # View issue
|
|
69
|
+
gh issue create --title "Bug" --body "Description"
|
|
70
|
+
gh issue develop 42 -c # Create branch from issue
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Repository
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
gh repo view # Current repo info
|
|
77
|
+
gh repo clone owner/repo # Clone
|
|
78
|
+
gh browse # Open repo in browser
|
|
79
|
+
gh browse path/to/file:42 # Open file at line
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Workflow Runs
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
gh run list # List workflow runs
|
|
86
|
+
gh run view <run-id> # View run details
|
|
87
|
+
gh run watch # Watch running workflow
|
|
88
|
+
gh run rerun <run-id> # Rerun failed workflow
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## JSON Output (scripting)
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
gh pr list --json number,title,author
|
|
95
|
+
gh pr view 123 --json commits,reviews
|
|
96
|
+
gh issue list --json number,title --jq '.[].title'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Common Patterns
|
|
100
|
+
|
|
101
|
+
### Create PR with auto-merge
|
|
102
|
+
```bash
|
|
103
|
+
gh pr create --fill && gh pr merge --auto --squash
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Close stale PRs
|
|
107
|
+
```bash
|
|
108
|
+
gh pr list --state open --json number -q '.[].number' | xargs -I {} gh pr close {}
|
|
109
|
+
```
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
# Git Safety Protocols
|
|
2
|
-
|
|
3
|
-
## Secret Detection Patterns
|
|
4
|
-
|
|
5
|
-
### Scan Command
|
|
6
|
-
```bash
|
|
7
|
-
git diff --cached | grep -iE "(AKIA|api[_-]?key|token|password|secret|credential|private[_-]?key|mongodb://|postgres://|mysql://|redis://|-----BEGIN)"
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
### Patterns to Detect
|
|
11
|
-
|
|
12
|
-
| Category | Pattern | Example |
|
|
13
|
-
|----------|---------|---------|
|
|
14
|
-
| API Keys | `api[_-]?key`, `apiKey` | `API_KEY=abc123` |
|
|
15
|
-
| AWS | `AKIA[0-9A-Z]{16}` | `AKIAIOSFODNN7EXAMPLE` |
|
|
16
|
-
| Tokens | `token`, `auth_token`, `jwt` | `AUTH_TOKEN=xyz` |
|
|
17
|
-
| Passwords | `password`, `passwd`, `pwd` | `DB_PASSWORD=secret` |
|
|
18
|
-
| Private Keys | `-----BEGIN PRIVATE KEY-----` | PEM files |
|
|
19
|
-
| DB URLs | `mongodb://`, `postgres://`, `mysql://` | Connection strings |
|
|
20
|
-
| OAuth | `client_secret`, `oauth_token` | `CLIENT_SECRET=abc` |
|
|
21
|
-
|
|
22
|
-
### Files to Warn About
|
|
23
|
-
- `.env`, `.env.*` (except `.env.example`)
|
|
24
|
-
- `*.key`, `*.pem`, `*.p12`
|
|
25
|
-
- `credentials.json`, `secrets.json`
|
|
26
|
-
- `config/private.*`
|
|
27
|
-
|
|
28
|
-
### Action on Detection
|
|
29
|
-
1. **BLOCK commit immediately**
|
|
30
|
-
2. Show matching lines: `git diff --cached | grep -B2 -A2 <pattern>`
|
|
31
|
-
3. Suggest: "Add to .gitignore or use environment variables"
|
|
32
|
-
4. Offer to unstage: `git reset HEAD <file>`
|
|
33
|
-
|
|
34
|
-
## Branch Protection
|
|
35
|
-
|
|
36
|
-
### Never Force Push To
|
|
37
|
-
- `main`, `master`, `production`, `prod`, `release/*`
|
|
38
|
-
|
|
39
|
-
### Pre-Merge Checks
|
|
40
|
-
```bash
|
|
41
|
-
# Check for conflicts before merge
|
|
42
|
-
git merge --no-commit --no-ff origin/{branch} && git merge --abort
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Remote-First Operations
|
|
46
|
-
Always use `origin/{branch}` for comparisons:
|
|
47
|
-
- ✅ `git diff origin/main...origin/feature`
|
|
48
|
-
- ❌ `git diff main...HEAD` (includes local uncommitted)
|
|
49
|
-
|
|
50
|
-
## Error Recovery
|
|
51
|
-
|
|
52
|
-
### Undo Last Commit (unpushed)
|
|
53
|
-
```bash
|
|
54
|
-
git reset --soft HEAD~1 # Keep changes staged
|
|
55
|
-
git reset HEAD~1 # Keep changes unstaged
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Abort Merge
|
|
59
|
-
```bash
|
|
60
|
-
git merge --abort
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Discard Local Changes
|
|
64
|
-
```bash
|
|
65
|
-
git checkout -- <file> # Single file
|
|
66
|
-
git reset --hard HEAD # All files (DANGER)
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Always confirm with user before destructive operations.**
|
|
1
|
+
# Git Safety Protocols
|
|
2
|
+
|
|
3
|
+
## Secret Detection Patterns
|
|
4
|
+
|
|
5
|
+
### Scan Command
|
|
6
|
+
```bash
|
|
7
|
+
git diff --cached | grep -iE "(AKIA|api[_-]?key|token|password|secret|credential|private[_-]?key|mongodb://|postgres://|mysql://|redis://|-----BEGIN)"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Patterns to Detect
|
|
11
|
+
|
|
12
|
+
| Category | Pattern | Example |
|
|
13
|
+
|----------|---------|---------|
|
|
14
|
+
| API Keys | `api[_-]?key`, `apiKey` | `API_KEY=abc123` |
|
|
15
|
+
| AWS | `AKIA[0-9A-Z]{16}` | `AKIAIOSFODNN7EXAMPLE` |
|
|
16
|
+
| Tokens | `token`, `auth_token`, `jwt` | `AUTH_TOKEN=xyz` |
|
|
17
|
+
| Passwords | `password`, `passwd`, `pwd` | `DB_PASSWORD=secret` |
|
|
18
|
+
| Private Keys | `-----BEGIN PRIVATE KEY-----` | PEM files |
|
|
19
|
+
| DB URLs | `mongodb://`, `postgres://`, `mysql://` | Connection strings |
|
|
20
|
+
| OAuth | `client_secret`, `oauth_token` | `CLIENT_SECRET=abc` |
|
|
21
|
+
|
|
22
|
+
### Files to Warn About
|
|
23
|
+
- `.env`, `.env.*` (except `.env.example`)
|
|
24
|
+
- `*.key`, `*.pem`, `*.p12`
|
|
25
|
+
- `credentials.json`, `secrets.json`
|
|
26
|
+
- `config/private.*`
|
|
27
|
+
|
|
28
|
+
### Action on Detection
|
|
29
|
+
1. **BLOCK commit immediately**
|
|
30
|
+
2. Show matching lines: `git diff --cached | grep -B2 -A2 <pattern>`
|
|
31
|
+
3. Suggest: "Add to .gitignore or use environment variables"
|
|
32
|
+
4. Offer to unstage: `git reset HEAD <file>`
|
|
33
|
+
|
|
34
|
+
## Branch Protection
|
|
35
|
+
|
|
36
|
+
### Never Force Push To
|
|
37
|
+
- `main`, `master`, `production`, `prod`, `release/*`
|
|
38
|
+
|
|
39
|
+
### Pre-Merge Checks
|
|
40
|
+
```bash
|
|
41
|
+
# Check for conflicts before merge
|
|
42
|
+
git merge --no-commit --no-ff origin/{branch} && git merge --abort
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Remote-First Operations
|
|
46
|
+
Always use `origin/{branch}` for comparisons:
|
|
47
|
+
- ✅ `git diff origin/main...origin/feature`
|
|
48
|
+
- ❌ `git diff main...HEAD` (includes local uncommitted)
|
|
49
|
+
|
|
50
|
+
## Error Recovery
|
|
51
|
+
|
|
52
|
+
### Undo Last Commit (unpushed)
|
|
53
|
+
```bash
|
|
54
|
+
git reset --soft HEAD~1 # Keep changes staged
|
|
55
|
+
git reset HEAD~1 # Keep changes unstaged
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Abort Merge
|
|
59
|
+
```bash
|
|
60
|
+
git merge --abort
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Discard Local Changes
|
|
64
|
+
```bash
|
|
65
|
+
git checkout -- <file> # Single file
|
|
66
|
+
git reset --hard HEAD # All files (DANGER)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Always confirm with user before destructive operations.**
|