commands

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 106 Imported by: 0

Documentation

Overview

P88 Sprint 05: `nself ai chat` — quick chat for verification. Acceptance criteria: `nself ai chat "hello"` returns coherent local response <3s.

P88 Sprint 03: `nself ai pool` — 8 subcommands for Gemini pool management.

Package commands: controller + project subcommands for B46 multi-tenant master controller.

CLI surface:

nself controller start | stop | status | init
nself project create --slug <slug> --domain <domain>
nself project delete --slug <slug> [--force]
nself project list
nself project status --slug <slug>
nself project migrate --slug <slug>
nself project shell --slug <slug>
nself project rotate-credentials --slug <slug>

Feature flag: NSELF_FLAG_MULTI_TENANT_CONTROLLER must be true. When OFF, all commands print 503 Multi-tenant controller not enabled.

P88 Sprint 05: `nself doctor --ai` first-run wizard. Tickets: T-05-01 (wizard), T-05-02 (headless), T-05-03 (idempotency).

Package commands — gdpr.go

`nself gdpr` implements GDPR data portability (Art. 20) and right-to-erasure (Art. 17) flows for self-hosted nSelf instances.

Subcommands:

nself gdpr export --user <id>         Build an export archive for a user
nself gdpr delete --user <id>         Cascade-delete/anonymize a user's data
nself gdpr status --request <id>      Show status of a GDPR request
nself gdpr list-requests              List all GDPR requests

Package commands — security.go

`nself security` provides server-level security operations: audit, setup, and status. These commands inspect the host environment (firewall, fail2ban, SSH config) and the running stack for common hardening gaps. They are intentionally non-destructive by default — `setup` requires `--apply` to make changes, otherwise it prints what would be done.

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "nself",
	Short: "nSelf CLI - Serverless hosting, anywhere",
	Long: `nSelf CLI empowers you to deploy a fully-featured, production-ready
backend to any hosting provider with absolute simplicity.

The Golden Path:
  nself init    # Generate your pristine .env configuration
  nself build   # Compose your infrastructure
  nself start   # Boot your stack`,

	RunE: func(cmd *cobra.Command, args []string) error {
		return cmd.Help()
	},

	SilenceUsage:  true,
	SilenceErrors: true,
}

RootCmd represents the base command when called without any subcommands

Functions

func EnsureOutboxDir added in v1.0.6

func EnsureOutboxDir() error

EnsureOutboxDir creates the outbox directory if it does not exist. Called during nself setup to ensure the durable queue is ready.

func Execute

func Execute() error

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main().

func RegisterControllerCommands added in v1.0.12

func RegisterControllerCommands(root *cobra.Command)

RegisterControllerCommands attaches controller + project commands to the root command.

Types

type AdminConnection added in v1.0.6

type AdminConnection struct {
	Name       string `json:"name"`
	Host       string `json:"host"`
	User       string `json:"user"`
	Port       int    `json:"port"`
	LocalPort  int    `json:"local_port"`
	RemotePort int    `json:"remote_port"`
}

AdminConnection represents a saved remote admin connection.

type AdminProject added in v1.0.6

type AdminProject struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Path    string `json:"path"`
	Host    string `json:"host"`
	SSHUser string `json:"ssh_user"`
	URL     string `json:"url"`
}

AdminProject represents a project in the multi-project config.

type ClawConfig added in v1.0.6

type ClawConfig struct {
	APIKey    string `yaml:"api_key,omitempty"`
	ServerURL string `yaml:"server_url,omitempty"`
}

ClawConfig holds the CLI-to-claw-server configuration.

type FunctionInfo added in v1.0.11

type FunctionInfo struct {
	Name   string `json:"name"`
	Status string `json:"status"`
	URL    string `json:"url"`
	Dir    string `json:"dir"`
}

FunctionInfo describes a deployed function.

type LogSummary

type LogSummary struct {
	Service    string
	TotalLines int
	ErrorCount int
	WarnCount  int
	TopErrors  []string // up to 5 most frequent error messages (deduped)
	LastLine   string
}

LogSummary holds per-service log analysis results.

func CollectLogSummary

func CollectLogSummary(ctx context.Context, workdir string, service string, maxLines int) (*LogSummary, error)

CollectLogSummary fetches and analyses recent logs for a single service.

type LogVolume

type LogVolume struct {
	Service     string
	LinesPerMin float64
	BytesPerMin float64
	ErrorRate   float64 // errors / total lines in sample window
}

LogVolume holds per-service log volume sample data.

func SampleLogVolume

func SampleLogVolume(ctx context.Context, workdir string, service string, sampleDuration time.Duration) (*LogVolume, error)

SampleLogVolume samples docker logs for a service over sampleDuration and computes volume metrics.

type LogsOptions

type LogsOptions struct {
	Search  string
	Grep    string // regex pattern for --grep
	Errors  bool
	Level   string // debug|info|warn|error
	Compact bool
	Quiet   bool
	Tail    int
	Follow  bool
	Since   string // relative (1h, 30m) or absolute RFC3339
	Until   string // relative or absolute RFC3339
	JSON    bool   // structured JSON output per line
	NoColor bool
	Plain   bool // disable highlighting for piping
	Service []string
}

LogsOptions holds parsed flag values for log filtering and formatting.

Source Files

Jump to

Keyboard shortcuts

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