@trac3er/oh-my-god 2.0.0 → 2.0.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.
Files changed (243) hide show
  1. package/.claude-plugin/marketplace.json +8 -8
  2. package/.claude-plugin/plugin.json +5 -4
  3. package/.claude-plugin/scripts/uninstall.sh +74 -3
  4. package/.claude-plugin/scripts/update.sh +78 -3
  5. package/.coveragerc +26 -0
  6. package/.mcp.json +4 -4
  7. package/CHANGELOG.md +14 -0
  8. package/CODE_OF_CONDUCT.md +27 -0
  9. package/CONTRIBUTING.md +62 -0
  10. package/OMG-setup.sh +1201 -355
  11. package/README.md +77 -56
  12. package/SECURITY.md +25 -0
  13. package/agents/__init__.py +1 -0
  14. package/agents/model_roles.py +196 -0
  15. package/agents/omg-architect-mode.md +3 -5
  16. package/agents/omg-backend-engineer.md +3 -5
  17. package/agents/omg-database-engineer.md +3 -5
  18. package/agents/omg-frontend-designer.md +4 -5
  19. package/agents/omg-implement-mode.md +4 -5
  20. package/agents/omg-infra-engineer.md +3 -5
  21. package/agents/omg-research-mode.md +4 -6
  22. package/agents/omg-security-auditor.md +3 -5
  23. package/agents/omg-testing-engineer.md +3 -5
  24. package/build/lib/yaml.py +321 -0
  25. package/commands/OMG:ai-commit.md +101 -14
  26. package/commands/OMG:arch.md +302 -19
  27. package/commands/OMG:ccg.md +12 -7
  28. package/commands/OMG:compat.md +25 -17
  29. package/commands/OMG:cost.md +173 -13
  30. package/commands/OMG:crazy.md +1 -1
  31. package/commands/OMG:create-agent.md +170 -20
  32. package/commands/OMG:deps.md +235 -17
  33. package/commands/OMG:domain-init.md +1 -1
  34. package/commands/OMG:escalate.md +41 -12
  35. package/commands/OMG:health-check.md +37 -13
  36. package/commands/OMG:init.md +122 -14
  37. package/commands/OMG:project-init.md +1 -1
  38. package/commands/OMG:session-branch.md +76 -9
  39. package/commands/OMG:session-fork.md +42 -5
  40. package/commands/OMG:session-merge.md +124 -8
  41. package/commands/OMG:setup.md +69 -12
  42. package/commands/OMG:stats.md +215 -14
  43. package/commands/OMG:teams.md +19 -10
  44. package/config/lsp_languages.yaml +8 -0
  45. package/hooks/__init__.py +0 -0
  46. package/hooks/_agent_registry.py +423 -0
  47. package/hooks/_analytics.py +291 -0
  48. package/hooks/_budget.py +31 -0
  49. package/hooks/_common.py +569 -0
  50. package/hooks/_compression_optimizer.py +119 -0
  51. package/hooks/_cost_ledger.py +176 -0
  52. package/hooks/_learnings.py +126 -0
  53. package/hooks/_memory.py +103 -0
  54. package/hooks/_protected_context.py +150 -0
  55. package/hooks/_token_counter.py +221 -0
  56. package/hooks/branch_manager.py +236 -0
  57. package/hooks/budget_governor.py +232 -0
  58. package/hooks/circuit-breaker.py +270 -0
  59. package/hooks/compression_feedback.py +254 -0
  60. package/hooks/config-guard.py +216 -0
  61. package/hooks/context_pressure.py +53 -0
  62. package/hooks/credential_store.py +1020 -0
  63. package/hooks/fetch-rate-limits.py +212 -0
  64. package/hooks/firewall.py +48 -0
  65. package/hooks/hashline-formatter-bridge.py +224 -0
  66. package/hooks/hashline-injector.py +273 -0
  67. package/hooks/hashline-validator.py +216 -0
  68. package/hooks/idle-detector.py +95 -0
  69. package/hooks/intentgate-keyword-detector.py +188 -0
  70. package/hooks/magic-keyword-router.py +195 -0
  71. package/hooks/policy_engine.py +505 -0
  72. package/hooks/post-tool-failure.py +19 -0
  73. package/hooks/post-write.py +219 -0
  74. package/hooks/post_write.py +46 -0
  75. package/hooks/pre-compact.py +398 -0
  76. package/hooks/pre-tool-inject.py +98 -0
  77. package/hooks/prompt-enhancer.py +672 -0
  78. package/hooks/quality-runner.py +191 -0
  79. package/hooks/query.py +512 -0
  80. package/hooks/secret-guard.py +61 -0
  81. package/hooks/secret_audit.py +144 -0
  82. package/hooks/session-end-capture.py +137 -0
  83. package/hooks/session-start.py +277 -0
  84. package/hooks/setup_wizard.py +582 -0
  85. package/hooks/shadow_manager.py +297 -0
  86. package/hooks/state_migration.py +225 -0
  87. package/hooks/stop-gate.py +7 -0
  88. package/hooks/stop_dispatcher.py +945 -0
  89. package/hooks/test-validator.py +361 -0
  90. package/hooks/test_generator_hook.py +123 -0
  91. package/hooks/todo-state-tracker.py +114 -0
  92. package/hooks/tool-ledger.py +149 -0
  93. package/hooks/trust_review.py +585 -0
  94. package/hud/omg-hud.mjs +31 -1
  95. package/lab/__init__.py +1 -0
  96. package/lab/pipeline.py +75 -0
  97. package/lab/policies.py +52 -0
  98. package/package.json +7 -18
  99. package/plugins/README.md +33 -61
  100. package/plugins/advanced/commands/OMG:deep-plan.md +3 -3
  101. package/plugins/advanced/commands/OMG:learn.md +1 -1
  102. package/plugins/advanced/commands/OMG:security-review.md +3 -3
  103. package/plugins/advanced/commands/OMG:ship.md +1 -1
  104. package/plugins/advanced/plugin.json +1 -1
  105. package/plugins/core/plugin.json +8 -3
  106. package/plugins/dephealth/__init__.py +0 -0
  107. package/plugins/dephealth/cve_scanner.py +188 -0
  108. package/plugins/dephealth/license_checker.py +135 -0
  109. package/plugins/dephealth/manifest_detector.py +423 -0
  110. package/plugins/dephealth/vuln_analyzer.py +169 -0
  111. package/plugins/testgen/__init__.py +0 -0
  112. package/plugins/testgen/codamosa_engine.py +402 -0
  113. package/plugins/testgen/edge_case_synthesizer.py +184 -0
  114. package/plugins/testgen/framework_detector.py +271 -0
  115. package/plugins/testgen/skeleton_generator.py +219 -0
  116. package/plugins/viz/__init__.py +0 -0
  117. package/plugins/viz/ast_parser.py +139 -0
  118. package/plugins/viz/diagram_generator.py +192 -0
  119. package/plugins/viz/graph_builder.py +444 -0
  120. package/plugins/viz/native_parsers.py +259 -0
  121. package/plugins/viz/regex_parser.py +112 -0
  122. package/pyproject.toml +81 -0
  123. package/rules/contextual/write-verify.md +2 -2
  124. package/rules/core/00-truth.md +1 -1
  125. package/rules/core/01-surgical.md +1 -1
  126. package/rules/core/02-circuit-breaker.md +2 -2
  127. package/rules/core/03-ensemble.md +3 -3
  128. package/rules/core/04-testing.md +3 -3
  129. package/runtime/__init__.py +32 -0
  130. package/runtime/adapters/__init__.py +13 -0
  131. package/runtime/adapters/claude.py +60 -0
  132. package/runtime/adapters/gpt.py +53 -0
  133. package/runtime/adapters/local.py +53 -0
  134. package/runtime/adoption.py +212 -0
  135. package/runtime/business_workflow.py +220 -0
  136. package/runtime/cli_provider.py +85 -0
  137. package/runtime/compat.py +1299 -0
  138. package/runtime/custom_agent_loader.py +366 -0
  139. package/runtime/dispatcher.py +47 -0
  140. package/runtime/ecosystem.py +371 -0
  141. package/runtime/legacy_compat.py +7 -0
  142. package/runtime/mcp_config_writers.py +115 -0
  143. package/runtime/mcp_lifecycle.py +153 -0
  144. package/runtime/mcp_memory_server.py +135 -0
  145. package/runtime/memory_parsers/__init__.py +0 -0
  146. package/runtime/memory_parsers/chatgpt_parser.py +257 -0
  147. package/runtime/memory_parsers/claude_import.py +107 -0
  148. package/runtime/memory_parsers/export.py +97 -0
  149. package/runtime/memory_parsers/gemini_import.py +91 -0
  150. package/runtime/memory_parsers/kimi_import.py +91 -0
  151. package/runtime/memory_store.py +215 -0
  152. package/runtime/omc_compat.py +7 -0
  153. package/runtime/providers/__init__.py +0 -0
  154. package/runtime/providers/codex_provider.py +112 -0
  155. package/runtime/providers/gemini_provider.py +128 -0
  156. package/runtime/providers/kimi_provider.py +151 -0
  157. package/runtime/providers/opencode_provider.py +144 -0
  158. package/runtime/subagent_dispatcher.py +362 -0
  159. package/runtime/team_router.py +1167 -0
  160. package/runtime/tmux_session_manager.py +169 -0
  161. package/scripts/check-omg-compat-contract-snapshot.py +137 -0
  162. package/scripts/check-omg-contract-snapshot.py +12 -0
  163. package/scripts/check-omg-public-ready.py +193 -0
  164. package/scripts/check-omg-standalone-clean.py +103 -0
  165. package/scripts/legacy_to_omg_migrate.py +29 -0
  166. package/scripts/migrate-legacy.py +464 -0
  167. package/scripts/omc_to_omg_migrate.py +12 -0
  168. package/scripts/omg.py +492 -0
  169. package/scripts/settings-merge.py +283 -0
  170. package/scripts/verify-standalone.sh +8 -4
  171. package/settings.json +126 -29
  172. package/templates/profile.yaml +1 -1
  173. package/tools/__init__.py +2 -0
  174. package/tools/browser_consent.py +289 -0
  175. package/tools/browser_stealth.py +481 -0
  176. package/tools/browser_tool.py +448 -0
  177. package/tools/changelog_generator.py +347 -0
  178. package/tools/commit_splitter.py +746 -0
  179. package/tools/config_discovery.py +151 -0
  180. package/tools/config_merger.py +449 -0
  181. package/tools/dashboard_generator.py +300 -0
  182. package/tools/git_inspector.py +298 -0
  183. package/tools/lsp_client.py +275 -0
  184. package/tools/lsp_discovery.py +231 -0
  185. package/tools/lsp_operations.py +392 -0
  186. package/tools/pr_generator.py +404 -0
  187. package/tools/python_repl.py +656 -0
  188. package/tools/python_sandbox.py +609 -0
  189. package/tools/search_providers/__init__.py +77 -0
  190. package/tools/search_providers/brave.py +115 -0
  191. package/tools/search_providers/exa.py +116 -0
  192. package/tools/search_providers/jina.py +104 -0
  193. package/tools/search_providers/perplexity.py +139 -0
  194. package/tools/search_providers/synthetic.py +74 -0
  195. package/tools/session_snapshot.py +736 -0
  196. package/tools/ssh_manager.py +912 -0
  197. package/tools/theme_engine.py +294 -0
  198. package/tools/theme_selector.py +137 -0
  199. package/tools/web_search.py +622 -0
  200. package/yaml.py +321 -0
  201. package/.claude-plugin/scripts/install.sh +0 -9
  202. package/bun.lock +0 -23
  203. package/bunfig.toml +0 -3
  204. package/hooks/_budget.ts +0 -1
  205. package/hooks/_common.ts +0 -63
  206. package/hooks/circuit-breaker.ts +0 -101
  207. package/hooks/config-guard.ts +0 -4
  208. package/hooks/firewall.ts +0 -20
  209. package/hooks/policy_engine.ts +0 -156
  210. package/hooks/post-tool-failure.ts +0 -22
  211. package/hooks/post-write.ts +0 -4
  212. package/hooks/pre-tool-inject.ts +0 -4
  213. package/hooks/prompt-enhancer.ts +0 -46
  214. package/hooks/quality-runner.ts +0 -24
  215. package/hooks/secret-guard.ts +0 -4
  216. package/hooks/session-end-capture.ts +0 -19
  217. package/hooks/session-start.ts +0 -19
  218. package/hooks/shadow_manager.ts +0 -81
  219. package/hooks/stop-gate.ts +0 -22
  220. package/hooks/stop_dispatcher.ts +0 -147
  221. package/hooks/test-generator-hook.ts +0 -4
  222. package/hooks/tool-ledger.ts +0 -27
  223. package/hooks/trust_review.ts +0 -175
  224. package/lab/pipeline.ts +0 -75
  225. package/lab/policies.ts +0 -68
  226. package/runtime/common.ts +0 -111
  227. package/runtime/compat.ts +0 -174
  228. package/runtime/dispatcher.ts +0 -25
  229. package/runtime/ecosystem.ts +0 -186
  230. package/runtime/provider_bootstrap.ts +0 -99
  231. package/runtime/provider_smoke.ts +0 -34
  232. package/runtime/release_readiness.ts +0 -186
  233. package/runtime/team_router.ts +0 -144
  234. package/scripts/check-omg-compat-contract-snapshot.ts +0 -20
  235. package/scripts/check-omg-standalone-clean.ts +0 -12
  236. package/scripts/check-runtime-clean.ts +0 -94
  237. package/scripts/omg.ts +0 -352
  238. package/scripts/settings-merge.ts +0 -93
  239. package/tools/commit_splitter.ts +0 -23
  240. package/tools/git_inspector.ts +0 -18
  241. package/tools/session_snapshot.ts +0 -47
  242. package/trac3er-oh-my-god-2.0.0.tgz +0 -0
  243. package/tsconfig.json +0 -15
@@ -1,26 +1,134 @@
1
1
  ---
2
- description: "Initialize project metadata for OMG on a Bun-first repository."
3
- allowed-tools: Read, Write, Edit, Grep, Glob, Bash(rg:*), Bash(find:*), Bash(bun:*), Bash(git:*)
4
- argument-hint: "[optional project goal]"
2
+ description: "Unified initializer — auto-detects: project setup (if no .omg/state), domain scaffolding (if argument given), or health check."
3
+ allowed-tools: Read, Write, Edit, MultiEdit, Bash(mkdir:*), Bash(cat:*), Bash(find:*), Bash(ls:*), Bash(head:*), Bash(grep:*), Bash(tree:*), Bash(node:*), Bash(python*:*), Bash(tee:*), Grep, Glob
4
+ argument-hint: "[optional: domain name like 'payment', or 'check' for health check]"
5
5
  ---
6
6
 
7
- # /OMG:init
7
+ # /OMG:init — Unified Project & Domain Initializer
8
8
 
9
- Use this to sketch initial project metadata and likely verification commands.
9
+ ## Auto-Detection Logic
10
10
 
11
- ## Suggested defaults
11
+ ```
12
+ if argument is a domain name (e.g. "payment", "user-profile"):
13
+ → DOMAIN INIT (create new domain from existing patterns)
14
+ elif .omg/state directory does not exist:
15
+ → PROJECT INIT (first-time project setup)
16
+ elif .omg/state/profile.yaml exists:
17
+ → HEALTH CHECK (verify everything works, offer upgrades)
18
+ ```
19
+
20
+ ---
21
+
22
+ ## MODE A: PROJECT INIT (no .omg/state found)
23
+
24
+ ### Step 1: Create .omg/state/profile.yaml (MOST IMPORTANT)
25
+ Detect from code. Ask user for anything undetectable.
12
26
 
13
27
  ```yaml
14
- project:
15
- goal: "[describe the product or migration target]"
16
- test_cmd: "[detect: bun test/npm test/cargo test]"
17
- typecheck_cmd: "[detect: bunx tsc --noEmit or equivalent]"
18
- build_cmd: "[detect: bun run build or null]"
28
+ # .omg/state/profile.yaml — injected every session (keep under 20 lines)
29
+ name: "[from package.json/Cargo.toml/pyproject.toml]"
30
+ description: "[1 sentence]"
31
+ repo: "[from git remote -v]"
32
+
33
+ language: "[detect]"
34
+ framework: "[detect]"
35
+ database: "[detect or ask]"
36
+ infra: "[detect from Dockerfile/terraform/etc]"
37
+ key_deps: "[top 5]"
38
+
39
+ conventions:
40
+ naming: "[detect: camelCase/snake_case]"
41
+ test_cmd: "[detect: npm test/pytest/cargo test]"
42
+ lint_cmd: "[detect: eslint/ruff/clippy]"
43
+
44
+ ai_behavior:
45
+ communication: "[ask user: language preference]"
46
+ when_stuck: "Ask user after 2 failed attempts"
47
+ testing: "User-journey focused, not boilerplate"
19
48
  ```
20
49
 
21
- ## Useful inventory command
50
+ ### Step 2: Create knowledge structure + OMG v1 contract dirs
51
+ ```
52
+ mkdir -p .omg/state/ledger .omg/knowledge/decisions .omg/knowledge/patterns .omg/knowledge/rules
53
+ mkdir -p .omg/trust .omg/evidence .omg/shadow .omg/migrations
54
+ ```
55
+
56
+ Copy OMG v1 templates when missing:
57
+ - `.omg/idea.yml`
58
+ - `.omg/policy.yaml`
59
+ - `.omg/runtime.yaml`
60
+
61
+ ### Step 3: Auto-detect quality gate
62
+ ```json
63
+ // .omg/state/quality-gate.json — only include commands that exist
64
+ {
65
+ "format": "[detect: prettier/black/gofmt or null]",
66
+ "lint": "[detect: eslint/ruff/clippy or null]",
67
+ "typecheck": "[detect: tsc/mypy or null]",
68
+ "test": "[detect: npm test/pytest/cargo test or null]"
69
+ }
70
+ ```
71
+
72
+ ### Step 4: Copy relevant contextual rules
73
+ Based on detected project type, copy relevant rules from templates:
74
+ - Web project → security-domains.md, code-hygiene.md
75
+ - Backend → infra-safety.md, dependency-safety.md
76
+ - DDD project → ddd-sdd.md, outside-in.md
77
+
78
+ ### Step 5: Verify
79
+ Run `/OMG:health-check` to confirm setup.
80
+
81
+ ---
82
+
83
+ ## MODE B: DOMAIN INIT (argument = domain name)
84
+
85
+ ### Step 1: Find Reference Pattern
86
+ ```bash
87
+ find . -type f -name "*.ts" -o -name "*.py" | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -10
88
+ ```
89
+ Read the most complete existing domain. Extract:
90
+ - Directory structure (routes, services, models, tests)
91
+ - Naming conventions, error handling, data flow patterns
92
+
93
+ ### Step 2: Define the New Domain
94
+ Ask the user:
95
+ - "What entities does [domain] have?"
96
+ - "What actions can be performed?"
97
+ - "What external services does it talk to?"
98
+ - "What are the business rules?"
99
+
100
+ ### Step 3: Generate Domain Structure
101
+ Match the reference pattern EXACTLY. Create:
102
+ ```
103
+ src/[domain]/
104
+ ├── [domain].model.ts
105
+ ├── [domain].service.ts
106
+ ├── [domain].repository.ts
107
+ ├── [domain].controller.ts (or routes)
108
+ ├── [domain].types.ts
109
+ └── __tests__/
110
+ └── [domain].service.test.ts
111
+ ```
112
+
113
+ ### Step 4: Document the Pattern
114
+ Save to `.omg/knowledge/patterns/[domain]-pattern.md`
115
+
116
+ ---
117
+
118
+ ## MODE C: HEALTH CHECK (already initialized)
119
+
120
+ Run `/OMG:health-check` and additionally:
121
+ - Verify profile.yaml is up-to-date with current project state
122
+ - Check if new contextual rules should be added
123
+ - Offer to update quality-gate.json if tools changed
124
+
125
+ ---
22
126
 
127
+ ## File Write Method
128
+ Use `Write` tool first. If it fails (file exists), fall back to:
23
129
  ```bash
24
- find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) \
25
- | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -10
130
+ cat > .omg/state/profile.yaml << 'EOF'
131
+ [content]
132
+ EOF
26
133
  ```
134
+ Always READ the file after writing to confirm.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: "Alias for /OMG:init (project setup mode). Use /OMG:init instead."
3
- allowed-tools: Read, Write, Edit, MultiEdit, Bash(mkdir:*), Bash(cat:*), Bash(find:*), Bash(ls:*), Bash(head:*), Bash(grep:*), Bash(tree:*), Bash(bun:*), Bash(tee:*), Grep, Glob
3
+ allowed-tools: Read, Write, Edit, MultiEdit, Bash(mkdir:*), Bash(cat:*), Bash(find:*), Bash(ls:*), Bash(head:*), Bash(grep:*), Bash(tree:*), Bash(node:*), Bash(python*:*), Bash(tee:*), Grep, Glob
4
4
  argument-hint: "[optional: project description]"
5
5
  ---
6
6
 
@@ -1,18 +1,85 @@
1
1
  ---
2
- description: "Create or switch OMG state branches."
3
- allowed-tools: Read, Write, Edit, Bash(bun:*)
2
+ description: "Create or manage OMG state branches for experimental workflows."
3
+ allowed-tools: Read, Write, Edit, Bash
4
4
  argument-hint: "--name <branch-name> [--from <snapshot_id>]"
5
5
  ---
6
6
 
7
- # /OMG:session-branch
7
+ # /OMG:session-branch — Branch OMG State
8
8
 
9
- OMG state branches are stored under `.omg/state/session-snapshots/`.
9
+ Create a named branch of the current OMG state for experimentation or parallel exploration.
10
10
 
11
- ## Examples
11
+ ## Important
12
12
 
13
+ Branching is **OMG state only** — it captures and restores `.omg/state/` directory contents. It does **not** fork the conversation, context window, or Claude session. Think of it as a checkpoint you can name and switch between.
14
+
15
+ ## Usage
16
+
17
+ ```
18
+ /OMG:session-branch --name "experiment"
19
+ /OMG:session-branch --name "refactor-v2" --from 20260302_143000_baseline
20
+ ```
21
+
22
+ ## What It Does
23
+
24
+ 1. Creates a snapshot of the current `.omg/state/` directory (or restores a specified snapshot)
25
+ 2. Writes branch metadata to `.omg/state/branches/<name>.json`
26
+ 3. Updates `.omg/state/current_branch.json` to track the active branch
27
+
28
+ ## Branch Metadata
29
+
30
+ Each branch stores:
31
+
32
+ | Field | Description |
33
+ |-------|-------------|
34
+ | `name` | Branch name |
35
+ | `snapshot_id` | Associated snapshot ID |
36
+ | `created_at` | ISO timestamp of creation |
37
+ | `parent_branch` | Branch that was active when this branch was created |
38
+ | `status` | Branch status (`active`) |
39
+
40
+ ## Managing Branches
41
+
42
+ ```
43
+ # List all branches
44
+ python3 tools/session_snapshot.py branches
45
+
46
+ # Switch to a branch (restores its snapshot)
47
+ python3 tools/session_snapshot.py switch experiment
48
+
49
+ # Create branch from specific snapshot
50
+ python3 tools/session_snapshot.py branch my-branch --from 20260302_143000_baseline
51
+ ```
52
+
53
+ ## Feature Flag
54
+
55
+ Branching is gated behind `OMG_BRANCHING_ENABLED` (default: `False`).
56
+
57
+ Enable via environment variable:
13
58
  ```bash
14
- bun tools/session_snapshot.ts branches
15
- bun tools/session_snapshot.ts switch experiment
16
- bun tools/session_snapshot.ts branch my-branch --from 20260302_143000_baseline
17
- bun tools/session_snapshot.ts switch baseline
59
+ export OMG_BRANCHING_ENABLED=true
60
+ ```
61
+
62
+ Or in `settings.json`:
63
+ ```json
64
+ {
65
+ "_omg": {
66
+ "features": {
67
+ "BRANCHING": true
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Example Workflow
74
+
75
+ ```
76
+ # 1. Create a baseline branch
77
+ /OMG:session-branch --name "baseline"
78
+
79
+ # 2. Do some experimental work...
80
+ # 3. Create experiment branch to save progress
81
+ /OMG:session-branch --name "experiment-auth"
82
+
83
+ # 4. Switch back to baseline if experiment didn't work
84
+ python3 tools/session_snapshot.py switch baseline
18
85
  ```
@@ -1,16 +1,53 @@
1
1
  ---
2
2
  description: "Fork OMG state from a specific snapshot checkpoint."
3
- allowed-tools: Read, Write, Edit, Bash(bun:*)
3
+ allowed-tools: Read, Write, Edit, Bash
4
4
  argument-hint: "--from <snapshot_id> --name <fork-name>"
5
5
  ---
6
6
 
7
- # /OMG:session-fork
7
+ # /OMG:session-fork — Fork OMG State from Checkpoint
8
8
 
9
- Forking is OMG state only. It restores `.omg/state/` snapshot data and starts a new named branch from that checkpoint.
9
+ Create a new branch from a specific snapshot checkpoint. This is a convenience wrapper around `/OMG:session-branch` that always requires a source snapshot.
10
+
11
+ ## Important
12
+
13
+ Forking is **OMG state only** — it restores a previous `.omg/state/` snapshot and creates a new named branch from it. It does **not** fork the conversation or create a parallel Claude session.
14
+
15
+ ## Usage
16
+
17
+ ```
18
+ /OMG:session-fork --from 20260302_143000_baseline --name "alt-approach"
19
+ ```
20
+
21
+ ## What It Does
22
+
23
+ 1. Looks up the specified snapshot by ID
24
+ 2. Restores that snapshot to `.omg/state/`
25
+ 3. Creates a new branch with the given name pointing to that snapshot
26
+ 4. Updates `.omg/state/current_branch.json`
27
+
28
+ ## When to Use Fork vs Branch
29
+
30
+ | Action | Use Case |
31
+ |--------|----------|
32
+ | `/OMG:session-branch --name X` | Save current state as a named branch |
33
+ | `/OMG:session-fork --from S --name X` | Go back to snapshot S and start a new exploration path |
10
34
 
11
35
  ## Example
12
36
 
13
- ```bash
14
- bun tools/session_snapshot.ts list
37
+ ```
38
+ # List available snapshots to find a good fork point
39
+ python3 tools/session_snapshot.py list
40
+
41
+ # Fork from a previous checkpoint
15
42
  /OMG:session-fork --from 20260302_100000_pre-refactor --name "approach-b"
43
+
44
+ # Continue working from that earlier state...
45
+ ```
46
+
47
+ ## Feature Flag
48
+
49
+ Forking shares the `OMG_BRANCHING_ENABLED` feature flag with `/OMG:session-branch` (default: `False`).
50
+
51
+ ```bash
52
+ export OMG_BRANCHING_ENABLED=true
16
53
  ```
@@ -1,18 +1,134 @@
1
1
  ---
2
2
  description: "Merge OMG state branches together with conflict detection."
3
- allowed-tools: Read, Write, Edit, Bash(bun:*)
3
+ allowed-tools: Read, Write, Edit, Bash
4
4
  argument-hint: "--from <source-branch> [--into <target-branch>] [--preview]"
5
5
  ---
6
6
 
7
- # /OMG:session-merge
7
+ # /OMG:session-merge — Merge OMG State Branches
8
8
 
9
- Merge one OMG state branch into another with preview support.
9
+ Merge one OMG state branch into another with automatic conflict detection.
10
10
 
11
- ## Examples
11
+ ## Important
12
12
 
13
+ Merging is **OMG state only** — it merges branch metadata (`.omg/state/branches/<name>.json`). It does **not** merge conversations, context windows, or file system state. Think of it as combining the tracked state from two named branches.
14
+
15
+ ## Usage
16
+
17
+ ```
18
+ /OMG:session-merge --from "experiment"
19
+ /OMG:session-merge --from "experiment" --into "main"
20
+ /OMG:session-merge --from "experiment" --preview
21
+ ```
22
+
23
+ ## What It Does
24
+
25
+ 1. Loads the source and target branch metadata as flat JSON dicts
26
+ 2. Detects conflicts (keys present in both branches with different values)
27
+ 3. If `--preview`: returns conflict report without applying changes
28
+ 4. If no conflicts: applies source changes on top of target (last-write-wins)
29
+ 5. Marks the source branch as `status: "merged"` in its metadata file
30
+ 6. Updates `.omg/state/current_branch.json` to the target branch
31
+
32
+ ## Conflict Detection
33
+
34
+ A **value_conflict** occurs when both branches have the same key but different values. When conflicts are found, the merge is **aborted** — you must resolve conflicts manually before merging.
35
+
36
+ Conflict report format:
37
+
38
+ ```json
39
+ {
40
+ "key": "snapshot_id",
41
+ "source_value": "20260302_150000_experiment",
42
+ "target_value": "20260302_140000_main",
43
+ "conflict_type": "value_conflict"
44
+ }
45
+ ```
46
+
47
+ ## Preview Mode
48
+
49
+ Use `--preview` to see what a merge would do without applying changes:
50
+
51
+ ```
52
+ python3 tools/session_snapshot.py merge-preview experiment --into main
53
+ ```
54
+
55
+ Returns:
56
+
57
+ ```json
58
+ {
59
+ "source": "experiment",
60
+ "target": "main",
61
+ "conflicts": [],
62
+ "changes": 2,
63
+ "preview": true
64
+ }
65
+ ```
66
+
67
+ ## CLI Commands
68
+
69
+ ```
70
+ # Merge source into target
71
+ python3 tools/session_snapshot.py merge experiment --into main
72
+
73
+ # Preview merge without applying
74
+ python3 tools/session_snapshot.py merge-preview experiment --into main
75
+
76
+ # Merge into default target (main)
77
+ python3 tools/session_snapshot.py merge experiment
78
+ ```
79
+
80
+ ## Feature Flag
81
+
82
+ Merging is gated behind `OMG_MERGE_ENABLED` (default: `False`).
83
+
84
+ Enable via environment variable:
13
85
  ```bash
14
- bun tools/session_snapshot.ts merge-preview experiment --into main
15
- bun tools/session_snapshot.ts merge experiment --into main
16
- bun tools/session_snapshot.ts merge experiment
17
- bun tools/session_snapshot.ts branches
86
+ export OMG_MERGE_ENABLED=true
87
+ ```
88
+
89
+ Or in `settings.json`:
90
+ ```json
91
+ {
92
+ "_omg": {
93
+ "features": {
94
+ "MERGE": true
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ ## Merge Behavior
101
+
102
+ | Scenario | Result |
103
+ |----------|--------|
104
+ | No conflicts | Source state overlaid on target (last-write-wins) |
105
+ | Conflicts found | Merge aborted, conflicts returned |
106
+ | Source branch missing | Error returned |
107
+ | Target branch missing | Error returned |
108
+ | Feature flag disabled | `{"skipped": true}` |
109
+
110
+ ## After Merge
111
+
112
+ - The **target** branch is updated with merged state
113
+ - The **source** branch status changes to `"merged"` (not deleted)
114
+ - `current_branch.json` is updated to the target branch
115
+ - Source branch remains accessible for reference
116
+
117
+ ## Example Workflow
118
+
119
+ ```
120
+ # 1. Create branches
121
+ /OMG:session-branch --name "main"
122
+ /OMG:session-branch --name "experiment"
123
+
124
+ # 2. Do experimental work on "experiment" branch...
125
+
126
+ # 3. Preview the merge
127
+ /OMG:session-merge --from "experiment" --preview
128
+
129
+ # 4. If no conflicts, apply the merge
130
+ /OMG:session-merge --from "experiment" --into "main"
131
+
132
+ # 5. Verify merge
133
+ python3 tools/session_snapshot.py branches
18
134
  ```
@@ -1,22 +1,79 @@
1
1
  ---
2
- description: "Interactive setup for the Bun runtime, provider status, and Claude hook installation."
3
- allowed-tools: Read, Write, Edit, Bash(bun:*), Bash(ls:*), Bash(grep:*)
4
- argument-hint: "[optional: --non-interactive for CI mode]"
2
+ description: "Native OMG setup and adoption flow for supported hosts"
3
+ allowed-tools: Read, Write, Edit, Bash(python*:*), Bash(ls:*), Bash(grep:*)
4
+ argument-hint: "[optional: --non-interactive, --mode omg-only|coexist, --preset safe|balanced|interop|labs]"
5
5
  ---
6
6
 
7
7
  # /OMG:setup
8
8
 
9
- Guided setup for the Bun runtime.
9
+ Feature-gated: requires `OMG_SETUP_ENABLED=1` or `settings.json._omg.features.SETUP: true`.
10
10
 
11
- ## Covers
11
+ ## Overview
12
12
 
13
- - Bun availability and version
14
- - provider detection and status via `runtime/provider_bootstrap.ts`
15
- - standalone install or plugin install through `OMG-setup.sh`
16
- - settings merge and hook registration
13
+ Native OMG setup for Claude Code, Codex, OpenCode, and other supported CLIs.
14
+ The command keeps migration logic internal and focuses the user on a small adoption flow:
17
15
 
18
- ## Non-interactive mode
16
+ 1. Detect supported CLIs.
17
+ 2. Detect overlapping ecosystems.
18
+ 3. Recommend an adoption mode.
19
+ 4. Apply an OMG preset.
20
+ 5. Configure MCP and save preferences.
19
21
 
20
- ```bash
21
- ./OMG-setup.sh install --non-interactive
22
+ ## Wizard Flow
23
+
24
+ ```text
25
+ Step 1: Detect CLIs
26
+ - codex
27
+ - gemini
28
+ - opencode
29
+ - kimi
30
+
31
+ Step 2: Detect adoption context
32
+ - OMC-style markers
33
+ - OMX-style markers
34
+ - Superpowers-style markers
35
+
36
+ Step 3: Choose mode
37
+ - OMG-only (recommended)
38
+ - coexist
39
+
40
+ Step 4: Choose preset
41
+ - safe
42
+ - balanced
43
+ - interop
44
+ - labs
45
+
46
+ Step 5: Configure MCP and persist preferences
47
+ - writes .mcp.json
48
+ - writes .omg/state/cli-config.yaml
49
+ - writes .omg/state/adoption-report.json
22
50
  ```
51
+
52
+ ## Modes
53
+
54
+ `OMG-only`
55
+ - Recommended default.
56
+ - OMG becomes the main hooks, HUD, MCP, and orchestration layer.
57
+
58
+ `coexist`
59
+ - Advanced mode.
60
+ - OMG avoids destructive overlap and keeps third-party command namespaces intact where possible.
61
+
62
+ ## Output
63
+
64
+ The command emits a final summary that includes:
65
+
66
+ - CLI detection results
67
+ - auth status
68
+ - MCP configuration status
69
+ - selected preset
70
+ - selected adoption mode
71
+ - adoption report path
72
+
73
+ ## Public Path
74
+
75
+ The public OMG journey is:
76
+
77
+ 1. install for your host
78
+ 2. run `/OMG:setup`
79
+ 3. run `/OMG:crazy <goal>`