claude-code-source-recovery
БесплатноБез исполняемых скриптовНе проверенSkill for exploring and understanding the recovered Claude Code 2.1.88 TypeScript source code, including its CLI architecture, command system, MCP…
от reason-machines★ 99 звёзд на GitHubОб этом скилле
Claude Code 2.1.88 Source Recovery
Skill by ara.so — Daily 2026 Skills collection.
What This Project Is
This repository contains the recovered TypeScript source code of @anthropic-ai/claude-code version 2.1.88. On 2026-03-31, Anthropic accidentally published a cli.js.map (57MB) source map to npm that contained the full sourcesContent of the bundled CLI. After extraction and reconstruction, the result is ~700,000 lines of TypeScript source code organized into a readable directory structure.
The project is useful for:
- Studying production CLI architecture patterns (Ink/React in terminal)
- Understanding how MCP (Model Context Protocol) is implemented in a real CLI
- Learning how Claude Code manages sessions, commands, authentication, and tool execution
Repository Structure
src/
├── entrypoints/ # CLI bootstrap and initialization
├── commands/ # Command definitions (login, mcp, review, tasks, etc.)
├── components/ # Ink/React terminal UI components
├── services/ # Core business logic (sync, remote capabilities, policies)
├── hooks/ # Terminal state management hooks
├── utils/ # Auth, file ops, process management helpers
└── ink/ # Custom terminal rendering infrastructure
Installing the Original 2.1.88 Package (Tencent Mirror Cache)
The official npm version was pulled. Use the Tencent mirror cache while available:
npm install -g https://mirrors.cloud.tencent.com/npm/@anthropic-ai/claude-code/-/claude-code-2.1.88.tgz
Extracting Source from the Source Map
If you have the original cli.js.map, you can recover sources programmatically:
import fs from "fs";
import path from "path";
import zlib from "zlib";
interface SourceMap {
version: number;
sources: string[];
sourcesContent: (string | null)[];
mappings: string;
}
async function extractSourceMap(mapPath: string, outDir: string) {
const raw = fs.readFileSync(mapPath, "utf-8");
const sourceMap: SourceMap = JSON.parse(raw);
for (let i = 0; i < sourceMap.sources.length; i++) {
const sourcePath = sourceMap.sources[i];
const content = sourceMap.sourcesContent[i];
if (!content) continue;
// Normalize path: strip webpack/bundle prefixes
const normalized = sourcePath
.replace(/^webpack:\/\/\//, "")
.replace(/^\.\//, "");
const outPath = path.join(outDir, normalized);
fs.mkdirSync(path.dirname(outPath), { recursive: true });
fs.writeFileSync(outPath, content, "utf-8");
}
console.log(`Extracted ${sourceMap.sources.length} source files to ${outDir}`);
}
extractSourceMap("cli.js.map", "./recovered-src");
Key Architectural Patterns
1. CLI Entrypoint Bootstrap
// src/entrypoints/cli.ts (representative pattern)
import { render } from "ink";
import React from "react";
import { App } from "../components/App";
import { parseArgs } from "../utils/args";
async function main() {
const args = parseArgs(process.argv.slice(2));
if (args.command) {
// Dispatch to named command handler
const handler = await loadCommand(args.command);
await handler.run(args);
} else {
// Default: launch interactive REPL via Ink
render(React.createElement(App, { initialArgs: args }));
}
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
2. Command Loading System
Commands support built-in, dynamic skills, plugins, and MCP sources:
// src/commands/loader.ts (representative pattern)
type CommandSource = "builtin" | "skill" | "plugin" | "mcp";
interface Command {
name: string;
source: CommandSource;
description: string;
run(args: ParsedArgs): Promise<void>;
}
async function loadCommand(name: string): Promise<Command> {
// 1. Check built-in commands first
const builtin = builtinCommands.get(name);
if (builtin) return builtin;
// 2. Check MCP-registered commands
const mcpCmd = await mcpRegistry.resolve(name);
if (mcpCmd) return mcpCmd;
// 3. Dynamic skill loading
const skill = await loadSkillCommand(name);
if (skill) return skill;
throw new Error(`Unknown command: ${name}`);
}
3. Ink/React Terminal UI Component Pattern
// src/components/ChatView.tsx (representative pattern)
import React, { useState, useEffect } from "react";
import { Box, Text, useInput } from "ink";
import { useConversation } from "../hooks/useConversation";
interface ChatViewProps {
sessionId: string;
}
export function ChatView({ sessionId }: ChatViewProps) {
const { messages, sendMessage, isStreaming } = useConversation(sessionId);
const [input, setInput] = useState("");
useInput((char, key) => {
if (key.return) {
sendMessage(input);
setInput("");
} else if (key.backspace) {
setInput((prev) => prev.slice(0, -1));
} else {
setInput((prev) => prev + char);
}
});
return (
<Box flex
Установить claude-code-source-recovery в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл claude-code-source-recovery?
Skill for exploring and understanding the recovered Claude Code 2.1.88 TypeScript source code, including its CLI architecture, command system, MCP integration, and Ink/React terminal UI components.
Как установить скилл claude-code-source-recovery?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл claude-code-source-recovery запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic