Skip to main content

Pieces Python CLI Tool

This is a comprehensive command-line interface (CLI) tool designed to interact seamlessly with PiecesOS. It provides a range of functionalities such as asset management, application interaction, and integration with various PiecesOS features.

WebsitePiecesOS DocumentationPieces CLI Documentation

Introducing CLI

Important

Make sure you have PiecesOS installed in order to run the Pieces CLI tool.

Operating System Support

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.

The CLI Supports

  • Windows 10 or greater
  • Mac
  • Windows

Installing

To get started with the Pieces Python CLI Tool, you need to:

  1. Ensure PiecesOS is installed and running on your system.

  2. Install the Python package:

    pip install pieces-cli
    
    brew install pieces-cli
    
    conda install pieces-cli
    

Getting Started

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.

Some important terminologies

  • x -> The index
  • current asset -> The asset that you are currently using can be changed by the open command
  • current conversation -> The conversation that you currently using in the ask command

Shell Completion

The Pieces CLI supports auto-completion for bash, zsh, fish, and PowerShell. To enable completion for your shell, run:

pieces completion [shell]

Quick setup commands for each shell:

  • Bash:
echo 'eval "$(pieces completion bash)"' >> ~/.bashrc && source ~/.bashrc
  • Zsh:
echo 'eval "$(pieces completion zsh)"' >> ~/.zshrc && source ~/.zshrc
  • Fish:
echo 'pieces completion fish | source' >> ~/.config/fish/config.fish && source ~/.config/fish/config.fish
  • PowerShell:
Add-Content $PROFILE '$completionPiecesScript = pieces completion powershell | Out-String; Invoke-Expression $completionPiecesScript'; . $PROFILE

After setup, restart your terminal or source your configuration file. Then try typing pieces and press Tab to test auto-completion!

Usage

To refer to the list of all the commands currently supported in the Pieces CLI Agent, visit the documentation.

Contributing

Installation

To run this project locally, follow these steps:

  1. Fork this project via GitHub.

  2. Clone this project:

git clone https://github.com/pieces-app/cli-agent
  1. Create a Virtual Environment
python3 -m venv venv
  1. Activate Your Virtualenv
source venv/bin/activate for Mac & Linux OS

cd venv\Scripts for Windows OS
activate
  1. This project uses poetry for managing dependencies and builds. Install poetry with:
pip install poetry
  1. Then use poetry to install the required dependencies
poetry install
  1. You build with
poetry build
  1. Finally any project dependencies should be added to the pyproject.toml file with
poetry add
  1. Open the Dist folder
cd dist
  1. Install the WHL file
pip install pieces-cli-{VERSION}-py3-none-any.whl

replace the VERSION with the version you downloaded Note: Ensure you get latest from the releases of the cli-agent

  1. To view all the CLI Commands
pieces help

these can be local/github/pypi etc.

Updating

To update the project, run the following command:

pip install pieces-cli --upgrade

Testing

To discover and run all the test cases in the repository, run the following command:

pytest

To check the test coverage, you can use the coverage package. Install coverage with:

pip install coverage

Run the tests with coverage using the following command:

coverage run -m pytest
coverage report

Uninstallation

To uninstall the project, run the following command:

pip uninstall pieces-cli

Don't forget to remove the virtual environment and dist folder

Available Commands

  run               - Starts a looped version of the CLI that only requires you to type the flag

  list              - Lists all the materials in your Pieces Drive (alias: 'drive')
  list apps         - List all registered applications
  list models       - List all registered AI models and change the AI model that you are using the ask command

  modify            - Modify the current material content after you edit it in the editor
  edit              - Edit the current material name or classification you can use -n and -c for name and classification respectively
  delete            - Deletes the current or most recent material.
  create            - Creates a new material based on what you've copied to your clipboard
  execute           - Execute a Pieces bash material
  clear             - to clear the terminal

  config            - View current configuration
  config --editor x - Set the editor to 'x' in the configuration

  ask "ask"       - Asks a single question to the model selected in change model. Default timeout set to 10 seconds
  --materials,-m    - Add material(s) by index. Separate materials with spaces. Run 'drive' to find material indexes
  --file,-f         - Add a certain files or folders to the ask command it can be absolute or relative path

  chats             - List all the chats. The green chat shows the currently using one in the ask command
  chat              - Show the messages of the currently using chat in the ask command
  chat x            - List all the messages in a certain chat and switch to it in the ask command
  -n,--new          - To create a new chat in the ask command
  -d,--delete       - Deletes the current chat
  -r,--rename       - Rename the current chat. If no value given it will let the model rename it for you

  commit            - Commits the changes to github and auto generate the message, you can use -p or --push to push

  search q          - Does a fuzzy search for your query
  --mode ncs        - Does a neural code search for your query
  --mode fts        - Does a full text search for your query

  login             - Login to pieces
  logout            - Logout from pieces

  version           - Gets version of PiecesOS and the version of the cli tool
  help              - Show this help message
  onboarding        - Start the onboarding process
  feedback          - Send feedback to Pieces
  contribute        - Contribute to Pieces CLI
  install           - Install PiecesOS
  open              - Opens PiecesOS

Release files for pieces-cli 1.20.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pieces-cli 1.20.1
File Size Uploaded
pieces_cli-1.20.1.tar.gz 600.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pieces-cli 1.20.1
File Interpreter ABI Platform
pieces_cli-1.20.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.3 MB

Release files / pieces_cli-1.20.1.tar.gz

Download URL pieces_cli-1.20.1.tar.gz
Size 600.9 kB
Tags Source
SHA-256 checksum
How to use checksums
303f04e847bb122e6638e592d1ad0645fd9c1ed5f6494637bf203089d4f0164c
BLAKE2b-256 checksum
How to use checksums
d428e5c3d511e6a81b06f0c293909dfb138fd10d28979968e4a4ad12cf671f73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.11.9 Darwin/24.6.0

Release files / pieces_cli-1.20.1-py3-none-any.whl

Download URL pieces_cli-1.20.1-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
889dc1bd392b7060ed7afb73fe9f2bfbd452ae66fe9ceb03a6c7a662795f7828
BLAKE2b-256 checksum
How to use checksums
c0cf3daa8efb5bd3bbb031aeeb6a0478b6b18c23a17dd5c0978742d024535b35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.11.9 Darwin/24.6.0

Release history Release notifications | RSS feed

This release

1.20.1 This release

2 release files

1.19.0

2 release files

1.18.1

2 release files

1.18.0

2 release files

1.17.1

2 release files

1.17.0

2 release files

1.16.5

2 release files

1.16.3

2 release files

1.16.2

2 release files

1.15.2

2 release files

1.13.0

2 release files

1.12.1

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.10.0

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.4

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page