claude-code-sourcemap

repository·main·Indexed 27 days ago

https://github.com/chinasiro/claude-code-sourcemap

A research-oriented reconstruction of the @anthropic-ai/claude-code TypeScript source code (version 2.1.88). This unofficial project recovers source files from the sourcesContent field of the cli.js.map file found in the official npm package, providing a restored directory structure including tools, commands, services, and MCP server handlers.

Tokens
10.8K
Snippets
7
Records
80
Agent score
93%

What's inside claude-code-sourcemap

  1. Overview of claude-code-sourcemap

    main

    This repository provides reconstructed TypeScript source code for @anthropic-ai/claude-code version 2.1.88. The source code is recovered from the sourcesContent field within the cli.js.map file found in the official npm package.

    Warning: This is an unofficial reconstruction intended for research purposes only. It does not represent the original internal development repository structure of Anthropic.

  2. GitHub App OAuth Flow Overview

    main

    The GitHub App installation process uses an OAuth flow to create a long-lived authentication token for GitHub Actions. The flow typically involves opening a browser for user authorization or providing a URL for manual sign-in.

    OAuth States

    • starting: The initial state where the token creation process begins.
    • waiting_for_login: The system is waiting for the user to authorize the app. A sign-in URL is provided.
    • processing: The system is currently processing the authentication request.
    • success: The authentication token has been created successfully and is being used for GitHub Actions setup.
    • error: An error occurred during the OAuth process. Depending on the error, the system may allow a retry.
    • about_to_retry: The system is attempting to retry the authentication process.
  3. Manage Marketplaces via CLI UI

    main

    The ManageMarketplaces component provides a terminal-based user interface for managing plugin marketplaces within Claude Code. Users can view available marketplaces, browse installed plugins, update marketplaces, toggle auto-updates, or remove marketplaces entirely.

    Key Capabilities

    • List Marketplaces: View all configured marketplaces, their sources, plugin counts, and last update timestamps.
    • Add Marketplace: Navigate to the marketplace addition flow.
    • Update Marketplace: Refresh a marketplace and bump its installed plugins to the latest versions.
    • Remove Marketplace: Uninstall all plugins associated with a marketplace and remove the marketplace source.
    • Toggle Auto-Update: Enable or disable automatic updates for a specific marketplace.
    • Browse Plugins: View the list of available plugins within a specific marketplace.

    Interactive Shortcuts (List View)

    When in the marketplace list, you can use the following keyboard shortcuts:

    • u / U: Mark a marketplace for Update.
    • r / R: Mark a marketplace for Removal (triggers a confirmation view).
    • Enter: Select a marketplace to view details or trigger the 'Add Marketplace' action.

    Interactive Shortcuts (Details View)

    When viewing a specific marketplace's details:

    • Enter: Select an option from the details menu (Browse, Update, Toggle Auto-Update, or Remove).

    Interactive Shortcuts (Confirmation View)

    When confirming a removal:

    • y / Y: Confirm removal.
    • n / N: Cancel removal and return to the list.
  4. Launch a remote code review with /ultrareview

    main

    The /ultrareview command initiates a remote, cloud-based code review session. It supports two modes of operation based on the argument provided:

    1. Pull Request Mode: Provide a PR number (e.g., /ultrareview 123). This works on GitHub repositories where the Claude GitHub app is installed. It reviews the code at refs/pull/<PR_NUMBER>/head.
    2. Branch Mode: Run /ultrareview without arguments. This bundles your current working tree and compares it against the default branch (e.g., main). This mode is intended for local changes that haven't been pushed yet.

    Note: If your repository is too large for the bundle mode, you must push your changes to a branch and use the PR mode instead.

    Reviews typically take 10–20 minutes to complete in the cloud. Results are delivered back to your local session via task notifications.

  5. Configure XAA (SEP-990) for MCP servers

    main

    To enable XAA (SEP-990) for an MCP server, you must first run claude mcp xaa setup. When adding the server, you must include the --xaa flag along with --client-id and either --client-secret or an existing MCP_CLIENT_SECRET environment variable. Note that XAA is only supported for http and sse transports.

    Requirement: You must have CLAUDE_CODE_ENABLE_XAA=1 set in your environment.

  6. Update Claude Code via CLI

    main

    Use the update command to check for and install updates for Claude Code. The command automatically detects your installation method (native, npm-local, npm-global, or package manager) and attempts to update it using the appropriate mechanism.

    Update Channels By default, it checks the latest channel, but it respects the autoUpdatesChannel setting in your configuration (e.g., stable).

    Manual Update Fallbacks If the automatic update fails due to permissions or errors, the CLI may suggest manual commands:

    • For local npm installations: cd ~/.claude/local && npm update @anthropic-ai/claude-code
    • For global npm installations: Run with sudo or consider switching to a native installation using claude install.

    Package Manager Updates If Claude Code was installed via a system package manager, the update command will instruct you to use that manager instead of performing the update itself:

    • Homebrew: brew upgrade claude-code
    • Winget: winget upgrade Anthropic.ClaudeCode
    • APK: apk upgrade claude-code
    • Other (pacman, deb, rpm): Use your system's specific package manager (e.g., apt, dnf, pacman).
  7. Understand the GitHub App OAuth Flow

    main

    The OAuthFlowStep component manages the user interface and logic for authenticating a GitHub App via OAuth. It supports an automated flow where a browser is opened for sign-in, and a manual fallback where users can paste an authorization code if prompted.

    Key Behaviors:

    • Automatic Flow: Attempts to start the OAuth flow and open a browser for Claude AI sign-in.
    • Manual Entry: If the automated flow fails or requires it, users can paste a code in the format authorizationCode#state (extracted from the authorization callback URL).
    • Token Type: This flow generates inference-only tokens specifically for GitHub Actions, rather than a full replacement login session. It uses saveOAuthTokensIfNeeded to ensure existing auth sessions are not destroyed.
    • Clipboard Support: Users can trigger a clipboard copy of the login URL by typing c when the paste prompt is visible.