{
  "name": "snaplet",
  "description": "Create and share PostgreSQL snapshots with schema, data transformation, and preview databases for collaborative development (see: https://docs.snaplet.dev)",
  "options": [
    {
      "names": [
        "--help",
        "-h"
      ],
      "description": "Show help for snaplet",
      "isPersistent": true
    },
    {
      "names": [
        "--version",
        "-v"
      ],
      "description": "Show version number",
      "isPersistent": true
    }
  ],
  "subcommands": [
    {
      "name": "auth",
      "description": "Manage auth state",
      "subcommands": [
        {
          "name": "login",
          "aliases": [
            "setup"
          ],
          "description": "Login with an access token",
          "args": [
            {
              "name": "access-token",
              "isOptional": true
            }
          ]
        }
      ]
    },
    {
      "name": "config",
      "description": "Manage configuration",
      "subcommands": [
        {
          "name": "generate",
          "description": "Generate transform files",
          "options": [
            {
              "names": [
                "--dry-run"
              ]
            },
            {
              "names": [
                "--type",
                "-t"
              ],
              "args": [
                {
                  "suggestions": [
                    "typedefs",
                    "transform",
                    "keys",
                    "seed"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "list",
          "aliases": [
            "ls"
          ],
          "description": "List config variables"
        },
        {
          "name": "pull",
          "description": "Pull cloud project config to local",
          "options": [
            {
              "names": [
                "--type",
                "-t"
              ],
              "args": [
                {
                  "suggestions": [
                    "typedefs",
                    "transform",
                    "keys",
                    "seed"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "push",
          "description": "Push local project config to cloud",
          "options": [
            {
              "names": [
                "--type",
                "-t"
              ],
              "args": [
                {
                  "suggestions": [
                    "typedefs",
                    "transform",
                    "keys",
                    "seed"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "setup",
          "description": "Setup local project configuration",
          "options": [
            {
              "names": [
                "--generate"
              ]
            },
            {
              "names": [
                "--no-generate"
              ]
            },
            {
              "names": [
                "--yes"
              ],
              "description": "Automatically accept any prompt, useful for scripts"
            }
          ],
          "args": [
            {
              "name": "targetDatabaseUrl",
              "isOptional": true
            }
          ]
        }
      ]
    },
    {
      "name": "database",
      "aliases": [
        "db"
      ],
      "description": "Manage preview database",
      "subcommands": [
        {
          "name": "cache",
          "aliases": [
            "ca"
          ],
          "description": "Cache a snapshot into the preview database server",
          "options": [
            {
              "names": [
                "--tags"
              ],
              "description": "Filter snapshots by tags",
              "args": [
                {
                  "name": "tags-list",
                  "description": "Tag1,tag2,tag3"
                }
              ]
            },
            {
              "names": [
                "--latest"
              ],
              "description": "Select the latest snapshot captured to cache in the preview database server"
            },
            {
              "names": [
                "--clear"
              ],
              "description": "Remove the snapshot from the preview database server cache"
            }
          ],
          "args": [
            {
              "name": "snapshot",
              "isOptional": true,
              "generators": [
                {
                  "script": [
                    "snaplet",
                    "snapshot",
                    "ls"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "create",
          "aliases": [
            "c"
          ],
          "description": "Create a preview database from a snapshot",
          "options": [
            {
              "names": [
                "--tags"
              ],
              "description": "Filter snapshots by tags",
              "args": [
                {
                  "name": "tags-list",
                  "description": "Tag1,tag2,tag3"
                }
              ]
            },
            {
              "names": [
                "--latest"
              ],
              "description": "Restore the latest snapshot"
            },
            {
              "names": [
                "--git"
              ],
              "description": "Infer the database name from the current git branch"
            },
            {
              "names": [
                "--no-snapshot"
              ],
              "description": "Create an empty database not based on a snapshot"
            },
            {
              "names": [
                "--force"
              ],
              "description": "Force the database creation, it will drop and recreate the existing database if present"
            }
          ],
          "args": [
            {
              "name": "database-name"
            },
            {
              "name": "snapshot",
              "isOptional": true,
              "generators": [
                {
                  "script": [
                    "snaplet",
                    "snapshot",
                    "ls"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "drop",
          "aliases": [
            "delete",
            "d"
          ],
          "description": "Drop a preview database",
          "options": [
            {
              "names": [
                "--git"
              ],
              "description": "Infer the database name from the current git branch"
            }
          ],
          "args": [
            {
              "name": "database-name",
              "isOptional": true,
              "generators": [
                {
                  "script": [
                    "snaplet",
                    "database",
                    "ls"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "url",
          "aliases": [
            "u"
          ],
          "description": "Show a preview database url",
          "options": [
            {
              "names": [
                "--git"
              ],
              "description": "Infer the database name from the current git branch"
            }
          ],
          "args": [
            {
              "name": "database-name",
              "isOptional": true,
              "generators": [
                {
                  "script": [
                    "snaplet",
                    "database",
                    "ls"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "destroy",
          "aliases": [
            "ds"
          ],
          "description": "Destroy the database server",
          "options": [
            {
              "names": [
                "--yes"
              ],
              "description": "Automatically accept any prompt, useful for scripts"
            }
          ]
        },
        {
          "name": "setup",
          "aliases": [
            "s"
          ],
          "description": "Create a preview database server",
          "options": [
            {
              "names": [
                "--region"
              ],
              "description": "Fly.io region where the preview database server should be created",
              "args": [
                {
                  "suggestions": [
                    "ams",
                    "cdg",
                    "den",
                    "dfw",
                    "ewr",
                    "fra",
                    "gru",
                    "hkg",
                    "iad",
                    "jnb",
                    "lax",
                    "lhr",
                    "maa",
                    "mad",
                    "mia",
                    "nrt",
                    "ord",
                    "otp",
                    "scl",
                    "sea",
                    "sin",
                    "sjc",
                    "syd",
                    "waw",
                    "yul",
                    "yyz"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "list",
          "aliases": [
            "ls"
          ],
          "description": "List preview databases"
        }
      ]
    },
    {
      "name": "discord",
      "aliases": [
        "chat"
      ],
      "description": "Open the Snaplet Discord chat window in your browser"
    },
    {
      "name": "documentation",
      "aliases": [
        "docs"
      ],
      "description": "Opens the Snaplet Documentation in your browser"
    },
    {
      "name": "project",
      "description": "Manage project configuration",
      "subcommands": [
        {
          "name": "create",
          "description": "Create a new project",
          "options": [
            {
              "names": [
                "--team",
                "-t"
              ],
              "args": [
                {
                  "name": "team-name"
                }
              ]
            }
          ],
          "args": [
            {
              "name": "name"
            }
          ]
        },
        {
          "name": "invite",
          "description": "Create an invite URL for this project"
        },
        {
          "name": "setup",
          "description": "Set up a project",
          "args": [
            {
              "name": "project-id",
              "isOptional": true
            }
          ]
        }
      ]
    },
    {
      "name": "proxy",
      "aliases": [
        "dev"
      ],
      "description": "Start a database proxy"
    },
    {
      "name": "seed",
      "aliases": [
        "gen",
        "generate"
      ],
      "description": "Populates an empty database with generated data",
      "options": [
        {
          "names": [
            "-i",
            "--interactive"
          ],
          "description": "Show interactive prompts to customise seeding"
        },
        {
          "names": [
            "-n",
            "--entriesPerTable"
          ],
          "args": [
            {
              "name": "number"
            }
          ]
        }
      ]
    },
    {
      "name": "snapshot",
      "aliases": [
        "ss"
      ],
      "description": "Manage snapshots",
      "subcommands": [
        {
          "name": "capture",
          "aliases": [
            "c"
          ],
          "description": "Capture a new snapshot",
          "options": [
            {
              "names": [
                "--env",
                "--environment"
              ],
              "description": "Environment to use when capturing the snapshot",
              "args": [
                {
                  "name": "environment-name",
                  "suggestions": [
                    "cloud",
                    "local"
                  ]
                }
              ]
            },
            {
              "names": [
                "-m",
                "--message"
              ],
              "description": "Attach a message to the snapshot",
              "args": [
                {
                  "name": "message"
                }
              ]
            },
            {
              "names": [
                "--subset-path",
                "--subset"
              ],
              "description": "Path to a subset config file",
              "args": [
                {
                  "name": "path",
                  "template": "filepaths"
                }
              ]
            },
            {
              "names": [
                "--tags"
              ],
              "description": "Attach tags to the snapshot",
              "args": [
                {
                  "name": "tags-list",
                  "description": "Tag1,tag2,tag3"
                }
              ]
            },
            {
              "names": [
                "-t",
                "--transform-mode"
              ],
              "description": "Transformation mode to apply to the snapshot",
              "args": [
                {
                  "name": "transformation-mode",
                  "suggestions": [
                    "strict",
                    "unsafe",
                    "auto"
                  ]
                }
              ]
            }
          ],
          "args": [
            {
              "name": "destination-path",
              "isOptional": true,
              "template": "folders"
            }
          ]
        },
        {
          "name": "create",
          "description": "Create a snapshot in cloud",
          "options": [
            {
              "names": [
                "--json"
              ]
            }
          ]
        },
        {
          "name": "list",
          "aliases": [
            "ls"
          ],
          "description": "List all snapshots",
          "options": [
            {
              "names": [
                "--tags"
              ],
              "description": "Filter snapshots by tags",
              "args": [
                {
                  "name": "tags-list",
                  "description": "Tag1,tag2,tag3"
                }
              ]
            }
          ]
        },
        {
          "name": "restore",
          "aliases": [
            "r"
          ],
          "description": "Restore a snapshot",
          "options": [
            {
              "names": [
                "data",
                "--no-data"
              ],
              "description": "Restore data on the database (skip with --no-data)"
            },
            {
              "names": [
                "schema",
                "--no-schema"
              ],
              "description": "Restore schema on the database (skip with --no-schema)"
            },
            {
              "names": [
                "reset",
                "--no-reset"
              ],
              "description": "Drop destination database before restoring schemas (skip with --no-reset)"
            },
            {
              "names": [
                "--tags"
              ],
              "description": "Filter snapshots by tags",
              "args": [
                {
                  "name": "tags-list",
                  "description": "Tag1,tag2,tag3"
                }
              ]
            },
            {
              "names": [
                "--latest"
              ],
              "description": "Restore the latest snapshot"
            },
            {
              "names": [
                "-y",
                "--yes"
              ],
              "description": "Performs a restore without a confirmation message"
            },
            {
              "names": [
                "--schema-only"
              ],
              "description": "Skip data, only restore schema"
            },
            {
              "names": [
                "--data-only"
              ],
              "description": "Restore data only (keep the current schema and indexes)"
            }
          ],
          "args": [
            {
              "name": "snapshot-name",
              "isOptional": true,
              "generators": [
                {
                  "script": [
                    "snaplet",
                    "snapshot",
                    "ls"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "share",
          "aliases": [
            "upload"
          ],
          "description": "Share a snapshot",
          "options": [
            {
              "names": [
                "--no-encrypt"
              ],
              "description": "Disable encryption"
            },
            {
              "names": [
                "--tags"
              ],
              "description": "Filter snapshots by tags",
              "args": [
                {
                  "name": "tags-list",
                  "description": "Tag1,tag2,tag3"
                }
              ]
            },
            {
              "names": [
                "--latest"
              ],
              "description": "Share the latest snapshot"
            }
          ],
          "args": [
            {
              "name": "snapshot-name",
              "isOptional": true,
              "generators": [
                {
                  "script": [
                    "snaplet",
                    "snapshot",
                    "ls"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name": "sample",
          "aliases": [
            "s"
          ],
          "description": "Create a sample of a database",
          "options": [
            {
              "names": [
                "--env",
                "--environment"
              ],
              "description": "Environment to use when slicing the snapshot",
              "args": [
                {
                  "name": "environment-name",
                  "suggestions": [
                    "cloud",
                    "local"
                  ]
                }
              ]
            },
            {
              "names": [
                "--sample-config-path",
                "--subset-path"
              ],
              "description": "Path to a sample config file",
              "args": [
                {
                  "template": "filepaths"
                }
              ]
            },
            {
              "names": [
                "-f",
                "--force"
              ],
              "description": "Force overwrite existing sample file",
              "isDangerous": true
            }
          ],
          "args": [
            {
              "name": "destination-path",
              "isOptional": true,
              "template": "folders"
            }
          ]
        }
      ]
    },
    {
      "name": "subset",
      "aliases": [
        "subsetting"
      ],
      "description": "Manage subsetting",
      "subcommands": [
        {
          "name": "setup",
          "aliases": [
            "configure",
            "config"
          ],
          "description": "Configure subsetting"
        }
      ]
    },
    {
      "name": "team",
      "description": "Manage team configuration",
      "subcommands": [
        {
          "name": "create",
          "description": "Create a new team",
          "args": [
            {
              "name": "team-name"
            }
          ]
        }
      ]
    },
    {
      "name": "upgrade",
      "description": "Upgrade this binary"
    },
    {
      "name": "completion",
      "description": "Generate completion script"
    }
  ]
}
