brainpalace-cli 26.5.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 (55) hide show
  1. brainpalace_cli-26.5.1/PKG-INFO +173 -0
  2. brainpalace_cli-26.5.1/README.md +144 -0
  3. brainpalace_cli-26.5.1/brainpalace_cli/__init__.py +3 -0
  4. brainpalace_cli-26.5.1/brainpalace_cli/cli.py +131 -0
  5. brainpalace_cli-26.5.1/brainpalace_cli/client/__init__.py +20 -0
  6. brainpalace_cli-26.5.1/brainpalace_cli/client/api_client.py +552 -0
  7. brainpalace_cli-26.5.1/brainpalace_cli/client/errors.py +66 -0
  8. brainpalace_cli-26.5.1/brainpalace_cli/commands/__init__.py +53 -0
  9. brainpalace_cli-26.5.1/brainpalace_cli/commands/cache.py +129 -0
  10. brainpalace_cli-26.5.1/brainpalace_cli/commands/config.py +604 -0
  11. brainpalace_cli-26.5.1/brainpalace_cli/commands/context.py +48 -0
  12. brainpalace_cli-26.5.1/brainpalace_cli/commands/doctor.py +122 -0
  13. brainpalace_cli-26.5.1/brainpalace_cli/commands/folders.py +282 -0
  14. brainpalace_cli-26.5.1/brainpalace_cli/commands/index.py +209 -0
  15. brainpalace_cli-26.5.1/brainpalace_cli/commands/init.py +530 -0
  16. brainpalace_cli-26.5.1/brainpalace_cli/commands/inject.py +274 -0
  17. brainpalace_cli-26.5.1/brainpalace_cli/commands/install_agent.py +340 -0
  18. brainpalace_cli-26.5.1/brainpalace_cli/commands/jobs.py +345 -0
  19. brainpalace_cli-26.5.1/brainpalace_cli/commands/list_cmd.py +233 -0
  20. brainpalace_cli-26.5.1/brainpalace_cli/commands/mcp.py +34 -0
  21. brainpalace_cli-26.5.1/brainpalace_cli/commands/memories.py +130 -0
  22. brainpalace_cli-26.5.1/brainpalace_cli/commands/query.py +231 -0
  23. brainpalace_cli-26.5.1/brainpalace_cli/commands/recall.py +53 -0
  24. brainpalace_cli-26.5.1/brainpalace_cli/commands/remember.py +43 -0
  25. brainpalace_cli-26.5.1/brainpalace_cli/commands/reset.py +83 -0
  26. brainpalace_cli-26.5.1/brainpalace_cli/commands/sessions.py +79 -0
  27. brainpalace_cli-26.5.1/brainpalace_cli/commands/start.py +506 -0
  28. brainpalace_cli-26.5.1/brainpalace_cli/commands/status.py +239 -0
  29. brainpalace_cli-26.5.1/brainpalace_cli/commands/stop.py +457 -0
  30. brainpalace_cli-26.5.1/brainpalace_cli/commands/types.py +104 -0
  31. brainpalace_cli-26.5.1/brainpalace_cli/commands/uninstall.py +180 -0
  32. brainpalace_cli-26.5.1/brainpalace_cli/commands/whoami.py +74 -0
  33. brainpalace_cli-26.5.1/brainpalace_cli/config.py +454 -0
  34. brainpalace_cli-26.5.1/brainpalace_cli/config_migrate.py +198 -0
  35. brainpalace_cli-26.5.1/brainpalace_cli/config_schema.py +490 -0
  36. brainpalace_cli-26.5.1/brainpalace_cli/diagnostics.py +813 -0
  37. brainpalace_cli-26.5.1/brainpalace_cli/discovery.py +116 -0
  38. brainpalace_cli-26.5.1/brainpalace_cli/mcp_server/__init__.py +9 -0
  39. brainpalace_cli-26.5.1/brainpalace_cli/mcp_server/lifecycle.py +177 -0
  40. brainpalace_cli-26.5.1/brainpalace_cli/mcp_server/schemas.py +63 -0
  41. brainpalace_cli-26.5.1/brainpalace_cli/mcp_server/server.py +143 -0
  42. brainpalace_cli-26.5.1/brainpalace_cli/mcp_server/tools.py +227 -0
  43. brainpalace_cli-26.5.1/brainpalace_cli/migration.py +117 -0
  44. brainpalace_cli-26.5.1/brainpalace_cli/runtime/__init__.py +59 -0
  45. brainpalace_cli-26.5.1/brainpalace_cli/runtime/claude_converter.py +155 -0
  46. brainpalace_cli-26.5.1/brainpalace_cli/runtime/codex_converter.py +215 -0
  47. brainpalace_cli-26.5.1/brainpalace_cli/runtime/converter_base.py +73 -0
  48. brainpalace_cli-26.5.1/brainpalace_cli/runtime/gemini_converter.py +119 -0
  49. brainpalace_cli-26.5.1/brainpalace_cli/runtime/opencode_converter.py +234 -0
  50. brainpalace_cli-26.5.1/brainpalace_cli/runtime/parser.py +333 -0
  51. brainpalace_cli-26.5.1/brainpalace_cli/runtime/skill_runtime_converter.py +234 -0
  52. brainpalace_cli-26.5.1/brainpalace_cli/runtime/tool_maps.py +98 -0
  53. brainpalace_cli-26.5.1/brainpalace_cli/runtime/types.py +125 -0
  54. brainpalace_cli-26.5.1/brainpalace_cli/xdg_paths.py +142 -0
  55. brainpalace_cli-26.5.1/pyproject.toml +66 -0
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.1
2
+ Name: brainpalace-cli
3
+ Version: 26.5.1
4
+ Summary: BrainPalace CLI - Command-line interface for managing AI agent memory and knowledge retrieval
5
+ Home-page: https://github.com/bxw91/brainpalace
6
+ License: MIT
7
+ Keywords: brainpalace,rag,cli,ai-memory,llm-memory,semantic-search,ai-agent,claude-code,agent-memory
8
+ Author: bxw91
9
+ Requires-Python: >=3.10,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Dist: brainpalace-rag (>=26.5.1,<27.0.0)
19
+ Requires-Dist: click (>=8.1.0,<9.0.0)
20
+ Requires-Dist: httpx (>=0.28.0,<0.29.0)
21
+ Requires-Dist: mcp (>=1.0,<2.0)
22
+ Requires-Dist: pydantic (>=2.10.0,<3.0.0)
23
+ Requires-Dist: pyyaml (>=6.0.0,<7.0.0)
24
+ Requires-Dist: rich (>=13.9.0,<14.0.0)
25
+ Project-URL: Documentation, https://github.com/bxw91/brainpalace#readme
26
+ Project-URL: Repository, https://github.com/bxw91/brainpalace
27
+ Description-Content-Type: text/markdown
28
+
29
+ # BrainPalace CLI
30
+
31
+ > Command-line interface for managing AI agent memory and knowledge retrieval with the **BrainPalace** RAG server.
32
+
33
+ **BrainPalace** (formerly doc-serve) is an intelligent document indexing and semantic search system designed to give AI agents long-term memory. This CLI provides a convenient way to manage your BrainPalace server and knowledge base.
34
+
35
+ [![PyPI version](https://badge.fury.io/py/brainpalace-cli.svg)](https://pypi.org/project/brainpalace-cli/)
36
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
37
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
38
+
39
+ ## Why BrainPalace?
40
+
41
+ AI agents need persistent memory to be truly useful. BrainPalace provides the retrieval infrastructure that enables context-aware, knowledge-grounded AI interactions.
42
+
43
+ ### Search Capabilities
44
+
45
+ | Search Type | Description | Best For |
46
+ |-------------|-------------|----------|
47
+ | **Semantic Search** | Natural language queries using OpenAI embeddings | Conceptual questions, related content |
48
+ | **Keyword Search (BM25)** | Traditional keyword matching with TF-IDF ranking | Exact matches, technical terms |
49
+ | **Hybrid Search** | Combines vector + BM25 approaches | General-purpose queries |
50
+ | **GraphRAG** | Knowledge graph retrieval | Understanding relationships |
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ pip install brainpalace-cli
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ ```bash
61
+ brainpalace init # Initialize project
62
+ brainpalace start # Start server
63
+ brainpalace index ./docs # Index documents
64
+ brainpalace query "search term"
65
+ ```
66
+
67
+ > **Note**: The legacy command `doc-svr-ctl` is still available but deprecated. Please use `brainpalace` for new installations.
68
+
69
+ ## Development Installation
70
+
71
+ ```bash
72
+ cd brainpalace-cli
73
+ poetry install
74
+ ```
75
+
76
+ ## Usage
77
+
78
+ ```bash
79
+ # Check server status
80
+ brainpalace status
81
+
82
+ # Search documents
83
+ brainpalace query "how to use python"
84
+
85
+ # Index documents from a folder
86
+ brainpalace index ./docs
87
+
88
+ # Reset/clear the index
89
+ brainpalace reset --yes
90
+ ```
91
+
92
+ ## Configuration
93
+
94
+ Set the server URL via environment variable:
95
+
96
+ ```bash
97
+ export BRAINPALACE_URL=http://localhost:8000
98
+ ```
99
+
100
+ Or use the `--url` flag:
101
+
102
+ ```bash
103
+ brainpalace --url http://localhost:8000 status
104
+ ```
105
+
106
+ > **Note**: The legacy environment variable `DOC_SERVE_URL` is still supported for backwards compatibility.
107
+
108
+ ## Commands
109
+
110
+ ### Server Management
111
+
112
+ | Command | Description |
113
+ |---------|-------------|
114
+ | `init` | Initialize project for BrainPalace (creates `.claude/brainpalace/`) |
115
+ | `start` | Start the BrainPalace server for current project |
116
+ | `stop` | Stop the running server |
117
+ | `list` | List all running BrainPalace instances |
118
+ | `status` | Check server health and indexing status |
119
+
120
+ ### Data Management
121
+
122
+ | Command | Description |
123
+ |---------|-------------|
124
+ | `query` | Search indexed documents |
125
+ | `index` | Start indexing documents from a folder |
126
+ | `reset` | Clear all indexed documents |
127
+
128
+ ## Options
129
+
130
+ All commands support:
131
+ - `--url` - Server URL (or `BRAINPALACE_URL` / `DOC_SERVE_URL` env var)
132
+ - `--json` - Output as JSON for scripting
133
+
134
+ ## Example Workflow
135
+
136
+ ```bash
137
+ # 1. Initialize a new project
138
+ cd my-project
139
+ brainpalace init
140
+
141
+ # 2. Start the server
142
+ brainpalace start
143
+
144
+ # 3. Index your documentation
145
+ brainpalace index ./docs ./src
146
+
147
+ # 4. Query your knowledge base
148
+ brainpalace query "How does authentication work?"
149
+
150
+ # 5. Stop when done
151
+ brainpalace stop
152
+ ```
153
+
154
+ ## Documentation
155
+
156
+ - [User Guide](https://github.com/bxw91/brainpalace/wiki/User-Guide) - Getting started and usage
157
+ - [Developer Guide](https://github.com/bxw91/brainpalace/wiki/Developer-Guide) - Contributing and development
158
+ - [API Reference](https://github.com/bxw91/brainpalace/wiki/API-Reference) - Full API documentation
159
+
160
+ ## Release Information
161
+
162
+ - **Current Version**: See [pyproject.toml](./pyproject.toml)
163
+ - **Release Notes**: [GitHub Releases](https://github.com/bxw91/brainpalace/releases)
164
+ - **Changelog**: [Latest Release](https://github.com/bxw91/brainpalace/releases/latest)
165
+
166
+ ## Related Packages
167
+
168
+ - [brainpalace-rag](https://pypi.org/project/brainpalace-rag/) - The RAG server that powers BrainPalace
169
+
170
+ ## License
171
+
172
+ MIT
173
+
@@ -0,0 +1,144 @@
1
+ # BrainPalace CLI
2
+
3
+ > Command-line interface for managing AI agent memory and knowledge retrieval with the **BrainPalace** RAG server.
4
+
5
+ **BrainPalace** (formerly doc-serve) is an intelligent document indexing and semantic search system designed to give AI agents long-term memory. This CLI provides a convenient way to manage your BrainPalace server and knowledge base.
6
+
7
+ [![PyPI version](https://badge.fury.io/py/brainpalace-cli.svg)](https://pypi.org/project/brainpalace-cli/)
8
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
+
11
+ ## Why BrainPalace?
12
+
13
+ AI agents need persistent memory to be truly useful. BrainPalace provides the retrieval infrastructure that enables context-aware, knowledge-grounded AI interactions.
14
+
15
+ ### Search Capabilities
16
+
17
+ | Search Type | Description | Best For |
18
+ |-------------|-------------|----------|
19
+ | **Semantic Search** | Natural language queries using OpenAI embeddings | Conceptual questions, related content |
20
+ | **Keyword Search (BM25)** | Traditional keyword matching with TF-IDF ranking | Exact matches, technical terms |
21
+ | **Hybrid Search** | Combines vector + BM25 approaches | General-purpose queries |
22
+ | **GraphRAG** | Knowledge graph retrieval | Understanding relationships |
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pip install brainpalace-cli
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ ```bash
33
+ brainpalace init # Initialize project
34
+ brainpalace start # Start server
35
+ brainpalace index ./docs # Index documents
36
+ brainpalace query "search term"
37
+ ```
38
+
39
+ > **Note**: The legacy command `doc-svr-ctl` is still available but deprecated. Please use `brainpalace` for new installations.
40
+
41
+ ## Development Installation
42
+
43
+ ```bash
44
+ cd brainpalace-cli
45
+ poetry install
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ```bash
51
+ # Check server status
52
+ brainpalace status
53
+
54
+ # Search documents
55
+ brainpalace query "how to use python"
56
+
57
+ # Index documents from a folder
58
+ brainpalace index ./docs
59
+
60
+ # Reset/clear the index
61
+ brainpalace reset --yes
62
+ ```
63
+
64
+ ## Configuration
65
+
66
+ Set the server URL via environment variable:
67
+
68
+ ```bash
69
+ export BRAINPALACE_URL=http://localhost:8000
70
+ ```
71
+
72
+ Or use the `--url` flag:
73
+
74
+ ```bash
75
+ brainpalace --url http://localhost:8000 status
76
+ ```
77
+
78
+ > **Note**: The legacy environment variable `DOC_SERVE_URL` is still supported for backwards compatibility.
79
+
80
+ ## Commands
81
+
82
+ ### Server Management
83
+
84
+ | Command | Description |
85
+ |---------|-------------|
86
+ | `init` | Initialize project for BrainPalace (creates `.claude/brainpalace/`) |
87
+ | `start` | Start the BrainPalace server for current project |
88
+ | `stop` | Stop the running server |
89
+ | `list` | List all running BrainPalace instances |
90
+ | `status` | Check server health and indexing status |
91
+
92
+ ### Data Management
93
+
94
+ | Command | Description |
95
+ |---------|-------------|
96
+ | `query` | Search indexed documents |
97
+ | `index` | Start indexing documents from a folder |
98
+ | `reset` | Clear all indexed documents |
99
+
100
+ ## Options
101
+
102
+ All commands support:
103
+ - `--url` - Server URL (or `BRAINPALACE_URL` / `DOC_SERVE_URL` env var)
104
+ - `--json` - Output as JSON for scripting
105
+
106
+ ## Example Workflow
107
+
108
+ ```bash
109
+ # 1. Initialize a new project
110
+ cd my-project
111
+ brainpalace init
112
+
113
+ # 2. Start the server
114
+ brainpalace start
115
+
116
+ # 3. Index your documentation
117
+ brainpalace index ./docs ./src
118
+
119
+ # 4. Query your knowledge base
120
+ brainpalace query "How does authentication work?"
121
+
122
+ # 5. Stop when done
123
+ brainpalace stop
124
+ ```
125
+
126
+ ## Documentation
127
+
128
+ - [User Guide](https://github.com/bxw91/brainpalace/wiki/User-Guide) - Getting started and usage
129
+ - [Developer Guide](https://github.com/bxw91/brainpalace/wiki/Developer-Guide) - Contributing and development
130
+ - [API Reference](https://github.com/bxw91/brainpalace/wiki/API-Reference) - Full API documentation
131
+
132
+ ## Release Information
133
+
134
+ - **Current Version**: See [pyproject.toml](./pyproject.toml)
135
+ - **Release Notes**: [GitHub Releases](https://github.com/bxw91/brainpalace/releases)
136
+ - **Changelog**: [Latest Release](https://github.com/bxw91/brainpalace/releases/latest)
137
+
138
+ ## Related Packages
139
+
140
+ - [brainpalace-rag](https://pypi.org/project/brainpalace-rag/) - The RAG server that powers BrainPalace
141
+
142
+ ## License
143
+
144
+ MIT
@@ -0,0 +1,3 @@
1
+ """Doc-Serve CLI - Command-line interface for managing Doc-Serve server."""
2
+
3
+ __version__ = "26.5.1"
@@ -0,0 +1,131 @@
1
+ """Main CLI entry point for brainpalace CLI.
2
+
3
+ This module provides the command-line interface for managing and querying
4
+ the BrainPalace RAG server.
5
+ """
6
+
7
+ import click
8
+
9
+ from . import __version__
10
+ from .commands import (
11
+ cache_group,
12
+ config_group,
13
+ context_command,
14
+ doctor_command,
15
+ folders_group,
16
+ index_command,
17
+ init_command,
18
+ inject_command,
19
+ install_agent_command,
20
+ jobs_command,
21
+ list_command,
22
+ mcp_command,
23
+ memories_group,
24
+ query_command,
25
+ recall_command,
26
+ remember_command,
27
+ reset_command,
28
+ start_command,
29
+ status_command,
30
+ stop_command,
31
+ submit_session_command,
32
+ types_group,
33
+ uninstall_command,
34
+ whoami_command,
35
+ )
36
+
37
+
38
+ @click.group()
39
+ @click.version_option(version=__version__, prog_name="brainpalace")
40
+ def cli() -> None:
41
+ """BrainPalace CLI - Manage and query the BrainPalace RAG server.
42
+
43
+ A command-line interface for interacting with the BrainPalace document
44
+ indexing and semantic search API.
45
+
46
+ \b
47
+ Project Commands:
48
+ init Initialize a new brainpalace project
49
+ start Start the server for this project
50
+ stop Stop the server for this project
51
+ list List all running brainpalace instances
52
+
53
+ \b
54
+ Server Commands:
55
+ status Check server status
56
+ query Search documents
57
+ index Index documents from a folder
58
+ inject Index documents with content injection
59
+ jobs View and manage job queue
60
+ reset Clear all indexed documents
61
+
62
+ \b
63
+ Cache Commands:
64
+ cache Manage the embedding cache (status, clear)
65
+
66
+ \b
67
+ Folder Commands:
68
+ folders Manage indexed folders (list, add, remove)
69
+
70
+ \b
71
+ File Type Commands:
72
+ types List available file type presets
73
+
74
+ \b
75
+ MCP (Model Context Protocol):
76
+ mcp Serve BrainPalace over stdio for MCP-aware AI clients
77
+
78
+ \b
79
+ Examples:
80
+ brainpalace init # Initialize project
81
+ brainpalace start # Start server
82
+ brainpalace status # Check server status
83
+ brainpalace query "how to use python" # Search documents
84
+ brainpalace index ./docs # Index documents
85
+ brainpalace index ./src --include-type python # Index with preset
86
+ brainpalace inject --script enrich.py ./docs # Index with injection
87
+ brainpalace folders list # List indexed folders
88
+ brainpalace folders remove ./docs --yes # Remove folder chunks
89
+ brainpalace types list # Show file type presets
90
+ brainpalace stop # Stop server
91
+
92
+ \b
93
+ Environment Variables:
94
+ BRAINPALACE_URL Server URL (default: http://127.0.0.1:8000)
95
+ """
96
+ pass
97
+
98
+
99
+ # Register project management commands
100
+ cli.add_command(init_command, name="init")
101
+ cli.add_command(start_command, name="start")
102
+ cli.add_command(stop_command, name="stop")
103
+ cli.add_command(list_command, name="list")
104
+ cli.add_command(whoami_command, name="whoami")
105
+
106
+ # Register server interaction commands
107
+ cli.add_command(doctor_command, name="doctor")
108
+ cli.add_command(status_command, name="status")
109
+ cli.add_command(query_command, name="query")
110
+ cli.add_command(remember_command, name="remember")
111
+ cli.add_command(recall_command, name="recall")
112
+ cli.add_command(memories_group, name="memories")
113
+ cli.add_command(context_command, name="context")
114
+ cli.add_command(submit_session_command, name="submit-session")
115
+ cli.add_command(index_command, name="index")
116
+ cli.add_command(inject_command, name="inject")
117
+ cli.add_command(jobs_command, name="jobs")
118
+ cli.add_command(reset_command, name="reset")
119
+ cli.add_command(config_group, name="config")
120
+ cli.add_command(folders_group, name="folders")
121
+ cli.add_command(types_group, name="types")
122
+ cli.add_command(cache_group, name="cache")
123
+ cli.add_command(uninstall_command, name="uninstall")
124
+ cli.add_command(install_agent_command, name="install-agent")
125
+
126
+ # Register MCP server (opt-in stdio shim for non-Claude-Code AI clients)
127
+ cli.add_command(mcp_command, name="mcp")
128
+
129
+
130
+ if __name__ == "__main__":
131
+ cli()
@@ -0,0 +1,20 @@
1
+ """HTTP client for communicating with BrainPalace server."""
2
+
3
+ from .api_client import (
4
+ ConnectionError,
5
+ DocServeClient,
6
+ DocServeError,
7
+ FolderInfo,
8
+ ServerError,
9
+ )
10
+ from .errors import EXIT_CODE_CONNECTION_ERROR, exit_on_connection_error
11
+
12
+ __all__ = [
13
+ "DocServeClient",
14
+ "DocServeError",
15
+ "ConnectionError",
16
+ "EXIT_CODE_CONNECTION_ERROR",
17
+ "FolderInfo",
18
+ "ServerError",
19
+ "exit_on_connection_error",
20
+ ]