{"id":50944321,"url":"https://github.com/codecaine-zz/ollama_console_markdown_display","last_synced_at":"2026-06-17T18:07:54.883Z","repository":{"id":350963591,"uuid":"1208946816","full_name":"codecaine-zz/ollama_console_markdown_display","owner":"codecaine-zz","description":"Ollama Console Markdown Display","archived":false,"fork":false,"pushed_at":"2026-04-13T02:10:48.000Z","size":173,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-13T02:24:31.272Z","etag":null,"topics":["ai","ai-tools","bun","clipboard","copy","javascript","macos","markdown","ollama","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/codecaine-zz.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-13T00:10:57.000Z","updated_at":"2026-04-13T02:10:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/codecaine-zz/ollama_console_markdown_display","commit_stats":null,"previous_names":["codecaine-zz/ollama_console_markdown_display"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/codecaine-zz/ollama_console_markdown_display","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecaine-zz%2Follama_console_markdown_display","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecaine-zz%2Follama_console_markdown_display/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecaine-zz%2Follama_console_markdown_display/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecaine-zz%2Follama_console_markdown_display/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codecaine-zz","download_url":"https://codeload.github.com/codecaine-zz/ollama_console_markdown_display/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecaine-zz%2Follama_console_markdown_display/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34459804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"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":["ai","ai-tools","bun","clipboard","copy","javascript","macos","markdown","ollama","typescript"],"created_at":"2026-06-17T18:07:54.152Z","updated_at":"2026-06-17T18:07:54.869Z","avatar_url":"https://github.com/codecaine-zz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ollama Console Markdown Display\n\nChat with Ollama models in your terminal with beautifully rendered markdown output and clipboard-copyable code blocks. Powered by Bun v1.3.12's `Bun.markdown.ansi()` API.\n\n## Demo\n\n![Demo](demo.gif)\n\n## Requirements\n\n- macOS (ARM or Intel)\n- [Bun](https://bun.sh) v1.3.12+\n- [Ollama](https://ollama.ai) installed (started automatically if not running)\n\n## Usage\n\n### One-liner mode\n\n```bash\n# Basic question\nbun run index.ts \"explain closures in JavaScript\"\n\n# Specify a model\nbun run index.ts -m qwen3.5:4b \"write fizzbuzz in python\"\n\n# Save response to a file\nbun run index.ts -o response.md \"create a REST API in Node.js\"\n\n# Enable thinking/reasoning mode\nbun run index.ts -t \"why is the sky blue\"\n\n# Combine flags: custom model + thinking + save output\nbun run index.ts -m qwen3.5:27b -t -o answer.md \"explain monads\"\n```\n\n### Interactive chat mode\n\n```bash\n# Start chat with default model\nbun run index.ts\n\n# Start chat with a specific model\nbun run index.ts -m qwen3.5:27b\n\n# Start chat with thinking mode enabled\nbun run index.ts -t\n\n# Start chat with auto-save to file\nbun run index.ts -o session.md\n\n# Combine: specific model + thinking + output\nbun run index.ts -m qwen3.5:4b -t -o log.md\n```\n\n### Read a markdown file\n\n```bash\n# Auto-detect .md file\nbun run index.ts README.md\n\n# Explicit flag\nbun run index.ts -r notes.md\n```\n\n### Show help\n\n```bash\nbun run index.ts -h\n```\n\n### Options\n\n| Flag                  | Description                              |\n| --------------------- | ---------------------------------------- |\n| `-m, --model \u003cname\u003e`  | Model to use (default: `qwen3.5:latest`) |\n| `-o, --output \u003cfile\u003e` | Save response markdown to a file         |\n| `-r, --read \u003cfile\u003e`   | Render a markdown file in the terminal   |\n| `-t, --think`         | Enable thinking/reasoning mode           |\n| `-h, --help`          | Show help                                |\n\n### Chat commands\n\n| Command         | Action                            |\n| --------------- | --------------------------------- |\n| `\u003cn\u003e`           | Copy code block #n to clipboard   |\n| `all`           | Copy all code blocks to clipboard |\n| `save \u003cfile\u003e`   | Save last response to a file      |\n| `model \u003cname\u003e`  | Switch to a different model       |\n| `models`        | List available Ollama models      |\n| `think`         | Toggle thinking mode on/off       |\n| `think on/off`  | Set thinking mode explicitly      |\n| `exit` / `quit` | End the chat                      |\n\nAfter each response with code blocks, a copy prompt appears where you can type a block number, `all`, or press enter to continue chatting.\n\n## Install as a global command\n\nBun's `--compile` flag produces unsigned ARM64 binaries that macOS kills on Apple Silicon. Use a shell wrapper instead:\n\n```bash\n# Make the wrapper script executable and link it into your PATH\nchmod +x ollama-chat.sh\nsudo ln -sf \"$(pwd)/ollama-chat.sh\" /usr/local/bin/ollama-chat\n```\n\nNow you can use it from anywhere:\n\n```bash\nollama-chat \"explain closures in JavaScript\"\nollama-chat -m qwen3.5:27b -t \"why is the sky blue\"\nollama-chat README.md\n```\n\n## Features\n\n- **Streaming** — tokens appear in real-time, then get replaced with formatted markdown\n- **Rendered markdown** — headings, lists, bold, italic, code blocks with language labels\n- **Read .md files** — render any markdown file in the terminal with syntax coloring\n- **Code block clipboard** — numbered code blocks with `copy \u003cn\u003e` to pbcopy\n- **Save output** — save responses to markdown files with `-o` flag or `save` command\n- **Model switching** — switch models mid-chat with `model \u003cname\u003e`, list with `models`\n- **Thinking mode** — enable chain-of-thought reasoning with `-t` flag or `think` command\n- **Conversation memory** — chat mode maintains full message history\n- **Automatic Ollama startup** — detects if Ollama is running and starts it automatically if needed\n\n## Automatic Ollama Startup\n\nThe main function includes an enhanced Ollama startup process that handles server availability automatically:\n\n1. **Detection** — on launch, the app checks if Ollama is already running by pinging `http://localhost:11434/api/tags`\n2. **Auto-start** — if Ollama is not running, it spawns `ollama serve` in the background and waits up to 15 seconds for it to become ready\n3. **Error handling** — if Ollama fails to start (e.g. not installed), an error message is displayed with a link to the installation page at https://ollama.ai\n4. **Graceful cleanup** — signal handlers (`SIGINT`, `SIGTERM`, `exit`) ensure the spawned Ollama process is stopped when the app exits\n\nNo manual server management is required — just run the app and it takes care of the rest.\n\n## Note on compiled binaries\n\nBun's `--compile` flag currently produces unsigned ARM64 binaries that macOS kills on Apple Silicon. Use the shell wrapper install method above instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecaine-zz%2Follama_console_markdown_display","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecaine-zz%2Follama_console_markdown_display","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecaine-zz%2Follama_console_markdown_display/lists"}