Cotton code
220 lines · 5.3 KB · JSONRaw
{  "format_version": 1,  "id": "repo_var",  "name": "Variable",  "plural": "Variables",  "builtin": true,  "visibility": "owner",  "title": "name",  "columns": [    {      "key": "repo_id",      "name": "Repository",      "type": "link",      "link_to": "repository",      "readonly": true    },    {      "key": "name",      "name": "Name",      "type": "text",      "readonly": true,      "required": true    },    {      "key": "value",      "name": "Value",      "type": "text",      "readonly": true    },    {      "key": "secrets_in",      "name": "Secrets",      "type": "text",      "readonly": true    }  ],  "instructions": "A variable is a name and a value a repository's workflows read as vars.NAME when they run on the owner's Macs. Variables are stored in the clear; a password or a token belongs in Passwords, where a job reads its secrets.",  "tables": [    {      "name": "cotton_repo_vars",      "columns": [        {          "name": "id",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": true,          "declaration": "\n    id TEXT PRIMARY KEY",          "position": 0        },        {          "name": "workspace_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    workspace_id TEXT NOT NULL",          "position": 1        },        {          "name": "repo_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    repo_id TEXT NOT NULL",          "position": 2        },        {          "name": "name",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    name TEXT NOT NULL",          "position": 3        },        {          "name": "value",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    value TEXT NOT NULL",          "position": 4        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 5        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 6        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 7        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 8        }      ],      "constraints": [        {          "declaration": "\n    UNIQUE (workspace_id, repo_id, name)",          "position": 9        },        {          "declaration": "\n    CHECK (length(trim(name)) > 0)",          "position": 10        },        {          "declaration": "\n    CHECK (name NOT GLOB '*[^A-Za-z0-9_]*')",          "position": 11        },        {          "declaration": "\n    CHECK (length(value) <= 65536)",          "position": 12        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n  ",          "position": 13        }      ],      "prefix": "CREATE TABLE IF NOT EXISTS cotton_repo_vars (",      "suffix": ")",      "indexes": [        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_vars_repo ON cotton_repo_vars (workspace_id, repo_id, name)",        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_vars_author ON cotton_repo_vars (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    }  ],  "picture": null,  "engine": "ci",  "date": null,  "project": null,  "order": null,  "slip": {    "title": "name",    "subtitle": "value",    "trailing": null,    "photo": null,    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "name",        "value",        "secrets_in"      ]    },    {      "heading": "Details",      "columns": [        "repo_id"      ]    }  ],  "empty": {    "title": "No variables.",    "message": "No variables on this repository."  },  "delete": false,  "commands": [    {      "id": "set",      "label": "Set",      "kind": "update",      "method": "repo.setVar",      "bindings": {        "id": "repo_id",        "name": "name",        "value": "value"      },      "receipt": "Set variable",      "object": "edit"    },    {      "id": "delete",      "label": "Delete",      "kind": "delete",      "method": "repo.deleteVar",      "confirm": "Delete this variable?",      "bindings": {        "id": "repo_id",        "name": "name"      },      "receipt": "Deleted",      "does": "destroys"    }  ]}