These two exported functions in src/utils/path.ts lacked unit tests.
toRelativePath wraps Node's path.relative() and keeps the absolute
path when the result would start with '..' (i.e. the target is outside
the CWD). Four tests cover: child-of-cwd, outside-cwd, cwd-itself,
and the type-safety invariant.
getDirectoryForPath uses statSync to distinguish directories from files,
falling back to dirname() for non-existent paths and bypassing the
filesystem for UNC paths (NTLM credential-leak prevention). Three tests
cover: existing directory, known file, and non-existent path.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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>
Replace the 6-line stub in @ant/claude-for-chrome-mcp with the complete
implementation (8 files, 3038 lines) from the reference project.
Provides 17 browser tools: navigate, screenshot, click, type, read DOM,
execute JS, record GIF, monitor console/network, manage tabs, etc.
No feature flag needed. No changes to src/ (already matches official).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 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>
- 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>
- 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>
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>
- 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>
- 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>