{"id":47639530,"url":"https://github.com/shuymn/capsule","last_synced_at":"2026-06-06T03:01:12.595Z","repository":{"id":345799434,"uuid":"1187001928","full_name":"shuymn/capsule","owner":"shuymn","description":"Daemon-backed Rust prompt engine for zsh with async updates and hot-reloadable modules.","archived":false,"fork":false,"pushed_at":"2026-05-31T17:46:36.000Z","size":887,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-31T19:22:34.777Z","etag":null,"topics":["async","daemon","linux","macos","prompt-engine","rust","shell-prompt","toml","zsh"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/shuymn.png","metadata":{"files":{"readme":"README.ja.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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-20T08:22:40.000Z","updated_at":"2026-05-31T17:46:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"13297e7e-db00-4a83-b19b-a0ebf0bd6c3f","html_url":"https://github.com/shuymn/capsule","commit_stats":null,"previous_names":["shuymn/capsule"],"tags_count":3,"template":false,"template_full_name":"shuymn/rust-template","purl":"pkg:github/shuymn/capsule","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuymn%2Fcapsule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuymn%2Fcapsule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuymn%2Fcapsule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuymn%2Fcapsule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shuymn","download_url":"https://codeload.github.com/shuymn/capsule/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuymn%2Fcapsule/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33967641,"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-06T02:00:07.033Z","response_time":107,"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":["async","daemon","linux","macos","prompt-engine","rust","shell-prompt","toml","zsh"],"created_at":"2026-04-02T00:42:15.546Z","updated_at":"2026-06-06T03:01:12.590Z","avatar_url":"https://github.com/shuymn.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# capsule\n\n`capsule` は Rust 実装の `zsh` 用プロンプトエンジンです。macOS と Linux で動作します。\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/vhs/readme-prompt.gif\" alt=\"capsule プロンプトデモ\"\u003e\n\u003c/p\u003e\n\n常駐デーモンがレンダリング・キャッシュ・低速モジュールの非同期更新を担います。`zsh` はコプロセス経由でプロンプトリクエストを中継するため、プロンプトは即座に表示され、バックグラウンド処理が完了すると非同期で更新されます。\n\n## プロンプト\n\n```\n\u003cdirectory\u003e on \u003cgit branch\u003e [indicators] via \u003ctoolchain\u003e took \u003cduration\u003e\nat \u003ctime\u003e ❯\n```\n\n**1行目:** ディレクトリ、git ステータス、カスタムモジュール、コマンド実行時間。ツールチェインセグメント（`via \u003ctoolchain\u003e` の部分）は組み込み実装を持たず、ユーザー定義の `[[module]]` エントリによってのみ提供されます。\n\n**2行目:** 時刻（デフォルト無効）、プロンプト文字 `❯` / `❮`（vim コマンドモード）。文字は成功時に緑、失敗時に赤になります。\n\n1行目はターミナル幅を超える場合、まずディレクトリを短縮し、次に末尾のセグメントを省略します。\n\n## インストール\n\n要件: macOS または Linux、`zsh`。\n\n```bash\n# 1. バイナリのインストール\nbrew install shuymn/tap/capsule\n\n# 2. システムサービスマネージャへの登録（推奨）\ncapsule daemon install   # macOS: launchd  |  Linux: systemd --user\n\n# 3. .zshrc へ追記\neval \"$(capsule init zsh)\"\n```\n\ntoolchainモジュールを用意するには、`capsule preset` を実行してその出力を設定ファイルに貼り付けます。\n\n## 設定\n\n設定ファイルは最初に存在するパスから読み込まれます:\n\n1. `$XDG_CONFIG_HOME/capsule/config.toml`\n2. `~/.config/capsule/config.toml`\n3. `~/.capsule/config.toml`\n\n変更は次回のレンダリング時に自動的に反映されます。\n\n### 組み込みモジュール\n\n```toml\n[character]\nglyph = \"❯\"\nsuccess_style = { fg = \"green\", bold = true }\nerror_style = { fg = \"red\", bold = true }\n\n[character.vicmd]           # vim コマンドモードの上書き\nglyph = \"❮\"\n# style = { fg = \"yellow\" }\n\n[directory]\nstyle = { fg = \"cyan\", bold = true }\n# read_only_style = { fg = \"red\" }\n\n[git]\nicon = \"\\u{f418}\"\nconnector = \"on\"\nstyle = { fg = \"magenta\", bold = true }\nindicator_style = { fg = \"red\", bold = true }\n# detached_hash_style = { fg = \"green\", bold = true }\n# state_style = { fg = \"yellow\", bold = true }\n\n[time]\ndisabled = true             # 有効にするには false を設定\nformat = \"HH:MM:SS\"         # または \"HH:MM\"\nconnector = \"at\"\nstyle = { fg = \"yellow\", bold = true }\n\n[cmd_duration]\nthreshold_ms = 2000\nconnector = \"took\"\nstyle = { fg = \"yellow\", bold = true }\n```\n\n### コネクタとタイムアウト\n\n```toml\n[connectors]\n# style = {}\n\n[timeout]\nfast_ms = 500       # 環境変数/ファイルソース\nslow_ms = 5000      # コマンド、git\n```\n\n### スタイル構文\n\n| キー     | 型    | 説明                 |\n|----------|-------|----------------------|\n| `fg`     | color | 前景色               |\n| `bold`   | bool  | 太字                 |\n| `dimmed` | bool  | 薄暗く（faint）表示  |\n\n色: `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `bright_black`。\n\n`[color_map]` で ANSI コードを上書き（classic 30〜37 およびbright 90〜97）:\n\n```toml\n[color_map]\ngreen = 32\ncyan = 36\n```\n\n### カスタムモジュール\n\n```toml\n[[module]]\nname = \"rust\"\nwhen.files = [\"Cargo.toml\"]\nformat = \"v{version}\"\nicon = \"🦀\"\nconnector = \"via\"\nstyle = { fg = \"red\" }\n\n# ソースが複数ある場合は、非同期で解決して最初に成功した結果が使われます。\n[[module.source]]\nname = \"version\"\nenv = \"RUST_VERSION\"\n\n[[module.source]]\nname = \"version\"\ncommand = [\"rustc\", \"--version\"]\nregex = 'rustc ([\\d.]+)'\n```\n\n環境変数/ファイルソースはインラインで評価されます。コマンドソースはバックグラウンドで実行され、プロンプトを非同期で更新します。\n\n#### フォーマット文字列構文\n\n| 構文     | 意味 |\n|----------|------|\n| `{name}` | 変数プレースホルダ。未解決の場合はモジュール全体が非表示 |\n| `[…]`    | オプションセクション。内部の変数が未解決の場合は省略 |\n| `{{`     | リテラル `{` |\n| `[[`     | リテラル `[` |\n\n```toml\nformat = \"{profile}[ ({region})]\"   # region が未解決の場合は省略\n```\n\n#### グルーピング\n\n同じディレクトリで複数のモジュールが適用可能な場合、グループ内で最も低い `priority` を持つモジュールのみがレンダリングされます:\n\n```toml\narbitration = { group = \"runtime\", priority = 10 }\n```\n\n`arbitration` を持たないモジュールは常にレンダリングされます。\n\n## CLI\n\n```\ncapsule daemon              デーモンの起動\ncapsule daemon install      サービスの登録（macOS: launchd、Linux: systemd）\ncapsule daemon uninstall    サービスの削除\ncapsule connect             Coprocess リレー（init スクリプトが使用）\ncapsule init zsh            シェル統合スクリプトの出力\ncapsule preset              組み込みモジュール定義を TOML として出力\n```\n\n## リポジトリ構成\n\n- `crates/cli`: CLI エントリポイントと統合テスト\n- `crates/core`: デーモン、プロンプトモジュール、レンダリング、設定\n- `crates/prompt-bench`: ベンチマークハーネス\n- `crates/protocol`: wireプロトコルとメッセージコーデック\n- `crates/sys`: プラットフォーム固有の FFI（macOS: launchd、Linux: systemd socketの有効化）\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuymn%2Fcapsule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshuymn%2Fcapsule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuymn%2Fcapsule/lists"}