lilbee 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. lilbee-0.3.1/.beads/.gitignore +54 -0
  2. lilbee-0.3.1/.beads/README.md +81 -0
  3. lilbee-0.3.1/.beads/config.yaml +42 -0
  4. lilbee-0.3.1/.beads/hooks/post-checkout +17 -0
  5. lilbee-0.3.1/.beads/hooks/post-merge +19 -0
  6. lilbee-0.3.1/.beads/hooks/pre-commit +19 -0
  7. lilbee-0.3.1/.beads/hooks/pre-push +19 -0
  8. lilbee-0.3.1/.beads/hooks/prepare-commit-msg +24 -0
  9. lilbee-0.3.1/.beads/interactions.jsonl +0 -0
  10. lilbee-0.3.1/.beads/metadata.json +7 -0
  11. lilbee-0.3.1/.github/workflows/ci.yml +97 -0
  12. lilbee-0.3.1/.github/workflows/publish.yml +32 -0
  13. lilbee-0.3.1/.gitignore +20 -0
  14. lilbee-0.3.1/AGENTS.md +146 -0
  15. lilbee-0.3.1/LICENSE +21 -0
  16. lilbee-0.3.1/Makefile +37 -0
  17. lilbee-0.3.1/PKG-INFO +229 -0
  18. lilbee-0.3.1/README.md +198 -0
  19. lilbee-0.3.1/demos/chat.gif +0 -0
  20. lilbee-0.3.1/demos/chat.tape +37 -0
  21. lilbee-0.3.1/demos/code-search.gif +0 -0
  22. lilbee-0.3.1/demos/code-search.tape +19 -0
  23. lilbee-0.3.1/demos/ingest.gif +0 -0
  24. lilbee-0.3.1/demos/json.gif +0 -0
  25. lilbee-0.3.1/demos/json.tape +13 -0
  26. lilbee-0.3.1/demos/opencode.gif +0 -0
  27. lilbee-0.3.1/demos/opencode.tape +23 -0
  28. lilbee-0.3.1/docs/agent-integration.md +89 -0
  29. lilbee-0.3.1/docs/demos.md +27 -0
  30. lilbee-0.3.1/docs/development.md +70 -0
  31. lilbee-0.3.1/pyproject.toml +93 -0
  32. lilbee-0.3.1/src/lilbee/__init__.py +1 -0
  33. lilbee-0.3.1/src/lilbee/__main__.py +6 -0
  34. lilbee-0.3.1/src/lilbee/_languages.py +268 -0
  35. lilbee-0.3.1/src/lilbee/chunker.py +104 -0
  36. lilbee-0.3.1/src/lilbee/cli/__init__.py +51 -0
  37. lilbee-0.3.1/src/lilbee/cli/_app.py +83 -0
  38. lilbee-0.3.1/src/lilbee/cli/_chat.py +202 -0
  39. lilbee-0.3.1/src/lilbee/cli/_commands.py +363 -0
  40. lilbee-0.3.1/src/lilbee/cli/_helpers.py +240 -0
  41. lilbee-0.3.1/src/lilbee/code_chunker.py +127 -0
  42. lilbee-0.3.1/src/lilbee/config.py +102 -0
  43. lilbee-0.3.1/src/lilbee/embedder.py +101 -0
  44. lilbee-0.3.1/src/lilbee/ingest.py +350 -0
  45. lilbee-0.3.1/src/lilbee/mcp.py +78 -0
  46. lilbee-0.3.1/src/lilbee/query.py +154 -0
  47. lilbee-0.3.1/src/lilbee/store.py +175 -0
  48. lilbee-0.3.1/tests/__init__.py +0 -0
  49. lilbee-0.3.1/tests/test_accuracy.py +174 -0
  50. lilbee-0.3.1/tests/test_chunker.py +260 -0
  51. lilbee-0.3.1/tests/test_cli.py +1452 -0
  52. lilbee-0.3.1/tests/test_config.py +243 -0
  53. lilbee-0.3.1/tests/test_embedder.py +228 -0
  54. lilbee-0.3.1/tests/test_formats.py +259 -0
  55. lilbee-0.3.1/tests/test_ingest.py +556 -0
  56. lilbee-0.3.1/tests/test_mcp.py +175 -0
  57. lilbee-0.3.1/tests/test_pipeline.py +378 -0
  58. lilbee-0.3.1/tests/test_query.py +334 -0
  59. lilbee-0.3.1/uv.lock +1938 -0
@@ -0,0 +1,54 @@
1
+ # Dolt database (managed by Dolt, not git)
2
+ dolt/
3
+ dolt-access.lock
4
+
5
+ # Runtime files
6
+ bd.sock
7
+ bd.sock.startlock
8
+ sync-state.json
9
+ last-touched
10
+
11
+ # Local version tracking (prevents upgrade notification spam after git ops)
12
+ .local_version
13
+
14
+ # Worktree redirect file (contains relative path to main repo's .beads/)
15
+ # Must not be committed as paths would be wrong in other clones
16
+ redirect
17
+
18
+ # Sync state (local-only, per-machine)
19
+ # These files are machine-specific and should not be shared across clones
20
+ .sync.lock
21
+ .jsonl.lock
22
+ sync_base.jsonl
23
+ export-state/
24
+
25
+ # Ephemeral store (SQLite - wisps/molecules, intentionally not versioned)
26
+ ephemeral.sqlite3
27
+ ephemeral.sqlite3-journal
28
+ ephemeral.sqlite3-wal
29
+ ephemeral.sqlite3-shm
30
+
31
+ # Legacy files (from pre-Dolt versions)
32
+ *.db
33
+ *.db?*
34
+ *.db-journal
35
+ *.db-wal
36
+ *.db-shm
37
+ db.sqlite
38
+ bd.db
39
+ daemon.lock
40
+ daemon.log
41
+ daemon-*.log.gz
42
+ daemon.pid
43
+ beads.base.jsonl
44
+ beads.base.meta.json
45
+ beads.left.jsonl
46
+ beads.left.meta.json
47
+ beads.right.jsonl
48
+ beads.right.meta.json
49
+
50
+ # NOTE: Do NOT add negation patterns (e.g., !issues.jsonl) here.
51
+ # They would override fork protection in .git/info/exclude, allowing
52
+ # contributors to accidentally commit upstream issue databases.
53
+ # The JSONL files (issues.jsonl, interactions.jsonl) and config files
54
+ # are tracked by git by default since no pattern above ignores them.
@@ -0,0 +1,81 @@
1
+ # Beads - AI-Native Issue Tracking
2
+
3
+ Welcome to Beads! This repository uses **Beads** for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.
4
+
5
+ ## What is Beads?
6
+
7
+ Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.
8
+
9
+ **Learn more:** [github.com/steveyegge/beads](https://github.com/steveyegge/beads)
10
+
11
+ ## Quick Start
12
+
13
+ ### Essential Commands
14
+
15
+ ```bash
16
+ # Create new issues
17
+ bd create "Add user authentication"
18
+
19
+ # View all issues
20
+ bd list
21
+
22
+ # View issue details
23
+ bd show <issue-id>
24
+
25
+ # Update issue status
26
+ bd update <issue-id> --status in_progress
27
+ bd update <issue-id> --status done
28
+
29
+ # Sync with Dolt remote
30
+ bd dolt push
31
+ ```
32
+
33
+ ### Working with Issues
34
+
35
+ Issues in Beads are:
36
+ - **Git-native**: Stored in `.beads/issues.jsonl` and synced like code
37
+ - **AI-friendly**: CLI-first design works perfectly with AI coding agents
38
+ - **Branch-aware**: Issues can follow your branch workflow
39
+ - **Always in sync**: Auto-syncs with your commits
40
+
41
+ ## Why Beads?
42
+
43
+ ✨ **AI-Native Design**
44
+ - Built specifically for AI-assisted development workflows
45
+ - CLI-first interface works seamlessly with AI coding agents
46
+ - No context switching to web UIs
47
+
48
+ 🚀 **Developer Focused**
49
+ - Issues live in your repo, right next to your code
50
+ - Works offline, syncs when you push
51
+ - Fast, lightweight, and stays out of your way
52
+
53
+ 🔧 **Git Integration**
54
+ - Automatic sync with git commits
55
+ - Branch-aware issue tracking
56
+ - Intelligent JSONL merge resolution
57
+
58
+ ## Get Started with Beads
59
+
60
+ Try Beads in your own projects:
61
+
62
+ ```bash
63
+ # Install Beads
64
+ curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
65
+
66
+ # Initialize in your repo
67
+ bd init
68
+
69
+ # Create your first issue
70
+ bd create "Try out Beads"
71
+ ```
72
+
73
+ ## Learn More
74
+
75
+ - **Documentation**: [github.com/steveyegge/beads/docs](https://github.com/steveyegge/beads/tree/main/docs)
76
+ - **Quick Start Guide**: Run `bd quickstart`
77
+ - **Examples**: [github.com/steveyegge/beads/examples](https://github.com/steveyegge/beads/tree/main/examples)
78
+
79
+ ---
80
+
81
+ *Beads: Issue tracking that moves at the speed of thought* ⚡
@@ -0,0 +1,42 @@
1
+ # Beads Configuration File
2
+ # This file configures default behavior for all bd commands in this repository
3
+ # All settings can also be set via environment variables (BD_* prefix)
4
+ # or overridden with command-line flags
5
+
6
+ # Issue prefix for this repository (used by bd init)
7
+ # If not set, bd init will auto-detect from directory name
8
+ # Example: issue-prefix: "myproject" creates issues like "myproject-1", "myproject-2", etc.
9
+ # issue-prefix: ""
10
+
11
+ # Use no-db mode: load from JSONL, write back after each command
12
+ # When true, bd will use .beads/issues.jsonl as the source of truth
13
+ # instead of the Dolt database
14
+ # no-db: false
15
+
16
+ # Enable JSON output by default
17
+ # json: false
18
+
19
+ # Default actor for audit trails (overridden by BD_ACTOR or --actor)
20
+ # actor: ""
21
+
22
+ # Export events (audit trail) to .beads/events.jsonl on each flush/sync
23
+ # When enabled, new events are appended incrementally using a high-water mark.
24
+ # Use 'bd export --events' to trigger manually regardless of this setting.
25
+ # events-export: false
26
+
27
+ # Multi-repo configuration (experimental - bd-307)
28
+ # Allows hydrating from multiple repositories and routing writes to the correct JSONL
29
+ # repos:
30
+ # primary: "." # Primary repo (where this database lives)
31
+ # additional: # Additional repos to hydrate from (read-only)
32
+ # - ~/beads-planning # Personal planning repo
33
+ # - ~/work-planning # Work planning repo
34
+
35
+ # Integration settings (access with 'bd config get/set')
36
+ # These are stored in the database, not in this file:
37
+ # - jira.url
38
+ # - jira.project
39
+ # - linear.url
40
+ # - linear.api-key
41
+ # - github.org
42
+ # - github.repo
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env sh
2
+ # bd-shim v1
3
+ # bd-hooks-version: 0.56.1
4
+ #
5
+ # bd (beads) post-checkout hook - thin shim
6
+ #
7
+ # This shim delegates to 'bd hooks run post-checkout' which contains
8
+ # the actual hook logic. This pattern ensures hook behavior is always
9
+ # in sync with the installed bd version - no manual updates needed.
10
+
11
+ # Check if bd is available
12
+ if ! command -v bd >/dev/null 2>&1; then
13
+ # Silently skip - post-checkout is called frequently
14
+ exit 0
15
+ fi
16
+
17
+ exec bd hooks run post-checkout "$@"
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env sh
2
+ # bd-shim v1
3
+ # bd-hooks-version: 0.56.1
4
+ #
5
+ # bd (beads) post-merge hook - thin shim
6
+ #
7
+ # This shim delegates to 'bd hooks run post-merge' which contains
8
+ # the actual hook logic. This pattern ensures hook behavior is always
9
+ # in sync with the installed bd version - no manual updates needed.
10
+
11
+ # Check if bd is available
12
+ if ! command -v bd >/dev/null 2>&1; then
13
+ echo "Warning: bd command not found in PATH, skipping post-merge hook" >&2
14
+ echo " Install bd: brew install beads" >&2
15
+ echo " Or add bd to your PATH" >&2
16
+ exit 0
17
+ fi
18
+
19
+ exec bd hooks run post-merge "$@"
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env sh
2
+ # bd-shim v2
3
+ # bd-hooks-version: 0.56.1
4
+ #
5
+ # bd (beads) pre-commit hook — thin shim
6
+ #
7
+ # Delegates to 'bd hooks run pre-commit' which contains the actual hook
8
+ # logic. This pattern ensures hook behavior is always in sync with the
9
+ # installed bd version — no manual updates needed.
10
+
11
+ # Check if bd is available
12
+ if ! command -v bd >/dev/null 2>&1; then
13
+ echo "Warning: bd command not found in PATH, skipping pre-commit hook" >&2
14
+ echo " Install bd: brew install beads" >&2
15
+ echo " Or add bd to your PATH" >&2
16
+ exit 0
17
+ fi
18
+
19
+ exec bd hooks run pre-commit "$@"
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env sh
2
+ # bd-shim v1
3
+ # bd-hooks-version: 0.56.1
4
+ #
5
+ # bd (beads) pre-push hook - thin shim
6
+ #
7
+ # This shim delegates to 'bd hooks run pre-push' which contains
8
+ # the actual hook logic. This pattern ensures hook behavior is always
9
+ # in sync with the installed bd version - no manual updates needed.
10
+
11
+ # Check if bd is available
12
+ if ! command -v bd >/dev/null 2>&1; then
13
+ echo "Warning: bd command not found in PATH, skipping pre-push hook" >&2
14
+ echo " Install bd: brew install beads" >&2
15
+ echo " Or add bd to your PATH" >&2
16
+ exit 0
17
+ fi
18
+
19
+ exec bd hooks run pre-push "$@"
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env sh
2
+ # bd-shim v1
3
+ # bd-hooks-version: 0.48.0
4
+ #
5
+ # bd (beads) prepare-commit-msg hook - thin shim
6
+ #
7
+ # This shim delegates to 'bd hooks run prepare-commit-msg' which contains
8
+ # the actual hook logic. This pattern ensures hook behavior is always
9
+ # in sync with the installed bd version - no manual updates needed.
10
+ #
11
+ # Arguments:
12
+ # $1 = path to the commit message file
13
+ # $2 = source of commit message (message, template, merge, squash, commit)
14
+ # $3 = commit SHA-1 (if -c, -C, or --amend)
15
+
16
+ # Check if bd is available
17
+ if ! command -v bd >/dev/null 2>&1; then
18
+ echo "Warning: bd command not found in PATH, skipping prepare-commit-msg hook" >&2
19
+ echo " Install bd: brew install beads" >&2
20
+ echo " Or add bd to your PATH" >&2
21
+ exit 0
22
+ fi
23
+
24
+ exec bd hooks run prepare-commit-msg "$@"
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "database": "dolt",
3
+ "jsonl_export": "issues.jsonl",
4
+ "backend": "dolt",
5
+ "dolt_mode": "server",
6
+ "dolt_database": "beads_bb"
7
+ }
@@ -0,0 +1,97 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master, main]
6
+ pull_request:
7
+ branches: [master, main]
8
+ workflow_call:
9
+
10
+ jobs:
11
+ lint:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Install uv
17
+ uses: astral-sh/setup-uv@v5
18
+ with:
19
+ version: "latest"
20
+
21
+ - name: Set up Python
22
+ run: uv python install 3.12
23
+
24
+ - name: Install dependencies
25
+ run: uv sync
26
+
27
+ - name: Lint
28
+ run: make lint
29
+
30
+ - name: Format check
31
+ run: make format-check
32
+
33
+ - name: Type check
34
+ run: make typecheck
35
+
36
+ - name: Check imports resolve
37
+ run: uv run python -c "import lilbee; from lilbee import cli, config, chunker, code_chunker, embedder, store, ingest, query"
38
+
39
+ test:
40
+ runs-on: ${{ matrix.os }}
41
+ strategy:
42
+ fail-fast: false
43
+ matrix:
44
+ os: [ubuntu-latest, macos-latest]
45
+ python-version: ["3.11", "3.12", "3.13"]
46
+
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+
50
+ - name: Install uv
51
+ uses: astral-sh/setup-uv@v5
52
+ with:
53
+ version: "latest"
54
+
55
+ - name: Set up Python ${{ matrix.python-version }}
56
+ run: uv python install ${{ matrix.python-version }}
57
+
58
+ - name: Install dependencies
59
+ run: uv sync
60
+
61
+ - name: Run unit tests with coverage
62
+ run: make test
63
+ env:
64
+ LILBEE_DATA: ${{ runner.temp }}/lilbee
65
+
66
+ test-with-ollama:
67
+ runs-on: ubuntu-latest
68
+ if: github.event_name == 'push'
69
+
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+
73
+ - name: Install uv
74
+ uses: astral-sh/setup-uv@v5
75
+ with:
76
+ version: "latest"
77
+
78
+ - name: Set up Python
79
+ run: uv python install 3.12
80
+
81
+ - name: Install dependencies
82
+ run: uv sync
83
+
84
+ - name: Install Ollama
85
+ run: curl -fsSL https://ollama.com/install.sh | sh
86
+
87
+ - name: Start Ollama and pull models
88
+ run: |
89
+ ollama serve &
90
+ sleep 5
91
+ ollama pull nomic-embed-text
92
+ ollama pull mistral
93
+
94
+ - name: Run full test suite (including accuracy)
95
+ run: uv run pytest tests/ -v
96
+ env:
97
+ LILBEE_DATA: ${{ runner.temp }}/lilbee
@@ -0,0 +1,32 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ ci:
9
+ uses: ./.github/workflows/ci.yml
10
+
11
+ publish:
12
+ needs: ci
13
+ runs-on: ubuntu-latest
14
+ environment: pypi
15
+ permissions:
16
+ id-token: write
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Install uv
21
+ uses: astral-sh/setup-uv@v5
22
+ with:
23
+ version: "latest"
24
+
25
+ - name: Set up Python
26
+ run: uv python install 3.12
27
+
28
+ - name: Build package
29
+ run: uv build
30
+
31
+ - name: Publish to PyPI
32
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,20 @@
1
+ data/
2
+ __pycache__/
3
+ *.pyc
4
+ .venv/
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ .eggs/
9
+ .pytest_cache/
10
+ .mypy_cache/
11
+ .ruff_cache/
12
+ .coverage
13
+ htmlcov/
14
+ *.pdf
15
+ *.html
16
+ *.txt
17
+ CLAUDE.md
18
+ .worktrees/
19
+ docs/plans/
20
+ demo.cast
lilbee-0.3.1/AGENTS.md ADDED
@@ -0,0 +1,146 @@
1
+ # lilbee — Development Guide
2
+
3
+ ## Project
4
+ Local RAG knowledge base. Python 3.11+, Ollama for LLM/embeddings, LanceDB for vectors. Managed with `uv`. Task tracking with `beads` (`bd`). Learned behaviors with `floop`.
5
+
6
+ ## Task Tracking (beads)
7
+ ```bash
8
+ bd ready # See what's ready to work on
9
+ bd update <id> -s in_progress # Claim a task
10
+ bd close <id> # Mark done
11
+ bd list # All issues
12
+ ```
13
+ Every code change MUST be tracked as a beads task. Create tasks before starting work, close them when done.
14
+
15
+ ## Commands
16
+ ```bash
17
+ uv sync # Install dependencies
18
+ make check # Run all checks: lint, format, typecheck, test (same as CI)
19
+ make test # Tests with coverage
20
+ make lint # Ruff linting
21
+ make typecheck # Mypy
22
+ make format # Auto-format code
23
+ uv run lilbee sync # Sync documents to vector DB
24
+ uv run lilbee ask "question"
25
+ uv run lilbee chat
26
+ uv run lilbee status
27
+ uv run lilbee rebuild
28
+ ```
29
+
30
+ ## Architecture
31
+ - `src/lilbee/` — All source code
32
+ - Documents + data stored in platform-standard location (see `lilbee status`)
33
+ - macOS: `~/Library/Application Support/lilbee/`
34
+ - Linux: `~/.local/share/lilbee/`
35
+ - Windows: `%LOCALAPPDATA%/lilbee/`
36
+ - Override: `LILBEE_DATA=/path` or `--data-dir`
37
+ - All settings configurable via `LILBEE_*` env vars or CLI flags
38
+ - Auto-sync: documents/ is source of truth, data/ is rebuilt from it
39
+
40
+ ## Configuration
41
+ All settings override via environment variables:
42
+ - `LILBEE_DATA` — data directory path
43
+ - `LILBEE_CHAT_MODEL` — LLM model (default: `mistral`)
44
+ - `LILBEE_EMBEDDING_MODEL` — embedding model (default: `nomic-embed-text`)
45
+ - `LILBEE_EMBEDDING_DIM` — embedding dimensions (default: `768`)
46
+ - `LILBEE_CHUNK_SIZE` — tokens per chunk (default: `512`)
47
+ - `LILBEE_CHUNK_OVERLAP` — overlap tokens (default: `100`)
48
+ - `LILBEE_TOP_K` — retrieval result count (default: `5`)
49
+
50
+ CLI also accepts `--model` / `-m` for chat model and `--data-dir` / `-d`.
51
+
52
+ ## Code Quality Rules
53
+
54
+ ### Test-Driven Development
55
+ - **100% test coverage required** — enforced by `pytest-cov` with `fail_under = 100`
56
+ - Write tests BEFORE or alongside implementation, not after
57
+ - Every public function MUST have at least one test
58
+ - Mock all external dependencies (Ollama, filesystem I/O where needed) — tests must run without a live server
59
+ - Use `pytest.mark.skipif` only for integration tests that genuinely require live services
60
+ - Use `tmp_path` fixtures for filesystem tests — never write to real paths
61
+ - Test edge cases and error paths, not just the happy path
62
+ - Tests are documentation — name them descriptively (`test_add_nonexistent_fails`, not `test_add_3`)
63
+
64
+ ### DRY & Modularity
65
+ - **Don't Repeat Yourself** — extract shared logic into helpers when duplicated
66
+ - Single Responsibility — each function does one thing well
67
+ - Small functions — max ~20 lines, max 2 levels of nesting
68
+ - Low cyclomatic complexity — extract helpers when branches exceed 3
69
+ - **Use maps for classification/dispatch** — if-chains that map values to categories belong in a dict, not repeated `if`/`elif` blocks
70
+ - Compose small functions rather than writing monolithic ones
71
+ - If you need to copy-paste code, refactor into a shared function instead
72
+
73
+ ### Code Style
74
+ - No LangChain — raw Ollama SDK
75
+ - Type hints on all public functions
76
+ - Dataclasses for structured return types (not raw dicts)
77
+ - Named constants for magic numbers — with descriptive comments
78
+ - Descriptive variable names — `pending_segments` not `current`, `chunk_size` not `n`
79
+ - Logging with `logging.getLogger(__name__)` — no bare `except: pass`
80
+ - No hardcoded values — all configurable through `config.py` with env var overrides
81
+ - Imports: stdlib first, then third-party, then local — no star imports
82
+ - Lazy imports in CLI callbacks (avoid loading heavy deps at import time)
83
+ - Linting: `ruff check` + `ruff format` (line length 100)
84
+ - Type checking: `mypy` with strict settings
85
+
86
+ ### YAGNI & Simplicity
87
+ - Don't add features, abstractions, or config that isn't needed yet
88
+ - Three similar lines are better than a premature abstraction
89
+ - Only validate at system boundaries (user input, external APIs) — trust internal code
90
+ - No backwards-compatibility shims — if something is unused, delete it
91
+
92
+ ### Git & Workflow
93
+ - Every change tracked as a beads task (`bd create` → `bd close`)
94
+ - Run `make check` before closing any task — it mirrors CI exactly
95
+ - Tests, lint, and type checks must pass before closing a task
96
+ - CI runs on every push and PR
97
+
98
+ ### Behavior Learning (floop)
99
+ - `floop` captures corrections and learned behaviors across sessions
100
+ - Hooks run automatically via `~/.claude/settings.json` (session-start, dynamic-context, detect-correction)
101
+ - `floop active` — show behaviors active in current context
102
+ - `floop learn` — manually capture a correction/behavior
103
+ - `floop list` — list all learned behaviors
104
+ - `floop prompt` — generate prompt section from active behaviors
105
+
106
+ ## Agent Integration
107
+
108
+ lilbee has a local knowledge base you can query. Use it for domain-specific questions about the user's documents.
109
+
110
+ ### MCP Server (recommended)
111
+
112
+ An MCP server is configured in `.claude/settings.json` for this project. Tools available:
113
+
114
+ | Tool | Description | Requires Ollama |
115
+ |------|-------------|-----------------|
116
+ | `lilbee_search(query, top_k)` | Search for relevant chunks | No |
117
+ | `lilbee_status()` | Show indexed docs and config | No |
118
+ | `lilbee_sync()` | Sync documents to vector store | Yes (embedding) |
119
+
120
+ Prefer `lilbee_search` — it returns pre-embedded chunks without calling Ollama at query time.
121
+
122
+ ### JSON CLI (fallback)
123
+
124
+ All commands accept `--json` (before the subcommand) for structured output:
125
+
126
+ ```bash
127
+ lilbee --json search "query" --top-k 5
128
+ lilbee --json ask "question"
129
+ lilbee --json status
130
+ lilbee --json sync
131
+ ```
132
+
133
+ Every command returns a single JSON object on stdout. Errors return non-zero exit + `{"error": "message"}`.
134
+
135
+ See [docs/agent-integration.md](docs/agent-integration.md) for full reference.
136
+
137
+ ## Key Files
138
+ - `config.py` — All settings (env-var configurable)
139
+ - `ingest.py` — Document sync engine (hash-based change detection)
140
+ - `query.py` — RAG pipeline (embed → search → generate)
141
+ - `store.py` — LanceDB operations
142
+ - `chunker.py` — Text chunking (token-based recursive)
143
+ - `code_chunker.py` — Code chunking (tree-sitter AST)
144
+ - `embedder.py` — Ollama embedding wrapper
145
+ - `cli.py` — Typer CLI with --model, --data-dir, --version, and --json flags
146
+ - `mcp.py` — MCP server exposing search, ask, status, sync as tools
lilbee-0.3.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 tobocop2
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
lilbee-0.3.1/Makefile ADDED
@@ -0,0 +1,37 @@
1
+ .PHONY: lint format format-check typecheck test check clean install demo build publish
2
+
3
+ lint:
4
+ uv run ruff check src/ tests/
5
+
6
+ format:
7
+ uv run ruff format src/ tests/
8
+
9
+ format-check:
10
+ uv run ruff format --check src/ tests/
11
+
12
+ typecheck:
13
+ uv run mypy src/lilbee/
14
+
15
+ test:
16
+ uv run pytest --cov=lilbee --cov-report=term-missing -v
17
+
18
+ check: lint format-check typecheck test ## Run all checks (same as CI)
19
+
20
+ install:
21
+ uv tool install . --force --reinstall
22
+
23
+ demo: ## Record all demo GIFs via VHS
24
+ vhs demos/chat.tape
25
+ vhs demos/code-search.tape
26
+ vhs demos/json.tape
27
+ vhs demos/opencode.tape
28
+
29
+ build:
30
+ uv build
31
+
32
+ publish: build ## Build and upload to PyPI
33
+ uv publish
34
+
35
+ clean:
36
+ rm -rf .mypy_cache .pytest_cache .ruff_cache htmlcov .coverage dist/
37
+ find . -type d -name __pycache__ -exec rm -rf {} +