@skillcdn/console 0.4.4 → 0.4.6

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.
Files changed (192) hide show
  1. package/README.md +3 -3
  2. package/dist/api.d.ts +3 -3
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +3 -3
  5. package/dist/api.js.map +1 -1
  6. package/dist/cli/cli.d.ts.map +1 -1
  7. package/dist/cli/cli.js +180 -22
  8. package/dist/cli/cli.js.map +1 -1
  9. package/dist/cli/format.d.ts +24 -4
  10. package/dist/cli/format.d.ts.map +1 -1
  11. package/dist/cli/format.js +78 -21
  12. package/dist/cli/format.js.map +1 -1
  13. package/dist/cli/help.d.ts.map +1 -1
  14. package/dist/cli/help.js +43 -10
  15. package/dist/cli/help.js.map +1 -1
  16. package/dist/client.d.ts +30 -1
  17. package/dist/client.d.ts.map +1 -1
  18. package/dist/client.js +13 -2
  19. package/dist/client.js.map +1 -1
  20. package/dist/compat.js +1 -1
  21. package/dist/components/board.d.ts.map +1 -1
  22. package/dist/components/board.js +46 -15
  23. package/dist/components/board.js.map +1 -1
  24. package/dist/components/decision-form.d.ts +0 -3
  25. package/dist/components/decision-form.d.ts.map +1 -1
  26. package/dist/components/decision-form.js +3 -15
  27. package/dist/components/decision-form.js.map +1 -1
  28. package/dist/components/event-feed.d.ts.map +1 -1
  29. package/dist/components/event-feed.js +30 -10
  30. package/dist/components/event-feed.js.map +1 -1
  31. package/dist/components/my-decisions.d.ts +20 -3
  32. package/dist/components/my-decisions.d.ts.map +1 -1
  33. package/dist/components/my-decisions.js +14 -1
  34. package/dist/components/my-decisions.js.map +1 -1
  35. package/dist/components/people.d.ts +43 -1
  36. package/dist/components/people.d.ts.map +1 -1
  37. package/dist/components/people.js +117 -9
  38. package/dist/components/people.js.map +1 -1
  39. package/dist/components/picker.d.ts +8 -0
  40. package/dist/components/picker.d.ts.map +1 -1
  41. package/dist/components/picker.js +2 -2
  42. package/dist/components/picker.js.map +1 -1
  43. package/dist/components/plugin-frame.d.ts +0 -1
  44. package/dist/components/plugin-frame.d.ts.map +1 -1
  45. package/dist/components/plugin-frame.js +38 -4
  46. package/dist/components/plugin-frame.js.map +1 -1
  47. package/dist/components/plugin-settings.d.ts +5 -1
  48. package/dist/components/plugin-settings.d.ts.map +1 -1
  49. package/dist/components/plugin-settings.js +143 -30
  50. package/dist/components/plugin-settings.js.map +1 -1
  51. package/dist/components/projects.d.ts.map +1 -1
  52. package/dist/components/projects.js +3 -1
  53. package/dist/components/projects.js.map +1 -1
  54. package/dist/components/searches.d.ts +11 -0
  55. package/dist/components/searches.d.ts.map +1 -0
  56. package/dist/components/searches.js +30 -0
  57. package/dist/components/searches.js.map +1 -0
  58. package/dist/components/task-form.d.ts.map +1 -1
  59. package/dist/components/task-form.js +6 -5
  60. package/dist/components/task-form.js.map +1 -1
  61. package/dist/components/ui.d.ts +16 -0
  62. package/dist/components/ui.d.ts.map +1 -1
  63. package/dist/components/ui.js +10 -0
  64. package/dist/components/ui.js.map +1 -1
  65. package/dist/console.css +362 -67
  66. package/dist/console.d.ts +2 -1
  67. package/dist/console.d.ts.map +1 -1
  68. package/dist/console.js +90 -14
  69. package/dist/console.js.map +1 -1
  70. package/dist/data.d.ts +14 -1
  71. package/dist/data.d.ts.map +1 -1
  72. package/dist/data.js +36 -1
  73. package/dist/data.js.map +1 -1
  74. package/dist/i18n/en.d.ts +89 -0
  75. package/dist/i18n/en.d.ts.map +1 -1
  76. package/dist/i18n/en.js +87 -2
  77. package/dist/i18n/en.js.map +1 -1
  78. package/dist/i18n/ko.d.ts.map +1 -1
  79. package/dist/i18n/ko.js +87 -3
  80. package/dist/i18n/ko.js.map +1 -1
  81. package/dist/index.d.ts +3 -2
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +3 -2
  84. package/dist/index.js.map +1 -1
  85. package/dist/limits.d.ts +6 -0
  86. package/dist/limits.d.ts.map +1 -1
  87. package/dist/limits.js +6 -0
  88. package/dist/limits.js.map +1 -1
  89. package/dist/plugin/args.d.ts +6 -1
  90. package/dist/plugin/args.d.ts.map +1 -1
  91. package/dist/plugin/args.js +16 -11
  92. package/dist/plugin/args.js.map +1 -1
  93. package/dist/plugin/bridge.d.ts +21 -1
  94. package/dist/plugin/bridge.d.ts.map +1 -1
  95. package/dist/plugin/bridge.js +28 -0
  96. package/dist/plugin/bridge.js.map +1 -1
  97. package/dist/plugin/capabilities.d.ts +1 -1
  98. package/dist/plugin/capabilities.d.ts.map +1 -1
  99. package/dist/plugin/capabilities.js +10 -0
  100. package/dist/plugin/capabilities.js.map +1 -1
  101. package/dist/plugin/context.d.ts +165 -14
  102. package/dist/plugin/context.d.ts.map +1 -1
  103. package/dist/plugin/define.d.ts +13 -1
  104. package/dist/plugin/define.d.ts.map +1 -1
  105. package/dist/plugin/define.js +17 -1
  106. package/dist/plugin/define.js.map +1 -1
  107. package/dist/plugin/limits.d.ts +4 -0
  108. package/dist/plugin/limits.d.ts.map +1 -1
  109. package/dist/plugin/limits.js +4 -0
  110. package/dist/plugin/limits.js.map +1 -1
  111. package/dist/plugin/manifest.d.ts +15 -0
  112. package/dist/plugin/manifest.d.ts.map +1 -1
  113. package/dist/plugin/manifest.js +61 -4
  114. package/dist/plugin/manifest.js.map +1 -1
  115. package/dist/plugin/rest-schemas.d.ts +44 -0
  116. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  117. package/dist/plugin/rest-schemas.js +55 -3
  118. package/dist/plugin/rest-schemas.js.map +1 -1
  119. package/dist/plugin/testing.d.ts +15 -1
  120. package/dist/plugin/testing.d.ts.map +1 -1
  121. package/dist/plugin/testing.js +40 -4
  122. package/dist/plugin/testing.js.map +1 -1
  123. package/dist/plugin/web.d.ts +19 -0
  124. package/dist/plugin/web.d.ts.map +1 -1
  125. package/dist/plugin/web.js +17 -1
  126. package/dist/plugin/web.js.map +1 -1
  127. package/dist/plugin.d.ts +1 -1
  128. package/dist/plugin.d.ts.map +1 -1
  129. package/dist/plugin.js +1 -1
  130. package/dist/plugin.js.map +1 -1
  131. package/dist/router.d.ts +19 -0
  132. package/dist/router.d.ts.map +1 -1
  133. package/dist/router.js +18 -0
  134. package/dist/router.js.map +1 -1
  135. package/dist/routes.d.ts +11 -2
  136. package/dist/routes.d.ts.map +1 -1
  137. package/dist/routes.js +14 -1
  138. package/dist/routes.js.map +1 -1
  139. package/dist/schemas.d.ts +367 -0
  140. package/dist/schemas.d.ts.map +1 -1
  141. package/dist/schemas.js +62 -2
  142. package/dist/schemas.js.map +1 -1
  143. package/dist/vocabulary.d.ts +1 -1
  144. package/dist/vocabulary.d.ts.map +1 -1
  145. package/dist/vocabulary.js +6 -0
  146. package/dist/vocabulary.js.map +1 -1
  147. package/docs/specs/cli.md +8 -5
  148. package/docs/specs/plugins.md +62 -42
  149. package/docs/specs/rest.md +23 -6
  150. package/package.json +1 -1
  151. package/skills/building-a-plugin/SKILL.md +8 -6
  152. package/skills/working-the-board/SKILL.md +1 -1
  153. package/src/api.ts +17 -0
  154. package/src/cli/cli.ts +227 -19
  155. package/src/cli/format.ts +96 -21
  156. package/src/cli/help.ts +47 -10
  157. package/src/client.ts +74 -0
  158. package/src/compat.ts +1 -1
  159. package/src/components/board.tsx +83 -42
  160. package/src/components/decision-form.tsx +13 -32
  161. package/src/components/event-feed.tsx +36 -9
  162. package/src/components/my-decisions.tsx +50 -5
  163. package/src/components/people.tsx +394 -37
  164. package/src/components/picker.tsx +11 -2
  165. package/src/components/plugin-frame.tsx +39 -3
  166. package/src/components/plugin-settings.tsx +346 -137
  167. package/src/components/projects.tsx +14 -14
  168. package/src/components/searches.ts +47 -0
  169. package/src/components/task-form.tsx +23 -28
  170. package/src/components/ui.tsx +36 -0
  171. package/src/console.tsx +229 -40
  172. package/src/data.ts +53 -1
  173. package/src/i18n/en.ts +98 -2
  174. package/src/i18n/ko.ts +95 -3
  175. package/src/index.ts +11 -0
  176. package/src/limits.ts +6 -0
  177. package/src/plugin/args.ts +16 -11
  178. package/src/plugin/bridge.ts +46 -0
  179. package/src/plugin/capabilities.ts +11 -0
  180. package/src/plugin/context.ts +177 -11
  181. package/src/plugin/define.ts +34 -0
  182. package/src/plugin/limits.ts +4 -0
  183. package/src/plugin/manifest.ts +74 -3
  184. package/src/plugin/rest-schemas.ts +62 -5
  185. package/src/plugin/testing.ts +61 -5
  186. package/src/plugin/web.ts +34 -0
  187. package/src/plugin.ts +1 -0
  188. package/src/router.ts +25 -0
  189. package/src/routes.ts +17 -2
  190. package/src/schemas.ts +81 -2
  191. package/src/styles/console.css +362 -67
  192. package/src/vocabulary.ts +6 -0
@@ -13,9 +13,10 @@ import {
13
13
  } from "../api.js";
14
14
  import { useWords } from "../i18n/index.js";
15
15
  import { isPicture, placing, unusedName } from "./files.js";
16
- import { Picker, type PickerSearch } from "./picker.js";
16
+ import { Picker } from "./picker.js";
17
+ import { peopleSearch } from "./searches.js";
17
18
  import { type TaskSearch, taskLabel } from "./task-form.js";
18
- import { Button, formatBytes, PersonChip, personName } from "./ui.js";
19
+ import { Button, Chip, formatBytes, PersonChip, personName } from "./ui.js";
19
20
 
20
21
  // Raising a decision: the question, what a person needs to know, the options to choose from,
21
22
  // and who is to answer (ADR-0042): the person raising it, unless they name another of the
@@ -57,23 +58,6 @@ export function decidersInput(
57
58
  return ids.length === 1 ? { deciderId: first } : { deciderId: first, deciderIds: ids };
58
59
  }
59
60
 
60
- /** The people of the project found by the words typed, a page at a time, as a picker searches. */
61
- export function peopleSearch(people: readonly RestPerson[]): PickerSearch<RestPerson> {
62
- return async (query, page) => {
63
- const words = query.trim().toLowerCase();
64
- const found = people.filter(
65
- (person) =>
66
- words.length === 0 ||
67
- personName(person).toLowerCase().includes(words) ||
68
- person.login.toLowerCase().includes(words),
69
- );
70
- return {
71
- items: found.slice(page.offset, page.offset + page.limit),
72
- more: found.length > page.offset + page.limit,
73
- };
74
- };
75
- }
76
-
77
61
  export function DecisionForm(props: DecisionFormProps) {
78
62
  const words = useWords();
79
63
  const form = words.decisions.form;
@@ -228,25 +212,22 @@ export function DecisionForm(props: DecisionFormProps) {
228
212
  <legend className="sc-field-label">{form.decider}</legend>
229
213
  <div className="sc-chips">
230
214
  {deciders.map((person) => (
231
- <span key={person.id} className="sc-chip">
215
+ <Chip
216
+ key={person.id}
217
+ onRemove={() =>
218
+ setDeciders((current) => current.filter((chosen) => chosen.id !== person.id))
219
+ }
220
+ removeLabel={`${words.common.remove}: ${personName(person)}`}
221
+ disabled={props.busy}
222
+ >
232
223
  <PersonChip person={person} />
233
224
  {person.id === props.me?.id && <span className="sc-muted"> {form.me}</span>}
234
- <button
235
- type="button"
236
- className="sc-chip-remove"
237
- aria-label={`${words.common.remove}: ${personName(person)}`}
238
- disabled={props.busy}
239
- onClick={() =>
240
- setDeciders((current) => current.filter((chosen) => chosen.id !== person.id))
241
- }
242
- >
243
- <span aria-hidden="true">&times;</span>
244
- </button>
245
- </span>
225
+ </Chip>
246
226
  ))}
247
227
  {deciders.length === 0 && <span className="sc-muted">{form.deciderPlaceholder}</span>}
248
228
  {deciders.length < MAX_DECIDERS && (
249
229
  <Picker
230
+ className="sc-picker-add"
250
231
  value={undefined}
251
232
  search={findDeciders}
252
233
  keyOf={(person) => person.id}
@@ -45,11 +45,15 @@ function sentenceOf(event: RestEvent, words: Messages): string {
45
45
  const grantee =
46
46
  data.everyone === true
47
47
  ? feed.everyone
48
- : data.login !== undefined
49
- ? data.login
50
- : data.key !== undefined
51
- ? feed.membersOf(data.name ?? data.key)
52
- : feed.someone;
48
+ : data.grantee !== undefined
49
+ ? feed.thePlugin(data.grantee)
50
+ : data.team !== undefined
51
+ ? feed.theTeam(data.team)
52
+ : data.login !== undefined
53
+ ? data.login
54
+ : data.key !== undefined
55
+ ? feed.membersOf(data.name ?? data.key)
56
+ : feed.someone;
53
57
  switch (event.kind) {
54
58
  case "person.joined":
55
59
  return feed.event.personJoined();
@@ -67,6 +71,18 @@ function sentenceOf(event: RestEvent, words: Messages): string {
67
71
  return data.manager === null || data.manager === undefined
68
72
  ? feed.event.managerCleared(login)
69
73
  : feed.event.managerChanged(login, data.manager);
74
+ case "person.email_changed":
75
+ return data.set === true ? feed.event.emailChanged(login) : feed.event.emailCleared(login);
76
+ case "team.created":
77
+ return feed.event.teamCreated(data.team ?? feed.aTeam);
78
+ case "team.renamed":
79
+ return feed.event.teamRenamed(data.name ?? feed.aTeam, data.team ?? feed.aTeam);
80
+ case "team.removed":
81
+ return feed.event.teamRemoved(data.team ?? feed.aTeam);
82
+ case "team.member_added":
83
+ return feed.event.teamMemberAdded(login, data.team ?? feed.aTeam);
84
+ case "team.member_removed":
85
+ return feed.event.teamMemberRemoved(login, data.team ?? feed.aTeam);
70
86
  case "workspace.updated":
71
87
  return feed.event.workspaceUpdated(fields);
72
88
  case "project.created":
@@ -140,9 +156,11 @@ function sentenceOf(event: RestEvent, words: Messages): string {
140
156
  case "plugin.disabled":
141
157
  return feed.event.pluginDisabled(plugin);
142
158
  case "plugin.configured":
143
- return data.capabilities === undefined
144
- ? feed.event.pluginConfigured(fields, plugin)
145
- : feed.event.pluginConsented(plugin);
159
+ return data.capabilities !== undefined
160
+ ? feed.event.pluginConsented(plugin)
161
+ : data.source !== undefined && data.source !== "administrator"
162
+ ? feed.event.pluginSealed(fields, plugin, data.source)
163
+ : feed.event.pluginConfigured(fields, plugin);
146
164
  case "plugin.granted":
147
165
  return feed.event.pluginGranted(data.role ?? feed.role.other, grantee, plugin);
148
166
  case "plugin.revoked":
@@ -195,7 +213,11 @@ function formatFeedDay(day: string, language: string, now: Date = new Date()): s
195
213
 
196
214
  /** Whether two events were done by the same person as the same agent, so the name is said once. */
197
215
  function sameHands(a: RestEvent, b: RestEvent): boolean {
198
- return (a.actor?.id ?? null) === (b.actor?.id ?? null) && a.agent === b.agent;
216
+ return (
217
+ (a.actor?.id ?? null) === (b.actor?.id ?? null) &&
218
+ a.agent === b.agent &&
219
+ (a.via ?? null) === (b.via ?? null)
220
+ );
199
221
  }
200
222
 
201
223
  /** The hour of an event, for a row whose day is in the heading above it. */
@@ -266,6 +288,11 @@ export function EventFeed(props: EventFeedProps) {
266
288
  {words.feed.as(agentLabel(run.actor.agent))}
267
289
  </span>
268
290
  )}
291
+ {run.actor.via !== null && run.actor.via !== undefined && (
292
+ <span className="sc-feed-agent" title={words.feed.viaTitle}>
293
+ {words.feed.via(run.actor.via)}
294
+ </span>
295
+ )}
269
296
  </span>
270
297
  <ol className="sc-feed-run-list">
271
298
  {run.events.map((event) => {
@@ -1,5 +1,11 @@
1
1
  import type { ReactNode } from "react";
2
- import type { RestAnswerInput, RestDecision, RestMyDecisions } from "../api.js";
2
+ import {
3
+ decisionFilePath,
4
+ type RestAnswerInput,
5
+ type RestDecision,
6
+ type RestMyDecisions,
7
+ type RestReachedDecision,
8
+ } from "../api.js";
3
9
  import { useWords } from "../i18n/index.js";
4
10
  import { DecisionCard, DecisionLog } from "./decision-list.js";
5
11
  import { ProjectMark } from "./projects.js";
@@ -11,7 +17,9 @@ import { Button } from "./ui.js";
11
17
  // whom they wait for; in the second the record, the answered ones of both kinds, newest first.
12
18
  // Every card and row names the project, and who asked and who answers, as the cards do
13
19
  // everywhere. Takes its data as props and nothing from the network; the page reads more when
14
- // asked.
20
+ // asked. A decision here may be in a project the person may not see (ADR-0068), so the files
21
+ // put on it are read at the decision's own address, which serves them to whoever the decision
22
+ // reaches, and not at the project's.
15
23
 
16
24
  /** One kind of a person's decisions, a page at a time. */
17
25
  export interface DecisionsPage {
@@ -27,8 +35,14 @@ export interface MyDecisionsProps {
27
35
  /** The decisions the person asked of someone else: waiting and answered. */
28
36
  readonly raised: DecisionsPage;
29
37
  readonly decisionHref: (projectKey: string, decisionId: string) => string;
30
- /** Where a file put on a decision is read, by its project's key and its id (ADR-0055). */
31
- readonly fileHref?: ((projectKey: string, fileId: string) => string) | undefined;
38
+ /**
39
+ * Where a file put on a decision is read (ADR-0055), by the project's key, the file's id and
40
+ * the decision's; left out, at the decision's own address, `decisionFilePath`, which serves it
41
+ * to whoever the decision reaches, in a project they may see or not (ADR-0068).
42
+ */
43
+ readonly fileHref?:
44
+ | ((projectKey: string, fileId: string, decisionId: string) => string)
45
+ | undefined;
32
46
  /** Called with the person's answer on a decision of theirs, in its project. Left out, a waiting decision is answered on its own page. */
33
47
  readonly onAnswer?:
34
48
  | ((projectKey: string, decision: RestDecision, input: RestAnswerInput) => void)
@@ -82,7 +96,11 @@ export function MyDecisions(props: MyDecisionsProps) {
82
96
  decision={item.decision}
83
97
  href={props.decisionHref(item.project.key, item.decision.id)}
84
98
  project={<InProject project={item.project} />}
85
- fileHref={fileHref === undefined ? undefined : (fileId) => fileHref(item.project.key, fileId)}
99
+ fileHref={(fileId) =>
100
+ fileHref === undefined
101
+ ? decisionFilePath(item.decision.id, fileId)
102
+ : fileHref(item.project.key, fileId, item.decision.id)
103
+ }
86
104
  onAnswer={
87
105
  answerable && onAnswer !== undefined
88
106
  ? (decision, input) => onAnswer(item.project.key, decision, input)
@@ -139,3 +157,30 @@ export function MyDecisions(props: MyDecisionsProps) {
139
157
  </div>
140
158
  );
141
159
  }
160
+
161
+ export interface ReachedDecisionProps {
162
+ /** The decision as the person reaches it (ADR-0068): its project, the decision, and whether they may answer it. */
163
+ readonly reached: RestReachedDecision;
164
+ /** Called with the person's answer; the decision is answered here only where `mayAnswer` says they may. */
165
+ readonly onAnswer?: ((decision: RestDecision, input: RestAnswerInput) => void) | undefined;
166
+ readonly busy?: boolean | undefined;
167
+ }
168
+
169
+ /**
170
+ * One decision wherever it is (ADR-0068), on its own page: the card with its project named, the
171
+ * files put on it read at the decision's own address, since the project may be one the person
172
+ * may not see, and the way to answer it where they may.
173
+ */
174
+ export function ReachedDecision(props: ReachedDecisionProps) {
175
+ const { reached } = props;
176
+ const { decision } = reached;
177
+ return (
178
+ <DecisionCard
179
+ decision={decision}
180
+ project={<InProject project={reached.project} />}
181
+ fileHref={(fileId) => decisionFilePath(decision.id, fileId)}
182
+ onAnswer={reached.mayAnswer === true ? props.onAnswer : undefined}
183
+ busy={props.busy}
184
+ />
185
+ );
186
+ }