{"passport":{"unfragile":{"@version":"1.0","version":"2026-05","artifact":{"id":"github-dsherret--ts-morph","slug":"dsherret--ts-morph","name":"ts-morph","type":"repo","url":"https://ts-morph.com","page_url":"https://unfragile.ai/dsherret--ts-morph","categories":["code-editors"],"tags":["ast","code-generation","javascript","static-analysis","typescript"],"pricing":{"model":"open_source","free":true,"starting_price":null},"status":"active","verified":false},"capabilities":[{"id":"github-dsherret--ts-morph__cap_0","uri":"capability://code.generation.editing.in.memory.ast.manipulation.with.deferred.persistence","name":"in-memory ast manipulation with deferred persistence","description":"Wraps TypeScript Compiler API objects to provide an object-oriented interface for navigating and modifying Abstract Syntax Trees while maintaining all changes in memory until explicitly saved to disk. Uses a Node-based wrapper system that maps compiler API nodes to higher-level abstractions, enabling safe mutations without immediate file I/O. Changes accumulate in memory and are flushed to the file system only when saveSourceFile() or saveSourceFiles() is called, allowing batch operations and rollback scenarios.","intents":["I want to programmatically modify TypeScript code without immediately writing to disk so I can batch changes and validate before persisting","I need to apply complex transformations across multiple files while keeping all edits in memory for performance","I want to safely experiment with code changes and discard them if validation fails"],"best_for":["code generation tools and scaffolders","automated refactoring engines","linters and static analysis tools that modify code","teams building custom TypeScript transformers"],"limitations":["All changes held in memory until explicit save — can cause memory pressure on very large codebases (100k+ files)","No built-in transaction rollback — must manually track state if reverting changes","Changes are not persisted to disk until saveSourceFile() is called, so process crashes lose all edits"],"requires":["TypeScript 4.0+","Node.js 12.20+","ts-morph package installed"],"input_types":["TypeScript/JavaScript source files","AST node references","code strings"],"output_types":["modified AST nodes in memory","persisted source files on disk"],"categories":["code-generation-editing","ast-manipulation"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_1","uri":"capability://code.generation.editing.semantic.aware.code.navigation.and.traversal","name":"semantic-aware code navigation and traversal","description":"Provides a comprehensive object-oriented API for traversing AST nodes with semantic awareness through the TypeChecker interface, enabling queries like 'find all usages of this symbol' and 'get the type of this expression'. Navigation methods include getParent(), getChildren(), forEachChild(), and specialized accessors for declaration kinds (getClass(), getFunction(), getInterface()). The system wraps compiler API's SyntaxKind and TypeFlags enums into strongly-typed Node subclasses, making traversal type-safe and IDE-friendly with autocomplete.","intents":["I want to find all references to a specific variable or function across my codebase","I need to traverse the AST and understand the semantic meaning of nodes, not just their syntactic structure","I want to query nodes by their kind (e.g., 'get all class declarations') with type-safe results"],"best_for":["static analysis tool builders","code search and refactoring tools","IDE plugin developers","teams building custom linters"],"limitations":["TypeChecker-based semantic queries require full project context — cannot analyze isolated files without tsconfig.json","Performance degrades on large codebases (10k+ files) due to full type checking overhead","Symbol resolution requires all dependencies to be resolvable — missing node_modules breaks semantic analysis"],"requires":["TypeScript 4.0+","Valid tsconfig.json or explicit compiler options","All imported dependencies available in node_modules"],"input_types":["AST nodes","symbol references","source file paths"],"output_types":["AST node collections","type information","symbol definitions"],"categories":["code-generation-editing","search-retrieval"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_10","uri":"capability://code.generation.editing.syntax.aware.code.formatting.and.whitespace.preservation","name":"syntax-aware code formatting and whitespace preservation","description":"Provides APIs for querying and manipulating whitespace, formatting, and syntax details through methods like getLeadingTrivia(), getTrailingTrivia(), and getFullText(). Preserves existing formatting when modifying code, allowing surgical edits that don't reformat the entire file. Supports querying line and column positions, getting source text with or without trivia, and understanding the syntactic structure including comments and whitespace.","intents":["I want to modify code while preserving the original formatting and comments","I need to get the exact source text of a node including comments and whitespace","I want to understand the line and column positions of nodes for error reporting"],"best_for":["linters and code analysis tools","error reporting and diagnostics","code editors and IDE plugins","tools that need to preserve formatting"],"limitations":["Trivia (comments, whitespace) handling is complex — modifying trivia can break formatting","Line/column position queries require scanning the entire file — can be slow for large files","No built-in formatting — must use external formatters like Prettier to reformat code"],"requires":["TypeScript 4.0+","Source file with valid syntax"],"input_types":["AST nodes","source text"],"output_types":["trivia information","line/column positions","formatted source text"],"categories":["code-generation-editing"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_11","uri":"capability://code.generation.editing.typescript.specific.language.feature.support.generics.unions.intersections","name":"typescript-specific language feature support (generics, unions, intersections)","description":"Provides comprehensive support for TypeScript-specific type features through specialized node classes and type introspection APIs. Handles generics with type parameters and type arguments, union and intersection types, conditional types, mapped types, and type queries. Enables querying and modifying these features through methods like getTypeArguments(), getConstraint(), and getTypeParameters() on relevant node types.","intents":["I want to extract type parameters from a generic class and understand their constraints","I need to analyze a union type and iterate over its constituent types","I want to understand and modify conditional types in my codebase"],"best_for":["advanced code generators","type-aware refactoring tools","TypeScript-specific linters","teams working with advanced TypeScript features"],"limitations":["Complex type features (conditional types, mapped types) can be difficult to analyze and modify","Type inference for complex expressions requires full type checking context","Some advanced type features may not be fully supported"],"requires":["TypeScript 4.0+","Understanding of advanced TypeScript type features","Valid project context for type checking"],"input_types":["type nodes","generic declarations","type parameters"],"output_types":["type information","type parameter details","type argument information"],"categories":["code-generation-editing","data-processing-analysis"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_12","uri":"capability://automation.workflow.incremental.compilation.and.caching.for.performance.optimization","name":"incremental compilation and caching for performance optimization","description":"Implements caching and incremental compilation strategies to optimize performance when working with large projects. Caches parsed ASTs and type information to avoid re-parsing unchanged files, and supports incremental updates when source files are modified. The Project class manages this caching internally, reusing compiler state across multiple operations to reduce redundant work.","intents":["I want to perform multiple analyses on the same project without re-parsing all files each time","I need to update a single file and have the project reflect the changes without full recompilation","I want to optimize performance when working with large codebases"],"best_for":["long-running analysis tools","watch-mode code generators","IDE plugins","teams working with large codebases"],"limitations":["Caching is automatic but opaque — no control over cache invalidation strategy","Incremental updates may not be fully incremental for all operations — some require full recompilation","Cache memory usage grows with project size — very large projects may run out of memory"],"requires":["TypeScript 4.0+","Sufficient memory for caching (proportional to project size)"],"input_types":["source files","compiler options"],"output_types":["cached ASTs","cached type information"],"categories":["automation-workflow","data-processing-analysis"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_2","uri":"capability://code.generation.editing.declaration.aware.code.generation.and.modification","name":"declaration-aware code generation and modification","description":"Provides specialized APIs for creating and modifying TypeScript declarations (classes, interfaces, functions, imports) through a structure-based system that abstracts away low-level AST node creation. Uses a StructurePrinterFactory pattern to convert high-level structure objects (ClassDeclarationStructure, FunctionDeclarationStructure, etc.) into AST nodes, enabling developers to add methods to classes, create new interfaces, or modify function signatures without manually constructing SyntaxNodes. Supports JSDoc generation, decorators, access modifiers, and type annotations through the structure API.","intents":["I want to programmatically add a new method to an existing class with proper type annotations and JSDoc","I need to create new TypeScript interfaces or classes from scratch with full type safety","I want to modify function signatures, add parameters, or change return types safely"],"best_for":["code generators (ORMs, API clients, GraphQL code generators)","scaffolding tools","teams automating boilerplate generation","API documentation generators"],"limitations":["Structure API is TypeScript-specific — cannot generate JavaScript-only syntax like JSX without workarounds","Complex nested structures (deeply nested generics, conditional types) may require manual AST manipulation","No built-in formatting — generated code requires running through a formatter like Prettier"],"requires":["TypeScript 4.0+","Understanding of TypeScript declaration syntax","ts-morph package with structure types"],"input_types":["structure objects (ClassDeclarationStructure, etc.)","existing AST nodes","type strings"],"output_types":["modified AST nodes","generated source code","persisted TypeScript files"],"categories":["code-generation-editing"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_3","uri":"capability://code.generation.editing.import.and.export.statement.manipulation","name":"import and export statement manipulation","description":"Provides specialized APIs for analyzing and modifying import/export declarations through dedicated classes (ImportDeclaration, ExportDeclaration, ExportSpecifier) that abstract away the complexity of managing module specifiers, named imports, default imports, and re-exports. Supports operations like addImportDeclaration(), removeImportDeclaration(), and getImportDeclarations() with filtering by module name. Handles both ES6 module syntax and CommonJS require patterns, and can automatically organize imports or detect circular dependencies.","intents":["I want to add a new import statement to a file and ensure it doesn't create duplicates","I need to find all files that import a specific module and update them when the module path changes","I want to automatically organize imports (sort, remove unused) in my codebase"],"best_for":["refactoring tools","module path migration tools","import optimization tools","monorepo management systems"],"limitations":["Cannot detect dynamic imports (require() calls or import() expressions) — only static import/export statements","Circular dependency detection requires full project context and can be slow on large codebases","CommonJS require() manipulation is limited compared to ES6 import/export"],"requires":["TypeScript 4.0+","Valid source files with import/export statements","Project context for full import resolution"],"input_types":["source files","module specifiers","import/export declarations"],"output_types":["modified import/export statements","import organization reports"],"categories":["code-generation-editing"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_4","uri":"capability://code.generation.editing.type.system.introspection.and.querying","name":"type system introspection and querying","description":"Exposes TypeScript's type system through a wrapper API that allows querying type information for expressions, declarations, and symbols. Provides methods like getType(), getTypeAtLocation(), and getSymbolAtLocation() that return Type and Symbol objects with properties for checking type kinds (isStringLiteral(), isUnion(), isIntersection()), accessing type arguments, and resolving symbol definitions. Integrates with TypeChecker to enable semantic analysis without requiring developers to interact with the low-level Compiler API directly.","intents":["I want to determine the type of an expression at a specific location in the code","I need to check if a type is a union, intersection, or generic type and extract its components","I want to find the definition of a symbol and trace its type through the codebase"],"best_for":["type-aware code generators","API documentation generators","type-checking linters","IDE plugin developers"],"limitations":["Type introspection requires full project context and TypeChecker initialization — cannot work on isolated files","Complex generic types with deep nesting can be slow to resolve","Type narrowing and control flow analysis require analyzing the full function body, not just the expression"],"requires":["TypeScript 4.0+","Valid tsconfig.json with proper type checking configuration","All dependencies resolvable in node_modules"],"input_types":["AST nodes","expressions","symbol references"],"output_types":["Type objects","Symbol information","type kind enums"],"categories":["code-generation-editing","data-processing-analysis"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_5","uri":"capability://tool.use.integration.file.system.abstraction.with.in.memory.and.real.file.system.support","name":"file system abstraction with in-memory and real file system support","description":"Implements a FileSystemHost abstraction layer that decouples ts-morph from the underlying file system, supporting both real file system operations and in-memory virtual file systems. The abstraction allows creating a Project with a custom FileSystemHost implementation, enabling scenarios like testing without disk I/O, running in browser environments, or using custom storage backends. Provides methods like readFileSync(), writeFileSync(), and directoryExistsSync() that can be overridden to implement alternative storage strategies.","intents":["I want to test my code transformation logic without writing to disk","I need to run ts-morph in a browser or Node.js environment without file system access","I want to use a custom storage backend (database, cloud storage) instead of the local file system"],"best_for":["testing frameworks for code generators","browser-based code editors","cloud-based development environments","teams with custom storage requirements"],"limitations":["Custom FileSystemHost implementations must handle all file operations — incomplete implementations will cause runtime errors","In-memory file systems consume memory proportional to codebase size — not suitable for very large codebases (1M+ lines)","No built-in caching or optimization — custom implementations must handle performance themselves"],"requires":["TypeScript 4.0+","Understanding of FileSystemHost interface","Custom FileSystemHost implementation for non-standard file systems"],"input_types":["file paths","file contents","directory paths"],"output_types":["file contents","directory listings","file metadata"],"categories":["tool-use-integration","automation-workflow"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_6","uri":"capability://automation.workflow.project.wide.compiler.configuration.and.diagnostics","name":"project-wide compiler configuration and diagnostics","description":"Manages TypeScript compiler options and project configuration through a Project class that can load tsconfig.json files, apply custom compiler options, and expose diagnostic information. Provides methods like getPreEmitDiagnostics() and getCompilerOptions() to access compiler configuration and error/warning information. Supports multiple source files within a single project context, enabling whole-project analysis and refactoring that respects compiler settings like strict mode, target version, and module resolution.","intents":["I want to load a tsconfig.json file and apply its compiler options to my code analysis","I need to get all compilation errors and warnings for my project to fix them programmatically","I want to analyze code with specific compiler settings (strict mode, ES target version) applied"],"best_for":["build tools and bundlers","CI/CD linters and validators","teams migrating TypeScript versions","custom TypeScript compiler wrappers"],"limitations":["Compiler diagnostics require full type checking — can be slow on large projects (10k+ files)","Custom compiler options may not be fully supported — some advanced options require direct Compiler API usage","Diagnostics are read-only — cannot programmatically fix errors, only report them"],"requires":["TypeScript 4.0+","Valid tsconfig.json file (optional, can use inline compiler options)","All dependencies resolvable for type checking"],"input_types":["tsconfig.json file path","compiler options object","source files"],"output_types":["compiler options","diagnostic information","error/warning reports"],"categories":["automation-workflow","data-processing-analysis"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_7","uri":"capability://code.generation.editing.decorator.and.jsdoc.annotation.analysis.and.generation","name":"decorator and jsdoc annotation analysis and generation","description":"Provides specialized APIs for analyzing and generating TypeScript decorators and JSDoc comments through Decorator and JSDocTag classes. Supports reading decorator arguments, generating new decorators with parameters, and parsing/generating JSDoc tags (param, returns, deprecated, etc.). Integrates with the declaration modification system to allow adding decorators and JSDoc to classes, methods, and properties programmatically.","intents":["I want to find all classes decorated with @Entity and extract their decorator arguments","I need to generate JSDoc comments for auto-generated code with proper @param and @returns tags","I want to add decorators to methods when refactoring code"],"best_for":["ORM and framework code generators","API documentation generators","decorator-based framework tools","teams using TypeScript decorators extensively"],"limitations":["Decorator analysis is syntactic only — cannot evaluate decorator expressions at runtime","JSDoc parsing is basic — complex JSDoc syntax may not be fully supported","Decorator generation requires understanding of decorator syntax and semantics"],"requires":["TypeScript 4.0+","experimentalDecorators compiler option enabled for decorator support","Valid decorator syntax"],"input_types":["decorator nodes","JSDoc comment strings","declaration nodes"],"output_types":["decorator information","JSDoc tag objects","generated decorators and comments"],"categories":["code-generation-editing"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_8","uri":"capability://code.generation.editing.multi.file.batch.refactoring.with.consistency.checking","name":"multi-file batch refactoring with consistency checking","description":"Enables refactoring operations across multiple source files within a project context, maintaining consistency through symbol resolution and type checking. Supports operations like renaming symbols across files, moving declarations between files, and updating all references automatically. Uses the TypeChecker to ensure that refactoring operations respect type safety and don't break module boundaries or create circular dependencies.","intents":["I want to rename a function and automatically update all call sites across my entire codebase","I need to move a class from one file to another and update all imports automatically","I want to extract a function and ensure all references are updated consistently"],"best_for":["IDE refactoring tools","large-scale code migration tools","monorepo management systems","teams performing systematic codebase improvements"],"limitations":["Refactoring operations require full project context and type checking — slow on large codebases (10k+ files)","Some refactoring operations (like extract function) require manual implementation using lower-level APIs","Circular dependency detection and resolution is not automatic — requires manual handling"],"requires":["TypeScript 4.0+","Valid tsconfig.json with proper module resolution","All dependencies resolvable"],"input_types":["source files","symbol references","refactoring operations"],"output_types":["modified source files","refactoring reports","consistency validation results"],"categories":["code-generation-editing","automation-workflow"],"confidence":0.5,"matches":0,"success_rate":0},{"id":"github-dsherret--ts-morph__cap_9","uri":"capability://code.generation.editing.source.file.creation.and.template.based.code.generation","name":"source file creation and template-based code generation","description":"Provides APIs for creating new source files within a project and populating them with code using the structure-based generation system. Supports creating files with initial content (classes, interfaces, functions) through addSourceFileAtPath() and createSourceFile() methods that accept structure objects. Enables template-based code generation where developers define the structure of generated code declaratively rather than building AST nodes manually.","intents":["I want to create a new TypeScript file with a class definition and export it","I need to generate multiple files from a template (e.g., one file per entity in a database schema)","I want to create a new file with proper imports and type annotations"],"best_for":["code generators and scaffolders","API client generators","ORM code generators","teams automating boilerplate creation"],"limitations":["Generated code requires formatting — ts-morph does not format output, requiring separate Prettier/dprint integration","Complex file structures may require multiple API calls — no built-in template language","No built-in validation of generated code — must manually verify syntax"],"requires":["TypeScript 4.0+","Valid project context","Write permissions to target directory"],"input_types":["file paths","structure objects","code strings"],"output_types":["created source files","generated code"],"categories":["code-generation-editing","automation-workflow"],"confidence":0.5,"matches":0,"success_rate":0}],"trust":{"score":44,"verified":false,"data_access_risk":"high","permissions":["TypeScript 4.0+","Node.js 12.20+","ts-morph package installed","Valid tsconfig.json or explicit compiler options","All imported dependencies available in node_modules","Source file with valid syntax","Understanding of advanced TypeScript type features","Valid project context for type checking","Sufficient memory for caching (proportional to project size)","Understanding of TypeScript declaration syntax"],"failure_modes":["All changes held in memory until explicit save — can cause memory pressure on very large codebases (100k+ files)","No built-in transaction rollback — must manually track state if reverting changes","Changes are not persisted to disk until saveSourceFile() is called, so process crashes lose all edits","TypeChecker-based semantic queries require full project context — cannot analyze isolated files without tsconfig.json","Performance degrades on large codebases (10k+ files) due to full type checking overhead","Symbol resolution requires all dependencies to be resolvable — missing node_modules breaks semantic analysis","Trivia (comments, whitespace) handling is complex — modifying trivia can break formatting","Line/column position queries require scanning the entire file — can be slow for large files","No built-in formatting — must use external formatters like Prettier to reformat code","Complex type features (conditional types, mapped types) can be difficult to analyze and modify","builder identity is not verified yet","no observed match outcomes yet"],"rank_breakdown":{"adoption":0.5776190759460377,"quality":0.35,"ecosystem":0.55,"match_graph":0.25,"freshness":0.75,"weights":{"adoption":0.3,"quality":0.2,"ecosystem":0.15,"match_graph":0.3,"freshness":0.05}},"observed_outcomes":{"matches":0,"success_rate":0,"avg_confidence":0,"top_intents":[],"last_matched_at":null},"maintenance":{"status":"active","updated_at":"2026-05-24T12:16:21.550Z","last_scraped_at":"2026-05-03T13:58:37.060Z","last_commit":"2026-04-12T18:25:32Z"},"community":{"stars":6041,"forks":232,"weekly_downloads":null,"model_downloads":null,"model_likes":null}},"distribution":{"claim_url":"https://unfragile.ai/submit?claim=dsherret--ts-morph","compare_url":"https://unfragile.ai/compare?artifact=dsherret--ts-morph"}},"signature":"LWgOqOWQEw6ByDSCkhMaMJHS/JFqNawUaHzjTE2xvf2R3sQdhtkhCoEqX1YPsDOKyRzn4BbidS9IdoVU8MUoCw==","signedAt":"2026-06-21T07:17:32.518Z","signedBy":"unfragile.ai","version":1},"_links":{"self":"https://unfragile.ai/api/v1/passport/dsherret--ts-morph","artifact":"https://unfragile.ai/dsherret--ts-morph","verify":"https://unfragile.ai/api/v1/verify?slug=dsherret--ts-morph","publicKey":"https://unfragile.ai/api/v1/trust-passport-public-key","spec":"https://unfragile.ai/trust","schema":"https://unfragile.ai/schema.json","docs":"https://unfragile.ai/docs"}}