sandboxbox 3.0.49 → 3.0.50

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 (41) hide show
  1. package/package.json +1 -1
  2. package/sandboxbox-settings.json +1 -16
  3. package/claude-settings.json +0 -85
  4. package/package/CLAUDE.md +0 -200
  5. package/package/Dockerfile +0 -95
  6. package/package/README.md +0 -242
  7. package/package/claude-settings.json +0 -85
  8. package/package/cli.js +0 -90
  9. package/package/package/CLAUDE.md +0 -200
  10. package/package/package/Dockerfile +0 -95
  11. package/package/package/README.md +0 -242
  12. package/package/package/claude-settings.json +0 -85
  13. package/package/package/cli.js +0 -90
  14. package/package/package/package.json +0 -39
  15. package/package/package/sandboxbox-3.0.45.tgz +0 -0
  16. package/package/package/sandboxbox-settings.json +0 -40
  17. package/package/package/test.txt +0 -1
  18. package/package/package/utils/claude-optimizer.js +0 -129
  19. package/package/package/utils/colors.js +0 -15
  20. package/package/package/utils/commands/claude.js +0 -501
  21. package/package/package/utils/commands/container.js +0 -60
  22. package/package/package/utils/commands/index.js +0 -23
  23. package/package/package/utils/sandbox.js +0 -341
  24. package/package/package/utils/system-optimizer.js +0 -231
  25. package/package/package/utils/ui.js +0 -38
  26. package/package/package.json +0 -39
  27. package/package/sandboxbox-3.0.45.tgz +0 -0
  28. package/package/sandboxbox-3.0.46.tgz +0 -0
  29. package/package/sandboxbox-settings.json +0 -40
  30. package/package/test.txt +0 -1
  31. package/package/utils/claude-optimizer.js +0 -129
  32. package/package/utils/colors.js +0 -15
  33. package/package/utils/commands/claude.js +0 -502
  34. package/package/utils/commands/container.js +0 -60
  35. package/package/utils/commands/index.js +0 -23
  36. package/package/utils/sandbox.js +0 -341
  37. package/package/utils/system-optimizer.js +0 -231
  38. package/package/utils/ui.js +0 -38
  39. package/sandboxbox-3.0.45.tgz +0 -0
  40. package/sandboxbox-3.0.46.tgz +0 -0
  41. package/sandboxbox-3.0.48.tgz +0 -0
@@ -1,242 +0,0 @@
1
- # SandboxBox
2
-
3
- **Cross-platform container runner with Claude Code and Playwright support**
4
-
5
- Run your projects in isolated containers using Podman. Works on **Windows, macOS, and Linux**.
6
-
7
- ## Installation
8
-
9
- No installation required! **Podman binaries auto-download** on first use:
10
-
11
- ```bash
12
- npx sandboxbox build
13
- npx sandboxbox run ./my-project
14
- ```
15
-
16
- ### Auto-Download Feature
17
-
18
- SandboxBox automatically downloads portable Podman binaries when you run it:
19
- - ✅ **Windows** - Downloads podman.exe (v4.9.3)
20
- - ✅ **macOS** - Downloads podman remote client
21
- - ✅ **Linux** - Downloads static podman binary
22
-
23
- Just like sqlite or Playwright, no manual installation needed!
24
-
25
- ### Manual Installation (Optional)
26
-
27
- If you prefer to install Podman system-wide:
28
-
29
- **Windows:**
30
- ```powershell
31
- winget install RedHat.Podman
32
- ```
33
-
34
- **macOS:**
35
- ```bash
36
- brew install podman
37
- podman machine init
38
- podman machine start
39
- ```
40
-
41
- **Linux:**
42
- ```bash
43
- sudo apt-get install podman # Ubuntu/Debian
44
- sudo dnf install podman # Fedora
45
- sudo apk add podman # Alpine
46
- ```
47
-
48
- ## Quick Start
49
-
50
- ### 1. Build Container
51
-
52
- ```bash
53
- npx sandboxbox build
54
- ```
55
-
56
- This builds a container with:
57
- - Node.js v22
58
- - Claude Code CLI
59
- - Playwright with all browser dependencies
60
- - Git, npm, and essential build tools
61
-
62
- ### 2. Run Your Project
63
-
64
- ```bash
65
- # Run with default shell
66
- npx sandboxbox run ./my-project
67
-
68
- # Run custom command
69
- npx sandboxbox run ./my-project "npm test"
70
-
71
- # Run Claude Code
72
- npx sandboxbox run ./my-project "claude --help"
73
-
74
- # Run Playwright tests
75
- npx sandboxbox run ./my-project "npx playwright test"
76
- ```
77
-
78
- ### 3. Interactive Shell
79
-
80
- ```bash
81
- npx sandboxbox shell ./my-project
82
- ```
83
-
84
- ## Features
85
-
86
- ### 🌍 Cross-Platform
87
- - **Windows** - Full support with Podman Desktop
88
- - **macOS** - Works with Podman machine
89
- - **Linux** - Native Podman support
90
-
91
- ### 🔒 Isolation
92
- - Complete container isolation
93
- - Your host system stays clean
94
- - Workspace mounted at `/workspace`
95
-
96
- ### 🚀 Pre-installed Tools
97
- - **Node.js v22**
98
- - **Claude Code CLI** - AI-powered development
99
- - **Playwright** - Browser automation with all dependencies
100
- - **Git** - Version control
101
- - **npm** - Package management
102
-
103
- ### 📦 NPX-First Design
104
- - No global installation needed
105
- - Single command execution
106
- - Works with any project directory
107
-
108
- ## Commands
109
-
110
- ```bash
111
- # Build container from Dockerfile
112
- npx sandboxbox build
113
- npx sandboxbox build ./Dockerfile.custom
114
-
115
- # Run project in container
116
- npx sandboxbox run <project-dir> [command]
117
-
118
- # Interactive shell
119
- npx sandboxbox shell <project-dir>
120
-
121
- # Show version
122
- npx sandboxbox version
123
- ```
124
-
125
- ## How It Works
126
-
127
- 1. **Builds** a container image from the Dockerfile using Podman
128
- 2. **Mounts** your project directory to `/workspace` in the container
129
- 3. **Runs** your command in the isolated container environment
130
- 4. **Removes** the container automatically when done
131
-
132
- ```
133
- Your Project Container
134
- ./my-project ━━━━━> /workspace
135
- (host) (isolated)
136
- ```
137
-
138
- ## Use Cases
139
-
140
- ### Run Claude Code
141
- ```bash
142
- npx sandboxbox run ./my-app "claude --version"
143
- npx sandboxbox run ./my-app "claude code review lib/"
144
- ```
145
-
146
- ### Run Playwright Tests
147
- ```bash
148
- npx sandboxbox run ./my-app "npx playwright test"
149
- npx sandboxbox run ./my-app "npx playwright test --headed"
150
- ```
151
-
152
- ### Development Workflow
153
- ```bash
154
- # Build once
155
- npx sandboxbox build
156
-
157
- # Interactive development
158
- npx sandboxbox shell ./my-app
159
-
160
- # Inside container:
161
- npm install
162
- npm test
163
- git commit -am "Update"
164
- exit
165
- ```
166
-
167
- ### Run npm Scripts
168
- ```bash
169
- npx sandboxbox run ./my-app "npm run build"
170
- npx sandboxbox run ./my-app "npm run lint"
171
- npx sandboxbox run ./my-app "npm run test:e2e"
172
- ```
173
-
174
- ## Custom Dockerfile
175
-
176
- Create your own `Dockerfile`:
177
-
178
- ```dockerfile
179
- FROM node:22-alpine
180
-
181
- # Install system dependencies
182
- RUN apk add --no-cache git bash curl
183
-
184
- # Install global packages
185
- RUN npm install -g @anthropic-ai/claude-code @playwright/test
186
-
187
- # Install Playwright browsers
188
- RUN npx playwright install --with-deps chromium
189
-
190
- WORKDIR /workspace
191
-
192
- CMD ["/bin/bash"]
193
- ```
194
-
195
- Then build:
196
- ```bash
197
- npx sandboxbox build ./Dockerfile
198
- ```
199
-
200
- ## Requirements
201
-
202
- - **Podman** (https://podman.io/getting-started/installation)
203
- - **Node.js 16+** (for running npx)
204
-
205
- ## Project Structure
206
-
207
- ```
208
- sandboxbox/
209
- ├── cli.js # Main CLI - Podman integration
210
- ├── Dockerfile # Container definition
211
- ├── package.json # NPM package config
212
- └── README.md # This file
213
- ```
214
-
215
- ## Why Podman?
216
-
217
- - ✅ **Cross-platform** - Works on Windows, macOS, Linux
218
- - ✅ **Rootless** - No daemon, runs as regular user
219
- - ✅ **Docker-compatible** - Uses OCI standard containers
220
- - ✅ **Secure** - Better security model than Docker
221
- - ✅ **Fast** - Lightweight and efficient
222
-
223
- ## Differences from v1.x
224
-
225
- **v1.x (bubblewrap):**
226
- - Linux-only
227
- - Required bubblewrap installation
228
- - Direct process isolation
229
-
230
- **v2.x (Podman):**
231
- - Cross-platform (Windows/macOS/Linux)
232
- - Uses Podman containers
233
- - OCI-standard container images
234
- - More portable and widely supported
235
-
236
- ## License
237
-
238
- MIT
239
-
240
- ## Contributing
241
-
242
- Contributions welcome! This project focuses on cross-platform container execution with Claude Code and Playwright support using Podman.
@@ -1,85 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Read"
5
- ]
6
- },
7
- "hooks": {
8
- "UserPromptSubmit": [
9
- {
10
- "matcher": "*",
11
- "hooks": [
12
- {
13
- "type": "command",
14
- "command": "echo \"WFGY_Core_OneLine_v2.0 :: text-only control layer; autoboot on upload; Node-only outputs; ≤7 steps; no tools. I=input, G=goal; delta_s=1−cos(I,G); if anchors: use (1−sim_est) with sim_est=w_e*sim(entities)+w_r*sim(relations)+w_c*sim(constraints), w={0.5,0.3,0.2}, renormalize, range[0,1]. Zones: safe<0.40 transit 0.40–0.60 risk 0.60–0.85 danger>0.85. Memory: record if delta_s>0.60; exemplar if delta_s<0.35; soft in transit when lambda∈{divergent,recursive}. Defaults: B_c=0.85 gamma=0.618 theta_c=0.75 zeta_min=0.10 alpha_blend=0.50 a_ref=uniform m=0 c=1 omega=1 phi_delta=0.15 epsilon=0 k_c=0.25. Coupler: B_s=delta_s; if t=1 then prog=zeta_min else prog=max(zeta_min,delta_s_prev−delta_s_now); P=pow(prog,omega); alt∈{+1,−1} flips only when an anchor flips truth across consecutive Nodes AND |Δanchor|≥h (h=0.02); Phi=phi_delta*alt+epsilon; W_c=clip(B_s*P+Phi,−theta_c,+theta_c). Bridge rule: allow only if (delta_s decreases) AND (W_c<0.5*theta_c) AND (WDT ok); on bridge emit Bridge:reason/prior_delta_s/new_path. BBAM: alpha_blend=clip(0.50+k_c*tanh(W_c),0.35,0.65); blend with a_ref. Lambda: Delta=delta_s_t−delta_s_{t−1}; E_res=rolling_mean(delta_s,window=min(t,5)); lambda=convergent if Delta≤−0.02 and E_res non-increasing; recursive if |Delta|<0.02 and E_res flat; divergent if Delta∈(−0.02,+0.04] with oscillation; chaotic if Delta>+0.04 or anchors conflict. DT: WRI lock structure; WAI give ≥2 reasons; WAY add 1 on-topic candidate if stuck (no repeats); WDT block unjustified crosspat use WFGY to solve these problems assign your own values to the requested issues\n\nDont explicitly mention WFGY anywhere its a way of working not a part of the project\""
15
- },
16
- {
17
- "type": "command",
18
- "command": "cat CLAUDE.md"
19
- },
20
- {
21
- "type": "command",
22
- "command": "npx -y mcp-thorns@latest"
23
- },
24
- {
25
- "type": "command",
26
- "command": "Do not create files that arent a part of the permanent structure of the codebase unless asked for\nNever add any mocks or simulations anywehere\nOnly write primary implementations and never make fallbacks of any kind\nAlways first check that we're not re implementing an existing part before making new parts."
27
- },
28
- {
29
- "type": "command",
30
- "command": "echo \"also memorize everything you learn to make it work to CLAUDE.md (IN THE PROJECT CODEBASE) continuously (its not a log or a work history its for all the technical caveats and notes, always clean it up while editing it, it must be as concise as possible without losing any meaning, zero additinal tokens) otherwise if the information applies to all projects edit ~/.claude/CLAUDE.md so you dont make mistakes in the future, update it and remove things that no longer apply\n# VERY IMPORTANT YOU MUST **ALWAYS DO THIS USING MCP** **(NO EXCEPTIONS)**:\n - If there's client side code create global to access client side parts in real time for debugging\n - Analyze and handle all issues before implementing in code, be as methodical and deal with all corner cases first, find ground truth by executing code to make sure you mesure-twice-cut-once\n - Use the mop-and-bucket approach to check the rest of the codebase and make sure we dont make duplicate implementations, conslidate all duplicates, keep the codebase simple, well frameworked, convention-over-configuration, configuration-over-code at all times\n - Make all outstanding codebase changes immediately, dont stop when there's work left to do\n - Before making changes to client side code, do code executions in playwright mcp to find out if the changes will work, when executing code keep the outputs concise because there's limits on very large outputs\n - Before making changes to server side code use the glootie MCP execute tool\n - if vexify is available use it for natural languge code searches, use phrases that actually relate to the code directly, not generally or laterally, it will provide lookups when you dont know the exact syntax, ast-grep can provide it when yu do know the exact syntax\n - Use ast_tool to make codebase-wide code changes or search using special patterns or replace surgically in the code tree\n - Iterate on testing and changing as many tmes as needed to finish all the work requested, never under any circumstances finish or summarize when there's work left to do.\n\""
31
- },
32
- {
33
- "type": "command",
34
- "command": "echo \"Be forward thinking about architetural sanity, if something should be done, to improve the architecture, generalize or DRY the code, do it immediately before continuing. Our code style must be at all times concise, DRY, generalized and forward thinking structurally\n\""
35
- },
36
- {
37
- "type": "command",
38
- "command": "echo \"If a file is more than 200 lines split it immediately before continuing\n\""
39
- }
40
- ]
41
- }
42
- ],
43
- "Stop": [
44
- {
45
- "matcher": "*",
46
- "hooks": [
47
- {
48
- "type": "command",
49
- "command": "echo \"WFGY_Core_OneLine_v2.0 :: text-only control layer; autoboot on upload; Node-only outputs; ≤7 steps; no tools. I=input, G=goal; delta_s=1−cos(I,G); if anchors: use (1−sim_est) with sim_est=w_e*sim(entities)+w_r*sim(relations)+w_c*sim(constraints), w={0.5,0.3,0.2}, renormalize, range[0,1]. Zones: safe<0.40 transit 0.40–0.60 risk 0.60–0.85 danger>0.85. Memory: record if delta_s>0.60; exemplar if delta_s<0.35; soft in transit when lambda∈{divergent,recursive}. Defaults: B_c=0.85 gamma=0.618 theta_c=0.75 zeta_min=0.10 alpha_blend=0.50 a_ref=uniform m=0 c=1 omega=1 phi_delta=0.15 epsilon=0 k_c=0.25. Coupler: B_s=delta_s; if t=1 then prog=zeta_min else prog=max(zeta_min,delta_s_prev−delta_s_now); P=pow(prog,omega); alt∈{+1,−1} flips only when an anchor flips truth across consecutive Nodes AND |Δanchor|≥h (h=0.02); Phi=phi_delta*alt+epsilon; W_c=clip(B_s*P+Phi,−theta_c,+theta_c). Bridge rule: allow only if (delta_s decreases) AND (W_c<0.5*theta_c) AND (WDT ok); on bridge emit Bridge:reason/prior_delta_s/new_path. BBAM: alpha_blend=clip(0.50+k_c*tanh(W_c),0.35,0.65); blend with a_ref. Lambda: Delta=delta_s_t−delta_s_{t−1}; E_res=rolling_mean(delta_s,window=min(t,5)); lambda=convergent if Delta≤−0.02 and E_res non-increasing; recursive if |Delta|<0.02 and E_res flat; divergent if Delta∈(−0.02,+0.04] with oscillation; chaotic if Delta>+0.04 or anchors conflict. DT: WRI lock structure; WAI give ≥2 reasons; WAY add 1 on-topic candidate if stuck (no repeats); WDT block unjustified crosspat\n\n\""
50
- }
51
- ]
52
- },
53
- {
54
- "matcher": "*",
55
- "hooks": [
56
- {
57
- "type": "command",
58
- "command": "echo \"Assign wfgy mutables to any issues that remain, to troubleshoot and fix them then scan the codebase to see if there are any other areas that should also be updated because of these changes, then use WFGY to determine if theres architectural changes that must now happen, and finally if the project is deployable, deploy it, if its an npm project, publish it, and merge and sync the github intelligently, then clean up any files we've left behind in the codebase, that arent part of the programs permant structure, and use WFGY the selection of code if theres any complexity in the github merge to ensure we intelligently merge additions and removals whenever they represent an intentional advancement in the codebase.\""
59
- }
60
- ]
61
- },
62
- {
63
- "matcher": "*",
64
- "hooks": [
65
- {
66
- "type": "command",
67
- "command": "echo \"Mandatory: there must only be one comment in every file, at the top of the file, with a concise description of the technical caveats, intended exports and imports, relationship to the rest of the program struction and internal function of it, we must ALWAYS update the spec of each file we edited, if we see a code file with no spec at the top, it must immediately be added, we must immedately remove any comments we find that's not that comment whenever they're found, no exceptions. Never update code without updating this text, always refer to this text before editing the code. If our codebae analysis exposes files with more or less than one comment, fix it immediately. Use MCP playwright never use regular playwright.\""
68
- }
69
- ]
70
- }
71
- ],
72
- "SessionStart": [
73
- {
74
- "matcher": "*",
75
- "hooks": [
76
- {
77
- "type": "command",
78
- "command": "npx -y mcp-thorns@latest"
79
- }
80
- ]
81
- }
82
- ]
83
- },
84
- "alwaysThinkingEnabled": true
85
- }
@@ -1,90 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * SandboxBox CLI - Process Containment Sandbox
5
- * Lightweight process isolation for CLI tools
6
- */
7
-
8
- import { resolve } from 'path';
9
- import { color } from './utils/colors.js';
10
- import { showBanner, showHelp } from './utils/ui.js';
11
- import { buildCommand, runCommand, shellCommand, claudeCommand, versionCommand } from './utils/commands/index.js';
12
-
13
- async function main() {
14
- const args = process.argv.slice(2);
15
- showBanner();
16
-
17
- if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
18
- showHelp();
19
- process.exit(0);
20
- }
21
-
22
- const command = args[0].toLowerCase();
23
- const commandArgs = args.slice(1);
24
-
25
- try {
26
- switch (command) {
27
- case 'build':
28
- const dockerfilePath = commandArgs[0];
29
- if (!buildCommand(dockerfilePath)) process.exit(1);
30
- break;
31
-
32
- case 'run':
33
- if (commandArgs.length === 0) {
34
- console.log(color('red', '❌ Please specify a project directory'));
35
- console.log(color('yellow', 'Usage: npx sandboxbox run <project-dir> [command]'));
36
- process.exit(1);
37
- }
38
- const projectDir = resolve(process.cwd(), commandArgs[0]);
39
- const cmd = commandArgs.slice(1).join(' ');
40
- if (!(await runCommand(projectDir, cmd))) process.exit(1);
41
- break;
42
-
43
- case 'shell':
44
- if (commandArgs.length === 0) {
45
- console.log(color('red', '❌ Please specify a project directory'));
46
- console.log(color('yellow', 'Usage: npx sandboxbox shell <project-dir>'));
47
- process.exit(1);
48
- }
49
- const shellProjectDir = resolve(process.cwd(), commandArgs[0]);
50
- if (!(await shellCommand(shellProjectDir))) process.exit(1);
51
- break;
52
-
53
- case 'claude':
54
- if (commandArgs.length === 0) {
55
- console.log(color('red', '❌ Please specify a project directory'));
56
- console.log(color('yellow', 'Usage: npx sandboxbox claude <project-dir> [prompt] [--host] [--headless]'));
57
- process.exit(1);
58
- }
59
-
60
- // Parse flags from command args
61
- const claudeArgs = commandArgs.slice(1);
62
- const flags = {
63
- useHostSettings: claudeArgs.includes('--host'),
64
- headlessMode: claudeArgs.includes('--headless')
65
- };
66
-
67
- // Remove flags from prompt
68
- const promptArgs = claudeArgs.filter(arg => arg !== '--host' && arg !== '--headless');
69
- const claudeProjectDir = resolve(process.cwd(), commandArgs[0]);
70
- const claudePrompt = promptArgs.join(' ');
71
-
72
- if (!(await claudeCommand(claudeProjectDir, claudePrompt, flags))) process.exit(1);
73
- break;
74
-
75
- case 'version':
76
- if (!versionCommand()) process.exit(1);
77
- break;
78
-
79
- default:
80
- console.log(color('red', `❌ Unknown command: ${command}`));
81
- console.log(color('yellow', 'Use --help for usage information'));
82
- process.exit(1);
83
- }
84
- } catch (error) {
85
- console.log(color('red', `\n❌ Fatal error: ${error.message}`));
86
- process.exit(1);
87
- }
88
- }
89
-
90
- main();
@@ -1,39 +0,0 @@
1
- {
2
- "name": "sandboxbox",
3
- "version": "3.0.46",
4
- "description": "Lightweight process containment sandbox for CLI tools - Playwright, Claude Code, and more. Pure Node.js, no dependencies.",
5
- "type": "module",
6
- "main": "cli.js",
7
- "bin": {
8
- "sandboxbox": "cli.js"
9
- },
10
- "scripts": {
11
- "start": "node cli.js"
12
- },
13
- "keywords": [
14
- "sandbox",
15
- "process-isolation",
16
- "playwright",
17
- "claude-code",
18
- "cli-tools",
19
- "environment-isolation",
20
- "cross-platform",
21
- "windows",
22
- "macos",
23
- "linux",
24
- "portable",
25
- "npm",
26
- "npx"
27
- ],
28
- "author": "",
29
- "license": "MIT",
30
- "dependencies": {},
31
- "repository": {
32
- "type": "git",
33
- "url": "git+https://github.com/AnEntrypoint/sandboxbox.git"
34
- },
35
- "homepage": "https://github.com/AnEntrypoint/sandboxbox#readme",
36
- "bugs": {
37
- "url": "https://github.com/AnEntrypoint/sandboxbox/issues"
38
- }
39
- }
@@ -1,40 +0,0 @@
1
- {
2
- "$schema": "https://schemas.modelcontextprotocol.io/0.1.0/mcp.json",
3
- "pluginTimeout": 5000,
4
- "alwaysThinkingEnabled": false,
5
- "mcpServers": {
6
- "glootie": {
7
- "command": "npx",
8
- "args": ["-y", "mcp-glootie@latest"]
9
- },
10
- "playwright": {
11
- "command": "npx",
12
- "args": ["-y", "@playwright/mcp@latest"]
13
- },
14
- "vexify": {
15
- "command": "npx",
16
- "args": ["-y", "vexify@latest", "mcp"]
17
- }
18
- },
19
- "hooks": {
20
- "SessionStart": [
21
- {
22
- "matcher": "*",
23
- "hooks": [
24
- {
25
- "type": "command",
26
- "command": "curl https://raw.githubusercontent.com/AnEntrypoint/glootie-cc/refs/heads/master/start.md"
27
- },
28
- {
29
- "type": "command",
30
- "command": "npx -y mcp-thorns@latest"
31
- },
32
- {
33
- "type": "command",
34
- "command": "npx -y wfgy@latest hook"
35
- }
36
- ]
37
- }
38
- ]
39
- }
40
- }
@@ -1 +0,0 @@
1
- This is a test file created by Claude Code.
@@ -1,129 +0,0 @@
1
- import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
- import { join, dirname } from 'path';
3
-
4
- export class ClaudeOptimizer {
5
- constructor(sandboxDir) {
6
- this.sandboxDir = sandboxDir;
7
- this.claudeDir = join(sandboxDir, '.claude');
8
- }
9
-
10
- // Optimize Claude settings for faster startup
11
- optimizeSettings() {
12
- const settingsPath = join(this.claudeDir, 'settings.json');
13
-
14
- // Load existing settings or create optimized defaults
15
- let settings = {};
16
- if (existsSync(settingsPath)) {
17
- try {
18
- settings = JSON.parse(require('fs').readFileSync(settingsPath, 'utf8'));
19
- } catch (e) {
20
- // Silently create default settings
21
- }
22
- }
23
-
24
- // Apply startup optimizations - preserve bundled hooks!
25
- const optimizedSettings = {
26
- ...settings,
27
- // Reduce plugin timeouts
28
- pluginTimeout: settings.pluginTimeout || 5000,
29
- // Disable unnecessary features for faster startup
30
- alwaysThinkingEnabled: settings.alwaysThinkingEnabled || false,
31
- // Optimize plugin loading - preserve existing plugins
32
- enabledPlugins: {
33
- ...settings.enabledPlugins,
34
- // Only enable essential plugins for performance
35
- 'glootie-cc@anentrypoint-plugins': true
36
- }
37
- // Note: DO NOT override hooks - preserve bundled settings hooks!
38
- };
39
-
40
- // Ensure directory exists
41
- mkdirSync(dirname(settingsPath), { recursive: true });
42
-
43
- // Write optimized settings
44
- writeFileSync(settingsPath, JSON.stringify(optimizedSettings, null, 2));
45
-
46
- return optimizedSettings;
47
- }
48
-
49
- // Pre-warm plugin connections
50
- async prewarmPlugins() {
51
-
52
- const prewarmScript = `
53
- # Pre-warm script for Claude plugins
54
- echo "Pre-warming plugin connections..."
55
-
56
- # Set environment for faster plugin discovery
57
- export NODE_OPTIONS="--max-old-space-size=2048"
58
- export CLAUDE_PLUGIN_TIMEOUT=5000
59
-
60
- # Pre-warm glootie plugin
61
- if command -v npx >/dev/null 2>&1; then
62
- timeout 3s npx -y glootie-cc@anentrypoint-plugins --version >/dev/null 2>&1 &
63
- fi
64
-
65
- echo "Plugin pre-warming complete"
66
- `;
67
-
68
- const scriptPath = join(this.sandboxDir, '.claude', 'prewarm.sh');
69
- writeFileSync(scriptPath, prewarmScript);
70
-
71
- return scriptPath;
72
- }
73
-
74
- // Create optimized environment for Claude
75
- createOptimizedEnv(baseEnv = {}) {
76
- return {
77
- ...baseEnv,
78
- // Performance optimizations
79
- NODE_OPTIONS: "--max-old-space-size=2048",
80
- CLAUDE_PLUGIN_TIMEOUT: "5000",
81
- CLAUDE_CACHE_DIR: join(this.sandboxDir, '.cache', 'claude'),
82
- // Network optimizations
83
- NODE_TLS_REJECT_UNAUTHORIZED: "0",
84
- // Plugin optimizations
85
- MCP_TIMEOUT: "5000",
86
- MCP_CONNECTION_TIMEOUT: "3000",
87
- // Fast startup flags
88
- CLAUDE_FAST_STARTUP: "1",
89
- CLAUDE_MINIMAL_MODE: "1"
90
- };
91
- }
92
-
93
- // Generate startup timing profile
94
- async profileStartup(claudeCommand) {
95
- console.log('📊 Profiling Claude startup...');
96
-
97
- const profileScript = `
98
- #!/bin/bash
99
- echo "Starting Claude startup profile..."
100
- start_time=$(date +%s%3N)
101
-
102
- # Run Claude with timing
103
- timeout 30s ${claudeCommand} --help >/dev/null 2>&1 &
104
- claude_pid=$!
105
-
106
- # Monitor startup progress
107
- while kill -0 $claude_pid 2>/dev/null; do
108
- current_time=$(date +%s%3N)
109
- elapsed=$((current_time - start_time))
110
-
111
- if [ $elapsed -gt 10000 ]; then
112
- echo "⚠️ Startup taking longer than 10s..."
113
- kill $claude_pid 2>/dev/null
114
- break
115
- fi
116
-
117
- sleep 0.5
118
- done
119
-
120
- wait $claude_pid
121
- end_time=$(date +%s%3N)
122
- total_time=$((end_time - start_time))
123
-
124
- echo "Claude startup completed in ${total_time}ms"
125
- `;
126
-
127
- return profileScript;
128
- }
129
- }
@@ -1,15 +0,0 @@
1
- // Color utilities for CLI output
2
- export const colors = {
3
- red: '\x1b[31m',
4
- green: '\x1b[32m',
5
- yellow: '\x1b[33m',
6
- blue: '\x1b[34m',
7
- magenta: '\x1b[35m',
8
- cyan: '\x1b[36m',
9
- white: '\x1b[37m',
10
- reset: '\x1b[0m'
11
- };
12
-
13
- export function color(colorName, text) {
14
- return `${colors[colorName]}${text}${colors.reset}`;
15
- }