Skip to content

Commit 5ea0b18

Browse files
committed
fix: add postinstall stubs + turndown dep, update build docs
- scripts/postinstall.sh auto-creates @ant/* stubs after bun install - Add turndown to package.json dependencies - Update both READMEs with postinstall note in build steps - Update missing packages section to explain postinstall mechanism
1 parent c3e0f95 commit 5ea0b18

5 files changed

Lines changed: 158 additions & 22 deletions

File tree

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Two Anthropic-internal packages that can't be installed from npm:
8787
git clone https://github.com/roger2ai/Claude-Code-Compiled.git
8888
cd Claude-Code-Compiled
8989

90-
# Install dependencies
90+
# Install dependencies (postinstall auto-creates @ant/* stubs)
9191
bun install
9292

9393
# Patch Commander.js (multi-char short flags not supported upstream)
@@ -215,17 +215,16 @@ These Anthropic-internal experimental features are disabled via `feature()` flag
215215
| WorkflowTool | Gated behind `feature('WORKFLOW_SCRIPTS')` |
216216
| TungstenTool | Gated behind `USER_TYPE=ant` |
217217

218-
### Missing Internal Packages (no runtime impact)
218+
### Missing Internal Packages (auto-created by postinstall)
219219

220-
All `@ant/*` package references are behind `feature()` guards and tree-shaken at build time:
220+
All `@ant/*` package references are behind `feature()` guards and tree-shaken at build time. Stubs are auto-created by `scripts/postinstall.sh` after `bun install`:
221221

222-
| Package | Purpose | Impact |
223-
|---------|---------|--------|
224-
| `@ant/claude-for-chrome-mcp` | Chrome browser MCP | None — dead code |
225-
| `@ant/computer-use-mcp` | Computer Use MCP | None — dead code |
226-
| `@ant/computer-use-input` | Mouse/keyboard control | None — dead code |
227-
| `@ant/computer-use-swift` | macOS native screenshots | None — dead code |
228-
| `@anthropic-ai/claude-agent-sdk` | SDK type reference | None — `import type` only |
222+
| Package | Purpose | How It's Handled |
223+
|---------|---------|------------------|
224+
| `@ant/claude-for-chrome-mcp` | Chrome browser MCP | Stub in postinstall — dead code |
225+
| `@ant/computer-use-mcp` | Computer Use MCP | Stub in postinstall — dead code |
226+
| `@ant/computer-use-input` | Mouse/keyboard control | Stub in postinstall — dead code |
227+
| `@ant/computer-use-swift` | macOS native screenshots | Stub in postinstall — dead code |
229228

230229
**Summary: All core CLI functionality (file ops, commands, search, API calls, MCP) works. Missing features are Anthropic-internal experiments not available in the official release either.**
231230

README_CN.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
git clone https://github.com/roger2ai/Claude-Code-Compiled.git
8888
cd Claude-Code-Compiled
8989

90-
# 安装依赖
90+
# 安装依赖(postinstall 自动创建 @ant/* stub)
9191
bun install
9292

9393
# 修补 Commander.js(多字符短标志不支持)
@@ -215,17 +215,16 @@ claude-code/
215215
| WorkflowTool | `feature('WORKFLOW_SCRIPTS')` 返回 false |
216216
| TungstenTool | `USER_TYPE=ant` 条件不满足 |
217217

218-
### 缺失的内部包(无运行时影响
218+
### 缺失的内部包(postinstall 自动创建 stub
219219

220-
所有 `@ant/*` 包引用都在 `feature()` 守卫的 dead code 分支内,编译时被完全剔除:
220+
所有 `@ant/*` 包引用都在 `feature()` 守卫的 dead code 分支内,编译时被完全剔除。Stub 由 `scripts/postinstall.sh``bun install` 后自动创建
221221

222-
|| 用途 | 影响 |
223-
|------|------|------|
224-
| `@ant/claude-for-chrome-mcp` | Chrome 浏览器 MCP | 无 — dead code |
225-
| `@ant/computer-use-mcp` | Computer Use MCP | 无 — dead code |
226-
| `@ant/computer-use-input` | 鼠标/键盘控制 | 无 — dead code |
227-
| `@ant/computer-use-swift` | macOS 原生截图 | 无 — dead code |
228-
| `@anthropic-ai/claude-agent-sdk` | SDK 类型引用 | 无 — 仅 `import type` |
222+
|| 用途 | 处理方式 |
223+
|------|------|----------|
224+
| `@ant/claude-for-chrome-mcp` | Chrome 浏览器 MCP | postinstall stub — dead code |
225+
| `@ant/computer-use-mcp` | Computer Use MCP | postinstall stub — dead code |
226+
| `@ant/computer-use-input` | 鼠标/键盘控制 | postinstall stub — dead code |
227+
| `@ant/computer-use-swift` | macOS 原生截图 | postinstall stub — dead code |
229228

230229
**总结:所有核心 CLI 功能(文件操作、命令执行、搜索、API 调用、MCP 集成)均可正常使用。缺失的功能均为 Anthropic 内部实验性功能,在官方公开版本中同样不存在。**
231230

bun.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"start": "bun run src/main.tsx"
7+
"start": "bun run src/main.tsx",
8+
"postinstall": "bash scripts/postinstall.sh"
89
},
910
"dependencies": {
1011
"@alcalzone/ansi-tokenize": "^0.1.0",
@@ -90,6 +91,8 @@
9091
"ws": "^8.18.0",
9192
"xss": "^1.0.0",
9293
"yaml": "^2.8.3",
93-
"zod": "^3.23.0"
94+
"zod": "^3.23.0",
95+
"turndown": "^7.1.3",
96+
"@anthropic-ai/sandbox-runtime": "*"
9497
}
9598
}

scripts/postinstall.sh

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#!/bin/bash
2+
# postinstall.sh — Create stubs for Anthropic internal packages
3+
# Run automatically after `bun install` via package.json scripts
4+
5+
set -e
6+
7+
STUBS_DIR="node_modules/@ant"
8+
SANDBOX_DIR="node_modules/@anthropic-ai/sandbox-runtime"
9+
10+
echo "[postinstall] Creating stub packages..."
11+
12+
# ── @ant/claude-for-chrome-mcp ──────────────────────────────────────────────
13+
mkdir -p "$STUBS_DIR/claude-for-chrome-mcp"
14+
cat > "$STUBS_DIR/claude-for-chrome-mcp/package.json" << 'EOF'
15+
{ "name": "@ant/claude-for-chrome-mcp", "version": "0.0.0", "main": "index.js" }
16+
EOF
17+
cat > "$STUBS_DIR/claude-for-chrome-mcp/index.js" << 'EOF'
18+
module.exports = { BROWSER_TOOLS: [], setupClaudeInChrome: () => ({}) };
19+
EOF
20+
21+
# ── @ant/computer-use-input ─────────────────────────────────────────────────
22+
mkdir -p "$STUBS_DIR/computer-use-input"
23+
cat > "$STUBS_DIR/computer-use-input/package.json" << 'EOF'
24+
{ "name": "@ant/computer-use-input", "version": "0.0.0", "main": "index.js" }
25+
EOF
26+
cat > "$STUBS_DIR/computer-use-input/index.js" << 'EOF'
27+
module.exports = {};
28+
EOF
29+
30+
# ── @ant/computer-use-mcp ──────────────────────────────────────────────────
31+
mkdir -p "$STUBS_DIR/computer-use-mcp"
32+
cat > "$STUBS_DIR/computer-use-mcp/package.json" << 'EOF'
33+
{ "name": "@ant/computer-use-mcp", "version": "0.0.0", "main": "index.js" }
34+
EOF
35+
cat > "$STUBS_DIR/computer-use-mcp/index.js" << 'EOF'
36+
module.exports = {
37+
buildComputerUseTools: () => ({}),
38+
bindSessionContext: () => ({}),
39+
DEFAULT_GRANT_FLAGS: {},
40+
API_RESIZE_PARAMS: {},
41+
targetImageSize: () => ({ width: 0, height: 0 }),
42+
};
43+
EOF
44+
mkdir -p "$STUBS_DIR/computer-use-mcp/sentinelApps"
45+
cat > "$STUBS_DIR/computer-use-mcp/sentinelApps/index.js" << 'EOF'
46+
module.exports = { getSentinelCategory: () => '' };
47+
EOF
48+
mkdir -p "$STUBS_DIR/computer-use-mcp/types"
49+
cat > "$STUBS_DIR/computer-use-mcp/types/index.js" << 'EOF'
50+
module.exports = { DEFAULT_GRANT_FLAGS: {} };
51+
EOF
52+
53+
# ── @ant/computer-use-swift ─────────────────────────────────────────────────
54+
mkdir -p "$STUBS_DIR/computer-use-swift"
55+
cat > "$STUBS_DIR/computer-use-swift/package.json" << 'EOF'
56+
{ "name": "@ant/computer-use-swift", "version": "0.0.0", "main": "index.js" }
57+
EOF
58+
cat > "$STUBS_DIR/computer-use-swift/index.js" << 'EOF'
59+
module.exports = {};
60+
EOF
61+
62+
# ── @anthropic-ai/sandbox-runtime ───────────────────────────────────────────
63+
# Only create stub if not already installed (e.g. from npm)
64+
if [ ! -f "$SANDBOX_DIR/dist/index.js" ]; then
65+
echo "[postinstall] Creating sandbox-runtime stub (install @anthropic-ai/sandbox-runtime for real sandboxing)..."
66+
mkdir -p "$SANDBOX_DIR"
67+
cat > "$SANDBOX_DIR/package.json" << 'EOF'
68+
{ "name": "@anthropic-ai/sandbox-runtime", "version": "0.0.0-stub", "main": "index.js" }
69+
EOF
70+
cat > "$SANDBOX_DIR/index.js" << 'STUBEOF'
71+
class SandboxManager {
72+
static getFsReadConfig() { return null; }
73+
static getFsWriteConfig() { return null; }
74+
static getNetworkConfig() { return null; }
75+
static getNetworkRestrictionConfig() { return null; }
76+
static isSandboxingEnabled() { return false; }
77+
static isSupportedPlatform() { return false; }
78+
static areUnsandboxedCommandsAllowed() { return true; }
79+
static isAutoAllowBashIfSandboxedEnabled() { return false; }
80+
static getSandboxConfig() { return null; }
81+
static refreshConfig() {}
82+
static reset() { return Promise.resolve(); }
83+
static wrapWithSandbox(cmd) { return Promise.resolve(cmd); }
84+
static getExcludedCommands() { return []; }
85+
static getSandboxSettings() { return null; }
86+
static setSandboxSettings() {}
87+
static getIgnoreViolations() { return null; }
88+
static getIgnoreViolationsConfig() { return null; }
89+
static checkDependencies() { return { errors: [], warnings: [] }; }
90+
static initialize() { return Promise.resolve(); }
91+
static updateConfig() {}
92+
static getAllowUnixSockets() { return undefined; }
93+
static getAllowLocalBinding() { return undefined; }
94+
static getEnableWeakerNestedSandbox() { return undefined; }
95+
static getProxyPort() { return undefined; }
96+
static getSocksProxyPort() { return undefined; }
97+
static getLinuxHttpSocketPath() { return undefined; }
98+
static getLinuxSocksSocketPath() { return undefined; }
99+
static waitForNetworkInitialization() { return Promise.resolve(true); }
100+
static cleanupAfterCommand() {}
101+
static getSandboxViolationStore() { return new SandboxViolationStore(); }
102+
static annotateStderrWithSandboxFailures(_cmd, stderr) { return stderr; }
103+
static getLinuxGlobPatternWarnings() { return []; }
104+
}
105+
class SandboxViolationStore {
106+
constructor() {}
107+
addViolation() {}
108+
getViolations() { return []; }
109+
clear() {}
110+
}
111+
const SandboxRuntimeConfigSchema = {
112+
parse: (x) => x,
113+
safeParse: (x) => ({ success: true, data: x }),
114+
};
115+
module.exports = { SandboxManager, SandboxViolationStore, SandboxRuntimeConfigSchema };
116+
STUBEOF
117+
fi
118+
119+
echo "[postinstall] Stubs created."

0 commit comments

Comments
 (0)