HN 표시: TypeScript 코드베이스에서 드리프트 감지

hackernews | | 📰 뉴스
#ai 모델 #ai 코딩 #claude #cli #typescript #드리프트 감지 #아키텍처
원문 출처: hackernews · Genesis Park에서 요약 및 분석

요약

TypeScript 코드베이스용 컨텍스트 컴파일러인 'LogicStamp Context'가 공개되었습니다. 이 도구는 React, Next.js, Vue 등의 코드를 분석하여 AI가 이해하기 쉬운 구조화된 계약(contract)과 의존성 그래프로 변환하며, 구현 세부 사항의 노이즈를 제거합니다. 또한 감시 모드(Watch mode)와 엄격한 diff 기능을 통해 아키텍처 드리프트와 파괴적 변경 사항을 실시간으로 감지하고, Claude나 Cursor와 같은 MCP 호환 AI 에이전트와 원활하게 통합됩니다.

본문

LogicStamp Context is a CLI that compiles TypeScript codebases into deterministic, diffable architectural contracts and dependency graphs - a compact, structured source of truth for AI coding workflows. Includes watch mode, strict, auditable diffs, and real-time breaking change detection. Use with logicstamp-mcp to feed structured context into Claude, Cursor, and other MCP-compatible assistants. 📑 Table of Contents AI coding assistants read your source code - but they don’t understand its structure. They hallucinate props, miss dependencies, and can’t detect when a breaking change impacts consumers. Example: your Button accepts variant and disabled , but the AI suggests isLoading because it saw that pattern elsewhere. Without a structured contract, there is no reliable source of truth. LogicStamp Context derives that layer from your TypeScript - explicit interfaces and dependency structure for tools to consume instead of inferring from implementation. Example workflow: stamp context --strict-watch generates context bundles that MCP-powered assistants use to explain component architecture (ThemeContext shown here). TypeScript Code → Compilation → Deterministic Contracts → AI Assistant (.ts/.tsx) (ts-morph) (context.json bundles) (Claude, Cursor) No install required: npx logicstamp-context context Scans your repo and writes context.json files + context_main.json for AI tools. What you get: - 📁 context.json files - one per folder with components, preserving your directory structure - 📋 context_main.json - index file with project overview and folder metadata For ongoing use, install the CLI globally: npm install -g logicstamp-context The stamp command is then available everywhere. Initialize and generate context: stamp init # sets up .gitignore, scans for secrets stamp context ℹ️ Note: With npx , runnpx logicstamp-context context . After a global install, usestamp context . 📋 For detailed setup instructions, see the Getting Started Guide. | Without LogicStamp Context | With LogicStamp Context | |---|---| | AI parses ~200 lines of implementation to infer a component's interface | AI reads a ~20-line interface contract | | Props/hooks inferred (often wrong) | Props/hooks explicit and verified | | No way to know if context is stale | Watch mode catches changes in real-time | | Different prompts = different understanding | Deterministic: same code = same contract | | Manual context gathering: "Here's my Button component..." | Structured contracts: AI understands architecture automatically | Key insight: AI assistants don’t need your implementation - they need your interfaces. LogicStamp extracts what matters and discards the noise. Instead of sending raw source code to AI: // Raw: AI must parse and infer export const Button = ({ variant = 'primary', disabled, onClick, children }) => { const [isHovered, setIsHovered] = useState(false); // ... 150 more lines of implementation } LogicStamp Context generates: { "kind": "react:component", "interface": { "props": { "variant": { "type": "literal-union", "literals": ["primary", "secondary"] }, "disabled": { "type": "boolean" }, "onClick": { "type": "function", "signature": "() => void" } } }, "composition": { "hooks": ["useState"], "components": ["./Icon"] } } Pre-parsed. Categorized. Stable. The AI reads contracts, not implementations. On disk, each folder’s context.json is a LogicStampBundle: contracts live under graph.nodes , with graph.edges for dependencies. context_main.json indexes folders and metadata. Full JSON shape: docs/reference/schema.md. Under the hood: the TypeScript compiler API (via ts-morph). Analysis-only - it describes your codebase and emits context files. it does not transform or refactor your source. Core: - Deterministic contracts - Same input = same output, auditable in version control - Watch mode - Auto-regenerate on file changes with incremental rebuilds - Breaking change detection - Strict watch mode catches removed props, events, functions in real-time - MCP-ready - AI agents consume context via standardized MCP interface Analysis: - React/Next.js/Vue component extraction (props, hooks, state, deps) - Backend API extraction (Express.js, NestJS routes and controllers) - Dependency graphs (handles circular dependencies) - Style metadata extraction (Tailwind, SCSS, MUI, shadcn) - Next.js App Router detection (client/server, layouts, pages) Developer experience: - Per-folder bundles matching your project structure - Accurate token estimates (GPT/Claude) - Security-first: automatic secret detection and sanitization - Zero config required - sensible defaults, works out of the box - Works alongside tsc - Focuses on contract structure and change detection, not type-checking. Usetsc --noEmit for compiler errors.compare --strict and--strict-watch flag contract-level breaking changes. - Beyond .d.ts - Adds semantic contracts, dependency graphs, and diffable hashes (semanticHash ,bundleHash ) alongside declaration surfaces. - Context, not control - Feeds

Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.

공유

관련 저널 읽기

전체 보기 →