bindai-cli 0.1.7__tar.gz → 0.2.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.
Potentially problematic release.
This version of bindai-cli might be problematic. Click here for more details.
- bindai_cli-0.2.0/PKG-INFO +186 -0
- bindai_cli-0.2.0/README.md +174 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/pyproject.toml +5 -3
- bindai_cli-0.2.0/src/bindai_cli/__init__.py +1 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/__main__.py +3 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/app.py +15 -4
- bindai_cli-0.2.0/src/bindai_cli/commands/config.py +204 -0
- bindai_cli-0.2.0/src/bindai_cli/commands/connections.py +144 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/commands/doctor.py +53 -0
- bindai_cli-0.2.0/src/bindai_cli/commands/new.py +116 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/commands/version.py +1 -1
- bindai_cli-0.2.0/src/bindai_cli/scaffolds/basic/__pycache__/main.cpython-314.pyc +0 -0
- bindai_cli-0.2.0/src/bindai_cli/scaffolds/basic/agents/__pycache__/assistant.cpython-314.pyc +0 -0
- bindai_cli-0.2.0/src/bindai_cli/scaffolds/basic/agents/assistant.py +3 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/main.py +2 -2
- bindai_cli-0.2.0/src/bindai_cli/scaffolds/basic/requirements.txt +1 -0
- bindai_cli-0.2.0/src/bindai_cli/scaffolds/basic/tools/__pycache__/echo.cpython-314.pyc +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/templates/registry.py +23 -6
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/templates/validator.py +0 -1
- bindai_cli-0.2.0/src/bindai_cli/templates/workflow-basic/template.json +15 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/utils/scaffold.py +2 -2
- bindai_cli-0.2.0/src/bindai_cli.egg-info/PKG-INFO +186 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli.egg-info/SOURCES.txt +13 -1
- bindai_cli-0.2.0/src/bindai_cli.egg-info/requires.txt +5 -0
- bindai_cli-0.2.0/tests/test_app.py +17 -0
- bindai_cli-0.2.0/tests/test_config.py +461 -0
- bindai_cli-0.2.0/tests/test_connections.py +416 -0
- bindai_cli-0.2.0/tests/test_doctor.py +170 -0
- bindai_cli-0.2.0/tests/test_new.py +208 -0
- bindai_cli-0.2.0/tests/test_run.py +114 -0
- bindai_cli-0.2.0/tests/test_templates.py +64 -0
- bindai_cli-0.1.7/PKG-INFO +0 -9
- bindai_cli-0.1.7/README.md +0 -3
- bindai_cli-0.1.7/src/bindai_cli/__init__.py +0 -1
- bindai_cli-0.1.7/src/bindai_cli/commands/new.py +0 -84
- bindai_cli-0.1.7/src/bindai_cli/scaffolds/basic/agents/assistant.py +0 -7
- bindai_cli-0.1.7/src/bindai_cli/scaffolds/basic/requirements.txt +0 -1
- bindai_cli-0.1.7/src/bindai_cli/templates/workflow-basic/template.json +0 -14
- bindai_cli-0.1.7/src/bindai_cli.egg-info/PKG-INFO +0 -9
- bindai_cli-0.1.7/src/bindai_cli.egg-info/requires.txt +0 -4
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/setup.cfg +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/commands/__init__.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/commands/add.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/commands/inspect.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/commands/run.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/commands/template.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/commands/workflow.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/generators/__init__.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/generators/agent.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/generators/directories.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/generators/knowledge.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/generators/memory.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/generators/pyproject.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/generators/tool.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/generators/workflow.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/inspectors/project.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/.env.example +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/.gitignore +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/LICENSE +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/README.md +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/bindai.toml +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/knowledge/.gitkeep +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/memory/.gitkeep +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/templates/.gitkeep +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/tests/.gitkeep +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/tools/.gitkeep +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/tools/echo.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/scaffolds/basic/workflows/.gitkeep +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/templates/installer.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/templates/models.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/utils/config.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/utils/providers.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/workflows/graph.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli/workflows/validator.py +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli.egg-info/dependency_links.txt +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli.egg-info/entry_points.txt +0 -0
- {bindai_cli-0.1.7 → bindai_cli-0.2.0}/src/bindai_cli.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bindai-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: BindAI Command Line Interface
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: typer>=0.16
|
|
8
|
+
Requires-Dist: rich>=14.0
|
|
9
|
+
Requires-Dist: python-dotenv>=1.0
|
|
10
|
+
Requires-Dist: bindai-config>=0.2.0
|
|
11
|
+
Requires-Dist: bindai-connections[credentials]>=0.2.0
|
|
12
|
+
|
|
13
|
+
# BindAI CLI
|
|
14
|
+
|
|
15
|
+
`bindai-cli` provides the command-line interface for creating, inspecting, developing, and managing BindAI projects.
|
|
16
|
+
|
|
17
|
+
The CLI is designed to provide a convenient developer workflow around the BindAI framework and its project structure.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
The BindAI CLI provides commands for common development tasks, including:
|
|
22
|
+
|
|
23
|
+
* Project creation
|
|
24
|
+
* Project scaffolding
|
|
25
|
+
* BindAI environment inspection
|
|
26
|
+
* Framework diagnostics
|
|
27
|
+
* Project creation
|
|
28
|
+
* Development utilities
|
|
29
|
+
* CLI-based project management
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
The CLI is included as the `bindai-cli` package in the BindAI workspace.
|
|
34
|
+
|
|
35
|
+
For development from the BindAI repository:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv sync
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The CLI can then be executed with:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
uv run bindai
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Common Commands
|
|
48
|
+
|
|
49
|
+
### Doctor
|
|
50
|
+
|
|
51
|
+
Run BindAI diagnostics:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
bindai doctor
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This command is intended to help identify configuration or environment issues.
|
|
58
|
+
|
|
59
|
+
### Inspect
|
|
60
|
+
|
|
61
|
+
Inspect the current BindAI environment or project:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bindai inspect
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Create a Project
|
|
68
|
+
|
|
69
|
+
Create a new BindAI project:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bindai new my-project
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The generated project can then be developed independently while using the BindAI framework.
|
|
76
|
+
|
|
77
|
+
## Project Scaffolding
|
|
78
|
+
|
|
79
|
+
The CLI includes templates and scaffolding resources for creating BindAI projects.
|
|
80
|
+
|
|
81
|
+
A typical workflow is:
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
bindai new my-project
|
|
85
|
+
│
|
|
86
|
+
▼
|
|
87
|
+
Project files
|
|
88
|
+
│
|
|
89
|
+
▼
|
|
90
|
+
Configure project
|
|
91
|
+
│
|
|
92
|
+
▼
|
|
93
|
+
Add agents / workflows
|
|
94
|
+
│
|
|
95
|
+
▼
|
|
96
|
+
Develop
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The package includes its CLI templates and scaffolding resources as package data so they can be distributed with the CLI.
|
|
100
|
+
|
|
101
|
+
## Development
|
|
102
|
+
|
|
103
|
+
`bindai-cli` is part of the BindAI workspace.
|
|
104
|
+
|
|
105
|
+
From the repository root:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
uv sync
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Run the CLI:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
uv run bindai
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Run the complete test suite:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
uv run pytest
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Run static type checking:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
uv run mypy packages/bindai-cli
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Build the package:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
uv build --package bindai-cli
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Package API
|
|
136
|
+
|
|
137
|
+
The package currently exposes its version through:
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from bindai_cli import __version__
|
|
141
|
+
|
|
142
|
+
print(__version__)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Current version:
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
0.1.8
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The primary public interface of this package is the command-line application rather than a large Python API.
|
|
152
|
+
|
|
153
|
+
## Architecture
|
|
154
|
+
|
|
155
|
+
The CLI sits at the developer-facing edge of the BindAI platform:
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
Developer
|
|
159
|
+
│
|
|
160
|
+
▼
|
|
161
|
+
BindAI CLI
|
|
162
|
+
│
|
|
163
|
+
├── Diagnostics
|
|
164
|
+
├── Inspection
|
|
165
|
+
├── Initialization
|
|
166
|
+
└── Project Scaffolding
|
|
167
|
+
│
|
|
168
|
+
▼
|
|
169
|
+
BindAI Project
|
|
170
|
+
│
|
|
171
|
+
┌─────┼─────┐
|
|
172
|
+
▼ ▼ ▼
|
|
173
|
+
Agents Workflows Tools
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
This keeps command-line concerns separate from the core BindAI runtime and framework packages.
|
|
177
|
+
|
|
178
|
+
## Documentation
|
|
179
|
+
|
|
180
|
+
Full BindAI documentation is available at:
|
|
181
|
+
|
|
182
|
+
https://docs.bindai.dev
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
BindAI is released under the MIT License.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# BindAI CLI
|
|
2
|
+
|
|
3
|
+
`bindai-cli` provides the command-line interface for creating, inspecting, developing, and managing BindAI projects.
|
|
4
|
+
|
|
5
|
+
The CLI is designed to provide a convenient developer workflow around the BindAI framework and its project structure.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
The BindAI CLI provides commands for common development tasks, including:
|
|
10
|
+
|
|
11
|
+
* Project creation
|
|
12
|
+
* Project scaffolding
|
|
13
|
+
* BindAI environment inspection
|
|
14
|
+
* Framework diagnostics
|
|
15
|
+
* Project creation
|
|
16
|
+
* Development utilities
|
|
17
|
+
* CLI-based project management
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
The CLI is included as the `bindai-cli` package in the BindAI workspace.
|
|
22
|
+
|
|
23
|
+
For development from the BindAI repository:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
uv sync
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The CLI can then be executed with:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uv run bindai
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Common Commands
|
|
36
|
+
|
|
37
|
+
### Doctor
|
|
38
|
+
|
|
39
|
+
Run BindAI diagnostics:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
bindai doctor
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This command is intended to help identify configuration or environment issues.
|
|
46
|
+
|
|
47
|
+
### Inspect
|
|
48
|
+
|
|
49
|
+
Inspect the current BindAI environment or project:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
bindai inspect
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Create a Project
|
|
56
|
+
|
|
57
|
+
Create a new BindAI project:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
bindai new my-project
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The generated project can then be developed independently while using the BindAI framework.
|
|
64
|
+
|
|
65
|
+
## Project Scaffolding
|
|
66
|
+
|
|
67
|
+
The CLI includes templates and scaffolding resources for creating BindAI projects.
|
|
68
|
+
|
|
69
|
+
A typical workflow is:
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
bindai new my-project
|
|
73
|
+
│
|
|
74
|
+
▼
|
|
75
|
+
Project files
|
|
76
|
+
│
|
|
77
|
+
▼
|
|
78
|
+
Configure project
|
|
79
|
+
│
|
|
80
|
+
▼
|
|
81
|
+
Add agents / workflows
|
|
82
|
+
│
|
|
83
|
+
▼
|
|
84
|
+
Develop
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The package includes its CLI templates and scaffolding resources as package data so they can be distributed with the CLI.
|
|
88
|
+
|
|
89
|
+
## Development
|
|
90
|
+
|
|
91
|
+
`bindai-cli` is part of the BindAI workspace.
|
|
92
|
+
|
|
93
|
+
From the repository root:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
uv sync
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Run the CLI:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
uv run bindai
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Run the complete test suite:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
uv run pytest
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Run static type checking:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
uv run mypy packages/bindai-cli
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Build the package:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
uv build --package bindai-cli
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Package API
|
|
124
|
+
|
|
125
|
+
The package currently exposes its version through:
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from bindai_cli import __version__
|
|
129
|
+
|
|
130
|
+
print(__version__)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Current version:
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
0.1.8
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The primary public interface of this package is the command-line application rather than a large Python API.
|
|
140
|
+
|
|
141
|
+
## Architecture
|
|
142
|
+
|
|
143
|
+
The CLI sits at the developer-facing edge of the BindAI platform:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
Developer
|
|
147
|
+
│
|
|
148
|
+
▼
|
|
149
|
+
BindAI CLI
|
|
150
|
+
│
|
|
151
|
+
├── Diagnostics
|
|
152
|
+
├── Inspection
|
|
153
|
+
├── Initialization
|
|
154
|
+
└── Project Scaffolding
|
|
155
|
+
│
|
|
156
|
+
▼
|
|
157
|
+
BindAI Project
|
|
158
|
+
│
|
|
159
|
+
┌─────┼─────┐
|
|
160
|
+
▼ ▼ ▼
|
|
161
|
+
Agents Workflows Tools
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
This keeps command-line concerns separate from the core BindAI runtime and framework packages.
|
|
165
|
+
|
|
166
|
+
## Documentation
|
|
167
|
+
|
|
168
|
+
Full BindAI documentation is available at:
|
|
169
|
+
|
|
170
|
+
https://docs.bindai.dev
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
BindAI is released under the MIT License.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "bindai-cli"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
description = "BindAI Command Line Interface"
|
|
5
|
+
readme = "README.md"
|
|
5
6
|
requires-python = ">=3.11"
|
|
6
7
|
|
|
7
8
|
dependencies = [
|
|
8
9
|
"typer>=0.16",
|
|
9
10
|
"rich>=14.0",
|
|
10
11
|
"python-dotenv>=1.0",
|
|
11
|
-
"bindai-config>=0.
|
|
12
|
+
"bindai-config>=0.2.0",
|
|
13
|
+
"bindai-connections[credentials]>=0.2.0",
|
|
12
14
|
]
|
|
13
15
|
|
|
14
16
|
[project.scripts]
|
|
@@ -26,4 +28,4 @@ bindai_cli = [
|
|
|
26
28
|
"templates/*/template.json",
|
|
27
29
|
"scaffolds/**/*",
|
|
28
30
|
"scaffolds/**/.*",
|
|
29
|
-
]
|
|
31
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.8"
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import typer
|
|
2
2
|
|
|
3
|
+
from bindai_cli.commands.config import app as config_app
|
|
4
|
+
from bindai_cli.commands.connections import app as connections_app
|
|
3
5
|
from bindai_cli.commands.doctor import app as doctor_app
|
|
4
6
|
from bindai_cli.commands.inspect import app as inspect_app
|
|
5
|
-
from bindai_cli.commands.new import
|
|
7
|
+
from bindai_cli.commands.new import new
|
|
6
8
|
from bindai_cli.commands.run import app as run_app
|
|
7
9
|
from bindai_cli.commands.template import app as template_app
|
|
8
10
|
from bindai_cli.commands.version import app as version_app
|
|
@@ -23,10 +25,9 @@ app.add_typer(
|
|
|
23
25
|
name="doctor",
|
|
24
26
|
)
|
|
25
27
|
|
|
26
|
-
app.
|
|
27
|
-
new_app,
|
|
28
|
+
app.command(
|
|
28
29
|
name="new",
|
|
29
|
-
)
|
|
30
|
+
)(new)
|
|
30
31
|
|
|
31
32
|
app.add_typer(
|
|
32
33
|
run_app,
|
|
@@ -47,3 +48,13 @@ app.add_typer(
|
|
|
47
48
|
inspect_app,
|
|
48
49
|
name="inspect",
|
|
49
50
|
)
|
|
51
|
+
|
|
52
|
+
app.add_typer(
|
|
53
|
+
config_app,
|
|
54
|
+
name="config",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
app.add_typer(
|
|
58
|
+
connections_app,
|
|
59
|
+
name="connections",
|
|
60
|
+
)
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import fields
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, get_args, get_type_hints
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
from bindai_config import ProjectConfig, ProjectRuntime, TomlWriter
|
|
9
|
+
from rich.console import Console
|
|
10
|
+
from rich.table import Table
|
|
11
|
+
|
|
12
|
+
app = typer.Typer(
|
|
13
|
+
help="Inspect and modify BindAI project configuration.",
|
|
14
|
+
no_args_is_help=True,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
console = Console()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@app.command(name="list")
|
|
21
|
+
def list_config() -> None:
|
|
22
|
+
"""
|
|
23
|
+
List effective project configuration and its source.
|
|
24
|
+
"""
|
|
25
|
+
runtime = ProjectRuntime(Path.cwd())
|
|
26
|
+
values = runtime.resolver.all()
|
|
27
|
+
|
|
28
|
+
table = Table(title="Configuration")
|
|
29
|
+
table.add_column("Name", style="cyan")
|
|
30
|
+
table.add_column("Value")
|
|
31
|
+
table.add_column("Source")
|
|
32
|
+
|
|
33
|
+
for name, config_value in values.items():
|
|
34
|
+
table.add_row(
|
|
35
|
+
name,
|
|
36
|
+
str(config_value.value),
|
|
37
|
+
config_value.source,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
console.print(table)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@app.command(name="get")
|
|
44
|
+
def get_config(
|
|
45
|
+
name: str = typer.Argument(
|
|
46
|
+
...,
|
|
47
|
+
help="Configuration field to inspect.",
|
|
48
|
+
),
|
|
49
|
+
) -> None:
|
|
50
|
+
"""
|
|
51
|
+
Show one effective configuration value and its source.
|
|
52
|
+
"""
|
|
53
|
+
runtime = ProjectRuntime(Path.cwd())
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
config_value = runtime.resolver.resolve(name)
|
|
57
|
+
except KeyError as exc:
|
|
58
|
+
raise typer.BadParameter(
|
|
59
|
+
f'Unknown configuration field "{name}".',
|
|
60
|
+
) from exc
|
|
61
|
+
|
|
62
|
+
console.print(f"{name} = {config_value.value}")
|
|
63
|
+
console.print(f"source = {config_value.source}")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@app.command(name="set")
|
|
67
|
+
def set_config(
|
|
68
|
+
name: str = typer.Argument(
|
|
69
|
+
...,
|
|
70
|
+
help="Configuration field to update.",
|
|
71
|
+
),
|
|
72
|
+
value: str = typer.Argument(
|
|
73
|
+
...,
|
|
74
|
+
help="Value to persist in bindai.toml.",
|
|
75
|
+
),
|
|
76
|
+
) -> None:
|
|
77
|
+
"""
|
|
78
|
+
Set one project configuration value in bindai.toml.
|
|
79
|
+
"""
|
|
80
|
+
config_path = Path.cwd() / "bindai.toml"
|
|
81
|
+
|
|
82
|
+
if not config_path.exists():
|
|
83
|
+
raise typer.BadParameter(
|
|
84
|
+
f'No bindai.toml found in "{Path.cwd()}".',
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
expected_type = _field_type(name)
|
|
89
|
+
converted_value = _convert_value(
|
|
90
|
+
name,
|
|
91
|
+
value,
|
|
92
|
+
expected_type,
|
|
93
|
+
)
|
|
94
|
+
except KeyError as exc:
|
|
95
|
+
raise typer.BadParameter(str(exc).strip("'")) from exc
|
|
96
|
+
except ValueError as exc:
|
|
97
|
+
raise typer.BadParameter(str(exc)) from exc
|
|
98
|
+
|
|
99
|
+
try:
|
|
100
|
+
TomlWriter().set(
|
|
101
|
+
config_path,
|
|
102
|
+
name,
|
|
103
|
+
converted_value,
|
|
104
|
+
)
|
|
105
|
+
except (TypeError, ValueError) as exc:
|
|
106
|
+
raise typer.BadParameter(str(exc)) from exc
|
|
107
|
+
|
|
108
|
+
console.print(
|
|
109
|
+
f'Set {name} = {converted_value!r} in {config_path.name}.',
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@app.command(name="path")
|
|
114
|
+
def config_path() -> None:
|
|
115
|
+
"""
|
|
116
|
+
Show the path to the active bindai.toml file.
|
|
117
|
+
"""
|
|
118
|
+
config_path = Path.cwd() / "bindai.toml"
|
|
119
|
+
|
|
120
|
+
if not config_path.exists():
|
|
121
|
+
raise typer.BadParameter(
|
|
122
|
+
f'No bindai.toml found in "{Path.cwd()}".',
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
console.print(config_path.resolve())
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _field_type(name: str) -> Any:
|
|
129
|
+
config_fields = {
|
|
130
|
+
field.name: field
|
|
131
|
+
for field in fields(ProjectConfig)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if name not in config_fields:
|
|
135
|
+
raise KeyError(
|
|
136
|
+
f'Unknown configuration field "{name}".'
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
return get_type_hints(ProjectConfig)[name]
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def _convert_value(
|
|
143
|
+
name: str,
|
|
144
|
+
value: str,
|
|
145
|
+
expected_type: Any,
|
|
146
|
+
) -> Any:
|
|
147
|
+
expected_types = get_args(expected_type)
|
|
148
|
+
|
|
149
|
+
if expected_types:
|
|
150
|
+
non_none_types = tuple(
|
|
151
|
+
item
|
|
152
|
+
for item in expected_types
|
|
153
|
+
if item is not type(None)
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
if len(non_none_types) == 1:
|
|
157
|
+
return _convert_value(
|
|
158
|
+
name,
|
|
159
|
+
value,
|
|
160
|
+
non_none_types[0],
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
raise ValueError(
|
|
164
|
+
f'Unsupported configuration type for "{name}".',
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
if expected_type is str:
|
|
168
|
+
return value
|
|
169
|
+
|
|
170
|
+
if expected_type is int:
|
|
171
|
+
try:
|
|
172
|
+
return int(value)
|
|
173
|
+
except ValueError as exc:
|
|
174
|
+
raise ValueError(
|
|
175
|
+
f'Invalid value for "{name}": '
|
|
176
|
+
f'expected an integer, got "{value}".',
|
|
177
|
+
) from exc
|
|
178
|
+
|
|
179
|
+
if expected_type is float:
|
|
180
|
+
try:
|
|
181
|
+
return float(value)
|
|
182
|
+
except ValueError as exc:
|
|
183
|
+
raise ValueError(
|
|
184
|
+
f'Invalid value for "{name}": '
|
|
185
|
+
f'expected a number, got "{value}".',
|
|
186
|
+
) from exc
|
|
187
|
+
|
|
188
|
+
if expected_type is bool:
|
|
189
|
+
normalized = value.strip().lower()
|
|
190
|
+
|
|
191
|
+
if normalized in {"1", "true", "yes", "on"}:
|
|
192
|
+
return True
|
|
193
|
+
|
|
194
|
+
if normalized in {"0", "false", "no", "off"}:
|
|
195
|
+
return False
|
|
196
|
+
|
|
197
|
+
raise ValueError(
|
|
198
|
+
f'Invalid value for "{name}": '
|
|
199
|
+
f'expected a boolean, got "{value}".',
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
raise ValueError(
|
|
203
|
+
f'Unsupported configuration type for "{name}".',
|
|
204
|
+
)
|