mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-16 05:15:51 +00:00
Compare commits
8 Commits
v1.4.0
...
refactor/p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d60e0eaccb | ||
|
|
a3fa374bb3 | ||
|
|
b5c299f5d2 | ||
|
|
ac42ce2d67 | ||
|
|
c659912517 | ||
|
|
a14b7f352b | ||
|
|
c5ab83a3fc | ||
|
|
03b7f9b453 |
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@@ -8,7 +8,7 @@ on:
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: macos-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -24,11 +24,14 @@ jobs:
|
||||
run: bunx tsc --noEmit
|
||||
|
||||
- name: Test with Coverage
|
||||
run: bun test --coverage --coverage-reporter=lcov
|
||||
run: |
|
||||
set -o pipefail
|
||||
bun test --coverage --coverage-reporter=lcov 2>&1 | grep -vE '^\s*(\(pass\)|\(skip\))' | sed '/^.*\/__tests__\/.*:$/d' | cat -s
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
file: ./coverage/lcov.info
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Build
|
||||
|
||||
13
CLAUDE.md
13
CLAUDE.md
@@ -247,14 +247,23 @@ Feature flags control which functionality is enabled at runtime. 代码中统一
|
||||
## Testing
|
||||
|
||||
- **框架**: `bun:test`(内置断言 + mock)
|
||||
- **当前状态**: 2472 tests / 138 files / 0 fail
|
||||
- **当前状态**: 2992 tests / 188 files / 0 fail
|
||||
- **单元测试**: 就近放置于 `src/**/__tests__/`,文件名 `<module>.test.ts`
|
||||
- **集成测试**: `tests/integration/` — 4 个文件(cli-arguments, context-build, message-pipeline, tool-chain)
|
||||
- **共享 mock/fixture**: `tests/mocks/`(api-responses, file-system, fixtures/)
|
||||
- **命名**: `describe("functionName")` + `test("behavior description")`,英文
|
||||
- **Mock 模式**: 对重依赖模块使用 `mock.module()` + `await import()` 解锁(必须内联在测试文件中,不能从共享 helper 导入)
|
||||
- **包测试**: `packages/` 下各包也有独立测试(如 `color-diff-napi` 11 tests)
|
||||
|
||||
### Mock 使用规范
|
||||
|
||||
**只 mock 有副作用的依赖链,不 mock 纯函数/纯数据模块。**
|
||||
|
||||
被迫 mock 的根源:`log.ts` / `debug.ts` → `bootstrap/state.ts`(模块级 `realpathSync` / `randomUUID` 副作用)。必须 mock 的模块:`log.ts`、`debug.ts`、`bun:bundle`、`settings/settings.js`、`config.ts`、`auth.ts`、第三方网络库。
|
||||
|
||||
不要 mock:纯函数模块(`errors.ts`、`stringUtils.js`)、mock 值与真实实现相同的模块、mock 路径与实际 import 不匹配的模块。
|
||||
|
||||
路径规则:统一用 `.ts` 扩展名 + `src/*` 别名路径,禁止双重 mock 同一模块。
|
||||
|
||||
### 类型检查
|
||||
|
||||
项目使用 TypeScript strict 模式,**tsc 必须零错误**。每次修改后运行:
|
||||
|
||||
19
README.md
19
README.md
@@ -10,28 +10,25 @@
|
||||
|
||||
> Which Claude do you like? The open source one is the best.
|
||||
|
||||
牢 A (Anthropic) 官方 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI 工具的源码反编译/逆向还原项目。目标是将 Claude Code 大部分功能及工程化能力复现 (问就是老佛爷已经付过钱了)。虽然很难绷, 但是它叫做 CCB(踩踩背)...
|
||||
牢 A (Anthropic) 官方 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI 工具的源码反编译/逆向还原项目。目标是将 Claude Code 大部分功能及工程化能力复现 (问就是老佛爷已经付过钱了)。虽然很难绷, 但是它叫做 CCB(踩踩背)... 而且, 我们实现了企业版或者需要登陆 Claude 账号才能使用的特性, 实现技术普惠
|
||||
|
||||
[文档在这里, 支持投稿 PR](https://ccb.agent-aura.top/) | [留影文档在这里](./Friends.md) | [Discord 群组](https://discord.gg/qZU6zS7Q)
|
||||
|
||||
| 特性 | 说明 | 文档 |
|
||||
|------|------|------|
|
||||
| **Claude 群控技术** | Pipe IPC 多实例协作:同机 main/sub 自动编排 + LAN 跨机器零配置发现与通讯,`/pipes` 选择面板 + `Shift+↓` 交互 + 消息广播路由 | [Pipe IPC](https://ccb.agent-aura.top/docs/features/pipes-and-lan) / [LAN](https://ccb.agent-aura.top/docs/features/lan-pipes) |
|
||||
| ACP 协议一等一支持 | 支持接入 Zed、Cursor 等 IDE,支持会话恢复、Skills、权限桥接 | [文档](https://ccb.agent-aura.top/docs/features/acp-zed) |
|
||||
| Remote Control 私有部署 | Docker 自托管 RCS + Web UI | [文档](https://ccb.agent-aura.top/docs/features/remote-control-self-hosting) |
|
||||
| /dream 记忆整理 | 自动整理和优化记忆文件 | [文档](https://ccb.agent-aura.top/docs/features/auto-dream) |
|
||||
| Web Search | 内置网页搜索工具 | [文档](https://ccb.agent-aura.top/docs/features/web-browser-tool) |
|
||||
| 自定义模型供应商 | OpenAI/Anthropic/Gemini/Grok 兼容 | [文档](https://ccb.agent-aura.top/docs/features/custom-platform-login) |
|
||||
| **ACP 协议一等一支持** | 支持接入 Zed、Cursor 等 IDE,支持会话恢复、Skills、权限桥接 | [文档](https://ccb.agent-aura.top/docs/features/acp-zed) |
|
||||
| **Remote Control 私有部署** | Docker 自托管远程界面, 可以手机上看 CC | [文档](https://ccb.agent-aura.top/docs/features/remote-control-self-hosting) |
|
||||
| **Langfuse 监控** | 企业级 Agent 监控, 可以清晰看到每次 agent loop 细节, 可以一键转化为数据集 | [文档](https://ccb.agent-aura.top/docs/features/langfuse-monitoring) |
|
||||
| **Web Search** | 内置网页搜索工具, 支持 bing 和 brave 搜索 | [文档](https://ccb.agent-aura.top/docs/features/web-browser-tool) |
|
||||
| **Poor Mode** | 穷鬼模式,关闭记忆提取和键入建议,大幅度减少并发请求 | /poor 可以开关 |
|
||||
| **自定义模型供应商** | OpenAI/Anthropic/Gemini/Grok 兼容 | [文档](https://ccb.agent-aura.top/docs/features/custom-platform-login) |
|
||||
| Voice Mode | Push-to-Talk 语音输入 | [文档](https://ccb.agent-aura.top/docs/features/voice-mode) |
|
||||
| Computer Use | 屏幕截图、键鼠控制 | [文档](https://ccb.agent-aura.top/docs/features/computer-use) |
|
||||
| Chrome Use | 浏览器自动化、表单填写、数据抓取 | [自托管](https://ccb.agent-aura.top/docs/features/chrome-use-mcp) [原生版](https://ccb.agent-aura.top/docs/features/claude-in-chrome-mcp) |
|
||||
| Sentry | 企业级错误追踪 | [文档](https://ccb.agent-aura.top/docs/internals/sentry-setup) |
|
||||
| GrowthBook | 企业级特性开关 | [文档](https://ccb.agent-aura.top/docs/internals/growthbook-adapter) |
|
||||
| Langfuse 监控 | LLM 调用/工具执行/多 Agent 全链路追踪 | [文档](https://ccb.agent-aura.top/docs/features/langfuse-monitoring) |
|
||||
| Poor Mode | 穷鬼模式,关闭记忆提取和键入建议 | /poor 可以开关 |
|
||||
|
||||
|
||||
- 🔮 [ ] V6 — 大规模重构石山代码,全面模块分包(全新分支,main 封存为历史版本)
|
||||
| /dream 记忆整理 | 自动整理和优化记忆文件 | [文档](https://ccb.agent-aura.top/docs/features/auto-dream) |
|
||||
|
||||
- 🚀 [想要启动项目](#快速开始源码版)
|
||||
- 🐛 [想要调试项目](#vs-code-调试)
|
||||
|
||||
4
bun.lock
4
bun.lock
@@ -6,7 +6,7 @@
|
||||
"name": "claude-code-best",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^0.19.0",
|
||||
"@claude-code-best/mcp-chrome-bridge": "^2.0.7",
|
||||
"@claude-code-best/mcp-chrome-bridge": "^2.0.8",
|
||||
"ws": "^8.20.0",
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -460,7 +460,7 @@
|
||||
|
||||
"@claude-code-best/builtin-tools": ["@claude-code-best/builtin-tools@workspace:packages/builtin-tools"],
|
||||
|
||||
"@claude-code-best/mcp-chrome-bridge": ["@claude-code-best/mcp-chrome-bridge@2.0.7", "https://registry.npmmirror.com/@claude-code-best/mcp-chrome-bridge/-/mcp-chrome-bridge-2.0.7.tgz", { "dependencies": { "@fastify/cors": "^11.0.1", "@modelcontextprotocol/sdk": "^1.11.0", "chalk": "^5.4.1", "chrome-mcp-shared": "^1.0.2", "commander": "^13.1.0", "fastify": "^5.3.2", "is-admin": "^4.0.0", "pino": "^9.6.0", "uuid": "^11.1.0" }, "bin": { "mcp-chrome-bridge": "dist/cli.js", "mcp-chrome-stdio": "dist/mcp/mcp-server-stdio.js" } }, "sha512-gb64+Ga6li3A8Ll9NKV+ePBn5/U0fccCdrH43tGYveLKZIZxURz8cbY+Z3BdbTdYSPVdFXtfUlp3TMxu4OT5gg=="],
|
||||
"@claude-code-best/mcp-chrome-bridge": ["@claude-code-best/mcp-chrome-bridge@2.0.8", "https://registry.npmmirror.com/@claude-code-best/mcp-chrome-bridge/-/mcp-chrome-bridge-2.0.8.tgz", { "dependencies": { "@fastify/cors": "^11.0.1", "@modelcontextprotocol/sdk": "^1.11.0", "chalk": "^5.4.1", "chrome-mcp-shared": "^1.0.2", "commander": "^13.1.0", "fastify": "^5.3.2", "is-admin": "^4.0.0", "pino": "^9.6.0", "uuid": "^11.1.0" }, "bin": { "mcp-chrome-bridge": "dist/cli.js", "mcp-chrome-stdio": "dist/mcp/mcp-server-stdio.js" } }, "sha512-f7J1e4PQ6qxXzdHwL7QRrMZ4lPfD/L1MWxWDbyHmHY7jaW2GL6WcArKpk/fApg3V/q0racqUWzXHQdpE/HJZqg=="],
|
||||
|
||||
"@claude-code-best/mcp-client": ["@claude-code-best/mcp-client@workspace:packages/mcp-client"],
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-code-best",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"description": "Reverse-engineered Anthropic Claude Code CLI — interactive AI coding assistant in the terminal",
|
||||
"type": "module",
|
||||
"author": "claude-code-best <claude-code-best@proton.me>",
|
||||
@@ -54,14 +54,14 @@
|
||||
"test": "bun test",
|
||||
"check:unused": "knip-bun",
|
||||
"health": "bun run scripts/health-check.ts",
|
||||
"postinstall": "node scripts/postinstall.cjs && node scripts/setup-chrome-mcp.mjs",
|
||||
"postinstall": "node scripts/run-parallel.mjs scripts/postinstall.cjs scripts/setup-chrome-mcp.mjs",
|
||||
"docs:dev": "npx mintlify dev",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"rcs": "bun run scripts/rcs.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^0.19.0",
|
||||
"@claude-code-best/mcp-chrome-bridge": "^2.0.7",
|
||||
"@claude-code-best/mcp-chrome-bridge": "^2.0.8",
|
||||
"ws": "^8.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -87,7 +87,7 @@ mock.module("src/tasks/LocalAgentTask/LocalAgentTask.js", () => ({
|
||||
updateProgressFromMessage: noop,
|
||||
}));
|
||||
|
||||
mock.module("src/utils/debug.js", () => ({
|
||||
mock.module("src/utils/debug.ts", () => ({
|
||||
getMinDebugLogLevel: () => "warn",
|
||||
isDebugMode: () => false,
|
||||
enableDebugLogging: () => false,
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
import { mock, describe, expect, test } from "bun:test";
|
||||
|
||||
// Mock commands.ts to cut the heavy shell/prefix.ts → analytics → api chain
|
||||
mock.module("src/utils/bash/commands.ts", () => ({
|
||||
splitCommand_DEPRECATED: (cmd: string) =>
|
||||
cmd.split(/\s*(?:[|;&]+)\s*/).filter(Boolean),
|
||||
quote: (args: string[]) => args.join(" "),
|
||||
}));
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
const { interpretCommandResult } = await import("../commandSemantics");
|
||||
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
import { mock, describe, expect, test } from "bun:test";
|
||||
|
||||
mock.module("src/utils/debug.js", () => ({
|
||||
mock.module("src/utils/debug.ts", () => ({
|
||||
logForDebugging: () => {},
|
||||
isDebugMode: () => false,
|
||||
}));
|
||||
|
||||
mock.module("src/utils/errors.js", () => ({
|
||||
errorMessage: (e: unknown) => String(e),
|
||||
}));
|
||||
|
||||
mock.module("src/utils/stringUtils.js", () => ({
|
||||
plural: (n: number, singular: string, plural?: string) =>
|
||||
n === 1 ? singular : (plural ?? singular + "s"),
|
||||
}));
|
||||
|
||||
const {
|
||||
formatGoToDefinitionResult,
|
||||
formatFindReferencesResult,
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/** SDK 消息类型 — 与 CC CLI bridge 模块兼容 */
|
||||
export interface SDKMessage {
|
||||
type: string;
|
||||
content?: unknown;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface UserMessage extends SDKMessage {
|
||||
type: "user";
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface AssistantMessage extends SDKMessage {
|
||||
type: "assistant";
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface PermissionRequest extends SDKMessage {
|
||||
type: "permission_request";
|
||||
tool_name: string;
|
||||
tool_input: unknown;
|
||||
}
|
||||
|
||||
export interface PermissionResponse extends SDKMessage {
|
||||
type: "permission_response";
|
||||
approved: boolean;
|
||||
request_id: string;
|
||||
}
|
||||
|
||||
export interface ControlRequest extends SDKMessage {
|
||||
type: "control_request";
|
||||
action: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export type SessionEventType =
|
||||
| "user"
|
||||
| "assistant"
|
||||
| "permission_request"
|
||||
| "permission_response"
|
||||
| "control_request"
|
||||
| "tool_use"
|
||||
| "tool_result"
|
||||
| "status"
|
||||
| "error";
|
||||
|
||||
// --- Normalized Event Payloads (SSE contract) ---
|
||||
|
||||
export interface NormalizedEventPayload {
|
||||
content: string;
|
||||
raw?: unknown;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface UserEventPayload extends NormalizedEventPayload {
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface AssistantEventPayload extends NormalizedEventPayload {
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface ToolUseEventPayload extends NormalizedEventPayload {
|
||||
content: string;
|
||||
tool_name: string;
|
||||
tool_input: unknown;
|
||||
}
|
||||
|
||||
export interface ToolResultEventPayload extends NormalizedEventPayload {
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface PermissionEventPayload extends NormalizedEventPayload {
|
||||
content: string;
|
||||
request_id: string;
|
||||
request: {
|
||||
subtype: string;
|
||||
tool_name: string;
|
||||
tool_input: unknown;
|
||||
};
|
||||
}
|
||||
@@ -597,7 +597,7 @@ function renderSystemMessage(text) {
|
||||
const LOADING_ID = "loading-indicator";
|
||||
|
||||
// TUI star spinner frames (same as Claude Code CLI)
|
||||
const SPINNER_FRAMES = ["·", "✢", "✳", "✶", "✻", "✽"];
|
||||
const SPINNER_FRAMES = ["·", "✢", "✱", "✶", "✻", "✽"];
|
||||
const SPINNER_CYCLE = [...SPINNER_FRAMES, ...SPINNER_FRAMES.slice().reverse()];
|
||||
|
||||
// 204 verbs from TUI src/constants/spinnerVerbs.ts
|
||||
|
||||
10
scripts/run-parallel.mjs
Normal file
10
scripts/run-parallel.mjs
Normal file
@@ -0,0 +1,10 @@
|
||||
import { spawn } from "node:child_process"
|
||||
|
||||
const scripts = process.argv.slice(2)
|
||||
if (scripts.length === 0) {
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
for (const script of scripts) {
|
||||
spawn(process.execPath, [script], { stdio: "inherit", shell: false })
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/env bun
|
||||
/**
|
||||
* Verify GrowthBook gate defaults and compile-time feature flags.
|
||||
*
|
||||
* Usage:
|
||||
* bun run scripts/verify-gates.ts
|
||||
*
|
||||
* This script checks that LOCAL_GATE_DEFAULTS are being returned correctly
|
||||
* when GrowthBook is not connected, and that compile-time feature flags
|
||||
* are properly enabled.
|
||||
*/
|
||||
|
||||
// We can't import feature() from bun:bundle in a standalone script,
|
||||
// so we test the GrowthBook layer directly.
|
||||
|
||||
import {
|
||||
getFeatureValue_CACHED_MAY_BE_STALE,
|
||||
checkStatsigFeatureGate_CACHED_MAY_BE_STALE,
|
||||
} from '../src/services/analytics/growthbook.js'
|
||||
|
||||
interface GateCheck {
|
||||
name: string
|
||||
gate: string
|
||||
expected: unknown
|
||||
category: string
|
||||
/** If set, this compile flag must also be enabled at build time */
|
||||
compileFlag?: string
|
||||
}
|
||||
|
||||
const gates: GateCheck[] = [
|
||||
// P0: Pure local
|
||||
{ name: 'Custom keybindings', gate: 'tengu_keybinding_customization_release', expected: true, category: 'P0' },
|
||||
{ name: 'Streaming tool exec', gate: 'tengu_streaming_tool_execution2', expected: true, category: 'P0' },
|
||||
{ name: 'Cron tasks', gate: 'tengu_kairos_cron', expected: true, category: 'P0' },
|
||||
{ name: 'JSON tools format', gate: 'tengu_amber_json_tools', expected: true, category: 'P0' },
|
||||
{ name: 'Immediate model cmd', gate: 'tengu_immediate_model_command', expected: true, category: 'P0' },
|
||||
{ name: 'MCP delta', gate: 'tengu_basalt_3kr', expected: true, category: 'P0' },
|
||||
{ name: 'Leaf pruning', gate: 'tengu_pebble_leaf_prune', expected: true, category: 'P0' },
|
||||
{ name: 'Message smooshing', gate: 'tengu_chair_sermon', expected: true, category: 'P0' },
|
||||
{ name: 'Deep link', gate: 'tengu_lodestone_enabled', expected: true, category: 'P0', compileFlag: 'LODESTONE' },
|
||||
{ name: 'Auto background', gate: 'tengu_auto_background_agents', expected: true, category: 'P0' },
|
||||
{ name: 'Fine-grained tools', gate: 'tengu_fgts', expected: true, category: 'P0' },
|
||||
|
||||
// P1: API-dependent
|
||||
{ name: 'Session memory', gate: 'tengu_session_memory', expected: true, category: 'P1' },
|
||||
{ name: 'Auto memory extract', gate: 'tengu_passport_quail', expected: true, category: 'P1', compileFlag: 'EXTRACT_MEMORIES' },
|
||||
{ name: 'Memory skip index', gate: 'tengu_moth_copse', expected: true, category: 'P1' },
|
||||
{ name: 'Memory search section', gate: 'tengu_coral_fern', expected: true, category: 'P1' },
|
||||
{ name: 'Prompt suggestions', gate: 'tengu_chomp_inflection', expected: true, category: 'P1' },
|
||||
{ name: 'Verification agent', gate: 'tengu_hive_evidence', expected: true, category: 'P1', compileFlag: 'VERIFICATION_AGENT' },
|
||||
{ name: 'Brief mode', gate: 'tengu_kairos_brief', expected: true, category: 'P1', compileFlag: 'KAIROS_BRIEF' },
|
||||
{ name: 'Away summary', gate: 'tengu_sedge_lantern', expected: true, category: 'P1', compileFlag: 'AWAY_SUMMARY' },
|
||||
{ name: 'Idle return prompt', gate: 'tengu_willow_mode', expected: 'dialog', category: 'P1' },
|
||||
|
||||
// Kill switches
|
||||
{ name: 'Ultrathink', gate: 'tengu_turtle_carbon', expected: true, category: 'KS', compileFlag: 'ULTRATHINK' },
|
||||
{ name: 'Explore/Plan agents', gate: 'tengu_amber_stoat', expected: true, category: 'KS', compileFlag: 'BUILTIN_EXPLORE_PLAN_AGENTS' },
|
||||
{ name: 'Agent teams', gate: 'tengu_amber_flint', expected: true, category: 'KS' },
|
||||
{ name: 'Slim subagent CLAUDE.md', gate: 'tengu_slim_subagent_claudemd', expected: true, category: 'KS' },
|
||||
{ name: 'Bash security', gate: 'tengu_birch_trellis', expected: true, category: 'KS' },
|
||||
{ name: 'macOS clipboard', gate: 'tengu_collage_kaleidoscope', expected: true, category: 'KS' },
|
||||
{ name: 'Compact cache prefix', gate: 'tengu_compact_cache_prefix', expected: true, category: 'KS' },
|
||||
{ name: 'Durable cron', gate: 'tengu_kairos_cron_durable', expected: true, category: 'KS' },
|
||||
{ name: 'Attribution header', gate: 'tengu_attribution_header', expected: true, category: 'KS' },
|
||||
{ name: 'Agent progress', gate: 'tengu_slate_prism', expected: true, category: 'KS' },
|
||||
]
|
||||
|
||||
console.log('=== GrowthBook Local Gate Verification ===\n')
|
||||
|
||||
let pass = 0
|
||||
let fail = 0
|
||||
|
||||
for (const category of ['P0', 'P1', 'KS']) {
|
||||
const label = category === 'KS' ? 'Kill Switches' : category
|
||||
console.log(`--- ${label} ---`)
|
||||
|
||||
for (const check of gates.filter(g => g.category === category)) {
|
||||
const actual = typeof check.expected === 'boolean'
|
||||
? checkStatsigFeatureGate_CACHED_MAY_BE_STALE(check.gate)
|
||||
: getFeatureValue_CACHED_MAY_BE_STALE(check.gate, null)
|
||||
|
||||
const matches = typeof check.expected === 'boolean'
|
||||
? actual === check.expected
|
||||
: actual === check.expected || JSON.stringify(actual) === JSON.stringify(check.expected)
|
||||
|
||||
const status = matches ? '\x1b[32mPASS\x1b[0m' : '\x1b[31mFAIL\x1b[0m'
|
||||
const flagNote = check.compileFlag ? ` [needs feature('${check.compileFlag}')]` : ''
|
||||
|
||||
console.log(` ${status} ${check.name}: ${check.gate} = ${JSON.stringify(actual)}${flagNote}`)
|
||||
|
||||
if (matches) pass++
|
||||
else fail++
|
||||
}
|
||||
console.log()
|
||||
}
|
||||
|
||||
console.log(`\nResult: ${pass} passed, ${fail} failed out of ${pass + fail} gates`)
|
||||
|
||||
if (fail > 0) {
|
||||
console.log('\n\x1b[31mSome gates are not returning expected values!\x1b[0m')
|
||||
console.log('If CLAUDE_CODE_DISABLE_LOCAL_GATES=1 is set, all gates will return defaults.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('\n\x1b[32mAll GrowthBook gates returning expected local defaults.\x1b[0m')
|
||||
console.log('\nNote: Compile-time feature() flags cannot be verified in this script.')
|
||||
console.log('Use "bun run dev" and test manually for features with [needs feature()] markers.')
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type HookEvent = any;
|
||||
export type ModelUsage = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type AgentColorName = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type HookCallbackMatcher = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type SessionId = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type randomUUID = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type ModelSetting = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type ModelStrings = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type SettingSource = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type resetSettingsCache = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type PluginHookMatcher = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type createSignal = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type StdoutMessage = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type ask = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type installOAuthTokens = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type RemoteIO = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type StructuredIO = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type collectContextData = any;
|
||||
@@ -1,14 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type SDKStatus = any;
|
||||
export type ModelInfo = any;
|
||||
export type SDKMessage = any;
|
||||
export type SDKUserMessage = any;
|
||||
export type SDKUserMessageReplay = any;
|
||||
export type PermissionResult = any;
|
||||
export type McpServerConfigForProcessTransport = any;
|
||||
export type McpServerStatus = any;
|
||||
export type RewindFilesResult = any;
|
||||
export type HookEvent = any;
|
||||
export type HookInput = any;
|
||||
export type HookJSONOutput = any;
|
||||
export type PermissionUpdate = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type SDKControlElicitationResponseSchema = any;
|
||||
@@ -1,9 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type StdoutMessage = any;
|
||||
export type SDKControlInitializeRequest = any;
|
||||
export type SDKControlInitializeResponse = any;
|
||||
export type SDKControlRequest = any;
|
||||
export type SDKControlResponse = any;
|
||||
export type SDKControlMcpSetServersResponse = any;
|
||||
export type SDKControlReloadPluginsResponse = any;
|
||||
export type StdinMessage = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type CanUseToolFn = any;
|
||||
@@ -1,5 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type tryGenerateSuggestion = any;
|
||||
export type logSuggestionOutcome = any;
|
||||
export type logSuggestionSuppressed = any;
|
||||
export type PromptVariant = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getFeatureValue_CACHED_MAY_BE_STALE = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type logEvent = any;
|
||||
export type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type isQualifiedForGrove = any;
|
||||
export type checkGroveForNonInteractive = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type EMPTY_USAGE = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type statusListeners = any;
|
||||
export type ClaudeAILimits = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type performMCPOAuthFlow = any;
|
||||
export type revokeServerTokens = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type isChannelAllowlisted = any;
|
||||
export type isChannelsEnabled = any;
|
||||
@@ -1,5 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type ChannelMessageNotificationSchema = any;
|
||||
export type gateChannelServer = any;
|
||||
export type wrapChannelMessage = any;
|
||||
export type findChannelEntry = any;
|
||||
@@ -1,7 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type setupSdkMcpClients = any;
|
||||
export type connectToServer = any;
|
||||
export type clearServerCache = any;
|
||||
export type fetchToolsForClient = any;
|
||||
export type areMcpConfigsEqual = any;
|
||||
export type reconnectMcpServerImpl = any;
|
||||
@@ -1,6 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type filterMcpServersByPolicy = any;
|
||||
export type getMcpConfigByName = any;
|
||||
export type isMcpServerDisabled = any;
|
||||
export type setMcpServerEnabled = any;
|
||||
export type getAllMcpConfigs = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type runElicitationHooks = any;
|
||||
export type runElicitationResultHooks = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getMcpPrefix = any;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type MCPServerConnection = any;
|
||||
export type McpSdkServerConfig = any;
|
||||
export type ScopedMcpServerConfig = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type commandBelongsToServer = any;
|
||||
export type filterToolsByServer = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type setupVscodeSdkMcp = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type OAuthService = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type isPolicyAllowed = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type waitForRemoteManagedSettingsToLoad = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type downloadUserSettings = any;
|
||||
export type redownloadUserSettings = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type AppState = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type externalMetadataToAppState = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type assembleToolPool = any;
|
||||
export type filterToolsByDenyRules = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type createAbortController = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type uniq = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getAccountInformation = any;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getLatestVersion = any;
|
||||
export type InstallStatus = any;
|
||||
export type installGlobalPackage = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type AwsAuthStatusManager = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type modelSupportsAutoMode = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type registerCleanup = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type createCombinedAbortSignal = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type notifyCommandLifecycle = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type incrementPromptCount = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type regenerateCompletionCache = any;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getGlobalConfig = any;
|
||||
export type InstallMethod = any;
|
||||
export type saveGlobalConfig = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type loadConversationForResume = any;
|
||||
export type TurnInterruptionState = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getCwd = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type logForDebugging = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type logForDiagnosticsNoPII = any;
|
||||
export type withDiagnosticsTiming = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getDoctorDiagnostic = any;
|
||||
@@ -1,5 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type modelSupportsEffort = any;
|
||||
export type modelSupportsMaxEffort = any;
|
||||
export type EFFORT_LEVELS = any;
|
||||
export type resolveAppliedEffort = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type AbortError = any;
|
||||
@@ -1,5 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type isFastModeAvailable = any;
|
||||
export type isFastModeEnabled = any;
|
||||
export type isFastModeSupportedByModel = any;
|
||||
export type getFastModeState = any;
|
||||
@@ -1,5 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type fileHistoryRewind = any;
|
||||
export type fileHistoryCanRestore = any;
|
||||
export type fileHistoryEnabled = any;
|
||||
export type fileHistoryGetDiffStats = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type executeFilePersistence = any;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type createFileStateCacheWithSizeLimit = any;
|
||||
export type mergeFileStateCaches = any;
|
||||
export type READ_FILE_STATE_CACHE_SIZE = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getLastCacheSafeParams = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type fromArray = any;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type gracefulShutdown = any;
|
||||
export type gracefulShutdownSync = any;
|
||||
export type isShuttingDown = any;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type headlessProfilerStartTurn = any;
|
||||
export type headlessProfilerCheckpoint = any;
|
||||
export type logHeadlessProfilerTurn = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type executeNotificationHooks = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type finalizePendingAsyncHooks = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type registerHookEventHandler = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type createIdleTimeoutManager = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type safeParseJSON = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type installOrUpdateClaudePackage = any;
|
||||
export type localInstallationExists = any;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getInMemoryErrors = any;
|
||||
export type logError = any;
|
||||
export type logMCPDebug = any;
|
||||
@@ -1,8 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type dequeue = any;
|
||||
export type dequeueAllMatching = any;
|
||||
export type enqueue = any;
|
||||
export type hasCommandsInQueue = any;
|
||||
export type peek = any;
|
||||
export type subscribeToCommandQueue = any;
|
||||
export type getCommandsByMaxPriority = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type createModelSwitchBreadcrumbs = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type toInternalMessages = any;
|
||||
export type toSDKRateLimitInfo = any;
|
||||
@@ -1,5 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getDefaultMainLoopModel = any;
|
||||
export type getMainLoopModel = any;
|
||||
export type modelDisplayString = any;
|
||||
export type parseUserSpecifiedModel = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getModelOptions = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type ensureModelStringsInitialized = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getAPIProvider = any;
|
||||
@@ -1,3 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type installLatest = any;
|
||||
export type removeInstalledSymlink = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type getPackageManager = any;
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type expandPath = any;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user