{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://flowexec.io/schemas/config_schema.json",
  "title": "Config",
  "description": "User Configuration for the Flow CLI.\nIncludes configurations for workspaces, templates, I/O, and other settings for the CLI.\n\nIt is read from the user's flow config directory:\n- **MacOS**: `$HOME/Library/Application Support/flow`\n- **Linux**: `$HOME/.config/flow`\n- **Windows**: `%APPDATA%\\flow`\n\nAlternatively, a custom path can be set using the `FLOW_CONFIG_PATH` environment variable.\n",
  "type": "object",
  "required": [
    "workspaces",
    "currentWorkspace"
  ],
  "definitions": {
    "ColorPalette": {
      "description": "The color palette for the interactive UI.\nThe colors can be either an ANSI 16, ANSI 256, or TrueColor (hex) value.\nIf unset, the default color for the current theme will be used.\n",
      "type": "object",
      "properties": {
        "black": {
          "type": "string"
        },
        "body": {
          "type": "string"
        },
        "border": {
          "type": "string"
        },
        "codeStyle": {
          "description": "The style of the code block. For example, `monokai`, `dracula`, `github`, etc.\nSee [chroma styles](https://github.com/alecthomas/chroma/tree/master/styles) for available style names.\n",
          "type": "string"
        },
        "emphasis": {
          "type": "string"
        },
        "error": {
          "type": "string"
        },
        "gray": {
          "type": "string"
        },
        "info": {
          "type": "string"
        },
        "primary": {
          "type": "string"
        },
        "secondary": {
          "type": "string"
        },
        "success": {
          "type": "string"
        },
        "tertiary": {
          "type": "string"
        },
        "warning": {
          "type": "string"
        },
        "white": {
          "type": "string"
        }
      }
    },
    "GitSource": {
      "description": "Where a workspace added from a git URL pulls from.",
      "type": "object",
      "required": [
        "remote"
      ],
      "properties": {
        "ref": {
          "description": "The branch or tag name specified when the workspace was added.",
          "type": "string",
          "default": ""
        },
        "refType": {
          "description": "The type of ref. Empty if no ref was specified.",
          "type": "string",
          "default": "",
          "enum": [
            "",
            "branch",
            "tag"
          ]
        },
        "remote": {
          "description": "The git remote URL the workspace was cloned from.",
          "type": "string"
        }
      }
    },
    "Interactive": {
      "description": "Configurations for the interactive UI.",
      "type": "object",
      "required": [
        "enabled"
      ],
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "mouse": {
          "description": "Whether the interactive UI responds to the mouse: scrolling, clicking to select, and clicking\nbreadcrumbs to go back. Defaults to `true`. While enabled, most terminals require holding\nShift (Option on iTerm2) to select text.\n",
          "type": "boolean"
        },
        "notifyOnCompletion": {
          "description": "Whether to send a desktop notification when a command completes.",
          "type": "boolean"
        },
        "soundOnCompletion": {
          "description": "Whether to play a sound when a command completes.",
          "type": "boolean"
        }
      }
    },
    "LogRetention": {
      "description": "Limits on the run logs kept in flow's logs directory. Each time an executable runs, the oldest\nlogs are removed until every limit is met. An unset field uses its default; `0` removes that limit.\n",
      "type": "object",
      "properties": {
        "maxAge": {
          "description": "Remove logs older than this duration. Defaults to `720h` (30 days).\n",
          "type": "string"
        },
        "maxCount": {
          "description": "Keep at most this many logs. Defaults to `1000`.",
          "type": "integer"
        },
        "maxSizeMB": {
          "description": "Keep the total size of all logs under this many megabytes. Defaults to `500`.",
          "type": "integer"
        }
      }
    }
  },
  "properties": {
    "colorOverride": {
      "$ref": "#/definitions/ColorPalette",
      "description": "Override the default color palette for the interactive UI.\nThis can be used to customize the colors of the UI.\n"
    },
    "currentNamespace": {
      "description": "The name of the current namespace.\n\nNamespaces are used to reference executables in the CLI using the format `workspace/namespace:name`.\nIf the namespace is not set, only executables defined without a namespace will be discovered.\n",
      "type": "string",
      "default": ""
    },
    "currentVault": {
      "description": "The name of the currently active vault.",
      "type": "string"
    },
    "currentWorkspace": {
      "description": "The name of the current workspace. This should match a key in the `workspaces` or `remoteWorkspaces` map.",
      "type": "string",
      "default": ""
    },
    "customVerbs": {
      "description": "Additional executable verbs registered by the user.\nVerbs must be lowercase words made up of letters, numbers, and hyphens.\nManage them with `flow config add verb` and `flow config remove verb`.\n",
      "type": "array",
      "default": [],
      "items": {
        "type": "string"
      }
    },
    "defaultLogMode": {
      "description": "The default log mode to use when running executables.\nThis can either be `hidden`, `json`, `logfmt` or `text`\n\n`hidden` will not display any logs.\n`json` will display logs in JSON format.\n`logfmt` will display logs with a log level, timestamp, and message.\n`text` will just display the log message.\n",
      "type": "string",
      "default": "logfmt"
    },
    "defaultTimeout": {
      "description": "The default timeout to use when running executables.\nThis should be a valid duration string.\n",
      "type": "string",
      "default": "30m"
    },
    "gitWorkspaces": {
      "description": "Map of workspace names to their git source, for workspaces added from a git URL. This is set automatically\nand kept here because the workspace's own flow.yaml is a tracked file that belongs to the upstream repository.\n",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/GitSource"
      }
    },
    "interactive": {
      "$ref": "#/definitions/Interactive"
    },
    "logRetention": {
      "$ref": "#/definitions/LogRetention",
      "description": "Limits on how many run logs flow keeps, by age, total size, and count.\nManage them with `flow config set log-retention`.\n"
    },
    "templates": {
      "description": "A map of flowfile template names to their paths.",
      "type": "object",
      "default": {},
      "additionalProperties": {
        "type": "string"
      }
    },
    "theme": {
      "description": "The theme of the interactive UI.",
      "type": "string",
      "default": "default",
      "enum": [
        "default",
        "everforest",
        "dark",
        "light",
        "dracula",
        "tokyo-night"
      ]
    },
    "updateCheck": {
      "description": "Whether to check for CLI updates in the background.\nWhen enabled, flow will periodically check GitHub for a newer version and\ndisplay a notice if one is available after each command.\nSet `FLOW_NO_UPDATE_CHECK=1` to suppress checks regardless of this setting.\n",
      "type": "boolean",
      "default": false
    },
    "vaults": {
      "description": "A legacy map of vault names to their storage paths, retained for backwards compatibility.\nThe authoritative list of vaults is discovered from the vault configuration directory managed\nby flow; this map is no longer required to reference or switch vaults.\n",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "workspaceMode": {
      "description": "The mode of the workspace. This can be either `fixed` or `dynamic`.\nIn `fixed` mode, the current workspace used at runtime is always the one set in the currentWorkspace config field.\nIn `dynamic` mode, the current workspace used at runtime is determined by the current directory.\nIf the current directory is within a workspace, that workspace is used.\n",
      "type": "string",
      "default": "dynamic",
      "enum": [
        "fixed",
        "dynamic"
      ]
    },
    "workspaces": {
      "description": "Map of workspace names to their paths. The path should be a valid absolute path to the workspace directory.\n",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  }
}