Getting Started

bearkit is a companion CLI for Bear notes — orphan/duplicate/dangling-wikilink reports, a Markdown linter, a literal find-and-replace across notes, and a random-note opener. It’s a from-scratch Go rewrite of the original Python bearkit, built for single-binary, zero-runtime-dependency distribution.

Installation

No packaged releases yet — build from source:

git clone https://github.com/i-am-fran/bearkit.git
cd bearkit
go build -o bearkit ./cmd/bearkit
mv bearkit /usr/local/bin/   # or anywhere on your PATH

Requires Go 1.23+ to build. Requires Bear 2.8+ and its bundled bearcli binary at runtime.

Quick Start

bearkit orphans
bearkit duplicates
bearkit wikilinks
bearkit lint -t work -n
bearkit replace --find "old text" --replace "new text"
bearkit random 4 -t evergreen

Interactive Mode

Run bearkit with no arguments, or any command with no flags, in a terminal to be walked through the options interactively. Passing any flag runs non-interactively — the mode that makes sense for scripts, cron jobs, and launchd agents.


Guides

Tag Scoping

Every command accepts -t/--tag <tagName> to scope it to a tag and its nested children — -t people also matches #people/authors.

lint, wikilinks, and replace additionally accept -i/--id <noteID> to scope to a single note by ID instead of a tag or vault-wide scan. -i is mutually exclusive with -t, and skips the confirmation prompt since you’ve already picked the exact note.

bearkit lint -t work
bearkit wikilinks -i 6F98051A-0000-1111-2222-9444C3615B10

Don’t know a note’s ID? Get one with bearcli:

bearcli list --fields id,title
bearcli search "my note" --fields id,title

Dry-Run & Confirmation

Edit actions — lint, replace, and wikilinks --mark — change your notes, so they ask for confirmation before writing anything back, unless run with -y/--yes (handy for cron/launchd agents).

-n/--dry-run previews the change as a unified diff per note, without writing anything back to Bear or creating a summary note.

bearkit lint -t work -n
bearkit replace --find "old text" --replace "new text" -y

Reports in Bear

List actions (orphans, duplicates, wikilinks) never change your notes — they save their report as a new Bear note tagged #bearkit/lists.

Edit actions (lint, replace, wikilinks --mark) save a summary of what changed as a note tagged #bearkit/edits, unless run with --dry-run (nothing changed, so nothing to summarize).

Both tags are excluded from every scan bearkit runs, so past reports never show up as orphans, duplicates, or lint/wikilink/replace findings themselves.

--group-by-tag reorganizes either kind of summary note by Bear tag instead of a flat list: each tag gets an H2 heading, each note under it an H3. Available on orphans, wikilinks, lint, and replace.


Command Reference

Full flag reference for every subcommand, ported from bearkit --help.

orphans

List notes with no incoming [[wikilinks]]. Never changes your notes; saves its report as a note tagged #bearkit/lists.

bearkit orphans
bearkit orphans -t work

Flags: -t/--tag, --group-by-tag.

duplicates

List notes that share the same title.

bearkit duplicates

Flags: -t/--tag.

List [[wikilinks]] whose target note doesn’t exist.

bearkit wikilinks
bearkit wikilinks -i 6F98051A-0000-1111-2222-9444C3615B10

--mark additionally marks each dangling wikilink in the note itself by appending ` + — e.g. [[Wikilink]] becomes [[Wikilink +]]. Marks are self-healing: once the target note exists, the +` is stripped back off on the next run. Targets with a likely typo suggestion are left unmarked.

bearkit wikilinks --mark
bearkit wikilinks --mark -t evergreen -y

Flags: -t/--tag, -i/--id, --mark, --group-by-tag; with --mark: -n/--dry-run, -y/--yes.

lint

Lint all notes, or notes matching -t. Auto-fixes what it can and flags the rest for manual attention.

bearkit lint
bearkit lint -t work -n
bearkit lint -i 6F98051A-0000-1111-2222-9444C3615B10

Flags: -t/--tag, -i/--id, --group-by-tag, -n/--dry-run, -y/--yes.

replace

Replace every literal occurrence of --find <text> with --replace <text>, across all notes or notes matching -t. Case-sensitive, no regex.

bearkit replace --find "old text" --replace "new text"
bearkit replace --find "old text" --replace "" -y
bearkit replace --find "old text" --replace "new text" -i 6F98051A-0000-1111-2222-9444C3615B10

--replace may be empty, to delete the found text outright.

Flags: -t/--tag, -i/--id, --group-by-tag, -n/--dry-run, -y/--yes.

random

Open one or more random notes in Bear (1-9, default 1). Never creates a summary note.

bearkit random
bearkit random 4 -t evergreen

Flags: -t/--tag.

Global Flags

Flag Description Available on
-t, --tag <tagName> Scope to notes tagged <tagName> (and its nested tags, e.g. -t people also matches #people/authors) every command
-i, --id <noteID> Scope to a single note by ID instead of a tag/vault-wide scan. Mutually exclusive with -t. Skips the confirmation prompt. lint, wikilinks, replace
--group-by-tag Reorganize the summary note by Bear tag instead of a flat list orphans, wikilinks, lint, replace
-n, --dry-run Preview an edit as a unified diff per note, without writing anything lint, wikilinks --mark, replace
-y, --yes Skip the confirmation prompt (cron/launchd-friendly) lint, wikilinks --mark, replace