From 4946760612bd672e0aa62ed61eeb6ddfbc7f1dde Mon Sep 17 00:00:00 2001 From: Serhii Vasylenko Date: Thu, 30 Apr 2026 02:10:14 +0200 Subject: [PATCH 1/2] Fix tag decoding TypeScript function location in SPECIFICATION.md The spec referenced `tags.ts` as the location of the `decodeTagName()` TypeScript function, but it was extracted to `bear-encoding.ts` during a refactor. The in-code comment in `notes.ts` already points to the correct location: `operations/bear-encoding.ts`. --- docs/dev/SPECIFICATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev/SPECIFICATION.md b/docs/dev/SPECIFICATION.md index d887399..ef90fa3 100644 --- a/docs/dev/SPECIFICATION.md +++ b/docs/dev/SPECIFICATION.md @@ -62,7 +62,7 @@ There is no delete tool. Too destructive for AI-assisted workflows — a misiden Bear uses Core Data with SQLite. The schema is undocumented — our understanding comes from reverse-engineering (see `BEAR_DATABASE_SCHEMA.md`). The database path is hardcoded to Bear's app group container at `~/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite` (overridable via `BEAR_DB_PATH` env var for tests). Key fragility points: -- Tag name decoding logic exists in two places (SQL expression in `notes.ts` and TypeScript function in `tags.ts`) — these must produce identical results. Bidirectional comments link them. +- Tag name decoding logic exists in two places (SQL expression in `notes.ts` and TypeScript function in `bear-encoding.ts`) — these must produce identical results. Bidirectional comments link them. - Tag hierarchy is not stored relationally — it's reconstructed at query time by splitting slash-delimited paths. - All queries exclude trashed, archived, and encrypted notes to match what Bear's UI shows. From 7ed6ac12c10d0dd622a200d604aae217da5d348c Mon Sep 17 00:00:00 2001 From: Serhii Vasylenko Date: Thu, 30 Apr 2026 02:11:19 +0200 Subject: [PATCH 2/2] Update src/ project structure tree in CLAUDE.md The source tree was refactored into layered subdirectories (infra/, operations/, tools/) but the Project Structure section still showed the old flat layout. Also removes the no-longer-existing utils.ts entry and adds the new logging.ts, bear-encoding.ts, and tools/ entries. --- CLAUDE.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 432419d..a68d274 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -32,16 +32,24 @@ You are world-class NodeJS developer, senior engineer with a vast experience in ## Project Structure ``` ├── src/ # MCP server source code -│ ├── main.ts # Server entry point and tool registration -│ ├── bear-urls.ts # Bear app URL scheme handlers -│ ├── database.ts # SQLite database connection -│ ├── notes.ts # Note operations (search, content) -│ ├── tags.ts # Tag operations (list, hierarchy) -│ ├── note-conventions.ts # Tag placement conventions for new notes +│ ├── main.ts # Server entry point │ ├── config.ts # Configuration management +│ ├── logging.ts # Logging setup │ ├── types.ts # Type definitions -│ ├── utils.ts # Shared utilities -│ └── *.test.ts # Unit tests (co-located with source files) +│ ├── infra/ # Infrastructure layer +│ │ ├── bear-urls.ts # Bear app URL scheme handlers +│ │ ├── database.ts # SQLite database connection +│ │ └── *.test.ts # Unit tests (co-located with source files) +│ ├── operations/ # Business logic layer +│ │ ├── bear-encoding.ts # Bear encoding/decoding utilities +│ │ ├── notes.ts # Note operations (search, content) +│ │ ├── note-conventions.ts # Tag placement conventions for new notes +│ │ ├── tags.ts # Tag operations (list, hierarchy) +│ │ └── *.test.ts # Unit tests (co-located with source files) +│ └── tools/ # MCP tool handlers +│ ├── note-tools.ts # Note tool registrations and handlers +│ ├── tag-tools.ts # Tag tool registrations and handlers +│ └── responses.ts # Tool response helpers ├── tests/ │ ├── fixtures/ # Test fixtures (sample notes, images) │ └── system/ # System tests (require Bear app running)