{"id":28236633,"url":"https://github.com/karmakrafts/introspekt","last_synced_at":"2025-08-01T23:11:06.019Z","repository":{"id":289176895,"uuid":"969784512","full_name":"karmakrafts/Introspekt","owner":"karmakrafts","description":"Positional code and compile-time introspection API for Kotlin/Multiplatform.","archived":false,"fork":false,"pushed_at":"2025-07-08T05:19:01.000Z","size":691,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-08T06:36:47.598Z","etag":null,"topics":["compiler-plugin","introspection","kotlin","kotlin-common","kotlin-compiler","kotlin-compiler-plugin","kotlin-js","kotlin-jvm","kotlin-native","trace","tracing"],"latest_commit_sha":null,"homepage":"https://git.karmakrafts.dev/kk/introspekt","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karmakrafts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-20T23:19:27.000Z","updated_at":"2025-07-08T04:53:40.000Z","dependencies_parsed_at":"2025-04-28T14:44:12.493Z","dependency_job_id":"c0c6fddc-f303-497e-bab6-0d5d8e3b486f","html_url":"https://github.com/karmakrafts/Introspekt","commit_stats":null,"previous_names":["karmakrafts/trakkit","karmakrafts/introspekt"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/karmakrafts/Introspekt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FIntrospekt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FIntrospekt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FIntrospekt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FIntrospekt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karmakrafts","download_url":"https://codeload.github.com/karmakrafts/Introspekt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FIntrospekt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268310797,"owners_count":24230185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler-plugin","introspection","kotlin","kotlin-common","kotlin-compiler","kotlin-compiler-plugin","kotlin-js","kotlin-jvm","kotlin-native","trace","tracing"],"created_at":"2025-05-19T00:15:52.019Z","updated_at":"2025-08-01T23:11:06.008Z","avatar_url":"https://github.com/karmakrafts.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introspekt\n\n[![](https://git.karmakrafts.dev/kk/introspekt/badges/master/pipeline.svg)](https://git.karmakrafts.dev/kk/introspekt/-/pipelines)\n[![](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo.maven.apache.org%2Fmaven2%2Fdev%2Fkarmakrafts%2Fintrospekt%2Fintrospekt-runtime%2Fmaven-metadata.xml\n)](https://git.karmakrafts.dev/kk/introspekt/-/packages)\n[![](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Fdev%2Fkarmakrafts%2Fintrospekt%2Fintrospekt-runtime%2Fmaven-metadata.xml\n)](https://git.karmakrafts.dev/kk/introspekt/-/packages)\n\nIntrospekt is a positional code API and introspection framework for Kotlin Multiplatform.  \nIt currently adds the following features:\n\n* `SourceLocation` type with access to module name, file path, function name, line and column\n* `FunctionInfo` type for introspecting current/caller function signature and location\n* `ClassInfo` type for introspecting current/caller classes including functions\n* `AnnotationUsageInfo` type for introspecting annotation types and their parameters\n* `TypeInfo` type for fundamental RTTI integrated with **kotlin.reflect** to fix gaps on Kotlin/JS and other platforms\n* Default-parameter inlining for intrinsic types listed above (like `std::source_location` in C++)\n* Compile-time evaluation of location hashes to improve runtime performance for positional memoization\n* Tracing API for automatically injecting trace callbacks into code, including manual spans and events\n\n### How to use it\n\nFirst, add the official Maven Central repository to your `settings.gradle.kts`:\n\n```kotlin\npluginManagement {\n    repositories {\n        maven(\"https://central.sonatype.com/repository/maven-snapshots\")\n        mavenCentral()\n    }\n}\n\ndependencyResolutionManagement {\n    repositories {\n        maven(\"https://central.sonatype.com/repository/maven-snapshots\")\n        mavenCentral()\n    }\n}\n```\n\nThen add a dependency on the plugin in your root buildscript:\n\n```kotlin\nplugins {\n    id(\"dev.karmakrafts.introspekt.introspekt-gradle-plugin\") version \"\u003cversion\u003e\"\n}\n\nkotlin {\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(\"dev.karmakrafts.introspekt:introspekt-runtime:\u003cversion\u003e\")\n            }\n        }\n    }\n}\n```\n\n### Tracing\n\nTracing can be used to automatically inject callbacks into the code to collect certain events.  \nThe events can be processed/collected using an implementation of `TraceCollector`.  \nThe following example illustrates a simple use-case for logging:\n\n```kotlin\nobject MyCollector : TraceCollector {\n    private val logger: MyLogger = MyLogger() // Some logger from another library\n    \n    fun enterSpan(span: TraceSpan) = logger.trace(\"Entering span ${span.name}\")\n    fun leaveSpan(span: TraceSpan, end: SourceLocation) = logger.trace(\"Leaving span ${span.name}\")\n    fun enterFunction(function: FunctionInfo) { /* ... */ }\n    fun leaveFunction(function: FunctionInfo) { /* ... */ }\n    fun call(callee: FunctionInfo, caller: FunctionInfo, location: SourceLocation) { /* ... */ }\n    fun event(event: TraceEvent) { /* ... */ }\n}\n\nfun main() {\n    // Register the collector before any code we want to trace is executed\n    TraceCollector.register(MyCollector)\n    // Enter code we want to trace\n    functionIWantToTrace()\n}\n\n@Trace // This will inject callbacks after every call, and when entering/leaving functions\nfun functionIWantToTrace() {\n    TraceSpan.enter(\"My awesome span\")\n    // ...\n    TraceSpan.leave()\n    // ...\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmakrafts%2Fintrospekt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarmakrafts%2Fintrospekt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmakrafts%2Fintrospekt/lists"}