aboutsummaryrefslogtreecommitdiff
path: root/SPEC.md
blob: c44a86ad34d2372c1fc0d57df2d5a85986a92f7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# Manifest Specification

A lite-xl manifest is a JSON file contains three different keys:

* Remotes
* Addons
* Lite-XLs

## Remotes

A simple array of string repository identifiers. A repository identifier takes
the form of a git remote url, i.e. `<url>:<ref>`. An example would be:

`https://github.com/lite-xl/lite-xl-plugin-manager.git:latest`

## Addons

Addons are the primary objects specified in this specification. An addon
consists of a series of metadata, the path to the addon in this repository,
or its location on a remote repository, or a publically accessible URL,and a
set of files to be downloaded with the plugin (usually releases, but can be
data files, or fonts, or anything else).

Addons can specify optionally specify a type, which determines where they're
installed. Currently three types are supported:

* `library`
* `plugin`
* `color`

Addons are further classified into two organizational categories.
`singleton` addons, and `complex` addons. Addons are listed a `singleton`
if and only if they consist of exactly one file, have an empty or absent
`files` specification, and do not specify a `remote`. Singleton addons
consist of exactly one `.lua` file, named after the addon. Complex addons
are contained within a folder, and have an `init.lua` or `init.so` file that
loads other components within it.

The vast majority of addons are `singleton` `plugin`s.

### Metadata

Fields that are required are bolded.

* **`id`**: The semantic id of the addon, a string only containing `[a-z0-9\-_]`.
* **`version`**: The addon's semantic version. A string that can contains `[0-9\.]`.
* **`mod_version`**: The mod_version this addon is compatible with.
  A string that can contain `[0-9\.]`. If `type` is `library`, this field is optional.
* `type`: An optional string that specifies the addon type. Valid values are `"plugin"`
  `"library"`, or `"color"`. Defaults to `"plugin"`.
* `name`: The optional name of the addon.
* `description`: An optional english-language description of the addon.
* `provides`: An optional array of strings that are a shorthand of functionality
 this addon provides. Can be used as a dependency.
* `replaces`: An optional array of ids that this plugin explicitly replaces. Will always
 prefer this plugin in place of those plugins, so long as version requirements are met.
* `remote`: Optional. Specifies a public https git link where this addon is located. If present,
 denotes a **stub**.
* `dependencies`: Optionally a hash of dependencies required, or optional
  for this addon.
* `conflicts`: An optional hash of addons which conflict with this one, in the same
  format as `dependencies`.
* `tags`:  Optional freeform tags that may describe attributes of the addon.
* `path`: Optional path to the addon. If omitted, will only pull the files in
  `files`. To pull the whole repository, use `"."`.
* `arch`: Optionally a list of architectures this plugin supports. If not present, and no `files` that specify arches, assumes that plugin is valid for all architectures. If not present, and at least one `files` exists that specifies an architecture, only assumed to be valid for all `arch`es specified under `files`. Can be either an array of arch names, or can be `"*"` to explicitly specify all architectures.
* `post`: Optionally a string which represents a command to run. If presented
  with a dictionary, takes `ARCH` keys, and runs a different command per `ARCH`.
* `url`: Optionally a URL which specifies a direct download link to a single lua file.
  precludes the use of `remote`, `path`. Usually a `singleton`.
* `extra`: Optionally a dictionary which holds any desired extra information.

Any keys not present in this official listing render the manifest non-conforming.
Any extra keys should be placed in `extra`. An example of keys that can be placed
in `extra` that some plugin managers/displays will use are:

* `author`: The main author of the addon.
* `license`: The license under which the addon is licensed.

### Dependencies

Depedencies are specified in an object, with the key being the `id` of the
addon depended upon, or a `provides` alias.

Dependency values are an object which contain the following keys:

* `version`: A version specifier. (see below).
* `optional`: A boolean that determines whether the dependency is optional.

### Stubs

If a addon likes, it can specify a particular `remote`; a publically acessible
git repository, accessed via HTTPS, pinned at a specific commit to be used as a
source for its data. In that case, the package manager must download the repository,
and interpret the manifest file found there to determine the addon's metadata.

This is known as a stub.

### Files

Files are objects that contain at least two keys, `url`, and `checksum`. They
can also optionally contain the `arch` and `path` keys.

* `url` represents the URL to grab the particular file from.
* `checksum` is the sha256hex checksum for the file. If `"SKIP"` is specified, the
  check is skipped. This is fine for development purposes, but any publically
  accessible manifest, should specify a checksum.
* `arch` is the lite-xl/clang architecture tuple that the file is relevant for.
  if omitted, file is to be assumed to be valid for all arhcitectures. Can be an array.
* `path` is the location to install this file inside the addon's directory.

If a file is an archive, of either `.zip` or `.tar.gz`, it will automatically
be extracted inside the addon's directory.

## Lite-XLs

Lite-XLs represent different version of lite-xl that are registered in this
repository. Lite-XLs has the following metadata, as well as a `files` array.

* `version`: A version specifier. Must take the form of x.x(.x)(-suffix).
  Suffixes can be used to denote different flavours of lite-xl.
* `mod_version`: The modversion the binary corresponds to.

### Files

The files array is identical to that of the `files` array under `addons`.
Conventionally, there should be a single file per architecture that is a
`.tar.gz` or `.zip` containing all necessary files for `lite-xl` to run.

## Version Specifiers

When asking for a version, all fields can use inequality operators to specify
the version to be asked for. As an example, `>=0.1` can be used to specify
that any version greater than `0.1` can be used.

## Example File

```yaml
{
  "addons": [ # The addons array contains a list of all addons registered on this repository.
    {
      "id": "plugin_manager", # Unique name, used to reference the plugin.
      "version": "0.1", # Semantic version.
      "description": "A GUI interface to the Adam's lite plugin manager.", # English description of the plugin.
      "path": "plugins/plugin_manager", # The path to the plugin in this repository.
      "mod_version": "3", # The mod_version this plugin corresponds to.
      "provides": [ # A list of small strings that represent functionalities this plugin provides.
        "plugin-manager"
      ],
      "files": [ # A list of files (usually binaries) this plugin requires to function.
        {
          "url": "https://github.com/adamharrison/lite-xl-plugin-manager/releases/download/v0.1/lpm.x86_64-linux", # A publically accessible to download from.
          "arch": "x86_64-linux", # The lite-xl/clang target tuple that represents the architecture this file is for.
          "checksum": "d27f03c850bacdf808436722cd16e2d7649683e017fe6267934eeeedbcd21096" # the sha256hex checksum that corresponds to this file.
        },
        {
          "url": "https://github.com/adamharrison/lite-xl-plugin-manager/releases/download/v0.1/lpm.x86_64-windows.exe",
          "arch": "x86_64-windows",
          "checksum": "2ed993ed4376e1840b0824d7619f2d3447891d3aa234459378fcf9387c4e4680"
        }
      ],
      "dependencies": {
        "json": {} # Depeneds on `json`, can be a plugin's name or one of its `provides`.
      }
    },
    {
      "id": "json",
      "version": "1.0",
      "description": "JSON support plugin, provides encoding/decoding.",
      "type": "library",
      "path": "plugins/json.lua",
      "provides": [
        "json"
      ]
    },
    {
      "tags": ["language"],
      "description": "Syntax for .gitignore, .dockerignore and some other `.*ignore` files",
      "version": "1.0",
      "mod_version": "3",
      "remote": "https://github.com/anthonyaxenov/lite-xl-ignore-syntax:2ed993ed4376e1840b0824d7619f2d3447891d3aa234459378fcf9387c4e4680", # The remote to be used for this plugin.
      "id": "language_ignore",
      "post": {"x86-linux":"cp language_ignore.lua /tmp/somewhere-else", "x86-windows":"COPY language_ignore.lua C:\\Users\\Someone\\ignore.lua"} # Post download steps to run to fully set up the plugin. Does not run by default, requires --post.
    },
    {
      "description": "Provides a GUI to manage core and plugin settings, bindings and select color theme. Depends on widget.",
      "dependencies": {
        "toolbarview": { "version": ">=1.0" },
        "widget": { "version": ">=1.0" }
      },
      "version": "1.0",
      "mod_version": "3",
      "path": "plugins/settings.lua",
      "id": "settings"
    },
    {
      "description": "Syntax for Kaitai struct files",
      "url": "https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1", # URL directly to the singleton plugin file.
      "id": "language_ksy",
      "version": "1.0",
      "mod_version": "3",
      "checksum": "08a9f8635b09a98cec9dfca8bb65f24fd7b6585c7e8308773e7ddff9a3e5a60f", # Checksum for this particular URL.
    }
  ],
  "lite-xls": [ # An array of lite-xl releases.
    {
      "version": "2.1-simplified", # The version, followed by a release suffix defining the release flavour. The only releases that are permitted to not have suffixes are official relases.
      "mod_version": "3", # The mod_version this release corresponds to.
      "files": [ # Identical to `files` under `addons`, although these are usually simply archives to be extracted.
        {
          "arch": "x86_64-linux",
          "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/lite-xl-2.1.0-simplified-x86_64-linux.tar.gz",
          "checksum": "b5087bd03fb491c9424485ba5cb16fe3bb0a6473fdc801704e43f82cdf960448"
        },
        {
          "arch": "x86_64-windows",
          "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/lite-xl-2.1.0-simplified-x86_64-windows.zip",
          "checksum": "f12cc1c172299dd25575ae1b7473599a21431f9c4e14e73b271ff1429913275d"
        }
      ]
    },
    {
      "version": "2.1-simplified-enhanced",
      "mod_version": "3",
      "files": [
        {
          "arch": "x86_64-linux",
          "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/lite-xl-2.1.0-simplified-x86_64-linux-enhanced.tar.gz",
          "checksum": "4625c7aac70a2834ef5ce5ba501af2d72d203441303e56147dcf8bcc4b889e40"
        },
        {
          "arch": "x86_64-windows",
          "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/lite-xl-2.1.0-simplified-x86_64-windows-enhanced.zip",
          "checksum": "5ac009e3d5a5c99ca7fbd4f6b5bd4e25612909bf59c0925eddb41fe294ce28a4"
        }
      ]
    }
  ],
  "remotes": [ # A list of remote specifiers. The plugin manager will pull these in and add them as additional repositories if specified to do so with a flag.
    "https://github.com/lite-xl/lite-xl-plugins.git:2.1",
    "https://github.com/adamharrison/lite-xl-simplified.git:v2.1"
  ]
}
```