oh-my-customcode 0.135.0 → 0.136.1
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 +2 -2
- package/dist/cli/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/.claude/agents/mgr-gitnerd.md +7 -2
- package/templates/.claude/rules/MUST-safety.md +14 -0
- package/templates/.claude/skills/pipeline/workflows/auto-dev.yaml +14 -4
- package/templates/guides/git-safety/README.md +97 -0
- package/templates/manifest.json +2 -2
package/README.md
CHANGED
|
@@ -222,7 +222,7 @@ Key rules: R010 (orchestrator never writes files), R009 (parallel execution mand
|
|
|
222
222
|
|
|
223
223
|
---
|
|
224
224
|
|
|
225
|
-
### Guides (
|
|
225
|
+
### Guides (50)
|
|
226
226
|
|
|
227
227
|
Reference documentation covering best practices, architecture decisions, and integration patterns. Located in `guides/` at project root, covering topics from agent design to CI/CD to observability.
|
|
228
228
|
|
|
@@ -279,7 +279,7 @@ your-project/
|
|
|
279
279
|
│ ├── specs/ # Extracted canonical specs
|
|
280
280
|
│ ├── contexts/ # 4 shared context files
|
|
281
281
|
│ └── ontology/ # Knowledge graph for RAG
|
|
282
|
-
└── guides/ #
|
|
282
|
+
└── guides/ # 50 reference documents
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
---
|
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -52,10 +52,15 @@ Types: feat, fix, docs, style, refactor, test, chore
|
|
|
52
52
|
|
|
53
53
|
## Safety Rules
|
|
54
54
|
|
|
55
|
-
- NEVER force push to main/master
|
|
56
|
-
- NEVER reset --hard without confirmation
|
|
55
|
+
- NEVER force push to main/master (use `--force-with-lease` only on feature branches with explicit user approval)
|
|
56
|
+
- NEVER `git reset --hard` without confirmation — verify `git status` shows clean tree OR user explicitly accepts loss
|
|
57
|
+
- NEVER `git checkout -- <path>` / `git restore <path>` without confirmation — uncommitted changes are unrecoverable
|
|
58
|
+
- NEVER `git clean -fd` without prior `git clean -nd` dry-run + user approval
|
|
59
|
+
- NEVER `git branch -D <branch>` without showing `git log <branch>` first if branch has unmerged commits
|
|
57
60
|
- NEVER skip pre-commit hooks without reason
|
|
58
61
|
- ALWAYS create new commits (avoid --amend unless requested)
|
|
62
|
+
- ALWAYS check `git reflog` before declaring work lost — most destructive ops are recoverable for 30 days
|
|
63
|
+
- Reference: R001 Destructive Git Commands section, #1146 (v0.136.0 working tree loss incident)
|
|
59
64
|
|
|
60
65
|
## Push Rules (R016)
|
|
61
66
|
|
|
@@ -11,6 +11,20 @@
|
|
|
11
11
|
| Commands | `rm -rf /` or broad deletes, shutdown/restart, sudo/su, network config changes |
|
|
12
12
|
| External | Access URLs without approval, send user data externally, download/execute unknown scripts |
|
|
13
13
|
|
|
14
|
+
## Destructive Git Commands (Working Tree Loss Risk)
|
|
15
|
+
|
|
16
|
+
The following git commands have caused working tree loss in past sessions (#1146, v0.136.0). REQUIRE explicit user approval per invocation:
|
|
17
|
+
|
|
18
|
+
| Command | Risk | Required Action |
|
|
19
|
+
|---------|------|----------------|
|
|
20
|
+
| `git reset --hard <ref>` (especially to remote/old SHA) | Erases uncommitted + committed local changes | Confirm uncommitted state with `git status`; show ref delta; explicit approval |
|
|
21
|
+
| `git checkout -- <path>` / `git restore <path>` (without `--source`) | Discards uncommitted file changes | Confirm file is intentionally being reverted; explicit approval |
|
|
22
|
+
| `git clean -fd` / `git clean -fdx` | Permanently deletes untracked files (incl. ignored with `-x`) | List files with `git clean -nd` first; explicit approval |
|
|
23
|
+
| `git branch -D <name>` (when branch has unmerged commits) | Loses unmerged work | Show `git log <branch>` first; confirm commits are pushed elsewhere; explicit approval |
|
|
24
|
+
| `git push --force` / `git push --force-with-lease` to shared branches | Rewrites shared history | NEVER on main/master; explicit approval for feature branches with active collaborators |
|
|
25
|
+
|
|
26
|
+
**Recovery hint**: If working tree loss occurs, check `git reflog` immediately — most operations are recoverable within 30 days.
|
|
27
|
+
|
|
14
28
|
## Required Before Destructive Operations
|
|
15
29
|
|
|
16
30
|
Verify target, assess impact scope, check recoverability, get user approval.
|
|
@@ -149,6 +149,17 @@ steps:
|
|
|
149
149
|
prompt: |
|
|
150
150
|
Create a GitHub Release.
|
|
151
151
|
|
|
152
|
+
0. Pre-check (mandatory, delegate to mgr-gitnerd per R010): Detect and remove stale local `release` branch if present.
|
|
153
|
+
The local `release` branch (file ref) conflicts with `release/v*` directory ref namespace.
|
|
154
|
+
mgr-gitnerd executes (force-delete acceptable in automation context; warns if branch has unpushed commits):
|
|
155
|
+
if git show-ref --verify --quiet refs/heads/release; then
|
|
156
|
+
# Check for unpushed commits before force-delete
|
|
157
|
+
if [ -n "$(git log refs/heads/release ^origin/develop --oneline 2>/dev/null)" ]; then
|
|
158
|
+
echo "::warning::Local 'release' branch has unpushed commits — force-deleting anyway"
|
|
159
|
+
fi
|
|
160
|
+
git branch -D release
|
|
161
|
+
fi
|
|
162
|
+
Reference: issue #1141 (v0.135.0 follow-up), mgr-gitnerd MEMORY.md.
|
|
152
163
|
1. Version:
|
|
153
164
|
- No existing tags → v0.1.0
|
|
154
165
|
- Otherwise: semver bump (patch for bugfix, minor for features)
|
|
@@ -159,10 +170,9 @@ steps:
|
|
|
159
170
|
4. Close milestone
|
|
160
171
|
5. Close verify-ready issues with "Fixed in v{version}"
|
|
161
172
|
Label needs-review issues as "Deferred from v{version}"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- Non-npm: direct tag on main (trunk-based)
|
|
173
|
+
6. Adapt release mechanism to project:
|
|
174
|
+
- npm project: PR + merge + npm publish verification
|
|
175
|
+
- Non-npm: direct tag on main (trunk-based)
|
|
166
176
|
description: "Git tag + GitHub Release + close milestone/issues"
|
|
167
177
|
depends_on: deep-verify
|
|
168
178
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Git Safety Guide
|
|
2
|
+
|
|
3
|
+
Reference for safe git operations in autonomous AI agent flows. Born from #1146 (v0.136.0 working tree loss incident).
|
|
4
|
+
|
|
5
|
+
## Destructive Commands Quick Reference
|
|
6
|
+
|
|
7
|
+
| Command | Risk | Required Action |
|
|
8
|
+
|---------|------|----------------|
|
|
9
|
+
| `git reset --hard <ref>` | Erases uncommitted + committed local changes | Confirm `git status` clean; show ref delta; explicit user approval |
|
|
10
|
+
| `git checkout -- <path>` / `git restore <path>` | Discards uncommitted file changes | Confirm intentional revert; explicit approval |
|
|
11
|
+
| `git clean -fd` / `-fdx` | Permanently deletes untracked files | Run `git clean -nd` dry-run first; explicit approval |
|
|
12
|
+
| `git branch -D <name>` (unmerged) | Loses unmerged work | Show `git log <branch>` first; confirm pushed elsewhere |
|
|
13
|
+
| `git push --force` (shared branch) | Rewrites shared history | NEVER on main/master; explicit approval for collaborative branches |
|
|
14
|
+
|
|
15
|
+
## Pre-Flight Checks
|
|
16
|
+
|
|
17
|
+
Before any destructive operation:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git status --porcelain | wc -l # MUST be 0 for safe destructive op
|
|
21
|
+
git stash list # check if work was previously stashed
|
|
22
|
+
git reflog -n 20 # baseline before any history-rewriting op
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Recovery Procedures
|
|
26
|
+
|
|
27
|
+
### From `git reset --hard`
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git reflog # find pre-reset SHA
|
|
31
|
+
git reset --hard <pre-reset-sha> # restore HEAD
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Most operations are recoverable within 30 days (default reflog expiry).
|
|
35
|
+
|
|
36
|
+
### From `git clean -fd`
|
|
37
|
+
|
|
38
|
+
Untracked file deletion is **permanent**. Recovery requires:
|
|
39
|
+
- Editor history (VS Code, JetBrains)
|
|
40
|
+
- Filesystem snapshots (Time Machine, ZFS, btrfs)
|
|
41
|
+
- Container layer cache (if in Docker)
|
|
42
|
+
|
|
43
|
+
### From `git branch -D` (unmerged commits)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git reflog # find branch tip SHA
|
|
47
|
+
git branch <name> <sha> # recreate branch
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### From orphaned commits (no ref)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git fsck --lost-found # find dangling commits
|
|
54
|
+
git show <sha> # inspect candidates
|
|
55
|
+
git branch recovered <sha> # save as branch
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Agent-Specific Rules
|
|
59
|
+
|
|
60
|
+
For AI agents executing git in autonomous flows:
|
|
61
|
+
|
|
62
|
+
1. **Pre-check is mandatory** — never assume "small change"
|
|
63
|
+
2. **Report uncommitted state** — show `git status` output to user before destructive ops
|
|
64
|
+
3. **Stash before reset** — `git stash push -u "pre-reset-<reason>"` is cheap insurance
|
|
65
|
+
4. **Reflog baseline** — capture `git reflog -n 5` before any history-rewriting op
|
|
66
|
+
|
|
67
|
+
## Cross-References
|
|
68
|
+
|
|
69
|
+
- **R001** (`.claude/rules/MUST-safety.md`) — Destructive Git Commands section
|
|
70
|
+
- **mgr-gitnerd** (`.claude/agents/mgr-gitnerd.md`) — Safety Rules section
|
|
71
|
+
- **Issue #1146** — Original v0.136.0 working tree loss incident
|
|
72
|
+
- **mgr-gitnerd memory** (`.claude/agent-memory/mgr-gitnerd/MEMORY.md`) — Incident lessons
|
|
73
|
+
|
|
74
|
+
## Reference Implementation Patterns
|
|
75
|
+
|
|
76
|
+
### Safe reset wrapper (pseudo-code)
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
safe_reset() {
|
|
80
|
+
local target=$1
|
|
81
|
+
local dirty=$(git status --porcelain | wc -l)
|
|
82
|
+
if [ "$dirty" -gt 0 ]; then
|
|
83
|
+
echo "WARNING: $dirty uncommitted change(s). Stash or commit first."
|
|
84
|
+
git status --short
|
|
85
|
+
return 1
|
|
86
|
+
fi
|
|
87
|
+
echo "Reset preview:"
|
|
88
|
+
git log HEAD..$target --oneline
|
|
89
|
+
git log $target..HEAD --oneline
|
|
90
|
+
read -p "Proceed? [y/N] " confirm
|
|
91
|
+
[ "$confirm" = "y" ] && git reset --hard "$target"
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Destructive op detection (advisory)
|
|
96
|
+
|
|
97
|
+
See `.claude/hooks/scripts/git-delegation-guard.sh` for the existing R010 advisory pattern. A future `destructive-git-guard.sh` (T2 from #1146, deferred) will add R001 destructive-op-specific warnings.
|
package/templates/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.136.1",
|
|
3
3
|
"lastUpdated": "2026-05-14T00:00:00.000Z",
|
|
4
4
|
"omcustomMinClaudeCode": "2.1.121",
|
|
5
5
|
"omcustomMinClaudeCodeReason": "Sensitive-path direct Write/Edit on .claude/** under bypassPermissions (R010 deprecation, #1101)",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"name": "guides",
|
|
27
27
|
"path": "guides",
|
|
28
28
|
"description": "Reference documentation",
|
|
29
|
-
"files":
|
|
29
|
+
"files": 50
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"name": "hooks",
|