Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
dist/
*.tsbuildinfo
.env
.env.local
bun.lockb
package-lock.json
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,57 @@ The source map file in the published npm package contained a reference to the fu

---

## Quick Setup

### Prerequisites

- **[Bun](https://bun.sh)** v1.3+ (the project's runtime)
- **Node.js** v18+ (for npm package installation)
- An **Anthropic API key** (set as `ANTHROPIC_API_KEY` environment variable)

### Install & Run

```bash
# 1. Install Bun (if not already installed)
curl -fsSL https://bun.sh/install | bash
source ~/.bash_profile # or restart your terminal

# 2. Install dependencies
npm install --legacy-peer-deps

# 3. Run Claude Code
bun run start

# Or with arguments:
bun run start -- --help
bun run start -- --version
bun run start -- -p "Hello Claude"
```

### Available Scripts

| Script | Description |
|--------|-------------|
| `bun run start` | Run Claude Code CLI |
| `bun run dev` | Run with hot-reloading (--watch) |
| `bun run build` | Bundle for production |
| `bun run typecheck` | Run TypeScript type checking |

### Environment Variables

| Variable | Description |
|----------|-------------|
| `ANTHROPIC_API_KEY` | Your Anthropic API key (required to use Claude) |
| `FEATURE_FLAGS` | Comma-separated list of feature flags to enable (e.g., `KAIROS,VOICE_MODE`) |

### Notes

- Some modules from the original source were not included in the leak (Anthropic-internal `@ant/*` packages, some tools). These have been replaced with stubs that export no-ops.
- The `bun:bundle` feature flag system is shimmed via a Bun plugin at `plugins/bunBundleDev.ts`. All flags default to `false` unless enabled via `FEATURE_FLAGS`.
- The `MACRO.*` build-time constants are defined in `bunfig.toml` and injected by Bun's `--define` system.

---

## Overview

Claude Code is Anthropic's official CLI tool that lets you interact with Claude directly from the terminal to perform software engineering tasks — editing files, running commands, searching codebases, managing git workflows, and more.
Expand Down
878 changes: 878 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Bun configuration for Claude Code development
# See https://bun.sh/docs/runtime/bunfig

[run]
# Load the bun:bundle polyfill before the main entry point
preload = ["./plugins/bunBundleDev.ts"]

[define]
# Build-time macros — injected as global constants
"MACRO.VERSION" = '"1.0.0-dev"'
"MACRO.BUILD_TIME" = '""'
"MACRO.PACKAGE_URL" = '"@anthropic-ai/claude-code"'
"MACRO.NATIVE_PACKAGE_URL" = 'undefined'
"MACRO.FEEDBACK_CHANNEL" = '"https://github.com/anthropics/claude-code/issues"'
"MACRO.ISSUES_EXPLAINER" = '"file an issue at https://github.com/anthropics/claude-code/issues"'
"MACRO.VERSION_CHANGELOG" = '""'
103 changes: 103 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"name": "claude-code",
"version": "1.0.0",
"description": "Claude Code CLI \u2014 Leaked Source (2026-03-31)",
"type": "module",
"private": true,
"scripts": {
"start": "bun run src/entrypoints/cli.tsx",
"dev": "bun --watch run src/entrypoints/cli.tsx",
"build": "bun build src/entrypoints/cli.tsx --outdir dist --target bun --define 'MACRO.VERSION=\"1.0.0-dev\"' --define 'MACRO.BUILD_TIME=\"\"' --define 'MACRO.PACKAGE_URL=\"@anthropic-ai/claude-code\"' --define 'MACRO.NATIVE_PACKAGE_URL=\"\"' --define 'MACRO.FEEDBACK_CHANNEL=\"\"' --define 'MACRO.ISSUES_EXPLAINER=\"\"' --define 'MACRO.VERSION_CHANGELOG=\"\"'",
"typecheck": "bun x tsc --noEmit"
},
"dependencies": {
"@alcalzone/ansi-tokenize": "^0.1.0",
"@ant/claude-for-chrome-mcp": "file:stubs/@ant/claude-for-chrome-mcp",
"@ant/computer-use-input": "file:stubs/@ant/computer-use-input",
"@ant/computer-use-mcp": "file:stubs/@ant/computer-use-mcp",
"@ant/computer-use-swift": "file:stubs/@ant/computer-use-swift",
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
"@anthropic-ai/mcpb": "file:stubs/@anthropic-ai/mcpb",
"@anthropic-ai/sandbox-runtime": "file:stubs/anthropic-ai/sandbox-runtime",
"@anthropic-ai/sdk": "^0.39.0",
"@aws-sdk/client-bedrock-runtime": "^3.700.0",
"@commander-js/extra-typings": "^13.1.0",
"@growthbook/growthbook": "^1.3.0",
"@modelcontextprotocol/sdk": "^1.12.1",
"@opentelemetry/api": "^1.9.1",
"@opentelemetry/api-logs": "^0.214.0",
"@opentelemetry/core": "^2.6.1",
"@opentelemetry/resources": "^2.6.1",
"@opentelemetry/sdk-logs": "^0.214.0",
"@opentelemetry/sdk-metrics": "^2.6.1",
"@opentelemetry/sdk-trace-base": "^2.6.1",
"@opentelemetry/semantic-conventions": "^1.40.0",
"ajv": "^8.17.0",
"asciichart": "^1.5.25",
"auto-bind": "^5.0.1",
"axios": "^1.7.0",
"bidi-js": "^1.0.3",
"chalk": "^5.4.0",
"chokidar": "^4.0.0",
"cli-boxes": "^3.0.0",
"code-excerpt": "^4.0.0",
"color-diff-napi": "^0.0.1",
"commander": "^13.1.0",
"diff": "^7.0.0",
"emoji-regex": "^10.4.0",
"env-paths": "^3.0.0",
"execa": "^9.5.0",
"figures": "^6.1.0",
"fuse.js": "^7.3.0",
"get-east-asian-width": "^1.3.0",
"google-auth-library": "^9.15.0",
"highlight.js": "^11.11.1",
"https-proxy-agent": "^7.0.0",
"ignore": "^6.0.0",
"indent-string": "^5.0.0",
"jsonc-parser": "^3.3.1",
"lodash-es": "^4.17.21",
"lru-cache": "^11.0.0",
"marked": "^15.0.0",
"p-map": "^7.0.0",
"picomatch": "^4.0.0",
"proper-lockfile": "^4.1.2",
"qrcode": "^1.5.4",
"react": "^19.3.0-canary-705268dc-20260409",
"react-compiler-runtime": "^1.0.0",
"react-reconciler": "^0.34.0-canary-705268dc-20260409",
"semver": "^7.6.0",
Comment on lines +66 to +69
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

What @types/reactand@types/react-reconciler` versions are compatible with:

  • react@19.3.0-canary-705268dc-20260409
  • react-reconciler@0.34.0-canary-705268dc-20260409
    ?`

💡 Result:

The compatible versions are the latest @types/react (19.2.14) and @types/react-reconciler (0.33.0). These provide types for React 19, including ongoing canary updates via the react/canary.d.ts augmentation in DefinitelyTyped. No specific canary-tagged @types packages exist; types are maintained to support current and experimental React 19 features as evidenced by recent commits adding canary-specific types like SubmitEvent.submitter and optimisticKey.

Citations:


🏁 Script executed:

sed -n '94,96p' package.json

Repository: tanbiralam/claude-code

Length of output: 169


Update @types/react and @types/react-reconciler versions to match React runtime.

The canary runtime versions (React 19 and react-reconciler 0.34) are paired with mismatched type packages: @types/react@^18.3.0 targets React 18, and @types/react-reconciler@^0.28.0 is outdated. Update to @types/react@^19.2.14 and @types/react-reconciler@^0.33.0 to resolve incompatibilities and prevent typecheck failures.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 66 - 69, Update the type package versions in
package.json so they match the canary React runtime: change the `@types/react`
entry (currently ^18.3.0) to ^19.2.14 and change `@types/react-reconciler`
(currently ^0.28.0) to ^0.33.0; modify the dependency entries for "@types/react"
and "@types/react-reconciler" in package.json, run install, and re-run the
typecheck to confirm the mismatch is resolved.

"shell-quote": "^1.8.0",
"signal-exit": "^4.1.0",
"stack-utils": "^2.0.0",
"strip-ansi": "^7.1.0",
"supports-hyperlinks": "^3.1.0",
"tree-kill": "^1.2.2",
"type-fest": "^4.30.0",
"undici": "^7.3.0",
"usehooks-ts": "^3.1.0",
"vscode-jsonrpc": "^8.2.1",
"vscode-languageserver-protocol": "^3.17.0",
"vscode-languageserver-types": "^3.17.5",
"wrap-ansi": "^9.0.0",
"ws": "^8.18.0",
"xss": "^1.0.15",
"zod": "^3.24.0"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

What is the current stable Zod v4 release, and which APIs differ from Zod v3 that could break existing TypeScript code?

💡 Result:

The current stable release of Zod v4 is 4.3.6, released on January 22, 2026. Key APIs that differ from Zod v3 and could break existing TypeScript code include: Error customization: Deprecated message parameter in favor of unified error parameter (function). Dropped invalid_type_error and required_error parameters. errorMap is dropped. ZodError changes: Updated issue formats (streamlined, some merged/dropped like ZodNotFiniteIssue). Deprecated .format, .flatten, .formErrors. Deprecated .addIssue and .addIssues. z.number: No longer accepts infinite values (Infinity/-Infinity). .safe no longer accepts floats (behaves like .int). .int accepts only safe integers. z.string: Deprecated chained methods like .email, .uuid etc. (now top-level z.email, z.uuid). Stricter .uuid validation. .refine: Ignores type predicates. Drops ctx.path. Drops function as second argument. Optional helpers dropped: z.ostring, z.onumber, etc. z.literal: Drops symbol support. z.record: Drops single argument usage. Improved enum support (exhaustive checking). z.intersection: Throws regular Error on merge conflict (instead of ZodError). z.tuple: NonEmptyTuple now infers string[] instead of [string, ...string[]]. z.coerce: Input type now unknown instead of specific types. z.promise: Deprecated. Internal: Generic updates, ._def moved to ._zod.def, ZodEffects split, etc. These affect type inference and advanced usage. Requires TypeScript strict mode and TS 5.5+. A codemod npx @zod/codemod --transform v3-to-v4 handles many changes. Official migration guide: https://zod.dev/v4/changelog

Citations:


🏁 Script executed:

# Find and check documentation files for Zod version references
find . -type f \( -name "README*" -o -name "*.md" -o -name "CHANGELOG*" \) -exec grep -l "zod\|Zod" {} \; 2>/dev/null | head -20

Repository: tanbiralam/claude-code

Length of output: 77


🏁 Script executed:

# Search for Zod usage in the codebase to detect v4-specific APIs
rg "z\.(email|uuid|string|number|refine|promise)" --type ts --type tsx --type js --type jsx -c 2>/dev/null | head -30

Repository: tanbiralam/claude-code

Length of output: 48


🏁 Script executed:

# Check tsconfig for TypeScript version requirement (v4 needs 5.5+)
cat -n tsconfig.json 2>/dev/null || echo "No tsconfig.json found"

Repository: tanbiralam/claude-code

Length of output: 995


🏁 Script executed:

# Check if there are any v4 migration references or comments in the codebase
rg "v4|migration|zod.*4" --type ts --type tsx --type js --type jsx -i -c 2>/dev/null | head -20

Repository: tanbiralam/claude-code

Length of output: 48


🏁 Script executed:

# Read README.md to see what it says about Zod
cat README.md

Repository: tanbiralam/claude-code

Length of output: 11243


🏁 Script executed:

# Search for Zod imports to see how it's actually used
rg "import.*zod|from.*zod|require.*zod" --type ts --type tsx --type js --type jsx

Repository: tanbiralam/claude-code

Length of output: 93


🏁 Script executed:

# Check actual dependencies in package.json around the zod line
sed -n '80,95p' package.json

Repository: tanbiralam/claude-code

Length of output: 552


🏁 Script executed:

# Check the schemas directory to see actual Zod usage patterns
find src/schemas -type f -name "*.ts" -o -name "*.tsx" | head -5

Repository: tanbiralam/claude-code

Length of output: 86


🏁 Script executed:

# Look at one schema file to see what Zod APIs are being used
ls -la src/schemas/ 2>/dev/null | head -20

Repository: tanbiralam/claude-code

Length of output: 237


🏁 Script executed:

cat src/schemas/hooks.ts

Repository: tanbiralam/claude-code

Length of output: 7947


Zod version mismatch is a runtime blocker.

package.json pins v3.24.0, but the codebase imports from zod/v4 (e.g., line 10 in src/schemas/hooks.ts). The v4 entry point does not exist in v3 and will cause a MODULE_NOT_FOUND error at build or startup. README correctly documents Zod v4 as the intended dependency.

Update package.json to "zod": "^4.0.0" or higher (stable is 4.3.6). Verify TypeScript 5.5+ compatibility after upgrading.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 85, The package.json currently pins "zod": "^3.24.0"
which conflicts with imports from "zod/v4" (e.g., imports in
src/schemas/hooks.ts) and will cause MODULE_NOT_FOUND; update the dependency in
package.json to a Zod v4 release (e.g., "zod": "^4.3.6" or at least "^4.0.0"),
run npm/yarn install and rebuild, and verify TypeScript compatibility (TS 5.5+)
before committing so imports like "zod/v4" resolve correctly.

},
"devDependencies": {
"@types/diff": "^7.0.0",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.0.0",
"@types/picomatch": "^3.0.0",
"@types/proper-lockfile": "^4.1.4",
"@types/qrcode": "^1.5.5",
"@types/react": "^18.3.0",
"@types/react-reconciler": "^0.28.0",
"@types/semver": "^7.5.0",
"@types/shell-quote": "^1.7.0",
"@types/stack-utils": "^2.0.0",
"@types/ws": "^8.5.0",
"bun-types": "^1.2.0",
"typescript": "^5.7.0"
}
}
32 changes: 32 additions & 0 deletions plugins/bunBundleDev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Bun plugin that provides a runtime implementation of the `bun:bundle` module.
*
* In production, Bun's bundler statically replaces `feature()` calls at compile
* time. During development (running unbundled with `bun run`), this plugin
* intercepts `bun:bundle` imports and returns a stub where every feature flag
* is `false` by default.
*
* To enable specific flags during dev, set the env var FEATURE_FLAGS as a
* comma-separated list:
*
* FEATURE_FLAGS=KAIROS,VOICE_MODE bun run src/main.tsx
*/
import { plugin } from 'bun'

const enabledFlags = new Set(
(process.env.FEATURE_FLAGS ?? '').split(',').filter(Boolean),
)

plugin({
name: 'bun-bundle-dev',
setup(build) {
build.module('bun:bundle', () => ({
exports: {
feature(flag: string): boolean {
return enabledFlags.has(flag)
},
},
loader: 'object',
}))
},
})
2 changes: 2 additions & 0 deletions src/assistant/sessionDiscovery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface AssistantSession {}
2 changes: 2 additions & 0 deletions src/cli/transports/Transport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface Transport {}
4 changes: 4 additions & 0 deletions src/commands/install-github-app/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Stub: not included in leaked source
export interface State {}
export interface Warning {}
export interface Workflow {}
3 changes: 3 additions & 0 deletions src/commands/plugin/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Stub: not included in leaked source
export interface PluginSettingsProps {}
export interface ViewState {}
2 changes: 2 additions & 0 deletions src/commands/plugin/unifiedTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface UnifiedInstalledItem {}
3 changes: 3 additions & 0 deletions src/components/FeedbackSurvey/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Stub: not included in leaked source
export interface FeedbackSurveyResponse {}
export interface FeedbackSurveyType {}
3 changes: 3 additions & 0 deletions src/components/Spinner/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Stub: not included in leaked source
export interface RGBColor {}
export interface SpinnerMode {}
2 changes: 1 addition & 1 deletion src/components/StructuredDiff/colorDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ColorFile,
getSyntaxTheme as nativeGetSyntaxTheme,
type SyntaxTheme,
} from 'color-diff-napi'
} from '../../native-ts/color-diff/index.js'
import { isEnvDefinedFalsy } from '../../utils/envUtils.js'

export type ColorModuleUnavailableReason = 'env'
Expand Down
2 changes: 2 additions & 0 deletions src/components/agents/new-agent-creation/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface AgentWizardData {}
8 changes: 8 additions & 0 deletions src/components/mcp/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Stub: not included in leaked source
export interface AgentMcpServerInfo {}
export interface ClaudeAIServerInfo {}
export interface HTTPServerInfo {}
export interface MCPViewState {}
export interface SSEServerInfo {}
export interface ServerInfo {}
export interface StdioServerInfo {}
2 changes: 2 additions & 0 deletions src/components/ui/option.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface Option {}
4 changes: 4 additions & 0 deletions src/components/wizard/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Stub: not included in leaked source
export interface WizardContextValue {}
export interface WizardProviderProps {}
export interface WizardStepComponent {}
2 changes: 2 additions & 0 deletions src/constants/querySource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface QuerySource {}
13 changes: 13 additions & 0 deletions src/entrypoints/sdk/controlTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Stub: not included in leaked source
export interface SDKControlCancelRequest {}
export interface SDKControlInitializeRequest {}
export interface SDKControlInitializeResponse {}
export interface SDKControlMcpSetServersResponse {}
export interface SDKControlPermissionRequest {}
export interface SDKControlReloadPluginsResponse {}
export interface SDKControlRequest {}
export interface SDKControlRequestInner {}
export interface SDKControlResponse {}
export interface SDKPartialAssistantMessage {}
export interface StdinMessage {}
export interface StdoutMessage {}
3 changes: 3 additions & 0 deletions src/entrypoints/sdk/coreTypes.generated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Stub: not included in leaked source
// Star re-export: no specific names identified
export {}
19 changes: 19 additions & 0 deletions src/entrypoints/sdk/runtimeTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Stub: not included in leaked source
export interface AnyZodRawShape {}
export interface EffortLevel {}
export interface ForkSessionOptions {}
export interface ForkSessionResult {}
export interface GetSessionInfoOptions {}
export interface GetSessionMessagesOptions {}
export interface InferShape {}
export interface InternalOptions {}
export interface InternalQuery {}
export interface ListSessionsOptions {}
export interface McpSdkServerConfigWithInstance {}
export interface Options {}
export interface Query {}
export interface SDKSession {}
export interface SDKSessionOptions {}
export interface SdkMcpToolDefinition {}
export interface SessionMessage {}
export interface SessionMutationOptions {}
2 changes: 2 additions & 0 deletions src/entrypoints/sdk/sdkUtilityTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface NonNullableUsage {}
2 changes: 2 additions & 0 deletions src/entrypoints/sdk/settingsTypes.generated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface Settings {}
3 changes: 3 additions & 0 deletions src/entrypoints/sdk/toolTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Stub: not included in leaked source
// Star re-export: no specific names identified
export {}
2 changes: 2 additions & 0 deletions src/ink/cursor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface Cursor {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

In current TypeScript, what values are assignable to an empty interface like interface Cursor {} and what stricter placeholder type is recommended for “no properties allowed”?

💡 Result:

In current TypeScript (as of 2026), an empty interface interface Cursor {} is equivalent to the type {}, which accepts any non-nullish value (primitives like strings/numbers/booleans, objects, arrays, functions, etc.) due to structural typing. Only null and undefined are not assignable (with strictNullChecks on). The stricter placeholder type recommended for "no properties allowed" (only accepting {} the empty object literal, rejecting anything with properties or primitives) is Record<string, never> (or equivalently { [key: string]: never }). Example: type StrictEmpty = Record<string, never>; const valid: StrictEmpty = {}; // OK const invalid1: StrictEmpty = { foo: 1 }; // Error: Type 'number' is not assignable to 'never' const invalid2: StrictEmpty = "string"; // Error: Type 'string' is not assignable to 'Record<string, never>' This is widely recommended by linters like typescript-eslint (no-empty-object-type) and community sources to avoid the pitfalls of {}.

Citations:


🏁 Script executed:

# Check if the file exists and read its content
if [ -f "src/ink/cursor.ts" ]; then
  echo "=== File content (with line numbers) ==="
  cat -n "src/ink/cursor.ts"
else
  echo "File not found at src/ink/cursor.ts"
  # Try to locate the file
  echo "=== Searching for cursor.ts files ==="
  find . -name "cursor.ts" -type f 2>/dev/null | head -20
fi

Repository: tanbiralam/claude-code

Length of output: 186


🏁 Script executed:

# Search for usages of Cursor type
echo "=== Searching for 'Cursor' type usages ==="
rg "Cursor" --type ts --type tsx -B 2 -A 2 | head -100

Repository: tanbiralam/claude-code

Length of output: 153


🏁 Script executed:

# Search for usages of Cursor type without tsx flag
echo "=== Searching for 'Cursor' usages in TypeScript files ==="
rg "Cursor" --type ts -B 2 -A 2

echo ""
echo "=== Alternative: grep for Cursor imports/exports ==="
rg "from.*cursor|import.*Cursor|export.*Cursor" --type ts

Repository: tanbiralam/claude-code

Length of output: 50379


🏁 Script executed:

# Search specifically for imports from ink/cursor or references to the stub interface
echo "=== Searching for imports from 'ink/cursor' ==="
rg "from.*ink/cursor|import.*from.*cursor" --type ts | grep -v "utils/Cursor"

echo ""
echo "=== Checking src/ink directory structure ==="
find src/ink -type f -name "*.ts" | head -20

echo ""
echo "=== Checking if cursor is exported from ink's main exports ==="
rg "export.*Cursor|export.*cursor" src/ink --type ts | head -20

Repository: tanbiralam/claude-code

Length of output: 2552


🏁 Script executed:

# Check how Cursor is used in frame.ts
echo "=== Cursor usage in src/ink/frame.ts ==="
cat -n src/ink/frame.ts | head -100

Repository: tanbiralam/claude-code

Length of output: 4198


🏁 Script executed:

# Search for all places where cursor object is created or assigned
echo "=== All assignments to cursor in src/ink/frame.ts ==="
rg "cursor.*:" src/ink/frame.ts -A 1 | head -50

echo ""
echo "=== Check if there are other usages of the Cursor type ==="
rg "Frame\[|\.cursor" src/ink --type ts -B 1 -A 1 | head -100

Repository: tanbiralam/claude-code

Length of output: 5718


Specify the actual Cursor shape instead of using an empty interface placeholder.

Cursor {} is too permissive as a contract. The actual implementation uses objects with { x: number; y: number; visible: boolean } properties (as seen in frame.ts and log-update.ts), so define the interface to match:

export interface Cursor {
  x: number
  y: number
  visible: boolean
}

Note: Record<string, never> would reject these properties and cause type errors, so avoid that approach.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/ink/cursor.ts` at line 2, The Cursor interface is currently an empty
placeholder; update the export interface Cursor to match the actual shape used
elsewhere (e.g., frame.ts and log-update.ts) by defining the three properties:
x: number, y: number, and visible: boolean so consumers of Cursor have the
correct type contract.

2 changes: 2 additions & 0 deletions src/ink/events/paste-event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface PasteEvent {}
2 changes: 2 additions & 0 deletions src/ink/events/resize-event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface ResizeEvent {}
1 change: 1 addition & 0 deletions src/ink/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Stub: not included in leaked source
7 changes: 7 additions & 0 deletions src/keybindings/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Stub: not included in leaked source
export interface Chord {}
export interface KeybindingAction {}
export interface KeybindingBlock {}
export interface KeybindingContextName {}
export interface ParsedBinding {}
export interface ParsedKeystroke {}
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ async function run(): Promise<CommanderCommand> {
// If not provided but flag is present, value will be true
// The actual filtering is handled in debug.ts by parsing process.argv
return true;
}).addOption(new Option('-d2e, --debug-to-stderr', 'Enable debug mode (to stderr)').argParser(Boolean).hideHelp()).option('--debug-file <path>', 'Write debug logs to a specific file path (implicitly enables debug mode)', () => true).option('--verbose', 'Override verbose mode setting from config', () => true).option('-p, --print', 'Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p mode. Only use this flag in directories you trust.', () => true).option('--bare', 'Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and CLAUDE.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read). 3P providers (Bedrock/Vertex/Foundry) use their own credentials. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (CLAUDE.md dirs), --mcp-config, --settings, --agents, --plugin-dir.', () => true).addOption(new Option('--init', 'Run Setup hooks with init trigger, then continue').hideHelp()).addOption(new Option('--init-only', 'Run Setup and SessionStart:startup hooks, then exit').hideHelp()).addOption(new Option('--maintenance', 'Run Setup hooks with maintenance trigger, then continue').hideHelp()).addOption(new Option('--output-format <format>', 'Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)').choices(['text', 'json', 'stream-json'])).addOption(new Option('--json-schema <schema>', 'JSON Schema for structured output validation. ' + 'Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}').argParser(String)).option('--include-hook-events', 'Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)', () => true).option('--include-partial-messages', 'Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)', () => true).addOption(new Option('--input-format <format>', 'Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)').choices(['text', 'stream-json'])).option('--mcp-debug', '[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)', () => true).option('--dangerously-skip-permissions', 'Bypass all permission checks. Recommended only for sandboxes with no internet access.', () => true).option('--allow-dangerously-skip-permissions', 'Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.', () => true).addOption(new Option('--thinking <mode>', 'Thinking mode: enabled (equivalent to adaptive), disabled').choices(['enabled', 'adaptive', 'disabled']).hideHelp()).addOption(new Option('--max-thinking-tokens <tokens>', '[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)').argParser(Number).hideHelp()).addOption(new Option('--max-turns <turns>', 'Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)').argParser(Number).hideHelp()).addOption(new Option('--max-budget-usd <amount>', 'Maximum dollar amount to spend on API calls (only works with --print)').argParser(value => {
}).addOption(new Option('--debug-to-stderr', 'Enable debug mode (to stderr)').argParser(Boolean).hideHelp()).option('--debug-file <path>', 'Write debug logs to a specific file path (implicitly enables debug mode)', () => true).option('--verbose', 'Override verbose mode setting from config', () => true).option('-p, --print', 'Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p mode. Only use this flag in directories you trust.', () => true).option('--bare', 'Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and CLAUDE.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read). 3P providers (Bedrock/Vertex/Foundry) use their own credentials. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (CLAUDE.md dirs), --mcp-config, --settings, --agents, --plugin-dir.', () => true).addOption(new Option('--init', 'Run Setup hooks with init trigger, then continue').hideHelp()).addOption(new Option('--init-only', 'Run Setup and SessionStart:startup hooks, then exit').hideHelp()).addOption(new Option('--maintenance', 'Run Setup hooks with maintenance trigger, then continue').hideHelp()).addOption(new Option('--output-format <format>', 'Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)').choices(['text', 'json', 'stream-json'])).addOption(new Option('--json-schema <schema>', 'JSON Schema for structured output validation. ' + 'Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}').argParser(String)).option('--include-hook-events', 'Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)', () => true).option('--include-partial-messages', 'Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)', () => true).addOption(new Option('--input-format <format>', 'Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)').choices(['text', 'stream-json'])).option('--mcp-debug', '[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)', () => true).option('--dangerously-skip-permissions', 'Bypass all permission checks. Recommended only for sandboxes with no internet access.', () => true).option('--allow-dangerously-skip-permissions', 'Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.', () => true).addOption(new Option('--thinking <mode>', 'Thinking mode: enabled (equivalent to adaptive), disabled').choices(['enabled', 'adaptive', 'disabled']).hideHelp()).addOption(new Option('--max-thinking-tokens <tokens>', '[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)').argParser(Number).hideHelp()).addOption(new Option('--max-turns <turns>', 'Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)').argParser(Number).hideHelp()).addOption(new Option('--max-budget-usd <amount>', 'Maximum dollar amount to spend on API calls (only works with --print)').argParser(value => {
const amount = Number(value);
if (isNaN(amount) || amount <= 0) {
throw new Error('--max-budget-usd must be a positive number greater than 0');
Expand Down
3 changes: 3 additions & 0 deletions src/query/transitions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Stub: not included in leaked source
export interface Continue {}
export interface Terminal {}
4 changes: 4 additions & 0 deletions src/services/lsp/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Stub: not included in leaked source
export interface LspServerConfig {}
export interface LspServerState {}
export interface ScopedLspServerConfig {}
12 changes: 12 additions & 0 deletions src/services/oauth/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Stub: not included in leaked source
export interface BillingType {}
export interface OAuthProfileResponse {}
export interface OAuthTokenExchangeResponse {}
export interface OAuthTokens {}
export interface RateLimitTier {}
export interface ReferralCampaign {}
export interface ReferralEligibilityResponse {}
export interface ReferralRedemptionsResponse {}
export interface ReferrerRewardInfo {}
export interface SubscriptionType {}
export interface UserRolesResponse {}
2 changes: 2 additions & 0 deletions src/services/skillSearch/signals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Stub: not included in leaked source
export interface DiscoverySignal {}
3 changes: 3 additions & 0 deletions src/services/tips/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Stub: not included in leaked source
export interface Tip {}
export interface TipContext {}
3 changes: 3 additions & 0 deletions src/skills/bundled/claude-api/SKILL.md.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Stub: not included in leaked source
const skillPrompt = ''
export default skillPrompt
3 changes: 3 additions & 0 deletions src/skills/bundled/claude-api/csharp/claude-api.md.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Stub: not included in leaked source
const csharpClaudeApi = ''
export default csharpClaudeApi
Loading