@delurio/cli 0.7.0 → 0.9.0

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,189 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unpkg.com/@delurio/cli@0.9.0/schemas/needs.schema.json",
4
+ "title": "delurio needs of a flow (needs.yaml)",
5
+ "description": "What must exist for a flow's users, in delurio-graph/0 (SPEC.md §13): a closed list beside the flow's flow.yaml, each need with the evidence that it exists, or `missing` and why it does not yet. A need that is missing is a gap of the product, listed in its needs.gaps.yaml.",
6
+ "type": "object",
7
+ "required": ["schema", "kind", "id", "needs"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "schema": { "$ref": "#/$defs/formatVersion" },
11
+ "kind": { "description": "The kind of graph file. A needs.yaml is `needs`.", "const": "needs" },
12
+ "id": {
13
+ "type": "string",
14
+ "description": "The id of the flow beside this file, whose needs these are.",
15
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
16
+ "examples": ["example.restoreNote"]
17
+ },
18
+ "title": { "type": "string", "description": "The list in plain words, for people." },
19
+ "summary": { "type": "string", "description": "Where the needs come from and what they cover, in a few plain sentences." },
20
+ "status": {
21
+ "description": "`proposed`: written, nobody has approved it. `approved`: the owner reviewed and accepted the list. A list is written from what the flow's users need, never read from the code, so it is never `captured`.",
22
+ "enum": ["proposed", "approved"]
23
+ },
24
+ "needs": {
25
+ "type": "array",
26
+ "description": "The needs, in the order people read them. Each id comes once.",
27
+ "minItems": 1,
28
+ "items": { "$ref": "#/$defs/need" }
29
+ }
30
+ },
31
+ "$defs": {
32
+ "formatVersion": {
33
+ "description": "The format and its version. Every graph file starts with it.",
34
+ "const": "delurio-graph/0"
35
+ },
36
+ "need": {
37
+ "type": "object",
38
+ "description": "One thing that must exist for the flow's users. A need without `missing` is met, and names evidence outside the graph (a source, a test, a scenario or a setting); a need with `missing` is a gap, and may name what exists of it so far.",
39
+ "required": ["id", "need"],
40
+ "additionalProperties": false,
41
+ "properties": {
42
+ "id": { "$ref": "#/$defs/needId" },
43
+ "need": {
44
+ "type": "string",
45
+ "description": "What must exist, in a sentence of the graph's language, from the users' side: what they can do or what they are told.",
46
+ "minLength": 1,
47
+ "examples": ["The owner of an archived note restores it from the note's own page, and it is active again."]
48
+ },
49
+ "evidence": {
50
+ "type": "array",
51
+ "description": "What shows that the need exists: the code, a test, a scenario that walks it, the states and nodes it is drawn as, a setting a deployment gives. Every piece must resolve.",
52
+ "minItems": 1,
53
+ "items": { "$ref": "#/$defs/evidence" }
54
+ },
55
+ "missing": {
56
+ "type": "string",
57
+ "description": "That the need does not exist yet, and why or where that is tracked: words, an issue, a finding's id. Its flow and id must then be in the product's needs.gaps.yaml.",
58
+ "minLength": 1,
59
+ "examples": ["archived notes are not erased yet; the second phase erases them"]
60
+ },
61
+ "note": { "type": "string", "description": "The author's own words. No tool reads them." }
62
+ },
63
+ "anyOf": [{ "required": ["evidence"] }, { "required": ["missing"] }]
64
+ },
65
+ "needId": {
66
+ "type": "string",
67
+ "description": "A need's id in its flow: kebab-case. The gaps name it so.",
68
+ "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$",
69
+ "examples": ["restore-from-its-page"]
70
+ },
71
+ "path": {
72
+ "type": "string",
73
+ "description": "A path relative to the application's repository root (SPEC.md §9).",
74
+ "pattern": "^[^\\s/][^\\s]*$"
75
+ },
76
+ "evidence": {
77
+ "type": "object",
78
+ "description": "One piece of evidence, of one kind: `source`, `test`, `scenario`, `state`, `node` or `setting`.",
79
+ "additionalProperties": false,
80
+ "properties": {
81
+ "source": {
82
+ "type": "string",
83
+ "description": "The code that makes the need true: `<path>:<line>`, or a bare `<path>` for a whole file, relative to the application's repository root (SPEC.md §9). The file must exist and have that line.",
84
+ "pattern": "^[^\\s/:][^\\s:]*(:[0-9]+)?$",
85
+ "examples": ["app/notes.js", "src/notes/restore.ts:42"]
86
+ },
87
+ "test": {
88
+ "$ref": "#/$defs/path",
89
+ "description": "A test of the need: its file, relative to the application's repository root. The file must exist.",
90
+ "examples": ["app/notes.test.js"]
91
+ },
92
+ "name": {
93
+ "type": "string",
94
+ "description": "With `source`: a name the file holds, such as the function that does it. With `test`: the test's name as it is written, in quotes or as a test function's name. The file must hold it, not as a part of a longer word.",
95
+ "minLength": 1,
96
+ "examples": ["restoreNote", "restores an archived note"]
97
+ },
98
+ "scenario": {
99
+ "type": "string",
100
+ "description": "A scenario of a binding (SPEC.md §7) that walks the need on the app. The binding is the flow's own binding.yaml, or the one `binding` names; it binds this flow and has the scenario, its `extends` included.",
101
+ "minLength": 1,
102
+ "examples": ["owner"]
103
+ },
104
+ "binding": {
105
+ "$ref": "#/$defs/path",
106
+ "description": "With `scenario`: the binding that has it, relative to the application's repository root, when it is not the flow's own binding.yaml.",
107
+ "examples": ["e2e/notes.binding.yaml"]
108
+ },
109
+ "state": {
110
+ "type": "string",
111
+ "description": "A state of the flow the need is drawn as. Where only missing needs name it, a tool that walks the flow on the app leaves it out.",
112
+ "minLength": 1,
113
+ "examples": ["restoring"]
114
+ },
115
+ "node": {
116
+ "type": "string",
117
+ "description": "A node of the flow's screens (ui.yaml) the need is drawn as. Where only missing needs name it, a tool that walks the flow on the app leaves it out.",
118
+ "minLength": 1,
119
+ "examples": ["restore"]
120
+ },
121
+ "setting": {
122
+ "type": "string",
123
+ "description": "An environment variable a deployment sets for the need. The file `in` names sets it on a line that is not commented out.",
124
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
125
+ "examples": ["NOTES_SESSION_SECRET"]
126
+ },
127
+ "in": {
128
+ "$ref": "#/$defs/path",
129
+ "description": "With `setting`: the file that tells a deployment what to set, relative to the application's repository root: a dotenv file such as .env.example, or a Compose file.",
130
+ "examples": [".env.example", "compose.yaml"]
131
+ }
132
+ },
133
+ "allOf": [
134
+ {
135
+ "$comment": "a piece of evidence names its kind",
136
+ "anyOf": [
137
+ { "required": ["source"] },
138
+ { "required": ["test"] },
139
+ { "required": ["scenario"] },
140
+ { "required": ["state"] },
141
+ { "required": ["node"] },
142
+ { "required": ["setting"] }
143
+ ]
144
+ },
145
+ {
146
+ "$comment": "a piece of evidence is of one kind: give each kind an item of its own",
147
+ "if": { "required": ["source"] },
148
+ "then": { "properties": { "test": false, "scenario": false, "state": false, "node": false, "setting": false } }
149
+ },
150
+ {
151
+ "$comment": "a piece of evidence is of one kind: give each kind an item of its own",
152
+ "if": { "required": ["test"] },
153
+ "then": { "properties": { "scenario": false, "state": false, "node": false, "setting": false } }
154
+ },
155
+ {
156
+ "$comment": "a piece of evidence is of one kind: give each kind an item of its own",
157
+ "if": { "required": ["scenario"] },
158
+ "then": { "properties": { "state": false, "node": false, "setting": false } }
159
+ },
160
+ {
161
+ "$comment": "a piece of evidence is of one kind: give each kind an item of its own",
162
+ "if": { "required": ["state"] },
163
+ "then": { "properties": { "node": false, "setting": false } }
164
+ },
165
+ {
166
+ "$comment": "a piece of evidence is of one kind: give each kind an item of its own",
167
+ "if": { "required": ["node"] },
168
+ "then": { "properties": { "setting": false } }
169
+ },
170
+ {
171
+ "$comment": "name goes with a source or a test",
172
+ "if": { "required": ["name"] },
173
+ "then": { "anyOf": [{ "required": ["source"] }, { "required": ["test"] }] }
174
+ },
175
+ {
176
+ "$comment": "binding goes with a scenario",
177
+ "if": { "required": ["binding"] },
178
+ "then": { "required": ["scenario"] }
179
+ },
180
+ {
181
+ "$comment": "a setting names the file that sets it, and in goes with a setting",
182
+ "if": { "required": ["setting"] },
183
+ "then": { "required": ["in"] },
184
+ "else": { "properties": { "in": false } }
185
+ }
186
+ ]
187
+ }
188
+ }
189
+ }
@@ -36,24 +36,51 @@
36
36
  "additionalProperties": { "type": "string", "description": "The sample value." },
37
37
  "examples": [{ "client": "Acme Notes" }]
38
38
  },
39
- "changes": {
39
+ "task": {
40
40
  "type": "object",
41
- "description": "What the flow changes and what follows, in its users' own words: what is created, sent, charged or removed, who sees it, and whether it can be undone. Required under --strict when the flow's steps invoke a writing action of its domain.",
41
+ "description": "The flow's name as its users know it, in their own words and language, such as \"Invite a member\": what Rehber names the task by, and what a list of tasks or a video shows. The graph's `title` is in the graph's language, for the people who write it; this is in every locale.",
42
42
  "required": ["key"],
43
43
  "additionalProperties": false,
44
44
  "properties": {
45
- "key": { "$ref": "#/$defs/catalogKey", "description": "The catalog key of the note; every locale's catalog must have it.", "examples": ["Changes.note"] }
45
+ "key": { "$ref": "#/$defs/catalogKey", "description": "The catalog key of the name; every locale's catalog must have it.", "examples": ["Invite.task"] }
46
46
  }
47
47
  },
48
+ "changes": {
49
+ "$comment": "exactly one of key or missing",
50
+ "type": "object",
51
+ "description": "What the flow changes and what follows, in its users' own words: what is created, sent, charged or removed, who sees it, and whether it can be undone. Required under --strict when the flow's steps invoke a writing action of its domain: `{ key }`, or `{ missing: <why> }` where the app has no such message yet, a gap that fails nothing (SPEC.md §4).",
52
+ "additionalProperties": false,
53
+ "properties": {
54
+ "key": { "$ref": "#/$defs/catalogKey", "description": "The catalog key of the note; every locale's catalog must have it.", "examples": ["Changes.note"] },
55
+ "missing": {
56
+ "type": "string",
57
+ "minLength": 1,
58
+ "description": "Why the flow has no changes note yet, such as an app that has no message saying what the flow changes. Rehber does not guide the flow's writing steps, and check gives the gap as a note (changes-note-gap).",
59
+ "examples": ["the app does not say what an import changes yet"]
60
+ }
61
+ },
62
+ "oneOf": [{ "required": ["key"] }, { "required": ["missing"] }]
63
+ },
48
64
  "nodes": {
49
65
  "type": "object",
50
66
  "description": "The nodes of the screens, by id. A node is shown in a state when the state is in `in`, not in `unless`, and `when` holds.",
51
- "propertyNames": { "$ref": "#/$defs/identifier" },
67
+ "propertyNames": {
68
+ "$ref": "#/$defs/identifier",
69
+ "not": { "const": "opener" },
70
+ "description": "A node's id: camelCase, and not opener, which a returnsFocus says for the node that opened its dialog (SPEC.md §4)."
71
+ },
52
72
  "additionalProperties": { "$ref": "#/$defs/node" }
53
73
  },
74
+ "focus": {
75
+ "type": "object",
76
+ "description": "The node that has focus when the flow enters a state from another state, after someone acts or a step ends, by state. A page that opens gives the focus to its `initialFocus` instead, and a dialog that closes to its `returnsFocus` node. The node is shown in that state.",
77
+ "propertyNames": { "$ref": "#/$defs/stateRef" },
78
+ "additionalProperties": { "$ref": "#/$defs/nodeRef", "description": "The node that has focus in that state." },
79
+ "examples": [{ "consent": "retryAlert" }]
80
+ },
54
81
  "edges": {
55
82
  "type": "array",
56
- "description": "Relations the page and the checks use: a node labelled by another, an action that leads to a state.",
83
+ "description": "Relations the page and the checks use: a node labelled by another, an action that leads to a state, the node a dialog gives the focus back to.",
57
84
  "items": { "$ref": "#/$defs/edge" }
58
85
  },
59
86
  "rules": {
@@ -165,6 +192,35 @@
165
192
  }
166
193
  ]
167
194
  },
195
+ "value": {
196
+ "$comment": "exactly one of key, literal or oneOf",
197
+ "type": "object",
198
+ "description": "What a field holds when it is shown, until someone types in it, in one of these forms: `{ key, params }` from the catalog, `{ literal }` (`{ literal: \"\" }` for an empty field), or `{ oneOf: [keys] }`.",
199
+ "additionalProperties": false,
200
+ "properties": {
201
+ "key": { "$ref": "#/$defs/catalogKey", "description": "The catalog key of the message the field holds." },
202
+ "params": {
203
+ "type": "object",
204
+ "description": "The data each `{param}` of the message stands for (e.g. `title: note.title`); the page fills it from `samples`.",
205
+ "additionalProperties": { "type": "string", "description": "The data the parameter stands for." }
206
+ },
207
+ "literal": { "type": "string", "description": "What the field holds, as it is; an empty string for an empty field." },
208
+ "oneOf": {
209
+ "type": "array",
210
+ "description": "Catalog keys of which one is held, depending on the data.",
211
+ "minItems": 1,
212
+ "items": { "$ref": "#/$defs/catalogKey" }
213
+ }
214
+ },
215
+ "oneOf": [{ "required": ["key"] }, { "required": ["literal"] }, { "required": ["oneOf"] }],
216
+ "allOf": [
217
+ {
218
+ "$comment": "params go with key or oneOf",
219
+ "if": { "required": ["literal"] },
220
+ "then": { "properties": { "params": false } }
221
+ }
222
+ ]
223
+ },
168
224
  "node": {
169
225
  "type": "object",
170
226
  "description": "A node of a screen.",
@@ -176,8 +232,8 @@
176
232
  "enum": ["page", "text", "action", "field", "list", "status", "alert"]
177
233
  },
178
234
  "component": {
179
- "description": "A kit-neutral component; a kit maps it to the product's own (SPEC.md §8). A `TextField`'s `text` is its label, and the field is named by it.",
180
- "enum": ["Page", "Heading", "Text", "Button", "LinkButton", "TextField", "List", "ListItem", "Status", "Alert"]
235
+ "description": "A kit-neutral component; a kit maps it to the product's own (SPEC.md §8). A `TextField`'s, a `Checkbox`'s, a `Radio`'s and a `Select`'s `text` is its label, and the control is named by it. A `Checkbox` (role checkbox or switch) and a `Radio` (role radio) say with `checked` whether they are checked; a `Select` (role combobox) is a choice of one option, and its `value` is the option it shows chosen.",
236
+ "enum": ["Page", "Heading", "Text", "Button", "LinkButton", "TextField", "Checkbox", "Radio", "Select", "List", "ListItem", "Status", "Alert"]
181
237
  },
182
238
  "role": {
183
239
  "description": "The WAI-ARIA 1.2 role the node exposes; `kit check` reads it from the browser's accessibility tree.",
@@ -202,30 +258,56 @@
202
258
  "unless": { "$ref": "#/$defs/states", "description": "The flow states the node is not shown in." },
203
259
  "when": { "$ref": "#/$defs/expression", "description": "A guard or context flag of the flow that must hold for the node to show." },
204
260
  "disabledIn": { "$ref": "#/$defs/states", "description": "The states where the node is shown but disabled." },
261
+ "disabledWhen": {
262
+ "$ref": "#/$defs/expression",
263
+ "description": "An expression over the flow's context (SPEC.md §3): where it holds, the node is shown but disabled, in any state that shows it, such as a button that waits until a VAT number is typed or a box is ticked. Beside disabledIn, the node is disabled where either says so. A replay compares it in each situation it stops in.",
264
+ "examples": ["not vatGiven", "not accepted"]
265
+ },
205
266
  "emits": {
206
267
  "type": "string",
207
268
  "description": "The event the node sends when pressed: an event of the flow, UPPER_SNAKE.",
208
269
  "pattern": "^[A-Z][A-Z0-9_]*$"
209
270
  },
210
- "initialFocus": { "$ref": "#/$defs/nodeRef", "description": "On a page: the node that has focus when it opens." },
271
+ "initialFocus": { "$ref": "#/$defs/nodeRef", "description": "On a page: the node that has focus when it opens, at the flow's start or when a transition shows it." },
211
272
  "repeat": { "type": "string", "description": "The node is drawn once per item of this data.", "examples": ["request.scopes"] },
212
273
  "frame": {
213
274
  "description": "For a page: whether it may be framed; `never` (served with CSP frame-ancestors 'none').",
214
275
  "const": "never"
215
276
  },
277
+ "value": { "$ref": "#/$defs/value", "description": "On a field: what it holds when it is shown, until someone types in it. A replay reads the field's value and compares it." },
278
+ "checked": {
279
+ "type": ["boolean", "string"],
280
+ "minLength": 1,
281
+ "description": "On a checkbox, menuitemcheckbox, menuitemradio, option, radio or switch: whether it is checked (or selected) when it is shown, as an expression over the flow's context (SPEC.md §3), or true or false. A replay reads its checked state and compares it.",
282
+ "examples": [true, "pinned", "plan == 'yearly'"]
283
+ },
284
+ "script": {
285
+ "description": "On a page: how much of it works without JavaScript. `optional`: the page and its actions (plain forms and links). `actions`: the page is drawn and read without it (rendered on the server), and only its actions need it. Without it, the page needs JavaScript. A replay's second walk with JavaScript off checks an `optional` page and takes its actions, and checks an `actions` page but its actions, and ends there.",
286
+ "enum": ["optional", "actions"]
287
+ },
216
288
  "source": { "$ref": "#/$defs/sourceAnchor" }
217
289
  },
218
290
  "allOf": [
219
291
  {
220
- "$comment": "initialFocus and frame are only on a page",
292
+ "$comment": "initialFocus, frame and script are only on a page",
221
293
  "if": { "not": { "properties": { "type": { "const": "page" } } } },
222
- "then": { "properties": { "initialFocus": false, "frame": false } }
294
+ "then": { "properties": { "initialFocus": false, "frame": false, "script": false } }
295
+ },
296
+ {
297
+ "$comment": "value is only on a field: what the field holds",
298
+ "if": { "not": { "properties": { "type": { "const": "field" } } } },
299
+ "then": { "properties": { "value": false } }
300
+ },
301
+ {
302
+ "$comment": "checked is only on a node whose role is checkbox, menuitemcheckbox, menuitemradio, option, radio or switch",
303
+ "if": { "not": { "required": ["role"], "properties": { "role": { "enum": ["checkbox", "menuitemcheckbox", "menuitemradio", "option", "radio", "switch"] } } } },
304
+ "then": { "properties": { "checked": false } }
223
305
  }
224
306
  ]
225
307
  },
226
308
  "edge": {
227
309
  "type": "object",
228
- "description": "A relation between nodes: `{ labelledBy: [node, labelNode] }` or `{ triggers: [node, state] }`.",
310
+ "description": "A relation between nodes: `{ labelledBy: [node, labelNode] }`, `{ triggers: [node, state] }` or `{ returnsFocus: [dialog, node | [node, ..] | opener] }`.",
229
311
  "minProperties": 1,
230
312
  "maxProperties": 1,
231
313
  "additionalProperties": false,
@@ -243,6 +325,21 @@
243
325
  "prefixItems": [{ "$ref": "#/$defs/nodeRef" }, { "$ref": "#/$defs/stateRef" }],
244
326
  "minItems": 2,
245
327
  "maxItems": 2
328
+ },
329
+ "returnsFocus": {
330
+ "type": "array",
331
+ "description": "A dialog (a page node whose role is dialog or alertdialog) and the node that has focus when it closes, usually the one that opened it. Where several nodes open the dialog, the list of them, or opener: the focus goes back to the one pressed to open it. It wins over `focus` for the state the dialog closes into, when that state shows the node.",
332
+ "prefixItems": [
333
+ { "$ref": "#/$defs/nodeRef" },
334
+ {
335
+ "anyOf": [
336
+ { "$ref": "#/$defs/nodeRef", "description": "The node, or opener: the node pressed to open the dialog." },
337
+ { "type": "array", "items": { "$ref": "#/$defs/nodeRef" }, "minItems": 2, "uniqueItems": true, "description": "The nodes that open the dialog: the one pressed to open it has the focus." }
338
+ ]
339
+ }
340
+ ],
341
+ "minItems": 2,
342
+ "maxItems": 2
246
343
  }
247
344
  }
248
345
  }