{"id":21509786,"url":"https://github.com/rynkowsg/sosh","last_synced_at":"2026-05-09T14:15:59.164Z","repository":{"id":225519328,"uuid":"765992204","full_name":"rynkowsg/sosh","owner":"rynkowsg","description":"Dependency resolver and bundler for shell scripts","archived":false,"fork":false,"pushed_at":"2024-04-07T02:58:15.000Z","size":97,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-09T03:47:50.820Z","etag":null,"topics":["bash","bundler","dependency-resolver","shell"],"latest_commit_sha":null,"homepage":"","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/rynkowsg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-03-02T03:35:50.000Z","updated_at":"2024-04-02T14:51:26.000Z","dependencies_parsed_at":"2024-04-06T19:31:37.870Z","dependency_job_id":"b2614a52-e4f3-4d66-a28e-b2b002384141","html_url":"https://github.com/rynkowsg/sosh","commit_stats":null,"previous_names":["rynkowsg/shellpack","rynkowsg/sosh"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rynkowsg%2Fsosh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rynkowsg%2Fsosh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rynkowsg%2Fsosh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rynkowsg%2Fsosh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rynkowsg","download_url":"https://codeload.github.com/rynkowsg/sosh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056431,"owners_count":20390720,"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","bundler","dependency-resolver","shell"],"created_at":"2024-11-23T21:31:41.863Z","updated_at":"2026-05-09T14:15:59.121Z","avatar_url":"https://github.com/rynkowsg.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sosh\n\n\n[![CircleCI Build Status][ci-build-badge]][ci-build]\n[![License][license-badge]][license]\n\n_**so**urce **.sh**_ to the rescue!\n\nLeverage `source` to fetch remote shell scripts and optionally bundle them into one file.\n\nStatus: **ALPHA**\n\n## Briefly\n\nsosh a shell tool that uses `source` declaration in shell scripts to fetch remote scripts and/or bundle them into one file.\n\nExample: let's assume you need some color definitions and functions to serialize arrays in a Bash script. You can take them adding following `source` declaration:\n```bash\nsource \"${ROOT_DIR}/.github_deps/rynkowsg/shell-gr@v0.2.2/lib/color.bash\"\nsource \"${ROOT_DIR}/.https_deps/gist.githubusercontent.com/TekWizely/c0259f25e18f2368c4a577495cd566cd/raw/b9e87c74565fb90a39bb7a1033f950773201dbf7/serialize_array.bash\"\n```\nIf you call `sosh fetch` on the script, sosh will get these files for you.\n\nIf you like to bundle the script into one file, you can use `sosh pack` and sosh will save the bundled file to expected location.\n\nThat's that simple.\n\n## Motivation\n\nSo, it all started when I was trying to share code between CircleCI orbs and their commands.\nThe thing is, orbs only let you use one bash script per command.\nThat's a bummer because if your commands share similarities or worse, they are kind of the same just with different defaults, you end up copying and pasting the same stuff over and over.\n\nAfter a couple of days, it hit me that it'd be super handy to share not just bits\nand pieces between orb commands, but also with all the other bash scripts I had lying around.\nI'm talking about the stuff we use all the time, like logging, handling errors, and other goodies.\n\n## Install\n\n```sh\ncurl -s https://raw.githubusercontent.com/rynkowsg/sosh/v0.2.0/main/src/pl/rynkowski/sosh.cljc -o ~/.bin/sosh\nchmod +x ~/.bin/sosh\n```\nThe line above installs the script in `~/.bin`. That installation directory needs to be added to `PATH`.\n\n\u003e [!WARNING]\n\u003e The tool requires [Babashka](https://github.com/babashka/babashka) to work. If you like to see this a standalone binary rise your voice [HERE](https://github.com/rynkowsg/sosh/issues/1).\n\n## Usage\n\n**FETCH**\n\n```sh\nsosh fetch ./test/res/test_suite/4_import_remote/entry.bash\n```\n\n**PACK**\n\n```sh\n# pack the script on input to the path on output\nsosh pack -i ./test/res/test_suite/3_import_with_variables/entry.bash -o ./bundled.bash\n\n# optionally you can set current working directory (useful if the entry script doesn't use absolute path for sourced files)\nsosh pack -i ./entry.bash -o ./bundled.bash\n```\n\n## What's there\n\n**Features**\n- recursive dependency resolution (your script requires A, A requires B, B requires C)\n- command to bundle script and sourced deps, either local or remote, into one file\n- option to ignore `source` line if contains `# sosh: skip` at the end\n- support for BATS files[^bats-disclaimer]\n\nSome aspects are better explained in [CHANGELOG](https://github.com/rynkowsg/sosh/blob/main/CHANGELOG.md#010-2024-03-15) notes to version 0.1.0.\n\n[^bats-disclaimer]: But script paths need to consider they can be called not only by bats, but also by Bash ([example](https://github.com/rynkowsg/sosh/blob/63d85c5/test/res/test_suite/7_bats_import/entry.bats#L6)).\n\n**Examples**\n\nI use this tools in my own repos:\n- [rynkowsg/asdf-orb] - CircleCI orb providing asdf ()\n- [rynkowsg/checkout-orb] - CircleCI orb providing advanced checkout\n- [rynkowsg/shell-gr]- my library of bash snippets ([lib examples](https://github.com/rynkowsg/shell-gr/blob/main/lib/))\n\nExamples:\n- source remote scripts from github:\n  - [install_asdf.bash](https://github.com/rynkowsg/asdf-orb/blob/main/src/scripts/install_asdf.bash) - script behind [rynkowsg/asdf-orb]\n  - [clone_git_repo.bash](https://github.com/rynkowsg/checkout-orb/blob/main/src/scripts/clone_git_repo.bash) - script behind [rynkowsg/checkout-orb]\n- source remote scripts by URL:\n  - [bats_assert.bash](https://github.com/rynkowsg/shell-gr/blob/dev/lib/bats_assert.bash) - wrapper for bats_assert to fetch all necessary files at once\n- path initialization in a remote script that requires yet another scripts[^re-path-initialization]:\n  - [error.bash](https://github.com/rynkowsg/shell-gr/blob/dev/lib/error.bash#L5)\n  - most of the files in [shell-gr repository](https://github.com/rynkowsg/shell-gr/tree/dev/lib)\n\n[^re-path-initialization]: Path initialization can be complicated, especially when writing bits sourcing other bits.\n\n[rynkowsg/asdf-orb]: https://github.com/rynkowsg/asdf-orb\n[rynkowsg/checkout-orb]: https://github.com/rynkowsg/checkout-orb\n[rynkowsg/shell-gr]: https://github.com/rynkowsg/shell-gr\n\n## License\n\nCopyright © 2024 Greg Rynkowski\n\nReleased under the [MIT license][license].\n\n[ci-build-badge]: https://circleci.com/gh/rynkowsg/sosh.svg?style=shield \"CircleCI Build Status\"\n[ci-build]: https://circleci.com/gh/rynkowsg/sosh\n[license-badge]: https://img.shields.io/badge/license-MIT-lightgrey.svg\n[license]: https://raw.githubusercontent.com/rynkowsg/sosh/main/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frynkowsg%2Fsosh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frynkowsg%2Fsosh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frynkowsg%2Fsosh/lists"}