@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,58 +1,58 @@
|
|
|
1
|
-
# Commit Workflow
|
|
2
|
-
|
|
3
|
-
Execute via `git-manager` subagent.
|
|
4
|
-
|
|
5
|
-
## Tool 1: Stage + Analyze
|
|
6
|
-
```bash
|
|
7
|
-
git add -A && \
|
|
8
|
-
echo "=== STAGED ===" && git diff --cached --stat && \
|
|
9
|
-
echo "=== SECURITY ===" && \
|
|
10
|
-
git diff --cached | grep -c -iE "(api[_-]?key|token|password|secret|credential)" | awk '{print "SECRETS:"$1}' && \
|
|
11
|
-
echo "=== GROUPS ===" && \
|
|
12
|
-
git diff --cached --name-only | awk -F'/' '{
|
|
13
|
-
if ($0 ~ /\.(md|txt)$/) print "docs:"$0
|
|
14
|
-
else if ($0 ~ /test|spec/) print "test:"$0
|
|
15
|
-
else if ($0 ~ /\.claude/) print "config:"$0
|
|
16
|
-
else if ($0 ~ /package\.json|lock/) print "deps:"$0
|
|
17
|
-
else print "code:"$0
|
|
18
|
-
}'
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
**If SECRETS > 0:** STOP, show matches, block commit.
|
|
22
|
-
|
|
23
|
-
## Tool 2: Split Decision
|
|
24
|
-
|
|
25
|
-
NOTE:
|
|
26
|
-
- Search for related issues on GitHub and add to body.
|
|
27
|
-
- Only use `feat`, `fix`, or `perf` prefixes for files in `.claude` directory (do not use `docs`).
|
|
28
|
-
|
|
29
|
-
**From groups, decide:**
|
|
30
|
-
|
|
31
|
-
**A) Single commit:** Same type/scope, FILES ≤ 3, LINES ≤ 50
|
|
32
|
-
|
|
33
|
-
**B) Multi commit:** Mixed types/scopes, group by:
|
|
34
|
-
- Group 1: `config:` → `chore(config): ...`
|
|
35
|
-
- Group 2: `deps:` → `chore(deps): ...`
|
|
36
|
-
- Group 3: `test:` → `test: ...`
|
|
37
|
-
- Group 4: `code:` → `feat|fix: ...`
|
|
38
|
-
- Group 5: `docs:` → `docs: ...`
|
|
39
|
-
|
|
40
|
-
## Tool 3: Commit
|
|
41
|
-
|
|
42
|
-
**Single:**
|
|
43
|
-
```bash
|
|
44
|
-
git commit -m "type(scope): description"
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
**Multi (sequential):**
|
|
48
|
-
```bash
|
|
49
|
-
git reset && git add file1 file2 && git commit -m "type(scope): desc"
|
|
50
|
-
```
|
|
51
|
-
Repeat for each group.
|
|
52
|
-
|
|
53
|
-
## Tool 4: Push (if requested)
|
|
54
|
-
```bash
|
|
55
|
-
git push && echo "✓ pushed: yes" || echo "✓ pushed: no"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Only push if user explicitly requested** ("push", "commit and push").
|
|
1
|
+
# Commit Workflow
|
|
2
|
+
|
|
3
|
+
Execute via `git-manager` subagent.
|
|
4
|
+
|
|
5
|
+
## Tool 1: Stage + Analyze
|
|
6
|
+
```bash
|
|
7
|
+
git add -A && \
|
|
8
|
+
echo "=== STAGED ===" && git diff --cached --stat && \
|
|
9
|
+
echo "=== SECURITY ===" && \
|
|
10
|
+
git diff --cached | grep -c -iE "(api[_-]?key|token|password|secret|credential)" | awk '{print "SECRETS:"$1}' && \
|
|
11
|
+
echo "=== GROUPS ===" && \
|
|
12
|
+
git diff --cached --name-only | awk -F'/' '{
|
|
13
|
+
if ($0 ~ /\.(md|txt)$/) print "docs:"$0
|
|
14
|
+
else if ($0 ~ /test|spec/) print "test:"$0
|
|
15
|
+
else if ($0 ~ /\.claude/) print "config:"$0
|
|
16
|
+
else if ($0 ~ /package\.json|lock/) print "deps:"$0
|
|
17
|
+
else print "code:"$0
|
|
18
|
+
}'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**If SECRETS > 0:** STOP, show matches, block commit.
|
|
22
|
+
|
|
23
|
+
## Tool 2: Split Decision
|
|
24
|
+
|
|
25
|
+
NOTE:
|
|
26
|
+
- Search for related issues on GitHub and add to body.
|
|
27
|
+
- Only use `feat`, `fix`, or `perf` prefixes for files in `.claude` directory (do not use `docs`).
|
|
28
|
+
|
|
29
|
+
**From groups, decide:**
|
|
30
|
+
|
|
31
|
+
**A) Single commit:** Same type/scope, FILES ≤ 3, LINES ≤ 50
|
|
32
|
+
|
|
33
|
+
**B) Multi commit:** Mixed types/scopes, group by:
|
|
34
|
+
- Group 1: `config:` → `chore(config): ...`
|
|
35
|
+
- Group 2: `deps:` → `chore(deps): ...`
|
|
36
|
+
- Group 3: `test:` → `test: ...`
|
|
37
|
+
- Group 4: `code:` → `feat|fix: ...`
|
|
38
|
+
- Group 5: `docs:` → `docs: ...`
|
|
39
|
+
|
|
40
|
+
## Tool 3: Commit
|
|
41
|
+
|
|
42
|
+
**Single:**
|
|
43
|
+
```bash
|
|
44
|
+
git commit -m "type(scope): description"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Multi (sequential):**
|
|
48
|
+
```bash
|
|
49
|
+
git reset && git add file1 file2 && git commit -m "type(scope): desc"
|
|
50
|
+
```
|
|
51
|
+
Repeat for each group.
|
|
52
|
+
|
|
53
|
+
## Tool 4: Push (if requested)
|
|
54
|
+
```bash
|
|
55
|
+
git push && echo "✓ pushed: yes" || echo "✓ pushed: no"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Only push if user explicitly requested** ("push", "commit and push").
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Merge PR Workflow
|
|
2
|
+
|
|
3
|
+
Execute via `git-manager` subagent.
|
|
4
|
+
|
|
5
|
+
## Variables
|
|
6
|
+
- PR_REFS: one or more PR numbers or GitHub PR URLs
|
|
7
|
+
- READY_LABEL: `ready to ship`
|
|
8
|
+
|
|
9
|
+
## Step 1: Parse and Inspect
|
|
10
|
+
|
|
11
|
+
Require at least one PR ref:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
gh auth status
|
|
15
|
+
gh repo view --json nameWithOwner,defaultBranchRef
|
|
16
|
+
for pr in "$@"; do
|
|
17
|
+
gh pr view "$pr" --json number,url,title,baseRefName,headRefName,mergeStateStatus,statusCheckRollup
|
|
18
|
+
done
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If any PR ref is invalid, from another repo, closed, or not visible to `gh`, stop before reviewing or merging any PRs.
|
|
22
|
+
|
|
23
|
+
## Step 2: Review
|
|
24
|
+
|
|
25
|
+
For each PR, run the code review:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
/code-review <PR number or URL>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Do not label or merge until all of these hold:
|
|
32
|
+
- the review reports no Critical or Important findings
|
|
33
|
+
- `mergeStateStatus` from Step 1 shows no conflicts
|
|
34
|
+
- required PR checks are terminal and green (`statusCheckRollup` from Step 1)
|
|
35
|
+
|
|
36
|
+
The review reports findings; it does not auto-fix them and posts nothing back to
|
|
37
|
+
GitHub. Fix anything blocking, push, then re-run this step before continuing.
|
|
38
|
+
|
|
39
|
+
`/code-review` ships in the optional `code-review` component. If it is not
|
|
40
|
+
installed, review the PR diff directly (`gh pr diff <PR>`) and apply the same
|
|
41
|
+
gate before labeling — never skip the review step.
|
|
42
|
+
|
|
43
|
+
If a PR still needs changes, stop the entire merge batch. Report:
|
|
44
|
+
- PR number/URL
|
|
45
|
+
- remaining findings or blockers
|
|
46
|
+
- exact failed checks or merge state, if any
|
|
47
|
+
- recommended next action
|
|
48
|
+
|
|
49
|
+
## Step 3: Apply Ready Label
|
|
50
|
+
|
|
51
|
+
Ensure the label exists, then apply it to each reviewed-ready PR:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
gh label list --json name --jq '.[].name' | grep -Fx "ready to ship" >/dev/null \
|
|
55
|
+
|| gh label create "ready to ship" --color "0E8A16" --description "Reviewed and ready to merge"
|
|
56
|
+
gh pr edit "$PR_REF" --add-label "ready to ship"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If labeling fails for any reason other than an already-existing label, stop and report the exact `gh` error.
|
|
60
|
+
|
|
61
|
+
## Step 4: Merge
|
|
62
|
+
|
|
63
|
+
Merge reviewed-ready PRs one at a time in the order provided.
|
|
64
|
+
|
|
65
|
+
Before each merge:
|
|
66
|
+
- re-read `mergeStateStatus`, `baseRefName`, and `statusCheckRollup`
|
|
67
|
+
- confirm required checks are still green or use auto-merge if branch protection is waiting on pending checks
|
|
68
|
+
- use the repository's allowed merge method and branch-protection rules
|
|
69
|
+
|
|
70
|
+
Select the merge method before running `gh pr merge`; do not let `gh` prompt interactively:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
MERGE_METHOD_FLAG="--merge" # or --squash / --rebase, based on repo convention
|
|
74
|
+
gh pr merge "$PR_REF" --auto --delete-branch "$MERGE_METHOD_FLAG"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Use `--auto` when required checks are pending. If checks are already green, use the same repo convention without `--auto`:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
gh pr merge "$PR_REF" --delete-branch "$MERGE_METHOD_FLAG"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Never force push. Never direct-push to protected target branches.
|
|
84
|
+
|
|
85
|
+
## Step 5: Watch Target-Branch CI
|
|
86
|
+
|
|
87
|
+
After each merge, capture the base branch and merge commit:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
gh pr view "$PR_REF" --json baseRefName,mergeCommit
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Watch CI/deploy workflows for that merge commit on the target branch:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
gh run list --branch "$BASE_BRANCH" --commit "$MERGE_SHA" --json databaseId,status,conclusion,name,url
|
|
97
|
+
gh run watch "$RUN_ID" --exit-status
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
If no workflow appears immediately, poll briefly before deciding there are no workflows for the merge commit.
|
|
101
|
+
|
|
102
|
+
## Step 6: CI Failure Convergence
|
|
103
|
+
|
|
104
|
+
If target-branch CI fails:
|
|
105
|
+
|
|
106
|
+
1. Inspect failed logs:
|
|
107
|
+
```bash
|
|
108
|
+
gh run view "$RUN_ID" --json status,conclusion,jobs
|
|
109
|
+
gh run view "$RUN_ID" --job "$JOB_ID" --log
|
|
110
|
+
```
|
|
111
|
+
2. If the failure is transient infrastructure, rerun failed jobs once:
|
|
112
|
+
```bash
|
|
113
|
+
gh run rerun "$RUN_ID" --failed
|
|
114
|
+
```
|
|
115
|
+
3. If the failure is deterministic and repo-fixable, stop and report it with:
|
|
116
|
+
workflow name, run id, job id, the failing command, and the exact error.
|
|
117
|
+
4. Once the fix is made, ship it through PR review/merge, then watch target-branch CI again.
|
|
118
|
+
|
|
119
|
+
Stop when target-branch CI succeeds, an external blocker remains, or the same blocker survives 3 attempts.
|
|
120
|
+
|
|
121
|
+
## Output Format
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
reviewed: PR #123 no blocking findings, CI green
|
|
125
|
+
labeled: PR #123 ready to ship
|
|
126
|
+
merged: PR #123 into dev (merge SHA abc123)
|
|
127
|
+
CI: green for abc123
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
If blocked:
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
stopped: PR #123 not merge-ready
|
|
134
|
+
reason: <finding/check/merge blocker>
|
|
135
|
+
suggestion: <next action>
|
|
136
|
+
```
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
# Merge Workflow
|
|
2
|
-
|
|
3
|
-
Execute via `git-manager` subagent.
|
|
4
|
-
|
|
5
|
-
## Variables
|
|
6
|
-
- TO_BRANCH: target (defaults to `main`)
|
|
7
|
-
- FROM_BRANCH: source (defaults to current branch)
|
|
8
|
-
|
|
9
|
-
## Step 1: Sync with Remote
|
|
10
|
-
|
|
11
|
-
**IMPORTANT: Always merge `main` (or any default branch) to current branch first.**
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
git fetch origin
|
|
15
|
-
git checkout {TO_BRANCH}
|
|
16
|
-
git pull origin {TO_BRANCH}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Step 2: Merge from REMOTE
|
|
20
|
-
```bash
|
|
21
|
-
git merge origin/{FROM_BRANCH} --no-ff -m "merge: {FROM_BRANCH} into {TO_BRANCH}"
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Why `origin/{FROM_BRANCH}`:** Ensures merging only committed+pushed changes, not local WIP.
|
|
25
|
-
|
|
26
|
-
## Step 3: Resolve Conflicts
|
|
27
|
-
If conflicts:
|
|
28
|
-
1. Resolve manually
|
|
29
|
-
2. `git add . && git commit`
|
|
30
|
-
3. If clarifications needed, report to main agent
|
|
31
|
-
|
|
32
|
-
## Step 4: Push
|
|
33
|
-
```bash
|
|
34
|
-
git push origin {TO_BRANCH}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Pre-Merge Checklist
|
|
38
|
-
- Fetch latest: `git fetch origin`
|
|
39
|
-
- Ensure FROM_BRANCH pushed to remote
|
|
40
|
-
- Check for conflicts: `git merge --no-commit --no-ff origin/{FROM_BRANCH}` then abort
|
|
41
|
-
|
|
42
|
-
## Error Handling
|
|
43
|
-
|
|
44
|
-
| Error | Action |
|
|
45
|
-
|-------|--------|
|
|
46
|
-
| Merge conflicts | Resolve manually, then commit |
|
|
47
|
-
| Branch not found | Verify branch name, ensure pushed |
|
|
48
|
-
| Push rejected | `git pull --rebase`, retry |
|
|
1
|
+
# Merge Workflow
|
|
2
|
+
|
|
3
|
+
Execute via `git-manager` subagent.
|
|
4
|
+
|
|
5
|
+
## Variables
|
|
6
|
+
- TO_BRANCH: target (defaults to `main`)
|
|
7
|
+
- FROM_BRANCH: source (defaults to current branch)
|
|
8
|
+
|
|
9
|
+
## Step 1: Sync with Remote
|
|
10
|
+
|
|
11
|
+
**IMPORTANT: Always merge `main` (or any default branch) to current branch first.**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git fetch origin
|
|
15
|
+
git checkout {TO_BRANCH}
|
|
16
|
+
git pull origin {TO_BRANCH}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Step 2: Merge from REMOTE
|
|
20
|
+
```bash
|
|
21
|
+
git merge origin/{FROM_BRANCH} --no-ff -m "merge: {FROM_BRANCH} into {TO_BRANCH}"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Why `origin/{FROM_BRANCH}`:** Ensures merging only committed+pushed changes, not local WIP.
|
|
25
|
+
|
|
26
|
+
## Step 3: Resolve Conflicts
|
|
27
|
+
If conflicts:
|
|
28
|
+
1. Resolve manually
|
|
29
|
+
2. `git add . && git commit`
|
|
30
|
+
3. If clarifications needed, report to main agent
|
|
31
|
+
|
|
32
|
+
## Step 4: Push
|
|
33
|
+
```bash
|
|
34
|
+
git push origin {TO_BRANCH}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Pre-Merge Checklist
|
|
38
|
+
- Fetch latest: `git fetch origin`
|
|
39
|
+
- Ensure FROM_BRANCH pushed to remote
|
|
40
|
+
- Check for conflicts: `git merge --no-commit --no-ff origin/{FROM_BRANCH}` then abort
|
|
41
|
+
|
|
42
|
+
## Error Handling
|
|
43
|
+
|
|
44
|
+
| Error | Action |
|
|
45
|
+
|-------|--------|
|
|
46
|
+
| Merge conflicts | Resolve manually, then commit |
|
|
47
|
+
| Branch not found | Verify branch name, ensure pushed |
|
|
48
|
+
| Push rejected | `git pull --rebase`, retry |
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
# Pull Request Workflow
|
|
2
|
-
|
|
3
|
-
Execute via `git-manager` subagent.
|
|
4
|
-
|
|
5
|
-
## Variables
|
|
6
|
-
- TO_BRANCH: target (defaults to `main`)
|
|
7
|
-
- FROM_BRANCH: source (defaults to current branch)
|
|
8
|
-
|
|
9
|
-
## CRITICAL: Use REMOTE diff
|
|
10
|
-
PRs based on remote branches. Local diff includes unpushed changes.
|
|
11
|
-
|
|
12
|
-
## Tool 1: Sync + Analyze
|
|
13
|
-
|
|
14
|
-
**IMPORTANT: Always merge `main` (or any default branch) to current branch first.**
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
git fetch origin && \
|
|
18
|
-
git push -u origin HEAD 2>/dev/null || true && \
|
|
19
|
-
BASE=${BASE_BRANCH:-main} && \
|
|
20
|
-
HEAD=$(git rev-parse --abbrev-ref HEAD) && \
|
|
21
|
-
echo "=== PR: $HEAD → $BASE ===" && \
|
|
22
|
-
echo "=== COMMITS ===" && \
|
|
23
|
-
git log origin/$BASE...origin/$HEAD --oneline && \
|
|
24
|
-
echo "=== FILES ===" && \
|
|
25
|
-
git diff origin/$BASE...origin/$HEAD --stat
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
**If "Branch not on remote":** Push first, retry.
|
|
29
|
-
|
|
30
|
-
## Tool 2: Generate Content
|
|
31
|
-
**Title:** Conventional commit format, <72 chars, NO version numbers
|
|
32
|
-
**Body:** Summary bullets + Test plan checklist
|
|
33
|
-
|
|
34
|
-
## Tool 3: Create PR
|
|
35
|
-
```bash
|
|
36
|
-
gh pr create --base $BASE --head $HEAD --title "..." --body "$(cat <<'EOF'
|
|
37
|
-
## Summary
|
|
38
|
-
- Bullet points
|
|
39
|
-
|
|
40
|
-
## Test plan
|
|
41
|
-
- [ ] Test item
|
|
42
|
-
EOF
|
|
43
|
-
)"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## DO NOT use (local comparison)
|
|
47
|
-
- ❌ `git diff main...HEAD`
|
|
48
|
-
- ❌ `git diff --cached`
|
|
49
|
-
- ❌ `git status`
|
|
50
|
-
|
|
51
|
-
## Error Handling
|
|
52
|
-
|
|
53
|
-
| Error | Action |
|
|
54
|
-
|-------|--------|
|
|
55
|
-
| Branch not on remote | `git push -u origin HEAD`, retry |
|
|
56
|
-
| Empty diff | Warn: "No changes for PR" |
|
|
57
|
-
| Push rejected | `git pull --rebase`, resolve, push |
|
|
58
|
-
| No upstream | `git push -u origin HEAD` |
|
|
1
|
+
# Pull Request Workflow
|
|
2
|
+
|
|
3
|
+
Execute via `git-manager` subagent.
|
|
4
|
+
|
|
5
|
+
## Variables
|
|
6
|
+
- TO_BRANCH: target (defaults to `main`)
|
|
7
|
+
- FROM_BRANCH: source (defaults to current branch)
|
|
8
|
+
|
|
9
|
+
## CRITICAL: Use REMOTE diff
|
|
10
|
+
PRs based on remote branches. Local diff includes unpushed changes.
|
|
11
|
+
|
|
12
|
+
## Tool 1: Sync + Analyze
|
|
13
|
+
|
|
14
|
+
**IMPORTANT: Always merge `main` (or any default branch) to current branch first.**
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git fetch origin && \
|
|
18
|
+
git push -u origin HEAD 2>/dev/null || true && \
|
|
19
|
+
BASE=${BASE_BRANCH:-main} && \
|
|
20
|
+
HEAD=$(git rev-parse --abbrev-ref HEAD) && \
|
|
21
|
+
echo "=== PR: $HEAD → $BASE ===" && \
|
|
22
|
+
echo "=== COMMITS ===" && \
|
|
23
|
+
git log origin/$BASE...origin/$HEAD --oneline && \
|
|
24
|
+
echo "=== FILES ===" && \
|
|
25
|
+
git diff origin/$BASE...origin/$HEAD --stat
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**If "Branch not on remote":** Push first, retry.
|
|
29
|
+
|
|
30
|
+
## Tool 2: Generate Content
|
|
31
|
+
**Title:** Conventional commit format, <72 chars, NO version numbers
|
|
32
|
+
**Body:** Summary bullets + Test plan checklist
|
|
33
|
+
|
|
34
|
+
## Tool 3: Create PR
|
|
35
|
+
```bash
|
|
36
|
+
gh pr create --base $BASE --head $HEAD --title "..." --body "$(cat <<'EOF'
|
|
37
|
+
## Summary
|
|
38
|
+
- Bullet points
|
|
39
|
+
|
|
40
|
+
## Test plan
|
|
41
|
+
- [ ] Test item
|
|
42
|
+
EOF
|
|
43
|
+
)"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## DO NOT use (local comparison)
|
|
47
|
+
- ❌ `git diff main...HEAD`
|
|
48
|
+
- ❌ `git diff --cached`
|
|
49
|
+
- ❌ `git status`
|
|
50
|
+
|
|
51
|
+
## Error Handling
|
|
52
|
+
|
|
53
|
+
| Error | Action |
|
|
54
|
+
|-------|--------|
|
|
55
|
+
| Branch not on remote | `git push -u origin HEAD`, retry |
|
|
56
|
+
| Empty diff | Warn: "No changes for PR" |
|
|
57
|
+
| Push rejected | `git pull --rebase`, resolve, push |
|
|
58
|
+
| No upstream | `git push -u origin HEAD` |
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
# Push Workflow
|
|
2
|
-
|
|
3
|
-
Execute via `git-manager` subagent.
|
|
4
|
-
|
|
5
|
-
## Pre-Push Checklist
|
|
6
|
-
1. All changes committed
|
|
7
|
-
2. Secrets scanned (see `safety-protocols.md`)
|
|
8
|
-
3. Branch pushed to remote
|
|
9
|
-
|
|
10
|
-
## Tool 1: Verify State
|
|
11
|
-
```bash
|
|
12
|
-
git status && \
|
|
13
|
-
git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline 2>/dev/null || echo "NO_UPSTREAM"
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**If uncommitted changes:** Warn user, suggest commit first.
|
|
17
|
-
**If NO_UPSTREAM:** Use `git push -u origin HEAD`.
|
|
18
|
-
|
|
19
|
-
## Tool 2: Push
|
|
20
|
-
```bash
|
|
21
|
-
git push origin HEAD
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**On success:** Report commit hashes pushed.
|
|
25
|
-
|
|
26
|
-
## Error Handling
|
|
27
|
-
|
|
28
|
-
| Error | Cause | Solution |
|
|
29
|
-
|-------|-------|----------|
|
|
30
|
-
| `rejected - non-fast-forward` | Remote has newer commits | `git pull --rebase`, resolve conflicts, push again |
|
|
31
|
-
| `no upstream branch` | Branch not tracked | `git push -u origin HEAD` |
|
|
32
|
-
| `Authentication failed` | Invalid credentials | Check `gh auth status` or SSH keys |
|
|
33
|
-
| `Repository not found` | Wrong remote URL | Verify `git remote -v` |
|
|
34
|
-
| `Permission denied` | No write access | Check repository permissions |
|
|
35
|
-
|
|
36
|
-
## Force Push (DANGER)
|
|
37
|
-
|
|
38
|
-
**NEVER force push to main/master/production branches.**
|
|
39
|
-
|
|
40
|
-
If user explicitly requests force push on feature branch:
|
|
41
|
-
```bash
|
|
42
|
-
git push -f origin HEAD
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**Warn user:** "Force push rewrites history. Collaborators may lose work."
|
|
46
|
-
|
|
47
|
-
## Output Format
|
|
48
|
-
```
|
|
49
|
-
✓ pushed: N commits to origin/{branch}
|
|
50
|
-
- abc123 feat(auth): add login
|
|
51
|
-
- def456 fix(api): resolve timeout
|
|
52
|
-
```
|
|
1
|
+
# Push Workflow
|
|
2
|
+
|
|
3
|
+
Execute via `git-manager` subagent.
|
|
4
|
+
|
|
5
|
+
## Pre-Push Checklist
|
|
6
|
+
1. All changes committed
|
|
7
|
+
2. Secrets scanned (see `safety-protocols.md`)
|
|
8
|
+
3. Branch pushed to remote
|
|
9
|
+
|
|
10
|
+
## Tool 1: Verify State
|
|
11
|
+
```bash
|
|
12
|
+
git status && \
|
|
13
|
+
git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline 2>/dev/null || echo "NO_UPSTREAM"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**If uncommitted changes:** Warn user, suggest commit first.
|
|
17
|
+
**If NO_UPSTREAM:** Use `git push -u origin HEAD`.
|
|
18
|
+
|
|
19
|
+
## Tool 2: Push
|
|
20
|
+
```bash
|
|
21
|
+
git push origin HEAD
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**On success:** Report commit hashes pushed.
|
|
25
|
+
|
|
26
|
+
## Error Handling
|
|
27
|
+
|
|
28
|
+
| Error | Cause | Solution |
|
|
29
|
+
|-------|-------|----------|
|
|
30
|
+
| `rejected - non-fast-forward` | Remote has newer commits | `git pull --rebase`, resolve conflicts, push again |
|
|
31
|
+
| `no upstream branch` | Branch not tracked | `git push -u origin HEAD` |
|
|
32
|
+
| `Authentication failed` | Invalid credentials | Check `gh auth status` or SSH keys |
|
|
33
|
+
| `Repository not found` | Wrong remote URL | Verify `git remote -v` |
|
|
34
|
+
| `Permission denied` | No write access | Check repository permissions |
|
|
35
|
+
|
|
36
|
+
## Force Push (DANGER)
|
|
37
|
+
|
|
38
|
+
**NEVER force push to main/master/production branches.**
|
|
39
|
+
|
|
40
|
+
If user explicitly requests force push on feature branch:
|
|
41
|
+
```bash
|
|
42
|
+
git push -f origin HEAD
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Warn user:** "Force push rewrites history. Collaborators may lose work."
|
|
46
|
+
|
|
47
|
+
## Output Format
|
|
48
|
+
```
|
|
49
|
+
✓ pushed: N commits to origin/{branch}
|
|
50
|
+
- abc123 feat(auth): add login
|
|
51
|
+
- def456 fix(api): resolve timeout
|
|
52
|
+
```
|