create-pmos 0.794.0 → 0.796.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/package.json +36 -34
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +35 -0
- package/workspace/guide/home.md +1 -1
- package/workspace/lib/card-rows-route.js +30 -4
- package/workspace/lib/launch-readiness.js +4 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/action-run.js +13 -2
- package/workspace/public/pm/chat-cards.js +35 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.796.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,41 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.796.0",
|
|
38
|
+
"at": "2026-11-24T21:11:47.859Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1820,
|
|
43
|
+
"t": "Milestone and initiative rows in Ask PMOS answers carry their buttons (job #1818)",
|
|
44
|
+
"s": "Milestone and initiative rows in Ask PMOS answers carry their buttons (job #1818)",
|
|
45
|
+
"k": "fix",
|
|
46
|
+
"try": {
|
|
47
|
+
"steps": [
|
|
48
|
+
"On Today, open Ask PMOS and ask: Which milestones are coming up? Press the diamond on a milestone row, then Undo.",
|
|
49
|
+
"Ask: Show me my top three initiatives.",
|
|
50
|
+
"Press the down arrow on the first row, then Undo."
|
|
51
|
+
],
|
|
52
|
+
"see": "the milestone row shows 'Back to a task: <title>.' with Undo, and Undo makes it a milestone again; the first initiative row has a down arrow but no up arrow; the down arrow moves it one place down…",
|
|
53
|
+
"open": "/today.html"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"v": "0.795.0",
|
|
60
|
+
"at": "2026-11-24T19:57:25.188Z",
|
|
61
|
+
"f": 4,
|
|
62
|
+
"prs": [
|
|
63
|
+
{
|
|
64
|
+
"n": 1810,
|
|
65
|
+
"t": "A launch check with no tracker reading is \"not checked\", never \"ready\" (job #1799, A172)",
|
|
66
|
+
"s": "A launch check with no tracker reading is \"not checked\", never \"ready\" (job #1799, A172)",
|
|
67
|
+
"k": "fix"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
},
|
|
36
71
|
{
|
|
37
72
|
"v": "0.794.0",
|
|
38
73
|
"at": "2026-11-24T19:46:34.647Z",
|
|
@@ -445,39 +480,6 @@
|
|
|
445
480
|
}
|
|
446
481
|
}
|
|
447
482
|
]
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
"v": "0.776.0",
|
|
451
|
-
"at": "2026-11-24T12:44:48.670Z",
|
|
452
|
-
"f": 4,
|
|
453
|
-
"prs": [
|
|
454
|
-
{
|
|
455
|
-
"n": 1739,
|
|
456
|
-
"t": "Release notes find a build's record when its PR names the initiative in prose",
|
|
457
|
-
"s": "Release notes find a build's record when its PR names the initiative in prose",
|
|
458
|
-
"k": "fix",
|
|
459
|
-
"h": "Release notes find a build's record when its PR names the initiative in prose"
|
|
460
|
-
},
|
|
461
|
-
{
|
|
462
|
-
"n": 1737,
|
|
463
|
-
"t": "PMOS drafts each product's five-line strategy from its own files",
|
|
464
|
-
"s": "PMOS drafts each product's five-line strategy from its own files",
|
|
465
|
-
"k": "new"
|
|
466
|
-
}
|
|
467
|
-
]
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
"v": "0.775.0",
|
|
471
|
-
"at": "2026-11-24T10:49:49.601Z",
|
|
472
|
-
"f": 4,
|
|
473
|
-
"prs": [
|
|
474
|
-
{
|
|
475
|
-
"n": 1736,
|
|
476
|
-
"t": "The Line tab reads as a table",
|
|
477
|
-
"s": "The Line tab reads as a table",
|
|
478
|
-
"k": "fix"
|
|
479
|
-
}
|
|
480
|
-
]
|
|
481
483
|
}
|
|
482
484
|
]
|
|
483
485
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T21:11:44Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T21:11:44Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T21:11:44Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.796.0",
|
|
4
|
+
"at": "2026-11-24T21:11:47.859Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1820,
|
|
9
|
+
"t": "Milestone and initiative rows in Ask PMOS answers carry their buttons (job #1818)",
|
|
10
|
+
"s": "Milestone and initiative rows in Ask PMOS answers carry their buttons (job #1818)",
|
|
11
|
+
"k": "fix",
|
|
12
|
+
"try": {
|
|
13
|
+
"steps": [
|
|
14
|
+
"On Today, open Ask PMOS and ask: Which milestones are coming up? Press the diamond on a milestone row, then Undo.",
|
|
15
|
+
"Ask: Show me my top three initiatives.",
|
|
16
|
+
"Press the down arrow on the first row, then Undo."
|
|
17
|
+
],
|
|
18
|
+
"see": "the milestone row shows 'Back to a task: <title>.' with Undo, and Undo makes it a milestone again; the first initiative row has a down arrow but no up arrow; the down arrow moves it one place down…",
|
|
19
|
+
"open": "/today.html"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"v": "0.795.0",
|
|
26
|
+
"at": "2026-11-24T19:57:25.188Z",
|
|
27
|
+
"f": 4,
|
|
28
|
+
"prs": [
|
|
29
|
+
{
|
|
30
|
+
"n": 1810,
|
|
31
|
+
"t": "A launch check with no tracker reading is \"not checked\", never \"ready\" (job #1799, A172)",
|
|
32
|
+
"s": "A launch check with no tracker reading is \"not checked\", never \"ready\" (job #1799, A172)",
|
|
33
|
+
"k": "fix"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
2
37
|
{
|
|
3
38
|
"v": "0.794.0",
|
|
4
39
|
"at": "2026-11-24T19:46:34.647Z",
|
package/workspace/guide/home.md
CHANGED
|
@@ -160,7 +160,7 @@ Press the name in the Viewer's header. The name becomes a field.
|
|
|
160
160
|
|
|
161
161
|
- Type the new name. Press Enter or the check to save it. Press Esc to stop without a change. An empty name is not saved.
|
|
162
162
|
- The new name shows at once in the list, the chat header, the Viewer, Work and the Timeline. The message **Renamed** has **Undo**.
|
|
163
|
-
- **Rows and pickers in the chat.** When PMOS names tasks or an initiative in its answer, the chat shows them as the rows Work shows, live, with their buttons
|
|
163
|
+
- **Rows and pickers in the chat.** When PMOS names tasks or an initiative in its answer, the chat shows them as the rows Work shows, live, with their buttons, each with **Undo**: ✓ marks a task done, ◇ makes a milestone a task again, and the arrows move an initiative up or down the Roadmap (the top one has no up arrow, the last one no down arrow). It shows the first 5 and **All N on Work**. A task that is gone shows "was not found", and PMOS's words above stay. When PMOS needs you to choose a value, such as a new due date or an owner, it shows one picker per value with its recommended choice set (✦). One press makes the change, and **Undo** puts it back. A row shows only the parts that have a value: a task with no owner or no due date shows no empty place for it. PMOS notes which kinds and ids each answer showed, which were not found and which buttons you pressed, and each ✦ draft with its ✓ or ✕, in the local use log on this computer. It notes no titles and none of your words. Nothing is sent anywhere.
|
|
164
164
|
- **A change from the chat shows at once.** When you ask the chat to add, move, close or delete a task, the row changes on Today, Work and an open task popup within a second, without the page reading its lists again. A change you make in one tab of the workspace shows in its other open tabs as soon as it is saved. A change that is not saved does not show in the other tabs. A published read-only Board does not follow these changes: it shows the board as it was published.
|
|
165
165
|
- An initiative of another product renames in that product's own repository, the same as on Work.
|
|
166
166
|
- Only the name changes. The id, the record file, the links and the history stay the same.
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* routes-slash.js beside #1746's routes, so it is not named routes-*.js (d86-seams 7: every routes-*.js is a route-modules entry).
|
|
4
4
|
*
|
|
5
5
|
* GET /api/card-rows?ws=<id>&kind=task|subtask|milestone|initiative&ids=a,b,c
|
|
6
|
-
* → { ok, rows: [{ id, kind, found, title, who, due, start, state, board, initiative, stage }] } at most 5 ids; an id that is
|
|
7
|
-
* on a board of the workspace comes back { id, found: false }
|
|
6
|
+
* → { ok, rows: [{ id, kind, found, title, who, due, start, state, board, initiative, stage, rank? }] } at most 5 ids; an id that is
|
|
7
|
+
* not on a board of the workspace comes back { id, found: false }
|
|
8
|
+
* rank (initiative rows on the Roadmap, job #1818): { up?, down?, back } — the initiative each move ranks it right after (null = the
|
|
9
|
+
* top), as `pmos initiative up|down` computes it; `up` is left out at the top and `down` at the end; `back` is where it is now (Undo)
|
|
8
10
|
*
|
|
9
11
|
* Read only. The chat draws these rows with the card catalog's buttons (public/pm/chat-cards.js); a button writes through the page's own
|
|
10
12
|
* routes (public/pm/action-run.js), never this one. */
|
|
@@ -24,13 +26,35 @@ function taskRows(ctx, w, ids) {
|
|
|
24
26
|
return ids.map((id) => {
|
|
25
27
|
const t = B.taskOf(folded, id);
|
|
26
28
|
if (!t) return { id, found: false };
|
|
27
|
-
|
|
29
|
+
// the PM's milestone flag is a ledger line of its own (scripts/boards.js task-milestone), folded into `milestones`, not a task field
|
|
30
|
+
const ms = (folded.milestones && folded.milestones.get(id) === true) || t.milestone === true;
|
|
31
|
+
return { id, kind: ms ? 'milestone' : t.parent ? 'subtask' : 'task', found: true, title: t.title || id, who: whoOf(t.owner), due: day(t.due),
|
|
28
32
|
start: day(t.start), state: t.state || 'To do', board: t.board || null, initiative: t.initiative || null };
|
|
29
33
|
});
|
|
30
34
|
}
|
|
31
35
|
|
|
36
|
+
/** The one Roadmap order (D105), read as `pmos initiative up|down` reads it. [] when it cannot be read: the rows then draw no move. */
|
|
37
|
+
function rankedOf(root) {
|
|
38
|
+
try {
|
|
39
|
+
const d = require('./initiative-rows.js').deriveSync(root);
|
|
40
|
+
if (!d.ok) return [];
|
|
41
|
+
const placed = require('./placements.js').readPlacements(root, { now: Date.now(), rules: require('./plan-rules.js').readRules(root), records: d.rows });
|
|
42
|
+
return Array.isArray(placed.ranked) ? placed.ranked : [];
|
|
43
|
+
} catch { return []; }
|
|
44
|
+
}
|
|
45
|
+
/** Where Move up and Move down put an initiative: the id it then comes right after (null = the top). PURE */
|
|
46
|
+
function rankOf(list, id) {
|
|
47
|
+
const i = list.indexOf(id);
|
|
48
|
+
if (i < 0) return null;
|
|
49
|
+
const r = { back: i > 0 ? list[i - 1] : null };
|
|
50
|
+
if (i > 0) r.up = i === 1 ? null : list[i - 2];
|
|
51
|
+
if (i < list.length - 1) r.down = list[i + 1];
|
|
52
|
+
return r;
|
|
53
|
+
}
|
|
54
|
+
|
|
32
55
|
function initiativeRows(ctx, w, ids) {
|
|
33
56
|
const boards = require('./routes-boards.js');
|
|
57
|
+
let list = null;
|
|
34
58
|
return ids.map((id) => {
|
|
35
59
|
let r = boards.initiativeWorkflow(ctx, w, id);
|
|
36
60
|
// the rows are still being derived (a fresh process): derive them now, as `pmos task` does
|
|
@@ -39,7 +63,8 @@ function initiativeRows(ctx, w, ids) {
|
|
|
39
63
|
const row = r.row;
|
|
40
64
|
const stage = row.stageName || (row.wf && row.wf.stage && row.wf.stage.name) || row.stage || '';
|
|
41
65
|
return { id, kind: 'initiative', found: true, title: row.title || id, who: row.owner || '', due: day(row.due || row.target || ''), state: row.state || '',
|
|
42
|
-
stage: typeof stage === 'string' ? stage : '', board: (r.board && r.board.id) || null, initiative: id
|
|
66
|
+
stage: typeof stage === 'string' ? stage : '', board: (r.board && r.board.id) || null, initiative: id,
|
|
67
|
+
...(() => { if (!list) list = rankedOf(w.root); const k = rankOf(list, id); return k ? { rank: k } : {}; })() };
|
|
43
68
|
});
|
|
44
69
|
}
|
|
45
70
|
|
|
@@ -60,5 +85,6 @@ module.exports = {
|
|
|
60
85
|
return true;
|
|
61
86
|
},
|
|
62
87
|
taskRows,
|
|
88
|
+
rankOf,
|
|
63
89
|
initiativeRows,
|
|
64
90
|
};
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* gaps [{ ticket, n, q }] open questions the ticket dry-run found, when present
|
|
15
15
|
* read(root, ini, o) → { input, launch, title } | { error } the I/O: reads the records above, writes nothing.
|
|
16
16
|
*
|
|
17
|
-
* THE RESULT: { launch, daysLeft, verdict: 'ready' | 'at risk' | 'no data', counts, items: [{ kind, id, title, why, who? }], notes: [line] }.
|
|
17
|
+
* THE RESULT: { launch, daysLeft, verdict: 'ready' | 'at risk' | 'not checked' (no tracker reading, nothing else open) | 'no data', counts, items: [{ kind, id, title, why, who? }], notes: [line] }.
|
|
18
18
|
* kind: task | ticket | signoff | question. A reading is never counted as ready by default: no tasks and no tickets is 'no data', a
|
|
19
19
|
* tracker reading older than `staleDays` adds a note with its age, and a product with no sign-off record says so. Nothing writes. */
|
|
20
20
|
|
|
@@ -115,7 +115,8 @@ function check(input = {}, { launch, launchTask = '', today, idleDays = IDLE_DAY
|
|
|
115
115
|
signoffs: items.filter((x) => x.kind === 'signoff').length,
|
|
116
116
|
questions: items.filter((x) => x.kind === 'question').length,
|
|
117
117
|
};
|
|
118
|
-
|
|
118
|
+
// no tracker reading is never ready (done test C3): nothing open may only mean the tickets were not read
|
|
119
|
+
const verdict = !tasks.length && !nTickets ? 'no data' : items.length ? 'at risk' : !tracker ? 'not checked' : 'ready';
|
|
119
120
|
return { launch: L || null, daysLeft: L ? days(t0, L) : null, today: t0, verdict, counts, items, notes };
|
|
120
121
|
}
|
|
121
122
|
|
|
@@ -123,7 +124,7 @@ function check(input = {}, { launch, launchTask = '', today, idleDays = IDLE_DAY
|
|
|
123
124
|
function render(res, { title = '', id = '', launchFrom } = {}) {
|
|
124
125
|
const name = title || id;
|
|
125
126
|
const when = res.daysLeft == null ? '' : res.daysLeft < 0 ? `${plural(-res.daysLeft, 'day', 'days')} ago` : res.daysLeft === 0 ? 'today' : `in ${plural(res.daysLeft, 'day', 'days')}`;
|
|
126
|
-
const head = `${name}: launch ${res.launch}${when ? ' (' + when + ')' : ''}${launchFrom ? ', from ' + launchFrom : ''}. ${res.verdict === 'ready' ? 'Ready: nothing open.' : res.verdict === 'no data' ? 'No data: no task and no tracker ticket.' : 'At risk: ' + plural(res.items.length, 'item is', 'items are') + ' not ready.'}`;
|
|
127
|
+
const head = `${name}: launch ${res.launch}${when ? ' (' + when + ')' : ''}${launchFrom ? ', from ' + launchFrom : ''}. ${res.verdict === 'ready' ? 'Ready: nothing open.' : res.verdict === 'no data' ? 'No data: no task and no tracker ticket.' : res.verdict === 'not checked' ? 'Not checked: no tracker reading, so the tickets are not counted.' : 'At risk: ' + plural(res.items.length, 'item is', 'items are') + ' not ready.'}`;
|
|
127
128
|
const out = [head];
|
|
128
129
|
const c = res.counts;
|
|
129
130
|
// zero is silence: a part with nothing in it is left out
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.796.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.796.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -22,6 +22,11 @@ const STATE = { 'to do': 'To do', todo: 'To do', 'in progress': 'In progress', d
|
|
|
22
22
|
const stateOf = (s) => STATE[String(s || '').trim().toLowerCase()] || String(s || '');
|
|
23
23
|
const clean = (s) => String(s == null ? '' : s).replace(/^"|"$/g, '');
|
|
24
24
|
|
|
25
|
+
const RANK = {
|
|
26
|
+
post: (f, p, a) => ['/api/placements', { events: [{ ev: 'ranked', initiative: p[0], after: a.after == null ? null : String(a.after) }] }],
|
|
27
|
+
undo: (r, b, a) => ['/api/placements', { events: [{ ev: 'ranked', initiative: b.events[0].initiative, after: a.back == null ? null : String(a.back) }] }],
|
|
28
|
+
};
|
|
29
|
+
|
|
25
30
|
/** The task family: what each "pmos task <sub>" sends, and how Undo puts it back. f: the filled flags, p: the positionals, a: the args. */
|
|
26
31
|
const ROUTES = {
|
|
27
32
|
'task set': {
|
|
@@ -29,6 +34,7 @@ const ROUTES = {
|
|
|
29
34
|
const b = { task: p[0] };
|
|
30
35
|
for (const k of ['due', 'start', 'owner', 'notes', 'description']) if (f[k] !== undefined) b[k] = f[k] === true ? '' : String(f[k]);
|
|
31
36
|
if (f.milestone !== undefined) b.milestone = f.milestone === true ? true : f.milestone !== 'false';
|
|
37
|
+
if (f['no-milestone'] !== undefined) b.milestone = false; // a milestone's Back to a task
|
|
32
38
|
if (f.pin !== undefined) b.pinned = f.pin === true ? true : f.pin !== 'false';
|
|
33
39
|
return ['/api/boards/tasks/edit', b];
|
|
34
40
|
},
|
|
@@ -47,9 +53,14 @@ const ROUTES = {
|
|
|
47
53
|
undo: (r, b) => ['/api/boards/tasks/restore', { task: b.task }],
|
|
48
54
|
},
|
|
49
55
|
'task comment': { post: (f, p) => ['/api/boards/tasks/comment', { task: p[0], text: String(p[1] || '') }], deferred: true },
|
|
56
|
+
// Move up and Move down on the Roadmap (job #1818): the row names where each move puts it (lib/card-rows-route.js rank), as
|
|
57
|
+
// `pmos initiative up|down` computes it; Undo ranks it after the one it came after before
|
|
58
|
+
'initiative up': RANK,
|
|
59
|
+
'initiative down': RANK,
|
|
50
60
|
};
|
|
51
61
|
const FIELD = { 'task set': (b) => ['due', 'start', 'owner', 'notes', 'description', 'milestone', 'pinned'].find((k) => k in b) || 'task',
|
|
52
|
-
'task state': () => 'state', 'task add': () => 'task', 'task remove': () => 'removed', 'task comment': () => 'comment'
|
|
62
|
+
'task state': () => 'state', 'task add': () => 'task', 'task remove': () => 'removed', 'task comment': () => 'comment',
|
|
63
|
+
'initiative up': () => 'rank', 'initiative down': () => 'rank' };
|
|
53
64
|
|
|
54
65
|
export function routeOf(run) {
|
|
55
66
|
const c = parseRun(run);
|
|
@@ -110,7 +121,7 @@ export async function runAction(o = {}, { pmPost, catalog } = {}) {
|
|
|
110
121
|
const res = await pmPost(route, body).catch(() => null);
|
|
111
122
|
if (!res || res.ok === false) return { ok: false, error: (res && res.error) || 'The change did not land.' };
|
|
112
123
|
tell({ kind: o.kind, id: o.id, field, value, undo: false });
|
|
113
|
-
const back = R.undo ? R.undo(res, body, { was: o.was }) : null;
|
|
124
|
+
const back = R.undo ? R.undo(res, body, { ...args, was: o.was }) : null;
|
|
114
125
|
return { ok: true, said: act.label + ' done.', field, value, result: res,
|
|
115
126
|
undo: back ? async () => {
|
|
116
127
|
const u = await pmPost(back[0], { ws: o.ws, board: o.board, ...back[1] }).catch(() => null);
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
* A wrong or closed id draws "<id> was not found" under the rows; PMOS's words above stay as they were. */
|
|
24
24
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
25
25
|
const SVG = (d) => `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
26
|
-
const ICON = { done: 'M5 12.5l4.5 4.5L19 7.5', go: 'M5 12.5l4.5 4.5L19 7.5', undo: 'M4 12a8 8 0 1 0 2.3-5.6M4 4v4.5h4.5'
|
|
26
|
+
const ICON = { done: 'M5 12.5l4.5 4.5L19 7.5', go: 'M5 12.5l4.5 4.5L19 7.5', undo: 'M4 12a8 8 0 1 0 2.3-5.6M4 4v4.5h4.5',
|
|
27
|
+
diamond: 'M12 3l9 9-9 9-9-9z', up: 'M6 15l6-6 6 6', down: 'M6 9l6 6 6-6' };
|
|
27
28
|
|
|
28
29
|
export const MAX_ROWS = 5;
|
|
29
30
|
export const MAX_FIELDS = 2;
|
|
@@ -102,7 +103,7 @@ function rowHtml(r, key, i, o) {
|
|
|
102
103
|
// never a blank part (card catalog rule 8, A511): a field with no value is left out, a row with no buttons has no buttons part
|
|
103
104
|
const bits = [r.who || '', r.due ? 'due ' + dayText(r.due) : '', r.stage || '', r.note || ''].filter(Boolean);
|
|
104
105
|
const badge = r.late ? `<span class="cc-badge late">${esc(r.late)}</span>` : BADGE[r.state] ? `<span class="cc-badge">${esc(BADGE[r.state])}</span>` : '';
|
|
105
|
-
const acts = (o.buttons || []).filter((a) =>
|
|
106
|
+
const acts = (o.buttons || []).filter((a) => canPress(a, r)).map((a) => `<button type="button" class="hm-icb" data-cc-act="${esc(key)}|${i}|${esc(a.label)}" aria-label="${esc(a.label + ': ' + r.title)}" title="${esc(a.label)}"${o.live === false ? ' disabled' : ''}>${SVG(ICON[a.icon] || ICON.done)}</button>`).join('');
|
|
106
107
|
const did = o.did && o.did[r.id];
|
|
107
108
|
const doneLine = did ? `<p class="cc-did" role="status">${esc(did.said)}${did.undo ? ` <button type="button" class="hm-undo" data-cc-undo="${esc(key)}|${esc(r.id)}">Undo</button>` : ''}</p>` : '';
|
|
108
109
|
return `<li class="cc-row" data-cc-id="${esc(r.id)}"><div class="cc-t"><b>${esc(r.title || r.id)}</b>${bits.length ? `<span>${esc(bits.join(' · '))}</span>` : ''}${doneLine}</div>${badge}${acts ? `<span class="cc-acts">${acts}</span>` : ''}</li>`;
|
|
@@ -150,13 +151,37 @@ export function saidOf(label, title, args) {
|
|
|
150
151
|
if (args.start) parts.push('start ' + dayText(args.start));
|
|
151
152
|
if (args.owner) parts.push('owner ' + args.owner);
|
|
152
153
|
if (args.to) parts.push(String(args.to));
|
|
153
|
-
const verb = label === 'Mark done' ? 'Done:' : /date/i.test(label) ? 'Moved' : label + ':';
|
|
154
|
+
const verb = label === 'Mark done' ? 'Done:' : /date/i.test(label) ? 'Moved' : /^Move (up|down)$/.test(label) ? label.replace('Move', 'Moved') + ':' : label + ':';
|
|
154
155
|
return `${verb} ${title}${parts.length ? (verb === 'Moved' ? ' ' : ', ') + parts.join(', ') : ''}.`;
|
|
155
156
|
}
|
|
156
157
|
|
|
157
|
-
/** The
|
|
158
|
+
/** The catalog button each kind's rows show (job #1818). A button that needs a value (a date, a person, a stage) goes to a picker. */
|
|
159
|
+
export const ROW_BUTTONS = Object.freeze({ task: ['Mark done'], subtask: ['Mark done'], milestone: ['Back to a task'], initiative: ['Move up / down'] });
|
|
160
|
+
// a button whose command is "up|down" is two presses, one per word
|
|
161
|
+
const ALT = { up: 'Move up', down: 'Move down', top: 'Move to top', bottom: 'Move to bottom' };
|
|
162
|
+
|
|
163
|
+
/** The buttons a row shows: the kind's ROW_BUTTONS from the catalog that the page can run with no value to pick. "pmos initiative up|down
|
|
164
|
+
* <id>" gives two buttons, Move up (pmos initiative up <id>) and Move down. Never a button the page has no route for. */
|
|
158
165
|
export function rowButtons(catalog, kind, routeOf) {
|
|
159
|
-
|
|
166
|
+
const out = [];
|
|
167
|
+
for (const a of actionsOf(catalog, kind)) {
|
|
168
|
+
if (!(ROW_BUTTONS[kind] || []).includes(a.label) || a.who !== 'you' || a.field || !a.run) continue;
|
|
169
|
+
const sub = (String(a.run).trim().split(/\s+/)[2]) || '';
|
|
170
|
+
const alts = sub.includes('|') ? sub.split('|') : [null];
|
|
171
|
+
for (const x of alts) {
|
|
172
|
+
const b = x ? { ...a, label: ALT[x] || x, run: a.run.replace(sub, x), icon: x } : a;
|
|
173
|
+
if (routeOf(b.run)) out.push(b);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
/** Can this row take the press? Done takes no Mark done; the top of the Roadmap takes no Move up, its end no Move down. */
|
|
179
|
+
function canPress(a, r) {
|
|
180
|
+
if (a.label === 'Mark done') return r.state !== 'Done';
|
|
181
|
+
if (a.label === 'Back to a task') return r.kind !== 'task';
|
|
182
|
+
if (a.label === 'Move up') return !!r.rank && 'up' in r.rank;
|
|
183
|
+
if (a.label === 'Move down') return !!r.rank && 'down' in r.rank;
|
|
184
|
+
return true;
|
|
160
185
|
}
|
|
161
186
|
|
|
162
187
|
/** The chat's part. host: { pmGet, pmPost, toast, ws: () => id, redraw, runAction, routeOf }. */
|
|
@@ -234,8 +259,10 @@ export function cardsUi(host) {
|
|
|
234
259
|
if (!row) return true;
|
|
235
260
|
b.disabled = true;
|
|
236
261
|
told(ck, { pressed: [label] });
|
|
237
|
-
const
|
|
238
|
-
|
|
262
|
+
const act = (host.routeOf ? rowButtons(S.catalog, spec.kind, host.routeOf) : []).find((a) => a.label === label) || label;
|
|
263
|
+
const args = label === 'Move up' || label === 'Move down' ? { after: row.rank && row.rank[label === 'Move up' ? 'up' : 'down'], back: row.rank && row.rank.back } : {};
|
|
264
|
+
const r = await host.runAction({ kind: spec.kind, action: act, id, args, was: row.state, ws: host.ws && host.ws(), board: row.board }, { pmPost: host.pmPost, catalog: S.catalog });
|
|
265
|
+
if (r && r.ok) { S.did.set(ck + '|' + id, { said: saidOf(label, row.title, {}), undo: r.undo }); if (spec.kind === 'initiative') S.rows.delete(rowsKey(spec)); } // a move changes every row's place: read them again
|
|
239
266
|
else if (host.toast) host.toast((r && (r.error || r.said || r.ask)) || 'Not saved.');
|
|
240
267
|
b.disabled = false; host.redraw(); return true;
|
|
241
268
|
}
|
|
@@ -244,7 +271,7 @@ export function cardsUi(host) {
|
|
|
244
271
|
const did = S.did.get(k + '|' + id); if (!did || !did.undo) return true;
|
|
245
272
|
b.disabled = true;
|
|
246
273
|
const u = await did.undo();
|
|
247
|
-
if (u && u.ok !== false) S.did.delete(k + '|' + id); else if (host.toast) host.toast((u && u.error) || 'The undo did not land.');
|
|
274
|
+
if (u && u.ok !== false) { S.did.delete(k + '|' + id); const sp = ui.specOf(k); if (sp && sp.kind === 'initiative') S.rows.delete(rowsKey(sp)); } else if (host.toast) host.toast((u && u.error) || 'The undo did not land.');
|
|
248
275
|
host.redraw(); return true;
|
|
249
276
|
}
|
|
250
277
|
return false;
|