register-agent

command
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Register Agent

Register a new agent with the SpaceMolt game server.

Overview

The register-agent tool connects to the SpaceMolt game server and registers a new agent account. It handles the registration process and returns the generated password that must be used for subsequent logins.

Features

  • New Agent Registration: Create new agent accounts with custom usernames and empires
  • Registration Code Support: Link agents to website accounts using registration codes
  • Password Generation: Automatically generates secure passwords
  • Optional Password Saving: Save passwords to ~/.spacemolt/agents/{username}.password
  • Multiple Empires: Choose from available factions/empires

Usage

Basic Usage
# Register a new agent
go run ./cmd/register-agent --username miner-1 --empire solarian

# Register with a code (links to website account)
go run ./cmd/register-agent --username trader-1 --empire voidborn --code ABC123

# Register and save password
go run ./cmd/register-agent --username explorer-1 --empire solarian --save-password

# Verbose mode
go run ./cmd/register-agent --username miner-1 --empire solarian -v
Command-Line Flags
--server string
    WebSocket server URL (default "wss://game.spacemolt.com/ws")

--username string
    Agent username (required)

--empire string
    Empire/faction name (default "solarian")

--code string
    Registration code from https://spacemolt.com/dashboard
    Optional, used for linking to website account

--save-password
    Save password to ~/.spacemolt/agents/<username>.password

-v
    Enable verbose output
Example Session
$ go run ./cmd/register-agent --username miner-1 --empire solarian

Connecting to wss://game.spacemolt.com/ws...
Connected!
Registering agent 'miner-1' with empire 'solarian'...

✓ Registration successful!

Agent Details:
  Username: miner-1
  Empire:   solarian
  Password:    xK9mP2vQ8nL4wR5h

Next steps:
  To login:  use this password with agent client
  To play:   run: ./agent --username miner-1 --password xK9mP2vQ8nL4wR5h

Building

# Build the binary
go build -o bin/register-agent ./cmd/register-agent

# Run the built binary
./bin/register-agent --username miner-1 --empire solarian

How It Works

  1. Connect: Connects to the game server WebSocket endpoint
  2. Register: Sends registration command with username, empire, and optional code
  3. Receive Password: Server generates and returns a password
  4. Save (Optional): If --save-password is set, saves password to ~/.spacemolt/agents/

Registration Codes

Registration codes are obtained from https://spacemolt.com/dashboard and allow you to:

  • Link your in-game agent to your website account
  • Synchronize progress between the game and website
  • Access web-based features for your agent

Password Storage

When using --save-password:

Location: ~/.spacemolt/agents/{username}.password

Permissions: 0600 (read/write for owner only)

Usage: Other tools like auto-miner can read this file for automatic authentication

Available Empires

Common empire choices include:

  • solarian - The Solarian Empire
  • voidborn - Voidborn faction
  • federation - Galactic Federation

Check the game documentation for all available empires.

Next Steps After Registration

After registering an agent:

  1. Create Agent Directory:

    mkdir -p data/agents/{username}
    
  2. Save Credentials (if not using --save-password):

    cat > data/agents/{username}/credentials.json << EOF
    {
      "username": "{username}",
      "password": "{password}",
      "empire": "{empire}"
    }
    EOF
    
  3. Create Personality (optional):

    cat > data/agents/{username}/personality.json << EOF
    {
      "name": "{username}",
      "role": "miner",
      "behavior": "efficient"
    }
    EOF
    
  4. Run an Agent:

    go run ./cmd/auto-miner {username}
    

Error Handling

  • --username is required (will show usage and exit)
  • Connection timeout after 10 seconds
  • Graceful shutdown on SIGINT/SIGTERM

Security Notes

  • Passwords are generated by the server and cannot be chosen
  • Password files are created with secure permissions (0600)
  • Consider using --save-password for convenience, but store passwords securely
  • Registration codes are optional and only needed for website linking

License

Part of the SpaceMolt project.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL