{"id":16844745,"url":"https://github.com/stephanhoyer/chuk","last_synced_at":"2025-06-19T03:45:38.258Z","repository":{"id":5907775,"uuid":"7126794","full_name":"StephanHoyer/chuk","owner":"StephanHoyer","description":"Run any arbitrary code before REPL starts","archived":false,"fork":false,"pushed_at":"2023-12-15T08:29:23.000Z","size":23,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T08:38:27.021Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StephanHoyer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2012-12-12T08:35:35.000Z","updated_at":"2019-06-09T02:29:56.000Z","dependencies_parsed_at":"2024-10-23T02:39:03.785Z","dependency_job_id":null,"html_url":"https://github.com/StephanHoyer/chuk","commit_stats":{"total_commits":39,"total_committers":2,"mean_commits":19.5,"dds":"0.15384615384615385","last_synced_commit":"6d790585a0059335b9e43fd628c8e92260d28567"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fchuk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fchuk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fchuk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fchuk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StephanHoyer","download_url":"https://codeload.github.com/StephanHoyer/chuk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351383,"owners_count":21089271,"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":[],"created_at":"2024-10-13T12:56:29.260Z","updated_at":"2025-04-11T06:00:27.082Z","avatar_url":"https://github.com/StephanHoyer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/StephanHoyer/chuk.png?branch=master)](https://travis-ci.org/StephanHoyer/chuk)\n\n# chuk\n\nRun any arbitrary code before REPL starts.\n\n## Installation\n\n```bash\n$ npm install chuk -g\n```\n\n## Usage\n\nIf you've install *chuk* globaly as recommended you should be able to run the\nchuk repl by just typing `chuk` instead of `node`. This should start a normal\nREPL as you'd expect.\n\nNow if you want to use the special ability to run some code before the REPL is\ngoing up create a file called `Chukfile` in you projects root dir.\n\nThe simplest Chukfile may look like this:\n\n```js\nmodule.exports = function(scope) {\n  scope.a = 1;\n}\n```\n\nAs you can see, it contains just JavaScript code. This Chukfile simply exports\none function with one parameter. The function is called at the startup of the\nREPL and the parameter is filled with the *global*-object of the REPL. So\nthe file above should give you a variable `a = 1` from start on.\n\n## Advanced usage\n\nSometimes you want to have different code run on different tasks. Maybe you\nwant to initialize the database if your debugging model code and you want to\ninitialize a rest service if you want to test something there. This can be\nachived easily by extending the `Chukfile` like so:\n\n```js\nmodule.exports = {\n  \"db\": function(scope) {\n    // DB init goes here\n  },\n  \"rest\": function(scope) {\n    // REST init goes here\n  }\n}\n```\n\nIf you now type\n\n```bash\n$ chuk db\n```\n\nto your shell, only the db section is loaded.\n\n## REPL history\n\n`chuk` automatically writes entered commands into a history file, which is then used to populate the repl's history on next boot of `chuk`.\nBy default the file `.repl_history` within the current execution folder is used, but this can be changed by the setting the environment variable `REPL_HISTORY` like:\n\n```bash\nREPL_HISTORY='.custom_history' chuk\n```\n\nUsing the env variable, one could maintain multiple separate history files within a single project for both writing and reading, which can be handy under special circumstances.\n\n## Running the tests\n\n```bash\n$ npm install\n$ make test\n```\n\n## Plugins\n\n[chuk-cb](https://github.com/StephanHoyer/chuk-cb) - simplifys writing callbacks in REPL session\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 Mario Behrendt info@mario-behrendt.de, Stephan Hoyer \u003cste.hoyer@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanhoyer%2Fchuk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephanhoyer%2Fchuk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanhoyer%2Fchuk/lists"}