@astera-app/plugin-sdk 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,245 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Astera plugin package.json",
4
+ "description": "The structure of an Astera plugin's package.json, for an editor. `astera plugins validate` is the authority: it checks rules a schema cannot hold (a command naming a declared panel, a theme's contrast, files in the folder), and a manifest this schema passes can still fail there.",
5
+ "type": "object",
6
+ "required": ["name", "version", "astera"],
7
+ "properties": {
8
+ "name": {
9
+ "description": "The npm package name, which is also the plugin's id.",
10
+ "type": "string",
11
+ "maxLength": 214,
12
+ "pattern": "^(?:@[a-z0-9-][a-z0-9-._]*\\/)?[a-z0-9-][a-z0-9-._]*$"
13
+ },
14
+ "version": {
15
+ "description": "A semver version.",
16
+ "type": "string",
17
+ "pattern": "^(\\d+)\\.(\\d+)\\.(\\d+)(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
18
+ },
19
+ "displayName": {
20
+ "description": "The name Astera shows; the package name when absent.",
21
+ "type": "string",
22
+ "minLength": 1,
23
+ "maxLength": 64
24
+ },
25
+ "description": {
26
+ "description": "One or two sentences Astera shows beside the plugin.",
27
+ "type": "string"
28
+ },
29
+ "license": {
30
+ "description": "An SPDX license id, or SEE LICENSE IN <file>. validate warns when it is missing or not one it knows.",
31
+ "type": "string"
32
+ },
33
+ "engines": {
34
+ "properties": {
35
+ "astera": {
36
+ "description": "Plugin API 2: the Astera versions the plugin runs on, as comparators all of which must hold, such as \">=1.7.0 <2.0.0\".",
37
+ "type": "string"
38
+ }
39
+ }
40
+ },
41
+ "astera": {
42
+ "description": "What Astera reads: the Plugin API, what the plugin runs and shows, and what it asks for.",
43
+ "type": "object",
44
+ "required": ["apiVersion"],
45
+ "properties": {
46
+ "apiVersion": {
47
+ "description": "The Plugin API the plugin is written for. \"2\" adds a ui page, contributions and themes.",
48
+ "type": "string",
49
+ "enum": ["1", "2"]
50
+ },
51
+ "entry": {
52
+ "description": "The Node file Astera starts, relative to the plugin's folder: trusted code with the person's rights. Required by Plugin API 1.",
53
+ "type": "string",
54
+ "minLength": 1
55
+ },
56
+ "ui": { "description": "Plugin API 2: the .html page the plugin's panels show, relative to its folder. Plugin API 1 ignores it." },
57
+ "capabilities": {
58
+ "description": "What the plugin's Host code serves; each needs an entry.",
59
+ "type": "array",
60
+ "uniqueItems": true,
61
+ "items": { "enum": ["event", "job-source", "completion-check", "notification"] }
62
+ },
63
+ "permissions": {
64
+ "description": "What the plugin asks Astera for. The first group opens Host commands to an entry; the second is the UI's (Plugin API 2).",
65
+ "type": "array",
66
+ "uniqueItems": true,
67
+ "items": {
68
+ "enum": [
69
+ "projects.read",
70
+ "jobs.read",
71
+ "jobs.create",
72
+ "jobs.run",
73
+ "runs.read",
74
+ "runs.control",
75
+ "tasks.read",
76
+ "tasks.write",
77
+ "questions.read",
78
+ "questions.answer",
79
+ "completion.read",
80
+ "events.subscribe",
81
+ "github.read",
82
+ "github.write",
83
+ "how-it-works.read",
84
+ "commands.register",
85
+ "panels.register",
86
+ "workspace.read",
87
+ "themes.register",
88
+ "network.request",
89
+ "files.read",
90
+ "files.write"
91
+ ]
92
+ }
93
+ },
94
+ "minAsteraVersion": {
95
+ "description": "The oldest Astera that runs the plugin.",
96
+ "type": "string",
97
+ "pattern": "^(\\d+)\\.(\\d+)\\.(\\d+)(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
98
+ },
99
+ "settingsSchema": { "$ref": "#/$defs/settingsSchema" },
100
+ "network": {
101
+ "description": "Plugin API 2: the origins the plugin always needs, granted with the install. Needs network.request.",
102
+ "type": "object",
103
+ "properties": {
104
+ "origins": {
105
+ "type": "array",
106
+ "maxItems": 20,
107
+ "items": {
108
+ "type": "object",
109
+ "required": ["origin", "access"],
110
+ "properties": {
111
+ "origin": { "description": "https:// or http://, a host and an optional port, no path.", "type": "string" },
112
+ "access": { "description": "read sends no body; send may.", "enum": ["read", "send"] }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ },
118
+ "contributes": { "description": "Plugin API 2: what the plugin adds to Astera's interface. Plugin API 1 ignores it." }
119
+ },
120
+ "if": { "required": ["apiVersion"], "properties": { "apiVersion": { "const": "2" } } },
121
+ "then": {
122
+ "properties": {
123
+ "ui": { "type": "string", "pattern": "\\.[Hh][Tt][Mm][Ll]$" },
124
+ "contributes": {
125
+ "type": "object",
126
+ "properties": {
127
+ "commands": { "description": "Each opens one of the plugin's panels.", "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/command" } },
128
+ "panels": { "description": "Panels showing the plugin's ui page.", "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/panel" } },
129
+ "sidebar": { "description": "A panel shown in the sidebar from a rail button.", "type": "array", "maxItems": 2, "items": { "$ref": "#/$defs/sidebarView" } },
130
+ "statusBar": { "description": "A short text in the status bar that runs one of the plugin's commands.", "type": "array", "maxItems": 2, "items": { "$ref": "#/$defs/statusItem" } },
131
+ "themes": { "description": "Colour themes over a built-in base.", "type": "array", "maxItems": 4, "items": { "$ref": "#/$defs/theme" } }
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ },
138
+ "$defs": {
139
+ "contributionId": {
140
+ "description": "Lower-case letters, digits and . _ -, starting with a letter or digit.",
141
+ "type": "string",
142
+ "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
143
+ },
144
+ "title": { "type": "string", "minLength": 1, "maxLength": 64 },
145
+ "command": {
146
+ "type": "object",
147
+ "required": ["id", "title", "panel"],
148
+ "properties": {
149
+ "id": { "$ref": "#/$defs/contributionId" },
150
+ "title": { "$ref": "#/$defs/title" },
151
+ "panel": { "description": "The id of a panel the plugin contributes.", "type": "string", "minLength": 1 }
152
+ }
153
+ },
154
+ "panel": {
155
+ "type": "object",
156
+ "required": ["id", "title"],
157
+ "properties": {
158
+ "id": { "$ref": "#/$defs/contributionId" },
159
+ "title": { "$ref": "#/$defs/title" },
160
+ "fileTypes": {
161
+ "description": "Extensions, lower case and without a dot, whose files Astera offers to open in this panel. Needs files.read.",
162
+ "type": "array",
163
+ "maxItems": 20,
164
+ "items": { "type": "string", "pattern": "^[a-z0-9][a-z0-9+_-]{0,15}$" }
165
+ }
166
+ }
167
+ },
168
+ "sidebarView": {
169
+ "type": "object",
170
+ "required": ["id", "title", "panel"],
171
+ "properties": {
172
+ "id": { "$ref": "#/$defs/contributionId" },
173
+ "title": { "$ref": "#/$defs/title" },
174
+ "panel": { "description": "The id of a panel the plugin contributes.", "type": "string" }
175
+ }
176
+ },
177
+ "statusItem": {
178
+ "type": "object",
179
+ "required": ["id", "text", "command"],
180
+ "properties": {
181
+ "id": { "$ref": "#/$defs/contributionId" },
182
+ "text": { "type": "string", "minLength": 1, "maxLength": 24 },
183
+ "command": { "description": "The id of a command the plugin contributes.", "type": "string" }
184
+ }
185
+ },
186
+ "hex": { "description": "A #rrggbb colour.", "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
187
+ "theme": {
188
+ "description": "Colours over a built-in base; validate checks that text keeps its contrast and surfaces stay dark.",
189
+ "type": "object",
190
+ "required": ["id", "title", "base", "colors"],
191
+ "properties": {
192
+ "id": { "$ref": "#/$defs/contributionId" },
193
+ "title": { "$ref": "#/$defs/title" },
194
+ "base": { "enum": ["vega", "orion", "umbra", "aurora", "antares", "quasar", "sirius"] },
195
+ "colors": {
196
+ "type": "object",
197
+ "additionalProperties": false,
198
+ "properties": {
199
+ "bg": { "$ref": "#/$defs/hex" },
200
+ "rail": { "$ref": "#/$defs/hex" },
201
+ "panel": { "$ref": "#/$defs/hex" },
202
+ "elevated": { "$ref": "#/$defs/hex" },
203
+ "surfaceHover": { "$ref": "#/$defs/hex" },
204
+ "termBg": { "$ref": "#/$defs/hex" },
205
+ "line": { "$ref": "#/$defs/hex" },
206
+ "lineSoft": { "$ref": "#/$defs/hex" },
207
+ "text": { "$ref": "#/$defs/hex" },
208
+ "textDim": { "$ref": "#/$defs/hex" },
209
+ "textFaint": { "$ref": "#/$defs/hex" },
210
+ "railIcon": { "$ref": "#/$defs/hex" },
211
+ "accent": { "$ref": "#/$defs/hex" },
212
+ "accentInk": { "$ref": "#/$defs/hex" },
213
+ "statusBg": { "$ref": "#/$defs/hex" },
214
+ "statusInk": { "$ref": "#/$defs/hex" },
215
+ "mdLink": { "$ref": "#/$defs/hex" }
216
+ }
217
+ }
218
+ }
219
+ },
220
+ "settingsSchema": {
221
+ "description": "The settings a person sets with astera plugins configure; needs an entry.",
222
+ "type": "object",
223
+ "required": ["type", "properties"],
224
+ "additionalProperties": false,
225
+ "properties": {
226
+ "type": { "const": "object" },
227
+ "properties": { "type": "object", "maxProperties": 50, "additionalProperties": { "$ref": "#/$defs/setting" } },
228
+ "required": { "type": "array", "items": { "type": "string" } }
229
+ }
230
+ },
231
+ "setting": {
232
+ "type": "object",
233
+ "required": ["type"],
234
+ "additionalProperties": false,
235
+ "properties": {
236
+ "type": { "enum": ["string", "number", "integer", "boolean"] },
237
+ "title": { "type": "string", "maxLength": 64 },
238
+ "description": { "type": "string", "maxLength": 500 },
239
+ "default": { "type": ["string", "number", "boolean"] },
240
+ "enum": { "type": "array", "maxItems": 50 },
241
+ "secret": { "description": "A string kept in Astera's secret store and never shown.", "const": true }
242
+ }
243
+ }
244
+ }
245
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astera-app/plugin-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Write Astera plugins: definePlugin and the plugin context's types.",
5
5
  "keywords": [
6
6
  "astera",
@@ -31,10 +31,22 @@
31
31
  "default": "./dist/cjs/index.js"
32
32
  }
33
33
  },
34
+ "./panel": {
35
+ "import": {
36
+ "types": "./dist/esm/panel.d.ts",
37
+ "default": "./dist/esm/panel.js"
38
+ },
39
+ "require": {
40
+ "types": "./dist/cjs/panel.d.ts",
41
+ "default": "./dist/cjs/panel.js"
42
+ }
43
+ },
44
+ "./manifest.schema.json": "./manifest.schema.json",
34
45
  "./package.json": "./package.json"
35
46
  },
36
47
  "files": [
37
48
  "dist",
49
+ "manifest.schema.json",
38
50
  "README.md",
39
51
  "LICENSE",
40
52
  "CHANGELOG.md"