COMMAND REORGANIZATION VISUAL - nself-org/cli GitHub Wiki

nself Command Reorganization - Visual Guide

Quick Reference | See COMMAND-REORGANIZATION-PROPOSAL.md for full details


The Problem (Current State)

77 top-level commands creating confusion and cognitive overload

nself [one of 77 options] โ†’ Too many choices!

Current Command Chaos

Authentication scattered:     auth, oauth, mfa, devices, security, roles, webhooks
Database scattered:           db, migrate, backup, restore
Deployment scattered:         deploy, staging, prod, rollback, env, sync, validate
Cloud scattered:              cloud, providers, provision, server, servers, k8s, helm
Observability scattered:      logs, metrics, monitor, health, status, doctor, history, audit, urls, exec
Services scattered:           service, admin, email, search, functions, mlflow, storage, redis, realtime
Security scattered:           security, secrets, vault, ssl, trust, mfa
Developer tools scattered:    dev, perf, bench, scale, frontend, ci, completion

Result: Users struggle to find commands, help text is overwhelming


The Solution (Proposed State)

13 logical categories with clear boundaries

nself <category> <action> โ†’ Clear mental model!

New Command Structure

Core (6 commands)
โ”œโ”€โ”€ init                    Initialize project
โ”œโ”€โ”€ build                   Build configs
โ”œโ”€โ”€ start                   Start services
โ”œโ”€โ”€ stop                    Stop services
โ”œโ”€โ”€ restart                 Restart services
โ””โ”€โ”€ status                  Service status

Data & Business Logic (4 categories)
โ”œโ”€โ”€ db                      Database operations (10+ subcommands)
โ”œโ”€โ”€ auth                    Authentication & authorization (20+ subcommands)
โ”œโ”€โ”€ tenant                  Multi-tenancy (32+ subcommands)
โ””โ”€โ”€ service                 Service management (25+ subcommands)

Infrastructure (3 categories)
โ”œโ”€โ”€ deploy                  Deployment & environments (15+ subcommands)
โ”œโ”€โ”€ cloud                   Cloud infrastructure (30+ subcommands)
โ””โ”€โ”€ observe                 Monitoring & observability (25+ subcommands)

Security & Tools (3 categories)
โ”œโ”€โ”€ secure                  Security & compliance (20+ subcommands)
โ”œโ”€โ”€ plugin                  Plugin management (10+ subcommands)
โ””โ”€โ”€ dev                     Developer tools (20+ subcommands)

Configuration (2 categories)
โ”œโ”€โ”€ config                  Configuration management (10+ subcommands)
โ””โ”€โ”€ help                    Help & utilities (4+ subcommands)

Result: 71% reduction in top-level commands, logical grouping, easy discovery


Before & After Comparison

Authentication Commands

BEFORE (8 top-level commands):

nself auth login
nself oauth enable
nself mfa enable
nself devices list
nself roles list
nself webhooks list
nself security scan
# Users must remember 8 separate top-level commands!

AFTER (1 top-level category):

nself auth login
nself auth oauth enable
nself auth mfa enable
nself auth devices list
nself auth roles list
nself auth webhooks list
# Everything auth-related is under 'nself auth'

Service Management

BEFORE (11 top-level commands):

nself service list
nself admin open
nself email test
nself search index
nself functions deploy
nself mlflow ui
nself storage upload
nself redis flush
nself realtime status
nself rate-limit config
# Mixed pattern - some under 'service', others top-level

AFTER (1 unified category):

nself service list
nself service admin open
nself service email test
nself service search index
nself service functions deploy
nself service mlflow ui
nself service storage upload
nself service cache flush
nself service realtime status
nself service rate-limit config
# ALL optional services under 'nself service'

Observability

BEFORE (9 top-level commands):

nself logs postgres
nself metrics
nself monitor
nself health check
nself doctor
nself history
nself audit
nself urls
nself exec postgres sh
# Scattered across multiple top-level commands

AFTER (1 unified category):

nself observe logs postgres
nself observe metrics
nself observe monitor
nself observe health check
nself observe doctor
nself observe history
nself observe audit
nself observe urls
nself observe exec postgres sh
# ALL observability under 'nself observe'

Command Migration Map

Quick Reference

Old Command New Command Category
nself oauth nself auth oauth Auth
nself mfa nself auth mfa Auth
nself devices nself auth devices Auth
nself roles nself auth roles Auth
nself webhooks nself auth webhooks Auth
nself admin nself service admin Service
nself email nself service email Service
nself search nself service search Service
nself functions nself service functions Service
nself mlflow nself service mlflow Service
nself storage nself service storage Service
nself redis nself service cache Service
nself realtime nself service realtime Service
nself staging nself deploy staging Deploy
nself prod nself deploy production Deploy
nself env nself deploy env Deploy
nself sync nself deploy sync Deploy
nself rollback nself deploy rollback Deploy
nself providers nself cloud provider Cloud
nself provision nself cloud server create Cloud
nself server nself cloud server Cloud
nself servers nself cloud server list Cloud
nself k8s nself cloud k8s Cloud
nself helm nself cloud helm Cloud
nself logs nself observe logs Observe
nself metrics nself observe metrics Observe
nself monitor nself observe monitor Observe
nself health nself observe health Observe
nself doctor nself observe doctor Observe
nself history nself observe history Observe
nself audit nself observe audit Observe
nself urls nself observe urls Observe
nself exec nself observe exec Observe
nself security nself secure Secure
nself secrets nself secure secrets Secure
nself vault nself secure vault Secure
nself ssl nself secure ssl Secure
nself trust nself secure ssl trust Secure
nself perf nself dev perf Dev
nself bench nself dev bench Dev
nself scale nself dev scale Dev
nself frontend nself dev frontend Dev
nself ci nself dev ci Dev
nself completion nself dev completion Dev
nself clean nself config clean Config
nself reset nself config reset Config
nself billing nself tenant billing Tenant
nself whitelabel nself tenant branding Tenant
nself org nself tenant Tenant

The 13 Categories Explained

1. Core Lifecycle (6 commands)

Daily essentials - Always top-level, no changes

init, build, start, stop, restart, status

2. Database (db)

ALL database operations - Already well-organized

nself db migrate       nself db backup       nself db types
nself db schema        nself db restore      nself db inspect
nself db seed          nself db shell        nself db data
nself db mock          nself db query

3. Authentication (auth)

ALL auth & authorization - Consolidates 8 top-level commands

nself auth login              nself auth oauth enable
nself auth signup             nself auth mfa enable
nself auth logout             nself auth devices list
nself auth status             nself auth roles create

4. Multi-Tenant (tenant)

ALL tenant operations - Already well-organized

nself tenant create           nself tenant billing usage
nself tenant list             nself tenant branding
nself tenant member add       nself tenant domains add
nself tenant setting set      nself tenant email edit

5. Service Management (service)

ALL optional services - Consolidates 11 top-level commands

nself service enable          nself service email test
nself service disable         nself service search index
nself service admin open      nself service functions deploy
nself service storage upload  nself service cache flush

6. Deployment (deploy)

ALL deployment operations - Consolidates 8 top-level commands

nself deploy staging          nself deploy env switch
nself deploy production       nself deploy sync db
nself deploy canary           nself deploy rollback
nself deploy blue-green       nself deploy validate

7. Cloud Infrastructure (cloud)

ALL cloud & infrastructure - Consolidates 8 top-level commands

nself cloud provider list     nself cloud k8s deploy
nself cloud server create     nself cloud helm install
nself cloud server ssh        nself cloud cost compare
nself cloud server list       nself cloud deploy full

8. Observability (observe) - NEW

ALL monitoring & diagnostics - Consolidates 9 top-level commands

nself observe logs            nself observe health check
nself observe metrics         nself observe doctor
nself observe monitor         nself observe history
nself observe urls            nself observe audit
nself observe exec

9. Security (secure) - NEW

ALL security operations - Consolidates 6 top-level commands

nself secure scan             nself secure vault init
nself secure incidents        nself secure ssl generate
nself secure secrets set      nself secure headers config
nself secure webauthn add     nself secure ssl trust

10. Plugins (plugin)

Plugin management - No changes

nself plugin list             nself plugin status
nself plugin install          nself plugin stripe sync
nself plugin remove           nself plugin github repos
nself plugin update           nself plugin shopify orders

11. Developer Tools (dev)

ALL dev utilities - Consolidates 7 top-level commands

nself dev perf profile        nself dev frontend add
nself dev bench run           nself dev ci init
nself dev scale postgres      nself dev completion bash
nself dev watch

12. Configuration (config)

ALL config operations - Consolidates 3 top-level commands

nself config show             nself config validate
nself config set              nself config clean
nself config edit             nself config reset
nself config diff

13. Help & Utilities (help)

Core utilities - Minimal changes

nself help                    nself version
nself update                  nself upgrade

Visual Command Tree

nself
โ”œโ”€โ”€ Core (Always available)
โ”‚   โ”œโ”€โ”€ init
โ”‚   โ”œโ”€โ”€ build
โ”‚   โ”œโ”€โ”€ start
โ”‚   โ”œโ”€โ”€ stop
โ”‚   โ”œโ”€โ”€ restart
โ”‚   โ””โ”€โ”€ status
โ”‚
โ”œโ”€โ”€ Data Layer
โ”‚   โ”œโ”€โ”€ db
โ”‚   โ”‚   โ”œโ”€โ”€ migrate (up, down, create, status)
โ”‚   โ”‚   โ”œโ”€โ”€ schema (scaffold, import, apply, diagram)
โ”‚   โ”‚   โ”œโ”€โ”€ seed (users, create)
โ”‚   โ”‚   โ”œโ”€โ”€ mock (auto)
โ”‚   โ”‚   โ”œโ”€โ”€ backup / restore
โ”‚   โ”‚   โ”œโ”€โ”€ shell / query
โ”‚   โ”‚   โ”œโ”€โ”€ types (typescript, go, python)
โ”‚   โ”‚   โ”œโ”€โ”€ inspect (size, slow)
โ”‚   โ”‚   โ””โ”€โ”€ data (export, anonymize)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ auth
โ”‚   โ”‚   โ”œโ”€โ”€ login / signup / logout / status
โ”‚   โ”‚   โ”œโ”€โ”€ oauth (install, enable, config, test, list)
โ”‚   โ”‚   โ”œโ”€โ”€ mfa (enable, disable, verify, backup-codes, qr)
โ”‚   โ”‚   โ”œโ”€โ”€ devices (list, revoke, trust)
โ”‚   โ”‚   โ”œโ”€โ”€ roles (list, create, assign, permissions)
โ”‚   โ”‚   โ””โ”€โ”€ webhooks (list, create, test)
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ tenant
โ”‚       โ”œโ”€โ”€ init / create / list / show / suspend / activate / delete / stats
โ”‚       โ”œโ”€โ”€ member (add, remove, list)
โ”‚       โ”œโ”€โ”€ billing (usage, invoice, subscription, payment, quota, plan, export, customer)
โ”‚       โ”œโ”€โ”€ branding / domains / email / themes
โ”‚       โ””โ”€โ”€ setting (set, get, list)
โ”‚
โ”œโ”€โ”€ Infrastructure Layer
โ”‚   โ”œโ”€โ”€ service
โ”‚   โ”‚   โ”œโ”€โ”€ list / enable / disable / status / restart / logs
โ”‚   โ”‚   โ”œโ”€โ”€ admin (status, open, users, config, dev)
โ”‚   โ”‚   โ”œโ”€โ”€ email (test, inbox, config)
โ”‚   โ”‚   โ”œโ”€โ”€ search (index, query, stats)
โ”‚   โ”‚   โ”œโ”€โ”€ functions (deploy, invoke, logs, list)
โ”‚   โ”‚   โ”œโ”€โ”€ mlflow (ui, experiments, runs, artifacts)
โ”‚   โ”‚   โ”œโ”€โ”€ storage (init, upload, list, delete, config, status, test)
โ”‚   โ”‚   โ”œโ”€โ”€ cache (stats, flush, keys)
โ”‚   โ”‚   โ”œโ”€โ”€ realtime (status, channels, broadcast)
โ”‚   โ”‚   โ””โ”€โ”€ rate-limit (config, status, reset)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ deploy
โ”‚   โ”‚   โ”œโ”€โ”€ staging / production / rollback
โ”‚   โ”‚   โ”œโ”€โ”€ preview / canary / blue-green
โ”‚   โ”‚   โ”œโ”€โ”€ check / status
โ”‚   โ”‚   โ”œโ”€โ”€ env (list, create, switch, diff)
โ”‚   โ”‚   โ”œโ”€โ”€ sync (db, files, config, full, auto, watch, status, history)
โ”‚   โ”‚   โ””โ”€โ”€ validate (config, env)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ cloud
โ”‚   โ”‚   โ”œโ”€โ”€ provider (list, init, validate, info)
โ”‚   โ”‚   โ”œโ”€โ”€ server (create, destroy, list, status, ssh, add, remove)
โ”‚   โ”‚   โ”œโ”€โ”€ cost (estimate, compare)
โ”‚   โ”‚   โ”œโ”€โ”€ deploy (quick, full)
โ”‚   โ”‚   โ”œโ”€โ”€ k8s (init, convert, apply, deploy, status, logs, scale, rollback, delete, cluster, namespace)
โ”‚   โ”‚   โ””โ”€โ”€ helm (init, generate, install, upgrade, rollback, uninstall, list, status, values, template, package, repo)
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ observe
โ”‚       โ”œโ”€โ”€ logs [service]
โ”‚       โ”œโ”€โ”€ metrics [service]
โ”‚       โ”œโ”€โ”€ monitor (status, enable, alerts, grafana)
โ”‚       โ”œโ”€โ”€ health (check, service, endpoint, watch, history, config)
โ”‚       โ”œโ”€โ”€ doctor [--fix]
โ”‚       โ”œโ”€โ”€ history (show, deployments, migrations, rollbacks, commands, search, export, clear)
โ”‚       โ”œโ”€โ”€ audit (events, users, export)
โ”‚       โ”œโ”€โ”€ urls [--env, --diff]
โ”‚       โ””โ”€โ”€ exec <service> <cmd>
โ”‚
โ”œโ”€โ”€ Security & Tooling
โ”‚   โ”œโ”€โ”€ secure
โ”‚   โ”‚   โ”œโ”€โ”€ scan (all, passwords, mfa, sessions, suspicious)
โ”‚   โ”‚   โ”œโ”€โ”€ incidents (list, show, resolve)
โ”‚   โ”‚   โ”œโ”€โ”€ events (list, show)
โ”‚   โ”‚   โ”œโ”€โ”€ webauthn (list, add, remove)
โ”‚   โ”‚   โ”œโ”€โ”€ headers (show, config, test)
โ”‚   โ”‚   โ”œโ”€โ”€ secrets (list, set, get, delete, rotate)
โ”‚   โ”‚   โ”œโ”€โ”€ vault (init, status, seal, unseal, backup, restore)
โ”‚   โ”‚   โ””โ”€โ”€ ssl (generate, install, renew, trust, verify)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ plugin
โ”‚   โ”‚   โ”œโ”€โ”€ list / install / remove / update / refresh / status
โ”‚   โ”‚   โ”œโ”€โ”€ stripe (sync, customers, subscriptions, invoices, webhook)
โ”‚   โ”‚   โ”œโ”€โ”€ github (sync, repos, issues, prs, workflows, webhook)
โ”‚   โ”‚   โ””โ”€โ”€ shopify (sync, products, orders, customers, webhook)
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ dev
โ”‚       โ”œโ”€โ”€ start / stop / status / watch
โ”‚       โ”œโ”€โ”€ perf (profile, analyze, slow-queries, report, dashboard, suggest)
โ”‚       โ”œโ”€โ”€ bench (run, baseline, compare, stress, report)
โ”‚       โ”œโ”€โ”€ scale <service> [--auto]
โ”‚       โ”œโ”€โ”€ frontend (status, list, add, remove, deploy, logs, env)
โ”‚       โ”œโ”€โ”€ ci (init, validate, status)
โ”‚       โ””โ”€โ”€ completion (bash, zsh, fish, install)
โ”‚
โ””โ”€โ”€ Configuration & Help
    โ”œโ”€โ”€ config
    โ”‚   โ”œโ”€โ”€ show / get / set / list / edit
    โ”‚   โ”œโ”€โ”€ validate / diff / export / import / reset
    โ”‚   โ””โ”€โ”€ clean / reset [--hard]
    โ”‚
    โ””โ”€โ”€ help / version / update / upgrade

Migration Timeline

Phase 1: Add New Commands (Weeks 1-2)

โœ… New commands work alongside old
โœ… Zero breaking changes
โœ… Users can start trying new syntax

Phase 2: Deprecation Warnings (Weeks 3-6)

โš ๏ธ  Old commands show deprecation notice
โš ๏ธ  Suggest new command
โœ… Continue working normally

Phase 3: Legacy Aliases (Ongoing)

โœ… Smart redirects
โœ… Telemetry tracking (opt-in)
โœ… Maintained for 2+ versions

Phase 4: Removal (6-12 months)

โŒ Old commands removed
โœ… Helpful error messages
โœ… Migration guide available

Help Text Comparison

BEFORE (77 commands)

$ nself help
Usage: nself <command>

Commands:
  admin          Admin UI
  admin-dev      Admin dev mode
  audit          Audit trail
  auth           Authentication
  backup         Backup database
  bench          Benchmarking
  billing        Billing management
  build          Build project
  ci             CI/CD generation
  clean          Clean resources
  cloud          Cloud infrastructure
  completion     Shell completion
  config         Configuration
  db             Database operations
  deploy         Deploy application
  dev            Development mode
  devices        User devices
  doctor         Diagnostics
  down           Stop services
  email          Email service
  env            Environment management
  exec           Execute in container
  frontend       Frontend apps
  functions      Serverless functions
  health         Health checks
  helm           Helm charts
  help           Show help
  history        History
  init           Initialize project
  k8s            Kubernetes
  logs           View logs
  metrics        Metrics
  mfa            Multi-factor auth
  migrate        Migrations
  mlflow         ML tracking
  monitor        Monitoring
  nself          nself CLI
  oauth          OAuth providers
  org            Organizations
  perf           Performance
  plugin         Plugins
  prod           Production
  providers      Cloud providers
  provision      Provision servers
  rate-limit     Rate limiting
  realtime       Realtime service
  redis          Redis cache
  reset          Reset project
  restart        Restart services
  restore        Restore database
  roles          User roles
  rollback       Rollback deployment
  scale          Service scaling
  search         Search service
  secrets        Secrets management
  security       Security
  server         Server management
  servers        List servers
  service        Service management
  ssl            SSL certificates
  staging        Staging deployment
  start          Start services
  status         Service status
  stop           Stop services
  storage        Object storage
  sync           Sync data
  tenant         Multi-tenancy
  trust          Trust certificates
  up             Start services
  update         Update nself
  upgrade        Upgrade nself
  urls           Service URLs
  validate       Validate config
  vault          Vault management
  version        Show version
  webhooks       Webhooks
  whitelabel     White-label

(77 commands - overwhelming!)

AFTER (13 categories)

$ nself help
Usage: nself <category> <action>

Core Commands:
  init          Initialize project
  build         Build configs
  start         Start services
  stop          Stop services
  restart       Restart services
  status        Service status

Main Categories:
  db            Database operations (migrate, backup, types, etc.)
  auth          Authentication & authorization (login, oauth, mfa, roles, etc.)
  tenant        Multi-tenancy (create, billing, branding, domains, etc.)
  service       Service management (admin, email, search, storage, etc.)

  deploy        Deployment & environments (staging, prod, sync, etc.)
  cloud         Cloud infrastructure (providers, servers, k8s, helm, etc.)
  observe       Monitoring & observability (logs, metrics, health, etc.)
  secure        Security & compliance (scan, secrets, vault, ssl, etc.)

  plugin        Plugin management (install, update, stripe, github, etc.)
  dev           Developer tools (perf, bench, frontend, ci, etc.)
  config        Configuration (show, edit, validate, clean, etc.)

Utilities:
  help          Show help
  version       Show version
  update        Update nself
  upgrade       Upgrade nself

For category help: nself help <category>
For command help:  nself <category> <action> --help

(13 categories - easy to scan!)

Common Workflows

Daily Development

BEFORE:

nself start
nself status
nself logs postgres
nself db migrate up
nself db seed
nself urls

AFTER:

nself start
nself status
nself observe logs postgres
nself db migrate up
nself db seed
nself observe urls

Deployment

BEFORE:

nself deploy check
nself staging
nself sync db staging
nself prod
nself rollback

AFTER:

nself deploy check
nself deploy staging
nself deploy sync db staging
nself deploy production
nself deploy rollback

Service Management

BEFORE:

nself service enable redis
nself redis flush
nself email test
nself search index
nself functions deploy

AFTER:

nself service enable redis
nself service cache flush
nself service email test
nself service search index
nself service functions deploy

Monitoring & Debugging

BEFORE:

nself logs postgres
nself health check
nself doctor
nself metrics
nself urls

AFTER:

nself observe logs postgres
nself observe health check
nself observe doctor
nself observe metrics
nself observe urls

FAQ

Q: Will my existing scripts break?

A: No! Legacy aliases will be supported for 2+ major versions. Your scripts will continue to work.

Q: Can I use both old and new commands?

A: Yes! During the transition period, both will work. Eventually, old commands will show deprecation warnings before being removed.

Q: How do I migrate?

A: Use the migration map above. Most changes are straightforward:

  • nself logs โ†’ nself observe logs
  • nself oauth โ†’ nself auth oauth
  • nself email โ†’ nself service email

Q: Why not keep everything top-level?

A: 77 commands is too many to remember. Grouping by category makes discovery easier and creates a clear mental model.

Q: What if I forget the new command?

A: The old command will redirect and show you the new one:

$ nself logs postgres
โš ๏ธ  DEPRECATED: Use 'nself observe logs postgres'
[logs continue...]

Q: Will tab completion work?

A: Yes! Tab completion will work for both old and new commands during the transition.


Summary

Problem: 77 top-level commands creating confusion Solution: 13 logical categories with backward-compatible migration Result: 71% reduction in top-level commands, improved discoverability Timeline: 4-phase rollout over 6-12 months Risk: Low - legacy aliases maintain compatibility

Next Step: Review proposal and approve for implementation


For full details, see COMMAND-REORGANIZATION-PROPOSAL.md

โš ๏ธ **GitHub.com Fallback** โš ๏ธ