@otea/cli 0.0.1 → 0.1.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.
- package/LICENSE +661 -0
- package/README.es.md +151 -0
- package/README.md +251 -3
- package/THIRD_PARTY_NOTICES.md +114 -0
- package/bin/otea.mjs +28 -0
- package/dist/app/agent-detail.js +26 -0
- package/dist/app/agent-draft.js +429 -0
- package/dist/app/agent-prompts.js +52 -0
- package/dist/app/agents.js +77 -0
- package/dist/app/asking.js +43 -0
- package/dist/app/board-archive.js +243 -0
- package/dist/app/board-migration.js +272 -0
- package/dist/app/boards.js +870 -0
- package/dist/app/branch-owner.js +48 -0
- package/dist/app/brief.js +53 -0
- package/dist/app/choices.js +61 -0
- package/dist/app/collections.js +101 -0
- package/dist/app/context.js +1 -0
- package/dist/app/crop.js +56 -0
- package/dist/app/devices.js +62 -0
- package/dist/app/draft-request.js +82 -0
- package/dist/app/events.js +12 -0
- package/dist/app/evidence.js +287 -0
- package/dist/app/gates.js +610 -0
- package/dist/app/guide.js +37 -0
- package/dist/app/home.js +145 -0
- package/dist/app/init-boards.js +36 -0
- package/dist/app/intake.js +25 -0
- package/dist/app/item-search.js +141 -0
- package/dist/app/items.js +318 -0
- package/dist/app/keep-waiting.js +44 -0
- package/dist/app/land-order.js +107 -0
- package/dist/app/language.js +52 -0
- package/dist/app/launcher.js +56 -0
- package/dist/app/lease-take.js +54 -0
- package/dist/app/leases.js +86 -0
- package/dist/app/machine.js +39 -0
- package/dist/app/merged.js +89 -0
- package/dist/app/migrate.js +171 -0
- package/dist/app/next.js +1637 -0
- package/dist/app/notes.js +319 -0
- package/dist/app/notify-targets.js +113 -0
- package/dist/app/opened.js +25 -0
- package/dist/app/owner-only.js +34 -0
- package/dist/app/performance.js +28 -0
- package/dist/app/phone.js +97 -0
- package/dist/app/presence.js +596 -0
- package/dist/app/preset-views.js +25 -0
- package/dist/app/presets.js +129 -0
- package/dist/app/priority.js +156 -0
- package/dist/app/profile.js +86 -0
- package/dist/app/project.js +247 -0
- package/dist/app/proofs.js +179 -0
- package/dist/app/questions.js +215 -0
- package/dist/app/reader-filter.js +58 -0
- package/dist/app/relations.js +164 -0
- package/dist/app/relay.js +98 -0
- package/dist/app/repos.js +176 -0
- package/dist/app/restart.js +92 -0
- package/dist/app/set-aside.js +64 -0
- package/dist/app/system-locale.js +6 -0
- package/dist/app/tailscale-cli.js +77 -0
- package/dist/app/tailscale-testing.js +41 -0
- package/dist/app/tailscale.js +177 -0
- package/dist/app/tips.js +30 -0
- package/dist/app/topics-everywhere.js +53 -0
- package/dist/app/topics.js +453 -0
- package/dist/app/undo.js +52 -0
- package/dist/app/validate.js +131 -0
- package/dist/app/watch.js +48 -0
- package/dist/cli/command.js +44 -0
- package/dist/cli/commands.js +3303 -0
- package/dist/cli/exit-codes.js +70 -0
- package/dist/cli/forge.js +176 -0
- package/dist/cli/format.js +340 -0
- package/dist/cli/gh.js +17 -0
- package/dist/cli/gitrepo.js +489 -0
- package/dist/cli/help.js +101 -0
- package/dist/cli/hooks.js +232 -0
- package/dist/cli/main.js +37 -0
- package/dist/cli/merged-outside.js +58 -0
- package/dist/cli/names.js +154 -0
- package/dist/cli/opener.js +21 -0
- package/dist/cli/owner.js +154 -0
- package/dist/cli/phone.js +221 -0
- package/dist/cli/ports.js +24 -0
- package/dist/cli/probe.js +18 -0
- package/dist/cli/run.js +246 -0
- package/dist/cli/serve-file.js +21 -0
- package/dist/cli/stats.js +55 -0
- package/dist/cli/version.js +3 -0
- package/dist/core/agent-guide.js +31 -0
- package/dist/core/agent-prompts.js +139 -0
- package/dist/core/authority.js +94 -0
- package/dist/core/board/analysis.js +86 -0
- package/dist/core/board/choices.js +100 -0
- package/dist/core/board/compile.js +362 -0
- package/dist/core/board/engine.js +523 -0
- package/dist/core/board/hints.js +46 -0
- package/dist/core/board/history.js +146 -0
- package/dist/core/board/ids.js +87 -0
- package/dist/core/board/joins.js +30 -0
- package/dist/core/board/mentions.js +68 -0
- package/dist/core/board/merged.js +18 -0
- package/dist/core/board/model.js +135 -0
- package/dist/core/board/next.js +1116 -0
- package/dist/core/board/notes.js +298 -0
- package/dist/core/board/performance.js +218 -0
- package/dist/core/board/plan.js +299 -0
- package/dist/core/board/problems.js +232 -0
- package/dist/core/board/proofs.js +84 -0
- package/dist/core/board/questions.js +114 -0
- package/dist/core/board/reading.js +220 -0
- package/dist/core/board/readings.js +534 -0
- package/dist/core/board/schema.js +335 -0
- package/dist/core/board/shape-words.js +179 -0
- package/dist/core/board/template-words.js +23 -0
- package/dist/core/board/templates-catalogue.js +965 -0
- package/dist/core/board/templates-coverage.js +261 -0
- package/dist/core/board/templates-flows.js +779 -0
- package/dist/core/board/templates.js +586 -0
- package/dist/core/brief.js +93 -0
- package/dist/core/diagram.js +80 -0
- package/dist/core/errors.js +12 -0
- package/dist/core/evidence.js +33 -0
- package/dist/core/fields.js +129 -0
- package/dist/core/hierarchy.js +30 -0
- package/dist/core/icons.js +181 -0
- package/dist/core/image-crop.js +166 -0
- package/dist/core/item.js +49 -0
- package/dist/core/lease.js +31 -0
- package/dist/core/modules.js +318 -0
- package/dist/core/notify/planner.js +117 -0
- package/dist/core/notify/signals.js +66 -0
- package/dist/core/notify/text.js +60 -0
- package/dist/core/path-key.js +22 -0
- package/dist/core/placement.js +161 -0
- package/dist/core/preset-labels.js +66 -0
- package/dist/core/preset-notes.js +109 -0
- package/dist/core/preset.js +541 -0
- package/dist/core/profile.js +55 -0
- package/dist/core/project-id.js +20 -0
- package/dist/core/refusal.js +1 -0
- package/dist/core/relations.js +208 -0
- package/dist/core/repo.js +54 -0
- package/dist/core/samples.js +161 -0
- package/dist/core/search-words.js +68 -0
- package/dist/core/test-report.js +120 -0
- package/dist/core/time.js +8 -0
- package/dist/core/validation.js +60 -0
- package/dist/core/views.js +171 -0
- package/dist/core/workflow.js +51 -0
- package/dist/mcp/commands.js +101 -0
- package/dist/mcp/server.js +239 -0
- package/dist/mcp/words.js +95 -0
- package/dist/server/boards.js +232 -0
- package/dist/server/changes.js +42 -0
- package/dist/server/diff-tip.js +83 -0
- package/dist/server/drift.js +87 -0
- package/dist/server/errors.js +87 -0
- package/dist/server/evidence.js +82 -0
- package/dist/server/hosts.js +6 -0
- package/dist/server/hub.js +98 -0
- package/dist/server/lan-access.js +62 -0
- package/dist/server/lan.js +164 -0
- package/dist/server/listen.js +70 -0
- package/dist/server/notifier.js +156 -0
- package/dist/server/notify-api.js +151 -0
- package/dist/server/pairing.js +124 -0
- package/dist/server/projects.js +191 -0
- package/dist/server/push.js +199 -0
- package/dist/server/server.js +960 -0
- package/dist/server/session.js +43 -0
- package/dist/server/stream.js +36 -0
- package/dist/server/test-push.js +38 -0
- package/dist/server/token.js +37 -0
- package/dist/server/transports.js +54 -0
- package/dist/server/ui.js +44 -0
- package/dist/server/writes.js +361 -0
- package/dist/server/wrong-address.js +36 -0
- package/dist/store/boards.js +111 -0
- package/dist/store/database.js +45 -0
- package/dist/store/machine.js +77 -0
- package/dist/store/migrations.js +493 -0
- package/dist/store/queries.js +585 -0
- package/dist/store/registry.js +72 -0
- package/package.json +72 -4
- package/presets/architecture/playbook.md +69 -0
- package/presets/architecture/preset.yaml +80 -0
- package/presets/architecture/samples.yaml +23 -0
- package/presets/bug-triage/playbook.md +129 -0
- package/presets/bug-triage/preset.yaml +127 -0
- package/presets/bug-triage/samples/wall-slide-after.png +0 -0
- package/presets/bug-triage/samples/wall-slide-before.png +0 -0
- package/presets/bug-triage/samples.yaml +72 -0
- package/presets/change/playbook.md +115 -0
- package/presets/change/preset.yaml +141 -0
- package/presets/change/samples.yaml +62 -0
- package/presets/review/playbook.md +51 -0
- package/presets/review/preset.yaml +62 -0
- package/presets/review/samples.yaml +27 -0
- package/presets/tasks/playbook.md +78 -0
- package/presets/tasks/preset.yaml +61 -0
- package/presets/tasks/samples.yaml +46 -0
- package/schemas/board.schema.json +764 -0
- package/ui/dist/THIRD_PARTY_NOTICES.md +114 -0
- package/ui/dist/assets/dm-mono-latin-400-normal--0xN8mdc.woff +0 -0
- package/ui/dist/assets/dm-mono-latin-400-normal-4GdczIuU.woff2 +0 -0
- package/ui/dist/assets/dm-mono-latin-500-normal-CN8Miw6E.woff +0 -0
- package/ui/dist/assets/dm-mono-latin-500-normal-DRMDZjhP.woff2 +0 -0
- package/ui/dist/assets/dm-mono-latin-ext-400-normal-1aZr6b2b.woff +0 -0
- package/ui/dist/assets/dm-mono-latin-ext-400-normal-C2zvOubV.woff2 +0 -0
- package/ui/dist/assets/dm-mono-latin-ext-500-normal-BtRyHRi6.woff2 +0 -0
- package/ui/dist/assets/dm-mono-latin-ext-500-normal-Dw3M13d8.woff +0 -0
- package/ui/dist/assets/index-C3OzJope.js +103 -0
- package/ui/dist/assets/index-COdEjckQ.css +1 -0
- package/ui/dist/assets/newsreader-latin-ext-opsz-italic-CSPGnFdO.woff2 +0 -0
- package/ui/dist/assets/newsreader-latin-ext-opsz-normal-BQn1nviT.woff2 +0 -0
- package/ui/dist/assets/newsreader-latin-opsz-italic-kJKFiXvB.woff2 +0 -0
- package/ui/dist/assets/newsreader-latin-opsz-normal-s-izfB6B.woff2 +0 -0
- package/ui/dist/assets/newsreader-vietnamese-opsz-italic-DTr-ymY4.woff2 +0 -0
- package/ui/dist/assets/newsreader-vietnamese-opsz-normal-BjhtXyW2.woff2 +0 -0
- package/ui/dist/assets/pdf-YwugTw7Y.js +54 -0
- package/ui/dist/assets/pdf-engine-CkBopwck.js +1 -0
- package/ui/dist/assets/pdf-rELvHkft.js +56 -0
- package/ui/dist/assets/pdf.worker.min-B5Yc7dP4.mjs +27 -0
- package/ui/dist/assets/pdf.worker.min-B7U8ptvh.js +1 -0
- package/ui/dist/assets/pdf.worker.min-CIqJB0yW.mjs +28 -0
- package/ui/dist/assets/pdf.worker.min-UqOn5EDC.js +1 -0
- package/ui/dist/assets/schibsted-grotesk-latin-ext-wght-normal-hsMS0n0O.woff2 +0 -0
- package/ui/dist/assets/schibsted-grotesk-latin-wght-normal-Bb8VGrTG.woff2 +0 -0
- package/ui/dist/icons/apple-touch-icon.png +0 -0
- package/ui/dist/icons/otea-192.png +0 -0
- package/ui/dist/icons/otea-512.png +0 -0
- package/ui/dist/icons/otea-badge.png +0 -0
- package/ui/dist/icons/otea-maskable-512.png +0 -0
- package/ui/dist/index.html +25 -0
- package/ui/dist/manifest.webmanifest +24 -0
- package/ui/dist/otea-idle.svg +5 -0
- package/ui/dist/otea-working.svg +5 -0
- package/ui/dist/otea-yours-working.svg +5 -0
- package/ui/dist/otea-yours.svg +5 -0
- package/ui/dist/sw.js +1 -0
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import { newId } from './ids.js';
|
|
2
|
+
import { BOARD_SCHEMA, boardDefaults, DONE, EVIDENCE_SHOWS, isEvidenceKind, LEVELS, MOTIVE, ROUNDS, SAME, STEP, stepDefaults, } from './model.js';
|
|
3
|
+
// Ready-made boards named after a job, as data in both languages. Using one copies it with fresh
|
|
4
|
+
// ids: nothing stays linked to the template. Instructions mention parts and steps as `@{key}`,
|
|
5
|
+
// which a copy turns into `@[id]`.
|
|
6
|
+
import { EMPTY, TITLE_NAME, w } from './template-words.js';
|
|
7
|
+
import { CATALOGUE_TEMPLATES } from './templates-catalogue.js';
|
|
8
|
+
import { COVERAGE_TEMPLATES, TEMPLATE_SETS } from './templates-coverage.js';
|
|
9
|
+
import { FLOW_TEMPLATES } from './templates-flows.js';
|
|
10
|
+
export { LANGS, TITLE_NAME } from './template-words.js';
|
|
11
|
+
// Every single-board template: the catalogue first (what Studio offers), then the first Studio's
|
|
12
|
+
// boards and the old presets' readings, kept hidden for the projects made with them, then the
|
|
13
|
+
// boards that only come in a set (hidden).
|
|
14
|
+
export const TEMPLATES = [
|
|
15
|
+
...CATALOGUE_TEMPLATES,
|
|
16
|
+
{
|
|
17
|
+
key: 'bugs',
|
|
18
|
+
retired: true,
|
|
19
|
+
icon: 'bug',
|
|
20
|
+
name: w('Fix bugs', 'Arreglar bugs'),
|
|
21
|
+
description: w('One agent refines each bug, another fixes it, and you approve each step.', 'Un agente refina cada bug, otro lo arregla y tú apruebas cada paso.'),
|
|
22
|
+
board: w('Bugs', 'Bugs'),
|
|
23
|
+
item: w('Bug', 'Bug'),
|
|
24
|
+
about: w('Bugs in the game. Reproduce before touching anything and leave the proof on video.', 'Bugs del juego. Reproduce antes de tocar nada y deja la prueba en vídeo.'),
|
|
25
|
+
idle: w('Look in the log of the latest build for errors without a bug and create one for each.', 'Busca en el log de la última build errores que no tengan bug y crea uno por cada uno.'),
|
|
26
|
+
parts: [
|
|
27
|
+
{
|
|
28
|
+
key: 'what',
|
|
29
|
+
kind: 'long',
|
|
30
|
+
name: w('What happens', 'Qué pasa'),
|
|
31
|
+
hint: w('what you see and what you expected', 'qué ves y qué esperabas ver'),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: 'repro',
|
|
35
|
+
kind: 'check',
|
|
36
|
+
name: w('Steps to reproduce', 'Pasos para reproducirlo'),
|
|
37
|
+
hint: w('each step, in order', 'cada paso, en orden'),
|
|
38
|
+
options: [
|
|
39
|
+
w('Open the game', 'Abrir la partida'),
|
|
40
|
+
w('Go to the place', 'Ir al lugar'),
|
|
41
|
+
w('Do the action', 'Hacer la acción'),
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: 'severity',
|
|
46
|
+
kind: 'level',
|
|
47
|
+
name: w('Severity', 'Gravedad'),
|
|
48
|
+
hint: w('how much it hurts whoever plays', 'cuánto le duele a quien juega'),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: 'area',
|
|
52
|
+
kind: 'choice',
|
|
53
|
+
name: w('Area', 'Área'),
|
|
54
|
+
hint: w('where the problem is', 'dónde está el problema'),
|
|
55
|
+
options: [
|
|
56
|
+
w('Game', 'Juego'),
|
|
57
|
+
w('Interface', 'Interfaz'),
|
|
58
|
+
w('Audio', 'Audio'),
|
|
59
|
+
w('Render', 'Render'),
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: 'cause',
|
|
64
|
+
kind: 'long',
|
|
65
|
+
name: w('Likely cause', 'Causa probable'),
|
|
66
|
+
hint: w('what causes it, in two or three sentences', 'qué lo provoca, en dos o tres frases'),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
key: 'code',
|
|
70
|
+
kind: 'code',
|
|
71
|
+
name: w('Code changes', 'Cambios de código'),
|
|
72
|
+
hint: w('the diff of the fix', 'el diff del arreglo'),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: 'video',
|
|
76
|
+
kind: 'video',
|
|
77
|
+
name: w('Video of the fix', 'Vídeo del arreglo'),
|
|
78
|
+
hint: w('the same action, fixed', 'la misma acción, ya arreglada'),
|
|
79
|
+
show: 'strip',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
form: [
|
|
83
|
+
['what', true],
|
|
84
|
+
['repro', false],
|
|
85
|
+
],
|
|
86
|
+
steps: [
|
|
87
|
+
{
|
|
88
|
+
key: 'refine',
|
|
89
|
+
name: w('Refine', 'Refinar'),
|
|
90
|
+
doer: 'any',
|
|
91
|
+
reviewer: 'you',
|
|
92
|
+
hand: [
|
|
93
|
+
['cause', 'always'],
|
|
94
|
+
['severity', 'always'],
|
|
95
|
+
],
|
|
96
|
+
ways: [DONE],
|
|
97
|
+
take: w('Reproduce the bug following @{repro} before looking for the cause.', 'Reproduce el bug siguiendo @{repro} antes de buscar la causa.'),
|
|
98
|
+
before: w('Write the @{cause} in plain words and pick the @{severity}.', 'Escribe la @{cause} en lenguaje llano y elige la @{severity}.'),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: 'fix',
|
|
102
|
+
name: w('Fix', 'Arreglar'),
|
|
103
|
+
doer: 'any',
|
|
104
|
+
reviewer: 'you',
|
|
105
|
+
hand: [
|
|
106
|
+
['code', 'always'],
|
|
107
|
+
['video', 'always', true],
|
|
108
|
+
],
|
|
109
|
+
take: w('Start from the @{cause} approved in @{refine}.', 'Parte de la @{cause} aprobada en @{refine}.'),
|
|
110
|
+
before: w('Record a new @{video} with the same action as @{repro}.', 'Graba un @{video} nuevo con la misma acción de @{repro}.'),
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
anytime: ['area'],
|
|
114
|
+
samples: {
|
|
115
|
+
en: [
|
|
116
|
+
'Wolves do not cross the rope bridge',
|
|
117
|
+
'The fog flickers on load',
|
|
118
|
+
'Footsteps sound twice in the lighthouse',
|
|
119
|
+
'Pollen over the pause menu',
|
|
120
|
+
],
|
|
121
|
+
es: [
|
|
122
|
+
'Los lobos no cruzan el puente de cuerda',
|
|
123
|
+
'La niebla parpadea al cargar',
|
|
124
|
+
'Los pasos suenan dos veces en el faro',
|
|
125
|
+
'Polen sobre el menú de pausa',
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
key: 'blog',
|
|
131
|
+
retired: true,
|
|
132
|
+
icon: 'book',
|
|
133
|
+
name: w('Write for the blog', 'Escribir para el blog'),
|
|
134
|
+
description: w('An agent proposes the outline and writes; you decide what gets published.', 'Un agente propone el esquema y escribe; tú decides qué se publica.'),
|
|
135
|
+
board: w('Journal', 'Diario'),
|
|
136
|
+
item: w('Post', 'Entrada'),
|
|
137
|
+
about: w('The development journal. Warm tone, no jargon, one idea per post.', 'El diario de desarrollo. Tono cercano, sin jerga, una idea por entrada.'),
|
|
138
|
+
idle: EMPTY,
|
|
139
|
+
parts: [
|
|
140
|
+
{
|
|
141
|
+
key: 'idea',
|
|
142
|
+
kind: 'long',
|
|
143
|
+
name: w('Idea', 'Idea'),
|
|
144
|
+
hint: w('what it is about, in one sentence', 'de qué trata, en una frase'),
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
key: 'outline',
|
|
148
|
+
kind: 'long',
|
|
149
|
+
name: w('Outline', 'Esquema'),
|
|
150
|
+
hint: w('the parts, in order', 'las partes, en orden'),
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
key: 'text',
|
|
154
|
+
kind: 'long',
|
|
155
|
+
name: w('Text', 'Texto'),
|
|
156
|
+
hint: w('the whole post', 'la entrada completa'),
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
key: 'cover',
|
|
160
|
+
kind: 'images',
|
|
161
|
+
name: w('Cover image', 'Imagen de portada'),
|
|
162
|
+
hint: w('an image that stands for it', 'una imagen que la represente'),
|
|
163
|
+
show: 'one',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
key: 'section',
|
|
167
|
+
kind: 'choice',
|
|
168
|
+
name: w('Section', 'Sección'),
|
|
169
|
+
hint: EMPTY,
|
|
170
|
+
options: [w('Tech', 'Técnica'), w('Art', 'Arte'), w('Community', 'Comunidad')],
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
form: [['idea', true]],
|
|
174
|
+
steps: [
|
|
175
|
+
{
|
|
176
|
+
key: 'outlining',
|
|
177
|
+
name: w('Outlining', 'Esquematizar'),
|
|
178
|
+
doer: 'any',
|
|
179
|
+
reviewer: 'you',
|
|
180
|
+
hand: [['outline', 'always']],
|
|
181
|
+
take: w('Propose an @{outline} from the @{idea}.', 'Propón un @{outline} a partir de la @{idea}.'),
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: 'drafting',
|
|
185
|
+
name: w('Drafting', 'Redactar'),
|
|
186
|
+
doer: 'any',
|
|
187
|
+
reviewer: 'you',
|
|
188
|
+
hand: [
|
|
189
|
+
['text', 'always'],
|
|
190
|
+
['cover', 'no'],
|
|
191
|
+
],
|
|
192
|
+
take: w('Write the @{text} following the approved @{outline}.', 'Escribe el @{text} siguiendo el @{outline} aprobado.'),
|
|
193
|
+
before: w('Read the text out loud once before handing it off.', 'Lee el texto en voz alta una vez antes de entregarlo.'),
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
key: 'publishing',
|
|
197
|
+
name: w('Publishing', 'Publicación'),
|
|
198
|
+
doer: 'you',
|
|
199
|
+
reviewer: 'none',
|
|
200
|
+
hand: [],
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
anytime: ['section'],
|
|
204
|
+
samples: {
|
|
205
|
+
en: ['The bridge the wolves fear', 'How we paint the fog', 'A week with the beta'],
|
|
206
|
+
es: ['El puente que temen los lobos', 'Cómo pintamos la niebla', 'Una semana con la beta'],
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
key: 'tasks',
|
|
211
|
+
retired: true,
|
|
212
|
+
icon: 'checklist',
|
|
213
|
+
name: w('Simple tasks', 'Tareas simples'),
|
|
214
|
+
description: w('One step: an agent does it and you review it.', 'Un solo paso: un agente lo hace y tú lo revisas.'),
|
|
215
|
+
board: w('Tasks', 'Tareas'),
|
|
216
|
+
item: w('Task', 'Tarea'),
|
|
217
|
+
about: EMPTY,
|
|
218
|
+
idle: EMPTY,
|
|
219
|
+
parts: [
|
|
220
|
+
{
|
|
221
|
+
key: 'todo',
|
|
222
|
+
kind: 'long',
|
|
223
|
+
name: w('What to do', 'Qué hay que hacer'),
|
|
224
|
+
hint: w('what an agent needs to start', 'lo que necesita un agente para empezar'),
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
key: 'did',
|
|
228
|
+
kind: 'long',
|
|
229
|
+
name: w('What I did', 'Qué hice'),
|
|
230
|
+
hint: w('what changed and how to check it', 'lo que cambió y cómo comprobarlo'),
|
|
231
|
+
},
|
|
232
|
+
{ key: 'priority', kind: 'level', name: w('Priority', 'Prioridad'), hint: EMPTY },
|
|
233
|
+
],
|
|
234
|
+
form: [['todo', false]],
|
|
235
|
+
steps: [
|
|
236
|
+
{
|
|
237
|
+
key: 'doit',
|
|
238
|
+
name: w('Do it', 'Hacerlo'),
|
|
239
|
+
doer: 'any',
|
|
240
|
+
reviewer: 'you',
|
|
241
|
+
hand: [['did', 'always']],
|
|
242
|
+
before: w('Say in @{did} how to check it.', 'Cuenta en @{did} cómo comprobarlo.'),
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
anytime: ['priority'],
|
|
246
|
+
samples: {
|
|
247
|
+
en: ['Write the controls guide', 'Review the forest palette', 'Close the dock map'],
|
|
248
|
+
es: [
|
|
249
|
+
'Escribir la guía de controles',
|
|
250
|
+
'Revisar la paleta del bosque',
|
|
251
|
+
'Cerrar el mapa del muelle',
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
...COVERAGE_TEMPLATES,
|
|
256
|
+
...FLOW_TEMPLATES,
|
|
257
|
+
];
|
|
258
|
+
export function requireTemplate(key) {
|
|
259
|
+
const template = TEMPLATES.find((candidate) => candidate.key === key);
|
|
260
|
+
if (!template)
|
|
261
|
+
throw new Error(`No template "${key}"`);
|
|
262
|
+
return template;
|
|
263
|
+
}
|
|
264
|
+
// Where a part shows by default: evidence, long texts and checklists in the main column, the rest
|
|
265
|
+
// at the side.
|
|
266
|
+
export function defaultZone(kind) {
|
|
267
|
+
return isEvidenceKind(kind) || kind === 'long' || kind === 'check' ? 'main' : 'side';
|
|
268
|
+
}
|
|
269
|
+
// A board name where a command takes it: quoted when it has a space.
|
|
270
|
+
const asArg = (name) => (/\s/.test(name) ? `"${name}"` : name);
|
|
271
|
+
// `keep`: the template's keys become the ids (a preset's reading keeps the keys its items' data is
|
|
272
|
+
// stored under); otherwise every id is fresh, so nothing stays linked to the template.
|
|
273
|
+
// `boards`: the names of the boards a set makes with it, by template key. A text names a board as
|
|
274
|
+
// #{key} (#{key:arg} where a command takes it): this board's own name, the set's name for that
|
|
275
|
+
// board, or else the template's.
|
|
276
|
+
export function instantiate(template, lang, names, ids = newId, options = {}) {
|
|
277
|
+
const keep = options.keep === true;
|
|
278
|
+
const boardName = (key) => {
|
|
279
|
+
if (key === template.key)
|
|
280
|
+
return names.name?.trim() || template.board[lang];
|
|
281
|
+
return options.boards?.[key] ?? requireTemplate(key).board[lang];
|
|
282
|
+
};
|
|
283
|
+
const named = (text) => text.replace(/#\{([a-z_-]+)(:arg)?\}/g, (_, key, arg) => arg ? asArg(boardName(key)) : boardName(key));
|
|
284
|
+
const refs = new Map();
|
|
285
|
+
const choices = new Map();
|
|
286
|
+
const parts = {};
|
|
287
|
+
for (const part of template.parts) {
|
|
288
|
+
const id = keep ? part.key : ids(isEvidenceKind(part.kind) ? 'e' : 'f');
|
|
289
|
+
refs.set(part.key, id);
|
|
290
|
+
const show = part.show ?? EVIDENCE_SHOWS[part.kind]?.[0];
|
|
291
|
+
const options = (part.options ?? []).map((option, index) => ({
|
|
292
|
+
id: keep ? (part.optionKeys?.[index] ?? `v${index + 1}`) : ids('c'),
|
|
293
|
+
name: option[lang],
|
|
294
|
+
}));
|
|
295
|
+
choices.set(part.key, options.map((choice) => choice.id));
|
|
296
|
+
parts[id] = {
|
|
297
|
+
id,
|
|
298
|
+
name: part.name[lang],
|
|
299
|
+
kind: part.kind,
|
|
300
|
+
hint: named(part.hint[lang]),
|
|
301
|
+
options,
|
|
302
|
+
...(show === undefined ? {} : { show }),
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
for (const step of template.steps)
|
|
306
|
+
refs.set(step.key, keep ? step.key : ids('s'));
|
|
307
|
+
const ref = (key) => refs.get(key) ?? key;
|
|
308
|
+
// A value as a choice part stores it (its option's id); a level, yes or no as written.
|
|
309
|
+
const storedValue = (key, value) => {
|
|
310
|
+
const part = template.parts.find((candidate) => candidate.key === key);
|
|
311
|
+
if (part?.kind !== 'choice')
|
|
312
|
+
return value;
|
|
313
|
+
const at = part.optionKeys?.indexOf(value) ?? -1;
|
|
314
|
+
const position = /^\d+$/.test(value) ? Number(value) : at;
|
|
315
|
+
return choices.get(key)?.[position] ?? value;
|
|
316
|
+
};
|
|
317
|
+
for (const part of template.parts) {
|
|
318
|
+
const made = parts[ref(part.key)];
|
|
319
|
+
if (!made)
|
|
320
|
+
continue;
|
|
321
|
+
if (part.initial !== undefined)
|
|
322
|
+
made.initial = storedValue(part.key, part.initial);
|
|
323
|
+
if (part.guard)
|
|
324
|
+
made.guard = {
|
|
325
|
+
push: part.guard.push.map(ref),
|
|
326
|
+
...(part.guard.repo === undefined ? {} : { repo: ref(part.guard.repo) }),
|
|
327
|
+
...(part.guard.base === undefined ? {} : { base: part.guard.base }),
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
const words = (text) => named(text?.[lang] ?? '').replace(/@\{([a-z_]+)\}/g, (_, key) => `@[${ref(key)}]`);
|
|
331
|
+
const steps = template.steps.map((step) => ({
|
|
332
|
+
id: ref(step.key),
|
|
333
|
+
name: step.name[lang],
|
|
334
|
+
doer: step.doer,
|
|
335
|
+
reviewer: step.reviewer,
|
|
336
|
+
hand: step.hand.map(([key, req, fresh, when]) => ({
|
|
337
|
+
ref: ref(key),
|
|
338
|
+
req,
|
|
339
|
+
...(when ? { when: { part: ref(when[0]), value: storedValue(when[0], when[1]) } } : {}),
|
|
340
|
+
fresh: fresh ?? false,
|
|
341
|
+
})),
|
|
342
|
+
ways: (step.ways ?? []).map((way) => (way === DONE ? DONE : ref(way))),
|
|
343
|
+
back: step.back === undefined ? SAME : ref(step.back),
|
|
344
|
+
instructions: {
|
|
345
|
+
take: words(step.take),
|
|
346
|
+
before: words(step.before),
|
|
347
|
+
review: words(step.review),
|
|
348
|
+
},
|
|
349
|
+
...stepDefaults(),
|
|
350
|
+
note: step.note ? { req: 'always', hint: step.note[lang] } : { req: 'no', hint: '' },
|
|
351
|
+
waits: [...(step.waits ?? [])],
|
|
352
|
+
skipWhenReady: step.skip === true,
|
|
353
|
+
doerMayDrop: step.drop === true,
|
|
354
|
+
...(step.lead
|
|
355
|
+
? {
|
|
356
|
+
lead: {
|
|
357
|
+
to: step.lead[0] === DONE ? DONE : ref(step.lead[0]),
|
|
358
|
+
when: {
|
|
359
|
+
part: ref(step.lead[1][0]),
|
|
360
|
+
value: storedValue(step.lead[1][0], step.lead[1][1]),
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
}
|
|
364
|
+
: {}),
|
|
365
|
+
}));
|
|
366
|
+
const layout = Object.fromEntries(Object.values(parts).map((p) => [p.id, defaultZone(p.kind)]));
|
|
367
|
+
// A board where someone reviews shows the rounds in the main column, first.
|
|
368
|
+
const reviewed = steps.some(({ reviewer }) => reviewer !== 'none');
|
|
369
|
+
const placed = reviewed ? { [ROUNDS]: 'main' } : {};
|
|
370
|
+
for (const [key, zone] of Object.entries(template.layout ?? {}))
|
|
371
|
+
placed[ref(key)] = zone;
|
|
372
|
+
const ordered = {
|
|
373
|
+
...placed,
|
|
374
|
+
...Object.fromEntries(Object.entries(layout).filter(([id]) => !(id in placed))),
|
|
375
|
+
};
|
|
376
|
+
const row = template.row
|
|
377
|
+
? template.row.map(ref)
|
|
378
|
+
: Object.values(parts)
|
|
379
|
+
.filter(({ kind }) => kind === 'level' || kind === 'choice')
|
|
380
|
+
.slice(0, 2)
|
|
381
|
+
.map(({ id }) => id);
|
|
382
|
+
const group = template.list?.group;
|
|
383
|
+
const motives = (template.motives ?? []).map(([key, name]) => ({
|
|
384
|
+
id: keep ? key : ids('c'),
|
|
385
|
+
name: name[lang],
|
|
386
|
+
}));
|
|
387
|
+
return {
|
|
388
|
+
...boardDefaults(),
|
|
389
|
+
drop: { by: template.dropBy ?? 'anyone', motives },
|
|
390
|
+
list: {
|
|
391
|
+
as: template.list?.as ?? 'list',
|
|
392
|
+
...(group === undefined
|
|
393
|
+
? {}
|
|
394
|
+
: { group: group === STEP || group === MOTIVE ? group : ref(group) }),
|
|
395
|
+
},
|
|
396
|
+
schema: BOARD_SCHEMA,
|
|
397
|
+
name: names.name?.trim() || template.board[lang],
|
|
398
|
+
item: names.item?.trim() || template.item[lang],
|
|
399
|
+
icon: template.icon,
|
|
400
|
+
title: TITLE_NAME[lang],
|
|
401
|
+
parts,
|
|
402
|
+
form: template.form.map(([key, required]) => ({ ref: ref(key), required })),
|
|
403
|
+
steps,
|
|
404
|
+
anytime: template.anytime.map(ref),
|
|
405
|
+
layout: ordered,
|
|
406
|
+
row,
|
|
407
|
+
about: words(template.about),
|
|
408
|
+
idle: words(template.idle),
|
|
409
|
+
cap: { on: false, n: 3 },
|
|
410
|
+
samples: [...template.samples[lang]],
|
|
411
|
+
...(template.split ? { split: { board: SAME, always: template.split.always } } : {}),
|
|
412
|
+
...(template.analysis
|
|
413
|
+
? {
|
|
414
|
+
analysis: Object.fromEntries(Object.entries(template.analysis).map(([role, key]) => [role, ref(key)])),
|
|
415
|
+
}
|
|
416
|
+
: {}),
|
|
417
|
+
template: template.key,
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
export { TEMPLATE_SETS };
|
|
421
|
+
export function requireSet(key) {
|
|
422
|
+
const set = TEMPLATE_SETS.find((candidate) => candidate.key === key);
|
|
423
|
+
if (!set)
|
|
424
|
+
throw new Error(`No template set "${key}"`);
|
|
425
|
+
return set;
|
|
426
|
+
}
|
|
427
|
+
export function isSetKey(key) {
|
|
428
|
+
return TEMPLATE_SETS.some((set) => set.key === key);
|
|
429
|
+
}
|
|
430
|
+
// Copies every board of a set. `boards` gives each one its hidden board id (what a split names)
|
|
431
|
+
// and the names the person typed; the parent of a split divides into its child by that id.
|
|
432
|
+
export function instantiateSet(set, lang, boards, ids = newId) {
|
|
433
|
+
const names = Object.fromEntries(set.boards.map((key, index) => [
|
|
434
|
+
key,
|
|
435
|
+
boards[index]?.name?.trim() || requireTemplate(key).board[lang],
|
|
436
|
+
]));
|
|
437
|
+
const defs = set.boards.map((key, index) => {
|
|
438
|
+
const { name, item } = boards[index] ?? {};
|
|
439
|
+
return instantiate(requireTemplate(key), lang, { ...(name ? { name } : {}), ...(item ? { item } : {}) }, ids, { boards: names });
|
|
440
|
+
});
|
|
441
|
+
const split = set.split;
|
|
442
|
+
const parent = split ? defs[split.parent] : undefined;
|
|
443
|
+
const child = split ? boards[split.child] : undefined;
|
|
444
|
+
if (split && parent && child)
|
|
445
|
+
parent.split = { board: child.id, always: split.always };
|
|
446
|
+
defs.forEach((def, index) => {
|
|
447
|
+
def.template = set.key;
|
|
448
|
+
def.madeWith = boards.filter((_, other) => other !== index).map(({ id }) => id);
|
|
449
|
+
});
|
|
450
|
+
return defs;
|
|
451
|
+
}
|
|
452
|
+
export function templateView(template, lang) {
|
|
453
|
+
return {
|
|
454
|
+
key: template.key,
|
|
455
|
+
icon: template.icon,
|
|
456
|
+
name: template.name[lang],
|
|
457
|
+
description: template.description[lang],
|
|
458
|
+
definition: instantiate(template, lang, {}),
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
export function setView(set, lang) {
|
|
462
|
+
const placeholders = set.boards.map((_, index) => ({ id: `bset${index}` }));
|
|
463
|
+
const defs = instantiateSet(set, lang, placeholders);
|
|
464
|
+
const [first] = defs;
|
|
465
|
+
if (!first)
|
|
466
|
+
throw new Error(`Template set "${set.key}" has no boards`);
|
|
467
|
+
return {
|
|
468
|
+
key: set.key,
|
|
469
|
+
icon: set.icon,
|
|
470
|
+
name: set.name[lang],
|
|
471
|
+
description: set.description[lang],
|
|
472
|
+
definition: first,
|
|
473
|
+
boards: defs.map((definition) => ({
|
|
474
|
+
name: definition.name,
|
|
475
|
+
item: definition.item,
|
|
476
|
+
definition,
|
|
477
|
+
})),
|
|
478
|
+
...(set.split ? { split: set.split } : {}),
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
const listed = ({ hidden, retired }) => !hidden && !retired;
|
|
482
|
+
// What Studio's home offers, in order: every template that is not only part of a set, then the
|
|
483
|
+
// sets.
|
|
484
|
+
export function listedTemplates(lang) {
|
|
485
|
+
return [
|
|
486
|
+
...TEMPLATES.filter(listed).map((template) => templateView(template, lang)),
|
|
487
|
+
...TEMPLATE_SETS.map((set) => setView(set, lang)),
|
|
488
|
+
];
|
|
489
|
+
}
|
|
490
|
+
// The keys of what Studio's home offers, in its order: the one catalog the CLI takes and lists.
|
|
491
|
+
export const LISTED_KEYS = [
|
|
492
|
+
...TEMPLATES.filter(listed).map(({ key }) => key),
|
|
493
|
+
...TEMPLATE_SETS.map(({ key }) => key),
|
|
494
|
+
];
|
|
495
|
+
export function isListedKey(key) {
|
|
496
|
+
return LISTED_KEYS.includes(key);
|
|
497
|
+
}
|
|
498
|
+
const BLANK = {
|
|
499
|
+
item: w('Item', 'Ítem'),
|
|
500
|
+
step: w('Do it', 'Hacerlo'),
|
|
501
|
+
};
|
|
502
|
+
// A blank board that already works: one step, any agent does it and you review it.
|
|
503
|
+
export function blankBoard(lang, names, ids = newId) {
|
|
504
|
+
return {
|
|
505
|
+
...boardDefaults(),
|
|
506
|
+
schema: BOARD_SCHEMA,
|
|
507
|
+
name: names.name.trim(),
|
|
508
|
+
item: names.item?.trim() || BLANK.item[lang],
|
|
509
|
+
icon: 'layers',
|
|
510
|
+
title: TITLE_NAME[lang],
|
|
511
|
+
parts: {},
|
|
512
|
+
form: [],
|
|
513
|
+
steps: [
|
|
514
|
+
{
|
|
515
|
+
id: ids('s'),
|
|
516
|
+
name: BLANK.step[lang],
|
|
517
|
+
doer: 'any',
|
|
518
|
+
reviewer: 'you',
|
|
519
|
+
hand: [],
|
|
520
|
+
ways: [],
|
|
521
|
+
back: SAME,
|
|
522
|
+
instructions: { take: '', before: '', review: '' },
|
|
523
|
+
...stepDefaults(),
|
|
524
|
+
},
|
|
525
|
+
],
|
|
526
|
+
anytime: [],
|
|
527
|
+
layout: { [ROUNDS]: 'main' },
|
|
528
|
+
row: [],
|
|
529
|
+
about: '',
|
|
530
|
+
idle: '',
|
|
531
|
+
cap: { on: false, n: 3 },
|
|
532
|
+
samples: [],
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
const REQUESTS = {
|
|
536
|
+
key: 'requests',
|
|
537
|
+
icon: 'inbox',
|
|
538
|
+
name: w('Requests', 'Pedidos'),
|
|
539
|
+
description: w('Loose requests for any agent.', 'Encargos sueltos para cualquier agente.'),
|
|
540
|
+
board: w('Requests', 'Pedidos'),
|
|
541
|
+
item: w('Request', 'Pedido'),
|
|
542
|
+
about: w('Loose requests for any agent. Every project comes with it.', 'Encargos sueltos para cualquier agente. Viene con cada proyecto.'),
|
|
543
|
+
idle: EMPTY,
|
|
544
|
+
parts: [
|
|
545
|
+
{
|
|
546
|
+
key: 'need',
|
|
547
|
+
kind: 'long',
|
|
548
|
+
name: w('What you need', 'Qué necesitas'),
|
|
549
|
+
hint: w('the request, in your words', 'el encargo, en tus palabras'),
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
key: 'did',
|
|
553
|
+
kind: 'long',
|
|
554
|
+
name: w('What I did', 'Qué hice'),
|
|
555
|
+
hint: w('what was done and how to check it', 'lo que hizo y cómo comprobarlo'),
|
|
556
|
+
},
|
|
557
|
+
],
|
|
558
|
+
form: [['need', true]],
|
|
559
|
+
steps: [
|
|
560
|
+
{
|
|
561
|
+
key: 'doit',
|
|
562
|
+
name: BLANK.step,
|
|
563
|
+
doer: 'any',
|
|
564
|
+
reviewer: 'you',
|
|
565
|
+
hand: [['did', 'always']],
|
|
566
|
+
// A Request has no branch: a code change done here would close as Done with nothing merged,
|
|
567
|
+
// while the gate keeps it out of the base (P8-R2-6).
|
|
568
|
+
take: w('Do what @{need} asks. A change to code that one of the project\'s boards lands (a board whose branch Otea protects) is not done here: a Request has no branch, so it would close as Done with nothing merged. Create it on that board instead (otea create --collection "<board>"), and hand this one off saying where it went.', 'Haz lo que pide @{need}. Un cambio de código que integra uno de los tableros del proyecto (uno cuya rama protege Otea) no se hace aquí: un Pedido no tiene rama, así que quedaría Hecho sin fusionar nada. Créalo en ese tablero (otea create --collection "<tablero>") y entrega este diciendo adónde fue.'),
|
|
569
|
+
},
|
|
570
|
+
],
|
|
571
|
+
anytime: [],
|
|
572
|
+
samples: {
|
|
573
|
+
en: ['Sort the dock textures', 'Upload build 0.12 to the beta'],
|
|
574
|
+
es: ['Ordenar las texturas del muelle', 'Subir la build 0.12 a la beta'],
|
|
575
|
+
},
|
|
576
|
+
};
|
|
577
|
+
// The language a board was made in, read from what it calls the title.
|
|
578
|
+
export function boardLang(def) {
|
|
579
|
+
return def.title === TITLE_NAME.es ? 'es' : 'en';
|
|
580
|
+
}
|
|
581
|
+
// The project's built-in board for loose requests (Pedidos); an agent's board draft arrives on one.
|
|
582
|
+
export function requestsBoard(lang, ids = newId) {
|
|
583
|
+
const def = instantiate(REQUESTS, lang, {}, ids);
|
|
584
|
+
delete def.template;
|
|
585
|
+
return def;
|
|
586
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { orderByBlocks } from './relations.js';
|
|
2
|
+
export const DEFAULT_LIMITS = [
|
|
3
|
+
'Touch only what these items need.',
|
|
4
|
+
'No new dependencies; ask first if a fix needs one.',
|
|
5
|
+
];
|
|
6
|
+
export const DEFAULT_SUCCESS = [
|
|
7
|
+
'Every item reaches review with its evidence attached.',
|
|
8
|
+
'Existing tests pass; new behavior gets a test where it can.',
|
|
9
|
+
'You never mark an item done; the person approves it.',
|
|
10
|
+
];
|
|
11
|
+
// The lines a person typed into a list: one per line, trimmed, the blank ones dropped.
|
|
12
|
+
export function briefLines(text) {
|
|
13
|
+
return text
|
|
14
|
+
.split('\n')
|
|
15
|
+
.map((line) => line.trim())
|
|
16
|
+
.filter(Boolean);
|
|
17
|
+
}
|
|
18
|
+
const fieldText = (value) => typeof value === 'string'
|
|
19
|
+
? value.trim()
|
|
20
|
+
: value === null || value === undefined
|
|
21
|
+
? ''
|
|
22
|
+
: String(value);
|
|
23
|
+
// A value under a list entry: its first line after the label, the rest indented beneath it.
|
|
24
|
+
const indented = (text) => text.split('\n').join('\n ');
|
|
25
|
+
function itemSection(item, entry) {
|
|
26
|
+
const lines = [`### ${item.id} · ${item.title}`, ''];
|
|
27
|
+
const description = fieldText(item.fields.description);
|
|
28
|
+
if (description)
|
|
29
|
+
lines.push(description, '');
|
|
30
|
+
lines.push(`- board: ${item.collection} · ${item.state}`);
|
|
31
|
+
for (const [name, value] of Object.entries(item.fields)) {
|
|
32
|
+
const text = fieldText(value);
|
|
33
|
+
if (name === 'title' || name === 'description' || text === '')
|
|
34
|
+
continue;
|
|
35
|
+
lines.push(`- ${name}: ${indented(text)}`);
|
|
36
|
+
}
|
|
37
|
+
if (entry.after.length > 0)
|
|
38
|
+
lines.push(`- after: ${entry.after.join(', ')}`);
|
|
39
|
+
if (entry.missing.length > 0) {
|
|
40
|
+
lines.push(`- blocked: ${entry.missing.join(', ')} is not in this brief; stop and ask.`);
|
|
41
|
+
}
|
|
42
|
+
return [...lines, ''];
|
|
43
|
+
}
|
|
44
|
+
const bullets = (lines) => lines.map((line) => `- ${line}`);
|
|
45
|
+
// A Markdown brief for an agent: the items in the order their blocks allow, each with its fields,
|
|
46
|
+
// what it waits for and the open blockers left out, then the limits and what success means.
|
|
47
|
+
export function writeBrief(input) {
|
|
48
|
+
const byId = new Map(input.items.map((item) => [item.id, item]));
|
|
49
|
+
const ids = orderByBlocks(input.items.map(({ id }) => id), input.relations);
|
|
50
|
+
const blocks = input.relations.filter(({ kind }) => kind === 'blocks');
|
|
51
|
+
const order = ids.map((id) => {
|
|
52
|
+
const blockers = blocks.filter(({ to }) => to === id).map(({ from }) => from);
|
|
53
|
+
return {
|
|
54
|
+
id,
|
|
55
|
+
title: byId.get(id)?.title ?? id,
|
|
56
|
+
after: blockers.filter((other) => byId.has(other)),
|
|
57
|
+
missing: blockers.filter((other) => !byId.has(other) && input.isOpen(other)),
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
const count = order.length === 1 ? '1 item' : `${order.length} items`;
|
|
61
|
+
const markdown = [
|
|
62
|
+
`# Brief · ${input.project}`,
|
|
63
|
+
'',
|
|
64
|
+
`${count} · written ${input.writtenAt}`,
|
|
65
|
+
'',
|
|
66
|
+
'Work these items in the order below. Claim each one before you start and heartbeat while you work. Hand each one back with its evidence attached. If something is unclear, stop and ask in the item instead of guessing.',
|
|
67
|
+
'',
|
|
68
|
+
'## Order',
|
|
69
|
+
'',
|
|
70
|
+
...order.map(({ id, title, after, missing }, index) => {
|
|
71
|
+
const note = missing.length > 0
|
|
72
|
+
? `needs ${missing.join(', ')}, not in this brief`
|
|
73
|
+
: after.length > 0
|
|
74
|
+
? `after ${after.join(', ')}`
|
|
75
|
+
: '';
|
|
76
|
+
return `${index + 1}. ${id} · ${title}${note ? ` (${note})` : ''}`;
|
|
77
|
+
}),
|
|
78
|
+
'',
|
|
79
|
+
'## Items',
|
|
80
|
+
'',
|
|
81
|
+
...order.flatMap((entry) => {
|
|
82
|
+
const item = byId.get(entry.id);
|
|
83
|
+
return item ? itemSection(item, entry) : [];
|
|
84
|
+
}),
|
|
85
|
+
...(input.limits.length > 0 ? ['## Limits', '', ...bullets(input.limits), ''] : []),
|
|
86
|
+
...(input.success.length > 0 ? ['## Success', '', ...bullets(input.success), ''] : []),
|
|
87
|
+
'## Hand back',
|
|
88
|
+
'',
|
|
89
|
+
'Move each item on to review when it holds. Leave a note on anything you skipped.',
|
|
90
|
+
'',
|
|
91
|
+
].join('\n');
|
|
92
|
+
return { order, markdown };
|
|
93
|
+
}
|