codeforge-dev 1.14.2 → 2.0.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.
Files changed (128) hide show
  1. package/{.devcontainer/config/defaults → .codeforge/config}/ccstatusline-settings.json +44 -6
  2. package/.codeforge/config/main-system-prompt.md +412 -0
  3. package/.codeforge/config/orchestrator-system-prompt.md +333 -0
  4. package/{.devcontainer/config/defaults → .codeforge/config}/settings.json +7 -2
  5. package/{.devcontainer/config → .codeforge}/file-manifest.json +15 -9
  6. package/{.devcontainer → .codeforge/scripts}/connect-external-terminal.sh +3 -1
  7. package/.devcontainer/.env.example +17 -5
  8. package/.devcontainer/.secrets.example +3 -0
  9. package/.devcontainer/CHANGELOG.md +215 -0
  10. package/.devcontainer/CLAUDE.md +26 -43
  11. package/.devcontainer/README.md +35 -20
  12. package/.devcontainer/devcontainer.json +36 -17
  13. package/.devcontainer/features/agent-browser/install.sh +3 -0
  14. package/.devcontainer/features/ast-grep/install.sh +3 -0
  15. package/.devcontainer/features/biome/install.sh +3 -0
  16. package/.devcontainer/features/ccburn/install.sh +2 -0
  17. package/.devcontainer/features/ccms/install.sh +2 -0
  18. package/.devcontainer/features/ccstatusline/README.md +7 -6
  19. package/.devcontainer/features/ccstatusline/install.sh +9 -4
  20. package/.devcontainer/features/ccusage/install.sh +2 -0
  21. package/.devcontainer/features/chromaterm/chromaterm.yml +2 -2
  22. package/.devcontainer/features/chromaterm/install.sh +2 -0
  23. package/.devcontainer/features/claude-code-native/README.md +47 -0
  24. package/.devcontainer/features/claude-code-native/devcontainer-feature.json +29 -0
  25. package/.devcontainer/features/claude-code-native/install.sh +131 -0
  26. package/.devcontainer/features/claude-monitor/install.sh +2 -0
  27. package/.devcontainer/features/claude-session-dashboard/README.md +2 -2
  28. package/.devcontainer/features/claude-session-dashboard/install.sh +3 -0
  29. package/.devcontainer/features/dprint/install.sh +2 -0
  30. package/.devcontainer/features/hadolint/install.sh +2 -0
  31. package/.devcontainer/features/kitty-terminfo/README.md +3 -1
  32. package/.devcontainer/features/kitty-terminfo/install.sh +2 -0
  33. package/.devcontainer/features/lsp-servers/install.sh +4 -0
  34. package/.devcontainer/features/mcp-qdrant/CHANGES.md +3 -3
  35. package/.devcontainer/features/mcp-qdrant/README.md +1 -0
  36. package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +1 -1
  37. package/.devcontainer/features/mcp-qdrant/install.sh +9 -2
  38. package/.devcontainer/features/mcp-qdrant/poststart-hook.sh +9 -2
  39. package/.devcontainer/features/notify-hook/devcontainer-feature.json +1 -1
  40. package/.devcontainer/features/notify-hook/install.sh +2 -0
  41. package/.devcontainer/features/ruff/install.sh +2 -0
  42. package/.devcontainer/features/shellcheck/install.sh +2 -0
  43. package/.devcontainer/features/shfmt/install.sh +2 -0
  44. package/.devcontainer/features/tmux/README.md +3 -3
  45. package/.devcontainer/features/tmux/install.sh +3 -1
  46. package/.devcontainer/features/tree-sitter/install.sh +4 -0
  47. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +27 -11
  48. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/README.md +20 -6
  49. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/architect.md +182 -29
  50. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/bash-exec.md +9 -0
  51. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/claude-guide.md +13 -4
  52. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/debug-logs.md +24 -5
  53. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/dependency-analyst.md +16 -5
  54. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/documenter.md +412 -0
  55. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/explorer.md +18 -6
  56. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/generalist.md +36 -10
  57. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/git-archaeologist.md +10 -1
  58. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/implementer.md +260 -0
  59. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/investigator.md +262 -0
  60. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/migrator.md +10 -0
  61. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/perf-profiler.md +21 -5
  62. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/refactorer.md +18 -8
  63. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/researcher.md +23 -5
  64. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/security-auditor.md +20 -6
  65. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/spec-writer.md +12 -0
  66. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/statusline-config.md +12 -2
  67. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/test-writer.md +22 -7
  68. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/scripts/guard-readonly-bash.py +9 -5
  69. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/scripts/redirect-builtin-agents.py +2 -5
  70. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/README.md +1 -1
  71. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/advisory-test-runner.py +4 -2
  72. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/README.md +3 -2
  73. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/block-dangerous.py +89 -15
  74. package/.devcontainer/plugins/devs-marketplace/plugins/git-workflow/.claude-plugin/plugin.json +7 -0
  75. package/.devcontainer/plugins/devs-marketplace/plugins/git-workflow/README.md +125 -0
  76. package/.devcontainer/plugins/devs-marketplace/plugins/git-workflow/skills/pr-review/SKILL.md +325 -0
  77. package/.devcontainer/plugins/devs-marketplace/plugins/git-workflow/skills/ship/SKILL.md +314 -0
  78. package/.devcontainer/plugins/devs-marketplace/plugins/prompt-snippets/.claude-plugin/plugin.json +5 -0
  79. package/.devcontainer/plugins/devs-marketplace/plugins/prompt-snippets/README.md +52 -0
  80. package/.devcontainer/plugins/devs-marketplace/plugins/prompt-snippets/skills/ps/SKILL.md +37 -0
  81. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/README.md +2 -2
  82. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/guard-protected-bash.py +80 -6
  83. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/guard-protected.py +4 -4
  84. package/.devcontainer/plugins/devs-marketplace/plugins/session-context/README.md +30 -14
  85. package/.devcontainer/plugins/devs-marketplace/plugins/session-context/hooks/hooks.json +13 -1
  86. package/.devcontainer/plugins/devs-marketplace/plugins/session-context/scripts/collect-session-edits.py +44 -0
  87. package/.devcontainer/plugins/devs-marketplace/plugins/session-context/scripts/commit-reminder.py +89 -10
  88. package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/.claude-plugin/plugin.json +1 -1
  89. package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/README.md +19 -11
  90. package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/scripts/skill-suggester.py +476 -282
  91. package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/team/SKILL.md +4 -4
  92. package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/worktree/SKILL.md +227 -0
  93. package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/worktree/references/manual-worktree-commands.md +238 -0
  94. package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/worktree/references/parallel-workflow-patterns.md +228 -0
  95. package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/skills/spec-build/SKILL.md +2 -2
  96. package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/scripts/ticket-linker.py +2 -2
  97. package/.devcontainer/plugins/devs-marketplace/plugins/workspace-scope-guard/README.md +1 -1
  98. package/.devcontainer/plugins/devs-marketplace/plugins/workspace-scope-guard/scripts/guard-workspace-scope.py +69 -31
  99. package/.devcontainer/scripts/check-setup.sh +5 -3
  100. package/.devcontainer/scripts/preflight.sh +113 -0
  101. package/.devcontainer/scripts/setup-aliases.sh +13 -8
  102. package/.devcontainer/scripts/setup-auth.sh +46 -0
  103. package/.devcontainer/scripts/setup-config.sh +29 -10
  104. package/.devcontainer/scripts/setup-migrate-claude.sh +80 -0
  105. package/.devcontainer/scripts/setup-migrate-codeforge.sh +60 -0
  106. package/.devcontainer/scripts/setup-plugins.sh +5 -5
  107. package/.devcontainer/scripts/setup-projects.sh +4 -2
  108. package/.devcontainer/scripts/setup-terminal.sh +3 -1
  109. package/.devcontainer/scripts/setup-update-claude.sh +22 -27
  110. package/.devcontainer/scripts/setup.sh +78 -5
  111. package/LICENSE.txt +14 -0
  112. package/README.md +82 -7
  113. package/package.json +4 -1
  114. package/setup.js +392 -21
  115. package/.devcontainer/config/defaults/main-system-prompt.md +0 -664
  116. package/.devcontainer/docs/configuration-reference.md +0 -93
  117. package/.devcontainer/docs/keybindings.md +0 -100
  118. package/.devcontainer/docs/optional-features.md +0 -64
  119. package/.devcontainer/docs/plugins.md +0 -176
  120. package/.devcontainer/docs/troubleshooting.md +0 -128
  121. package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/doc-writer.md +0 -334
  122. package/.devcontainer/scripts/setup-symlink-claude.sh +0 -36
  123. /package/{.devcontainer/config/defaults → .codeforge/config}/keybindings.json +0 -0
  124. /package/{.devcontainer/config/defaults → .codeforge/config}/rules/session-search.md +0 -0
  125. /package/{.devcontainer/config/defaults → .codeforge/config}/rules/spec-workflow.md +0 -0
  126. /package/{.devcontainer/config/defaults → .codeforge/config}/rules/workspace-scope.md +0 -0
  127. /package/{.devcontainer/config/defaults → .codeforge/config}/writing-system-prompt.md +0 -0
  128. /package/{.devcontainer → .codeforge/scripts}/connect-external-terminal.ps1 +0 -0
@@ -0,0 +1,228 @@
1
+ # Parallel Workflow Patterns
2
+
3
+ Worktree usage patterns for multi-context development, agent orchestration, and lifecycle customization.
4
+
5
+ ---
6
+
7
+ ## Pattern 1: Feature + Review
8
+
9
+ Work on a feature in one worktree while reviewing a PR in another.
10
+
11
+ **Setup:**
12
+ ```bash
13
+ # Main checkout: feature work
14
+ # New worktree: PR review
15
+ git worktree add /workspaces/projects/.worktrees/review-pr-123 -b review/pr-123
16
+ cd /workspaces/projects/.worktrees/review-pr-123
17
+ git fetch origin pull/123/head:review/pr-123
18
+ git checkout review/pr-123
19
+ ```
20
+
21
+ **Workflow:**
22
+ 1. Continue feature work in the main checkout
23
+ 2. Switch to the review worktree to read, test, and comment on the PR
24
+ 3. No stashing, no context loss
25
+ 4. Remove review worktree after PR is merged
26
+
27
+ **When to use:** Long-running feature work that cannot be interrupted, combined with review responsibilities.
28
+
29
+ ---
30
+
31
+ ## Pattern 2: Safe Experimentation
32
+
33
+ Try a risky refactor or architectural change without affecting the working checkout.
34
+
35
+ **Setup:**
36
+ ```bash
37
+ claude --worktree spike-new-architecture
38
+ # or
39
+ EnterWorktree: spike-new-architecture
40
+ ```
41
+
42
+ **Workflow:**
43
+ 1. Experiment freely in the worktree — break things, try approaches
44
+ 2. If the experiment succeeds: commit, create PR
45
+ 3. If it fails: exit the session → Claude auto-removes the worktree (no changes kept)
46
+ 4. Main checkout is untouched regardless of outcome
47
+
48
+ **When to use:** Evaluating whether an approach works before committing to it. Especially useful for refactors that touch many files.
49
+
50
+ ---
51
+
52
+ ## Pattern 3: Agent Swarm
53
+
54
+ Multiple Claude Code sessions working in parallel, each in their own worktree.
55
+
56
+ **Setup (manual):**
57
+ ```bash
58
+ # Terminal 1
59
+ claude --worktree feature-auth --tmux
60
+
61
+ # Terminal 2
62
+ claude --worktree feature-search --tmux
63
+
64
+ # Terminal 3
65
+ claude --worktree fix-tests --tmux
66
+ ```
67
+
68
+ **Setup (via agent teams):**
69
+ Agents with `isolation: worktree` in their frontmatter (refactorer, test-writer, migrator, documenter, implementer) automatically get worktrees when spawned via the `Task` tool. The lead agent coordinates, and each teammate operates in its own isolated copy.
70
+
71
+ **Workflow:**
72
+ 1. Each agent/session works on independent files
73
+ 2. Changes stay isolated until explicitly merged
74
+ 3. Reduced conflict risk when file ownership is respected
75
+ 4. After each session completes, review changes via PR
76
+
77
+ **When to use:** Large tasks that decompose into independent workstreams. Effective for feature builds, migrations, or test suites where each agent owns a different set of files.
78
+
79
+ **File ownership rule:** Assign each parallel session/agent to a distinct set of files. Two agents editing the same file causes merge conflicts that are difficult to resolve.
80
+
81
+ ---
82
+
83
+ ## Pattern 4: Hotfix While Mid-Feature
84
+
85
+ An urgent production bug arrives while deep in unfinished feature work.
86
+
87
+ **Without worktrees:**
88
+ ```bash
89
+ git stash # hope you remember what's stashed
90
+ git checkout main
91
+ # fix the bug
92
+ git checkout feature-branch
93
+ git stash pop # hope there are no conflicts
94
+ ```
95
+
96
+ **With worktrees:**
97
+ ```bash
98
+ claude --worktree hotfix-critical-bug
99
+ # fix the bug in the worktree, commit, create PR
100
+ # exit → worktree cleaned up
101
+ # continue feature work — never interrupted
102
+ ```
103
+
104
+ **When to use:** Anytime urgent work arrives while mid-task. The worktree avoids the stash-switch-pop dance entirely.
105
+
106
+ ---
107
+
108
+ ## Pattern 5: Long-Running Migration
109
+
110
+ Incremental migration work spread across multiple sessions.
111
+
112
+ **Setup:**
113
+ ```bash
114
+ git worktree add /workspaces/projects/.worktrees/migrate-v2 -b migrate/v2-upgrade
115
+ ```
116
+
117
+ **Workflow:**
118
+ 1. Work on the migration across multiple Claude sessions using `claude --resume`
119
+ 2. The worktree persists between sessions (not auto-cleaned because it has changes)
120
+ 3. Make incremental commits as milestones are reached
121
+ 4. When migration is complete, create PR from the worktree branch
122
+ 5. Clean up after merge
123
+
124
+ **When to use:** Multi-day migrations where the work cannot be completed in a single session. Keep the worktree alive until the migration PR is merged.
125
+
126
+ ---
127
+
128
+ ## Anti-Patterns
129
+
130
+ ### Too Many Worktrees
131
+
132
+ **Problem:** Five or more active worktrees with partially-complete work scattered across them.
133
+
134
+ **Consequence:** Cognitive overhead of tracking what's where. Dependency directories (`node_modules/`, `.venv/`) duplicated across worktrees consume disk space.
135
+
136
+ **Guideline:** Limit to 2-3 active worktrees. Finish and clean up before starting new ones.
137
+
138
+ ### Forgetting Cleanup
139
+
140
+ **Problem:** Worktrees accumulate after sessions end. `git worktree list` shows stale entries.
141
+
142
+ **Consequence:** Branch namespace pollution, stale references, wasted disk space.
143
+
144
+ **Guideline:** Clean up worktrees as part of completing a task. Run `git worktree list` periodically. Use `git worktree prune` for stale references.
145
+
146
+ ### Shared State Leaks
147
+
148
+ **Problem:** Operations in one worktree unexpectedly affect another.
149
+
150
+ **Examples:**
151
+ - `git stash` — the stash is shared across all worktrees
152
+ - `git gc` — can repack objects used by other worktrees
153
+ - `.git/config` changes — affect all worktrees
154
+ - Global hooks — run in all worktrees
155
+
156
+ **Guideline:** Avoid `git stash` in worktree workflows (use commits instead). Be cautious with global git config changes.
157
+
158
+ ### Editing the Same File in Multiple Worktrees
159
+
160
+ **Problem:** Two worktrees modify the same file independently.
161
+
162
+ **Consequence:** Merge conflict when integrating changes, requiring manual resolution.
163
+
164
+ **Guideline:** Assign file ownership. Each worktree/agent edits a distinct set of files. If overlap is unavoidable, coordinate explicitly before merging.
165
+
166
+ ---
167
+
168
+ ## Worktree Lifecycle Hooks
169
+
170
+ Claude Code provides `WorktreeCreate` and `WorktreeRemove` hooks for customizing worktree lifecycle behavior.
171
+
172
+ ### WorktreeCreate Hook
173
+
174
+ Fires when a worktree is being created via `--worktree` or `isolation: "worktree"`. **Replaces** the default git worktree behavior entirely.
175
+
176
+ **Input:**
177
+ ```json
178
+ {
179
+ "session_id": "abc123",
180
+ "cwd": "/workspaces/projects/CodeForge",
181
+ "hook_event_name": "WorktreeCreate",
182
+ "name": "feature-auth"
183
+ }
184
+ ```
185
+
186
+ **Output:** Print the absolute path to the created worktree directory on stdout.
187
+
188
+ **Use cases:**
189
+ - Custom directory layout (override the default `.claude/worktrees/` path)
190
+ - Non-git VCS (SVN, Mercurial) worktree creation
191
+ - Post-creation setup (install dependencies, copy config files)
192
+
193
+ ### WorktreeRemove Hook
194
+
195
+ Fires when a worktree is being removed (session exit or subagent finish). Cleanup counterpart to WorktreeCreate.
196
+
197
+ **Input:**
198
+ ```json
199
+ {
200
+ "session_id": "abc123",
201
+ "hook_event_name": "WorktreeRemove",
202
+ "worktree_path": "/workspaces/projects/CodeForge/.claude/worktrees/feature-auth"
203
+ }
204
+ ```
205
+
206
+ **Use cases:**
207
+ - Custom cleanup (remove dependency directories, revoke temporary credentials)
208
+ - Non-git VCS cleanup
209
+ - Logging or notification on worktree removal
210
+
211
+ **Configuration:** Hooks are defined in `.claude/settings.json` or `.claude/settings.local.json`:
212
+
213
+ ```json
214
+ {
215
+ "hooks": {
216
+ "WorktreeCreate": [
217
+ {
218
+ "hooks": [
219
+ {
220
+ "type": "command",
221
+ "command": "bash /path/to/create-worktree.sh"
222
+ }
223
+ ]
224
+ }
225
+ ]
226
+ }
227
+ }
228
+ ```
@@ -74,13 +74,13 @@ Decompose work into parallel workstreams and recommend team composition using th
74
74
 
75
75
  | Spec Type | Teammates |
76
76
  |-----------|-----------|
77
- | Full-stack feature | researcher + test-writer + doc-writer |
77
+ | Full-stack feature | researcher + test-writer + documenter |
78
78
  | Backend-heavy | researcher + test-writer |
79
79
  | Security-sensitive | security-auditor + test-writer |
80
80
  | Refactoring work | refactorer + test-writer |
81
81
  | Multi-service | researcher per service + test-writer |
82
82
 
83
- **Available specialist agents:** `architect`, `bash-exec`, `claude-guide`, `debug-logs`, `dependency-analyst`, `doc-writer`, `explorer`, `generalist`, `git-archaeologist`, `migrator`, `perf-profiler`, `refactorer`, `researcher`, `security-auditor`, `spec-writer`, `statusline-config`, `test-writer`
83
+ **Available specialist agents:** `architect`, `bash-exec`, `claude-guide`, `debug-logs`, `dependency-analyst`, `documenter`, `explorer`, `generalist`, `git-archaeologist`, `migrator`, `perf-profiler`, `refactorer`, `researcher`, `security-auditor`, `spec-writer`, `statusline-config`, `test-writer`
84
84
 
85
85
  Use `generalist` only when no specialist matches the workstream. Hard limit: 3-5 active teammates maximum.
86
86
 
@@ -71,7 +71,7 @@ def fetch_ticket(number: int) -> str | None:
71
71
 
72
72
  try:
73
73
  data = json.loads(result.stdout)
74
- except (json.JSONDecodeError, ValueError):
74
+ except json.JSONDecodeError:
75
75
  return None
76
76
 
77
77
  title = data.get("title", "(no title)")
@@ -103,7 +103,7 @@ def main():
103
103
 
104
104
  try:
105
105
  data = json.loads(raw)
106
- except (json.JSONDecodeError, ValueError):
106
+ except json.JSONDecodeError:
107
107
  sys.exit(0)
108
108
 
109
109
  prompt = data.get("prompt", "")
@@ -27,7 +27,7 @@ These paths are always permitted regardless of working directory:
27
27
 
28
28
  | Path | Reason |
29
29
  |------|--------|
30
- | `/workspaces/.claude/` | Claude config, plans, rules |
30
+ | `~/.claude/` | Claude config, plans, rules |
31
31
  | `/tmp/` | System temp directory |
32
32
 
33
33
  ### CWD Context Injection
@@ -28,9 +28,10 @@ BLACKLISTED_PREFIXES = [
28
28
  ]
29
29
 
30
30
  # Paths always allowed regardless of working directory
31
+ _home = os.environ.get("HOME", "/home/vscode")
31
32
  ALLOWED_PREFIXES = [
32
- "/workspaces/.claude/", # Claude config, plans, rules
33
- "/tmp/", # System scratch
33
+ f"{_home}/.claude/", # Claude config, plans, rules
34
+ "/tmp/", # System scratch
34
35
  ]
35
36
 
36
37
  WRITE_TOOLS = {"Write", "Edit", "NotebookEdit"}
@@ -53,27 +54,27 @@ PATH_FIELDS = {
53
54
  # ---------------------------------------------------------------------------
54
55
  WRITE_PATTERNS = [
55
56
  # --- Ported from guard-protected-bash.py ---
56
- r"(?:>|>>)\s*([^\s;&|]+)", # > file, >> file
57
- r"\btee\s+(?:-a\s+)?([^\s;&|]+)", # tee file
58
- r"\b(?:cp|mv)\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # cp/mv src dest
57
+ r"(?:>>|>)\s*([^\s;&|]+)", # >> file, > file
58
+ r"\btee\s+(?:-a\s+)?([^\s;&|]+)", # tee file
59
+ r"\b(?:cp|mv)\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # cp/mv src dest
59
60
  r'\bsed\s+-i[^\s]*\s+(?:\'[^\']*\'\s+|"[^"]*"\s+|[^\s]+\s+)*([^\s;&|]+)', # sed -i
60
- r"\bcat\s+(?:<<[^\s]*\s+)?>\s*([^\s;&|]+)", # cat > file
61
+ r"\bcat\s+(?:<<[^\s]*\s+)?>\s*([^\s;&|]+)", # cat > file
61
62
  # --- New patterns ---
62
- r"\btouch\s+(?:-[^\s]+\s+)*([^\s;&|]+)", # touch file
63
- r"\bmkdir\s+(?:-[^\s]+\s+)*([^\s;&|]+)", # mkdir [-p] dir
64
- r"\brm\s+(?:-[^\s]+\s+)*([^\s;&|]+)", # rm [-rf] path
65
- r"\bln\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # ln [-s] src dest
66
- r"\binstall\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # install src dest
67
- r"\brsync\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # rsync src dest
68
- r"\bchmod\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # chmod mode path
69
- r"\bchown\s+(?:-[^\s]+\s+)*[^\s:]+(?::[^\s]+)?\s+([^\s;&|]+)", # chown owner[:group] path
70
- r"\bdd\b[^;|&]*\bof=([^\s;&|]+)", # dd of=path
71
- r"\bwget\s+(?:-[^\s]+\s+)*-O\s+([^\s;&|]+)", # wget -O path
72
- r"\bcurl\s+(?:-[^\s]+\s+)*-o\s+([^\s;&|]+)", # curl -o path
73
- r"\btar\s+(?:-[^\s]+\s+)*-C\s+([^\s;&|]+)", # tar -C dir
74
- r"\bunzip\s+(?:-[^\s]+\s+)*-d\s+([^\s;&|]+)", # unzip -d dir
63
+ r"\btouch\s+(?:-[^\s]+\s+)*([^\s;&|]+)", # touch file
64
+ r"\bmkdir\s+(?:-[^\s]+\s+)*([^\s;&|]+)", # mkdir [-p] dir
65
+ r"\brm\s+(?:-[^\s]+\s+)*([^\s;&|]+)", # rm [-rf] path
66
+ r"\bln\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # ln [-s] src dest
67
+ r"\binstall\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # install src dest
68
+ r"\brsync\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # rsync src dest
69
+ r"\bchmod\s+(?:-[^\s]+\s+)*[^\s]+\s+([^\s;&|]+)", # chmod mode path
70
+ r"\bchown\s+(?:-[^\s]+\s+)*[^\s:]+(?::[^\s]+)?\s+([^\s;&|]+)", # chown owner[:group] path
71
+ r"\bdd\b[^;|&]*\bof=([^\s;&|]+)", # dd of=path
72
+ r"\bwget\s+(?:-[^\s]+\s+)*-O\s+([^\s;&|]+)", # wget -O path
73
+ r"\bcurl\s+(?:-[^\s]+\s+)*-o\s+([^\s;&|]+)", # curl -o path
74
+ r"\btar\s+(?:-[^\s]+\s+)*-C\s+([^\s;&|]+)", # tar -C dir
75
+ r"\bunzip\s+(?:-[^\s]+\s+)*-d\s+([^\s;&|]+)", # unzip -d dir
75
76
  r"\b(?:gcc|g\+\+|cc|c\+\+|clang)\s+(?:-[^\s]+\s+)*-o\s+([^\s;&|]+)", # gcc -o out
76
- r"\bsqlite3\s+([^\s;&|]+)", # sqlite3 dbpath
77
+ r"\bsqlite3\s+([^\s;&|]+)", # sqlite3 dbpath
77
78
  ]
78
79
 
79
80
  # ---------------------------------------------------------------------------
@@ -85,15 +86,42 @@ WORKSPACE_PATH_RE = re.compile(r'/workspaces/[^\s;|&>)<\'"]+')
85
86
  # ---------------------------------------------------------------------------
86
87
  # System command exemption (Layer 1 only)
87
88
  # ---------------------------------------------------------------------------
88
- SYSTEM_COMMANDS = frozenset({
89
- "git", "pip", "pip3", "npm", "npx", "yarn", "pnpm",
90
- "apt-get", "apt", "cargo", "go", "docker", "make", "cmake",
91
- "node", "python3", "python", "ruby", "gem", "bundle",
92
- })
89
+ SYSTEM_COMMANDS = frozenset(
90
+ {
91
+ "git",
92
+ "pip",
93
+ "pip3",
94
+ "npm",
95
+ "npx",
96
+ "yarn",
97
+ "pnpm",
98
+ "apt-get",
99
+ "apt",
100
+ "cargo",
101
+ "go",
102
+ "docker",
103
+ "make",
104
+ "cmake",
105
+ "node",
106
+ "python3",
107
+ "python",
108
+ "ruby",
109
+ "gem",
110
+ "bundle",
111
+ }
112
+ )
93
113
 
94
114
  SYSTEM_PATH_PREFIXES = (
95
- "/usr/", "/bin/", "/sbin/", "/lib/", "/opt/",
96
- "/proc/", "/sys/", "/dev/", "/var/", "/etc/",
115
+ "/usr/",
116
+ "/bin/",
117
+ "/sbin/",
118
+ "/lib/",
119
+ "/opt/",
120
+ "/proc/",
121
+ "/sys/",
122
+ "/dev/",
123
+ "/var/",
124
+ "/etc/",
97
125
  )
98
126
 
99
127
 
@@ -101,10 +129,12 @@ SYSTEM_PATH_PREFIXES = (
101
129
  # Core check functions
102
130
  # ---------------------------------------------------------------------------
103
131
 
132
+
104
133
  def is_blacklisted(resolved_path: str) -> bool:
105
134
  """Check if resolved_path is under a permanently blocked directory."""
106
- return (resolved_path == "/workspaces/.devcontainer"
107
- or resolved_path.startswith("/workspaces/.devcontainer/"))
135
+ return resolved_path == "/workspaces/.devcontainer" or resolved_path.startswith(
136
+ "/workspaces/.devcontainer/"
137
+ )
108
138
 
109
139
 
110
140
  def is_in_scope(resolved_path: str, cwd: str) -> bool:
@@ -134,6 +164,7 @@ def get_target_path(tool_name: str, tool_input: dict) -> str | None:
134
164
  # Bash enforcement
135
165
  # ---------------------------------------------------------------------------
136
166
 
167
+
137
168
  def extract_write_targets(command: str) -> list[str]:
138
169
  """Extract file paths that the command writes to (Layer 1)."""
139
170
  targets = []
@@ -156,7 +187,11 @@ def extract_primary_command(command: str) -> str:
156
187
  while i < len(tokens):
157
188
  tok = tokens[i]
158
189
  # Skip inline variable assignments: VAR=value
159
- if "=" in tok and not tok.startswith("-") and tok.split("=")[0].isidentifier():
190
+ if (
191
+ "=" in tok
192
+ and not tok.startswith("-")
193
+ and tok.split("=", 1)[0].isidentifier()
194
+ ):
160
195
  i += 1
161
196
  continue
162
197
  # Skip sudo and its flags
@@ -242,7 +277,9 @@ def check_bash_scope(command: str, cwd: str) -> None:
242
277
  # Override: if ANY target is under /workspaces/ outside cwd → NOT exempt
243
278
  if skip_layer1:
244
279
  for _, resolved in resolved_targets:
245
- if resolved.startswith("/workspaces/") and not is_in_scope(resolved, cwd):
280
+ if resolved.startswith("/workspaces/") and not is_in_scope(
281
+ resolved, cwd
282
+ ):
246
283
  skip_layer1 = False
247
284
  break
248
285
 
@@ -272,6 +309,7 @@ def check_bash_scope(command: str, cwd: str) -> None:
272
309
  # Main
273
310
  # ---------------------------------------------------------------------------
274
311
 
312
+
275
313
  def main():
276
314
  try:
277
315
  input_data = json.load(sys.stdin)
@@ -1,4 +1,6 @@
1
1
  #!/bin/bash
2
+ # SPDX-License-Identifier: GPL-3.0-only
3
+ # Copyright (c) 2026 Marcus Krueger
2
4
  # Verify CodeForge setup is working correctly
3
5
  # Run anytime with: check-setup
4
6
 
@@ -34,10 +36,10 @@ warn_check() {
34
36
  echo ""
35
37
  echo "Core:"
36
38
  check "Claude Code installed" "command -v claude"
37
- warn_check "Claude native binary" "[ -x ~/.local/bin/claude ] || [ -x /usr/local/bin/claude ]"
39
+ warn_check "Claude native binary" "[ -x ~/.local/bin/claude ]"
38
40
  check "cc alias configured" "grep -q 'alias cc=' ~/.bashrc 2>/dev/null || grep -q 'alias cc=' ~/.zshrc 2>/dev/null"
39
- check "Config directory exists" "[ -d '${CLAUDE_CONFIG_DIR:-/workspaces/.claude}' ]"
40
- check "Settings file exists" "[ -f '${CLAUDE_CONFIG_DIR:-/workspaces/.claude}/settings.json' ]"
41
+ check "Config directory exists" "[ -d '${CLAUDE_CONFIG_DIR:-$HOME/.claude}' ]"
42
+ check "Settings file exists" "[ -f '${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json' ]"
41
43
 
42
44
  echo ""
43
45
  echo "Authentication:"
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-License-Identifier: GPL-3.0-only
3
+ # Copyright (c) 2026 Marcus Krueger
4
+ # Pre-flight check: validates a container runtime is available on the host.
5
+ # Runs via initializeCommand BEFORE any container build/pull/start.
6
+
7
+ set -euo pipefail
8
+
9
+ # --- OS detection ---
10
+
11
+ detect_os() {
12
+ if [[ -f /proc/version ]] && grep -qi 'microsoft\|wsl' /proc/version 2>/dev/null; then
13
+ echo "wsl"
14
+ elif [[ "$(uname -s)" == "Darwin" ]]; then
15
+ echo "macos"
16
+ else
17
+ echo "linux"
18
+ fi
19
+ }
20
+
21
+ # --- Timeout wrapper (macOS lacks coreutils timeout) ---
22
+
23
+ run_with_timeout() {
24
+ local seconds="$1"
25
+ shift
26
+ if command -v timeout &>/dev/null; then
27
+ timeout "$seconds" "$@" &>/dev/null 2>&1
28
+ else
29
+ # Fallback for macOS: background + kill
30
+ "$@" &>/dev/null 2>&1 &
31
+ local pid=$!
32
+ (sleep "$seconds" && kill "$pid" 2>/dev/null) &
33
+ local watchdog=$!
34
+ if wait "$pid" 2>/dev/null; then
35
+ kill "$watchdog" 2>/dev/null
36
+ wait "$watchdog" 2>/dev/null
37
+ return 0
38
+ else
39
+ kill "$watchdog" 2>/dev/null
40
+ wait "$watchdog" 2>/dev/null
41
+ return 1
42
+ fi
43
+ fi
44
+ }
45
+
46
+ # --- Runtime detection ---
47
+
48
+ check_runtime() {
49
+ local runtime="$1"
50
+ if ! command -v "$runtime" &>/dev/null; then
51
+ return 1
52
+ fi
53
+ if run_with_timeout 5 "$runtime" info; then
54
+ return 0
55
+ fi
56
+ return 1
57
+ }
58
+
59
+ # --- Main ---
60
+
61
+ for runtime in docker podman; do
62
+ if check_runtime "$runtime"; then
63
+ exit 0
64
+ fi
65
+ done
66
+
67
+ # No working runtime found — determine why and advise
68
+
69
+ found_binary=""
70
+ for runtime in docker podman; do
71
+ if command -v "$runtime" &>/dev/null; then
72
+ found_binary="$runtime"
73
+ break
74
+ fi
75
+ done
76
+
77
+ HOST_OS="$(detect_os)"
78
+
79
+ echo ""
80
+ echo "╔══════════════════════════════════════════════════════════════╗"
81
+ echo "║ CodeForge: Container runtime not available ║"
82
+ echo "╚══════════════════════════════════════════════════════════════╝"
83
+ echo ""
84
+
85
+ if [[ -n "$found_binary" ]]; then
86
+ echo " Found '$found_binary' but the daemon is not responding."
87
+ echo ""
88
+ case "$HOST_OS" in
89
+ wsl)
90
+ echo " Fix: Start Docker Desktop and enable WSL 2 integration:"
91
+ echo " Settings → Resources → WSL Integration"
92
+ ;;
93
+ macos)
94
+ echo " Fix: Start Docker Desktop:"
95
+ echo " open -a Docker"
96
+ ;;
97
+ linux)
98
+ echo " Fix: Start the Docker daemon:"
99
+ echo " sudo systemctl start docker"
100
+ ;;
101
+ esac
102
+ else
103
+ echo " No container runtime (docker or podman) found in PATH."
104
+ echo ""
105
+ echo " Install Docker Desktop:"
106
+ echo " https://www.docker.com/products/docker-desktop/"
107
+ echo ""
108
+ echo " Or install Podman:"
109
+ echo " https://podman.io/getting-started/installation"
110
+ fi
111
+
112
+ echo ""
113
+ exit 1
@@ -1,4 +1,6 @@
1
1
  #!/bin/bash
2
+ # SPDX-License-Identifier: GPL-3.0-only
3
+ # Copyright (c) 2026 Marcus Krueger
2
4
  # Setup cc/claude/ccraw aliases for claude with local system prompt support
3
5
  #
4
6
  # Idempotent: removes the entire managed block then re-writes it fresh.
@@ -74,14 +76,14 @@ export GH_CONFIG_DIR="${GH_CONFIG_DIR:-/workspaces/.gh}"
74
76
  export LANG=en_US.UTF-8
75
77
  export LC_ALL=en_US.UTF-8
76
78
 
77
- # Prefer native binary over npm-installed version
78
- if [ -x "\$HOME/.local/bin/claude" ]; then
79
- _CLAUDE_BIN="\$HOME/.local/bin/claude"
80
- elif [ -x /usr/local/bin/claude ]; then
81
- _CLAUDE_BIN=/usr/local/bin/claude
82
- else
83
- _CLAUDE_BIN=claude
79
+ # Terminal color defaults Docker sets TERM=xterm (8 colors); upgrade to 256-color
80
+ if [ "\$TERM" = "xterm" ] || [ -z "\$TERM" ]; then
81
+ export TERM=xterm-256color
84
82
  fi
83
+ export COLORTERM="\${COLORTERM:-truecolor}"
84
+
85
+ # Native binary (installed by claude-code-native feature)
86
+ _CLAUDE_BIN="\$HOME/.local/bin/claude"
85
87
 
86
88
  # ChromaTerm wrapper (if ct is installed, wrap claude through it)
87
89
  if command -v ct >/dev/null 2>&1; then
@@ -94,13 +96,14 @@ alias cc='CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 "\$_CLAUDE_WRAP" "\$_CL
94
96
  alias claude='CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 "\$_CLAUDE_WRAP" "\$_CLAUDE_BIN" --system-prompt-file "\$CLAUDE_CONFIG_DIR/main-system-prompt.md" --permission-mode plan --allow-dangerously-skip-permissions'
95
97
  alias ccraw='command "\$_CLAUDE_BIN"'
96
98
  alias ccw='CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 "\$_CLAUDE_WRAP" "\$_CLAUDE_BIN" --system-prompt-file "\$CLAUDE_CONFIG_DIR/writing-system-prompt.md" --permission-mode plan --allow-dangerously-skip-permissions'
99
+ alias cc-orc='CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 "\$_CLAUDE_WRAP" "\$_CLAUDE_BIN" --system-prompt-file "\$CLAUDE_CONFIG_DIR/orchestrator-system-prompt.md" --permission-mode plan --allow-dangerously-skip-permissions'
97
100
 
98
101
  cc-tools() {
99
102
  echo "CodeForge Available Tools"
100
103
  echo "━━━━━━━━━━━━━━━━━━━━━━━━"
101
104
  printf " %-20s %s\n" "COMMAND" "STATUS"
102
105
  echo " ────────────────────────────────────"
103
- for cmd in claude cc ccw ccraw ccusage ccburn claude-monitor \\
106
+ for cmd in claude cc ccw ccraw cc-orc ccusage ccburn claude-monitor \\
104
107
  ccms ct cargo ruff biome dprint shfmt shellcheck hadolint \\
105
108
  ast-grep tree-sitter pyright typescript-language-server \\
106
109
  agent-browser gh docker git jq tmux bun go infocmp; do
@@ -114,6 +117,7 @@ cc-tools() {
114
117
  }
115
118
 
116
119
  alias check-setup='bash ${DEVCONTAINER_SCRIPTS}/check-setup.sh'
120
+ alias codeforge='node \${WORKSPACE_ROOT}/setup.js'
117
121
  ${BLOCK_END}
118
122
  BLOCK_EOF
119
123
 
@@ -126,5 +130,6 @@ echo " cc -> claude with \$CLAUDE_CONFIG_DIR/main-system-prompt.md"
126
130
  echo " claude -> claude with \$CLAUDE_CONFIG_DIR/main-system-prompt.md"
127
131
  echo " ccraw -> vanilla claude without any config"
128
132
  echo " ccw -> claude with \$CLAUDE_CONFIG_DIR/writing-system-prompt.md"
133
+ echo " cc-orc -> claude with \$CLAUDE_CONFIG_DIR/orchestrator-system-prompt.md (delegation mode)"
129
134
  echo " cc-tools -> list all available CodeForge tools"
130
135
  echo " check-setup -> verify CodeForge setup health"