Skip to content

Commit 953570d

Browse files
committed
docs: codify git workflow principles
Document the shared mutation invariants behind devloop's Git scripts, including intent-driven branching, live-state validation, scoped staging, and safe history rewrites. Add managed worktree resume semantics, link the leaf commit skills to the shared model, refresh the checkout guard wording, and bump the plugin to 0.2.5.
1 parent a2afc82 commit 953570d

7 files changed

Lines changed: 56 additions & 4 deletions

File tree

devloop/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devloop",
3-
"version": "0.2.4",
3+
"version": "0.2.5",
44
"description": "Dev-loop workflow, native-first rebuild: git/PR (GitHub + GitLab) + cwd-aware enter + Board-managed context delivery + lint/test gates. Built on native Claude Code events (CwdChanged / PostCompact / FileChanged / monitors).",
55
"author": {
66
"name": "qiankunli",

devloop/.codex-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devloop",
3-
"version": "0.2.4",
3+
"version": "0.2.5",
44
"description": "Dev-loop workflow: git/PR (GitHub + GitLab) + Board-managed workspace/repo context delivery + lint/test gates + execution-level hard intercepts for Claude Code and Codex.",
55
"author": {
66
"name": "qiankunli",

devloop/hooks/rules/command/worktree_add.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def check(self, target: Command, ctx) -> list[Finding]:
3131
"(canonical location, base branch, reuse/pruning, and dependency preparation).\n"
3232
f"Use the managed-worktree helper with a short unique tag: "
3333
f"`python3 \"<PLUGIN_ROOT>/scripts/checkout.py\" {repo} --worktree <tag>`. "
34-
"The enter flow delegates creation to `domain/worktree.py`."
34+
"The checkout helper delegates creation to `domain/worktree.py`."
3535
),
3636
locator=" ".join(target.argv),
3737
)

devloop/skills/gcam/SKILL.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: gcam
33
description: Commit current changes without pushing. Use when the user says "gcam" or wants to commit only.
44
---
55

6+
Apply the shared mutation principles in [`git-ops`](../git-ops/SKILL.md). This skill only
7+
selects the commit-only transaction.
8+
69
Run:
710

811
```

devloop/skills/gcamp/SKILL.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: gcamp
33
description: Commit current changes and push, without creating a pull/merge request. Use when the user says "gcamp" or wants to commit + push (e.g. add a commit to an existing PR/MR branch).
44
---
55

6+
Apply the shared mutation principles in [`git-ops`](../git-ops/SKILL.md). This skill only
7+
selects the commit-and-push transaction.
8+
69
Run:
710

811
```

devloop/skills/gcampr/SKILL.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: gcampr
33
description: Commit current changes, push, and create/reuse a pull/merge request (GitHub PR or GitLab MR). Use when the user says "gcampr" or asks to commit + push + open/raise a PR / MR / pull request / merge request.
44
---
55

6+
Apply the shared mutation principles in [`git-ops`](../git-ops/SKILL.md). This skill only
7+
selects the commit-push-and-open/reuse-PR transaction.
8+
69
Run the orchestrator (it handles preflight branch decision, staging, commit, push, and PR/MR create/reuse, then prints a self-narrating `PLAN:` banner):
710

811
```

devloop/skills/git-ops/SKILL.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: git-ops
3-
description: Commit, push, safely rebase an existing branch, create/read/update/close a pull/merge request (GitHub PR or GitLab MR), cut a feature branch, or view recent PRs in the current repo. Triggers — gcam / gcamp / gcampr / rebase / 解决冲突 / 提 PR / 提 MR / pull request / merge request / 看 PR / 看 MR / 关 PR / 关 MR / 切新分支 / 起新分支 / 发版.
3+
description: Commit, push, safely rebase an existing branch, create/read/update/close a pull/merge request (GitHub PR or GitLab MR), cut a feature branch, create/resume a managed worktree, or release. Triggers — gcam / gcamp / gcampr / rebase / 解决冲突 / 提 PR / 提 MR / pull request / merge request / 看 PR / 看 MR / 关 PR / 关 MR / checkout / worktree / 切新分支 / 起新分支 / 发版.
44
---
55

66
The umbrella for devloop's git + code-review workflow. All git goes through one runner
@@ -14,6 +14,34 @@ credentials file to hunt for.
1414

1515
Paths use `<PLUGIN_ROOT>``${CLAUDE_PLUGIN_ROOT}` on Claude Code; `${PLUGIN_ROOT}` on Codex.
1616

17+
## Operating principles
18+
19+
The scripts are the executable policy; this skill supplies the decision model. Inspect Git
20+
state freely, but do not improvise a competing mutation sequence when devloop owns that
21+
operation.
22+
23+
1. **Resolve intent before touching HEAD.** `--branch` means new work and cuts from a freshly
24+
fetched `origin/<target>`; omitting it means continue the current branch. Stacking is never
25+
inferred from the current checkout — it requires an explicit `--base`.
26+
2. **Treat an existing identity as work to preserve.** Reusing a branch or worktree tag means
27+
resume it as-is, not “make it current.” Checkout must not silently rebase or reset existing
28+
work. Updating its baseline is a separate, explicit history operation.
29+
3. **Revalidate shared state at the mutation boundary.** Injected branch/PR context is useful
30+
guidance, but the owning script's live fetch/forge/lease check is authoritative. If fresh
31+
state cannot be obtained, or changed underneath the transaction, stop rather than guess.
32+
4. **Scope mutations to the user's change.** Target one repo and an explicit file set when
33+
untracked or unrelated files exist. Never trade convenience for a repo-wide `git add -A`;
34+
never let the current cwd silently choose another subproject.
35+
5. **Rewrite history only as a resumable transaction.** Capture the old remote SHA before a
36+
rebase and publish with an exact `force-with-lease`. Never raw force-push, and never guess a
37+
reset target after the safe abort point has passed.
38+
6. **Use hard gates only where no legitimate editing path exists.** Protected and inactive
39+
branches are denied. In-flight branches remain editable for review fixes, but new work must
40+
move to a new branch.
41+
7. **Keep ownership boundaries explicit.** Commit/push/PR creation, checkout/worktree lifecycle,
42+
PR management, rebase, and release have separate owning entry points. Merge remains a human
43+
action. Trust and surface each owner's `PLAN:` or equivalent result.
44+
1745
## Commit / push / PR
1846

1947
| Intent | Script |
@@ -40,6 +68,21 @@ staging, auto-rebased onto the repo root; else tracked modifications — never
4068
quotes the MR's number / state / sha — so it's ground truth even right after you created the MR
4169
(a colleague can merge it in seconds); add `--branch` and re-run.
4270

71+
## Checkout / managed worktree
72+
73+
Use ordinary `cd` to select an existing repo or checkout. When another session needs an isolated
74+
checkout, use the managed helper instead of raw `git worktree add`:
75+
76+
```
77+
python3 <PLUGIN_ROOT>/scripts/checkout.py <repo> --worktree <short-unique-tag>
78+
```
79+
80+
A new tag creates `worktree-<tag>` from a freshly fetched `origin/<target>` and refuses creation
81+
if that baseline cannot be refreshed. An existing worktree path or retained `worktree-<tag>`
82+
branch is resumed without rebase/reset. Reuse the same tag only to continue that work; choose a
83+
new tag for independent work from the latest target. Baseline updates to retained work are
84+
explicit Git operations, never a side effect of checkout.
85+
4386
## Rebase an existing PR/MR branch
4487

4588
Rebase is its own resumable transaction — do **not** route it through gcamp/gcampr and do not

0 commit comments

Comments
 (0)