Repository navigation
v1.12.0 - TypeScript Integration
v1.12.0 - TypeScript Integration
π― Highlights
DX-78: TypeScript Compiler API Integration - Full cross-language reference finding now available for Python and TypeScript projects.
β¨ New Features
Multi-Language Symbol Analysis
-
TypeScript Compiler API integration via embedded
ts-query.jstool- No npm installation required - bundled with package
- Accurate symbol analysis using official TypeScript compiler
- Support for
sig,map, andrefscommands
-
Python reference finding via jedi library
- Cross-file reference analysis
- Symbol position tracking
- Context-aware lookups
-
Unified
invar refscommandinvar refs src/auth.ts::login # TypeScript invar refs src/parser.py::parse # Python
MCP Protocol Enhancement
- New
invar_refsMCP tool for AI agents - Automatic language detection (Python/TypeScript)
- JSON-structured output for agent consumption
π Security Fixes
TypeScript (4 Critical)
- JSON parsing protection - Malformed input no longer crashes process
- Null safety - Property access checks prevent TypeErrors
- I/O error handling - Graceful degradation on file read failures
- TOCTOU fix - Eliminated race condition in file operations
Python (5 Major)
- Fixed hardcoded
column=0in TypeScript refs lookup - Added
@shell_complexitymarkers to py_refs.py - Replaced trivial doctests with meaningful behavior tests
- Fixed weak test assertions in integration tests
- Replaced dynamic type creation with proper dataclass
π Documentation
- Updated .invar/context.md with DX-78 architecture details
- Enhanced CLAUDE.md with TypeScript review guidelines
- Security model and dependencies documented
- Review checklist for TypeScript vulnerabilities
π§ͺ Testing
- 32 new integration tests for TypeScript support
- All tests passing (Python + TypeScript)
- Guard verification: 0 errors, 0 warnings
π¦ Installation
pip install --upgrade invar-toolsDependencies:
- Node.js + TypeScript (for TypeScript project support)
- jedi (automatically installed for Python refs)
π Technical Details
Architecture
src/invar/
βββ node_tools/
β βββ ts-query.js # TypeScript Compiler API tool
βββ shell/
β βββ ts_compiler.py # Python wrapper (subprocess)
β βββ py_refs.py # Python refs (jedi)
βββ mcp/
β βββ handlers.py # MCP tool handlers
β βββ server.py # Protocol registration
βββ shell/commands/
βββ perception.py # Multi-language routing
βββ guard.py # CLI entry point
Security Model
- Single-shot subprocess: No persistent Node.js processes
- Path validation: All inputs validated before subprocess execution
- Error isolation: Failures don't crash parent process
- No orphan risk: Process lifecycle strictly managed
π Usage Examples
Find all references to a TypeScript symbol
$ invar refs src/auth.ts::validateToken
{
"file": "src/auth.ts",
"line": 45,
"column": 9,
"references": [
{"file": "src/middleware.ts", "line": 12, "column": 5, "context": "const valid = validateToken(token);"},
{"file": "src/routes.ts", "line": 28, "column": 10, "context": "if (validateToken(req.token)) {"}
]
}Find Python symbol references
$ invar refs src/parser.py::parse_source
{
"file": "src/parser.py",
"line": 23,
"column": 4,
"references": [
{"file": "src/main.py", "line": 15, "column": 8, "context": "ast = parse_source(code)"}
]
}π Related
- Proposal: DX-78 MCP Protocol Sync
- Review: Adversarial review process (4 rounds, all issues fixed)
π Credits
Reviewed-by: Adversarial Review Process
- 4 rounds of isolated subagent review
- All critical security issues addressed
- Zero test failures
Full Changelog: v1.11.0...v1.12.0