{"id":18725726,"url":"https://github.com/binaryage/dirac-sample","last_synced_at":"2025-09-04T15:34:22.629Z","repository":{"id":66474231,"uuid":"56320157","full_name":"binaryage/dirac-sample","owner":"binaryage","description":"An example integration of Dirac DevTools","archived":false,"fork":false,"pushed_at":"2019-09-02T14:22:05.000Z","size":64,"stargazers_count":17,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T16:47:08.820Z","etag":null,"topics":["devtools","dirac","repl"],"latest_commit_sha":null,"homepage":"https://github.com/binaryage/dirac","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binaryage.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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}},"created_at":"2016-04-15T12:56:05.000Z","updated_at":"2019-09-02T14:22:06.000Z","dependencies_parsed_at":"2023-07-25T05:45:53.047Z","dependency_job_id":null,"html_url":"https://github.com/binaryage/dirac-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/binaryage/dirac-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryage%2Fdirac-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryage%2Fdirac-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryage%2Fdirac-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryage%2Fdirac-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binaryage","download_url":"https://codeload.github.com/binaryage/dirac-sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binaryage%2Fdirac-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273631556,"owners_count":25140627,"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-09-04T02:00:08.968Z","response_time":61,"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":["devtools","dirac","repl"],"created_at":"2024-11-07T14:11:36.275Z","updated_at":"2025-09-04T15:34:22.609Z","avatar_url":"https://github.com/binaryage.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# This project is deprecated since Dirac v1.4.0\n\nPlease use Dirac integration examples in\n\n[https://github.com/binaryage/dirac/tree/master/examples](https://github.com/binaryage/dirac/tree/master/examples)\n\n---\n---\n---\n\n# dirac-sample [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](license.txt)\n\nThis project is an example of integration of [**Dirac DevTools**](https://github.com/binaryage/dirac) into a\nLeiningen-based ClojureScript project.\n\n![](https://box.binaryage.com/dirac-main-01.png)\n\n## Local setup\n\n    git clone https://github.com/binaryage/dirac-sample.git\n    cd dirac-sample\n\n## Demo time!\n\n### Installation\n\nLaunch latest [Chrome Canary](https://www.google.com/chrome/browser/canary.html) from command-line.\nI recommend to run it with a dedicated user profile, because you will install there a helper [Chrome Extension](https://chrome.google.com/webstore/detail/dirac-devtools/kbkdngfljkchidcjpnfcgcokkbhlkogi).\nAlso you have to run it with [remote debugging](https://developer.chrome.com/devtools/docs/debugger-protocol) enabled on port 9222 (better make an alias of this command):\n\n    /Applications/Google\\ Chrome\\ Canary.app/Contents/MacOS/Google\\ Chrome\\ Canary \\\n      --remote-debugging-port=9222 \\\n      --no-first-run \\\n      --user-data-dir=.test-dirac-chrome-profile\n\nNow you can install the [Dirac DevTools Chrome extension](https://chrome.google.com/webstore/detail/dirac-devtools/kbkdngfljkchidcjpnfcgcokkbhlkogi).\n\nAfter installation, should see a new extension icon next to your address bar \u003cimg src=\"https://box.binaryage.com/dirac-extension-icon.png\" height=\"32\"\u003e.\n\nNow you can launch the demo project from terminal:\n\n    lein demo\n\nAt this point you should have a demo website running at [http://localhost:9977](http://localhost:9977).\n\nPlease navigate there, do not open internal DevTools and click Dirac icon while on the `http://localhost:9977/demo.html` page.\nIt should open you a new window with Dirac DevTools app.\nIt will look almost the same as internal DevTools, but you can tell the difference at first glance: active tab highlight\nwill be green instead of blue (see the screenshots above).\n\nOk, now you can switch to Javascript Console in Dirac DevTools. Focus prompt field and press `CTRL+,` or `CTRL+.`.\nThis will cycle between Javascript to ClojureScript REPL prompts.\n\nYou should see a red message on a green background: `Dirac Agent is not listening at ws://localhost:8231 (need help?).`\n\nThat's correct. Dirac REPL uses nREPL protocol so we have to provide it with some nREPL server.\nLuckily enough leiningen offers nREPL server by simply running (in a new terminal session):\n\n    lein repl\n\nThe terminal should print something similar to this:\n\n    Compiling ClojureScript...\n    nREPL server started on port 8230 on host 127.0.0.1 - nrepl://127.0.0.1:8230\n    REPL-y 0.3.7, nREPL 0.2.12\n    Clojure 1.8.0\n    Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27\n        Docs: (doc function-name-here)\n              (find-doc \"part-of-name-here\")\n      Source: (source function-name-here)\n     Javadoc: (javadoc java-object-or-class-here)\n        Exit: Control+D or (exit) or (quit)\n     Results: Stored in vars *1, *2, *3, an exception in *e\n\n    user=\u003e\n    Dirac Agent v0.5.0\n    Connected to nREPL server at nrepl://localhost:8230.\n    Agent is accepting connections at ws://localhost:8231.\n\nLast three lines ensure you that Dirac Agent was launched alongside your nREPL server. It connected to it and is accepting\nDevTools connections on the websocket port 8231.\n\nAfter your Dirac Agent is up your Dirac DevTools should eventually reconnect.\n\nConnected? The red message should go away and you should see `cljs.user` indicating your\ncurrent namespace. REPL is ready for your input at this point. You can try:\n\n    (+ 1 2)\n    js/window\n    (doc filter)\n    (filter odd? (range 42))\n\nIf you see something very similar to the first screenshot at the top, you have Dirac running properly.\n\n**Congratulations!**\n\n### Hello, World!\n\nLet's try to call `hello!` function from our namespace `dirac-sample.demo`.\n\n    (dirac-sample.demo/hello! \"World\")\n\nIt worked `\"Hello, World!\"` was logged into the console (white background means that the logging output originated in Javascript land).\n\nAs you probably know you should first require (or eval) namespace in the REPL context to make it aware of namespace content.\n\n    (require 'dirac-sample.demo)\n\nBut still you have to type fully qualified name because currently you are in `cljs.user` namespace. To switch you can use `in-ns` special function.\n\nLet's try it:\n\n    (in-ns)\n\nYou get an error `java.lang.IllegalArgumentException: Argument to in-ns must be a symbol.`. This is a Java exception from nREPL side.\n Execute `(doc in-ns)` to see the documentation for this special REPL function. It expects namespace name as the first argument.\n\n    (in-ns 'dirac-sample.demo)\n    (hello! \"Dirac\")\n\nShould log `Hello, Dirac!` into the console without warnings.\n\n### Breakpoints\n\nYou can also test evaluation of ClojureScript in the context of selected stack frame when paused on a breakpoint:\n\n1. click the \"demo a breakpoint\" button on the page\n2. debugger should pause on the `(js-debugger)` line in the breakpoint-demo function\n\nCustom formatters should be presented as inlined values in the source code.\nAlso property names in the scope panel are sorted and displayed in a more friendly way.\n\nNow hit ESC to bring up console drawer. Make sure you are switched to Dirac REPL and then enter:\n\n    numbers\n\nYou should see actual value `(0 1 2)` of the `numbers` variable from local scope (formatted by custom formatters from cljs-devtools).\nSame way as you would expect when evaluating a Javascript command in a breakpoint context. Actually you can try it.\nHit `CTRL+.` to switch to Javascript console prompt (white background) and enter:\n\n    numbers\n\nThis should return the same output.\n\nAnd now return back to Dirac REPL by pressing `CTRL+.` again and enter:\n\n    (str (map inc numbers))\n\nYou should get back a string `\"(1 2 3)\"`.\n\nThis is a proof that Dirac REPL can execute arbitrary ClojureScript code in the context of a selected stack frame.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinaryage%2Fdirac-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinaryage%2Fdirac-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinaryage%2Fdirac-sample/lists"}