oh-my-customcode 0.136.0 → 0.136.2
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 +21 -20
- 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.
|
|
@@ -88,25 +88,11 @@ steps:
|
|
|
88
88
|
- All Agent tool calls MUST pass mode: "bypassPermissions" to prevent permission prompts during unattended execution
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
##
|
|
91
|
+
## Sensitive Path Handling (CC v2.1.121+)
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
Direct Write/Edit/Bash on `.claude/**` is permitted under `mode: "bypassPermissions"` as of CC v2.1.121 (#1101). The legacy `/tmp/*.sh` bypass is no longer required. Structural changes (new agents/skills) still go through mgr-creator with R017 verification.
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
1. Write(/tmp/fix-{topic}.sh) — script contents may use heredoc/sed/cp targeting .claude/
|
|
97
|
-
2. Bash(bash /tmp/fix-{topic}.sh) — Bash target is /tmp/, not .claude/
|
|
98
|
-
3. Read or Bash(head/grep) on .claude/ paths is fine (Read tool sensitive-path exempt; Bash on .claude/ is also exempt for some commands but to stay safe always use /tmp script for any sed/cat/wc on .claude/).
|
|
99
|
-
|
|
100
|
-
Rationale: CC sensitive-path check inspects tool-call target paths but does NOT audit script-internal file operations. Direct Write/Edit/Bash on .claude/ triggers user approval prompts even with bypassPermissions, breaking unattended automation.
|
|
101
|
-
|
|
102
|
-
Use this pattern for:
|
|
103
|
-
- Any documentation fix in .claude/
|
|
104
|
-
- Any frontmatter change
|
|
105
|
-
- Any read-only measurement / inspection / counting
|
|
106
|
-
- Count synchronization between source and templates
|
|
107
|
-
- Structural changes (new agents/skills) MUST still go through mgr-creator with R017 verification, AND mgr-creator itself uses /tmp bypass for the file writes
|
|
108
|
-
|
|
109
|
-
References: #1052, #1016 (v0.111.1 origin), #1046 (v0.116.1 delegation directive loss fix), feedback_sensitive_path_tmp_bypass.md memory
|
|
95
|
+
For CC < v2.1.121 see git history for the legacy bypass pattern.
|
|
110
96
|
|
|
111
97
|
## Local CI-mimic verification (MUST run before marking implement done)
|
|
112
98
|
|
|
@@ -160,9 +146,24 @@ steps:
|
|
|
160
146
|
git branch -D release
|
|
161
147
|
fi
|
|
162
148
|
Reference: issue #1141 (v0.135.0 follow-up), mgr-gitnerd MEMORY.md.
|
|
163
|
-
|
|
149
|
+
|
|
150
|
+
1. Version bump (mandatory):
|
|
151
|
+
Orchestrator delegates to mgr-updater (R010). mgr-updater executes the following atomic edits:
|
|
152
|
+
Determine NEW version per semver rules below.
|
|
153
|
+
npm project (package.json exists):
|
|
154
|
+
a. package.json: jq '.version = "<NEW>"' package.json > package.json.tmp && mv package.json.tmp package.json
|
|
155
|
+
b. templates/manifest.json: jq '.version = "<NEW>"' templates/manifest.json > templates/manifest.json.tmp && mv templates/manifest.json.tmp templates/manifest.json
|
|
156
|
+
c. mgr-gitnerd commit: "chore(release): bump to v<NEW>"
|
|
157
|
+
d. mgr-gitnerd push develop
|
|
158
|
+
e. mandatory verification (with existence guard for partial-update safety):
|
|
159
|
+
[ -f scripts/verify-version-sync.sh ] && bash scripts/verify-version-sync.sh || echo "::warning::verify-version-sync.sh not found, version sync verification skipped"
|
|
160
|
+
(verify-version-sync.sh 가 exit 1 시 release 단계 halt)
|
|
161
|
+
|
|
162
|
+
Version decision (semver):
|
|
164
163
|
- No existing tags → v0.1.0
|
|
165
|
-
-
|
|
164
|
+
- Previous tag exists → patch (bugfix) / minor (features) / major (breaking)
|
|
165
|
+
- Previous tag is ahead of source version (e.g., tag v0.136.1, package.json 0.136.0): use next available skip-version (0.136.2)
|
|
166
|
+
|
|
166
167
|
2. Release notes via omcustom-release-notes skill
|
|
167
168
|
3. Delegate to mgr-gitnerd:
|
|
168
169
|
- git tag + push
|
|
@@ -173,7 +174,7 @@ steps:
|
|
|
173
174
|
6. Adapt release mechanism to project:
|
|
174
175
|
- npm project: PR + merge + npm publish verification
|
|
175
176
|
- Non-npm: direct tag on main (trunk-based)
|
|
176
|
-
description: "Git tag + GitHub Release + close milestone/issues"
|
|
177
|
+
description: "Git tag + GitHub Release + close milestone/issues (with mandatory version sync verification)"
|
|
177
178
|
depends_on: deep-verify
|
|
178
179
|
|
|
179
180
|
- name: ci-check
|
|
@@ -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.136.
|
|
2
|
+
"version": "0.136.2",
|
|
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",
|