claude-code-best
00b044e8b2
支持 OpenAI Chat 兼容协议 ( #99 )
...
* feat: 完成 openai 接口兼容
* feat: 完成 openai 协议兼容
* fix: 修复测试用例
2026-04-03 23:33:17 +08:00
JiayuWang(王嘉宇)
465e9f01c6
test: add coverage for formatRelativeTimeAgo and formatLogMetadata ( #94 )
...
These two exported functions in src/utils/format.ts had no test
coverage. formatRelativeTimeAgo wraps formatRelativeTime and forces
numeric:'always' for past dates; formatLogMetadata assembles parts
(time, branch, size/count, tag, agentSetting, prNumber) into a
' · '-separated string.
Added 8 tests for formatRelativeTimeAgo covering past dates, future
dates, equal-to-now, and the no-'ago'-for-future invariant. Added
9 tests for formatLogMetadata covering all optional fields and the
separator format.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-03 22:17:58 +08:00
claude-code-best
2cc626c1c3
fix: 修复测试文件
2026-04-03 20:11:09 +08:00
claude-code-best
5a7d06fe99
refactor(buddy): align companion system with official CLI ( #82 )
...
* refactor(buddy): align companion system with official CLI
## Summary
Reverse-engineered the official Claude Code CLI (v2.1.91) buddy/companion
system and aligned our implementation to match.
## Changes (7 files)
### Added
- `src/buddy/CompanionCard.tsx` (+109)
JSX bordered card matching official vc8: rarity header, colored sprite,
name, personality, 10-bar stats, last reaction in nested border.
- `src/buddy/companionReact.ts` (+156)
Reaction system matching official ZUK+Dc8: 45s rate limiting, @-mention
detection, transcript builder (12 msgs, 5000 chars), POST buddy_react API.
### Modified
- `src/commands/buddy/index.ts`
type: local -> local-jsx, description/argumentHint/immediate/isHidden.
- `src/commands/buddy/buddy.ts`
LocalCommandCall -> LocalJSXCommandCall signature (onDone, context, args).
Removed mute/unmute/rehatch (official uses off/on only).
/buddy show returns CompanionCard JSX instead of plain text.
Pet auto-unmutes. companionMuted writes globalConfig (matches UI read source).
- `src/screens/REPL.tsx` (line 2808)
globalThis.fireCompanionObserver -> import triggerCompanionReaction.
- `src/state/AppStateStore.ts` — comment fix.
- `src/types/global.d.ts` — removed fireCompanionObserver declaration.
## Data flow (verified consistent)
- companionMuted: saveGlobalConfig() <-> getGlobalConfig() (6 read sites)
- companionReaction: setAppState() <-> useAppState() (4 sites)
- companionPetAt: setAppState() <-> useAppState() (2 sites)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
* fix(buddy): address CodeRabbit review findings
- buddy.ts: return type Promise<null> → Promise<React.ReactNode>
to match LocalJSXCommandCall interface (CompanionCard path returns
ReactElement, not null).
- CompanionCard.tsx: clamp stat value to 0..100 before .repeat()
to prevent negative count runtime error on out-of-range values.
Import path alias suggestions (src/ vs ../) dismissed — project
convention uses relative paths (verified against color.ts, help.ts).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
* fix(buddy): address second round CodeRabbit findings
- buddy.ts:105: remove unsafe (context as any).messages cast.
ToolUseContext already declares messages: Message[] at Tool.ts:250,
so context.messages is properly typed. Other commands (feedback,
copy, export) access it the same way without cast.
- companionReact.ts:154: wrap resp.json() in try/catch for defensive
JSON parsing. Malformed 200 responses now return null instead of
propagating to the outer catch.
Rate-limit timing (set before API call) kept as-is — matches official
ZUK pattern: prevents retry-storm on transient failures.
src/ path alias suggestions dismissed — project uses relative paths.
Auto-unmute on /buddy view kept — matches official behavior.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
---------
Co-authored-by: unraid <local@unraid.local >
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-03 17:22:54 +08:00
claude-code-best
cf44cc32e4
Merge branch 'pr/amDosion/60'
2026-04-03 17:21:09 +08:00
unraid
e74d1f0836
fix(buddy): address second round CodeRabbit findings
...
- buddy.ts:105: remove unsafe (context as any).messages cast.
ToolUseContext already declares messages: Message[] at Tool.ts:250,
so context.messages is properly typed. Other commands (feedback,
copy, export) access it the same way without cast.
- companionReact.ts:154: wrap resp.json() in try/catch for defensive
JSON parsing. Malformed 200 responses now return null instead of
propagating to the outer catch.
Rate-limit timing (set before API call) kept as-is — matches official
ZUK pattern: prevents retry-storm on transient failures.
src/ path alias suggestions dismissed — project uses relative paths.
Auto-unmute on /buddy view kept — matches official behavior.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-03 17:16:16 +08:00
unraid
7d4adce1b6
fix(buddy): address CodeRabbit review findings
...
- buddy.ts: return type Promise<null> → Promise<React.ReactNode>
to match LocalJSXCommandCall interface (CompanionCard path returns
ReactElement, not null).
- CompanionCard.tsx: clamp stat value to 0..100 before .repeat()
to prevent negative count runtime error on out-of-range values.
Import path alias suggestions (src/ vs ../) dismissed — project
convention uses relative paths (verified against color.ts, help.ts).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-03 17:00:01 +08:00
unraid
991119491c
refactor(buddy): align companion system with official CLI
...
## Summary
Reverse-engineered the official Claude Code CLI (v2.1.91) buddy/companion
system and aligned our implementation to match.
## Changes (7 files)
### Added
- `src/buddy/CompanionCard.tsx` (+109)
JSX bordered card matching official vc8: rarity header, colored sprite,
name, personality, 10-bar stats, last reaction in nested border.
- `src/buddy/companionReact.ts` (+156)
Reaction system matching official ZUK+Dc8: 45s rate limiting, @-mention
detection, transcript builder (12 msgs, 5000 chars), POST buddy_react API.
### Modified
- `src/commands/buddy/index.ts`
type: local -> local-jsx, description/argumentHint/immediate/isHidden.
- `src/commands/buddy/buddy.ts`
LocalCommandCall -> LocalJSXCommandCall signature (onDone, context, args).
Removed mute/unmute/rehatch (official uses off/on only).
/buddy show returns CompanionCard JSX instead of plain text.
Pet auto-unmutes. companionMuted writes globalConfig (matches UI read source).
- `src/screens/REPL.tsx` (line 2808)
globalThis.fireCompanionObserver -> import triggerCompanionReaction.
- `src/state/AppStateStore.ts` — comment fix.
- `src/types/global.d.ts` — removed fireCompanionObserver declaration.
## Data flow (verified consistent)
- companionMuted: saveGlobalConfig() <-> getGlobalConfig() (6 read sites)
- companionReaction: setAppState() <-> useAppState() (4 sites)
- companionPetAt: setAppState() <-> useAppState() (2 sites)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-03 16:36:22 +08:00
claude-code-best
a7604f6591
feat: /login 命令新增自定义 anthropic 终端登陆
2026-04-03 14:22:47 +08:00
claude-code-best
a02a9fc4c2
fix: 修复定义导入缺失的问题
2026-04-03 14:14:35 +08:00
claude-code-best
e944633dd8
fix: 修复 ERROR getAntModels is not defined
...
Fixes #69
2026-04-03 11:56:49 +08:00
claude-code-best
e74c009e02
feat: 添加 GrowthBook 自定义服务器适配器
...
通过 CLAUDE_GB_ADAPTER_URL/KEY 环境变量连接自定义 GrowthBook 实例,
无配置时所有 feature 读取返回代码默认值。支持 GrowthBook Cloud(非 remoteEval),
含完整文档和 feature key 列表。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-03 10:37:15 +08:00
claude-code-best
78144b4dba
feat: 关闭 Datadog 日志发送
2026-04-03 09:49:59 +08:00
claude-code-best
e32c159f35
feat: 关闭自动更新
2026-04-03 09:39:32 +08:00
claude-code-best
119518599e
feat: 更新 sentry 错误上报
2026-04-03 09:39:25 +08:00
unraid
e784f231d4
fix: validate and encode target sessionId in peer messages
...
- Trim and normalize target before use
- Validate with validateBridgeId allowlist (same as bridgeApi.ts)
- URL-encode compatTarget to prevent path traversal/injection
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-03 04:23:32 +08:00
unraid
8645d37b25
fix: add Authorization header to peer message requests
...
getBridgeAccessToken() provides the OAuth Bearer token, matching
the auth pattern used by bridgeApi.ts and codeSessionApi.ts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-03 04:15:24 +08:00
unraid
1d38eae536
fix: address CodeRabbit review findings
...
- webhookSanitizer: redact before truncate to avoid split secrets at boundary
- webhookSanitizer: return safe placeholder on error instead of raw content
- peerSessions: use discriminated union return type for type safety
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-03 04:08:04 +08:00
unraid
74e51e7e73
feat: enable Remote Control (BRIDGE_MODE) with stub completions
...
- Add BRIDGE_MODE to DEFAULT_FEATURES in dev.ts
- Implement peerSessions.ts: cross-session messaging via bridge API
- Implement webhookSanitizer.ts: redact secrets from webhook payloads
- Replace any stubs in controlTypes.ts with Zod schema-inferred types
- Fix tengu_bridge_system_init default to true for app "active" status
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-03 03:50:36 +08:00
claude-code-best
e48da3956c
feat: 修正 web search 工具
2026-04-03 00:47:37 +08:00
claude-code-best
d04e00fc2c
feat: 调整预先检查的代码
2026-04-02 23:00:48 +08:00
claude-code-best
c252294dd7
feat: 移除反蒸馏代码
2026-04-02 22:56:23 +08:00
claude-code-best
4337b82e6c
Merge branch 'pr/programming-pupil/33'
2026-04-02 21:41:55 +08:00
claude-code-best
7dfbcd0e79
feat: 更新 buddy 的一些功能
2026-04-02 21:41:19 +08:00
claude-code-best
70f32e25f3
Merge branch 'main' into pr/smallflyingpig/36
...
# Conflicts:
# src/entrypoints/cli.tsx
2026-04-02 21:25:53 +08:00
claude-code-best
87fdd455cc
chore: 删除调试代码
2026-04-02 21:23:36 +08:00
claude-code-best
991ccc673c
chore: 删除 src 下面的 src
2026-04-02 21:22:31 +08:00
claude-code-best
be82b71c3e
feat: 补全 auto mode 分类器 prompt 模板,支持 FEATURE_* 环境变量注入
...
- 重建 yolo-classifier-prompts/ 三个缺失的 prompt 文件
- dev.ts/build.ts 扫描 FEATURE_* 环境变量注入 Bun --feature
- AUTO_MODE_ENABLED_DEFAULT 由 feature flag 决定,开 feature 即开 auto mode
- 补充 docs/safety/auto-mode.mdx prompt 模板章节
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-02 21:18:39 +08:00
claude-code-best
68ccf28be8
feat: 尝试修复 auto mode
2026-04-02 20:57:52 +08:00
claude-code-best
4ab4506de2
fix: 修复 USER_TYPE=ant 时 TUI 无法启动的问题
...
反编译版本中 global.d.ts 声明的全局函数运行时未定义,
通过显式 import、stub 组件和全局 polyfill 修复。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-02 20:31:04 +08:00
claude-code-best
ce29527a67
test: 添加一大堆测试文件
2026-04-02 20:28:08 +08:00
claude-code-best
ac1f02958c
fix: 批量修正 external 字面量
2026-04-02 17:01:39 +08:00
claude-code-best
799dacc407
test: 新增一波测试文件
2026-04-02 16:21:24 +08:00
claude-code-best
8697c91668
feat: 完成测试 16-17
2026-04-02 16:03:20 +08:00
claude-code-best
006ad97fbb
test: 新增测试代码文件
2026-04-02 14:44:56 +08:00
Jiguo Li
e815002f96
Merge branch 'main' into main
2026-04-02 13:35:28 +08:00
编程界的小学生
2e4d6e2122
Update hooks.ts
2026-04-02 11:12:36 +08:00
Jiguo Li
4d1bc87eb4
Merge branch 'claude-code-best:main' into main
2026-04-02 10:12:49 +08:00
claude-code-best
4f323efb61
test: Phase 5 — 添加 12 个测试文件 (+209 tests, 1177 total)
...
新增覆盖: effort, tokenBudget, displayTags, taggedId,
controlMessageCompat, MCP normalization/envExpansion,
gitConfigParser, formatBriefTimestamp, hyperlink, windowsPaths, notebook
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-02 10:11:43 +08:00
claude-code-best
28e40ddc67
refactor: 用 Bun 原生 define 替换 cli.tsx 中的 globalThis 注入
...
- 删除 cli.tsx 顶部的 globalThis.MACRO / BUILD_* / feature polyfill
- 新增 scripts/defines.ts 作为 MACRO define 映射的单一来源
- 新增 scripts/dev.ts,通过 bun run -d 在转译时注入 MACRO 常量
- build.ts 引用 getMacroDefines() 实现构建时内联
- 清理 global.d.ts (移除 BUILD_*, MACRO 函数声明)
- 55 个 MACRO 消费文件零改动
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-02 09:51:48 +08:00
claude-code-best
21ac9e441f
test: Phase 2-4 — 添加 12 个测试文件 (+321 tests, 968 total)
...
Phase 2 (轻 Mock): envUtils, sleep/sequential, memoize, groupToolUses, dangerousPatterns, outputLimits
Phase 3 (补全): zodToJsonSchema, PermissionMode, envValidation
Phase 4 (工具模块): mcpStringUtils, destructiveCommandWarning, commandSemantics
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-02 09:29:01 +08:00
claude-code-best
acfaac5f14
test: Phase 1 — 添加 8 个纯函数测试文件 (+134 tests)
...
- errors.test.ts: 28 tests (isAbortError, toError, errorMessage, getErrnoCode, isFsInaccessible, classifyAxiosError 等)
- shellRuleMatching.test.ts: 22 tests (permissionRuleExtractPrefix, hasWildcards, matchWildcardPattern, parsePermissionRule 等)
- argumentSubstitution.test.ts: 18 tests (parseArguments, parseArgumentNames, generateProgressiveArgumentHint, substituteArguments)
- CircularBuffer.test.ts: 12 tests (add, addAll, getRecent, toArray, clear, length)
- sanitization.test.ts: 14 tests (partiallySanitizeUnicode, recursivelySanitizeUnicode)
- slashCommandParsing.test.ts: 8 tests (parseSlashCommand)
- contentArray.test.ts: 6 tests (insertBlockAfterToolResults)
- objectGroupBy.test.ts: 5 tests (objectGroupBy)
总计:781 tests / 40 files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-02 08:50:29 +08:00
claude-code-best
a28a44f9f7
test: 添加 FileEditTool/permissions/filterToolsByDenyRules 测试
...
- FileEditTool/utils.test.ts: 24 tests (normalizeQuotes, stripTrailingWhitespace, findActualString, preserveQuoteStyle, applyEditToFile)
- permissions/permissions.test.ts: 13 tests (getDenyRuleForTool, getAskRuleForTool, getDenyRuleForAgent, filterDeniedAgents)
- tools.test.ts: 扩展 5 tests (filterToolsByDenyRules 过滤逻辑)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-02 07:36:50 +08:00
claude-code-best
43af260322
test: 添加 json/truncate/path/tokens 模块测试
...
- json.test.ts: 27 tests (safeParseJSON, safeParseJSONC, parseJSONL, addItemToJSONCArray)
- truncate.test.ts: 24 tests (truncateToWidth, truncateStartToWidth, truncatePathMiddle, truncate, wrapText)
- path.test.ts: 15 tests (containsPathTraversal, normalizePathForConfigKey)
- tokens.test.ts: 22 tests (getTokenCountFromUsage, getTokenUsage, tokenCountFromLastAPIResponse, etc.)
使用 mock.module() 切断 log.ts/tokenEstimation.ts/slowOperations.ts 重依赖链
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-01 23:56:37 +08:00
claude-code-best
c57950e15e
test: 添加消息处理单元测试 (测试计划 06)
...
为消息创建、查询、文本提取、规范化等函数添加 56 个测试用例,
覆盖 createAssistantMessage、createUserMessage、isSyntheticMessage、
extractTag、isNotEmptyMessage、normalizeMessages 等核心功能。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-01 22:43:31 +08:00
claude-code-best
183421361e
test: 添加配置与设置系统单元测试 (测试计划 09)
...
为 SettingsSchema、PermissionsSchema、AllowedMcpServerEntrySchema
验证,MCP 类型守卫,设置常量函数,以及 validation 工具函数添加
62 个测试用例。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-01 22:39:21 +08:00
claude-code-best
3df4b95ff9
test: 添加 Git 工具函数单元测试 (测试计划 08)
...
为 normalizeGitRemoteUrl 添加 18 个测试用例,覆盖 SSH、HTTPS、
ssh://、CCR 代理 URL 格式、大小写规范化及边界条件。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-01 22:30:45 +08:00
claude-code-best
f81a767f83
test: 添加 Cron 调度单元测试 (测试计划 07)
...
覆盖 parseCronExpression、computeNextCronRun、cronToHuman,
包含有效/无效表达式、字段范围验证、下次运行计算、人类可读描述,
共 38 个测试用例。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-01 22:23:26 +08:00
claude-code-best
25839ab454
test: 添加模型路由单元测试 (测试计划 05)
...
覆盖 isModelAlias、isModelFamilyAlias、getAPIProvider、
isFirstPartyAnthropicBaseUrl、firstPartyNameToCanonical,共 40 个测试用例。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-01 22:20:25 +08:00
claude-code-best
583d04331b
test: 添加权限规则解析器单元测试 (测试计划 04)
...
覆盖 escapeRuleContent、unescapeRuleContent、permissionRuleValueFromString、
permissionRuleValueToString、normalizeLegacyToolName,共 25 个测试用例。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-04-01 22:18:00 +08:00