Skip to content

For helping the ai (cursor composer, cline, openhands) find the file that you're currently executing

Notifications You must be signed in to change notification settings

ryx2/AiAgenticStackTrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

TypeScript Method Tracing Utility

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).

What it does

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"
}

Setup

  1. Copy this file into your project's utils folder
  2. Enable decorators in your tsconfig.json:
{
    "compilerOptions": {
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true
    }
}

Basic Usage

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');
    }
}

License

MIT

Author

Raymond Xu (@ryx2)

About

For helping the ai (cursor composer, cline, openhands) find the file that you're currently executing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published