{"id":15065593,"url":"https://github.com/scripthaus-dev/scripthaus","last_synced_at":"2025-06-24T06:33:08.665Z","repository":{"id":39384380,"uuid":"494649966","full_name":"scripthaus-dev/scripthaus","owner":"scripthaus-dev","description":"ScriptHaus source code","archived":false,"fork":false,"pushed_at":"2024-02-10T22:16:39.000Z","size":197,"stargazers_count":16,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T13:51:37.576Z","etag":null,"topics":["bash","devtools","golang","markdown","open-source","scripts"],"latest_commit_sha":null,"homepage":"https://www.scripthaus.dev","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scripthaus-dev.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}},"created_at":"2022-05-21T01:28:28.000Z","updated_at":"2025-04-09T10:21:35.000Z","dependencies_parsed_at":"2024-01-17T07:43:42.626Z","dependency_job_id":"ce0e761f-676f-4b55-a810-f27cfa10cdb0","html_url":"https://github.com/scripthaus-dev/scripthaus","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"6940fab8ec27043380333ab50e382bb029d6b93a"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/scripthaus-dev/scripthaus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scripthaus-dev%2Fscripthaus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scripthaus-dev%2Fscripthaus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scripthaus-dev%2Fscripthaus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scripthaus-dev%2Fscripthaus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scripthaus-dev","download_url":"https://codeload.github.com/scripthaus-dev/scripthaus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scripthaus-dev%2Fscripthaus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261620698,"owners_count":23185571,"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":["bash","devtools","golang","markdown","open-source","scripts"],"created_at":"2024-09-25T00:42:35.125Z","updated_at":"2025-06-24T06:33:08.620Z","avatar_url":"https://github.com/scripthaus-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ScriptHaus\n \nScriptHaus lets you run bash, Python, and JS snippets from your Markdown files directly\nfrom the command-line. It can turn any Markdown file (including your README.md or\nBUILD.md) into a command-line tool, complete with command-line help and documentation.\n\n* **Stay Organized** - Store your bash one-liners in simple markdown playbooks\n* **Save Commands** - Easily save a command from history to run or view later\n* **Execute** - Run your commands and view documentation directly from the command-lin\n* **Never Forget** - Store history by command and playbook, including options, date, cwd, and exitcode\n* **Share** - Save your playbooks in git and share them with your team\n\nScriptHaus is open source and licensed under the MPLv2.\n\n## Install\n\nScriptHaus can be installed on Mac OS X (recommended) or Linux (experimental)\nusing [homebrew](https://brew.sh).\n\n```bash\n# @scripthaus command brew-install\nbrew tap scripthaus-dev/scripthaus\nbrew install scripthaus\n```\n\nTo install from source (requires go version 1.17+):\n\n```bash\n# @scripthaus command source-install\ngit clone https://github.com/scripthaus-dev/scripthaus.git\ncd scripthaus\nCGO_ENABLED=1 go build -o scripthaus cmd/main.go\n```\n\nThis will build the `scripthaus` binary in your local directory.  You can then `mv` it to any directory in your path.\n\nTo make typing ScriptHaus commands easier, I recommend adding aliasing scripthaus to **s**\n\n```bash\n# @scripthaus command make-alias\necho 'alias s=\"scripthaus\"' \u003e\u003e ~/.bash_profile\n```\n\n## Playbooks\n\nAny markdown file can be a ScriptHaus playbook.  Commands are found by searching for any code fence\n(with a valid language, e.g. \"bash\", \"python\", \"js\", etc.) that have the special ScriptHaus directive:\n\n```\n# @scripthaus command [name] - [short-description]\n```\n\nYou can easily annotate an existing markdown file (README.md or BUILD.md) or create a new playbook with\nscripts or one-liners that you want to document and be able to access easily.\n\nAny markdown that comes before the command, up until you hit a level 1-4 header, thematic break, or another code fence will\nbecome the command's documentation.\n\n````markdown\nThis is the simplest ScriptHaus command.\nThe markdown before the command will turn into help text.\n\n```bash\n# @scripthaus command hi - a simple command that just echos \"hi\" to the console\necho hi\n```\n````\n\nAssuming that markdown was placed into a file named \"commands.md\" you can run:\n```\n\u003e scripthaus run commands.md::hi\nhi\n```\n\nTo see the documentation and code block, run:\n````\n\u003e scripthaus show commands.md\ncommands.md\n  commands.md::hi - a simple command that just echos \"hi\" to the console\n  \n\u003e scripthaus show commands.md::hi\n[^scripthaus] show './commands.md::hi'\n\nThis is the simplest ScriptHaus command.\nThe markdown before the command will turn into help text.\n\n```bash\n# @scripthaus command hi - a simple command that just echos \"hi\" to the console\necho hi\n```\n````\n\n## Project and Home Directories\n\nPlaybooks can *always* be referenced by a relative or absolute path to their markdown files.\nBut, ScriptHaus also supports special syntax that let you access *global*\nor *project* playbooks easily.\n\n**Global** commands are placed in $HOME/scripthaus/scripthaus.md (the directory can be overriden\nby settng the environment variable $SCRIPTHAUS_HOME).  You can access any command in this\nscripthaus.md file as `^[command]`.  Other md files in the ScriptHaus home directory can\nbe accessed as `^[file.md]::[command]`.\n\n**Project** commands are placed in a \"scripthaus.md\" file at the root\nof your project directory.  When you are in the project directory, or\na sub-directory you can access any command in this scripthaus.md file\nas `.[command]`.  Other md files in the project root can be accessed as\n`.[file.md]::[script]` (note that scripthaus.md *must* also exist to\nmark the project root).\n\n## Running a Command\n\nTo run a command from a playbook use `scripthaus run [playbook]::[command]`.\n\nYou can also reference scripts from your *global* or *project* roots.  Here are some examples:\n\n```\nscripthaus run ./test.md::hello # runs the 'hello' command from ./test.md\nscripthaus run ^grep-files      # runs the 'grep-files' command from your global scripthaus.md\nscripthaus run .run-webserver   # runs the 'run-webserver command from your project's scripthaus.md file\nscripthaus run .build.md::test  # runs the 'test' command from the build.md file in your project root\n\n# runs the 'test' command from ./build.md if it exists, otherwise trys to find build.md in your project root\nscripthaus run build.md::test\n```\n\n## Adding a Command to Playbook\n\nYou can always edit the markdown files by hand.  That's the recommended way of converting your old text notes with commands\ninto a runnable ScriptHaus playbook.\n\nScriptHaus also allows you to add a command directly from the command prompt, which is useful when you want to capture a\ncommand from your shell history.\n\nHere's a simple add command to add your last bash command from history (\"!!\" refers to the last typed command).\nNote that for safety, \"test.md\" must already exist (scripthaus add will not create a new file).  If you need to\ncreate a new file, just `touch ./test.md` before running \"scripthaus add\".  You can also use \"^\" and \".\" to add\nto your global or project md files.\n\n```bash\nscripthaus add -t bash ./test.md::useful-command -m \"optional command description\" -c \"!!\"\nscripthaus add -t bash ^s3-upload -m \"upload files to my s3 bucket\" -c \"!!\"\n```\n\n## Showing Scripts and Playbooks\n\nTo list all the commands in a playbook run:\n\n```\nscripthaus show [playbook]\n```\n\nTo show the raw markdown for any command in a playbook (including the command text) run:\n\n```\nscripthaus show [playbook]::[script]\n```\n\n## Credits\n\nSpecial thanks to [Adam Bouhenguel @ajbouh](https://github.com/ajbouh) who had the initial idea of \nusing Markdown to write and document scripts that can be executed from the command-line.\nAdam also contributed the initial proof of concept code.\n\n## More Resources\n\nPlease report and bugs here in the GitHub issues tracker.\nFor more questions, please see the [FAQ](./FAQ.md).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscripthaus-dev%2Fscripthaus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscripthaus-dev%2Fscripthaus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscripthaus-dev%2Fscripthaus/lists"}