blq-cli 0.1.0__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 (63) hide show
  1. blq_cli-0.1.0/.github/workflows/ci.yml +93 -0
  2. blq_cli-0.1.0/.github/workflows/docs.yml +33 -0
  3. blq_cli-0.1.0/.github/workflows/publish.yml +46 -0
  4. blq_cli-0.1.0/.gitignore +48 -0
  5. blq_cli-0.1.0/.mcp.json +8 -0
  6. blq_cli-0.1.0/.readthedocs.yml +16 -0
  7. blq_cli-0.1.0/AGENT.md +88 -0
  8. blq_cli-0.1.0/AGENTS.md +711 -0
  9. blq_cli-0.1.0/CLAUDE.md +153 -0
  10. blq_cli-0.1.0/CONTRIBUTING.md +247 -0
  11. blq_cli-0.1.0/PKG-INFO +348 -0
  12. blq_cli-0.1.0/README.md +309 -0
  13. blq_cli-0.1.0/docs/ci-cd.md +206 -0
  14. blq_cli-0.1.0/docs/commands/capture.md +167 -0
  15. blq_cli-0.1.0/docs/commands/completions.md +123 -0
  16. blq_cli-0.1.0/docs/commands/errors.md +172 -0
  17. blq_cli-0.1.0/docs/commands/exec.md +196 -0
  18. blq_cli-0.1.0/docs/commands/filter.md +161 -0
  19. blq_cli-0.1.0/docs/commands/index.md +108 -0
  20. blq_cli-0.1.0/docs/commands/init.md +153 -0
  21. blq_cli-0.1.0/docs/commands/maintenance.md +132 -0
  22. blq_cli-0.1.0/docs/commands/query.md +130 -0
  23. blq_cli-0.1.0/docs/commands/registry.md +212 -0
  24. blq_cli-0.1.0/docs/commands/run.md +203 -0
  25. blq_cli-0.1.0/docs/commands/sql.md +227 -0
  26. blq_cli-0.1.0/docs/commands/status.md +166 -0
  27. blq_cli-0.1.0/docs/commands/sync.md +128 -0
  28. blq_cli-0.1.0/docs/design-commands.md +201 -0
  29. blq_cli-0.1.0/docs/design-sync.md +244 -0
  30. blq_cli-0.1.0/docs/getting-started.md +145 -0
  31. blq_cli-0.1.0/docs/index.md +63 -0
  32. blq_cli-0.1.0/docs/integration.md +294 -0
  33. blq_cli-0.1.0/docs/mcp.md +996 -0
  34. blq_cli-0.1.0/docs/python-api.md +534 -0
  35. blq_cli-0.1.0/docs/query-guide.md +212 -0
  36. blq_cli-0.1.0/docs/requirements.txt +2 -0
  37. blq_cli-0.1.0/experiments/agent-build-test.md +82 -0
  38. blq_cli-0.1.0/mkdocs.yml +71 -0
  39. blq_cli-0.1.0/pyproject.toml +77 -0
  40. blq_cli-0.1.0/src/blq/__init__.py +21 -0
  41. blq_cli-0.1.0/src/blq/cli.py +486 -0
  42. blq_cli-0.1.0/src/blq/commands/README.md +44 -0
  43. blq_cli-0.1.0/src/blq/commands/__init__.py +58 -0
  44. blq_cli-0.1.0/src/blq/commands/core.py +1058 -0
  45. blq_cli-0.1.0/src/blq/commands/events.py +113 -0
  46. blq_cli-0.1.0/src/blq/commands/execution.py +537 -0
  47. blq_cli-0.1.0/src/blq/commands/init_cmd.py +698 -0
  48. blq_cli-0.1.0/src/blq/commands/management.py +531 -0
  49. blq_cli-0.1.0/src/blq/commands/query_cmd.py +315 -0
  50. blq_cli-0.1.0/src/blq/commands/registry.py +81 -0
  51. blq_cli-0.1.0/src/blq/commands/serve_cmd.py +29 -0
  52. blq_cli-0.1.0/src/blq/commands/sync_cmd.py +218 -0
  53. blq_cli-0.1.0/src/blq/query.py +749 -0
  54. blq_cli-0.1.0/src/blq/schema.sql +369 -0
  55. blq_cli-0.1.0/src/blq/serve.py +1140 -0
  56. blq_cli-0.1.0/tests/__init__.py +1 -0
  57. blq_cli-0.1.0/tests/conftest.py +119 -0
  58. blq_cli-0.1.0/tests/test_core.py +569 -0
  59. blq_cli-0.1.0/tests/test_mcp_server.py +485 -0
  60. blq_cli-0.1.0/tests/test_phase1_structured_output.py +393 -0
  61. blq_cli-0.1.0/tests/test_phase2_command_registry.py +495 -0
  62. blq_cli-0.1.0/tests/test_query_api.py +362 -0
  63. blq_cli-0.1.0/tests/test_query_filter.py +561 -0
@@ -0,0 +1,93 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main, develop ]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: '3.12'
19
+ cache: 'pip'
20
+
21
+ - name: Install dependencies
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install ruff
25
+
26
+ - name: Run ruff check
27
+ run: ruff check .
28
+
29
+ - name: Run ruff format check
30
+ run: ruff format --check .
31
+
32
+ test:
33
+ runs-on: ubuntu-latest
34
+ strategy:
35
+ matrix:
36
+ python-version: ['3.10', '3.11', '3.12']
37
+
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+
41
+ - name: Set up Python ${{ matrix.python-version }}
42
+ uses: actions/setup-python@v5
43
+ with:
44
+ python-version: ${{ matrix.python-version }}
45
+ cache: 'pip'
46
+
47
+ - name: Install dependencies
48
+ run: |
49
+ python -m pip install --upgrade pip
50
+ pip install -e ".[dev]"
51
+
52
+ - name: Run tests with coverage
53
+ run: |
54
+ pytest --cov=blq --cov-report=xml --cov-report=term
55
+
56
+ - name: Upload coverage to Codecov
57
+ uses: codecov/codecov-action@v4
58
+ if: matrix.python-version == '3.12'
59
+ with:
60
+ files: ./coverage.xml
61
+ flags: unittests
62
+ name: codecov-umbrella
63
+ fail_ci_if_error: false
64
+
65
+ build:
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+
70
+ - name: Set up Python
71
+ uses: actions/setup-python@v5
72
+ with:
73
+ python-version: '3.12'
74
+ cache: 'pip'
75
+
76
+ - name: Install build dependencies
77
+ run: |
78
+ python -m pip install --upgrade pip
79
+ pip install build
80
+
81
+ - name: Build package
82
+ run: python -m build
83
+
84
+ - name: Check package
85
+ run: |
86
+ pip install twine
87
+ twine check dist/*
88
+
89
+ - name: Upload artifacts
90
+ uses: actions/upload-artifact@v4
91
+ with:
92
+ name: dist
93
+ path: dist/
@@ -0,0 +1,33 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: '3.12'
19
+
20
+ - name: Install dependencies
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+ pip install mkdocs mkdocs-material
24
+
25
+ - name: Build documentation
26
+ run: mkdocs build
27
+
28
+ - name: Upload artifacts
29
+ uses: actions/upload-artifact@v4
30
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
31
+ with:
32
+ name: docs
33
+ path: site/
@@ -0,0 +1,46 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ environment:
9
+ description: 'Deployment environment'
10
+ required: true
11
+ type: choice
12
+ options:
13
+ - testpypi
14
+ - pypi
15
+
16
+ jobs:
17
+ publish:
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: '3.12'
29
+
30
+ - name: Install build dependencies
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ pip install build
34
+
35
+ - name: Build package
36
+ run: python -m build
37
+
38
+ # - name: Publish to TestPyPI
39
+ # if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi'
40
+ # uses: pypa/gh-action-pypi-publish@release/v1
41
+ # with:
42
+ # repository-url: https://test.pypi.org/legacy/
43
+
44
+ - name: Publish to PyPI
45
+ if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi')
46
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,48 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+
28
+ # IDE
29
+ .idea/
30
+ .vscode/
31
+ *.swp
32
+ *.swo
33
+
34
+ # Testing
35
+ .pytest_cache/
36
+ .coverage
37
+ htmlcov/
38
+ .tox/
39
+ .nox/
40
+
41
+ # mypy
42
+ .mypy_cache/
43
+
44
+ # lq data (local to each project)
45
+ .lq/
46
+
47
+ # Documentation
48
+ site/
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "lq": {
4
+ "command": "lq",
5
+ "args": ["serve"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,16 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ version: 2
5
+
6
+ build:
7
+ os: ubuntu-22.04
8
+ tools:
9
+ python: "3.12"
10
+
11
+ mkdocs:
12
+ configuration: mkdocs.yml
13
+
14
+ python:
15
+ install:
16
+ - requirements: docs/requirements.txt
blq_cli-0.1.0/AGENT.md ADDED
@@ -0,0 +1,88 @@
1
+ # lq Agent Interface
2
+
3
+ This document describes how AI agents should interact with `blq` for efficient log analysis.
4
+
5
+ ## Token-Efficient Workflow
6
+
7
+ **Problem**: Raw build logs can be 10MB+, burning context when agents just need "what failed?"
8
+
9
+ **Solution**: Use `blq` commands for structured, minimal-token queries.
10
+
11
+ ### Quick Status Check (~10 tokens output)
12
+ ```bash
13
+ blq status
14
+ ```
15
+ Output:
16
+ ```
17
+ [ OK ] make
18
+ [FAIL] gh run 123
19
+ [WARN] eslint
20
+ ```
21
+
22
+ ### Get Errors (~200 tokens for 5 errors)
23
+ ```bash
24
+ blq errors --limit 5
25
+ ```
26
+
27
+ ### Compact Format (~100 tokens for 10 errors)
28
+ ```bash
29
+ blq errors --compact --limit 10
30
+ ```
31
+ Output:
32
+ ```
33
+ src/main.cpp:42:5: undefined reference to 'foo'
34
+ src/utils.cpp:15:1: missing semicolon
35
+ ```
36
+
37
+ ### JSON for Programmatic Use
38
+ ```bash
39
+ blq errors --json --limit 5
40
+ ```
41
+
42
+ ## MCP Tools (When Integrated)
43
+
44
+ When `blq` is exposed via duckdb_mcp, agents can use these tools:
45
+
46
+ | Tool | Description | Token Cost |
47
+ |------|-------------|------------|
48
+ | `blq_status` | Quick status badges | ~10 |
49
+ | `blq_errors` | Recent errors | ~200 |
50
+ | `blq_summary` | Aggregate by tool/category | ~100 |
51
+ | `blq_sql` | Custom queries | Variable |
52
+
53
+ ## Recommended Agent Workflow
54
+
55
+ 1. **Start with status**: `blq status` - see if anything failed
56
+ 2. **Drill into failures**: `blq errors --source "failed_source" --limit 5`
57
+ 3. **Get context if needed**: `blq sql "SELECT * FROM lq_events WHERE event_id = 42"`
58
+
59
+ ## SQL Macros Available
60
+
61
+ ```sql
62
+ -- Quick queries
63
+ FROM lq_status(); -- Status badges
64
+ FROM lq_errors(10); -- Recent errors
65
+ FROM lq_warnings(10); -- Recent warnings
66
+ FROM lq_summary(); -- Aggregate summary
67
+
68
+ -- Filtered queries
69
+ FROM lq_errors_for('make', 5); -- Errors for specific source
70
+ FROM lq_file('main.cpp'); -- Events for specific file
71
+
72
+ -- History
73
+ FROM lq_history(20); -- Run history
74
+ lq_diff(run1, run2); -- Compare two runs
75
+ ```
76
+
77
+ ## Storage Location
78
+
79
+ Logs are stored in `.lq/logs/` with Hive partitioning:
80
+ ```
81
+ .lq/logs/date=2024-01-15/source=run/001_make_103000.parquet
82
+ ```
83
+
84
+ Agents can directly query parquet files if needed:
85
+ ```sql
86
+ SELECT * FROM read_parquet('.lq/logs/**/*.parquet', hive_partitioning=true)
87
+ WHERE severity = 'error'
88
+ ```