pieces-cli 1.3.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.
- pieces_cli-1.3.0/LICENSE +21 -0
- pieces_cli-1.3.0/PKG-INFO +417 -0
- pieces_cli-1.3.0/README.md +392 -0
- pieces_cli-1.3.0/pyproject.toml +34 -0
- pieces_cli-1.3.0/src/pieces/__init__.py +8 -0
- pieces_cli-1.3.0/src/pieces/__main__.py +10 -0
- pieces_cli-1.3.0/src/pieces/app.py +134 -0
- pieces_cli-1.3.0/src/pieces/assets/__init__.py +2 -0
- pieces_cli-1.3.0/src/pieces/assets/assets_api.py +234 -0
- pieces_cli-1.3.0/src/pieces/assets/assets_command.py +146 -0
- pieces_cli-1.3.0/src/pieces/assets/assets_identifiers_ws.py +64 -0
- pieces_cli-1.3.0/src/pieces/autocommit/__init__.py +1 -0
- pieces_cli-1.3.0/src/pieces/autocommit/autocommit.py +217 -0
- pieces_cli-1.3.0/src/pieces/autocommit/git_api.py +50 -0
- pieces_cli-1.3.0/src/pieces/commands/__init__.py +14 -0
- pieces_cli-1.3.0/src/pieces/commands/change_model.py +22 -0
- pieces_cli-1.3.0/src/pieces/commands/cli_loop.py +97 -0
- pieces_cli-1.3.0/src/pieces/commands/extensions.json +272 -0
- pieces_cli-1.3.0/src/pieces/commands/list_command.py +61 -0
- pieces_cli-1.3.0/src/pieces/commands/search_command.py +60 -0
- pieces_cli-1.3.0/src/pieces/commands/signout_command.py +9 -0
- pieces_cli-1.3.0/src/pieces/commands/version_command.py +9 -0
- pieces_cli-1.3.0/src/pieces/copilot/__init__.py +3 -0
- pieces_cli-1.3.0/src/pieces/copilot/ask_command.py +54 -0
- pieces_cli-1.3.0/src/pieces/copilot/conversations.py +150 -0
- pieces_cli-1.3.0/src/pieces/copilot/pieces_ask_websocket.py +138 -0
- pieces_cli-1.3.0/src/pieces/gui.py +153 -0
- pieces_cli-1.3.0/src/pieces/pieces_argparser.py +65 -0
- pieces_cli-1.3.0/src/pieces/settings.py +200 -0
- pieces_cli-1.3.0/src/pieces/utils.py +42 -0
pieces_cli-1.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Pieces.app
|
|
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.
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pieces-cli
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: A powerful cli tool to interact with the pieces os
|
|
5
|
+
Home-page: https://pieces.app
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: copilot,pieces,ai,snippets
|
|
8
|
+
Author: Pieces
|
|
9
|
+
Author-email: development@pieces.app
|
|
10
|
+
Requires-Python: >=3.9,<3.13
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Dist: pieces_os_client (==1.2.7)
|
|
18
|
+
Requires-Dist: platformdirs (>=4.2.0,<5.0.0)
|
|
19
|
+
Requires-Dist: prompt-toolkit (>=3.0.43,<4.0.0)
|
|
20
|
+
Requires-Dist: pyperclip (>=1.8.2)
|
|
21
|
+
Requires-Dist: rich (>=13.7.1,<14.0.0)
|
|
22
|
+
Requires-Dist: websocket-client (==1.7.0)
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
<p align="center">
|
|
27
|
+
|
|
28
|
+
# <p align="center"> Pieces Python CLI Tool
|
|
29
|
+
|
|
30
|
+
<p align="center"> This is a comprehensive command-line interface (CLI) tool designed to interact seamlessly with Pieces OS. It provides a range of functionalities such as asset management, application interaction, and integration with various Pieces OS features.
|
|
31
|
+
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
##### <p align="center"> [Website](https://pieces.app/) • [Pieces OS Documentation](https://docs.pieces.app/) • [Pieces Python CLI Documentation](https://github.com/pieces-app/cli-agent/blob/prod/Documentation.md)
|
|
35
|
+
</p>
|
|
36
|
+
<br>
|
|
37
|
+
|
|
38
|
+
### Table of Contents
|
|
39
|
+
- [Operating System Support](#operating-system-support)
|
|
40
|
+
- [Installing](#installing)
|
|
41
|
+
- [Getting Started](#getting-started)
|
|
42
|
+
- [Terminologies](#some-important-terminologies)
|
|
43
|
+
- [Usage](#usage)
|
|
44
|
+
- [Run](#run)
|
|
45
|
+
- [List (assets,apps,models)](#list-command)
|
|
46
|
+
- [Open, Save, Create, Edit, and Delete Assets](#open)
|
|
47
|
+
- [Search and Query](#search-and-query)
|
|
48
|
+
- [Change the model](#change-the-llm-model-you-are-using)
|
|
49
|
+
- [conversations/conversation](#conversations-command)
|
|
50
|
+
- [Change Model](#change-model)
|
|
51
|
+
- [Ask a Question](#ask-a-question-to-a-model)
|
|
52
|
+
- [login and logout](#login-and-logout)
|
|
53
|
+
- [Additional Commands](#additional-commands)
|
|
54
|
+
- [Supported Versions](#supported-versions)
|
|
55
|
+
|
|
56
|
+
#### Operating System Support
|
|
57
|
+
The Pieces Python CLI Tool is compatible with various operating systems, ensuring a wide range of usage and adaptability. While it offers full support across most systems, specific features might have varied performance based on the OS environment.
|
|
58
|
+
|
|
59
|
+
The CLI Supports
|
|
60
|
+
- Windows 10 or greater
|
|
61
|
+
- Mac
|
|
62
|
+
- Windows
|
|
63
|
+
|
|
64
|
+
#### Installing
|
|
65
|
+
To get started with the Pieces Python CLI Tool, you need to:
|
|
66
|
+
|
|
67
|
+
1. Ensure Pieces OS is installed and running on your system.
|
|
68
|
+
2. Install the Python package:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install pieces-cli
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
brew install pieces-cli
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
conda install pieces-cli
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Getting Started
|
|
83
|
+
After installing the CLI tool, you can access its functionalities through the terminal. The tool is initialized with the command `pieces` followed by various subcommands and options.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Some important terminologies
|
|
87
|
+
|
|
88
|
+
- `x` -> The index
|
|
89
|
+
- `current asset` -> The asset that you are currently using can be changed by the open command
|
|
90
|
+
- `current conversation` -> The conversation that you currently using in the ask command
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### Usage
|
|
94
|
+
|
|
95
|
+
#### Run
|
|
96
|
+
The run command starts the CLI in a loop. While you can use each command without running the CLI in a loop you'll get much faster results and a better experience using run.
|
|
97
|
+
|
|
98
|
+
Once the CLI is running in a loop you can simply type the command.
|
|
99
|
+
|
|
100
|
+
For instance:
|
|
101
|
+
open
|
|
102
|
+
|
|
103
|
+
Instead of:
|
|
104
|
+
pieces open
|
|
105
|
+
|
|
106
|
+
If you have a numbered list or search open you can just type the number and it will open the asset associated.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pieces run
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### List command
|
|
113
|
+
To list assets applications or models, use the command:
|
|
114
|
+
|
|
115
|
+
##### Default of 10 assets
|
|
116
|
+
```bash
|
|
117
|
+
pieces list
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
##### Lists your x most recent assets
|
|
121
|
+
```bash
|
|
122
|
+
pieces list assets x
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
##### Lists all registered applications
|
|
126
|
+
```bash
|
|
127
|
+
pieces list apps
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
##### Lists all accessible AI models
|
|
131
|
+
```bash
|
|
132
|
+
pieces list models
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
##### Open an asset:
|
|
137
|
+
|
|
138
|
+
Opens an asset from a list or search. If only "open" is used then it will open your most recent asset. This also creates a link to the asset's code.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pieces open [ITEM_INDEX]
|
|
142
|
+
```
|
|
143
|
+
##### Save, Create, Edit, and Delete Assets
|
|
144
|
+
|
|
145
|
+
The save create edit and delete commands currrently work on the current asset which is by defualt set to the most recent one and you can change the current asset to anything using the open command above.
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
##### Save the current asset:
|
|
149
|
+
|
|
150
|
+
You need to edit the snippet code that was opened via the open command `pieces open` then save the changes to using the save command
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pieces save
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
##### Create a new asset:
|
|
157
|
+
|
|
158
|
+
Will take whatever text is copied to your clipboard and create an asset. The asset will automatically be scanned and recognized for it's file type.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
pieces create
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
##### Edit an existing asset:
|
|
165
|
+
|
|
166
|
+
This will edit the name and reclassify the current asset.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
pieces edit
|
|
170
|
+
```
|
|
171
|
+
This is used to edit both the classification and name of an asset.
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
pieces edit --name "new name"
|
|
176
|
+
```
|
|
177
|
+
to edit the name
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
pieces edit --classification python
|
|
181
|
+
```
|
|
182
|
+
to edit the classification
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
You can you -n or -c to change the name and classification respectively with the edit command.
|
|
186
|
+
|
|
187
|
+
##### Delete an asset:
|
|
188
|
+
|
|
189
|
+
This will delete an opened asset by using list or search first. If you do not have an opened asset it will open your most recent asset and ask if you'd like to delete it.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
pieces delete
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### Search and Query
|
|
196
|
+
##### Perform a fuzzy search:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
pieces search [your query]
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Finds strings that approximately match patterns. Normal search.
|
|
203
|
+
|
|
204
|
+
##### Perform a Neural Code Search:
|
|
205
|
+
```bash
|
|
206
|
+
pieces search query --mode ncs
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Uses machine learning, deep neural networks, and natural language processing. It can understand the intent of a user's search query and match it with the most relevant results.
|
|
210
|
+
|
|
211
|
+
##### Perform a Full Text Search:
|
|
212
|
+
```bash
|
|
213
|
+
pieces search query --mode fts
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Examines all words in a document to find matches to search criteria.
|
|
217
|
+
|
|
218
|
+
##### change the llm model you are using:
|
|
219
|
+
|
|
220
|
+
Change the model in the ask command.
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
pieces change_model [MODEL_INDEX]
|
|
224
|
+
```
|
|
225
|
+
##### Conversations command
|
|
226
|
+
###### Coversations
|
|
227
|
+
|
|
228
|
+
List all conversations that you have. The green conversation is the one that is currently being used in the ask command
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
pieces conversations
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
###### Conversation
|
|
235
|
+
|
|
236
|
+
List the messages in the currently using conversation in the ask command.
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
pieces conversation
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
You can create a new conversation that will be used in the ask command.
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
pieces conversation -n
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Rename a conversation
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
pieces conversation -r My awsome name
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Or you can make the model rename it for you
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
pieces conversation -r
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Delete a conversation
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
pieces conversation -d
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
You can switch the conversation and list its messages. Check the conversations command to get the index
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
pieces conversation x
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
##### Ask a question to a model:
|
|
276
|
+
**Requires quotes around question**
|
|
277
|
+
|
|
278
|
+
Ask the Pieces Copilot a question. You can add a relevant file, you can also add relevant snippets based on their index shown in the assets list command. In order to change models from the default (GPT3.5), use the `change_model` command You can add a relevance file or snippet index check the `list assets` command.
|
|
279
|
+
You can use `.` or `/` to refer to the current directory
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
pieces ask "your question" -f /file1 /file2 folder -s 1 2 3
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
##### Commiting to github
|
|
289
|
+
|
|
290
|
+
Auto commit the code to github and generate a commit message you can use the `-p` or `--push` flags to push the code to the repo too.
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
pieces commit -p
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
You can also add the `-i` or `--issues` flags so the commit message will include the issue numbers in the commit if found one else it will list all the issues to choose from.
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
pieces commit -i
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### Login and logout
|
|
303
|
+
Login to pieces
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
pieces login
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Logout from pieces
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
pieces logout
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
#### Additional Commands
|
|
316
|
+
##### Retrieve the version of Pieces OS and the CLI:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
pieces version
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
##### For a detailed help menu:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
pieces help
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
##### Supported Versions
|
|
329
|
+
- Windows 10 or Greater
|
|
330
|
+
- Mac (insert later)
|
|
331
|
+
- Linux (insert later)
|
|
332
|
+
|
|
333
|
+
It is advised to keep the CLI tool updated to the latest version to ensure compatibility with Pieces OS and access to all features. Please refer to our documentation for details on supported versions.
|
|
334
|
+
|
|
335
|
+
## Contributing
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
### Installation
|
|
339
|
+
To run this project locally, follow these steps:
|
|
340
|
+
|
|
341
|
+
1. Fork this project via GitHub.
|
|
342
|
+
|
|
343
|
+
2. Clone this project:
|
|
344
|
+
```shell
|
|
345
|
+
git clone https://github.com/pieces-app/cli-agent
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
3. Create a Virtual Environment
|
|
349
|
+
```shell
|
|
350
|
+
python3 -m venv venv
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
4. Activate Your Virtualenv
|
|
354
|
+
```shell
|
|
355
|
+
source venv/bin/activate for Mac & Linux OS
|
|
356
|
+
|
|
357
|
+
cd venv\Scripts for Windows OS
|
|
358
|
+
activate
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
5. This project uses poetry for managing dependencies and builds. Install poetry with:
|
|
362
|
+
```shell
|
|
363
|
+
pip install poetry
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
6. Then use poetry to install the required dependencies
|
|
367
|
+
```shell
|
|
368
|
+
poetry install
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
7. You build with
|
|
372
|
+
```shell
|
|
373
|
+
poetry build
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
8. Finally any project dependencies should be added to the pyproject.toml file with
|
|
377
|
+
```shell
|
|
378
|
+
poetry add
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
9. Open the Dist folder
|
|
382
|
+
```shell
|
|
383
|
+
cd dist
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
10. Install the WHL file
|
|
387
|
+
```shell
|
|
388
|
+
pip install pieces-{VERSION}-py3-none-any.whl
|
|
389
|
+
```
|
|
390
|
+
replace the VERSION with the version you downloaded
|
|
391
|
+
Note: Ensure you get latest from the [releases](https://github.com/pieces-app/cli-agent/releases) of the cli-agent
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
11. To view all the CLI Commands
|
|
395
|
+
```shell
|
|
396
|
+
pieces help
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
these can be local/github/pypi etc.
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
### Updating
|
|
403
|
+
To update the project, run the following command:
|
|
404
|
+
|
|
405
|
+
```shell
|
|
406
|
+
pip install pieces --upgrade
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Uninstallation
|
|
410
|
+
To uninstall the project, run the following command:
|
|
411
|
+
|
|
412
|
+
```shell
|
|
413
|
+
pip uninstall pieces
|
|
414
|
+
```
|
|
415
|
+
Don't forget to remove the virtual environment and dist folder
|
|
416
|
+
|
|
417
|
+
|