Skip to content

Latest commit

 

History

History
316 lines (203 loc) · 6.61 KB

File metadata and controls

316 lines (203 loc) · 6.61 KB

DAS Toolbox

Overview

DAS Toolbox is a CLI tool that simplifies the management of containerized services, OpenFaaS functions, and operations related to the Distributed Atomspace (DAS). It allows you to spin up databases, load MeTTa files, validate syntax, and more.


Table of Contents


Requirements

System Dependencies

  • Docker — required for some commands that interact with containers.

Python Dependencies

  • Python >= 3.10
  • pip (required if installing via pip)
  • virtualenv (optional, recommended to isolate the environment)

Note: pip is only required if you install via pip. On Ubuntu, you can install using the .deb package generated by make build without pip.


Installation

APT Repository (Ubuntu/Debian)

  1. Set up the repository:
sudo bash -c "wget -O - http://45.77.4.33/apt-repo/setup.sh | bash"
  1. Install the package:
sudo apt install das-toolbox
  1. Verify the installation:
das-cli --help

This method installs the .deb package directly. No pip or virtual environment is required.


Local .deb Package (Ubuntu/Debian)

  1. Build the package locally:
make build                 # generates the .deb file in dist/
  1. Install the package (choose one of the methods below):

Using APT (Recommended):

sudo apt install ./dist/das-cli_<version>.deb

Using dpkg:

sudo dpkg -i dist/das-cli_<version>.deb
  1. Verify the installation:
das-cli --help

No pip or virtualenv needed.


Build from Source (Linux, macOS, Windows)

  1. Clone the repository and navigate to the project root:
git clone https://github.com/singnet/das-toolbox.git
  1. (Optional but recommended) Create and activate a virtual environment:
python -m venv env
source env/bin/activate    # Linux/macOS
env\Scripts\activate       # Windows
  1. Install the package using pip:
cd das-toolbox/das-cli
pip install .
  1. Verify the installation:
das-cli --help

This method works on all supported OSs (Linux, macOS, Windows)


General Syntax

The general syntax for using das-cli is:

das-cli <command> <subcommand> [options]
  • <command> — the main module or functionality you want to access (e.g., ab, query).
  • <subcommand> — a specific action within the command (e.g., start, stop).
  • [options] — optional flags or parameters to modify the behavior of the subcommand (e.g., --follow, --remote).

Examples

1. Configure the Environment

# Configure Redis, MongoDB, or any supported service
das-cli config set

You can verify the configuration using:

das-cli config ls

2. Start Databases

# Start database services
das-cli db start

3. Load MeTTa Files

Before starting the modules, verify and load your MeTTa files to the database.

# Validate the MeTTa syntax
das-cli metta check ./examples/data/animals.metta

# Load the MeTTa file into the database
das-cli metta load ./examples/data/animals.metta

4. Start core services

Start the Attention Broker and the other core services:

# Start the Attention Broker
das-cli ab start

# Start the Query Agent
das-cli query start

5. Run a Query

You can run a query test using the query send command, passing a port range, and the query expression.

das-cli query send \
  --port-range 42500:42599 \
  --query 'LINK_TEMPLATE Expression 3 NODE Symbol Similarity NODE Symbol "\"human\"" VARIABLE S'

This command sends a MeTTa query to the running DAS environment. This command is under construction yet.

Help

You don't need to memorize all commands. DAS CLI offers a structured help system that lets you explore everything interactively.

List All Command Groups

das-cli --help

This will show the main command categories such as db, metta, logs, etc.

View Help for a Command Group

To see the available subcommands within a group:

das-cli <command-group> --help

Example:

das-cli db --help

Get Help for a Specific Subcommand

To understand how to use a specific command:

das-cli <command-group> <subcommand> --help

Example:

das-cli db count-atoms --help

Manual Pages (APT install only)

If you installed das-cli via the APT package, you can also view man pages:

man das-cli
man das-cli-attention-broker-start
man das-cli-db-restart

Man pages provide detailed documentation, flags, examples, and usage tips.


Integration Tests

If you forgot --recurse-submodules, run:

git submodule update --init --recursive

Without cluster tests:

make tests-local

With cluster tests:

DAS_CLI_TEST_CLUSTER=true make tests-local

Make sure you have configured the tests/integration/fixtures/config/redis_cluster.json file. Replace the username and ip for the cluster nodes. For the first node, you don't need to replace the username as it will automatically use the current server's user where the tests are running with das-cli. Do not change the context as it will be created during test execution.

Troubleshooting

Docker permission denied

Add your user to the Docker group:

sudo usermod -aG docker $USER
# Restart your terminal session

Temporary folder error

Ensure at least 32MB of free disk space. DAS Toolbox extracts files to temporary folders during execution.