Skip to main content

Personal knowledge base CLI - aggregate content from multiple sources

Project description

lestash

PyPI version GitHub

Core CLI and plugin system for Le Stash - a personal knowledge base that aggregates content from multiple sources into a unified, searchable database.

Note: For project overview, features, and quick start guide, see the GitHub repository.

Installation

uv add lestash

Or install the full workspace from the repository root:

uv sync --all-packages

CLI Commands

Items

# List all items
lestash items list

# Search items
lestash items search "query"

# Show item details
lestash items show <id>

# Export items to JSON
lestash items export --output backup.json

Sources

# List configured sources
lestash sources list

# Sync all sources
lestash sources sync

# View sync history
lestash sources history

Configuration

# Show current config
lestash config show

# Initialize config file
lestash config init

# Set a config value
lestash config set logging.level DEBUG

Plugin Architecture

Le Stash uses entry points for plugin discovery. Plugins implement the SourcePlugin base class:

from lestash.plugins.base import SourcePlugin
from lestash.models.item import ItemCreate

class MySource(SourcePlugin):
    name = "my-source"
    description = "My custom data source"

    def get_commands(self) -> typer.Typer:
        """Return Typer app with source-specific commands."""
        app = typer.Typer()
        # Add commands...
        return app

    def sync(self, config: dict) -> Iterator[ItemCreate]:
        """Fetch items from the source."""
        yield ItemCreate(
            source_type="my-source",
            source_id="unique-id",
            content="Item content",
        )

Register the plugin in pyproject.toml:

[project.entry-points."lestash.sources"]
my-source = "my_package:MySource"

Data Model

Item

The core unit of content:

Field Type Description
id int Auto-generated primary key
source_type str Plugin identifier (e.g., "arxiv", "linkedin")
source_id str Unique ID within the source
url str Optional URL to original content
title str Optional title
content str Main text content
author str Optional author
created_at datetime When the content was created
is_own_content bool Whether user authored this
metadata dict Source-specific data (JSON)

Database

SQLite database with:

  • items - Main content table with unique constraint on (source_type, source_id)
  • items_fts - Full-text search virtual table (FTS5)
  • item_history - Audit trail of content changes
  • tags / item_tags - Tagging system
  • sources - Plugin configuration storage
  • sync_log - Sync operation history

Configuration

Default location: ~/.config/lestash/config.toml

[general]
database_path = "~/.config/lestash/lestash.db"

[logging]
level = "INFO"
file_path = "~/.config/lestash/logs/lestash.log"

License

MIT

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lestash-1.0.2-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file lestash-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: lestash-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lestash-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 da560b4e73ed9557800e88bedeea7daaa993edde229fcf9493d5569b0b8b2cea
MD5 7d1f8e540e02193e10e4135b51e8a5d3
BLAKE2b-256 923a219b6c3407c98fd1590ac8faf00f06cbbe3ee50a4df6c31f978b23679931

See more details on using hashes here.

Provenance

The following attestation bundles were made for lestash-1.0.2-py3-none-any.whl:

Publisher: release.yml on thompsonson/lestash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page