⚙️ Autonomy CLI

Command-line interface for signal management and system operations.

What is the Autonomy CLI?

The Autonomy CLI is a command-line tool for managing signals, running imports, and performing system operations. It provides a Laravel Artisan-style interface with configuration persistence and sensible defaults.

Built with Commander.js, it remembers your preferences (default realm, author, API URL) so you don't have to repeat them with every command.

Installation

# Install dependencies
npm install commander
# Make CLI executable and link globally
chmod +x scripts/autonomy.js
npm link

After running npm link, the autonomy command will be available globally in your terminal.

Configuration

The CLI stores user-specific configuration in .autonomy.json at the project root. This file is gitignored and contains your preferences.

First Time Setup

autonomy config:set default_realm 01JQABCDEF1234567890ABCDEF
autonomy config:set default_author "Sam White"
autonomy config:set api_url "http://localhost:3000"

Configuration Commands

autonomy config:set <key> <value>

Set a configuration value

autonomy config:get <key>

Get a configuration value

autonomy config:list

List all configuration values

autonomy config:reset

Reset all configuration

Import Commands

import:docs

Scan a directory recursively for text files and generate a JSON file of DOCUMENT signals ready for import.

# Use default realm and author from config
autonomy import:docs ~/Documents/notes
# Override with flags
autonomy import:docs ~/journal --realm 01JQA... --author "Sam"

Supported formats: .txt, .md, .markdown, .text, .log, .json, .yml, .yaml, .xml, .csv

Output: signals-import-1735689234567.json

import:bulk

Import signals from a JSON file generated by import:docs or created manually.

# Use default API URL from config
autonomy import:bulk signals-import-1735689234567.json
# Override API URL
autonomy import:bulk signals.json --url "https://autonomy.example.com"

Database Commands

autonomy db:migrate

Run Prisma database migrations

autonomy db:seed

Seed database with sample data

autonomy db:studio

Open Prisma Studio (visual database browser)

autonomy db:reset

⚠️ Reset database (destroys all data)

Architecture

File Structure

scripts/
  autonomy.js           # Main CLI entry point
  lib/
    config.js           # Configuration helpers
  commands/
    import-docs.js      # Document import logic
    import-bulk.js      # Bulk import logic
    db.js               # Database commands

.autonomy.json          # User configuration (gitignored)

How It Works

  1. Commander.js parses command-line arguments and options
  2. Config helper loads user preferences from .autonomy.json
  3. Command modules execute the requested operation
  4. Results are displayed with formatted output and status indicators

Common Workflows

Importing Documents

# 1. Scan directory and generate JSON
autonomy import:docs ~/Documents/notes
# 2. Review generated JSON file
cat signals-import-1735689234567.json
# 3. Import to database
autonomy import:bulk signals-import-1735689234567.json

Database Setup

# 1. Run migrations
autonomy db:migrate
# 2. Seed with sample data (optional)
autonomy db:seed
# 3. Open visual browser
autonomy db:studio

Getting Help

# View all commands
autonomy --help
# View help for specific command
autonomy import:docs --help

Related Documentation