Skip to content

[Agent-Friendly] Make CLI usable by AI agents and automation #46

@oth-body

Description

@oth-body

Problem

The CLI requires interactive password input, uses spinners/animations in output, and doesn't provide machine-readable formats. This makes it difficult for:

  • AI agents (like OpenClaw assistants)
  • CI/CD pipelines
  • Automation scripts
  • Batch operations

Proposed Solutions

1. Non-interactive Authentication

Add environment variable and flag support:

# Environment variable
HOOT_PASSWORD=xxx hoot -p

# Password from stdin
echo $PASSWORD | hoot -p --password-stdin

# Password from file
hoot -p --password-file ~/.config/nostr-cli/password

2. JSON Output Mode

Add --json flag for machine-readable output:

hoot -l --json
hoot -p --json
hoot -dms --json

Example output:

{
  "posts": [
    {
      "id": "note1...",
      "content": "Hello world",
      "created_at": "2026-03-25T18:25:19Z",
      "relays": ["wss://relay.damus.io"]
    }
  ]
}

3. Quiet Mode

Add -q / --quiet flag to disable spinners, animations, and progress output:

hoot -m "test" -q
hoot -p -q

4. Consistent Exit Codes

  • 0 = success
  • 1 = general error
  • 2 = auth error (wrong password, no key)
  • 3 = network error (relay connection failed)
  • 4 = validation error (invalid input)

5. Machine-Readable Errors

JSON errors when --json is set:

{
  "error": "relay connection failed",
  "code": 3,
  "relay": "wss://relay.nostr.band"
}

6. Config via Flags

Allow overriding config file settings via flags:

hoot -m "test" --relays wss://damus.io,wss://nos.lol
hoot -p --timeout 30s

7. Batch Operations (optional)

# Multiple posts from file
hoot --batch posts.json

# Multiple commands via stdin
hoot --batch - <<EOF
{"cmd": "update_profile", "name": "Test"}
{"cmd": "post", "content": "Hello"}
EOF

Priority

High - this would enable:

  • AI assistants to interact with Nostr programmatically
  • Better CI/CD integration
  • Scripted automation
  • Testing in headless environments

Related

  • Subagents running in PTY can't easily pipe passwords
  • Spinners/animations break terminal capture

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions