Cotton code
254 lines · 6.1 KB · JSONRaw
{  "format_version": 1,  "id": "repo_label",  "name": "Label",  "plural": "Labels",  "builtin": true,  "visibility": "owner",  "title": "name",  "columns": [    {      "key": "repo_id",      "name": "Repository",      "type": "link",      "link_to": "repository",      "required": true,      "readonly": true    },    {      "key": "name",      "name": "Name",      "type": "text",      "readonly": true,      "required": true    },    {      "key": "color",      "name": "Colour",      "type": "text",      "readonly": true    },    {      "key": "description",      "name": "What it is for",      "type": "text",      "readonly": true    },    {      "key": "remote_id",      "type": "number",      "readonly": true    },    {      "key": "meta",      "name": "Colour and use",      "type": "text",      "readonly": true    },    {      "key": "origin",      "name": "Hosted by",      "type": "text",      "readonly": true    }  ],  "instructions": "A label is one word of a repository's label vocabulary, which its pull requests and issues can wear. Its colour is six hexadecimal digits the host draws it in; Cotton prints the word. Renaming or deleting one on a git host changes every pull request and issue carrying it.",  "tables": [    {      "name": "cotton_repo_labels",      "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": "color",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    color TEXT",          "position": 4        },        {          "name": "description",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    description TEXT",          "position": 5        },        {          "name": "remote_id",          "type": "INTEGER",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    remote_id INTEGER",          "position": 6        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 7        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 8        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 9        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 10        }      ],      "constraints": [        {          "declaration": "\n    UNIQUE (workspace_id, repo_id, name)",          "position": 11        },        {          "declaration": "\n    CHECK (length(trim(name)) > 0)",          "position": 12        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE",          "position": 13        },        {          "declaration": "\n    FOREIGN KEY (repo_id) REFERENCES cotton_repos(id)\n  ",          "position": 14        }      ],      "prefix": "CREATE TABLE IF NOT EXISTS cotton_repo_labels (",      "suffix": ")",      "indexes": [        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_labels_repo ON cotton_repo_labels (workspace_id, repo_id, name)",        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_labels_author ON cotton_repo_labels (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    }  ],  "picture": null,  "engine": "repos",  "date": null,  "project": null,  "order": null,  "slip": {    "title": "name",    "subtitle": "meta",    "trailing": null,    "photo": null,    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "name",        "color",        "description"      ]    },    {      "heading": "Details",      "columns": [        "origin",        "repo_id"      ]    }  ],  "empty": {    "title": "No labels.",    "message": "This repository has no labels yet."  },  "delete": false,  "commands": [    {      "id": "edit",      "label": "Edit",      "kind": "update",      "method": "repo.editLabel",      "bindings": {        "id": "repo_id",        "name": "name",        "color": "color",        "description": "description"      },      "receipt": "Updated label",      "object": "edit"    },    {      "id": "delete",      "label": "Delete",      "kind": "delete",      "method": "repo.deleteLabel",      "confirm": "Delete this label?",      "bindings": {        "id": "repo_id",        "name": "name"      },      "receipt": "Deleted",      "does": "destroys"    }  ]}