Drop-in solution to help agentic AI find what files it needs to read to add to the context for iterative development (cursor composer, openhands, cline, etc).
logs function inputs:
{
"event": "function_call",
"file": "src/services/MyService.ts",
"function": "getData",
"class": "MyService",
"timestamp": "2024-01-17T01:42:51.123Z",
"args": ["param1", "param2"]
}logs function outputs:
{
"event": "function_return",
"file": "src/services/MyService.ts",
"function": "getData",
"class": "MyService",
"timestamp": "2024-01-17T01:42:51.123Z",
"returnValue": "result"
}- Copy this file into your project's utils folder
- Enable decorators in your tsconfig.json:
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}import { traceClass } from './utils/trace';
@traceClass()
class MyClass {
async myMethod() {
console.log('Executing myMethod');
}
}Or, you could trace a single method:
import { traceMethod } from './utils/trace';
class MyClass {
@traceMethod()
async myMethod() {
console.log('Executing myMethod');
}
}MIT
Raymond Xu (@ryx2)