@jmanuelcorral/bond-app 0.1.4 → 0.1.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.
- package/README.md +241 -7
- package/app/brand/TOKENS.md +5 -5
- package/app/layouts/bond.json +10 -14
- package/app/mods/bond-agents/api.js +35 -0
- package/app/mods/bond-agents/branch.svg +1 -0
- package/app/mods/bond-agents/brand.js +53 -2
- package/app/mods/bond-agents/config.js +8 -0
- package/app/mods/bond-agents/eye-off.svg +1 -0
- package/app/mods/bond-agents/eye.svg +1 -0
- package/app/mods/bond-agents/main.js +316 -330
- package/app/mods/bond-agents/model.js +400 -6
- package/app/mods/bond-board/api.js +35 -0
- package/app/mods/bond-board/branch.svg +1 -0
- package/app/mods/bond-board/brand.js +53 -2
- package/app/mods/bond-board/config.js +8 -0
- package/app/mods/bond-board/main.js +1054 -366
- package/app/mods/bond-board/model.js +138 -17
- package/app/mods/bond-pane/close.svg +1 -0
- package/app/mods/bond-pane/hide.svg +1 -0
- package/app/mods/bond-pane/main.js +103 -0
- package/app/mods/bond-pane/mod.json +1 -0
- package/app/mods/bond-pane/model.js +18 -0
- package/app/mods/bond-pane/split-down.svg +1 -0
- package/app/mods/bond-pane/split-right.svg +1 -0
- package/app/mods/bond-pane/unzoom.svg +1 -0
- package/app/mods/bond-pane/zoom.svg +1 -0
- package/app/mods/bond-settings/api.js +35 -0
- package/app/mods/bond-settings/brand.js +53 -2
- package/app/mods/bond-settings/config.js +8 -0
- package/app/mods/bond-settings/main.js +1645 -87
- package/app/mods/bond-settings/mod.json +1 -1
- package/app/mods/bond-settings/pi-models.js +144 -0
- package/app/mods/bond-status/api.js +35 -0
- package/app/mods/bond-status/brand.js +53 -2
- package/app/mods/bond-status/config.js +8 -0
- package/app/mods/bond-status/main.js +37 -15
- package/app/mods/bond-status/model.js +19 -1
- package/app/mods/bond-tabs/brand.js +53 -2
- package/app/mods/bond-tabs/main.js +45 -3
- package/app/mods/bond-titlebar/brand.js +53 -2
- package/app/mods/bond-titlebar/main.js +115 -55
- package/app/mods/bond-titlebar/version.js +3 -0
- package/app/themes/bond-dark.json +5 -5
- package/app/themes/bond-light.json +5 -5
- package/package.json +1 -1
- package/runner/Dockerfile +58 -15
- package/runner/SPIKE-BOND.md +89 -0
- package/runner/build-config/.none +0 -0
- package/runner/build-creds/.none +0 -0
- package/runner/config.example/README.md +27 -0
- package/runner/config.example/pi/models.json +22 -0
- package/runner/credentials.example.env +27 -0
- package/runner/entrypoint.sh +16 -0
- package/runner/setup.sh +927 -0
- package/runner/versions.env +61 -0
- package/scripts/app-install.ts +64 -1
- package/src/cli.ts +53 -3
- package/src/config.ts +8 -0
- package/src/core/agy-login.ts +682 -0
- package/src/core/delivery.ts +3 -1
- package/src/core/hub-session.ts +9 -7
- package/src/core/orchestrator.ts +1186 -168
- package/src/core/repo-host.ts +60 -0
- package/src/core/setup.ts +239 -0
- package/src/core/watchdog.ts +6 -6
- package/src/db/database.ts +55 -1
- package/src/db/settings-repo.ts +440 -7
- package/src/db/ticket-repo.ts +73 -17
- package/src/index.ts +4 -4
- package/src/runner/azure-devops-client.ts +163 -0
- package/src/runner/docker-client.ts +84 -5
- package/src/runner/github-client.ts +146 -0
- package/src/runner/hc-client.ts +40 -5
- package/src/runner/image-builder.ts +268 -10
- package/src/runner/jira-client.ts +368 -0
- package/src/runner/tool-catalog.ts +84 -0
- package/src/server/app.ts +585 -9
- package/src/types.ts +168 -1
|
@@ -12,28 +12,36 @@
|
|
|
12
12
|
//
|
|
13
13
|
// P6: bond's look. A header with a counter per state, filters (repo, agent, text) and
|
|
14
14
|
// «Nuevo ticket» (a dialog with validation; the ticket lands in Ready, D4); each column
|
|
15
|
-
// in its state's color; empty columns
|
|
15
|
+
// in its state's color; empty columns keep their width with a short line. Colors come from the
|
|
16
16
|
// theme through brand.js (stateColor), never as literals here.
|
|
17
17
|
//
|
|
18
18
|
// Props: none (the board), or { view: "launch" | "cancel" | "deliver" | "nudge" | "approve"
|
|
19
19
|
// | "create" | "pick", ... } when this mod is opened as a dialog or popup by the board.
|
|
20
|
-
import { View, div } from "gpui-kit";
|
|
20
|
+
import { View, div, svg, image } from "gpui-kit";
|
|
21
21
|
import { v_flex, h_flex, TextareaState, Textarea, InputState, Input } from "gpui-base";
|
|
22
22
|
import { run, spaces, props, theme, openOverlay, closeOverlay, notify, shared, setShared, exec } from "herdr";
|
|
23
23
|
import { api, hcGet, apiUrl } from "./api.js";
|
|
24
|
+
import { CONFIG } from "./config.js";
|
|
24
25
|
import {
|
|
25
26
|
COLUMNS, POLL_MS, buildCards, groupByColumn, loadBoard, launchTicket, cancelRun, launchSummary,
|
|
26
27
|
deliverRun, nudgeRun, finishRun, approveHubFixes, deleteTicket, getDeletePreview,
|
|
27
|
-
columnCounts, filterOptions, filterCards, validateNewTicket, createTicket, AGENTS, TICKET_MODES, TEAM_ENGINES,
|
|
28
|
-
cleanRepoChips,
|
|
28
|
+
columnCounts, filterOptions, filterCards, issueChip, validateNewTicket, createTicket, AGENTS, TICKET_MODES, TEAM_ENGINES,
|
|
29
|
+
cleanRepoChips, listAssignedIssues, issueTicketId, searchRepos, listRepoIssues, searchJiraIssues, resetIssueProviderState, needsWizard, timeoutLabel,
|
|
29
30
|
} from "./model.js";
|
|
30
|
-
import { stateColor, UI } from "./brand.js";
|
|
31
|
+
import { stateColor, UI, settingsOverlay, createOverlay, markColor } from "./brand.js";
|
|
32
|
+
|
|
33
|
+
/** The Shell button's program: zsh when the run's container has it, else bash (login shells). */
|
|
34
|
+
const SHELL_ARGV = ["sh", "-c", "if command -v zsh >/dev/null 2>&1; then exec zsh -l; else exec bash -l; fi"];
|
|
31
35
|
|
|
32
36
|
const REFRESH_KEY = "bond.board.refresh";
|
|
33
37
|
// The board's repo/agent filter: a picker popup of this mod sets it, the board reads it.
|
|
34
38
|
const FILTER_KEY = "bond.board.filter";
|
|
35
39
|
const SELECTED_RUN_KEY = "bond.selected_run";
|
|
36
40
|
const SELECTED_TICKET_KEY = "bond.selected_ticket";
|
|
41
|
+
// W-P2: the wizard is offered once per session (D-W2: afterwards it lives in Ajustes).
|
|
42
|
+
let wizardOffered = false;
|
|
43
|
+
|
|
44
|
+
const slug = (s) => String(s).replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
37
45
|
|
|
38
46
|
function spanishStateLabel(col, status) {
|
|
39
47
|
const s = String(status || col || "").toLowerCase();
|
|
@@ -45,6 +53,12 @@ function spanishStateLabel(col, status) {
|
|
|
45
53
|
return `● ${s.toUpperCase()}`;
|
|
46
54
|
}
|
|
47
55
|
|
|
56
|
+
/** Height of an empty column's placeholder: one for all five, subtitle or not. */
|
|
57
|
+
const EMPTY_COLUMN_H = 132;
|
|
58
|
+
|
|
59
|
+
/** The line an empty column shows under its header. */
|
|
60
|
+
const EMPTY_LINE = { ready: "Nada pendiente", running: "Nada en curso", waiting: "Nada en espera", finished: "Nada terminado", error: "Sin errores" };
|
|
61
|
+
|
|
48
62
|
export default class BondBoard extends View {
|
|
49
63
|
init(_props, cx) {
|
|
50
64
|
const p = props() ?? {};
|
|
@@ -60,6 +74,9 @@ export default class BondBoard extends View {
|
|
|
60
74
|
try {
|
|
61
75
|
run("layout.hide", { id: "console" });
|
|
62
76
|
} catch {}
|
|
77
|
+
try {
|
|
78
|
+
run("layout.resize", { id: "board", weight: 3 });
|
|
79
|
+
} catch {}
|
|
63
80
|
}
|
|
64
81
|
if (this.view === "launch") {
|
|
65
82
|
// D20: the clone uses the GitHub credential stored in Ajustes (the user's gh
|
|
@@ -100,19 +117,87 @@ export default class BondBoard extends View {
|
|
|
100
117
|
this.agent = "pi";
|
|
101
118
|
this.team_engine = "hc";
|
|
102
119
|
this.errors = {};
|
|
120
|
+
this.setup = null;
|
|
121
|
+
this.selectedModel = null; // null = '(por defecto)'
|
|
122
|
+
cx.spawn(async (cx) => {
|
|
123
|
+
try {
|
|
124
|
+
this.setup = await api("/setup");
|
|
125
|
+
} catch {
|
|
126
|
+
this.setup = null;
|
|
127
|
+
}
|
|
128
|
+
cx.notify();
|
|
129
|
+
});
|
|
103
130
|
this.fields = {
|
|
104
131
|
title: InputState.new({ placeholder: "título del ticket" }),
|
|
105
|
-
|
|
106
|
-
|
|
132
|
+
model: InputState.new({ placeholder: "por defecto" }),
|
|
133
|
+
issue: InputState.new({ placeholder: "https://github.com/org/repo/issues/123 (o pulsa Buscar)" }),
|
|
134
|
+
repo: InputState.new({ placeholder: "https://github.com/org/repo o https://dev.azure.com/org/proyecto/_git/repo" }),
|
|
107
135
|
repos: TextareaState.new({ placeholder: "un repo por línea: https://github.com/org/repo [agente]" }),
|
|
108
136
|
hub: InputState.new({ placeholder: "https://github.com/org/hub" }),
|
|
109
137
|
base: InputState.new({ placeholder: "rama base (opcional: main)" }),
|
|
110
138
|
budget: InputState.new({ value: "2" }),
|
|
111
|
-
timeout: InputState.new({ value: "
|
|
112
|
-
description: TextareaState.new({ placeholder: "qué hay que hacer (va al PR)" }),
|
|
113
|
-
prompt: TextareaState.new({ placeholder: "encargo al agente (opcional)" }),
|
|
114
|
-
verify: TextareaState.new({ placeholder: "comandos de verificación, uno por línea (opcional)" }),
|
|
139
|
+
timeout: InputState.new({ value: "0", placeholder: "0 = sin timeout" }),
|
|
115
140
|
};
|
|
141
|
+
// Plan bond-app-nuevo-ticket (P2): la issue se busca, no se pega (D2/D4). Jira hasta P3.
|
|
142
|
+
this.issueProvider = "github";
|
|
143
|
+
this.pickedIssue = null;
|
|
144
|
+
this.carryBody = true; // lleva el cuerpo de la issue a la historia salvo que se desmarque
|
|
145
|
+
this.bondify = true; // bondifica el repo si no lo está salvo que se desmarque (P4, D-U)
|
|
146
|
+
// Plan bond-app-ajustes-imagen P4: «Docker en el run». Se pre-marca si el repo trae
|
|
147
|
+
// devcontainer, salvo que la persona ya lo haya tocado.
|
|
148
|
+
this.docker = false;
|
|
149
|
+
this.dockerTouched = false;
|
|
150
|
+
this.devcontainerRepo = null; // "owner/repo" con devcontainer detectado
|
|
151
|
+
this.devcontainerChecked = null; // último "owner/repo@base" consultado
|
|
152
|
+
// Dónde: el repo elegido es un hub (hub.toml) → el ticket va en modo hub, salvo que
|
|
153
|
+
// la persona pida tratarlo como un repo normal.
|
|
154
|
+
this.hubDetected = null; // URL del repo elegido cuando trae hub.toml
|
|
155
|
+
this.hubAsRepo = false;
|
|
156
|
+
this.issuePanel = null;
|
|
157
|
+
this.issues = null;
|
|
158
|
+
this.issuesLoading = false;
|
|
159
|
+
this.issuesError = null;
|
|
160
|
+
this.issueQuery = InputState.new({ placeholder: "filtra tus issues, escribe owner/repo para ver las de un repo, o pega la URL de una issue" });
|
|
161
|
+
this.issueQuery.on("change", (_e, cx) => cx.notify());
|
|
162
|
+
this.jiraQuery = InputState.new({ placeholder: "buscar por texto o clave en Jira (KEY-123)…" });
|
|
163
|
+
this.jiraQuery.on("change", (_e, cx) => cx.notify());
|
|
164
|
+
this.jiraResults = null;
|
|
165
|
+
this.jiraSearching = false;
|
|
166
|
+
// «Asignadas a mí»: on, the list is your open issues and «Buscar» stays within them;
|
|
167
|
+
// off, it searches the whole site (and with no text lists its open issues).
|
|
168
|
+
this.jiraMine = true;
|
|
169
|
+
this.issueRepo = null;
|
|
170
|
+
this.repoQuery = InputState.new({ placeholder: "buscar repo en favoritos, recientes, GitHub y Azure Repos (o pega su URL)" });
|
|
171
|
+
this.repoQuery.on("change", (_e, cx) => cx.notify());
|
|
172
|
+
// P4: con un repo de GitHub completo (escrito o elegido con su issue) se mira si trae
|
|
173
|
+
// devcontainer; checkDevcontainer no repite la misma consulta.
|
|
174
|
+
for (const f of [this.fields.repo, this.fields.base]) {
|
|
175
|
+
f.on("change", (_e, cx) => this.checkDevcontainer(cx));
|
|
176
|
+
f.on("blur", (_e, cx) => this.checkDevcontainer(cx));
|
|
177
|
+
}
|
|
178
|
+
this.assignedPool = null;
|
|
179
|
+
this.poolLoading = false;
|
|
180
|
+
this.repoResults = [];
|
|
181
|
+
this.reposLoading = false;
|
|
182
|
+
this.reposError = null;
|
|
183
|
+
// Alta en tres bloques (Qué · Dónde · Quién; decisión 2026-11-24): la historia se ve y
|
|
184
|
+
// se edita; el repo se elige aparte de la issue, con favoritos, recientes, GitHub y Azure.
|
|
185
|
+
this.source = "github"; // github | jira | manual
|
|
186
|
+
this.choosing = true; // la lista de issues abierta (al elegir una se pliega)
|
|
187
|
+
this.story = TextareaState.new({ placeholder: "qué tiene que hacer el agente: lo lee como primer mensaje" });
|
|
188
|
+
this.story.set_rows(4);
|
|
189
|
+
this.repoSel = null; // { url, label, host, base? } del bloque Dónde
|
|
190
|
+
this.repoChoosing = true;
|
|
191
|
+
this.repoFilter = "todos"; // todos | recientes | github | azure
|
|
192
|
+
this.repoSuggest = null;
|
|
193
|
+
this.repoSuggestLoading = false;
|
|
194
|
+
this.repoSuggestErrors = {};
|
|
195
|
+
this.repoSuggestFor = null;
|
|
196
|
+
this.listRepos = []; // «Varios (hub)»: { url, label }
|
|
197
|
+
this.optionsOpen = false;
|
|
198
|
+
this.repoQuery.on("change", (_e, cx) => this.suggestReposSoon(cx));
|
|
199
|
+
this.loadPool(cx);
|
|
200
|
+
this.suggestRepos(cx, "");
|
|
116
201
|
this.fields.title.focus();
|
|
117
202
|
return;
|
|
118
203
|
}
|
|
@@ -151,6 +236,24 @@ export default class BondBoard extends View {
|
|
|
151
236
|
}
|
|
152
237
|
if (dirty) cx.notify();
|
|
153
238
|
});
|
|
239
|
+
this.checkSetup(cx);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// W-P2: first launch — GET /setup says the orchestrator is not configured and the
|
|
243
|
+
// wizard never finished, open the bond-settings wizard once per session. Everything
|
|
244
|
+
// the person does is stored in the orchestrator, so closing it with Esc loses nothing.
|
|
245
|
+
checkSetup(cx) {
|
|
246
|
+
cx.spawn(async () => {
|
|
247
|
+
if (wizardOffered) return;
|
|
248
|
+
try {
|
|
249
|
+
const state = await api("/setup");
|
|
250
|
+
if (!needsWizard(state)) return;
|
|
251
|
+
wizardOffered = true;
|
|
252
|
+
openOverlay(settingsOverlay({ view: "wizard", step: 1 }));
|
|
253
|
+
} catch {
|
|
254
|
+
// no API: the board already shows its own «sin conexión» card.
|
|
255
|
+
}
|
|
256
|
+
});
|
|
154
257
|
}
|
|
155
258
|
|
|
156
259
|
refresh(cx) {
|
|
@@ -190,6 +293,9 @@ export default class BondBoard extends View {
|
|
|
190
293
|
closeOverlay(p.overlay);
|
|
191
294
|
} catch (e) {
|
|
192
295
|
this.error = String(e?.message ?? e);
|
|
296
|
+
// Also as a toast: the dialog may be gone by the time the start fails.
|
|
297
|
+
notify({ title: "No se pudo lanzar el run", body: this.error, level: "error" });
|
|
298
|
+
setShared(REFRESH_KEY, Date.now());
|
|
193
299
|
this.busy = false;
|
|
194
300
|
cx.notify();
|
|
195
301
|
}
|
|
@@ -308,10 +414,29 @@ export default class BondBoard extends View {
|
|
|
308
414
|
if (this.busy) return;
|
|
309
415
|
const p = props();
|
|
310
416
|
const v = (k) => this.fields[k].value();
|
|
417
|
+
let modelVal = null;
|
|
418
|
+
if (this.agent === "pi") {
|
|
419
|
+
const models = Array.isArray(this.setup?.models) ? this.setup.models : [];
|
|
420
|
+
if (models.length > 0) {
|
|
421
|
+
modelVal = this.selectedModel || null;
|
|
422
|
+
} else {
|
|
423
|
+
modelVal = v("model") || null;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
// Dónde: the chosen repo (or the typed URL) and the chips of «Varios (hub)».
|
|
427
|
+
const repoUrl = this.repoSel?.url ?? v("repo");
|
|
428
|
+
const reposText = this.listRepos.map((r) => r.url).join("\n");
|
|
429
|
+
const storyText = String(this.story.value() ?? "");
|
|
311
430
|
const check = validateNewTicket({
|
|
312
|
-
title: v("title"), issue: v("issue"), mode: this.mode, repo:
|
|
313
|
-
base: v("base"), agent: this.agent, team_engine: this.team_engine, budget: v("budget"), timeout: v("timeout"),
|
|
314
|
-
|
|
431
|
+
title: v("title"), issue: v("issue"), mode: this.mode, repo: repoUrl, repos: reposText, hub: v("hub"),
|
|
432
|
+
base: v("base"), model: modelVal, agent: this.agent, team_engine: this.team_engine, budget: v("budget"), timeout: v("timeout"),
|
|
433
|
+
// Desmarcado con issue que trae cuerpo = story "" explícita (el agente arranca sin
|
|
434
|
+
// historia); sin issue o sin cuerpo = undefined (comportamiento heredado).
|
|
435
|
+
// The story is what the box holds: emptied on purpose with an issue = "" (the agent
|
|
436
|
+
// starts without it); nothing typed and no issue = undefined (legacy behaviour).
|
|
437
|
+
story: storyText.trim() ? storyText : this.pickedIssue ? "" : undefined,
|
|
438
|
+
bondify: this.bondify,
|
|
439
|
+
docker: this.docker,
|
|
315
440
|
});
|
|
316
441
|
this.errors = check.errors;
|
|
317
442
|
this.error = null;
|
|
@@ -347,6 +472,11 @@ export default class BondBoard extends View {
|
|
|
347
472
|
closeOverlay(props().overlay);
|
|
348
473
|
cx.stop_propagation();
|
|
349
474
|
}
|
|
475
|
+
// Enter en el panel de repos busca en GitHub sin salir del teclado.
|
|
476
|
+
if (e.key === "enter" && this.view === "create" && this.issuePanel === "repos") {
|
|
477
|
+
this.searchReposOn(cx);
|
|
478
|
+
cx.stop_propagation();
|
|
479
|
+
}
|
|
350
480
|
}
|
|
351
481
|
|
|
352
482
|
// ---- board actions ----
|
|
@@ -422,7 +552,7 @@ export default class BondBoard extends View {
|
|
|
422
552
|
}
|
|
423
553
|
|
|
424
554
|
openCreate() {
|
|
425
|
-
openOverlay(
|
|
555
|
+
openOverlay(createOverlay());
|
|
426
556
|
}
|
|
427
557
|
|
|
428
558
|
openPick(field, options) {
|
|
@@ -519,6 +649,16 @@ export default class BondBoard extends View {
|
|
|
519
649
|
}
|
|
520
650
|
|
|
521
651
|
selectCard(card, cx) {
|
|
652
|
+
// Un ticket Ready sin run no tiene sesión propia: no se salta a ninguna consola
|
|
653
|
+
// (antes caía en el espacio que estuviera seleccionado, que no era el suyo);
|
|
654
|
+
// el clic abre el lanzador, que es la acción de un Ready (D4).
|
|
655
|
+
if (!card.run) {
|
|
656
|
+
this.selectedCardId = card.id;
|
|
657
|
+
setShared(SELECTED_TICKET_KEY, card.id);
|
|
658
|
+
if (cx) cx.notify();
|
|
659
|
+
this.openLaunch(card);
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
522
662
|
this.selectedCardId = card.id;
|
|
523
663
|
setShared(SELECTED_RUN_KEY, card.run?.id ?? null);
|
|
524
664
|
setShared(SELECTED_TICKET_KEY, card.id);
|
|
@@ -542,6 +682,13 @@ export default class BondBoard extends View {
|
|
|
542
682
|
try {
|
|
543
683
|
run("space.select", { id: sp.id });
|
|
544
684
|
} catch {}
|
|
685
|
+
} else if (card.run?.hc_machine && ["running", "waiting", "verifying", "blocked", "analyzing"].includes(String(card.run.state))) {
|
|
686
|
+
// E1 (plan bond-app-pestanas-paneles): the run gets its own space on its machine,
|
|
687
|
+
// never a terminal.show over whatever tab was open. space.new brings a shell in the
|
|
688
|
+
// "bond-init" tab; bond-agents gives the orchestrator its own tab and closes that one.
|
|
689
|
+
try {
|
|
690
|
+
run("space.new", { machine: card.run.hc_machine, name: card.title || card.id, tab: "bond-init" });
|
|
691
|
+
} catch {}
|
|
545
692
|
} else if (card.terminal) {
|
|
546
693
|
try {
|
|
547
694
|
run("terminal.show", { terminal: card.terminal });
|
|
@@ -588,6 +735,9 @@ export default class BondBoard extends View {
|
|
|
588
735
|
|
|
589
736
|
const folder = card.hub ? "/workspace/hub" : "/workspace";
|
|
590
737
|
const tabName = "shell";
|
|
738
|
+
// Plan bond-app-ajustes-imagen P3: zsh (oh-my-zsh, grupo «shell» de la imagen) when the
|
|
739
|
+
// container has it, bash otherwise. Only this human shell: the agents keep bash.
|
|
740
|
+
const argv = SHELL_ARGV;
|
|
591
741
|
|
|
592
742
|
try {
|
|
593
743
|
const sp = this.spaceForCard(card);
|
|
@@ -596,6 +746,7 @@ export default class BondBoard extends View {
|
|
|
596
746
|
space: sp.id,
|
|
597
747
|
name: tabName,
|
|
598
748
|
folder,
|
|
749
|
+
argv,
|
|
599
750
|
});
|
|
600
751
|
} else {
|
|
601
752
|
run("space.new", {
|
|
@@ -603,6 +754,7 @@ export default class BondBoard extends View {
|
|
|
603
754
|
name: card.title || card.id,
|
|
604
755
|
tab: tabName,
|
|
605
756
|
folder,
|
|
757
|
+
argv,
|
|
606
758
|
});
|
|
607
759
|
}
|
|
608
760
|
} catch {
|
|
@@ -634,152 +786,114 @@ export default class BondBoard extends View {
|
|
|
634
786
|
|
|
635
787
|
card(card) {
|
|
636
788
|
const t = theme();
|
|
637
|
-
const
|
|
638
|
-
const money = card.run ? `$${(card.costUsd || 0).toFixed(2)}` : "$0.00";
|
|
639
|
-
const budget = `/$${(card.budgetUsd || 0).toFixed(2)}`;
|
|
640
|
-
const time = card.elapsed ? `⏱ ${card.elapsed}` : "";
|
|
789
|
+
const mono = (el) => el.font_family("JetBrains Mono");
|
|
641
790
|
const color = stateColor(t, card.column);
|
|
642
791
|
const isSelected = this.selectedCardId === card.id;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
const
|
|
648
|
-
const
|
|
792
|
+
// The state's color goes on the card's border for the columns that ask for attention
|
|
793
|
+
// (running, waiting, error); ready and finished stay neutral.
|
|
794
|
+
const attention = ["running", "waiting", "error"].includes(card.column) || card.status === "waiting";
|
|
795
|
+
const cardBorder = isSelected ? t.ring : (attention ? color : t.border);
|
|
796
|
+
const hovered = this.hoveredCard === card.id;
|
|
797
|
+
const action = this.primaryAction(card);
|
|
798
|
+
const chip = issueChip(card.issueUrl, card.repoKeys?.[0]);
|
|
799
|
+
const azure = /dev\.azure\.com|visualstudio\.com/.test(String(card.repoUrl ?? ""));
|
|
800
|
+
const hubLabel = card.hub ? String(card.hub.label || card.hub.url || "hub").replace(/^hub\s+/i, "") : "";
|
|
801
|
+
const hubRepos = card.hub ? cleanRepoChips(Array.isArray(card.hub.repos) ? card.hub.repos : [], hubLabel) : [];
|
|
802
|
+
const money = card.run ? `$${(card.costUsd || 0).toFixed(2)}` : "$0.00";
|
|
649
803
|
|
|
650
|
-
const body = v_flex().flex_1().min_w(0).p(8).gap(
|
|
651
|
-
//
|
|
652
|
-
.child(
|
|
653
|
-
|
|
654
|
-
.child(
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
)
|
|
668
|
-
.
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
)
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
))
|
|
692
|
-
)
|
|
693
|
-
)
|
|
694
|
-
)
|
|
695
|
-
)
|
|
696
|
-
.when(!card.hub && Boolean(card.repo), (el) =>
|
|
697
|
-
el.child(
|
|
698
|
-
h_flex().gap(4).items_center().font_family("JetBrains Mono").text_size(UI.text.small).truncate()
|
|
699
|
-
.child(div().text_color(t.dim).child("repo:"))
|
|
700
|
-
.child(div().text_color(t.muted).truncate().child(String(card.repo)))
|
|
701
|
-
)
|
|
702
|
-
)
|
|
703
|
-
// Agent & state
|
|
704
|
-
.child(dim(`${card.agent || "agente"} · ${card.agentState || "listo"}`))
|
|
705
|
-
// Metrics bar: Cost + Time
|
|
706
|
-
.child(
|
|
707
|
-
h_flex().items_center().justify_between().p(5).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border).font_family("JetBrains Mono").text_size(UI.text.small)
|
|
708
|
-
.child(
|
|
709
|
-
h_flex().gap(3).items_center()
|
|
710
|
-
.child(div().text_color(t.dim).child("Gasto:"))
|
|
711
|
-
.child(div().font_semibold().text_color(t.working).child(money))
|
|
712
|
-
.child(div().text_color(t.dim).text_size(UI.text.tiny).child(budget))
|
|
713
|
-
)
|
|
714
|
-
.when(Boolean(time), (el) =>
|
|
715
|
-
el.child(
|
|
716
|
-
div().text_color(t.bond_waiting ?? t.blocked).font_medium().child(String(time))
|
|
717
|
-
)
|
|
718
|
-
)
|
|
719
|
-
)
|
|
720
|
-
// Diagnostic box with motivo: and bond hub check:
|
|
804
|
+
const body = v_flex().flex_1().min_w(0).p(8).gap(5)
|
|
805
|
+
// 1. State, issue and, on hover, the state's main action; «⋯» always.
|
|
806
|
+
.child(h_flex().items_center().gap(4).min_w(0)
|
|
807
|
+
.child(mono(div().flex_none().px(6).py(1).rounded(UI.radius).bg(t.raised).border_1().border_color(color)
|
|
808
|
+
.text_size(UI.text.tiny).font_semibold().text_color(color)).child(spanishStateLabel(card.column, card.status)))
|
|
809
|
+
.when(Boolean(chip), (el) => el.child(mono(div().id(`card-issue-${card.id}`).flex_none().px(5).py(1).rounded(UI.radius)
|
|
810
|
+
.bg(t.raised).border_1().border_color(t.border).text_size(UI.text.tiny).text_color(markColor(t, chip.host)).cursor_pointer()
|
|
811
|
+
.hover((s) => s.bg(t.hover)).tooltip(`Abrir ${chip.url}`)
|
|
812
|
+
.on_mouse_down("left", (_e, cx) => cx.stop_propagation())
|
|
813
|
+
.on_click((_e, cx) => { cx.stop_propagation(); exec("xdg-open", [chip.url]).catch(() => {}); }))
|
|
814
|
+
.child(chip.label)))
|
|
815
|
+
.child(div().flex_1())
|
|
816
|
+
.when(hovered && Boolean(action), (el) => el.child(this.button(`card-act-${card.id}`, action[1], "primary", () => action[2](), true)))
|
|
817
|
+
.child(mono(div().id(`card-menu-btn-${card.id}`).flex_none().px(4).rounded(UI.radius)
|
|
818
|
+
.text_size(UI.text.small).text_color(t.muted).cursor_pointer()
|
|
819
|
+
.hover((s) => s.bg(t.hover).text_color(t.foreground))
|
|
820
|
+
.on_mouse_down("left", (_e, cx) => cx.stop_propagation())
|
|
821
|
+
.on_click((_e, cx) => { cx.stop_propagation(); this.openCardMenu(card); }))
|
|
822
|
+
.child("⋯")))
|
|
823
|
+
// 2. Title, two lines at most (the full one in its tooltip).
|
|
824
|
+
.child(div().id(`card-title-${card.id}`).max_h(36).overflow_hidden().tooltip(String(card.title || card.id || ""))
|
|
825
|
+
.text_size(UI.text.title).font_semibold().font_family(UI.fontSans).text_color(t.foreground)
|
|
826
|
+
.child(String(card.title || card.id || "")))
|
|
827
|
+
// 3. Where: host, repo (or hub and its repos) and branch.
|
|
828
|
+
.child(mono(h_flex().gap(5).items_center().min_w(0).text_size(UI.text.small))
|
|
829
|
+
.when(Boolean(card.hub), (el) => el
|
|
830
|
+
.child(div().flex_none().text_color(t.accent).child("⬡"))
|
|
831
|
+
.child(div().flex_none().max_w(140).truncate().text_color(t.muted).child(hubLabel))
|
|
832
|
+
.when(hubRepos.length > 0, (sub) => sub.child(div().flex_none().text_color(t.dim).child(`${hubRepos.length} repos`))))
|
|
833
|
+
.when(!card.hub && Boolean(card.repo), (el) => el
|
|
834
|
+
.child(div().flex_none().text_size(UI.text.tiny).text_color(markColor(t, azure ? "azure" : "github")).child(azure ? "AZ" : "GH"))
|
|
835
|
+
.child(div().flex_none().max_w(160).truncate().text_color(t.muted).child(String(card.repo))))
|
|
836
|
+
.when(Boolean(card.branch), (el) => el
|
|
837
|
+
.child(div().flex_none().text_color(t.dim).child("·"))
|
|
838
|
+
.child(div().flex_1().min_w(0).truncate().text_color(t.dim).child(String(card.branch)))))
|
|
839
|
+
// 4. Who and how long.
|
|
840
|
+
.child(mono(h_flex().gap(6).items_center().text_size(UI.text.small).text_color(t.dim))
|
|
841
|
+
.child(div().flex_1().min_w(0).truncate().child(`${card.agent || "agente"} · ${card.agentState || "listo"}`))
|
|
842
|
+
.when(CONFIG.costs, (el) => el.child(div().flex_none().text_color(t.working).child(money)))
|
|
843
|
+
.when(Boolean(card.elapsed), (el) => el.child(div().flex_none().text_color(t.muted).child(`⏱ ${card.elapsed}`))))
|
|
844
|
+
// Why it stopped, and a hub's check.
|
|
721
845
|
.when(Boolean(card.failureReason) || Boolean(card.hub && card.analysis), (el) =>
|
|
722
|
-
el.child(
|
|
723
|
-
|
|
724
|
-
.
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
)
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
h_flex().items_center().justify_between().gap(4)
|
|
737
|
-
.child(div().text_color(t.dim).child("bond hub check:"))
|
|
738
|
-
.child(div().font_medium().text_color(analysisColor).child(analysisLabel))
|
|
739
|
-
);
|
|
740
|
-
})
|
|
741
|
-
)
|
|
742
|
-
)
|
|
743
|
-
.when(Boolean(card.story), (el) => el.child(div().text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.muted).truncate().child(`historia: ${String(card.story)}`)))
|
|
744
|
-
.when(Boolean(card.issueUrl) && !card.story, (el) => el.child(dim(`issue: ${String(card.issueUrl).split("/").slice(-3).join("/")}`)))
|
|
745
|
-
.children((card.deliveries || []).filter((d) => d.prUrl).map((d) => div().text_size(UI.text.small).font_family("JetBrains Mono").truncate()
|
|
746
|
-
.text_color(d.status === "failed" ? t.blocked : t.accent)
|
|
747
|
-
.child(String(`${d.name}: PR #${d.prNumber} · ${d.prUrl}`))))
|
|
846
|
+
el.child(mono(v_flex().p(6).rounded(UI.radius).bg(t.popover).border_1().border_color(t.border).gap(3).text_size(UI.text.tiny))
|
|
847
|
+
.when(Boolean(card.failureReason), (sub) => sub.child(h_flex().items_center().gap(4)
|
|
848
|
+
.child(div().font_semibold().text_color(color).flex_none().child("motivo:"))
|
|
849
|
+
.child(div().text_color(t.foreground).truncate().child(String(card.failureReason)))))
|
|
850
|
+
.when(Boolean(card.hub), (sub) => {
|
|
851
|
+
const ready = !card.analysis || card.analysis.status === "ready" || card.analysis.status === "ok" || (card.analysis.fixable === 0 && !card.hubBlocked);
|
|
852
|
+
return sub.child(h_flex().items_center().justify_between().gap(4)
|
|
853
|
+
.child(div().text_color(t.dim).child("bond hub check:"))
|
|
854
|
+
.child(div().font_medium().text_color(ready ? t.working : stateColor(t, "waiting"))
|
|
855
|
+
.child(ready ? "análisis: listo" : (card.analysis?.fixable ? `${card.analysis.fixable} arreglos pendientes` : "análisis: revisión"))));
|
|
856
|
+
})))
|
|
857
|
+
.children((card.deliveries || []).filter((d) => d.prUrl).map((d) => mono(div().text_size(UI.text.small).truncate()
|
|
858
|
+
.text_color(d.status === "failed" ? t.blocked : t.accent)).child(String(`${d.name}: PR #${d.prNumber}`))))
|
|
859
|
+
.when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) => el.child(mono(div().text_size(UI.text.small).text_color(t.accent).truncate()).child(`PR #${card.prNumber}`)))
|
|
748
860
|
.when(card.verifyFailures > 0 && card.status !== "pr_ready" && card.status !== "finished",
|
|
749
|
-
(el) => el.child(dim(`verificación fallida ${card.verifyFailures} ${card.verifyFailures === 1 ? "vez" : "veces"}`)))
|
|
750
|
-
.when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) => el.child(div().text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.accent).truncate().child(String(`PR #${card.prNumber} · ${card.prUrl}`))))
|
|
751
|
-
// Footer
|
|
752
|
-
.child(
|
|
753
|
-
div().pt(2).text_size(UI.text.tiny).font_family(UI.fontSans).text_color(t.dim).text_right().child("Haz clic para abrir sesión y consola")
|
|
754
|
-
);
|
|
861
|
+
(el) => el.child(mono(div().text_size(UI.text.small).text_color(t.dim)).child(`verificación fallida ${card.verifyFailures} ${card.verifyFailures === 1 ? "vez" : "veces"}`)));
|
|
755
862
|
|
|
756
863
|
return h_flex().id(`card-${card.id}`).flex_none().items_stretch().rounded(UI.radiusLg).overflow_hidden()
|
|
757
864
|
.bg(isSelected ? t.selected : t.surface)
|
|
758
865
|
.border_1().border_color(cardBorder)
|
|
759
866
|
.cursor_pointer().hover((s) => s.bg(t.hover))
|
|
867
|
+
.tooltip(card.run ? "Abrir la sesión" : "Lanzar el ticket")
|
|
868
|
+
.on_hover((h, cx) => {
|
|
869
|
+
const next = h ? card.id : (this.hoveredCard === card.id ? null : this.hoveredCard);
|
|
870
|
+
if (next !== this.hoveredCard) { this.hoveredCard = next; cx.notify(); }
|
|
871
|
+
})
|
|
760
872
|
.on_click((_e, cx) => this.selectCard(card, cx))
|
|
761
873
|
.on_mouse_down("right", (_e, cx) => {
|
|
762
874
|
cx.stop_propagation();
|
|
763
875
|
this.openCardMenu(card);
|
|
764
876
|
})
|
|
765
|
-
.child(div().w(3).flex_none().bg(color))
|
|
766
877
|
.child(body);
|
|
767
878
|
}
|
|
768
879
|
|
|
769
|
-
// An empty column placeholder matching design
|
|
880
|
+
// An empty column placeholder matching design (only «Listos» on a board with no ticket)
|
|
770
881
|
emptyColumnPlaceholder(colId) {
|
|
771
882
|
const t = theme();
|
|
772
883
|
const conf = {
|
|
773
|
-
ready: { icon: "📋", title: "Sin tareas pendientes", subtitle: "Crea
|
|
884
|
+
ready: { icon: "📋", title: "Sin tareas pendientes", subtitle: "Crea uno con «+ Nuevo ticket»" },
|
|
774
885
|
running: { icon: "⚡", title: "Ningún run en proceso", subtitle: null },
|
|
775
886
|
waiting: { icon: "⏳", title: "Sin tareas en espera", subtitle: null },
|
|
776
887
|
finished: { icon: "✓", title: "Ninguna tarea finalizada hoy", subtitle: null },
|
|
777
888
|
error: { icon: "⚠️", title: "Sin errores reportados", subtitle: null },
|
|
778
889
|
};
|
|
779
890
|
const c = conf[colId] ?? { icon: "▫", title: "Columna vacía", subtitle: null };
|
|
891
|
+
// Same height in every column, with or without a subtitle (content centered).
|
|
780
892
|
return v_flex()
|
|
781
893
|
.w_full()
|
|
782
|
-
.
|
|
894
|
+
.h(EMPTY_COLUMN_H)
|
|
895
|
+
.flex_none()
|
|
896
|
+
.px(12)
|
|
783
897
|
.gap(4)
|
|
784
898
|
.items_center()
|
|
785
899
|
.justify_center()
|
|
@@ -796,198 +910,142 @@ export default class BondBoard extends View {
|
|
|
796
910
|
);
|
|
797
911
|
}
|
|
798
912
|
|
|
799
|
-
column
|
|
913
|
+
/** One column. All of them share the board's width evenly; an empty one shows a short line
|
|
914
|
+
* under its header (the full hint only in «Listos» while the board has no ticket). With a
|
|
915
|
+
* column chosen in the title bar's counters it is the only one, its cards in a grid, and its
|
|
916
|
+
* header offers going back to every column. */
|
|
917
|
+
column(col, only = null) {
|
|
800
918
|
const t = theme();
|
|
801
919
|
const color = stateColor(t, col.id);
|
|
802
920
|
const count = col.cards.length;
|
|
803
|
-
const
|
|
804
|
-
const colBorder =
|
|
805
|
-
|
|
921
|
+
const alone = only === col.id;
|
|
922
|
+
const colBorder = t.border;
|
|
923
|
+
const header = h_flex().items_center().justify_between().gap(6).p(4).border_b(1).border_color(colBorder)
|
|
924
|
+
.child(h_flex().items_center().gap(6).min_w(0)
|
|
925
|
+
.child(div().size(8).rounded(4).flex_none().bg(count > 0 ? color : t.dim))
|
|
926
|
+
.child(div().truncate().text_size(UI.text.small).font_bold().font_family(UI.fontSans).text_color(count > 0 ? color : t.muted).child(col.label.toUpperCase())))
|
|
927
|
+
.child(h_flex().items_center().gap(6).flex_none()
|
|
928
|
+
.when(alone, (el) => el.child(div().id("col-show-all").px(6).py(1).rounded(UI.radius).cursor_pointer()
|
|
929
|
+
.text_size(UI.text.tiny).text_color(t.muted).hover((st) => st.bg(t.hover).text_color(t.foreground))
|
|
930
|
+
.on_click((_e, cx) => { setShared(FILTER_KEY, { ...(shared(FILTER_KEY) ?? {}), column: null }); cx.notify(); })
|
|
931
|
+
.child("Ver todas las columnas")))
|
|
932
|
+
.child(div().px(7).py(1).rounded(12).bg(t.raised).border_1().border_color(count > 0 ? color : t.border)
|
|
933
|
+
.text_size(UI.text.tiny).font_family("JetBrains Mono").font_semibold().text_color(count > 0 ? color : t.dim).child(String(count))));
|
|
934
|
+
const empty = count === 0 && (col.id !== "ready" || this.boardHasCards)
|
|
935
|
+
? div().w_full().py(14).text_center().text_size(UI.text.small).font_family(UI.fontSans).text_color(t.dim).child(EMPTY_LINE[col.id] ?? "Vacía")
|
|
936
|
+
: this.emptyColumnPlaceholder(col.id);
|
|
937
|
+
return v_flex().id(`col-${col.id}`).flex_1().min_w(0).h_full().gap(6).p(8).bg(t.chrome).rounded(UI.radiusLg)
|
|
806
938
|
.border_1().border_color(colBorder)
|
|
807
939
|
.overflow_y_scrollbar()
|
|
808
|
-
.child(
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
940
|
+
.child(header)
|
|
941
|
+
.when(count === 0, (el) => el.child(empty))
|
|
942
|
+
.when(alone && count > 0, (el) => el.child(h_flex().w_full().flex_wrap().gap(8).items_start()
|
|
943
|
+
.children(col.cards.map((c) => div().w(UI.columnWidth + 70).flex_none().child(this.card(c))))))
|
|
944
|
+
.when(!alone, (el) => el.children(col.cards.map((c) => this.card(c))));
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/** The main action of a card's state, shown as the one primary button of the session
|
|
948
|
+
* header (the rest goes to its «⋯» menu): [id, label, action] or null. */
|
|
949
|
+
primaryAction(card) {
|
|
950
|
+
if (card.canNudge) return ["nudge", "Desbloquear…", () => this.openNudge(card)];
|
|
951
|
+
if (card.canApprove) return ["approve", "Aprobar…", () => this.openApprove(card)];
|
|
952
|
+
if (card.canDeliver) return ["deliver", "Entregar…", () => this.openDeliver(card)];
|
|
953
|
+
if (card.canLaunch) return ["launch", "Lanzar…", () => this.openLaunch(card)];
|
|
954
|
+
return null;
|
|
822
955
|
}
|
|
823
956
|
|
|
957
|
+
/** Session header (one line, 2026-11-23): back · state + title + short branch · Shell, the
|
|
958
|
+
* state's main action and «⋯» (Terminado, PR, copy docker exec, Cancelar, Borrar). The
|
|
959
|
+
* title's tooltip carries the full title, repo and branch. */
|
|
824
960
|
renderSessionBar(card) {
|
|
825
961
|
const t = theme();
|
|
826
962
|
const colColor = stateColor(t, card.column);
|
|
963
|
+
const primary = this.primaryAction(card);
|
|
964
|
+
const repo = card.hub
|
|
965
|
+
? String(card.hub.label || card.hub.url || "hub").replace(/^hub\s+/i, "")
|
|
966
|
+
: String(card.repo || "");
|
|
967
|
+
const tip = [String(card.title || card.id), repo && `repo: ${repo}`, card.branch && `rama: ${card.branch}`].filter(Boolean).join("\n");
|
|
968
|
+
const iconBtn = (id, label, tooltip, action) => div().id(id).flex_none().size(26).rounded(UI.radius)
|
|
969
|
+
.flex().items_center().justify_center().text_size(UI.text.body).text_color(t.muted).cursor_pointer()
|
|
970
|
+
.hover((st) => st.bg(t.hover).text_color(t.foreground)).tooltip(tooltip)
|
|
971
|
+
.on_mouse_down("left", (_e, cx) => cx.stop_propagation())
|
|
972
|
+
.on_click((_e, cx) => { cx.stop_propagation(); action(cx); })
|
|
973
|
+
.child(label);
|
|
827
974
|
return h_flex()
|
|
828
975
|
.id("bond-session-bar")
|
|
829
976
|
.size_full()
|
|
830
|
-
.
|
|
977
|
+
.min_w(0)
|
|
978
|
+
.px(8)
|
|
831
979
|
.gap(8)
|
|
832
980
|
.items_center()
|
|
833
981
|
.bg(t.chrome)
|
|
834
982
|
.border_b(1)
|
|
835
983
|
.border_color(t.border)
|
|
836
984
|
.text_color(t.foreground)
|
|
985
|
+
.child(iconBtn("btn-back-to-kanban", "←", "Volver al kanban", (cx) => this.backToKanban(cx)))
|
|
986
|
+
.child(div().w(1).h(16).flex_none().bg(t.border))
|
|
987
|
+
// State, title and short branch: the only part that shrinks
|
|
988
|
+
.child(h_flex().flex_1().min_w(0).items_center().gap(8)
|
|
989
|
+
.child(div().flex_none().font_family("JetBrains Mono").text_size(UI.text.tiny).font_semibold().text_color(colColor)
|
|
990
|
+
.child(spanishStateLabel(card.column, card.status)))
|
|
991
|
+
.child(div().id(`session-title-${card.id}`).flex_1().min_w(0).truncate().tooltip(tip)
|
|
992
|
+
.font_semibold().text_size(UI.text.body).font_family(UI.fontSans).text_color(t.foreground)
|
|
993
|
+
.child(String(card.title || card.id)))
|
|
994
|
+
.when(Boolean(card.branch), (el) => el.child(h_flex().flex_none().max_w(180).items_center().gap(4).text_color(t.dim)
|
|
995
|
+
.child(svg("mods/bond-board/branch.svg").size(12).flex_none())
|
|
996
|
+
.child(div().min_w(0).truncate().font_family("JetBrains Mono").text_size(UI.text.tiny).child(String(card.branch).replace(/^feat\//, "")))))
|
|
997
|
+
)
|
|
998
|
+
// Actions: Shell, the state's main action, «⋯»
|
|
999
|
+
.child(h_flex().flex_none().items_center().gap(6)
|
|
1000
|
+
.when(Boolean(card.canShell), (el) => el.child(this.button(`session-shell-${card.id}`, "Shell", "plain", (cx) => this.openContainerShell(card, cx), true)))
|
|
1001
|
+
.when(Boolean(primary), (el) => el.child(this.button(`session-${primary[0]}-${card.id}`, primary[1], "primary", () => primary[2](), true)))
|
|
1002
|
+
.child(iconBtn(`session-more-${card.id}`, "⋯", "Más acciones", () => openOverlay({
|
|
1003
|
+
mod: "bond-board", kind: "popup", width: 220,
|
|
1004
|
+
props: { view: "card-menu", cardId: card.id, card, session: true },
|
|
1005
|
+
}))));
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// El orquestador nunca respondió: tarjeta centrada que explica cómo arreglarlo y permite
|
|
1009
|
+
// reintentar ya; el error crudo queda pequeño y tenue, para revisar (decisión 2026-11-19).
|
|
1010
|
+
renderApiDown() {
|
|
1011
|
+
const t = theme();
|
|
1012
|
+
return v_flex()
|
|
1013
|
+
.id("bond-api-down")
|
|
1014
|
+
.size_full()
|
|
1015
|
+
.items_center()
|
|
1016
|
+
.justify_center()
|
|
1017
|
+
.p(10)
|
|
1018
|
+
.bg(t.canvas)
|
|
1019
|
+
.text_color(t.foreground)
|
|
837
1020
|
.font_family("JetBrains Mono")
|
|
838
1021
|
.child(
|
|
839
|
-
|
|
840
|
-
.
|
|
841
|
-
.
|
|
842
|
-
.
|
|
843
|
-
.gap(
|
|
1022
|
+
v_flex()
|
|
1023
|
+
.w(520)
|
|
1024
|
+
.max_w_full()
|
|
1025
|
+
.p(24)
|
|
1026
|
+
.gap(8)
|
|
844
1027
|
.items_center()
|
|
845
|
-
.rounded(UI.
|
|
846
|
-
.bg(t.
|
|
1028
|
+
.rounded(UI.radiusLg)
|
|
1029
|
+
.bg(t.chrome)
|
|
847
1030
|
.border_1()
|
|
848
1031
|
.border_color(t.border)
|
|
849
|
-
.text_size(
|
|
850
|
-
.
|
|
851
|
-
.
|
|
852
|
-
|
|
853
|
-
.
|
|
854
|
-
.
|
|
855
|
-
.
|
|
856
|
-
.child("← Volver al kanban")
|
|
857
|
-
)
|
|
858
|
-
.child(div().w(1).h(16).bg(t.border))
|
|
859
|
-
.child(
|
|
860
|
-
h_flex()
|
|
861
|
-
.gap(6)
|
|
862
|
-
.items_center()
|
|
863
|
-
.child(div().size(7).rounded(4).bg(colColor))
|
|
864
|
-
.child(
|
|
865
|
-
div()
|
|
866
|
-
.font_semibold()
|
|
867
|
-
.text_size(UI.text.body)
|
|
868
|
-
.font_family(UI.fontSans)
|
|
869
|
-
.text_color(t.foreground)
|
|
870
|
-
.truncate()
|
|
871
|
-
.child(String(card.title || card.id))
|
|
872
|
-
)
|
|
873
|
-
)
|
|
874
|
-
.when(Boolean(card.branch), (el) =>
|
|
875
|
-
el.child(
|
|
876
|
-
div()
|
|
877
|
-
.px(5)
|
|
878
|
-
.py(1)
|
|
879
|
-
.rounded(UI.radius)
|
|
880
|
-
.bg(t.raised)
|
|
881
|
-
.border_1()
|
|
882
|
-
.border_color(t.border)
|
|
883
|
-
.text_size(UI.text.tiny)
|
|
884
|
-
.font_family("JetBrains Mono")
|
|
885
|
-
.text_color(t.muted)
|
|
886
|
-
.truncate()
|
|
887
|
-
.child(String(card.branch))
|
|
888
|
-
)
|
|
889
|
-
)
|
|
890
|
-
.when(Boolean(card.repo), (el) => {
|
|
891
|
-
let repoText = "";
|
|
892
|
-
if (card.hub) {
|
|
893
|
-
const raw = (card.hub && Array.isArray(card.hub.repos)) ? card.hub.repos : [];
|
|
894
|
-
const rawLabel = String(card.hub.label || card.hub.url || (typeof card.hub === "string" ? card.hub : "hub"));
|
|
895
|
-
const chips = cleanRepoChips(raw, rawLabel);
|
|
896
|
-
repoText = chips.length > 0 ? `· repos: ${chips.join(", ")}` : `· hub: ${rawLabel.replace(/^hub\s+/i, "")}`;
|
|
897
|
-
} else {
|
|
898
|
-
repoText = `· repo: ${String(card.repo)}`;
|
|
899
|
-
}
|
|
900
|
-
return el.child(
|
|
901
|
-
div()
|
|
902
|
-
.text_size(UI.text.small)
|
|
903
|
-
.font_family("JetBrains Mono")
|
|
904
|
-
.text_color(t.dim)
|
|
905
|
-
.truncate()
|
|
906
|
-
.child(repoText)
|
|
907
|
-
);
|
|
908
|
-
})
|
|
909
|
-
// Copyable docker exec command pill (D23)
|
|
910
|
-
.when(Boolean(card.containerCommand), (el) =>
|
|
911
|
-
el.child(
|
|
912
|
-
h_flex()
|
|
913
|
-
.id(`session-docker-cmd-${card.id}`)
|
|
914
|
-
.items_center()
|
|
915
|
-
.gap(5)
|
|
916
|
-
.px(6)
|
|
917
|
-
.h(24)
|
|
918
|
-
.rounded(UI.radius)
|
|
919
|
-
.bg(t.raised)
|
|
920
|
-
.border_1()
|
|
921
|
-
.border_color(t.border)
|
|
922
|
-
.cursor_pointer()
|
|
923
|
-
.hover((s) => s.bg(t.hover))
|
|
924
|
-
.on_click((_e, cx) => {
|
|
925
|
-
cx.stop_propagation();
|
|
926
|
-
this.copyToClipboard(String(card.containerCommand), cx);
|
|
927
|
-
})
|
|
928
|
-
.child(
|
|
929
|
-
div()
|
|
930
|
-
.font_family("JetBrains Mono")
|
|
931
|
-
.text_size(UI.text.tiny)
|
|
932
|
-
.text_color(t.muted)
|
|
933
|
-
.truncate()
|
|
934
|
-
.child(String(card.containerCommand))
|
|
935
|
-
)
|
|
936
|
-
.child(
|
|
937
|
-
div()
|
|
938
|
-
.text_size(UI.text.tiny)
|
|
939
|
-
.text_color(t.dim)
|
|
940
|
-
.flex_none()
|
|
941
|
-
.child("📋")
|
|
942
|
-
)
|
|
943
|
-
)
|
|
944
|
-
)
|
|
945
|
-
.child(div().flex_1())
|
|
946
|
-
// Action buttons in session bar
|
|
947
|
-
.when(Boolean(card.canShell), (el) =>
|
|
948
|
-
el.child(this.button(`session-shell-${card.id}`, "Shell del contenedor", "plain", (cx) => this.openContainerShell(card, cx), true))
|
|
949
|
-
)
|
|
950
|
-
.when(Boolean(card.canLaunch), (el) =>
|
|
951
|
-
el.child(this.button(`session-launch-${card.id}`, "Lanzar…", "primary", () => this.openLaunch(card), true))
|
|
952
|
-
)
|
|
953
|
-
.when(Boolean(card.canDeliver), (el) =>
|
|
954
|
-
el.child(this.button(`session-deliver-${card.id}`, "Entregar…", "primary", () => this.openDeliver(card), true))
|
|
955
|
-
)
|
|
956
|
-
.when(Boolean(card.canNudge), (el) =>
|
|
957
|
-
el.child(this.button(`session-nudge-${card.id}`, "Desbloquear…", "primary", () => this.openNudge(card), true))
|
|
958
|
-
)
|
|
959
|
-
.when(Boolean(card.canFinish), (el) =>
|
|
960
|
-
el.child(this.button(`session-finish-${card.id}`, "Terminado…", "plain", () => this.openFinish(card), true))
|
|
961
|
-
)
|
|
962
|
-
.when(Boolean(card.canApprove), (el) =>
|
|
963
|
-
el.child(this.button(`session-approve-${card.id}`, "Aprobar…", "primary", () => this.openApprove(card), true))
|
|
964
|
-
)
|
|
965
|
-
.when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) =>
|
|
966
|
-
el.child(this.button(`session-pr-${card.id}`, "Abrir PR", "plain", () => this.openPr(card), true))
|
|
967
|
-
)
|
|
968
|
-
.children((card.deliveries || []).filter((d) => d.prUrl).map((d) =>
|
|
969
|
-
this.button(`session-pr-${card.id}-${d.name}`, `PR ${d.name}`, "plain", () => this.openPr({ ...card, prUrl: d.prUrl, prNumber: d.prNumber }), true)))
|
|
970
|
-
.when(Boolean(card.canCancel), (el) =>
|
|
971
|
-
el.child(this.button(`session-cancel-${card.id}`, "Cancelar…", "danger", () => this.openCancel(card), true))
|
|
972
|
-
)
|
|
973
|
-
.child(this.button(`session-delete-${card.id}`, "Borrar…", "danger", () => this.openDelete(card), true))
|
|
974
|
-
// State chip
|
|
975
|
-
.child(
|
|
976
|
-
div()
|
|
977
|
-
.px(6)
|
|
978
|
-
.py(2)
|
|
979
|
-
.rounded(UI.radius)
|
|
980
|
-
.bg(t.raised)
|
|
981
|
-
.border_1()
|
|
982
|
-
.border_color(colColor)
|
|
983
|
-
.text_size(UI.text.tiny)
|
|
984
|
-
.font_family("JetBrains Mono")
|
|
985
|
-
.font_semibold()
|
|
986
|
-
.text_color(colColor)
|
|
987
|
-
.child(spanishStateLabel(card.column, card.status))
|
|
1032
|
+
.child(div().text_size(26).child("🔌"))
|
|
1033
|
+
.child(div().text_size(UI.text.title + 2).font_semibold().child("Sin conexión con el orquestador"))
|
|
1034
|
+
.child(div().text_size(UI.text.small).text_center().text_color(t.muted)
|
|
1035
|
+
.child(`El tablero necesita la API local en ${apiUrl()}. Arranca «bond-app start» en una terminal.`))
|
|
1036
|
+
.child(div().text_size(UI.text.tiny).text_color(t.dim).child("Se reintenta cada 3 segundos; al responder, el tablero solo se refresca."))
|
|
1037
|
+
.child(this.button("btn-api-retry", "Reintentar", "primary", (cx) => this.refresh(cx)))
|
|
1038
|
+
.child(div().pt(6).text_size(UI.text.tiny).text_center().text_color(t.dim).child(String(this.apiError ?? "")))
|
|
988
1039
|
);
|
|
989
1040
|
}
|
|
990
1041
|
|
|
1042
|
+
// Primer refresco en vuelo: nada de kanbanes falsos con ceros.
|
|
1043
|
+
renderLoading() {
|
|
1044
|
+
const t = theme();
|
|
1045
|
+
return v_flex().id("bond-loading").size_full().items_center().justify_center().bg(t.canvas)
|
|
1046
|
+
.child(div().font_family("JetBrains Mono").text_size(UI.text.small).text_color(t.dim).child("Cargando el tablero…"));
|
|
1047
|
+
}
|
|
1048
|
+
|
|
991
1049
|
renderBoard() {
|
|
992
1050
|
const t = theme();
|
|
993
1051
|
const cards = buildCards(this.tickets, this.runs, this.agentStatus);
|
|
@@ -1000,12 +1058,18 @@ export default class BondBoard extends View {
|
|
|
1000
1058
|
totalCost += c.costUsd || 0;
|
|
1001
1059
|
totalBudget += c.budgetUsd || 0;
|
|
1002
1060
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1061
|
+
// Las estadísticas solo se publican con carga real: sin ellas la barra de título
|
|
1062
|
+
// muestra «—» en vez de mentir con ceros (decisión 2026-11-19).
|
|
1063
|
+
if (this.loaded) {
|
|
1064
|
+
setShared("bond.board_stats", {
|
|
1065
|
+
total: cards.length,
|
|
1066
|
+
counts,
|
|
1067
|
+
cost: totalCost,
|
|
1068
|
+
budget: totalBudget,
|
|
1069
|
+
});
|
|
1070
|
+
} else {
|
|
1071
|
+
setShared("bond.board_stats", null);
|
|
1072
|
+
}
|
|
1009
1073
|
|
|
1010
1074
|
if (this.boardMode === "session" && this.selectedCardId) {
|
|
1011
1075
|
const activeCard = cards.find((c) => c.id === this.selectedCardId);
|
|
@@ -1022,14 +1086,27 @@ export default class BondBoard extends View {
|
|
|
1022
1086
|
? filter.text
|
|
1023
1087
|
: (inputSearch.length > 0 ? inputSearch : (sharedSearch ? String(sharedSearch) : ""));
|
|
1024
1088
|
const searchVal = activeSearch.trim();
|
|
1089
|
+
// El primer refresco no ha completado: no se finge un tablero vacio, se dice lo que pasa
|
|
1090
|
+
// (decisión 2026-11-19).
|
|
1091
|
+
if (!this.loaded) {
|
|
1092
|
+
return this.apiError ? this.renderApiDown() : this.renderLoading();
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1025
1095
|
const shown = filterCards(cards, { repo: filter.repo, agent: filter.agent, text: searchVal });
|
|
1026
|
-
|
|
1096
|
+
// A column chosen in the title bar's counters is shown alone; «Con error» goes away
|
|
1097
|
+
// while it has nothing.
|
|
1098
|
+
const only = COLUMNS.some((c) => c.id === filter.column) ? filter.column : null;
|
|
1099
|
+
this.boardHasCards = shown.length > 0;
|
|
1100
|
+
const columns = groupByColumn(shown)
|
|
1101
|
+
.filter((col) => (only ? col.id === only : (col.id !== "error" || col.cards.length > 0)));
|
|
1027
1102
|
|
|
1028
1103
|
return v_flex().id("bond-board").size_full().p(10).gap(8).bg(t.canvas).text_color(t.foreground)
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
.
|
|
1104
|
+
// La API cae tras haber cargado: se conserva el último kanban; el aviso no lleva el crudo.
|
|
1105
|
+
.when(Boolean(this.apiError), (el) => el.child(div().px(10).py(6).rounded(UI.radius).bg(t.raised).border_1().border_color(t.blocked)
|
|
1106
|
+
.text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.blocked)
|
|
1107
|
+
.child(`Sin respuesta del orquestador (${apiUrl()}); se reintenta cada 3 s`)))
|
|
1108
|
+
.child(h_flex().id("bond-columns").w_full().min_w(0).flex_1().min_h(0).gap(8).items_stretch()
|
|
1109
|
+
.children(columns.map((col) => this.column(col, only))));
|
|
1033
1110
|
}
|
|
1034
1111
|
|
|
1035
1112
|
renderDialog(title, body, actions) {
|
|
@@ -1058,54 +1135,662 @@ export default class BondBoard extends View {
|
|
|
1058
1135
|
return h_flex().id(id).flex_none().h(24).px(9).items_center().rounded(UI.radius).border_1()
|
|
1059
1136
|
.border_color(on ? t.accent : t.input).bg(on ? t.selected : t.surface)
|
|
1060
1137
|
.text_size(12).text_color(on ? t.foreground : t.muted).cursor_pointer()
|
|
1061
|
-
.hover((s) => s.bg(t.hover)).on_click((_e, cx) => { action(); cx.notify(); })
|
|
1138
|
+
.hover((s) => s.bg(t.hover)).on_click((_e, cx) => { action(cx); cx.notify(); })
|
|
1062
1139
|
.child(label);
|
|
1063
1140
|
}
|
|
1064
1141
|
|
|
1065
|
-
|
|
1142
|
+
// Plan bond-app-nuevo-ticket (P2): búsqueda combinada en el diálogo. Paso 1: repos —
|
|
1143
|
+
// los de tus issues asignadas, y búsqueda por nombre en GitHub (buscar + Buscar/Enter).
|
|
1144
|
+
// Paso 2: issues abiertas del repo elegido (ready primero, luego las tuyas).
|
|
1145
|
+
ghErrorText(e) {
|
|
1146
|
+
const msg = String(e?.message ?? e);
|
|
1147
|
+
if (this.issueProvider === "jira") {
|
|
1148
|
+
return msg === "jira_not_configured"
|
|
1149
|
+
? "No hay credencial de Jira: conéctala en Ajustes (sección Jira) y reintenta."
|
|
1150
|
+
: msg === "jira_authentication_failed"
|
|
1151
|
+
? "Credencial de Jira inválida: revísala en Ajustes (sección Jira)."
|
|
1152
|
+
: msg === "jira_api_error" || msg.startsWith("HTTP")
|
|
1153
|
+
? "Jira Cloud no responde ahora mismo; reintenta."
|
|
1154
|
+
: msg;
|
|
1155
|
+
}
|
|
1156
|
+
return msg === "github_not_configured"
|
|
1157
|
+
? "No hay sesión de GitHub: conéctala en Ajustes («Usar mi sesión de gh») y reintenta."
|
|
1158
|
+
: msg === "github_api_error" || msg.startsWith("HTTP")
|
|
1159
|
+
? "GitHub no responde ahora mismo; reintenta."
|
|
1160
|
+
: msg;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
searchIssues(cx) {
|
|
1164
|
+
if (this.issueProvider === "jira") {
|
|
1165
|
+
this.issuePanel = "jira";
|
|
1166
|
+
this.loadPool(cx);
|
|
1167
|
+
// Sin consulta se muestran las asignadas: los resultados de una búsqueda anterior
|
|
1168
|
+
// taparían el refresco de assignedPool (la panel prioriza jiraResults).
|
|
1169
|
+
if (String(this.jiraQuery.value() ?? "").trim() || !this.jiraMine) this.searchJiraOn(cx);
|
|
1170
|
+
else { this.jiraResults = null; cx.notify(); }
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
this.issuePanel = "repos";
|
|
1174
|
+
this.loadPool(cx);
|
|
1175
|
+
if (String(this.repoQuery.value() ?? "").trim()) this.searchReposOn(cx);
|
|
1176
|
+
else cx.notify();
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
loadPool(cx) {
|
|
1180
|
+
if (this.assignedPool || this.poolLoading) { cx.notify(); return; }
|
|
1181
|
+
this.poolLoading = true;
|
|
1182
|
+
this.reposError = null;
|
|
1183
|
+
cx.notify();
|
|
1184
|
+
cx.spawn(async (cx) => {
|
|
1185
|
+
try {
|
|
1186
|
+
const data = await listAssignedIssues(api, this.issueProvider);
|
|
1187
|
+
this.assignedPool = Array.isArray(data?.issues) ? data.issues : [];
|
|
1188
|
+
} catch (e) {
|
|
1189
|
+
this.reposError = this.ghErrorText(e);
|
|
1190
|
+
} finally {
|
|
1191
|
+
this.poolLoading = false;
|
|
1192
|
+
cx.notify();
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/** «Asignadas a mí» on/off: back to your list, or the site's search with the same text. */
|
|
1198
|
+
toggleJiraMine(cx) {
|
|
1199
|
+
this.jiraMine = !this.jiraMine;
|
|
1200
|
+
this.jiraResults = null;
|
|
1201
|
+
const term = String(this.jiraQuery.value() ?? "").trim();
|
|
1202
|
+
if (term || !this.jiraMine) this.searchJiraOn(cx);
|
|
1203
|
+
else { this.loadPool(cx); cx.notify(); }
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
searchJiraOn(cx) {
|
|
1207
|
+
const term = String(this.jiraQuery.value() ?? "").trim();
|
|
1208
|
+
if ((!term && this.jiraMine) || this.jiraSearching) return;
|
|
1209
|
+
this.jiraSearching = true;
|
|
1210
|
+
this.reposError = null;
|
|
1211
|
+
cx.notify();
|
|
1212
|
+
cx.spawn(async (cx) => {
|
|
1213
|
+
try {
|
|
1214
|
+
const data = await searchJiraIssues(api, { q: term, mine: this.jiraMine });
|
|
1215
|
+
this.jiraResults = Array.isArray(data?.issues) ? data.issues : [];
|
|
1216
|
+
} catch (e) {
|
|
1217
|
+
this.reposError = this.ghErrorText(e);
|
|
1218
|
+
} finally {
|
|
1219
|
+
this.jiraSearching = false;
|
|
1220
|
+
cx.notify();
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
searchReposOn(cx) {
|
|
1226
|
+
const term = String(this.repoQuery.value() ?? "").trim();
|
|
1227
|
+
if (!term || this.reposLoading) return;
|
|
1228
|
+
this.reposLoading = true;
|
|
1229
|
+
this.reposError = null;
|
|
1230
|
+
cx.notify();
|
|
1231
|
+
cx.spawn(async (cx) => {
|
|
1232
|
+
try {
|
|
1233
|
+
const data = await searchRepos(api, term);
|
|
1234
|
+
this.repoResults = (Array.isArray(data?.repos) ? data.repos : []).map((r) => ({ key: String(r.full_name) }));
|
|
1235
|
+
} catch (e) {
|
|
1236
|
+
this.reposError = this.ghErrorText(e);
|
|
1237
|
+
} finally {
|
|
1238
|
+
this.reposLoading = false;
|
|
1239
|
+
cx.notify();
|
|
1240
|
+
}
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
pickRepo(key, cx) {
|
|
1245
|
+
this.issueRepo = key;
|
|
1246
|
+
this.issuePanel = "issues";
|
|
1247
|
+
this.issues = null;
|
|
1248
|
+
this.issuesLoading = true;
|
|
1249
|
+
this.issuesError = null;
|
|
1250
|
+
cx.notify();
|
|
1251
|
+
const [owner, repo] = String(key).split("/");
|
|
1252
|
+
cx.spawn(async (cx) => {
|
|
1253
|
+
try {
|
|
1254
|
+
const data = await listRepoIssues(api, owner, repo);
|
|
1255
|
+
this.issues = Array.isArray(data?.issues) ? data.issues : [];
|
|
1256
|
+
} catch (e) {
|
|
1257
|
+
this.issuesError = this.ghErrorText(e);
|
|
1258
|
+
} finally {
|
|
1259
|
+
this.issuesLoading = false;
|
|
1260
|
+
cx.notify();
|
|
1261
|
+
}
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
// Check del alta: el cuerpo de la issue viaja como historia del ticket (primer mensaje
|
|
1266
|
+
// del agente). Sin esto el agente arranca sin la US.
|
|
1267
|
+
issueBodyRow() {
|
|
1268
|
+
const t = theme();
|
|
1269
|
+
const bodyText = String(this.pickedIssue?.body ?? "").trim();
|
|
1270
|
+
if (!bodyText) return null;
|
|
1271
|
+
return h_flex()
|
|
1272
|
+
.id("iss-carry-body")
|
|
1273
|
+
.gap(7)
|
|
1274
|
+
.items_center()
|
|
1275
|
+
.px(2)
|
|
1276
|
+
.py(3)
|
|
1277
|
+
.cursor_pointer()
|
|
1278
|
+
.text_color(t.foreground)
|
|
1279
|
+
.font_family(UI.fontSans)
|
|
1280
|
+
.text_size(UI.text.small)
|
|
1281
|
+
.on_click((_e, cx) => {
|
|
1282
|
+
this.carryBody = !this.carryBody;
|
|
1283
|
+
cx.notify();
|
|
1284
|
+
})
|
|
1285
|
+
.child(
|
|
1286
|
+
div()
|
|
1287
|
+
.w(13).h(13).rounded(3).border_1()
|
|
1288
|
+
.border_color(this.carryBody ? t.accent : t.border)
|
|
1289
|
+
.bg(this.carryBody ? t.accent : t.input)
|
|
1290
|
+
.child(div().text_size(10).text_center().text_color(t.chrome).child(this.carryBody ? "✓" : ""))
|
|
1291
|
+
)
|
|
1292
|
+
.child(`Llevar el cuerpo de la issue a la historia (${bodyText.length} caracteres). Sin marcar, el agente arranca sin la US.`);
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
// P4 (D-U): bondificar automáticamente el repo si no tiene .bond/bond.toml
|
|
1296
|
+
bondifyRow() {
|
|
1297
|
+
const t = theme();
|
|
1298
|
+
return h_flex()
|
|
1299
|
+
.id("ticket-bondify")
|
|
1300
|
+
.gap(7)
|
|
1301
|
+
.items_center()
|
|
1302
|
+
.px(2)
|
|
1303
|
+
.py(3)
|
|
1304
|
+
.cursor_pointer()
|
|
1305
|
+
.text_color(t.foreground)
|
|
1306
|
+
.font_family(UI.fontSans)
|
|
1307
|
+
.text_size(UI.text.small)
|
|
1308
|
+
.on_click((_e, cx) => {
|
|
1309
|
+
this.bondify = !this.bondify;
|
|
1310
|
+
cx.notify();
|
|
1311
|
+
})
|
|
1312
|
+
.child(
|
|
1313
|
+
div()
|
|
1314
|
+
.w(13).h(13).rounded(3).border_1()
|
|
1315
|
+
.border_color(this.bondify ? t.accent : t.border)
|
|
1316
|
+
.bg(this.bondify ? t.accent : t.input)
|
|
1317
|
+
.child(div().text_size(10).text_center().text_color(t.chrome).child(this.bondify ? "✓" : ""))
|
|
1318
|
+
)
|
|
1319
|
+
.child("Bondificar el repo si no lo está (bond init + commit propio)");
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
// P4: «Docker en el run». Avisa del riesgo (contenedor privilegiado) en la propia casilla.
|
|
1323
|
+
dockerRow() {
|
|
1324
|
+
const t = theme();
|
|
1325
|
+
return v_flex().gap(2)
|
|
1326
|
+
.child(h_flex()
|
|
1327
|
+
.id("ticket-docker")
|
|
1328
|
+
.gap(7).items_center().px(2).py(3).cursor_pointer()
|
|
1329
|
+
.text_color(t.foreground).font_family(UI.fontSans).text_size(UI.text.small)
|
|
1330
|
+
.on_click((_e, cx) => {
|
|
1331
|
+
this.docker = !this.docker;
|
|
1332
|
+
this.dockerTouched = true;
|
|
1333
|
+
cx.notify();
|
|
1334
|
+
})
|
|
1335
|
+
.child(div().w(13).h(13).rounded(3).border_1()
|
|
1336
|
+
.border_color(this.docker ? t.accent : t.border)
|
|
1337
|
+
.bg(this.docker ? t.accent : t.input)
|
|
1338
|
+
.child(div().text_size(10).text_center().text_color(t.chrome).child(this.docker ? "✓" : "")))
|
|
1339
|
+
.child("Docker en el run (devcontainers, compose…)")
|
|
1340
|
+
.when(Boolean(this.devcontainerRepo), (el) => el.child(div().id("ticket-docker-devcontainer").text_size(UI.text.tiny).text_color(t.accent).child("el repo trae devcontainer"))))
|
|
1341
|
+
.when(this.docker, (el) => el.child(div().pl(22).text_size(UI.text.tiny).font_family(UI.fontSans).text_color(t.dim)
|
|
1342
|
+
.child("El contenedor del run va privilegiado: un agente podría tomar este equipo (en Windows y Mac, la VM de Docker Desktop). La imagen necesita el grupo «Docker en el run».")));
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
/** P4: asks the orchestrator whether the repo carries a devcontainer; pre-ticks Docker. */
|
|
1346
|
+
checkDevcontainer(cx) {
|
|
1347
|
+
const m = /github\.com[/:]([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+?)(?:\.git)?\/?$/.exec(String(this.fields.repo.value() ?? "").trim());
|
|
1348
|
+
if (!m || this.mode === "list") return;
|
|
1349
|
+
const base = String(this.fields.base?.value?.() ?? "").trim();
|
|
1350
|
+
const key = `${m[1]}/${m[2]}@${base}`;
|
|
1351
|
+
if (key === this.devcontainerChecked) return;
|
|
1352
|
+
this.devcontainerChecked = key;
|
|
1353
|
+
cx.spawn(async (cx) => {
|
|
1354
|
+
try {
|
|
1355
|
+
const q = `owner=${encodeURIComponent(m[1])}&repo=${encodeURIComponent(m[2])}${base ? `&ref=${encodeURIComponent(base)}` : ""}`;
|
|
1356
|
+
const res = await api(`/repos/devcontainer?${q}`);
|
|
1357
|
+
if (key !== this.devcontainerChecked) return;
|
|
1358
|
+
this.devcontainerRepo = res?.devcontainer ? `${m[1]}/${m[2]}` : null;
|
|
1359
|
+
if (res?.devcontainer && !this.dockerTouched) this.docker = true;
|
|
1360
|
+
this.hubDetected = res?.hub ? (this.repoSel?.url ?? String(this.fields.repo.value() ?? "").trim()) : null;
|
|
1361
|
+
this.applyHubMode();
|
|
1362
|
+
cx.notify();
|
|
1363
|
+
} catch {}
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/** Hub detectado (y no tratado como repo): modo hub con ese repo; si no, un repo. */
|
|
1368
|
+
applyHubMode() {
|
|
1369
|
+
if (this.mode === "list") return;
|
|
1370
|
+
const url = this.repoSel?.url ?? String(this.fields.repo.value() ?? "").trim();
|
|
1371
|
+
const hub = Boolean(this.hubDetected) && this.hubDetected === url && !this.hubAsRepo;
|
|
1372
|
+
this.mode = hub ? "hub" : "repo";
|
|
1373
|
+
this.fields.hub.set_value(hub ? url : "");
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
pickIssue(it, cx) {
|
|
1377
|
+
this.pickedIssue = it;
|
|
1378
|
+
this.issuePanel = null;
|
|
1379
|
+
this.fields.issue.set_value(it.url ?? "");
|
|
1380
|
+
const title = it.title || it.summary || "";
|
|
1381
|
+
if (title) this.fields.title.set_value(title); // D4: automático y editable
|
|
1382
|
+
const desc = it.description || it.body || "";
|
|
1383
|
+
if (it.key) {
|
|
1384
|
+
this.pickedIssue.body = title + (desc ? `\n\n${desc}` : "");
|
|
1385
|
+
}
|
|
1386
|
+
// Qué: the story box gets the issue's text (editable); the list folds to this issue.
|
|
1387
|
+
this.story.set_value(String(this.pickedIssue.body ?? desc ?? ""));
|
|
1388
|
+
this.choosing = false;
|
|
1389
|
+
// Dónde: a GitHub issue only preloads its repo, and only when none is chosen yet.
|
|
1390
|
+
if (it.owner && it.repo && !this.repoSel) {
|
|
1391
|
+
this.selectRepo({ url: `https://github.com/${it.owner}/${it.repo}`, label: `${it.owner}/${it.repo}`, host: "github" });
|
|
1392
|
+
if (cx) this.checkDevcontainer(cx);
|
|
1393
|
+
}
|
|
1394
|
+
this.errors = {};
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
// ---- Alta en tres bloques: Dónde (repos) ---------------------------------------------
|
|
1398
|
+
|
|
1399
|
+
/** Asks the orchestrator for repos (favorites, recent, Azure, GitHub) for the query. */
|
|
1400
|
+
suggestRepos(cx, q) {
|
|
1401
|
+
this.repoSuggestFor = q;
|
|
1402
|
+
this.repoSuggestLoading = true;
|
|
1403
|
+
cx.notify();
|
|
1404
|
+
cx.spawn(async (cx) => {
|
|
1405
|
+
try {
|
|
1406
|
+
const res = await api(`/repos/suggest?q=${encodeURIComponent(q)}`);
|
|
1407
|
+
if (this.repoSuggestFor !== q) return;
|
|
1408
|
+
this.repoSuggest = Array.isArray(res?.repos) ? res.repos : [];
|
|
1409
|
+
this.repoSuggestErrors = res?.errors ?? {};
|
|
1410
|
+
} catch (e) {
|
|
1411
|
+
this.repoSuggestErrors = { api: String(e?.message ?? e) };
|
|
1412
|
+
}
|
|
1413
|
+
this.repoSuggestLoading = false;
|
|
1414
|
+
cx.notify();
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/** On typing: the shown list filters at once; the search (GitHub) waits a little. */
|
|
1419
|
+
suggestReposSoon(cx) {
|
|
1420
|
+
const asked = String(this.repoQuery.value() ?? "").trim();
|
|
1421
|
+
cx.notify();
|
|
1422
|
+
if (asked === this.repoSuggestFor) return;
|
|
1423
|
+
cx.spawn(async (cx) => {
|
|
1424
|
+
await cx.sleep(350);
|
|
1425
|
+
if (String(this.repoQuery.value() ?? "").trim() !== asked) return;
|
|
1426
|
+
this.suggestRepos(cx, asked);
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
selectRepo(r) {
|
|
1431
|
+
if (this.mode === "list") {
|
|
1432
|
+
if (r.host !== "github") {
|
|
1433
|
+
this.errors = { ...this.errors, repos: "Un hub solo admite repos de GitHub" };
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
if (!this.listRepos.some((x) => x.url === r.url)) this.listRepos = [...this.listRepos, { url: r.url, label: r.label }];
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
this.repoSel = r;
|
|
1440
|
+
this.repoChoosing = false;
|
|
1441
|
+
// Otro repo: su detección empieza de cero (checkDevcontainer la repite).
|
|
1442
|
+
this.hubDetected = null;
|
|
1443
|
+
this.hubAsRepo = false;
|
|
1444
|
+
this.devcontainerChecked = null;
|
|
1445
|
+
this.devcontainerRepo = null;
|
|
1446
|
+
this.applyHubMode();
|
|
1447
|
+
this.fields.repo.set_value(r.url);
|
|
1448
|
+
if (r.base) this.fields.base.set_value(r.base);
|
|
1449
|
+
this.errors = { ...this.errors, repo: undefined };
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
/** ★: adds or removes the repo from the favorites (Ajustes keeps the list too). */
|
|
1453
|
+
toggleFavorite(cx, r) {
|
|
1454
|
+
const current = (this.repoSuggest ?? []).filter((x) => x.favorite).map((x) => x.url);
|
|
1455
|
+
const next = r.favorite ? current.filter((u) => u !== r.url) : [...current, r.url];
|
|
1456
|
+
cx.spawn(async (cx) => {
|
|
1457
|
+
try {
|
|
1458
|
+
await api("/repos/favorites", { method: "PUT", body: { favorites: next } });
|
|
1459
|
+
this.suggestRepos(cx, String(this.repoQuery.value() ?? "").trim());
|
|
1460
|
+
} catch (e) {
|
|
1461
|
+
this.error = String(e?.message ?? e);
|
|
1462
|
+
cx.notify();
|
|
1463
|
+
}
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
useIssueUrl() {
|
|
1468
|
+
const url = String(this.fields.issue.value() ?? "").trim();
|
|
1469
|
+
if (!url) {
|
|
1470
|
+
this.errors = { ...this.errors, issue: "Pega antes la URL de la issue" };
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
this.pickedIssue = { url, title: "", manual: true };
|
|
1474
|
+
this.issuePanel = null;
|
|
1475
|
+
this.errors = {};
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
clearIssue() {
|
|
1479
|
+
this.pickedIssue = null;
|
|
1480
|
+
this.fields.issue.set_value("");
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
// Repos con issues tuyas abiertas (pool asignado), ready primero; base del paso 1.
|
|
1484
|
+
issueRepoGroups() {
|
|
1485
|
+
const map = new Map();
|
|
1486
|
+
for (const it of this.assignedPool ?? []) {
|
|
1487
|
+
const key = `${it.owner}/${it.repo}`;
|
|
1488
|
+
const g = map.get(key) ?? { key, n: 0, ready: 0 };
|
|
1489
|
+
g.n += 1;
|
|
1490
|
+
if (it.ready) g.ready += 1;
|
|
1491
|
+
map.set(key, g);
|
|
1492
|
+
}
|
|
1493
|
+
return [...map.values()].sort((a, b) => b.ready - a.ready || b.n - a.n || a.key.localeCompare(b.key));
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
// Los de tus issues asignadas primero; debajo, los golpes de la búsqueda en GitHub.
|
|
1497
|
+
issueRepoChoices() {
|
|
1498
|
+
const local = this.issueRepoGroups();
|
|
1499
|
+
const seen = new Set(local.map((g) => g.key));
|
|
1500
|
+
const remote = (this.repoResults ?? [])
|
|
1501
|
+
.filter((r) => r.key.includes("/") && !seen.has(r.key))
|
|
1502
|
+
.map((r) => ({ key: r.key, n: 0, ready: 0, remote: true }));
|
|
1503
|
+
return [...local, ...remote];
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
repoRow(g) {
|
|
1507
|
+
const t = theme();
|
|
1508
|
+
return h_flex().id(`iss-repo-${g.key.replace("/", "-")}`).h(26).px(8).gap(6).items_center()
|
|
1509
|
+
.rounded(UI.radius).text_size(12).font_family("JetBrains Mono").cursor_pointer()
|
|
1510
|
+
.text_color(t.foreground).hover((s) => s.bg(t.hover))
|
|
1511
|
+
.on_click((_e, cx) => this.pickRepo(g.key, cx))
|
|
1512
|
+
.child(div().flex_1().truncate().child(g.key))
|
|
1513
|
+
.when(Boolean(g.remote), (el) => el.child(div().text_size(UI.text.tiny).text_color(t.dim).child("GitHub")))
|
|
1514
|
+
.when(!g.remote && g.ready > 0, (el) => el.child(div().text_size(UI.text.tiny).text_color(t.accent).child(`ready ${g.ready}`)))
|
|
1515
|
+
.when(!g.remote, (el) => el.child(div().text_size(UI.text.tiny).text_color(t.dim).child(`${g.n} ${g.n === 1 ? "issue" : "issues"}`)));
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
issueRow(it) {
|
|
1519
|
+
const t = theme();
|
|
1520
|
+
const id = it.key ? `iss-row-${it.key}` : `iss-row-${it.owner}-${it.repo}-${it.number}`;
|
|
1521
|
+
const label = it.key ?? `#${it.number}`;
|
|
1522
|
+
return h_flex().id(id).h(26).px(8).gap(6).items_center()
|
|
1523
|
+
.rounded(UI.radius).text_size(12).font_family("JetBrains Mono").cursor_pointer()
|
|
1524
|
+
.text_color(t.foreground).hover((s) => s.bg(t.hover))
|
|
1525
|
+
.on_click((_e, cx) => { this.pickIssue(it, cx); cx.notify(); })
|
|
1526
|
+
.child(div().w(12).text_center().text_color(it.ready ? t.accent : t.dim).child(it.ready ? "✓" : (it.key ? "●" : "#")))
|
|
1527
|
+
.child(div().w(it.key ? 75 : 46).text_color(t.dim).child(label))
|
|
1528
|
+
.child(div().flex_1().truncate().child(String(it.title ?? it.summary ?? "")))
|
|
1529
|
+
.when(Boolean(it.ready), (el) => el.child(div().text_size(UI.text.tiny).text_color(t.accent).child("ready")));
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
renderModelSelector(models) {
|
|
1533
|
+
const defaultLabel = this.setup?.default_model
|
|
1534
|
+
? `(por defecto — ${this.setup.default_model})`
|
|
1535
|
+
: "(por defecto)";
|
|
1536
|
+
const isDefault = !this.selectedModel;
|
|
1537
|
+
return h_flex().id("model-selector").gap(6).flex_wrap()
|
|
1538
|
+
.child(this.choice("model-choice-default", defaultLabel, isDefault, () => {
|
|
1539
|
+
this.selectedModel = null;
|
|
1540
|
+
}))
|
|
1541
|
+
.children(models.map((m) => {
|
|
1542
|
+
const on = this.selectedModel === m;
|
|
1543
|
+
return this.choice(`model-choice-${slug(m)}`, m, on, () => {
|
|
1544
|
+
this.selectedModel = m;
|
|
1545
|
+
});
|
|
1546
|
+
}));
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
// ---- Alta en tres bloques (Qué · Dónde · Quién; decisión 2026-11-24) -----------------
|
|
1550
|
+
|
|
1551
|
+
createBlock(n, title, hint, children, error) {
|
|
1552
|
+
const t = theme();
|
|
1553
|
+
return v_flex().id(`create-block-${n}`).gap(8).px(14).py(11).rounded(UI.radiusLg).border_1()
|
|
1554
|
+
.border_color(error ? t.blocked : t.border).bg(t.background)
|
|
1555
|
+
.child(h_flex().gap(10).items_center()
|
|
1556
|
+
.child(div().w(22).h(22).rounded(11).bg(t.accent).flex().items_center().justify_center()
|
|
1557
|
+
.text_size(11).font_semibold().text_color(t.accent_foreground ?? t.background).child(String(n)))
|
|
1558
|
+
.child(div().text_size(UI.text.title + 1).font_family(UI.fontSans).font_semibold().child(title))
|
|
1559
|
+
.child(div().flex_1())
|
|
1560
|
+
.when(Boolean(hint), (el) => el.child(div().text_size(UI.text.small).font_family(UI.fontSans).text_color(t.dim).child(hint))))
|
|
1561
|
+
.children(children)
|
|
1562
|
+
.when(Boolean(error), (el) => el.child(div().text_size(UI.text.small).text_color(t.blocked).child(error)));
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
hostBadge(host) {
|
|
1566
|
+
const t = theme();
|
|
1567
|
+
const azure = host === "azure";
|
|
1568
|
+
return div().flex_none().px(6).h(18).rounded(4).flex().items_center()
|
|
1569
|
+
.bg(azure ? "#0078d422" : "#8b5cf622").text_size(10).font_semibold()
|
|
1570
|
+
.text_color(markColor(t, azure ? "azure" : "github")).child(azure ? "Azure" : "GitHub");
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
/** One issue of the «Qué» list (GitHub #n or Jira KEY), clickable. */
|
|
1574
|
+
createIssueRow(it, picked = false) {
|
|
1575
|
+
const t = theme();
|
|
1576
|
+
const label = it.key ?? (it.number ? `#${it.number}` : "URL");
|
|
1577
|
+
const where = it.key ? (it.project ?? "") : (it.owner && it.repo ? `${it.owner}/${it.repo}` : "");
|
|
1578
|
+
return h_flex().id(it.key ? `iss-row-${it.key}` : `iss-row-${it.owner}-${it.repo}-${it.number}`)
|
|
1579
|
+
.h(30).px(8).gap(10).items_center().rounded(UI.radius).cursor_pointer().min_w(0)
|
|
1580
|
+
.bg(picked ? t.selected : t.background).border_1().border_color(picked ? t.accent : t.background)
|
|
1581
|
+
.hover((s) => s.bg(t.hover)).on_click((_e, cx) => { this.pickIssue(it, cx); cx.notify(); })
|
|
1582
|
+
.child(div().w(it.key ? 72 : 50).flex_none().text_size(12).font_semibold().text_color(t.accent).child(label))
|
|
1583
|
+
.child(div().flex_1().min_w(0).truncate().text_size(12.5).font_family(UI.fontSans).child(String(it.title ?? it.summary ?? it.url ?? "")))
|
|
1584
|
+
.when(Boolean(where), (el) => el.child(div().flex_none().text_size(UI.text.small).text_color(t.dim).child(where)))
|
|
1585
|
+
.when(Boolean(it.status), (el) => el.child(div().flex_none().px(6).h(18).rounded(4).flex().items_center().border_1().border_color(t.border)
|
|
1586
|
+
.text_size(10).text_color(t.muted).child(String(it.status))))
|
|
1587
|
+
.when(Boolean(it.ready), (el) => el.child(div().flex_none().text_size(UI.text.tiny).text_color(t.accent).child("ready")));
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
/** One repo of the «Dónde» list: ★ toggles the favorite, the row picks it. */
|
|
1591
|
+
createRepoRow(r, picked = false) {
|
|
1592
|
+
const t = theme();
|
|
1593
|
+
return h_flex().id(`repo-row-${slug(r.url)}`).h(30).px(8).gap(10).items_center().rounded(UI.radius).cursor_pointer().min_w(0)
|
|
1594
|
+
.bg(picked ? t.selected : t.background).border_1().border_color(picked ? t.accent : t.background)
|
|
1595
|
+
.hover((s) => s.bg(t.hover)).on_click((_e, cx) => { this.selectRepo(r); this.checkDevcontainer(cx); cx.notify(); })
|
|
1596
|
+
.child(div().id(`repo-fav-${slug(r.url)}`).w(16).flex_none().text_size(13).cursor_pointer()
|
|
1597
|
+
.text_color(r.favorite ? markColor(t, "star") : t.dim).tooltip(r.favorite ? "Quitar de favoritos" : "Añadir a favoritos")
|
|
1598
|
+
.on_click((_e, cx) => { cx.stop_propagation(); this.toggleFavorite(cx, r); })
|
|
1599
|
+
.child(r.favorite ? "★" : r.recent ? "↺" : "☆"))
|
|
1600
|
+
.child(this.hostBadge(r.host))
|
|
1601
|
+
.child(div().flex_1().min_w(0).truncate().text_size(12.5).child(String(r.label ?? r.url)))
|
|
1602
|
+
.when(Boolean(r.base), (el) => el.child(div().flex_none().text_size(UI.text.small).text_color(t.dim).child(r.base)));
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
createWhat() {
|
|
1606
|
+
const t = theme();
|
|
1607
|
+
const lq = (s) => String(s ?? "").trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
1608
|
+
const has = (text, words) => words.every((w) => String(text).toLowerCase().includes(w));
|
|
1609
|
+
const src = (id, label) => this.choice(`src-${id}`, label, this.source === id, () => {
|
|
1610
|
+
if (this.source === id) return;
|
|
1611
|
+
this.source = id;
|
|
1612
|
+
this.issueProvider = id === "jira" ? "jira" : "github";
|
|
1613
|
+
resetIssueProviderState(this);
|
|
1614
|
+
this.choosing = true;
|
|
1615
|
+
this.pickedIssue = null;
|
|
1616
|
+
this.fields.issue.set_value("");
|
|
1617
|
+
});
|
|
1618
|
+
const rows = [h_flex().gap(6).child(src("github", "GitHub")).child(src("jira", "Jira")).child(src("manual", "Escribirla yo"))];
|
|
1619
|
+
if (this.source !== "manual") {
|
|
1620
|
+
if (this.pickedIssue && !this.choosing) {
|
|
1621
|
+
rows.push(h_flex().gap(8).items_center()
|
|
1622
|
+
.child(div().flex_1().min_w(0).child(this.createIssueRow(this.pickedIssue, true)))
|
|
1623
|
+
.child(this.button("iss-change", "Cambiar", "plain", () => { this.choosing = true; })));
|
|
1624
|
+
} else {
|
|
1625
|
+
const jira = this.source === "jira";
|
|
1626
|
+
const q = String((jira ? this.jiraQuery : this.issueQuery).value() ?? "").trim();
|
|
1627
|
+
const words = lq(q);
|
|
1628
|
+
const repoKey = !jira && /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(q) ? q : null;
|
|
1629
|
+
const looksUrl = /^https:\/\//.test(q);
|
|
1630
|
+
let list = jira ? (this.jiraResults ?? this.assignedPool ?? []) : (this.issuePanel === "issues" ? (this.issues ?? []) : (this.assignedPool ?? []));
|
|
1631
|
+
if (!(jira && this.jiraResults) && !repoKey && !looksUrl) list = list.filter((it) => has(`${it.key ?? `#${it.number}`} ${it.title ?? it.summary ?? ""} ${it.owner ?? ""}/${it.repo ?? ""}`, words));
|
|
1632
|
+
const loading = this.poolLoading || this.jiraSearching || this.issuesLoading;
|
|
1633
|
+
rows.push(h_flex().gap(6).items_center()
|
|
1634
|
+
.child(div().flex_1().child(Input.new(jira ? this.jiraQuery : this.issueQuery).h(28).px(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12)))
|
|
1635
|
+
.when(jira, (el) => el
|
|
1636
|
+
.child(this.choice("iss-jira-mine", this.jiraMine ? "✓ Asignadas a mí" : "Asignadas a mí", this.jiraMine, (cx) => this.toggleJiraMine(cx)))
|
|
1637
|
+
.child(this.button("iss-jira-go", this.jiraSearching ? "Buscando…" : "Buscar", "plain", (cx) => this.searchJiraOn(cx))))
|
|
1638
|
+
.when(Boolean(repoKey), (el) => el.child(this.button("iss-repo-go", `Issues de ${repoKey}`, "plain", (cx) => this.pickRepo(repoKey, cx))))
|
|
1639
|
+
.when(looksUrl, (el) => el.child(this.button("iss-use-url", "Usar URL", "plain", () => { this.fields.issue.set_value(q); this.useIssueUrl(); this.choosing = false; }))));
|
|
1640
|
+
rows.push(v_flex().id("iss-list").max_h(150).overflow_y_scrollbar().gap(1)
|
|
1641
|
+
.when(loading, (el) => el.child(div().px(6).py(3).text_size(UI.text.small).text_color(t.dim).child(jira ? "Buscando en Jira…" : "Buscando en GitHub…")))
|
|
1642
|
+
.when(Boolean(this.reposError || this.issuesError), (el) => el.child(h_flex().gap(8).items_center()
|
|
1643
|
+
.child(div().flex_1().text_size(UI.text.small).text_color(t.blocked).child(String(this.reposError || this.issuesError)))
|
|
1644
|
+
.child(this.button("iss-open-settings", "Abrir Ajustes", "plain", () => openOverlay(settingsOverlay({ section: jira ? "jira" : "github" }))))))
|
|
1645
|
+
.when(!loading && !this.reposError && list.length === 0, (el) => el.child(div().px(6).py(3).text_size(UI.text.small).text_color(t.dim)
|
|
1646
|
+
.child(jira ? (this.jiraMine ? "Sin issues asignadas a ti: busca por texto o clave (VEL-123), o quita «Asignadas a mí»" : "Sin issues: busca por texto o clave (VEL-123)") : "Sin issues asignadas: escribe owner/repo o pega la URL de una issue")))
|
|
1647
|
+
.children(list.slice(0, 40).map((it) => this.createIssueRow(it))));
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
const e = this.errors ?? {};
|
|
1651
|
+
rows.push(h_flex().gap(10).items_start()
|
|
1652
|
+
.child(v_flex().flex_1().gap(3).child(div().text_size(UI.text.small).font_medium().text_color(t.muted).child("Título"))
|
|
1653
|
+
.child(Input.new(this.fields.title).h(30).px(9).rounded(UI.radius).border_1().border_color(e.title ? t.blocked : t.input).bg(t.background).text_size(12.5))
|
|
1654
|
+
.when(Boolean(e.title), (el) => el.child(div().text_size(UI.text.small).text_color(t.blocked).child(e.title)))));
|
|
1655
|
+
rows.push(v_flex().gap(3)
|
|
1656
|
+
.child(h_flex().items_center()
|
|
1657
|
+
.child(div().flex_1().text_size(UI.text.small).font_medium().text_color(t.muted).child("Historia (lo que lee el agente; editable)"))
|
|
1658
|
+
.child(div().text_size(UI.text.small).text_color(t.dim).child(this.pickedIssue ? `desde ${this.pickedIssue.key ?? (this.pickedIssue.number ? `#${this.pickedIssue.number}` : "la issue")}` : "escrita a mano")))
|
|
1659
|
+
.child(Textarea.new(this.story).h(80).p(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12)));
|
|
1660
|
+
return this.createBlock(1, "Qué", "de dónde sale la historia", rows, e.issue);
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
createWhere() {
|
|
1664
|
+
const t = theme();
|
|
1665
|
+
const e = this.errors ?? {};
|
|
1666
|
+
// Un repo o un hub: se elige igual; si trae hub.toml, el alta lo detecta y pasa a modo hub.
|
|
1667
|
+
const rows = [];
|
|
1668
|
+
{
|
|
1669
|
+
if (this.mode === "list" && this.listRepos.length) {
|
|
1670
|
+
rows.push(h_flex().gap(6).flex_wrap().children(this.listRepos.map((r) => h_flex().id(`list-chip-${slug(r.url)}`).h(24).pl(8).pr(4).gap(6).items_center()
|
|
1671
|
+
.rounded(UI.radius).bg(t.selected).border_1().border_color(t.accent).text_size(12)
|
|
1672
|
+
.child(r.label)
|
|
1673
|
+
.child(div().id(`list-chip-x-${slug(r.url)}`).px(3).cursor_pointer().text_color(t.dim).on_click((_e, cx) => { this.listRepos = this.listRepos.filter((x) => x.url !== r.url); cx.notify(); }).child("✕")))));
|
|
1674
|
+
}
|
|
1675
|
+
if (this.mode !== "list" && this.repoSel && !this.repoChoosing) {
|
|
1676
|
+
const fav = (this.repoSuggest ?? []).find((x) => x.url === this.repoSel.url);
|
|
1677
|
+
rows.push(h_flex().gap(8).items_center()
|
|
1678
|
+
.child(div().flex_1().min_w(0).child(this.createRepoRow({ ...this.repoSel, favorite: Boolean(fav?.favorite), recent: Boolean(fav?.recent) }, true)))
|
|
1679
|
+
.child(this.button("repo-change", "Cambiar", "plain", () => { this.repoChoosing = true; })));
|
|
1680
|
+
if (this.hubDetected && this.hubDetected === this.repoSel.url) {
|
|
1681
|
+
const asHub = this.mode === "hub";
|
|
1682
|
+
rows.push(h_flex().id("repo-hub-detected").gap(10).items_center().px(10).py(7).rounded(UI.radius)
|
|
1683
|
+
.bg(asHub ? t.selected : t.raised).border_1().border_color(asHub ? t.accent : t.border)
|
|
1684
|
+
.child(v_flex().flex_1().min_w(0).gap(2)
|
|
1685
|
+
.child(div().text_size(12).font_semibold().text_color(asHub ? t.accent : t.foreground).child(asHub ? "⬡ Tipo hub detectado" : "⬡ Hub detectado, tratado como repo normal"))
|
|
1686
|
+
.child(div().text_size(UI.text.small).text_color(t.dim).child(asHub
|
|
1687
|
+
? "Trae hub.toml: el ticket trabaja en los repos del hub, un agente por repo (motor en «Opciones»)."
|
|
1688
|
+
: "Trae hub.toml, pero el ticket trabaja solo en este repo.")))
|
|
1689
|
+
.child(this.choice("repo-hub-toggle", asHub ? "Tratarlo como repo normal" : "Usarlo como hub", false, () => {
|
|
1690
|
+
this.hubAsRepo = asHub;
|
|
1691
|
+
this.applyHubMode();
|
|
1692
|
+
})));
|
|
1693
|
+
}
|
|
1694
|
+
} else {
|
|
1695
|
+
const q = String(this.repoQuery.value() ?? "").trim();
|
|
1696
|
+
const words = q.toLowerCase().split(/\s+/).filter(Boolean);
|
|
1697
|
+
const filters = [["todos", "Todos"], ["recientes", "★ Recientes"], ["github", "GitHub"], ["azure", "Azure"]];
|
|
1698
|
+
let list = (this.repoSuggest ?? []).filter((r) => this.repoFilter === "todos"
|
|
1699
|
+
|| (this.repoFilter === "recientes" ? r.favorite || r.recent : r.host === this.repoFilter));
|
|
1700
|
+
if (!/^https:\/\//.test(q)) list = list.filter((r) => words.every((w) => `${r.label} ${r.url}`.toLowerCase().includes(w)));
|
|
1701
|
+
if (this.mode === "list") list = list.filter((r) => r.host === "github");
|
|
1702
|
+
const pasted = /^https:\/\/(github\.com|dev\.azure\.com|[A-Za-z0-9_.-]+\.visualstudio\.com)\//.test(q) && !list.some((r) => r.url === q);
|
|
1703
|
+
rows.push(h_flex().gap(6).items_center()
|
|
1704
|
+
.child(div().flex_1().child(Input.new(this.repoQuery).h(28).px(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12)))
|
|
1705
|
+
.child(h_flex().gap(4).children(filters.map(([id, label]) => this.choice(`rf-${id}`, label, this.repoFilter === id, () => { this.repoFilter = id; })))));
|
|
1706
|
+
const errs = Object.entries(this.repoSuggestErrors ?? {}).map(([k, v]) => `${k === "azure" ? "Azure" : k === "github" ? "GitHub" : "API"}: ${v}`);
|
|
1707
|
+
rows.push(v_flex().id("repo-list").max_h(160).overflow_y_scrollbar().gap(1)
|
|
1708
|
+
.when(pasted, (el) => el.child(this.createRepoRow({ url: q, label: q, host: /github\.com/.test(q) ? "github" : "azure" })))
|
|
1709
|
+
.when(this.repoSuggestLoading && !(this.repoSuggest ?? []).length, (el) => el.child(div().px(6).py(3).text_size(UI.text.small).text_color(t.dim).child("Buscando repos…")))
|
|
1710
|
+
.when(errs.length > 0, (el) => el.child(div().px(6).py(2).text_size(UI.text.small).text_color(t.blocked).child(errs.join(" · "))))
|
|
1711
|
+
.when(!this.repoSuggestLoading && list.length === 0 && !pasted, (el) => el.child(div().px(6).py(3).text_size(UI.text.small).text_color(t.dim)
|
|
1712
|
+
.child(q ? "Ningún repo coincide: prueba otro nombre o pega su URL" : "Sin favoritos ni recientes todavía: busca un repo o pega su URL")))
|
|
1713
|
+
.children(list.slice(0, 40).map((r) => this.createRepoRow(r))));
|
|
1714
|
+
if (this.mode === "list") rows.push(div().text_size(UI.text.small).text_color(t.dim).child("Un hub solo admite repos de GitHub; elige dos o más."));
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
rows.push(h_flex().gap(10).items_center()
|
|
1718
|
+
.child(v_flex().w(220).gap(3).child(div().text_size(UI.text.small).font_medium().text_color(t.muted).child(this.mode === "hub" ? "Rama base del hub" : "Rama base"))
|
|
1719
|
+
.child(Input.new(this.fields.base).h(30).px(9).rounded(UI.radius).border_1().border_color(e.base ? t.blocked : t.input).bg(t.background).text_size(12.5)))
|
|
1720
|
+
.when(Boolean(this.devcontainerRepo), (el) => el.child(div().flex_1().pt(16).text_size(UI.text.small).font_family(UI.fontSans).text_color(t.accent)
|
|
1721
|
+
.child("Este repo trae devcontainer: «Docker en el run» queda marcado."))));
|
|
1722
|
+
return this.createBlock(2, "Dónde", "el repo no tiene por qué ser el de la issue", rows, e.repo || e.repos || e.hub || e.base);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
createWho() {
|
|
1066
1726
|
const t = theme();
|
|
1067
1727
|
const e = this.errors ?? {};
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
this.
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1728
|
+
const icons = { pi: ["icons/pi.svg", true], claude: ["icons/claude.svg", false], codex: ["icons/codex.svg", false], copilot: ["icons/copilot.svg", true], agy: ["icons/antigravity.svg", false] };
|
|
1729
|
+
const agentChip = (a) => {
|
|
1730
|
+
const on = this.agent === a;
|
|
1731
|
+
const ic = icons[a];
|
|
1732
|
+
return h_flex().id(`agent-${a}`).flex_none().h(26).px(10).gap(6).items_center().rounded(UI.radius).border_1()
|
|
1733
|
+
.border_color(on ? t.accent : t.input).bg(on ? t.selected : t.surface).text_size(12).text_color(on ? t.foreground : t.muted)
|
|
1734
|
+
.cursor_pointer().hover((s) => s.bg(t.hover)).on_click((_e, cx) => { this.agent = a; cx.notify(); })
|
|
1735
|
+
.when(Boolean(ic), (el) => el.child(ic[1] ? svg(ic[0]).size(13).text_color(t.foreground) : image(ic[0]).w(13).h(13)))
|
|
1736
|
+
.child(a);
|
|
1737
|
+
};
|
|
1738
|
+
const rows = [h_flex().gap(6).flex_wrap().children(AGENTS.map(agentChip))];
|
|
1739
|
+
if (this.agent === "pi") {
|
|
1740
|
+
const models = Array.isArray(this.setup?.models) ? this.setup.models : [];
|
|
1741
|
+
rows.push(this.field("Modelo", models.length > 0 ? this.renderModelSelector(models)
|
|
1742
|
+
: Input.new(this.fields.model).h(30).px(9).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12.5), e.model));
|
|
1743
|
+
}
|
|
1744
|
+
const summary = [`bondificar ${this.bondify ? "sí" : "no"}`, `Docker ${this.docker ? "sí" : "no"}`, timeoutLabel(String(this.fields.timeout.value() ?? "").trim() || 0)];
|
|
1745
|
+
rows.push(h_flex().id("opts-toggle").gap(6).items_center().cursor_pointer().on_click((_e, cx) => { this.optionsOpen = !this.optionsOpen; cx.notify(); })
|
|
1746
|
+
.child(div().text_size(12).text_color(t.muted).child(this.optionsOpen ? "▾ Opciones" : "▸ Opciones"))
|
|
1747
|
+
.when(!this.optionsOpen, (el) => el.child(div().text_size(UI.text.small).text_color(t.dim).child(summary.join(" · ")))));
|
|
1748
|
+
if (this.optionsOpen) {
|
|
1749
|
+
const box = v_flex().gap(6).pl(14).child(this.bondifyRow()).child(this.dockerRow())
|
|
1750
|
+
.child(h_flex().gap(10)
|
|
1751
|
+
.child(div().w(110).child(this.field("Timeout min (0 = sin)", Input.new(this.fields.timeout).h(30).px(9).rounded(UI.radius).border_1().border_color(e.timeout ? t.blocked : t.input).bg(t.background).text_size(12.5), e.timeout)))
|
|
1752
|
+
.when(CONFIG.costs, (el) => el.child(div().w(110).child(this.field("Tope USD", Input.new(this.fields.budget).h(30).px(9).rounded(UI.radius).border_1().border_color(e.budget ? t.blocked : t.input).bg(t.background).text_size(12.5), e.budget)))))
|
|
1753
|
+
.when(this.mode !== "repo", (el) => el.child(this.field("Motor de equipo", h_flex().gap(6).flex_wrap()
|
|
1754
|
+
.children(TEAM_ENGINES.map((en) => this.choice(`engine-${en.id}`, en.label, this.team_engine === en.id, () => { this.team_engine = en.id; }))), null)));
|
|
1755
|
+
rows.push(box);
|
|
1756
|
+
}
|
|
1757
|
+
return this.createBlock(3, "Quién", null, rows, e.agent || (!this.optionsOpen ? e.timeout || e.budget : null));
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
createSummary() {
|
|
1761
|
+
const t = theme();
|
|
1762
|
+
const it = this.pickedIssue;
|
|
1763
|
+
const what = it ? (it.key ?? (it.number ? `#${it.number}` : "issue")) : this.source === "manual" ? "historia a mano" : "sin issue";
|
|
1764
|
+
const where = this.mode === "hub" ? (this.repoSel?.label ? `${this.repoSel.label} (hub)` : String(this.fields.hub.value() ?? "") || "hub sin elegir")
|
|
1765
|
+
: this.mode === "list" ? (this.listRepos.length ? `${this.listRepos.length} repos (hub)` : "repos sin elegir")
|
|
1766
|
+
: this.repoSel?.label ?? (String(this.fields.repo.value() ?? "") || "repo sin elegir");
|
|
1767
|
+
const id = it ? issueTicketId(it) : null;
|
|
1768
|
+
return h_flex().id("create-summary").gap(8).items_center().px(14).py(9).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border).text_size(12).min_w(0)
|
|
1769
|
+
.child(div().flex_none().text_color(t.accent).font_semibold().child(what))
|
|
1770
|
+
.child(div().flex_none().text_color(t.dim).child("→"))
|
|
1771
|
+
.when(this.mode !== "list" && Boolean(this.repoSel), (el) => el.child(this.hostBadge(this.repoSel.host)))
|
|
1772
|
+
.child(div().flex_none().child(where))
|
|
1773
|
+
.child(div().flex_none().text_color(t.dim).child("·"))
|
|
1774
|
+
.child(div().flex_none().child(this.agent))
|
|
1775
|
+
.when(Boolean(id), (el) => el.child(div().flex_none().text_color(t.dim).child("·")).child(div().flex_1().min_w(0).truncate().text_color(t.muted).child(`rama feat/${id}`)));
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
renderCreate(p) {
|
|
1779
|
+
const t = theme();
|
|
1780
|
+
return v_flex().id("bond-dialog").track_focus(this.handle).on_key_down((ev, cx) => this.key(ev, cx))
|
|
1781
|
+
.size_full().bg(t.popover).rounded(UI.radiusLg).border_1().border_color(t.border).text_color(t.foreground).font_family("JetBrains Mono")
|
|
1782
|
+
.child(h_flex().h(46).flex_none().px(16).items_center().border_b_1().border_color(t.border)
|
|
1783
|
+
.child(div().flex_1().text_size(UI.text.title + 2).font_family(UI.fontSans).font_semibold().child("Nuevo ticket"))
|
|
1784
|
+
.child(div().text_size(UI.text.small).text_color(t.dim).child("Esc")))
|
|
1785
|
+
.child(v_flex().id("create-body").flex_1().min_h(0).px(16).py(12).gap(10).overflow_y_scrollbar()
|
|
1786
|
+
.child(this.createWhat()).child(this.createWhere()).child(this.createWho()))
|
|
1787
|
+
.child(v_flex().flex_none().gap(8).px(16).py(12).border_t_1().border_color(t.border)
|
|
1788
|
+
.child(this.createSummary())
|
|
1789
|
+
.when(Boolean(this.error), (el) => el.child(div().text_size(UI.text.small).text_color(t.blocked).child(this.error)))
|
|
1790
|
+
.child(h_flex().gap(8).items_center()
|
|
1791
|
+
.child(div().flex_1().text_size(UI.text.small).text_color(t.dim).child("El ticket queda en Ready: no arranca hasta que lo lances."))
|
|
1792
|
+
.child(this.button("dlg-back", "Volver", "plain", () => closeOverlay(p.overlay)))
|
|
1793
|
+
.child(this.button("dlg-create", this.busy ? "Creando…" : "Crear ticket", "primary", (cx) => this.create(cx)))));
|
|
1109
1794
|
}
|
|
1110
1795
|
|
|
1111
1796
|
renderPick(p) {
|
|
@@ -1128,7 +1813,10 @@ export default class BondBoard extends View {
|
|
|
1128
1813
|
renderCardMenu(p) {
|
|
1129
1814
|
const t = theme();
|
|
1130
1815
|
const card = p.card ?? (this.tickets && this.runs ? buildCards(this.tickets, this.runs, this.agentStatus).find((c) => c.id === p.cardId) : null) ?? {};
|
|
1131
|
-
|
|
1816
|
+
// From the session header: no «Abrir sesión», Shell nor the main action (already shown there).
|
|
1817
|
+
const inSession = Boolean(p.session);
|
|
1818
|
+
const shown = inSession ? this.primaryAction(card)?.[0] ?? null : null;
|
|
1819
|
+
const item = (id, label, icon, danger, action, keep = false) =>
|
|
1132
1820
|
h_flex()
|
|
1133
1821
|
.id(id)
|
|
1134
1822
|
.h(28)
|
|
@@ -1143,7 +1831,7 @@ export default class BondBoard extends View {
|
|
|
1143
1831
|
.hover((s) => s.bg(t.hover))
|
|
1144
1832
|
.on_click((_e, cx) => {
|
|
1145
1833
|
cx.stop_propagation();
|
|
1146
|
-
closeOverlay(p.overlay);
|
|
1834
|
+
if (!keep) closeOverlay(p.overlay);
|
|
1147
1835
|
action(cx);
|
|
1148
1836
|
})
|
|
1149
1837
|
.child(div().w(16).text_size(UI.text.small).text_center().child(icon))
|
|
@@ -1161,26 +1849,26 @@ export default class BondBoard extends View {
|
|
|
1161
1849
|
.border_1()
|
|
1162
1850
|
.border_color(t.border)
|
|
1163
1851
|
.text_color(t.foreground)
|
|
1164
|
-
.when(Boolean(card.canOpen), (el) =>
|
|
1852
|
+
.when(Boolean(card.canOpen) && !inSession, (el) =>
|
|
1165
1853
|
el.child(item(`menu-open-${card.id}`, "Abrir sesión", "→", false, (cx) => this.selectCard(card, cx)))
|
|
1166
1854
|
)
|
|
1167
|
-
.when(Boolean(card.canShell), (el) =>
|
|
1855
|
+
.when(Boolean(card.canShell) && !inSession, (el) =>
|
|
1168
1856
|
el.child(item(`menu-shell-${card.id}`, "Shell del contenedor", "", false, (cx) => this.openContainerShell(card, cx)))
|
|
1169
1857
|
)
|
|
1170
|
-
.when(Boolean(card.canLaunch), (el) =>
|
|
1171
|
-
el.child(item(`menu-launch-${card.id}`, "Lanzar run", "▶", false, () => this.openLaunch(card)))
|
|
1858
|
+
.when(Boolean(card.canLaunch) && shown !== "launch", (el) =>
|
|
1859
|
+
el.child(item(`menu-launch-${card.id}`, "Lanzar run", "▶", false, () => this.openLaunch(card), true))
|
|
1172
1860
|
)
|
|
1173
|
-
.when(Boolean(card.canDeliver), (el) =>
|
|
1174
|
-
el.child(item(`menu-deliver-${card.id}`, "Entregar…", "↑", false, () => this.openDeliver(card)))
|
|
1861
|
+
.when(Boolean(card.canDeliver) && shown !== "deliver", (el) =>
|
|
1862
|
+
el.child(item(`menu-deliver-${card.id}`, "Entregar…", "↑", false, () => this.openDeliver(card), true))
|
|
1175
1863
|
)
|
|
1176
|
-
.when(Boolean(card.canNudge), (el) =>
|
|
1177
|
-
el.child(item(`menu-nudge-${card.id}`, "Desbloquear…", "💬", false, () => this.openNudge(card)))
|
|
1864
|
+
.when(Boolean(card.canNudge) && shown !== "nudge", (el) =>
|
|
1865
|
+
el.child(item(`menu-nudge-${card.id}`, "Desbloquear…", "💬", false, () => this.openNudge(card), true))
|
|
1178
1866
|
)
|
|
1179
1867
|
.when(Boolean(card.canFinish), (el) =>
|
|
1180
|
-
el.child(item(`menu-finish-${card.id}`, "Terminado…", "✓", false, () => this.openFinish(card)))
|
|
1868
|
+
el.child(item(`menu-finish-${card.id}`, "Terminado…", "✓", false, () => this.openFinish(card), true))
|
|
1181
1869
|
)
|
|
1182
|
-
.when(Boolean(card.canApprove), (el) =>
|
|
1183
|
-
el.child(item(`menu-approve-${card.id}`, "Aprobar arreglos…", "✓", false, () => this.openApprove(card)))
|
|
1870
|
+
.when(Boolean(card.canApprove) && shown !== "approve", (el) =>
|
|
1871
|
+
el.child(item(`menu-approve-${card.id}`, "Aprobar arreglos…", "✓", false, () => this.openApprove(card), true))
|
|
1184
1872
|
)
|
|
1185
1873
|
.when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) =>
|
|
1186
1874
|
el.child(item(`menu-pr-${card.id}`, "Abrir PR", "↗", false, () => this.openPr(card)))
|
|
@@ -1194,10 +1882,10 @@ export default class BondBoard extends View {
|
|
|
1194
1882
|
el.child(item(`menu-copy-docker-${card.id}`, "Copiar docker exec", "📋", false, (cx) => this.copyToClipboard(card.containerCommand, cx)))
|
|
1195
1883
|
)
|
|
1196
1884
|
.when(Boolean(card.canCancel), (el) =>
|
|
1197
|
-
el.child(item(`menu-cancel-${card.id}`, "Cancelar run…", "✕", true, () => this.openCancel(card)))
|
|
1885
|
+
el.child(item(`menu-cancel-${card.id}`, "Cancelar run…", "✕", true, () => this.openCancel(card), true))
|
|
1198
1886
|
)
|
|
1199
1887
|
.child(div().h(1).my(2).bg(t.border))
|
|
1200
|
-
.child(item(`menu-delete-${card.id}`, "Borrar ticket…", "🗑", true, () => this.openDelete(card)));
|
|
1888
|
+
.child(item(`menu-delete-${card.id}`, "Borrar ticket…", "🗑", true, () => this.openDelete(card), true));
|
|
1201
1889
|
}
|
|
1202
1890
|
|
|
1203
1891
|
render() {
|