8000 GitHub - moozzi/liki: TUI, local wiki for articles · GitHub
[go: up one dir, main page]

Skip to content
moozziPublic

About

TUI, local wiki for articles

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

Repository files navigation

liki logo

Your local link wiki. liki saves links to articles you want to remember, downloads their content and a full offline copy of each page, and lets you find them later by meaning, not just by exact tag or URL. Type enum postgres and you get every saved article about Postgres enums.

Everything stays on your machine: links, article text and page snapshots live in a single SQLite file, and search runs on a local embedding model.

Dependencies

  • Go 1.27.3 or newer to build liki.

  • Ollama with the bge-m3 embedding model, for search. It understands English and Polish (and many other languages), so a Polish query finds English articles. Everything except search works without it.

  • Google Chrome (or Chromium), optional. liki opens each page in headless Chrome before saving it, so content drawn by JavaScript is captured too. Without Chrome, pages are saved as the server sends them.

    brew install ollama
    brew services start ollama
    ollama pull bge-m3

Go libraries (fetched automatically by go build):

Library Used for
modernc.org/sqlite database, pure Go (no cgo), with FTS5 full-text search
codeberg.org/readeck/go-readability extracting readable article text from pages
golang.org/x/net/html building self-contained page snapshots
chromedp rendering pages in headless Chrome
Bubble Tea, Bubbles, Lip Gloss interactive mode and styling

Install

git clone <repo-url> liki
cd liki
go build -o liki .

Move the liki binary somewhere on your PATH, or use go install ..

Usage

liki works in two ways:

  • Interactive mode: run liki with no arguments. Type any text to search, or / to pick a command. Tab completes, ↑↓ browses history, ctrl+c cancels a running command or exits.
  • One-off commands: liki <command> ..., handy in scripts. In interactive mode the same commands are typed as /command.
$ liki

  █  ▀ █▄▀ ▀   your local link wiki
  █▄ █ █ █ █   47 links · 7 tags · last added 4h ago

> enum postgres
  ⎿  3 results
     #10  www.crunchydata.com/blog/enums-vs-check-constraints-in-postgres   meaning ━━━━━━━─── 0.67   words 2/2
     #9   www.postgresql.org/docs/current/datatype-enum.html                meaning ━━━━━━──── 0.60   words 1/2
     #12  en.wikipedia.org/wiki/PostgreSQL                                  meaning ━━━━────── 0.52   words 2/2

Commands

Command What it does
add <url> [-tags a,b] [-no-fetch] [-force] Save a link. Downloads the article text and an offline snapshot right away unless -no-fetch is given. Refuses a link that is already saved, even in another form (http/https, www., trailing /, #anchor, utm_* and other tracking parameters); -force saves it anyway.
search <words...> [-n 10] Find links by meaning and keywords in their tags, URL and article text. In interactive mode, just type the words.
related <id> [-n 10] Find links on similar topics, by comparing whole articles by meaning. Uses the stored index, so it is instant.
list [page] [-n 20] [-tags a,b] Show saved links, newest first, one page at a time. -tags keeps links with any of the tags.
show <id> [-html] Print the saved article text (or its cleaned-up HTML).
open <id> [-o file.html] Open the saved page, with its original styles and images, in the browser. Works offline. -o saves it to a file instead.
edit <id> [-url ...] [-tags a,b] Change a link. Only the given fields change; -tags replaces all tags, -tags '' clears them. Changing the URL drops the saved content.
rm <id> [<id>...] Remove links with their content.
fetch [-all] [<id>...] Download content for links missing it, the given links, or all of them with -all.
index [-all] Build the search index for links missing it, or rebuild it with -all. Usually not needed: liki indexes links when they are added, changed or searched.

Interactive mode also has /help, /clear and /exit (plain exit or quit work too).

Examples

# Save articles, with tags
liki add https://www.postgresql.org/docs/current/datatype-enum.html -tags postgres,sql
liki add https://go.dev/blog/maps -tags go

# Find them later without remembering URLs or tags
liki search enum postgres
liki search "how do maps work in go"
liki search typ wyliczeniowy w bazie danych   # Polish query, English articles
liki related 3               # more links on the topic of #3

# Browse
liki list                    # newest 20 links
liki list 2 -n 50            # second page of 50
liki list -tags go,postgres  # links tagged go or postgres

# Read
liki show 3                  # article text in the terminal
liki open 3                  # original page in the browser, offline

# Maintain
liki edit 3 -tags postgres,enum
liki rm 3 4
liki fetch                   # fetch content that failed before

How search works

Each article is split into pieces of about 1200 characters, and each piece is stored twice:

  • as an embedding vector from bge-m3, which matches by meaning ("enumerated type" finds "enum", a Polish query finds English text);
  • in an SQLite FTS5 full-text index, which matches exact words and names like pg_enum.

A search ranks links both ways and merges the two rankings (reciprocal rank fusion). Results show how well each link matched:

  • meaning: similarity of the best matching piece, 0 to 1. Links matching only by meaning below 0.45 are hidden as noise.
  • words: how many of the query words the link contains. A link needs at least half of them to count as a keyword match.

Searching compares stored vectors only; article text is never re-read at search time.

related averages the vectors of each link's pieces into one vector per link and compares those. Whole articles score higher than a short query does, so links below 0.6 are hidden there.

Configuration

Variable Default
LIKI_DB ~/.liki/liki.db database file
OLLAMA_HOST localhost:11434 Ollama server
LIKI_EMBED_MODEL bge-m3 embedding model; changing it re-indexes links on the next search
LIKI_BROWSER found automatically path to Chrome, or off to save pages without rendering them

Interactive mode keeps its input history in history next to the database.

Limitations

  • Paywalled pages, pages behind a login and PDFs are not supported. Some sites block headless browsers.
  • Snapshots keep the page as it looked once loaded, without its scripts: interactive parts (menus, tabs, links that run scripts) don't work offline, and embedded iframes (like videos) work only online.
  • Keyword search stems English words only.

About

TUI, local wiki for articles

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0