{"id":49277733,"url":"https://github.com/birsax2/bear-rs","last_synced_at":"2026-04-25T17:01:57.866Z","repository":{"id":351989352,"uuid":"1213350740","full_name":"BIRSAx2/bear-rs","owner":"BIRSAx2","description":"Rust library for reading and writing Bear notes directly via the local SQLite database.","archived":false,"fork":false,"pushed_at":"2026-04-25T10:56:00.000Z","size":212,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-25T12:25:30.315Z","etag":null,"topics":["bear","cli","macos","markdown","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/bear-rs","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/BIRSAx2.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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-17T09:36:50.000Z","updated_at":"2026-04-25T10:56:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/BIRSAx2/bear-rs","commit_stats":null,"previous_names":["birsax2/bear-cli","birsax2/bear-rs"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/BIRSAx2/bear-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIRSAx2%2Fbear-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIRSAx2%2Fbear-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIRSAx2%2Fbear-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIRSAx2%2Fbear-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BIRSAx2","download_url":"https://codeload.github.com/BIRSAx2/bear-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BIRSAx2%2Fbear-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32269463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bear","cli","macos","markdown","rust"],"created_at":"2026-04-25T17:01:56.006Z","updated_at":"2026-04-25T17:01:57.861Z","avatar_url":"https://github.com/BIRSAx2.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bear-rs\n\nRust library for reading and writing [Bear](https://bear.app) notes directly via the local SQLite database.\n\nNo network, no CloudKit, no Bear.app process required. Works while Bear is running or closed.\n\n## Requirements\n\n- macOS\n- Bear installed (the database lives in Bear's app group container)\n\n## Installation\n\n```toml\n[dependencies]\nbear-rs = \"0.2\"\n```\n\nTo also get the `bear` CLI and MCP server:\n\n```toml\n[dependencies]\nbear-rs = { version = \"0.2\", features = [\"cli\"] }\n```\n\nOr install the binary directly:\n\n```sh\ncargo install bear-rs --features cli\n```\n\n## Usage\n\n```rust\nuse bear_rs::{SqliteStore, store::ListInput};\n\n// Read\nlet store = SqliteStore::open_ro()?;\nlet notes = store.list_notes(\u0026ListInput::default())?;\nlet note = store.get_note(Some(\"7E635AD3-...\"), None, true, true)?;\n\n// Write\nlet store = SqliteStore::open_rw()?;\nlet note = store.create_note(\"# My Note\\n\\nHello world\", \u0026[\"work\", \"rust\"], false)?;\nstore.append_to_note(Some(\u0026note.id), None, \"more text\", Default::default(), true, Default::default())?;\nstore.trash_note(Some(\u0026note.id), None)?;\n```\n\nAfter any write, `bear-rs` posts the Darwin notification `net.shinyfrog.bear.cli.didRequestRefresh` so Bear's UI refreshes automatically.\n\n## API\n\n### `SqliteStore`\n\nOpen with `SqliteStore::open_ro()` for reads or `SqliteStore::open_rw()` for writes.\n\n**Reading**\n\n| Method | Description |\n|---|---|\n| `list_notes(input)` | List notes with optional tag filter, sort, and limit |\n| `get_note(id, title, attachments, pins)` | Fetch a single note by ID or title |\n| `cat_note(id, title, offset, limit)` | Raw note text with optional pagination |\n| `search_notes(query, limit)` | Bear search syntax (`@todo`, `#tag`, `-negation`, etc.) |\n| `search_in_note(id, title, string, ignore_case)` | Line matches within a single note |\n| `list_tags(id, title)` | All tags, or tags for one note |\n| `list_pins(id, title)` | Pin contexts for one or all notes |\n| `list_attachments(id, title)` | Attachments for a note |\n| `read_attachment(id, title, filename)` | Raw attachment bytes |\n\n**Writing**\n\n| Method | Description |\n|---|---|\n| `create_note(text, tags, if_not_exists)` | Create a note; title extracted from first line |\n| `append_to_note(id, title, content, position, update_modified, tag_position)` | Append or prepend text |\n| `write_note(id, title, content, base_hash)` | Overwrite note content; optional hash guard |\n| `edit_note(id, title, ops)` | Find/replace operations |\n| `trash_note(id, title)` | Move to trash |\n| `archive_note(id, title)` | Archive |\n| `restore_note(id, title)` | Restore from trash or archive |\n| `add_tags(id, title, tags)` | Add tags |\n| `remove_tags(id, title, tags)` | Remove tags |\n| `rename_tag(old, new, force)` | Rename tag across all notes |\n| `delete_tag(name)` | Delete tag and remove from all notes |\n| `add_pins(id, title, contexts)` | Pin in contexts (`\"global\"` or tag name) |\n| `remove_pins(id, title, contexts)` | Unpin |\n| `add_attachment(id, title, filename, data)` | Attach a file |\n| `delete_attachment(id, title, filename)` | Mark attachment unused |\n\n### Search syntax\n\n`search_notes` accepts Bear's query syntax:\n\n```\n@today             modified today\n@yesterday         modified yesterday\n@lastNdays         modified in last N days\n@date(YYYY-MM-DD)  modified on a specific date\n@todo              has incomplete todos\n@done              has completed todos\n@pinned            pinned notes\n@tagged            has at least one tag\n@untagged          has no tags\n@images            has images\n@files             has files\n@code              has code blocks\n@locked            locked notes\n#tag               has tag\n-word              does not contain word\n\"exact phrase\"     exact phrase match\n```\n\n### Export\n\n```rust\nuse bear_rs::export::{ExportNote, export_notes};\n\nlet notes: Vec\u003cExportNote\u003e = store.list_notes(\u0026Default::default())?\n    .into_iter()\n    .map(Into::into)\n    .collect();\n\nexport_notes(\"./output\".as_ref(), \u0026notes, true, true)?;\n```\n\n## CLI and MCP server\n\nEnable the `cli` feature to build the `bear` binary and access the MCP server:\n\n```sh\ncargo install bear-rs --features cli\n```\n\n```\nbear list\nbear list --tag work --sort modified:desc --format json\nbear show --title \"My Note\" --fields all,content\nbear search \"@today @todo\"\nbear create \"My Note\" --content \"Body\" --tags work\nbear append --title \"My Note\" --content \"More text\"\nbear write \u003cid\u003e --content \"# Title\\n\\nBody\"\nbear edit \u003cid\u003e --at \"old\" --replace \"new\"\nbear trash --title \"My Note\"\nbear archive \u003cid\u003e\nbear restore \u003cid\u003e\nbear tags list\nbear tags add \u003cid\u003e work\nbear tags rename old new\nbear pin add \u003cid\u003e global\nbear attachments list \u003cid\u003e\nbear mcp-server\n```\n\nThe MCP server speaks JSON-RPC 2.0 over stdin/stdout and exposes one tool per command. Configure it in Claude Desktop or any MCP-compatible client by pointing it at `bear mcp-server`.\n\n## Development\n\n```sh\ncargo build\ncargo test\ncargo clippy --all-targets -- -D warnings                    # library only\ncargo clippy --features cli --all-targets -- -D warnings     # with CLI\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbirsax2%2Fbear-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbirsax2%2Fbear-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbirsax2%2Fbear-rs/lists"}