ai-agentmanager 1.46.0 → 1.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +64 -0
- package/package.json +1 -1
- package/public/app.js +29 -1
- package/public/index.html +5 -0
- package/public/keys.js +3 -2
- package/public/plan.js +323 -0
- package/public/style.css +59 -0
- package/public/today.js +102 -2
- package/src/calendar.js +385 -0
- package/src/cli.js +92 -0
- package/src/config.js +4 -0
- package/src/debt.js +276 -0
- package/src/decisions.js +188 -0
- package/src/milestones.js +282 -0
- package/src/notify.js +1 -0
- package/src/server.js +98 -3
- package/src/today.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.47.0 (2026-11-13)
|
|
4
|
+
|
|
5
|
+
- **Plan.** **Plan** in the top bar (or `c`, `#plan`) has three tabs: Dates, Decisions and Debt. Its badge counts dates that are late or at risk.
|
|
6
|
+
- **Dates.** Give a project its code complete, RC and GA dates. Each has a checklist: the app counts agents still working, unfinished backlog, open or failing pull requests and critical or high bugs, and you tick the rest (scope agreed, release notes, docs). A date is on track, at risk (a week or less away with counted work open), late or reached. **Show** opens what is behind a count; **Have an agent do it** puts an item on the project's backlog. Reminders come 14, 7, 3 and 1 days ahead, on the day and once when a date passes, with what is still open; dates show in Today from two weeks out. `agentmgr dates [project] --cc --rc --ga`.
|
|
7
|
+
- **Decisions.** One log of what was decided and why: plans you approved or sent back with your notes, your answers to agents' questions, and the decisions in each agent's design doc. Entries stay after the agent is deleted. Add your own, filter by project or words, copy as Markdown. `agentmgr decisions [project] --md`.
|
|
8
|
+
- **Debt.** Files ranked by how often they changed in 90 days, how many of those changes were fixes and how tangled they are, from git history, scanned weekly. **Hand to an agent** queues a refactor task; **Not debt** sets a file aside. `agentmgr debt [project] --scan`. Turn it off with `"debt": { "enabled": false }`.
|
|
9
|
+
- **Your day.** Paste your calendar's private iCal address (Google or Outlook) in Today and it opens with your meetings, the free time between them with what needs you placed in it, and the agents or issues each meeting names. Read-only; the address stays on this computer and isn't shown again.
|
|
10
|
+
- No model calls are added by any of this.
|
|
11
|
+
|
|
3
12
|
## 1.46.0 (2026-11-13)
|
|
4
13
|
|
|
5
14
|
- **Debug.** **🐞 Debug** in an agent's detail (or the **Debug** tab of the split) puts the agent's session on the left and a debug pane on the right. Say what goes wrong (a failure, E2E instability at max scale, slowness under load) and the agent investigates in its own session: it reads the code and logs, reproduces and measures where it can, and changes no code yet.
|
package/README.md
CHANGED
|
@@ -27,6 +27,8 @@ Run one background [Claude Code](https://claude.com/claude-code) agent per inten
|
|
|
27
27
|
- **Slack alerts.** A message in your channel when an agent needs input, finishes a backlog item, or fails.
|
|
28
28
|
- **Priority.** Mark agents P0–P3. P0 and P1 are highlighted, and lists sort by priority.
|
|
29
29
|
- **Share for review.** One click writes an **Analysis**, **Design**, **Flow** or **Proposal** document from the agent's work, a human time **Estimate** for planning, or the change's **Documentation** with an OpenAPI spec of any API changes. Copy it as Markdown, download it, or print it to PDF with diagrams.
|
|
30
|
+
- **Plan.** A project's commitment dates (code complete, release candidate, GA) with a checklist of what is still open for each, reminders as they come near, and an at-risk or late flag. A **decision log** gathered from plan reviews, your answers and design docs. A **tech debt radar** from git history and the code. What is open can be handed to an agent.
|
|
31
|
+
- **Your day.** Connect your calendar and Today lays the day out around your meetings: the free time between them with what needs you placed in it, and what each meeting is about.
|
|
30
32
|
- **Debug.** Say what to debug (a failure, E2E instability at max scale, slowness under load) in the **Debug** tab beside an agent's session. The agent investigates there and writes a report next to it: animated diagrams of the code path and the data flow with where it breaks, findings with evidence, likely causes and recommended fixes. It changes no code until you press **Apply fixes**.
|
|
31
33
|
- **AI News.** The frontier labs' latest releases in one list, newest first: Claude Platform, Claude Code, the OpenAI API and the Gemini API from their release notes, and the other top labs from a daily web search. Each is summarized in a sentence or two, with its links.
|
|
32
34
|
- **MCP servers and tools.** See every MCP server Claude Code has in a folder (yours, the project's, claude.ai connectors and plugins) with its tools, sign in to the ones that need it, and run any tool directly, through Claude Code, or in an agent's session.
|
|
@@ -184,6 +186,9 @@ agentmgr remote on | off | status | rotate # phone / remote access (see below
|
|
|
184
186
|
agentmgr backlog add "ask" -r <repo> [-p 1] # queue work; also: ls, start, accept, reopen, move, limit, pause
|
|
185
187
|
agentmgr notify slack --webhook <url> # Slack alerts; also: test, status, on, off, event <name> on|off
|
|
186
188
|
agentmgr debug <agent> "what goes wrong" # debug with an agent; no question prints its report; --fix applies the fixes
|
|
189
|
+
agentmgr dates <project> --cc 2026-12-01 --rc 2026-12-10 --ga 2026-12-20 # commitment dates; no dates: where each stands
|
|
190
|
+
agentmgr decisions [project] [--md] # the decision log; --add "<question>" --decision "<what>" adds one
|
|
191
|
+
agentmgr debt <project> --scan # the tech debt radar: files that change often and are hard to read
|
|
187
192
|
agentmgr news # the frontier labs' latest releases, summarized (--refresh, --lab, --days)
|
|
188
193
|
agentmgr inbox # prompts, questions, stuck agents and overlaps waiting on you
|
|
189
194
|
agentmgr answer <agent> <question-id> "…" # answer a question from the inbox
|
|
@@ -1149,6 +1154,65 @@ Usage comes from the session transcripts and is refreshed every few seconds whil
|
|
|
1149
1154
|
|
|
1150
1155
|
`agentmgr mcp run <agent|home> <server> <tool> [arguments or request]` does the first two, and `--session` the third. A destructive tool needs a second click. Plugins can refuse runs outside an agent's session with the `mcp.run` policy.
|
|
1151
1156
|
|
|
1157
|
+
## Plan: dates, decisions and tech debt
|
|
1158
|
+
|
|
1159
|
+
**Plan** in the top bar (or `c`, or `#plan`) looks ahead, in three tabs. Its button counts the dates that are late or at risk.
|
|
1160
|
+
|
|
1161
|
+
### Dates
|
|
1162
|
+
|
|
1163
|
+
Give a project its **code complete**, **release candidate** and **GA** dates (**+ Dates for a project**, or `agentmgr dates <project> --cc … --rc … --ga …`; they must be in that order). For each date you get:
|
|
1164
|
+
|
|
1165
|
+
- **How far it is and where it stands.** *On track*, *at risk* (a week or less away with counted work still open), *late*, or *reached* once you mark it.
|
|
1166
|
+
- **A checklist.** What the app can count for itself, and what only you can tick:
|
|
1167
|
+
|
|
1168
|
+
| Date | Counted by the app | Yours to tick |
|
|
1169
|
+
|---|---|---|
|
|
1170
|
+
| Code complete | agents still working, backlog items not finished, things waiting on you (plans, questions, prompts) | scope agreed |
|
|
1171
|
+
| Release candidate | pull requests still open, pull requests with failing checks, critical or high bugs open (bug hunts) | release notes and changelog drafted, RC cut and smoke-tested |
|
|
1172
|
+
| GA | critical or high bugs open, pull requests still open | docs and upgrade notes, release notes final, version tagged and published |
|
|
1173
|
+
|
|
1174
|
+
- **Related actions.** **Show** jumps to the agents, backlog, Land tab or Bugs behind a count. **Have an agent do it** hands one of your items (release notes, docs) to an agent through the project's backlog.
|
|
1175
|
+
- **Reminders.** Planned 14, 7, 3 and 1 days before and on the day, and once when a date passes. Each goes to Slack with what is still open (Alerts → *a project's date*), between 8:00 and 20:00; coming within a nearer one covers the further ones. A date you move gets its reminders again.
|
|
1176
|
+
- **In Today.** A date shows from two weeks out, higher up as it nears, with what is open.
|
|
1177
|
+
|
|
1178
|
+
### Decisions
|
|
1179
|
+
|
|
1180
|
+
What was decided on each project and why, newest first, gathered from what already happens here:
|
|
1181
|
+
|
|
1182
|
+
- **Plan reviews:** a plan you approved or sent back, with your notes.
|
|
1183
|
+
- **Your answers** to agents' questions.
|
|
1184
|
+
- **Design docs:** the bullets under *Decisions and risks*. When a design moves on, what it no longer says is kept and marked *replaced since*.
|
|
1185
|
+
- **Your own**, with **+ Add a decision** (or `agentmgr decisions <project> --add …`).
|
|
1186
|
+
|
|
1187
|
+
Entries stay after their agent is deleted. Filter by project or by words, remove one with ×, and **Copy as Markdown** (or `agentmgr decisions --md`) gives the log as a document. No model is called.
|
|
1188
|
+
|
|
1189
|
+
### Debt
|
|
1190
|
+
|
|
1191
|
+
Where a project's code costs the most to change. **Scan** (or `agentmgr debt <project> --scan`) reads the repository's last 90 days of git history and its source files, and scores each file by:
|
|
1192
|
+
|
|
1193
|
+
- how often it changed, and how many of those changes were fixes;
|
|
1194
|
+
- how tangled it is: its length, branch points, lines nested five deep or more, TODO/FIXME notes;
|
|
1195
|
+
- open bugs the bug hunts found in it.
|
|
1196
|
+
|
|
1197
|
+
Files that are both changed often and hard to read come first, each with its reasons. Test files count for less; vendored, generated and binary files, and commits that touch more than 40 files, are left out. **Hand to an agent** queues a task in the project's backlog (cover it with tests, then refactor in small steps); **Not debt** sets a file aside for good. Projects with a repository on this computer are scanned again every 7 days. It reads git and the files only: no model is called and nothing leaves the machine. In config.json: `"debt": { "enabled": true, "days": 90, "autoDays": 7, "top": 30 }`.
|
|
1198
|
+
|
|
1199
|
+
## Your day: Today around your calendar
|
|
1200
|
+
|
|
1201
|
+
In **Today**, **Connect calendar** takes your calendar's private iCal address:
|
|
1202
|
+
|
|
1203
|
+
- **Google Calendar:** Settings → your calendar → Integrate calendar → *Secret address in iCal format*.
|
|
1204
|
+
- **Outlook:** Settings → Calendar → Shared calendars → Publish a calendar → *ICS*.
|
|
1205
|
+
|
|
1206
|
+
The address gives read access only. It is kept in config.json on this computer, is never shown in the page again, and is fetched only by the daemon (every 10 minutes at most). Nothing is written to your calendar.
|
|
1207
|
+
|
|
1208
|
+
With it, Today opens with **Your day**:
|
|
1209
|
+
|
|
1210
|
+
- **Meetings** from now on, with the one in progress marked, and all-day events on a line of their own.
|
|
1211
|
+
- **Free time** between them until the end of your working day (09:00 to 18:00 unless you change it), with what needs you placed in it, most pressing first. Each kind of item has a usual length (a prompt 3 minutes, a question 5, a pull request review 25), and what doesn't fit is counted as *won't fit today* instead of squeezed in.
|
|
1212
|
+
- **What a meeting is about:** the agents, pull requests and issues its title or description names (a Jira key, `#482`, an agent's or project's name), to open before you walk in.
|
|
1213
|
+
|
|
1214
|
+
Repeating meetings, time zones, moved or cancelled occurrences and events marked *free* are understood. Several calendars can be added; **Disconnect** forgets them. In config.json: `"calendar": { "ics": ["https://…"], "workStart": "09:00", "workEnd": "18:00" }`.
|
|
1215
|
+
|
|
1152
1216
|
## Debug
|
|
1153
1217
|
|
|
1154
1218
|
**🐞 Debug** in an agent's detail (or the **Debug** tab of the split, **◫ Split** in the terminal bar) puts the agent's session on the left and the debug pane on the right. Type what is going wrong, for example *E2E tests fail at max scale after about 20 minutes* or *p99 latency triples under load*, and press **Debug** (or Enter).
|
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -39,6 +39,7 @@ import { initBugHunt } from '/bughunt.js';
|
|
|
39
39
|
import { drawDiagram } from '/diagram.js';
|
|
40
40
|
import { initValue } from '/value.js';
|
|
41
41
|
import { initNews } from '/news.js';
|
|
42
|
+
import { initPlan } from '/plan.js';
|
|
42
43
|
import { initMcp } from '/mcp.js';
|
|
43
44
|
import { initCodeMap } from '/codemap.js';
|
|
44
45
|
import { initKeys } from '/keys.js';
|
|
@@ -68,11 +69,13 @@ const standupOnLoad = hashId === 'standup';
|
|
|
68
69
|
const mapOnLoad = hashId === 'map';
|
|
69
70
|
const valueOnLoad = hashId === 'value';
|
|
70
71
|
const newsOnLoad = hashId === 'news';
|
|
72
|
+
// "#plan" or "#plan/<dates|decisions|debt>".
|
|
73
|
+
const planOnLoad = hashId === 'plan';
|
|
71
74
|
const reviewsOnLoad = hashId === 'reviews';
|
|
72
75
|
// "#mcp" or "#mcp/<agent>": the MCP window on its own.
|
|
73
76
|
const mcpOnLoad = hashId === 'mcp';
|
|
74
77
|
let watchShown = false;
|
|
75
|
-
let selectedId = (watchOnLoad || standupOnLoad || mapOnLoad || valueOnLoad || newsOnLoad || reviewsOnLoad || mcpOnLoad ? null : hashId) || null;
|
|
78
|
+
let selectedId = (watchOnLoad || standupOnLoad || mapOnLoad || valueOnLoad || newsOnLoad || planOnLoad || reviewsOnLoad || mcpOnLoad ? null : hashId) || null;
|
|
76
79
|
let openTermOnLoad = hashView === 'term' || hashView === 'code' || isShell(hashView) || isBrowser(hashView);
|
|
77
80
|
let filterText = '';
|
|
78
81
|
// "Only agents created in the last N days": remembered in this browser.
|
|
@@ -279,6 +282,7 @@ const todayUi = initToday({
|
|
|
279
282
|
openBugs: (show = 'open') => bugsUi.open({ show }),
|
|
280
283
|
openChanges: (id) => (showTab('agents'), select(id), reviewUi.open(id)),
|
|
281
284
|
openEval: (id) => (showTab('agents'), select(id), openDoc(id, 'eval')),
|
|
285
|
+
openPlan: (tab) => planUi.open(tab),
|
|
282
286
|
});
|
|
283
287
|
$('#today-btn').onclick = () => todayUi.open();
|
|
284
288
|
// Designs: every agent's design doc, the ones waiting for your review first.
|
|
@@ -304,6 +308,21 @@ $('#value-btn').onclick = () => valueUi.open();
|
|
|
304
308
|
// AI News: the frontier labs' latest releases, summarized.
|
|
305
309
|
const newsUi = initNews({ api, $, esc, ago, toast: (m, ms) => toast(m, ms) });
|
|
306
310
|
$('#news-btn').onclick = () => newsUi.open();
|
|
311
|
+
// Plan: project dates with their checklists and reminders, the decision log, the tech debt radar.
|
|
312
|
+
const planUi = initPlan({
|
|
313
|
+
api,
|
|
314
|
+
$,
|
|
315
|
+
esc,
|
|
316
|
+
ago,
|
|
317
|
+
toast: (m, ms) => toast(m, ms),
|
|
318
|
+
projects: () => projectsState.map((p) => ({ key: p.shortcut, name: p.name })),
|
|
319
|
+
openTab: (what, id) => {
|
|
320
|
+
if (what === 'agent') return showTab('agents'), select(id);
|
|
321
|
+
if (what === 'bugs') return bugsUi.open({ show: 'open' });
|
|
322
|
+
showTab(what);
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
$('#plan-btn').onclick = () => planUi.open();
|
|
307
326
|
// MCP: the MCP servers and tools Claude Code has in a folder, and running one.
|
|
308
327
|
const mcpUi = initMcp({ api, $, esc, ago, md: (t) => md(t), toast: (m, ms) => toast(m, ms), agents: () => [...agents.values()] });
|
|
309
328
|
$('#mcp-btn').onclick = () => mcpUi.open(selectedId && agents.get(selectedId)?.workdir ? selectedId : null);
|
|
@@ -358,6 +377,7 @@ function shortcut(act) {
|
|
|
358
377
|
if (act === 'bugs') return bugsUi.open();
|
|
359
378
|
if (act === 'value') return valueUi.open();
|
|
360
379
|
if (act === 'news') return newsUi.open();
|
|
380
|
+
if (act === 'plan') return planUi.open();
|
|
361
381
|
if (act === 'today') return todayUi.open();
|
|
362
382
|
if (act.startsWith('tab:')) return showTab(act.slice(4));
|
|
363
383
|
return false;
|
|
@@ -4420,6 +4440,11 @@ function handleEvent(msg) {
|
|
|
4420
4440
|
history.replaceState(null, '', '#');
|
|
4421
4441
|
valueUi.open();
|
|
4422
4442
|
}
|
|
4443
|
+
if (planOnLoad && !watchShown) {
|
|
4444
|
+
watchShown = true;
|
|
4445
|
+
history.replaceState(null, '', '#');
|
|
4446
|
+
planUi.open(hashView || 'dates');
|
|
4447
|
+
}
|
|
4423
4448
|
if (newsOnLoad && !watchShown) {
|
|
4424
4449
|
watchShown = true;
|
|
4425
4450
|
history.replaceState(null, '', '#');
|
|
@@ -4476,6 +4501,9 @@ function handleEvent(msg) {
|
|
|
4476
4501
|
valueUi.changed();
|
|
4477
4502
|
} else if (msg.t === 'news') {
|
|
4478
4503
|
newsUi.changed();
|
|
4504
|
+
} else if (msg.t === 'plan') {
|
|
4505
|
+
planUi.changed();
|
|
4506
|
+
todayUi.changed();
|
|
4479
4507
|
} else if (msg.t === 'standup') {
|
|
4480
4508
|
standupUi.set(msg.latest);
|
|
4481
4509
|
if (msg.latest?.reason === 'scheduled' && msg.latest.items.length) toast('Standup ready: press Standup (or p) to play it', 8000);
|
package/public/index.html
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
<button id="bugs-btn" title="Bugs: background hunts in a project or folder, and what they found, checked and worst first">Bugs <span id="bugs-count" class="badge"></span></button>
|
|
41
41
|
<button id="reviews-btn" title="Reviews: pull requests you review. Reviewer agents ask the critical questions and find what blocks approval; you post what you pick">Reviews <span id="reviews-count" class="badge ready"></span></button>
|
|
42
42
|
<button id="value-btn" title="Value: what the delivered work is worth, by day, week, month and quarter, against the AI cost and your time; reports for management">Value</button>
|
|
43
|
+
<button id="plan-btn" title="Plan: a project's dates (code complete, RC, GA) with their checklists and reminders, the decision log, and the tech debt radar">Plan <span id="plan-count" class="badge"></span></button>
|
|
43
44
|
<button id="news-btn" title="AI News: the frontier labs' latest releases (Anthropic, OpenAI, Google and the other top labs), each summarized, with links">AI News <span id="news-count" class="badge ready"></span></button>
|
|
44
45
|
<button id="map-btn" title="The codebase map: where each agent is changing and reading code, and who is about to collide">Map</button>
|
|
45
46
|
<button id="watch-btn" title="Running agents' sessions side by side, live: follow them all without clicking from one to the next">Watch</button>
|
|
@@ -417,6 +418,9 @@
|
|
|
417
418
|
<dialog id="value-dialog" class="issues-dialog value-dialog" aria-label="Value">
|
|
418
419
|
<div id="value-body"></div>
|
|
419
420
|
</dialog>
|
|
421
|
+
<dialog id="plan-dialog" class="issues-dialog plan-dialog" aria-label="Plan">
|
|
422
|
+
<div id="plan-body"></div>
|
|
423
|
+
</dialog>
|
|
420
424
|
<dialog id="news-dialog" class="issues-dialog news-dialog" aria-label="AI News">
|
|
421
425
|
<div id="news-body"></div>
|
|
422
426
|
</dialog>
|
|
@@ -595,6 +599,7 @@
|
|
|
595
599
|
<label class="check"><input type="checkbox" name="ev_budget" /> nears or reaches its budget, or today's spend reaches the daily limit</label>
|
|
596
600
|
<label class="check"><input type="checkbox" name="ev_standup" /> the daily standup is ready (with a link to play it)</label>
|
|
597
601
|
<label class="check"><input type="checkbox" name="ev_value" /> value reports (weekly, monthly, quarterly, as set in Value)</label>
|
|
602
|
+
<label class="check"><input type="checkbox" name="ev_milestone" /> a project's date (code complete, RC, GA) is 14, 7, 3 or 1 days away, today, or late (Plan → Dates)</label>
|
|
598
603
|
<label class="check"><input type="checkbox" name="ev_waiting" /> finished its turn and is idle after <input name="waitingDelaySec" type="number" min="0" class="num" />s</label>
|
|
599
604
|
<label class="check"><input type="checkbox" name="skipWhenWatching" /> not while I have its terminal open</label>
|
|
600
605
|
<label class="check"><input type="checkbox" name="includeIntent" /> include the intent text in the message</label>
|
package/public/keys.js
CHANGED
|
@@ -28,6 +28,7 @@ export const SHORTCUTS = [
|
|
|
28
28
|
[['g'], 'Reviews: pull requests you review', 'reviews'],
|
|
29
29
|
[['v'], 'Value: what the work is worth', 'value'],
|
|
30
30
|
[['l'], 'AI News: the latest frontier releases', 'news'],
|
|
31
|
+
[['c'], 'Plan: project dates, decisions and tech debt', 'plan'],
|
|
31
32
|
[['1'], 'Agents tab', 'tab:agents'],
|
|
32
33
|
[['2'], 'Inbox: what needs you', 'tab:inbox'],
|
|
33
34
|
[['3'], 'Backlog', 'tab:backlog'],
|
|
@@ -71,11 +72,11 @@ export const SHORTCUTS = [
|
|
|
71
72
|
// A single key, as an event names it, to its action.
|
|
72
73
|
export const SINGLE = {
|
|
73
74
|
j: 'next', k: 'prev', Enter: 'terminal', t: 'terminal',
|
|
74
|
-
r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', i: 'issues', o: 'actions', h: 'assistant', ',': 'settings', d: 'designs', g: 'reviews', v: 'value', l: 'news', y: 'today', b: 'bugs', '?': 'help',
|
|
75
|
+
r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', i: 'issues', o: 'actions', h: 'assistant', ',': 'settings', d: 'designs', g: 'reviews', v: 'value', l: 'news', c: 'plan', y: 'today', b: 'bugs', '?': 'help',
|
|
75
76
|
1: 'tab:agents', 2: 'tab:inbox', 3: 'tab:backlog', 4: 'tab:land', 5: 'tab:built',
|
|
76
77
|
};
|
|
77
78
|
// While Watch is open: only what makes sense there.
|
|
78
|
-
const ON_WATCH = new Set(['today', 'new', 'ask', 'watch', 'standup', 'map', 'issues', 'actions', 'assistant', 'settings', 'designs', 'reviews', 'value', 'news', 'bugs', 'help']);
|
|
79
|
+
const ON_WATCH = new Set(['today', 'new', 'ask', 'watch', 'standup', 'map', 'issues', 'actions', 'assistant', 'settings', 'designs', 'reviews', 'value', 'news', 'plan', 'bugs', 'help']);
|
|
79
80
|
|
|
80
81
|
/** Typing somewhere: a field, an editor or a terminal (xterm types through a textarea). */
|
|
81
82
|
const typing = (el) => Boolean(el?.closest?.('input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .cm-editor'));
|
package/public/plan.js
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
// Plan: looking ahead, in three tabs.
|
|
2
|
+
// Dates a project's commitments (code complete, release candidate, GA): how far each is,
|
|
3
|
+
// whether it is at risk, what is still open for it, and the reminders planned
|
|
4
|
+
// Decisions what was decided on each project and why, gathered from plan reviews, your answers
|
|
5
|
+
// and design docs, plus your own
|
|
6
|
+
// Debt where the code costs the most to change, from git history and the files themselves
|
|
7
|
+
// What is open can be handed to an agent from each (it goes to the backlog).
|
|
8
|
+
|
|
9
|
+
import { expandButton, expandable } from './expand.js';
|
|
10
|
+
|
|
11
|
+
const TABS = [
|
|
12
|
+
['dates', 'Dates'],
|
|
13
|
+
['decisions', 'Decisions'],
|
|
14
|
+
['debt', 'Debt'],
|
|
15
|
+
];
|
|
16
|
+
const SAVED = 'agentmgr.planTab';
|
|
17
|
+
const STATUS = { 'on-track': 'On track', 'at-risk': 'At risk', late: 'Late', reached: 'Reached' };
|
|
18
|
+
|
|
19
|
+
export function initPlan({ api, $, esc, ago, toast, projects = () => [], openTab = () => {} }) {
|
|
20
|
+
const dialog = $('#plan-dialog');
|
|
21
|
+
const body = $('#plan-body');
|
|
22
|
+
let tab = 'dates';
|
|
23
|
+
let data = {}; // per tab
|
|
24
|
+
let pending = false; // a change arrived while you were typing
|
|
25
|
+
let adding = false; // the "add dates" or "add a decision" form is open
|
|
26
|
+
const filter = { project: '', q: '' };
|
|
27
|
+
try {
|
|
28
|
+
tab = localStorage.getItem(SAVED) || 'dates';
|
|
29
|
+
} catch {}
|
|
30
|
+
if (!TABS.some(([k]) => k === tab)) tab = 'dates';
|
|
31
|
+
|
|
32
|
+
const route = () => (tab === 'dates' ? '/milestones' : tab === 'debt' ? '/debt' : `/decisions?project=${encodeURIComponent(filter.project)}&q=${encodeURIComponent(filter.q)}`);
|
|
33
|
+
async function load({ quiet = false } = {}) {
|
|
34
|
+
const t = tab;
|
|
35
|
+
try {
|
|
36
|
+
data[t] = await api('GET', route());
|
|
37
|
+
} catch (e) {
|
|
38
|
+
if (!quiet) toast?.(e.message, 5000);
|
|
39
|
+
}
|
|
40
|
+
if (t === 'dates') badge();
|
|
41
|
+
render();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** On the button: the dates that are late or at risk. */
|
|
45
|
+
function badge() {
|
|
46
|
+
const el = $('#plan-count');
|
|
47
|
+
if (!el || !data.dates) return;
|
|
48
|
+
const n = data.dates.projects.flatMap((p) => p.stages).filter((s) => s.status === 'late' || s.status === 'at-risk').length;
|
|
49
|
+
el.textContent = n ? String(n) : '';
|
|
50
|
+
el.title = n ? `${n} date${n === 1 ? '' : 's'} late or at risk` : '';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const day = (iso) => new Date(`${iso}T12:00:00`).toLocaleDateString([], { weekday: 'short', month: 'short', day: 'numeric' });
|
|
54
|
+
const typing = () => body.contains(document.activeElement) && /^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement.tagName);
|
|
55
|
+
|
|
56
|
+
// ------------------------------------------------------------ Dates
|
|
57
|
+
function dateInputs(stages, values = {}) {
|
|
58
|
+
return stages.map((s) => `<label class="plan-date">${esc(s.label)} <input type="date" name="${s.id}" value="${esc(values[s.id] ?? '')}" /></label>`).join('');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function checkItem(p, s, i) {
|
|
62
|
+
if (i.auto) {
|
|
63
|
+
return `<li class="plan-check ${i.ok ? 'ok' : 'open'}" title="${esc(i.names.join('\n'))}"><span class="plan-mark">${i.ok ? '✓' : i.count}</span><span>${esc(i.text)}</span>${!i.ok && i.go ? ` <button class="link" data-plan-go="${esc(i.go)}">Show</button>` : ''}</li>`;
|
|
64
|
+
}
|
|
65
|
+
return `<li class="plan-check ${i.done ? 'ok' : 'mine'}"><label><input type="checkbox" data-plan-check="${esc(p.shortcut)}|${s.id}|${esc(i.key)}" ${i.done ? 'checked' : ''} /> ${esc(i.text)}</label>${i.task && !i.done ? (i.asked ? ` <span class="hint">asked an agent ${esc(ago(i.asked))}</span>` : ` <button class="small" data-plan-task="${esc(p.shortcut)}|${s.id}|${esc(i.key)}" title="An agent does it: the task goes to this project's backlog">Have an agent do it</button>`) : ''}</li>`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function stageHtml(p, s) {
|
|
69
|
+
const reminders = s.reminders.map((r) => `<span class="plan-reminder${r.sent ? ' sent' : r.past ? ' past' : ''}" title="${esc(r.label)}${r.sent ? ': sent' : r.past ? ': passed before it was set' : ''}">${esc(day(r.on))}${r.sent ? ' ✓' : ''}</span>`).join('');
|
|
70
|
+
return `<section class="plan-stage ${esc(s.status)}">
|
|
71
|
+
<div class="plan-stage-head">
|
|
72
|
+
<b>${esc(s.label)}</b> <span class="hint">${esc(day(s.date))}</span>
|
|
73
|
+
<span class="tag plan-${esc(s.status)}">${esc(STATUS[s.status])}</span> <span class="plan-left">${esc(s.words)}</span>
|
|
74
|
+
<span class="spacer"></span>
|
|
75
|
+
<button class="small" data-plan-reach="${esc(p.shortcut)}|${s.id}|${s.reached ? '0' : '1'}" title="${s.reached ? 'Not reached after all: its reminders come back' : 'The date was met: no more reminders for it'}">${s.reached ? 'Not reached' : 'Mark reached'}</button>
|
|
76
|
+
</div>
|
|
77
|
+
<ul class="plan-checks">${s.checklist.map((i) => checkItem(p, s, i)).join('')}</ul>
|
|
78
|
+
${s.reached ? '' : `<div class="hint plan-reminders">Reminders: ${reminders}</div>`}
|
|
79
|
+
</section>`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function datesHtml() {
|
|
83
|
+
const d = data.dates;
|
|
84
|
+
if (!d) return '<p class="hint">Loading…</p>';
|
|
85
|
+
const form = adding
|
|
86
|
+
? `<form class="plan-form" data-plan-dates="">
|
|
87
|
+
<select name="project" required><option value="">pick a project</option>${d.others.map((p) => `<option value="${esc(p.shortcut)}">${esc(p.name)}</option>`).join('')}</select>
|
|
88
|
+
${dateInputs(d.stages)}
|
|
89
|
+
<button class="small primary">Save</button> <button type="button" class="small" data-plan="add">Cancel</button>
|
|
90
|
+
</form>`
|
|
91
|
+
: '';
|
|
92
|
+
const cards = d.projects
|
|
93
|
+
.map((p) => `<div class="plan-project">
|
|
94
|
+
<form class="plan-project-head" data-plan-dates="${esc(p.shortcut)}">
|
|
95
|
+
<h3>${esc(p.name)}</h3>
|
|
96
|
+
${dateInputs(d.stages, Object.fromEntries(p.stages.map((s) => [s.id, s.date])))}
|
|
97
|
+
<button class="small" title="Save the dates. A date that moves gets its reminders again; an emptied one is removed">Save dates</button>
|
|
98
|
+
</form>
|
|
99
|
+
<div class="plan-stages">${p.stages.map((s) => stageHtml(p, s)).join('')}</div>
|
|
100
|
+
</div>`)
|
|
101
|
+
.join('');
|
|
102
|
+
return `<p class="hint">A project's commitments and what stands between now and each. The app counts what it can see (agents still working, backlog, pull requests, serious bugs); you tick the rest, or hand it to an agent. A date a week or less away with counted work open is <b>at risk</b>. Reminders go to Slack ${d.remindDays.filter((n) => n).join(', ')} days before and on the day (Alerts), and the dates show in Today from two weeks out.</p>
|
|
103
|
+
<div class="plan-bar"><button class="small ${d.projects.length ? '' : 'primary'}" data-plan="add" ${d.others.length ? '' : 'disabled'}>+ Dates for a project</button></div>
|
|
104
|
+
${form}
|
|
105
|
+
${cards || (adding ? '' : '<p class="hint issues-empty">No dates yet. Add a project\'s code complete, release candidate and GA dates to get its checklists and reminders.</p>')}`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ------------------------------------------------------------ Decisions
|
|
109
|
+
function decisionsList() {
|
|
110
|
+
const d = data.decisions;
|
|
111
|
+
if (!d) return '<p class="hint">Loading…</p>';
|
|
112
|
+
if (!d.items.length) return `<p class="hint issues-empty">${d.total ? 'Nothing matches.' : 'No decisions yet. They are gathered as you approve plans and answer agents\' questions, and from design docs; or add your own.'}</p>`;
|
|
113
|
+
return `<ul class="plan-decisions">${d.items
|
|
114
|
+
.map((i) => `<li class="plan-decision${i.superseded ? ' superseded' : ''}">
|
|
115
|
+
<div class="plan-decision-head"><b>${esc(i.title)}</b><span class="spacer"></span><button class="link" data-plan-remove="${esc(i.id)}" title="Take it off the log">×</button></div>
|
|
116
|
+
<div><span class="hint">Decided:</span> ${esc(i.decision)}</div>
|
|
117
|
+
${i.why ? `<div><span class="hint">Why:</span> ${esc(i.why)}</div>` : ''}
|
|
118
|
+
<div class="hint">${esc(i.project.name)} · ${esc(i.kindLabel)}${i.agentName ? ` · ${i.agentGone ? esc(i.agentName) : `<button class="link" data-plan-agent="${esc(i.agentId)}">${esc(i.agentName)}</button>`}` : ''} · <span title="${esc(new Date(i.at).toLocaleString())}">${esc(ago(i.at))}</span>${i.superseded ? ' · <b>replaced since</b>' : ''}</div>
|
|
119
|
+
</li>`)
|
|
120
|
+
.join('')}</ul>`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function decisionsHtml() {
|
|
124
|
+
const d = data.decisions;
|
|
125
|
+
const all = projects();
|
|
126
|
+
const form = adding
|
|
127
|
+
? `<form class="plan-form plan-decision-form" data-plan-decision>
|
|
128
|
+
<select name="project" required><option value="">pick a project</option>${all.map((p) => `<option value="${esc(p.key)}" ${p.key === filter.project ? 'selected' : ''}>${esc(p.name)}</option>`).join('')}</select>
|
|
129
|
+
<input name="title" placeholder="What was the question? (Cursor or offset paging)" required />
|
|
130
|
+
<input name="decision" placeholder="What was decided" required />
|
|
131
|
+
<input name="why" placeholder="Why (optional)" />
|
|
132
|
+
<button class="small primary">Add</button> <button type="button" class="small" data-plan="add">Cancel</button>
|
|
133
|
+
</form>`
|
|
134
|
+
: '';
|
|
135
|
+
return `<p class="hint">What was decided on each project and why: the plans you approved or sent back (with your notes), your answers to agents' questions, and the decisions in each design doc. They stay after the agent is deleted.</p>
|
|
136
|
+
<div class="plan-bar">
|
|
137
|
+
<select data-plan-project aria-label="Project"><option value="">All projects${d ? ` (${d.total})` : ''}</option>${(d?.projects ?? []).map((p) => `<option value="${esc(p.key)}" ${p.key === filter.project ? 'selected' : ''}>${esc(p.name)} (${p.count})</option>`).join('')}</select>
|
|
138
|
+
<input type="search" data-plan-find placeholder="Find…" value="${esc(filter.q)}" aria-label="Find a decision" />
|
|
139
|
+
<span class="spacer"></span>
|
|
140
|
+
<button class="small" data-plan="copy" title="The log${filter.project ? ' of this project' : ''} as Markdown, on the clipboard">Copy as Markdown</button>
|
|
141
|
+
<button class="small" data-plan="add" ${all.length ? '' : 'disabled'}>+ Add a decision</button>
|
|
142
|
+
</div>
|
|
143
|
+
${form}
|
|
144
|
+
<div id="plan-decisions-list">${decisionsList()}</div>`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ------------------------------------------------------------ Debt
|
|
148
|
+
function debtHtml() {
|
|
149
|
+
const d = data.debt;
|
|
150
|
+
if (!d) return '<p class="hint">Loading…</p>';
|
|
151
|
+
const cards = d.projects
|
|
152
|
+
.map((p) => {
|
|
153
|
+
const meta = p.scanning ? 'Scanning…' : p.error ? `<span class="fail">Couldn't scan: ${esc(p.error)}</span>` : p.at ? `Scanned ${esc(ago(p.at))}: ${p.commits} commits in ${p.days} days, ${p.scanned} changed files read${p.dismissed ? `, ${p.dismissed} set aside` : ''}` : p.hasRepo ? 'Not scanned yet' : 'No local repository yet: start an agent in it first';
|
|
154
|
+
const rows = p.spots
|
|
155
|
+
.map((h) => `<tr>
|
|
156
|
+
<td class="plan-score"><span class="plan-bar-fill" style="width:${h.score}%"></span><b>${h.score}</b></td>
|
|
157
|
+
<td><code>${esc(h.file)}</code><div class="hint">${esc(h.reasons.join(' · '))}</div></td>
|
|
158
|
+
<td class="nowrap">${h.queued ? `<span class="hint">handed over ${esc(ago(h.queued))}</span>` : `<button class="small" data-plan-debt="${esc(p.shortcut)}" data-file="${esc(h.file)}" title="An agent covers it with tests, then refactors in small steps: the task goes to this project's backlog">Hand to an agent</button>`} <button class="small" data-plan-notdebt="${esc(p.shortcut)}" data-file="${esc(h.file)}" title="Generated, or meant to be this way: off the list, also after the next scan">Not debt</button></td>
|
|
159
|
+
</tr>`)
|
|
160
|
+
.join('');
|
|
161
|
+
return `<div class="plan-project">
|
|
162
|
+
<div class="plan-project-head"><h3>${esc(p.name)}</h3><span class="hint">${meta}</span><span class="spacer"></span><button class="small" data-plan-scan="${esc(p.shortcut)}" ${p.hasRepo && !p.scanning ? '' : 'disabled'}>${p.at ? 'Scan again' : 'Scan'}</button></div>
|
|
163
|
+
${rows ? `<table class="issues plan-debt"><tbody>${rows}</tbody></table>` : p.at && !p.error ? '<p class="hint">No hot spots: nothing here is both changed often and hard to read.</p>' : ''}
|
|
164
|
+
</div>`;
|
|
165
|
+
})
|
|
166
|
+
.join('');
|
|
167
|
+
return `<p class="hint">Where the code costs the most to change: files that changed often in the last ${d.settings.days} days (and how many of those changes were fixes) and are tangled (long, branching, deeply nested, with TODOs), plus the open bugs found there. Read from git and the files; no model is called. Scanned again every ${d.settings.autoDays} days.</p>
|
|
168
|
+
${cards || '<p class="hint issues-empty">No projects yet.</p>'}`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function draw() {
|
|
172
|
+
if (!dialog.open) return;
|
|
173
|
+
body.innerHTML = `
|
|
174
|
+
<div class="issues-head">
|
|
175
|
+
<h2>Plan</h2>
|
|
176
|
+
<div class="chips" role="tablist">${TABS.map(([k, label]) => `<button class="chip ${k === tab ? 'active' : ''}" role="tab" aria-selected="${k === tab}" data-plan-tab="${k}">${label}</button>`).join('')}</div>
|
|
177
|
+
<span class="spacer"></span>
|
|
178
|
+
<button class="small" data-plan="refresh" title="Look again">↻</button>
|
|
179
|
+
${expandButton(dialog)}
|
|
180
|
+
<button class="small" data-plan="close" title="Close (Esc)">Close</button>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="issues-scroll plan-scroll">${tab === 'dates' ? datesHtml() : tab === 'decisions' ? decisionsHtml() : debtHtml()}</div>`;
|
|
183
|
+
}
|
|
184
|
+
// A change from the daemon doesn't take what you are typing: it is drawn when you are done.
|
|
185
|
+
function render() {
|
|
186
|
+
if (typing()) {
|
|
187
|
+
pending = true;
|
|
188
|
+
// The decision list can still follow the search box.
|
|
189
|
+
const list = body.querySelector('#plan-decisions-list');
|
|
190
|
+
if (tab === 'decisions' && list) list.innerHTML = decisionsList();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
pending = false;
|
|
194
|
+
const top = body.querySelector('.plan-scroll')?.scrollTop ?? 0;
|
|
195
|
+
draw();
|
|
196
|
+
const sc = body.querySelector('.plan-scroll');
|
|
197
|
+
if (sc) sc.scrollTop = top;
|
|
198
|
+
}
|
|
199
|
+
body.addEventListener('focusout', () => setTimeout(() => pending && !typing() && render(), 0));
|
|
200
|
+
|
|
201
|
+
const run = async (fn, done) => {
|
|
202
|
+
try {
|
|
203
|
+
const r = await fn();
|
|
204
|
+
if (r && tab !== 'decisions') data[tab] = r;
|
|
205
|
+
if (done) toast?.(done, 2500);
|
|
206
|
+
} catch (e) {
|
|
207
|
+
toast?.(e.message, 6000);
|
|
208
|
+
}
|
|
209
|
+
document.activeElement?.blur?.();
|
|
210
|
+
if (tab === 'decisions') return load();
|
|
211
|
+
if (tab === 'dates') badge();
|
|
212
|
+
render();
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
body.addEventListener('submit', (e) => {
|
|
216
|
+
e.preventDefault();
|
|
217
|
+
const f = Object.fromEntries(new FormData(e.target));
|
|
218
|
+
if (e.target.matches('[data-plan-dates]')) {
|
|
219
|
+
const project = e.target.dataset.planDates || f.project;
|
|
220
|
+
if (!project) return toast?.('Pick a project', 3000);
|
|
221
|
+
adding = false;
|
|
222
|
+
return run(() => api('PUT', `/milestones/${encodeURIComponent(project)}`, { codeComplete: f.codeComplete || null, rc: f.rc || null, ga: f.ga || null }), 'Dates saved');
|
|
223
|
+
}
|
|
224
|
+
if (e.target.matches('[data-plan-decision]')) {
|
|
225
|
+
adding = false;
|
|
226
|
+
return run(() => api('POST', '/decisions', f), 'Added to the log');
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
let finding = null;
|
|
231
|
+
body.addEventListener('input', (e) => {
|
|
232
|
+
if (e.target.dataset.planFind === undefined) return;
|
|
233
|
+
filter.q = e.target.value;
|
|
234
|
+
clearTimeout(finding);
|
|
235
|
+
finding = setTimeout(() => load({ quiet: true }), 200);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
body.addEventListener('change', (e) => {
|
|
239
|
+
const c = e.target.dataset.planCheck;
|
|
240
|
+
if (c) {
|
|
241
|
+
const [project, stage, item] = c.split('|');
|
|
242
|
+
return run(() => api('POST', `/milestones/${encodeURIComponent(project)}/check`, { stage, item, done: e.target.checked }));
|
|
243
|
+
}
|
|
244
|
+
if (e.target.dataset.planProject !== undefined) {
|
|
245
|
+
filter.project = e.target.value;
|
|
246
|
+
e.target.blur();
|
|
247
|
+
load();
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
body.addEventListener('click', async (e) => {
|
|
252
|
+
const t = e.target.closest('[data-plan-tab]');
|
|
253
|
+
if (t) return show(t.dataset.planTab);
|
|
254
|
+
const ds = (name) => e.target.closest(`[data-plan-${name}]`)?.dataset;
|
|
255
|
+
const split = (v) => v.split('|');
|
|
256
|
+
if (ds('task')) {
|
|
257
|
+
const [project, stage, item] = split(ds('task').planTask);
|
|
258
|
+
return run(() => api('POST', `/milestones/${encodeURIComponent(project)}/task`, { stage, item }), "In the project's backlog: an agent picks it up");
|
|
259
|
+
}
|
|
260
|
+
if (ds('reach')) {
|
|
261
|
+
const [project, stage, on] = split(ds('reach').planReach);
|
|
262
|
+
return run(() => api('POST', `/milestones/${encodeURIComponent(project)}/reach`, { stage, reached: on === '1' }));
|
|
263
|
+
}
|
|
264
|
+
if (ds('go')) {
|
|
265
|
+
dialog.close();
|
|
266
|
+
return openTab(ds('go').planGo);
|
|
267
|
+
}
|
|
268
|
+
if (ds('agent')) {
|
|
269
|
+
dialog.close();
|
|
270
|
+
return openTab('agent', ds('agent').planAgent);
|
|
271
|
+
}
|
|
272
|
+
if (ds('remove')) return run(() => api('DELETE', `/decisions/${encodeURIComponent(ds('remove').planRemove)}`), 'Removed from the log');
|
|
273
|
+
if (ds('scan')) return run(() => api('POST', `/debt/${encodeURIComponent(ds('scan').planScan)}/scan`, {}), 'Scanning the repository');
|
|
274
|
+
if (ds('debt')) return run(() => api('POST', `/debt/${encodeURIComponent(ds('debt').planDebt)}/queue`, { file: ds('debt').file }), "In the project's backlog: an agent picks it up");
|
|
275
|
+
if (ds('notdebt')) return run(() => api('POST', `/debt/${encodeURIComponent(ds('notdebt').planNotdebt)}/dismiss`, { file: ds('notdebt').file }), 'Set aside');
|
|
276
|
+
const b = e.target.closest('[data-plan]')?.dataset.plan;
|
|
277
|
+
if (b === 'close') return dialog.close();
|
|
278
|
+
if (b === 'refresh') return load();
|
|
279
|
+
if (b === 'add') {
|
|
280
|
+
adding = !adding;
|
|
281
|
+
return draw();
|
|
282
|
+
}
|
|
283
|
+
if (b === 'copy') {
|
|
284
|
+
try {
|
|
285
|
+
const res = await fetch(`/api/decisions?format=markdown&project=${encodeURIComponent(filter.project)}`);
|
|
286
|
+
const ok = await navigator.clipboard?.writeText(await res.text()).then(() => true, () => false);
|
|
287
|
+
toast?.(ok ? 'The decision log is on the clipboard, as Markdown' : "Couldn't copy it", 3000);
|
|
288
|
+
} catch (err) {
|
|
289
|
+
toast?.(err.message, 5000);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
function show(next) {
|
|
295
|
+
tab = TABS.some(([k]) => k === next) ? next : 'dates';
|
|
296
|
+
adding = false;
|
|
297
|
+
try {
|
|
298
|
+
localStorage.setItem(SAVED, tab);
|
|
299
|
+
} catch {}
|
|
300
|
+
draw();
|
|
301
|
+
load();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function open(which) {
|
|
305
|
+
if (dialog.open && !which) return dialog.close();
|
|
306
|
+
if (!dialog.open) dialog.showModal();
|
|
307
|
+
show(which ?? tab);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
let again = null;
|
|
311
|
+
/** The daemon says something here changed: look again while open; the count now and then. */
|
|
312
|
+
function changed() {
|
|
313
|
+
clearTimeout(again);
|
|
314
|
+
again = setTimeout(() => {
|
|
315
|
+
if (dialog.open) load({ quiet: true });
|
|
316
|
+
else api('GET', '/milestones').then((v) => ((data.dates = v), badge()), () => {});
|
|
317
|
+
}, dialog.open ? 400 : 3000);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
expandable(dialog, draw);
|
|
321
|
+
api('GET', '/milestones').then((v) => ((data.dates = v), badge()), () => {});
|
|
322
|
+
return { open, changed, isOpen: () => dialog.open };
|
|
323
|
+
}
|