{ "name": "mods", "version": "1.8.1", "summary": "mods: asks a large language model from the command line and in pipelines (OpenAI-compatible APIs, Anthropic, Google, Cohere, Azure; the user's own key) (static Go)", "category": "tool", "license": "MIT", "homepage": "https://github.com/charmbracelet/mods", "source": { "url": "https://proxy.golang.org/github.com/charmbracelet/mods/@v/v1.8.1.zip", "sha256": "ada31c32dd1e231c82de2caa405fce137668bd6c7bae918185e7b192a3195f0f" }, "watch": {"kind": "index", "url": "https://proxy.golang.org/github.com/charmbracelet/mods/@v/list", "regex": "(?m)^v([0-9]+\\.[0-9]+\\.[0-9]+)$", "revendor": {"tool": "go", "args": ["."]}}, "vendor": "vendor.txt", "deps": [], "env_packages": [], "static": true, "nss": false, "check": "bin/mods --version | has -x 'mods version v1.8.1' && elf=$(readelf -l bin/mods) && [ -n \"$elf\" ] && ! printf '%s\\n' \"$elf\" | has 'program interpreter' && t=$(mktemp -d) && printf '%s\\n' 'import http.server, json, sys' 'class H(http.server.BaseHTTPRequestHandler):' ' def do_POST(self):' ' req = json.loads(self.rfile.read(int(self.headers[\"Content-Length\"])))' ' head = [self.path, self.headers.get(\"Authorization\"), req[\"model\"]]' ' open(sys.argv[2], \"w\").write(\"\\n\".join(head + [m[\"role\"] + \": \" + m[\"content\"] for m in req[\"messages\"]]) + \"\\n\")' ' self.send_response(200)' ' self.send_header(\"Content-Type\", \"text/event-stream\")' ' self.end_headers()' ' for delta, fin in (({\"role\": \"assistant\", \"content\": \"BVS \"}, None), ({\"content\": \"answer\"}, None), ({}, \"stop\")):' ' c = {\"id\": \"c1\", \"object\": \"chat.completion.chunk\", \"created\": 1, \"model\": \"bvs\", \"choices\": [{\"index\": 0, \"delta\": delta, \"finish_reason\": fin}]}' ' self.wfile.write(b\"data: \" + json.dumps(c).encode() + b\"\\n\\n\")' ' self.wfile.write(b\"data: [DONE]\\n\\n\")' ' def log_message(self, *a):' ' pass' 'http.server.HTTPServer((\"127.0.0.1\", int(sys.argv[1])), H).serve_forever()' > \"$t/openai.py\" && P=$(free_port) && { python3 \"$t/openai.py\" \"$P\" \"$t/req\" < /dev/null & echo $! > \"$t/pid\"; } && wait_port \"$P\" && mkdir -p \"$t/cfg/mods\" && printf 'default-api: local\\ndefault-model: bvs\\napis:\\n local:\\n base-url: http://127.0.0.1:%s/v1\\n api-key: bvs-key\\n models:\\n bvs:\\n max-input-chars: 4000\\n' \"$P\" > \"$t/cfg/mods/mods.yml\" && export HOME=$t XDG_CONFIG_HOME=$t/cfg XDG_DATA_HOME=$t/data XDG_CACHE_HOME=$t/cache && timeout -s KILL 60 bin/mods 'bvs question' < /dev/null > \"$t/out\" 2> \"$t/err\" && has 'BVS answer' < \"$t/out\" && has -x /v1/chat/completions < \"$t/req\" && has -x 'Bearer bvs-key' < \"$t/req\" && has -x bvs < \"$t/req\" && has -x 'user: bvs question' < \"$t/req\" && timeout -s KILL 30 bin/mods --list < /dev/null > \"$t/list\" 2>> \"$t/err\" && has 'bvs question' < \"$t/list\" && timeout -s KILL 60 bin/mods --continue-last 'second question' < /dev/null > \"$t/out2\" 2>> \"$t/err\" && has 'BVS answer' < \"$t/out2\" && has -x 'user: bvs question' < \"$t/req\" && has -x 'assistant: BVS answer' < \"$t/req\" && has -x 'user: second question' < \"$t/req\" && echo \"mods 1.8.1: a question answered in a stream by a stand-in OpenAI-compatible API on port $P with the configured key, the conversation saved in its database, listed, and continued with its first question and answer sent again\"; r=$?; [ $r = 0 ] || cat \"$t/err\" >&2; [ -f \"$t/pid\" ] && kill \"$(cat \"$t/pid\")\" 2>/dev/null; exit $r" }