{"id":16585578,"url":"https://github.com/junegunn/clj-inspector","last_synced_at":"2025-10-29T08:32:01.063Z","repository":{"id":62433156,"uuid":"109262769","full_name":"junegunn/clj-inspector","owner":"junegunn","description":"Inspector helps debugging Clojure programs","archived":false,"fork":false,"pushed_at":"2025-01-08T07:08:14.000Z","size":8,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-01T23:51:05.137Z","etag":null,"topics":["clojure","debugging"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/junegunn.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}},"created_at":"2017-11-02T12:37:01.000Z","updated_at":"2025-01-08T07:08:17.000Z","dependencies_parsed_at":"2022-11-01T21:01:29.752Z","dependency_job_id":null,"html_url":"https://github.com/junegunn/clj-inspector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junegunn%2Fclj-inspector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junegunn%2Fclj-inspector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junegunn%2Fclj-inspector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junegunn%2Fclj-inspector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/junegunn","download_url":"https://codeload.github.com/junegunn/clj-inspector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238795332,"owners_count":19531717,"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","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":["clojure","debugging"],"created_at":"2024-10-11T22:48:34.071Z","updated_at":"2025-10-29T08:31:55.731Z","avatar_url":"https://github.com/junegunn.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"clj-inspector\n=============\n\n[![Build Status](https://travis-ci.org/junegunn/clj-inspector.svg?branch=master)](https://travis-ci.org/junegunn/clj-inspector)\n[![codecov](https://codecov.io/gh/junegunn/clj-inspector/branch/master/graph/badge.svg)](https://codecov.io/gh/junegunn/clj-inspector)\n\n*Inspector* helps debugging Clojure programs.\n\nInstallation\n------------\n\nTo include *Inspector* in your development environment, add *Inspector* to\n`:dependencies` and `:injections` of `user` profile in `~/.lein/profiles.clj`:\n\n```clojure\n{:user {:dependencies [[junegunn/inspector \"0.2.0\"]]\n        :injections [(require 'inspector.core)]}}\n```\n\nUsage\n-----\n\n### Inspection with reader tags\n\n`#i/?` inspects the next form and prints debugging information.\n\n```clojure\n(let [foo 1\n      bar 2]\n  #i/? (+ foo #i/? (* bar bar)))\n\n;; ┌ (+ foo (* bar bar))\n;; │  at user$eval40206.invokeStatic (form-init3537188508571310180.clj:1)\n;; │ ┌ (* bar bar)\n;; │ │  at user$eval40206$fn__40209.invoke (form-init3537188508571310180.clj:3)\n;; │ │  result:  4\n;; │ ├  locals:\n;; │ │    bar: 2\n;; │ │    foo: 1\n;; │ └\n;; │  result:  5\n;; │  elapsed: 5ms\n;; ├  locals:\n;; │    bar: 2\n;; │    foo: 1\n;; └\n```\n\nBy default, messages are printed to `*out*`, but you can change it with\n`inspector.core/set-writer!`.\n\n```clojure\n(inspector.core/set-writer! System/err)\n```\n\nThis is useful when you're connected to an nREPL server running on a terminal\nwindow and you want the messages to be printed on that window.\n\n### Inspection with macros\n\n`inspector.core/?` macro can be used instead of `#i/?` tag.\n\n```clojure\n(require '[inspector.core :refer [?]])\n\n(? (rand-int 100)\n   (rand-int 200))\n\n;; Prints:\n;;   ┌ (rand-int 100)\n;;   │  at user$eval40599.invoke (form-init7268911457864946014.clj:1)\n;;   │  result:  19\n;;   │  elapsed: 1ms\n;;   └\n;;   ┌ (rand-int 200)\n;;   │  at user$eval40623.invoke (form-init7268911457864946014.clj:1)\n;;   │  result:  83\n;;   │  elapsed: 1ms\n;;   └\n;; Returns: 83\n```\n\nTo retrieve the inspection result as a map, use `inspector.core/inspect`\nmacro.\n\n```clojure\n(require '[inspector.core :refer [inspect]])\n\n(let [foo 1 bar 2] (inspect (+ foo bar)))\n;; Returns:\n;;   {:started \u003cSystem/currentTimeMillis\u003e,\n;;    :locals {:foo 1, :bar 2}, :result 3, :form (+ foo bar), :elapsed 0}\n```\n\nYou can use it to write derivative macros for capturing inspection reports.\n\n```clojure\n(def captures (atom []))\n\n(defmacro ?\u003e\u003e\n  \"Macro that captures the inspection report of each form and returns the\n  original evaluation result of the last form\"\n  [\u0026 forms]\n  `(do ~@(for [form forms]\n           `(let [report# (inspect ~form)]\n              (swap! captures conj report#)\n              (:result report#)))))\n```\n\n### Extra features in inspector.core\n\n```clojure\n(require '[inspector.core :refer [ls whereami env]])\n\n;; Print vars in the current namespace\n(ls)\n\n;; Print vars in the given namespace\n(ls *ns*)\n\n;; Print the members of the object\n(ls \"java object\")\n\n;; Print stack trace\n(whereami)\n\n;; Capture lexical bindings as a map\n(let [foo 1 bar 2] (env))\n```\n\nInspiration\n-----------\n\n*Inspector* was heavily inspired by [spyscope][spyscope].\n\n[spyscope]: https://github.com/dgrnbrg/spyscope\n\nLicense\n-------\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Junegunn Choi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunegunn%2Fclj-inspector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjunegunn%2Fclj-inspector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunegunn%2Fclj-inspector/lists"}