create-pmos 0.650.0 → 0.652.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.650.0",
3
+ "version": "0.652.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,32 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.652.0",
38
+ "at": "2026-11-20T09:04:15.002Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1434,
43
+ "t": "A done merge resolves its ✦, merged artefacts fold the old files, stage bars follow task dates",
44
+ "s": "A done merge resolves its ✦, merged artefacts fold the old files, stage bars follow task dates",
45
+ "k": "fix"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.651.0",
51
+ "at": "2026-11-20T07:19:20.677Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1433,
56
+ "t": "Quick edit in a row and full popups for a task and a milestone",
57
+ "s": "Quick edit in a row and full popups for a task and a milestone",
58
+ "k": "new"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.650.0",
38
64
  "at": "2026-11-20T06:52:20.858Z",
@@ -284,38 +310,6 @@
284
310
  "k": "fix"
285
311
  }
286
312
  ]
287
- },
288
- {
289
- "v": "0.627.0",
290
- "at": "2026-11-19T06:18:29.854Z",
291
- "f": 4,
292
- "prs": [
293
- {
294
- "n": 1408,
295
- "t": "Sprint band layout and theme names",
296
- "s": "Sprint band layout and theme names",
297
- "k": "fix"
298
- }
299
- ]
300
- },
301
- {
302
- "v": "0.626.0",
303
- "at": "2026-11-19T05:42:19.332Z",
304
- "f": 4,
305
- "prs": [
306
- {
307
- "n": 1406,
308
- "t": "One product-name rule for desk and shared copy; no raw report ids on Events",
309
- "s": "One product-name rule for desk and shared copy; no raw report ids on Events",
310
- "k": "fix"
311
- },
312
- {
313
- "n": 1407,
314
- "t": "Sprint overview on Work > Backlog > This sprint",
315
- "s": "Sprint overview on Work > Backlog > This sprint",
316
- "k": "new"
317
- }
318
- ]
319
313
  }
320
314
  ]
321
315
  }
package/payload/AGENTS.md CHANGED
@@ -106,6 +106,13 @@ If `pmos/mods` is installed in Claude Code, it guards the session. A hand-write
106
106
  - **A human building instead of an agent?** Same loop, plain terms: [AGENTS-HUMAN.md](AGENTS-HUMAN.md). State is written with `scripts/pmos-log.sh` (validated, append-only) — never hand-edited. Mixed human+agent teams write the same state through the same conventions.
107
107
  - **An initiative spanning multiple repos?** ONE repo is its **home** — the initiative record, brief/PRD, rubric, and state live there. Every sibling repo's PR anchors by declaring `Initiative: <id>` in the PR body (the gate's body-key path); records land in the home state layer. There is no cross-repo registry — the body key IS the join. **Sibling repos either do not install the pmos gate, or mirror the initiative file locally** — a vendored sibling gate fails closed on a missing local record by design (S5 Review Gate finding).
108
108
 
109
+ ## The PMOS popup: act on the files, never send the PM to a button
110
+
111
+ The PM talks to you from an initiative's popup in the workspace. PMOS acts by itself and the PM approves through the ✦ lines. When the PM asks for something the popup shows, change the file the popup reads. Do not tell the PM to press a button, and do not say you cannot when a file change does it.
112
+
113
+ - **The merge ✦ ("7 references and 2 retros can each be one artefact. Merge them?").** The popup derives it from the files: it shows while several different files of one kind belong to the initiative. When you merge files, put `superseded_by: <path of the merged file>` in the frontmatter of each old file. The Artefacts list then shows the merged file, folds each old file under it as an earlier version, and the ✦ goes away by itself. Delete nothing.
114
+ - **A stage's dates on the timeline.** A stage's bar runs from the earliest start to the latest end of its tasks (a task with no start counts from its due date). To change a stage's dates, change the dates of its tasks, with the PM's yes. Do not edit the workflow history to move a bar.
115
+
109
116
  ## Decomposing an initiative into tickets (file mode has no board)
110
117
 
111
118
  When an initiative is bigger than one run, break it into **tickets** — the plain-file equivalent of the hosted product's SDLC board. One file per ticket in `pmos/state/tickets/NNN-slug.md`, numbered in **dependency order**, from [templates/ticket-template.md](templates/ticket-template.md):
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@efc39439
1
+ kernel-source: pmos@93e27535
2
2
  assembled: 2026-11-20
3
3
  mode: vendor
@@ -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-20T06:52:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-20T09:04:11Z"}
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-20T06:52:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-20T09:04:11Z"}
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-20T06:52:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-20T09:04:11Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.652.0",
4
+ "at": "2026-11-20T09:04:15.002Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1434,
9
+ "t": "A done merge resolves its ✦, merged artefacts fold the old files, stage bars follow task dates",
10
+ "s": "A done merge resolves its ✦, merged artefacts fold the old files, stage bars follow task dates",
11
+ "k": "fix"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.651.0",
17
+ "at": "2026-11-20T07:19:20.677Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1433,
22
+ "t": "Quick edit in a row and full popups for a task and a milestone",
23
+ "s": "Quick edit in a row and full popups for a task and a milestone",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.650.0",
4
30
  "at": "2026-11-20T06:52:20.858Z",
@@ -140,13 +140,15 @@ On a computer the popup is built from the parts of the PMOS design system. The t
140
140
  The left column has three blocks:
141
141
 
142
142
  - **Where it stands.** What is happening, in a few sentences. Then **Next**: the next three dates, a milestone as a diamond and the outcome check as a circle; press a milestone to open it. Then one suggestion from PMOS with **Why**, **PMOS will** and **Based on**. The pencil opens it so you can change it first, ✓ does it and ✕ drops it. Other suggestions are one link under it.
143
- - **Stages.** Each stage of the workflow, with its dates under its name or "no dates yet", on a month scale with a red line for today. A stage has a bar only when it has real dates. A milestone is a diamond on its stage's row.
144
- - **Work breakdown.** **List** or **Gantt**; PMOS keeps your choice on this computer. **List** has one box on top: type a task and press Enter. Say its stage ("… in Plan"), or it goes to the stage in progress; start with ◇ to add a milestone. Each stage with tasks is one group that says how much is done, for example "1 of 3 done". A done task stays in its stage, in grey with a check. Stages with no tasks fold into one line at the end. Press the box before a task to change its status, its name to rename it, and the rest of the row to open it; ↗ and ⋯ show when you point at the row. **Gantt** is the table described below, with its bars.
143
+ - **Stages.** Each stage of the workflow, with its dates under its name or "no dates yet", on a month scale with a red line for today. A stage's bar runs from the earliest start to the latest end of its tasks; a task with no start counts from its due date. Only a stage with no dated task uses the days the workflow moved through it. To change a stage's dates, change its tasks' dates. A stage has a bar only when it has real dates. A milestone is a diamond on its stage's row.
144
+ - **Work breakdown.** **List** or **Gantt**; PMOS keeps your choice on this computer. **List** has one box on top: type a task and press Enter. Say its stage ("… in Plan"), or it goes to the stage in progress; start with ◇ to add a milestone. Each stage with tasks is one group that says how much is done, for example "1 of 3 done". A done task stays in its stage, in grey with a check. Stages with no tasks fold into one line at the end. Press the box before a task to mark it done, with **Undo**. Press its name to rename it: Enter saves and Escape cancels. When you point at the row, four icons show: **Who** (You, the people on this initiative, or **PMOS does it**, which gives the task to PMOS), **Due date**, **Stage** (moves the task to another stage) and ⋯ (**Status**, **Make it a milestone** and **Open the task**). Each change has **Undo**. A Jira ticket keeps its owner and stage from Jira. **Gantt** is the table described below, with its bars.
145
+
146
+ Press the rest of a row, or a milestone, to open it as a full popup in place of the work side. Its top line has ←, the path (**Work › product › initiative**), the chat button, ⋯ and ×. ← or the initiative's name goes back to the initiative, where you left it. The chat button shows **Ask PMOS** beside it. × closes the popup. A task shows its status, dates, owner, notes and what changed. A milestone also shows its date and how many days are left, the done test, **Kill if**, and the suggestion from PMOS about it when there is one.
145
147
 
146
148
  The right column has two blocks:
147
149
 
148
150
  - **The case.** **Problem**, **Goal** and **Done when** from the initiative's records, then its facts (status, dates, the next milestone, goal, product, program, workflow and what is open). Press a line to change it. A line not written offers a PMOS draft (✦) or ✕. When no line is written yet, one suggestion offers to draft them all from what is linked: ✓ sends the request to the chat, ✕ says not this, and the pencil lets you write it yourself.
149
- - **Artefacts.** The brief, the prototype and the documents, each with its kind and date. A document the gate needs that nobody wrote is grey and says which gate. + adds a file, a link or a new document.
151
+ - **Artefacts.** The brief, the prototype and the documents, each with its kind and date. A document the gate needs that nobody wrote is grey and says which gate. + adds a file, a link or a new document. After a merge, the merged file stands and says how many earlier files it holds, for example "7 earlier". An old file folds under it when its frontmatter has `superseded_by:` with the merged file's path, or when it opens with the merge's "superseded by" note. The merge suggestion then goes away by itself.
150
152
 
151
153
  On a phone, in a shared read-only copy and in a breakdown given the whole popup, the work side keeps the three parts below. They use the full width of the popup: in a wide popup the timeline gets the extra width. A done task shows in grey text, never struck through.
152
154
 
@@ -132,7 +132,7 @@ const cache = new Map(); // root -> { key, value }
132
132
  * The library of one repository.
133
133
  * owners: () => Map path → { id, title } — the library's own attribution (server.js initiativeIndex), real initiatives
134
134
  * only. It is called only when the repository state changed, because the index reads every planning file.
135
- * Returns { ok, files: [{path,title,category,date,initiative,status,type,by}], initiatives: {id: {title, short}}, kinds, edges: [[from, to, kind]], categories }.
135
+ * Returns { ok, files: [{path,title,category,date,initiative,status,type,by,supersededBy}], initiatives: {id: {title, short}}, kinds, edges: [[from, to, kind]], categories }.
136
136
  * `from` and `to` index `files`; `kind` indexes `kinds`.
137
137
  */
138
138
  function library(root, { stateDir, owners = () => new Map() } = {}) {
@@ -164,7 +164,7 @@ function library(root, { stateDir, owners = () => new Map() } = {}) {
164
164
  const o = own.get(n.id) || null;
165
165
  if (o && !initiatives[o.id]) initiatives[o.id] = { title: named(o), short: shortTitle(named(o)) };
166
166
  return { path: n.id, title: String(n.title || n.id), category: categoryOf(n.id, n.type), date: dayOf(n.id), initiative: o ? o.id : null, status: n.status ? String(n.status) : null,
167
- type: n.type ? String(n.type) : null, by: byOfPath(n.id, n) };
167
+ type: n.type ? String(n.type) : null, by: byOfPath(n.id, n), supersededBy: n.superseded_by || null };
168
168
  });
169
169
  const index = new Map(files.map((f, i) => [f.path, i]));
170
170
  const seen = new Set();
@@ -43,7 +43,7 @@ function cacheKey(root) {
43
43
  const dirty = git(root, ['status', '--porcelain', '-z', '--untracked-files=no']).split('\0').filter(Boolean)
44
44
  .map((l) => l.slice(3)).filter((p) => /\.md$/.test(p)).sort()
45
45
  .map((p) => { try { return p + ':' + fs.statSync(path.join(root, p)).mtimeMs; } catch { return p + ':gone'; } });
46
- return crypto.createHash('sha1').update('kg-v2-category\n' + head + '\n' + dirty.join('\n')).digest('hex');
46
+ return crypto.createHash('sha1').update('kg-v3-superseded\n' + head + '\n' + dirty.join('\n')).digest('hex');
47
47
  }
48
48
 
49
49
  function graphFor(root, { stateDir = defaultRoot() } = {}) {
@@ -96,6 +96,30 @@
96
96
  return out.join('/');
97
97
  };
98
98
 
99
+ /* the file that replaces this one (initiative-chat dead ends, 2026-11-20): `superseded_by: <path>` in the frontmatter, or the banner a merge
100
+ * writes at the top of the body ("> ARCHIVED OLD VERSION … superseded by `pmos/planning/prd/x-merged.md`"). Only a file that exists counts. */
101
+ function supersededBy(from, fm, text, bodyStart, have) {
102
+ const hit = (raw) => {
103
+ const t = String(raw || '').trim().replace(/^[`'"<]+|[`'">.,;]+$/g, '');
104
+ if (!/\.md$/i.test(t)) return null;
105
+ const a = t.replace(/^\//, '');
106
+ if (a !== from && have.has(a)) return a;
107
+ const b = norm(from, t);
108
+ return b !== from && have.has(b) ? b : null;
109
+ };
110
+ const fmv = fm && (fm.superseded_by || fm.supersededBy);
111
+ if (fmv) return hit(Array.isArray(fmv) ? fmv[0] : fmv);
112
+ const lines = String(text).split('\n').slice(Math.max(0, bodyStart - 1));
113
+ let seen = 0;
114
+ for (const l of lines) {
115
+ if (!l.trim()) continue;
116
+ if (++seen > 12) break; // the banner sits above the title, or just under it
117
+ const m = /^\s*>.*\bsuperseded by\b[^`\[]*?(?:`([^`]+\.md)`|\[[^\]]*\]\(([^)\s]+\.md)\)|([\w@./-]+\.md))/i.exec(l);
118
+ if (m) return hit(m[1] || m[2] || m[3]);
119
+ }
120
+ return null;
121
+ }
122
+
99
123
  const pathsIn = (value) => [...String(value || '').matchAll(/[\w@./-]+\.md\b/g)].map((m) => m[0].replace(/^\//, ''));
100
124
 
101
125
  function build(files) {
@@ -135,7 +159,7 @@
135
159
  id: f.path, title, type: fm.type || null, category: dc ? dc.category : null, category_basis: dc ? dc.basis : null, card: cardOf(fm, stripped, bodyStart),
136
160
  described: !!fm.description, tokens_est: estTokens(text), lines: text.split('\n').length,
137
161
  headings: heads.map((h) => ({ level: h.level, text: h.text, start: h.start, end: h.end })),
138
- status: fm.status || null, stale_after: fm.stale_after || null,
162
+ status: fm.status || null, stale_after: fm.stale_after || null, superseded_by: supersededBy(f.path, fm, text, bodyStart, have),
139
163
  });
140
164
 
141
165
  for (const m of body.matchAll(/\]\(([^)\s]+?)(?:#[^)]*)?\)/g)) {
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * build({ products, notes, programs }) → [item] newest first
6
6
  * products: [{ ws, name, titles: Map|{} initiative id → title, files, links, rounds }]
7
- * files lib/doc-library.js library().files that an initiative owns: [{ path, title, category, date, initiative, status, type, by }]
7
+ * files lib/doc-library.js library().files that an initiative owns: [{ path, title, category, date, initiative, status, type, by, supersededBy }]
8
8
  * links lib/custom-docs.js rows with a link: [{ id, scope, title, link: { kind, url }, at }]
9
9
  * rounds prototype rounds: [{ id, ini, name, at, made, board }] (lib/idle-lab.js roundsOf, named by the round's brief)
10
10
  * notes: lib/notes.js list().notes, with `came` (rowOf); programs: lib/routes-programs.js all()
@@ -17,6 +17,7 @@
17
17
  * family the Kind chip's family: plans · briefs · meetings · protos · checks · links (FAMILIES)
18
18
  * state 'Draft' | 'Final' | 'Issued' for a document (frontmatter status, or DRAFT in the title, which leaves the name); '' otherwise
19
19
  * v the edition a name or path says (v3), or null; ed: the key that folds editions of one document under one row
20
+ * old a document a merge replaced: the path of the file that replaced it (it shares that file's ed, and never stands as a row)
20
21
  * gate PMOS's own gate records (done test, rubric, eval, retro …): grouped by New they fold into one "Checks · N" row per initiative
21
22
  * by 'You' | 'PMOS' | a person's name (the last commit's author; an agent co-author is PMOS)
22
23
  * product the product's name; about: { ws, product, ini, title, program, programTitle } (About = "Program › Initiative")
@@ -212,7 +213,16 @@ function build({ products = [], notes = [], programs = [] } = {}) {
212
213
  push({ id: 'doc:' + p.ws + ':' + f.path, kind: 'doc', name, sub: (f.title || '') !== name ? f.title || '' : '',
213
214
  kindText: T.type, type: T.type, family: familyOf(T.type, T.gate, 'doc'), state: S.state, v: V.v, gate: T.gate, came: '', by: f.by || null,
214
215
  ed: p.ws + '|' + f.initiative + '|' + T.type + '|' + keyOf(V.bare), about: about(p, f.initiative), updated: f.date || null, held: null,
215
- path: f.path, open: { doc: { ws: p.ws, path: f.path } } });
216
+ path: f.path, open: { doc: { ws: p.ws, path: f.path } }, ...(f.supersededBy ? { old: f.supersededBy } : {}) });
217
+ }
218
+ // a file a merge replaced (its frontmatter `superseded_by:`, or the merge's banner) folds under the file that replaced it, as an earlier
219
+ // version: it shares that file's edition key and never stands as its own row (initiative-chat dead ends, 2026-11-20)
220
+ const docs = new Map(out.filter((x) => x.kind === 'doc' && x.about.ws === p.ws).map((x) => [x.path, x]));
221
+ for (const x of docs.values()) {
222
+ if (!x.old) continue;
223
+ let to = docs.get(x.old), hops = 0;
224
+ while (to && to.old && hops++ < 8) to = docs.get(to.old) || to; // a chain of merges ends at the newest file
225
+ if (to && to !== x) x.ed = to.ed; else delete x.old; // the replacement is not in the list: the file stands as it is
216
226
  }
217
227
  for (const l of p.links || []) {
218
228
  if (!l || !l.link || !l.link.url) continue;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.650.0",
3
+ "version": "0.652.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.650.0",
9
+ "version": "0.652.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.650.0",
3
+ "version": "0.652.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -8,7 +8,8 @@
8
8
  * versionOf(title) → 3 for "PRD v3", else 0
9
9
  * group(rows, { at(row) → ms, current?(row) → bool, dropped: Set }) → { groups: [{ kind, cur, earlier, files, versions, series }], merge }
10
10
  * one group per kind, in lifecycle order. cur: the record's own file when current() names one, else the newest. versions: the files
11
- * are versions of one document (the same name but for a version mark or a date); files: different documents of one kind. merge:
11
+ * are versions of one document (the same name but for a version mark or a date, or a file and the files a merge replaced: row.olds);
12
+ * files: different documents of one kind. merge:
12
13
  * { id, say, kinds, ask } — one ✦ line that proposes to merge the kinds with several different files (never a series kind,
13
14
  * Minutes, Update note, Report, nor a Note, Link or Research: separate things by nature), or null. dropped: the merge ids the PM said No to.
14
15
  */
@@ -65,17 +66,20 @@ export function group(rows, o = {}) {
65
66
  const sorted = real.slice().sort((a, b) => at(b) - at(a) || versionOf(b.title) - versionOf(a.title));
66
67
  const named = sorted.find((r) => cur(r));
67
68
  const c = named || sorted[0] || miss[0];
68
- const rest = (sorted.length ? sorted : miss).filter((r) => r !== c);
69
+ // the files a merge replaced (row.olds, pop-work-model.js artefactsOf) are earlier versions of the file that replaced them: never counted
70
+ // as files of the kind, so a merge that is done does not propose itself again
71
+ const olds = (c && c.olds) || [];
72
+ const rest = (sorted.length ? sorted : miss).filter((r) => r !== c).concat(olds);
69
73
  const bases = new Set(sorted.map((r) => baseOf(r.title)));
70
74
  const series = SERIES.has(kind);
71
- const versions = sorted.length > 1 && bases.size === 1 && !series;
72
- return { kind, cur: c, earlier: rest, n: sorted.length, versions, files: sorted.length > 1 && !versions ? sorted.length : 0, series, v: versionOf(c && c.title) };
75
+ const versions = !series && ((sorted.length > 1 && bases.size === 1) || (sorted.length === 1 && olds.length > 0));
76
+ return { kind, cur: c, earlier: rest, n: sorted.length + (versions ? olds.length : 0), versions, files: sorted.length > 1 && !versions ? sorted.length : 0, series, v: versionOf(c && c.title) };
73
77
  });
74
78
  const mergeable = groups.filter((g) => g.files > 1 && !NOMERGE.has(g.kind));
75
79
  const id = 'merge:' + mergeable.map((g) => g.kind).join('+');
76
80
  const merge = mergeable.length && !drop.has(id) ? { id, kinds: mergeable.map((g) => g.kind),
77
81
  say: andList(mergeable.map((g) => many(g.kind, g.files))) + ' can each be one artefact. Merge them?',
78
- ask: 'Merge the ' + andList(mergeable.map((g) => many(g.kind, g.files))) + ' of this initiative into one artefact per kind: the newest is the base, add the parts only the others have, name the sources at the end, and keep the old files as earlier versions. Delete nothing. Tell me what you merged.' } : null;
82
+ ask: 'Merge the ' + andList(mergeable.map((g) => many(g.kind, g.files))) + ' of this initiative into one artefact per kind: the newest is the base, add the parts only the others have, name the sources at the end, and keep the old files as earlier versions: put superseded_by: <the merged file> in the frontmatter of each old file, so the Artefacts list folds it under the merged file. Delete nothing. Tell me what you merged.' } : null;
79
83
  return { groups, merge };
80
84
  }
81
85
  /** The Version cell: "v3 · 2 earlier" when there is more than one; "v2" for one file that says its version; '' otherwise (zero is silence). */
@@ -20,6 +20,7 @@ export const I = {
20
20
  plus: 'M12 5v14M5 12h14', more: 'M5 12h.01M12 12h.01M19 12h.01', open: 'M14 5h5v5M19 5l-8 8M18 14v5H5V6h5', box: 'M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z',
21
21
  dia: 'M12 4l8 8-8 8-8-8z', doc: 'M7 3h7l4 4v14H7zM14 3v4h4M9.5 12h6M9.5 16h6', deck: 'M4 5h16v11H4zM12 16v4M8 20h8', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',
22
22
  proto: 'M4 5h16v12H4zM9 21h6M12 17v4', right: 'M10 7l5 5-5 5',
23
+ who: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM5 20a7 7 0 0 1 14 0', cal: 'M5 6h14v14H5zM5 10h14M9 4v4M15 4v4', stage: 'M5 7h14M5 12h10M5 17h6',
23
24
  };
24
25
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
25
26
  const DAY = 864e5;
@@ -140,11 +141,18 @@ export function listHtml(rows, W, o = {}) {
140
141
  }
141
142
  const li = (x) => {
142
143
  const sub = [x.date, x.who && x.who !== 'You' ? x.who : ''].filter(Boolean).join(' · ');
144
+ // the tick (WorkStatesDS 3): marks it done, with Undo; a done task and a Jira ticket show their state only
143
145
  const box = x.done ? `<span class="pwd-ck dn" aria-label="Done" role="img">${SV(I.ok, 14)}</span>`
144
146
  : o.ro || x.jira ? `<span class="pwd-ck" aria-hidden="true">${SV(x.ms ? I.dia : I.box, 14)}</span>`
145
- : `<button type="button" class="pwd-ck" data-pw-status="${esc(x.uid)}" aria-haspopup="menu" aria-label="${esc('Status: ' + x.status + '. Change it')}" title="${esc(x.status)}">${SV(x.ms ? I.dia : I.box, 14)}</button>`;
147
+ : `<button type="button" class="pwd-ck" data-pw-tick="${esc(x.uid)}" aria-label="${esc('Mark ' + x.title + ' done')}" title="Mark it done">${SV(x.ms ? I.dia : I.box, 14)}</button>`;
146
148
  const title = x.jira || o.ro || x.done ? `<span class="t">${esc(x.title)}</span>` : `<button type="button" class="t pwd-tt" data-pw-name="${esc(x.uid)}" aria-label="${esc('Rename ' + x.title)}">${esc(x.title)}</button>`;
147
- const acts = o.ro ? '' : `<span class="acts"><button type="button" class="pm-btn" data-pw-open="${esc(x.uid)}" aria-label="Open the task" title="Open the task">${SV(I.open)}</button><button type="button" class="pm-btn" data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu" aria-label="${esc('More for ' + x.title)}" title="More">${SV(I.more)}</button></span>`;
149
+ // on hover (WorkStatesDS 1): Who, Due date, Stage and More, each a small picker; a Jira ticket keeps Jira's owner and stage
150
+ const ab = (attr, label, d) => `<button type="button" class="pm-btn" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SV(d)}</button>`;
151
+ const acts = o.ro ? '' : '<span class="acts">'
152
+ + (x.jira || x.done ? '' : ab(`data-pw-who="${esc(x.uid)}" aria-haspopup="menu"`, 'Who: ' + (x.who || 'no one'), I.who))
153
+ + (x.done ? '' : ab(`data-pw-date="${esc(x.uid)}" aria-haspopup="dialog"`, x.date ? (x.ms ? 'Date: ' : 'Due: ') + x.date : 'Set a date', I.cal))
154
+ + (x.jira ? '' : ab(`data-pw-stage="${esc(x.uid)}" aria-haspopup="menu"`, 'Stage', I.stage))
155
+ + ab(`data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu"`, 'More for ' + x.title, I.more) + '</span>';
148
156
  return `<div class="pm-li pwd-li${x.done ? ' dn' : ''}${x.lit ? ' now' : ''}" data-pwli="${esc(x.uid)}" data-pw-row="${esc(x.uid)}">${box}<span class="txt">${title}${sub ? `<span class="w${x.late ? ' late' : ''}">${esc(sub)}</span>` : ''}</span>${acts}</div>`;
149
157
  };
150
158
  const body = groups.map((G) => {
@@ -192,10 +200,41 @@ export function artsHtml(arts, o = {}) {
192
200
  const R = (arts || []).map((a, i) => ({ a, i })).filter((x) => !(o.ro && x.a.missing));
193
201
  if (o.ro && !R.length) return '';
194
202
  const rows = R.map(({ a, i }) => {
195
- const meta = a.missing ? String(a.missing) : [a.kindName || a.kind, a.came, a.when].filter(Boolean).join(' · ');
203
+ // a merged file says how many files it replaced; those files are not rows of their own (they open from the table's Version fold)
204
+ const meta = a.missing ? String(a.missing) : [a.kindName || a.kind, a.came, a.when, a.olds && a.olds.length ? a.olds.length + ' earlier' : ''].filter(Boolean).join(' · ');
196
205
  const inner = `<span class="pwd-ai">${SV(iconOf(a))}</span><span class="txt"><span class="t">${esc(a.title)}</span>${meta ? `<span class="w${a.missing ? ' warn' : ''}">${esc(meta)}</span>` : ''}</span>`;
197
206
  return a.missing || o.ro ? `<div class="pm-li pwd-art${a.missing ? ' miss' : ''}">${inner}</div>` : `<button type="button" class="pm-li pwd-art" data-pw-art="${i}">${inner}</button>`;
198
207
  }).join('');
199
208
  const add = o.ro ? '' : `<button type="button" class="pm-btn" data-pw-addart aria-label="Add an artefact: a file, a link, or a new document" title="Add an artefact">${SV(I.plus)}</button>`;
200
209
  return `<section class="pm-block pwd-blk pwd-arts" aria-label="Artefacts"><div class="pm-row pwd-bh"><h2 class="pm-h-sm">Artefacts</h2>${add}</div>${o.merge || ''}${rows || '<p class="pm-meta">Nothing yet.</p>'}</section>`;
201
210
  }
211
+
212
+ /** Who can have a task (WorkStatesDS 1): You first, then the people who own tasks of this initiative, then PMOS. → [{ k, label, pmos? }] */
213
+ export function whoOf(rows, cur = '') {
214
+ const S = new Set();
215
+ for (const x of rows || []) if (x && x.kind === 'task' && !x.jira && x.who && x.who !== 'You') S.add(x.who);
216
+ return [{ k: 'You', label: 'You', on: cur === 'You' || cur === '' }].concat([...S].sort().map((n) => ({ k: n, label: n, on: n === cur })), [{ k: '', label: 'PMOS does it', pmos: true }]);
217
+ }
218
+ /** The stages a task can move to: the workflow's, in order. → [{ key, name, on }] */
219
+ export function stageList(st, cur) {
220
+ return (st || []).filter((x) => x && x.kind === 'stage' && x.key !== '').map((x) => ({ key: x.key, name: x.name, on: x.key === cur }));
221
+ }
222
+ /** The stage a task sits in: the last stage row above it in the breakdown. → key, or '' when it is in no stage */
223
+ export function stageOfTask(st, uid) {
224
+ let k = '';
225
+ for (const x of st || []) { if (x.kind === 'stage') k = x.key; else if (x.uid === uid) return k; }
226
+ return '';
227
+ }
228
+ /** A milestone's full popup, under its title (WorkStatesDS 6): its date and how far off, the initiative's done test and Kill if, then PMOS's
229
+ * suggestion about it when there is one. row: { uid, end, start, done }. o: { kill, ro } */
230
+ export function msHead(row, W, o = {}) {
231
+ const d = day(row.end || row.start), t = day(W.today);
232
+ const n = d != null && t != null ? Math.round((d - t) / DAY) : null;
233
+ const left = row.done || n == null ? '' : n === 0 ? 'today' : n > 0 ? 'in ' + n + (n === 1 ? ' day' : ' days') : (-n === 1 ? '1 day' : -n + ' days') + ' late';
234
+ const when = d == null ? 'No date yet' : [dayText(row.end || row.start, W.today), row.done ? 'done' : left].filter(Boolean).join(' · ');
235
+ const dt = ((W.overview && W.overview.lines) || []).find((l) => l.id === 'done');
236
+ const r = (k, v, cls = '') => `<dt>${k}</dt><dd${cls ? ` class="${cls}"` : ''}>${esc(v)}</dd>`;
237
+ const facts = `<dl class="pwd-facts">${r('Date', when, n != null && n < 0 && !row.done ? 'warn' : '')}${r('Done test', dt && dt.text ? dt.text : 'Not written yet', dt && dt.text ? '' : 'grey')}${o.kill ? r('Kill if', o.kill) : ''}</dl>`;
238
+ const s = W.rowSuggests && W.rowSuggests.get ? W.rowSuggests.get(row.uid) : null;
239
+ return `<div class="pwd-msh">${facts}${s && !o.ro ? sugHtml(s) : ''}</div>`;
240
+ }
@@ -272,7 +272,9 @@ function artefactsHtml(rows, C, add = true, o = {}) {
272
272
  const ver = vt && g.earlier.length ? `<button type="button" class="pw-ver" data-pw-ver="${esc(k)}" aria-expanded="${open}">${esc(vt)}${SVG(open ? P.down : P.right, 12)}</button>` : esc(vt);
273
273
  const row = `<div class="pw-ar${a.missing ? ' miss' : ''}" role="row"><span role="cell" class="pw-ak">${esc(g.kind)}</span><span role="cell">${nameCell(a)}</span><span role="cell" class="pw-av">${ver}</span>`
274
274
  + (C.when ? (a.missing ? `<span role="cell" class="warn" title="${esc(a.missing)}">${esc(String(a.missing).split(' · ')[0])}</span>` : `<span role="cell">${esc(a.when || '')}</span>`) : '') + '</div>';
275
- const more = open ? g.earlier.map((e) => `<div class="pw-ar pw-ear" role="row"><span role="cell"></span><span role="cell">${nameCell(e)}</span><span role="cell" class="pw-av">${e.title && AK.versionOf(e.title) ? 'v' + AK.versionOf(e.title) : ''}</span>${C.when ? `<span role="cell">${esc(e.when || '')}</span>` : ''}</div>`).join('') : '';
275
+ // an earlier version a merge replaced is not one of the rows: its press names the row that replaced it and its place under it
276
+ const earlyCell = (e) => (idx.has(e) ? nameCell(e) : `<button type="button" class="pw-an" data-pw-art="${idx.get(a)}:${(a.olds || []).indexOf(e)}">${esc(e.title)}</button>`);
277
+ const more = open ? g.earlier.map((e) => `<div class="pw-ar pw-ear" role="row"><span role="cell"></span><span role="cell">${earlyCell(e)}</span><span role="cell" class="pw-av">${e.title && AK.versionOf(e.title) ? 'v' + AK.versionOf(e.title) : ''}</span>${C.when ? `<span role="cell">${esc(e.when || '')}</span>` : ''}</div>`).join('') : '';
276
278
  return row + more;
277
279
  }).join('');
278
280
  const mg = G.merge ? `<div class="pw-sugs pw-amg" role="list" aria-label="PMOS suggests">${sugLine({ id: G.merge.id, say: G.merge.say, merge: G.merge })}</div>` : '';
@@ -508,6 +510,10 @@ export function wire(body, h0, x0) {
508
510
  if (d.pwMore != null) { S.moreOpen.add(d.pwMore); redraw(); return; }
509
511
  if (d.pwVer) { if (ARTOPEN.has(d.pwVer)) ARTOPEN.delete(d.pwVer); else ARTOPEN.add(d.pwVer); redraw(); return; }
510
512
  if (d.pwRowMore) { rowMenu(b, d.pwRowMore, c, h, body); return; }
513
+ // quick edit in the row (work-ds-quick-edit, WorkStatesDS 1 and 3): the tick, Who and Stage
514
+ if (d.pwTick) { b.disabled = true; if (h.status) await h.status(d.pwTick, 'Done'); return; }
515
+ if (d.pwWho) { whoMenu(b, d.pwWho, c, h, x); return; }
516
+ if (d.pwStage) { stageMenu(b, d.pwStage, c, h, x); return; }
511
517
  if ('pwAddty' in d) { S.msAdd = !S.msAdd; const f = b.closest('.pw-add'), k = f && f.querySelector('[data-pw-add]') && f.querySelector('[data-pw-add]').dataset.pwAdd; redraw(); if (k != null) setTimeout(() => { const i = body.querySelector(`[data-pw-add="${window.CSS.escape(k)}"]`); if (i) i.focus(); }, 0); return; }
512
518
  if (d.pwFact) { fact(d.pwFact, b, c, h); return; }
513
519
  if (d.pwStatus) { statusMenu(b, d.pwStatus, h, c); return; }
@@ -515,8 +521,9 @@ export function wire(body, h0, x0) {
515
521
  if (d.pwName) { rename(b, d.pwName, h); return; }
516
522
  if (d.pwOpen) { openSmall(d.pwOpen, c, h, x, body); return; }
517
523
  if ('pwBacklog' in d) { const o = x.o() || {}, w = h.where ? h.where() : {}, q = new URLSearchParams({ work: 'backlog' }); if (w.ws || o.ws) q.set('ws', w.ws || o.ws); if (o.id) q.set('ini', o.id); location.href = '/premium-board.html?' + q.toString(); return; }
518
- if (d.cbMs != null) { msPop(b, d.cbMs, W, h); return; }
519
- if (d.pwArt != null) { openArt(W.artefacts[+d.pwArt], h, x); return; }
524
+ // a milestone ◇ opens its full popup (WorkStatesDS 6); a Jira one and a phone keep the small card
525
+ if (d.cbMs != null) { const rw = W.rows.find((r) => r.uid === d.cbMs); if (rw && !rw.jira && !phone()) openSmall(d.cbMs, c, h, x, body); else msPop(b, d.cbMs, W, h); return; }
526
+ if (d.pwArt != null) { const [i, j] = String(d.pwArt).split(':'), a = W.artefacts[+i]; openArt(j != null ? a && a.olds && a.olds[+j] : a, h, x); return; }
520
527
  if ('pwAddart' in d) { addArt(x, h); return; }
521
528
  });
522
529
  body.addEventListener('keydown', async (e) => {
@@ -699,13 +706,49 @@ function dateMenu(btn, uid, c, h) {
699
706
  }
700
707
  function rowMenu(btn, uid, c, h, body) {
701
708
  const row = c.W.rows.find((x) => x.uid === uid) || {};
702
- openPop(btn, 'pw-rowm', `<button type="button" class="hi-mi" role="menuitem" data-k="kind">${SVG(row.ms ? P.box : P.dia, 14, 2)} ${row.ms ? 'Make it a task' : 'Make it a milestone'}</button>`
709
+ openPop(btn, 'pw-rowm', `<button type="button" class="hi-mi" role="menuitem" data-k="status">${SVG(P.box, 14, 2)} Status: ${esc(row.status || 'To do')}</button>`
710
+ + `<button type="button" class="hi-mi" role="menuitem" data-k="kind">${SVG(row.ms ? P.box : P.dia, 14, 2)} ${row.ms ? 'Make it a task' : 'Make it a milestone'}</button>`
703
711
  + `<button type="button" class="hi-mi" role="menuitem" data-k="open">${SVG(P.open, 14)} Open the task</button>` + jiraNote(row), (b) => {
712
+ const k = b.dataset.k;
713
+ // Status opens its own list (and its "when did this happen" line) in place of this menu
714
+ if (k === 'status') { statusMenu(btn, uid, h, c); return; }
704
715
  closePop();
705
- if (b.dataset.k === 'kind') setKind(row, !row.ms, h);
706
- else if (b.dataset.k === 'open') openSmall(uid, c, h, body.__pwx, body);
716
+ if (k === 'kind') setKind(row, !row.ms, h);
717
+ else if (k === 'open') openSmall(uid, c, h, body.__pwx, body);
707
718
  }, { menu: true, label: 'Task' });
708
719
  }
720
+ /* Who (WorkStatesDS 1): You, the people who own this initiative's tasks, and "PMOS does it". A name writes the owner (Undo puts the old one
721
+ * back, POST /api/boards/tasks/edit with `from`); PMOS does it gives the task to PMOS (POST /api/backlog/give; Undo is /api/backlog/stop). */
722
+ function whoMenu(btn, uid, c, h, x) {
723
+ const row = c.W.rows.find((r) => r.uid === uid) || {};
724
+ const L = PD.whoOf(c.W.rows, row.who || '');
725
+ openPop(btn, 'pw-who', L.map((p, i) => `<button type="button" class="hi-mi" role="menuitemradio" aria-checked="${!!p.on}" data-i="${i}">${SVG(p.pmos ? P.spark : PD.I.who, 14, 2)} ${esc(p.label)}</button>`).join(''), async (b) => {
726
+ const p = L[+b.dataset.i]; closePop(); if (!p || p.on) return;
727
+ const o = (x && x.o && x.o()) || {}, w = h.where ? h.where() : {}, ws = w.ws || o.ws, board = w.board || o.board;
728
+ const say = (m) => (h.toast ? h.toast(m) : undoToast(m));
729
+ if (p.pmos) {
730
+ const r = await pmPost('/api/backlog/give', { ws, board, tasks: [uid] }).catch(() => null);
731
+ if (!r || r.ok === false) { say((r && r.error) || 'PMOS did not take it.'); return; }
732
+ undoToast('PMOS does ' + (row.title || 'it') + '.', async () => { const u = await pmPost('/api/backlog/stop', { ws, board, task: uid }).catch(() => null); if (!u || u.ok === false) say((u && u.error) || 'The undo did not land.'); if (h.reload) await h.reload(); });
733
+ if (h.reload) await h.reload();
734
+ return;
735
+ }
736
+ const owner = p.k === 'You' ? '' : p.k;
737
+ const r = await pmPost('/api/boards/tasks/edit', { ws, board, task: uid, owner }).catch(() => null);
738
+ if (!r || r.ok === false) { say((r && r.error) || 'The owner was not changed.'); return; }
739
+ const was = (r.from && r.from.owner) || '';
740
+ undoToast((owner ? owner + ' has ' : 'You have ') + (row.title || 'it') + '.', async () => { const u = await pmPost('/api/boards/tasks/edit', { ws, board, task: uid, owner: was }).catch(() => null); if (!u || u.ok === false) say((u && u.error) || 'The undo did not land.'); if (h.reload) await h.reload(); });
741
+ if (h.reload) await h.reload();
742
+ }, { menu: true, label: 'Who', focus: '[aria-checked="true"]' });
743
+ }
744
+ /* Stage (WorkStatesDS 1): the workflow's stages; a pick moves the task there through the host's move (its toast carries the Undo) */
745
+ function stageMenu(btn, uid, c, h, x) {
746
+ const st = stagesOf(c.r, c.v, { ...((x && x.o && x.o()) || {}), today: c.W.today }), cur = PD.stageOfTask(st, uid), L = PD.stageList(st, cur);
747
+ openPop(btn, 'pw-stage', L.map((s, i) => `<button type="button" class="hi-mi" role="menuitemradio" aria-checked="${s.on}" data-i="${i}">${esc(s.name)}</button>`).join('') || '<p class="hi-small">This work has no stages.</p>', (b) => {
748
+ const s = L[+b.dataset.i]; closePop(); if (!s || s.on || !h.move) return;
749
+ h.move(uid, { to: s.key, from: cur, name: s.name });
750
+ }, { menu: true, label: 'Stage', focus: '[aria-checked="true"]' });
751
+ }
709
752
  /* "Open the task" opens the small task popup on top (round 3 point 20, pm/cozy-task-pop.js); ↑ ↓ step through this list. A Jira ticket keeps its
710
753
  * ticket view. On close the row is lit for a moment. */
711
754
  async function openSmall(uid, c, h, x, body, bt) {
@@ -723,6 +766,24 @@ async function openSmall(uid, c, h, x, body, bt) {
723
766
  // the row behind changes at once (Wawan, 2026-11-19: a new date or status did not show until the board was read again); the reload follows
724
767
  patch: (u, p) => { const rr = x && x.r && x.r(), tk = rr && Array.isArray(rr.tasks) ? rr.tasks.find((q) => q && q.uid === u) : null; if (!tk) return; if (!p) { rr.tasks.splice(rr.tasks.indexOf(tk), 1); if (h.redraw) h.redraw(); return; } Object.assign(tk, { status: p.status || tk.status, end: p.end, start: p.start, milestone: p.milestone }); if (h.redraw) h.redraw(); },
725
768
  onChange: () => { if (h.reload) h.reload(); },
769
+ // the full popup over the work side (work-ds-quick-edit, WorkStatesDS 4 and 6): ← and the path go back to this initiative, the chat button
770
+ // shows the popup's chat, × closes the popup; a milestone shows its date, the done test and PMOS's suggestion about it
771
+ full: !phone(), path: [o.from || 'Work', o.product || '', ((x && x.v && x.v()) || {}).title || ''].filter(Boolean),
772
+ chat: () => { const a = document.querySelector('.cz-pop [data-pop="ask"]'); if (a) a.click(); },
773
+ closeAll: () => { const k = document.querySelector('.cz-pop [data-pop="close"]'); if (k) k.click(); },
774
+ head: (t) => {
775
+ if (!t.milestone) return '';
776
+ const cc = body.__pwx && body.__pwx.r() ? model(body.__pwx.r(), body.__pwx.v(), body.__pwx.o()) : c, rr = (x && x.r && x.r()) || {};
777
+ return PD.msHead({ uid: t.uid, end: t.due, start: t.start, done: /^done$/i.test(t.status || '') }, cc.W, { kill: rr.kill || (rr.outcome && rr.outcome.kill) || '' });
778
+ },
779
+ headPress: async (b, tp) => {
780
+ const d = b.dataset, cc = body.__pwx && body.__pwx.r() ? model(body.__pwx.r(), body.__pwx.v(), body.__pwx.o()) : c;
781
+ const sg = findSug(cc.W, d.pwKeep || d.pwDrop || d.pwSug || ''); if (!sg) return false;
782
+ if (d.pwKeep) { b.disabled = true; await keepSug(sg, x, h); tp.refresh(); return true; }
783
+ if (d.pwDrop) { b.disabled = true; await dropSug(sg, x, h); tp.refresh(); return true; }
784
+ if (d.pwSug) { tp.close(); openSug(sg, cc, x, h); return true; }
785
+ return false;
786
+ },
726
787
  onClose: (u) => { const r = body.querySelector(`[data-pw-row="${window.CSS.escape(u)}"]`); if (r) { r.classList.add('lit'); r.scrollIntoView({ block: 'nearest' }); setTimeout(() => r.classList.remove('lit'), 1600); } },
727
788
  });
728
789
  }
@@ -33,3 +33,22 @@ button.ctp-t:hover { background: var(--cz-well); }
33
33
  }
34
34
  .ctp-when .sw { border-top: 0; margin-top: 0; padding-top: 0; }
35
35
  .ctp-menu button.ctp-del { color: var(--cz-late); }
36
+ /* the full popup (work-ds-quick-edit, WorkStatesDS 4 and 6): it takes the place of the popup's work side, the same size; the chat beside it stays
37
+ * usable, so its scrim neither dims nor catches presses. Head: ← and the path, then chat, ⋯ and ×; under it the kind and the title. */
38
+ .ctp-scrim.ctp-full { background: transparent; pointer-events: none; }
39
+ .ctp.ctp-full { transform: none; max-height: none; width: auto; border-radius: 28px; padding: var(--space-16) var(--space-24) var(--space-24); box-shadow: 0 0 0 1px var(--cz-hair); }
40
+ .ctp-full .ctp-fh { margin-bottom: var(--space-16); }
41
+ .ctp-path { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-4); font-size: var(--fs-row); color: var(--cz-ink2); overflow: hidden; white-space: nowrap; }
42
+ .ctp-cr { border: 0; background: none; padding: 0; font: inherit; color: inherit; overflow: hidden; text-overflow: ellipsis; }
43
+ button.ctp-cr { cursor: pointer; color: var(--cz-ink); }
44
+ button.ctp-cr:hover { text-decoration: underline; }
45
+ .ctp-sep { color: var(--cz-ink2); }
46
+ .ctp-th { display: flex; align-items: center; gap: var(--space-8); margin: 0 0 var(--space-12); }
47
+ .ctp-full .ctp-t { font-size: var(--fs-panel); }
48
+ .ctp-full .ctp-b, .ctp-full .ctp-hx { max-width: 720px; }
49
+ .ctp-hx { margin: 0 0 var(--space-16); display: flex; flex-direction: column; gap: var(--space-12); }
50
+ .ctp-hx .pwd-facts { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--space-4) var(--space-12); margin: 0; }
51
+ .ctp-hx .pwd-facts dt { color: var(--cz-ink2); }
52
+ .ctp-hx .pwd-facts dd { margin: 0; }
53
+ .ctp-hx .grey { color: var(--cz-ink2); }
54
+ .ctp-hx .warn { color: var(--cz-late); }
@@ -5,7 +5,11 @@
5
5
  * row?(uid) → the row the host drew (GET /api/boards/items adds the owner and notes when it answers), list?() → [uid] (↑ ↓ step through it),
6
6
  * rename?(task, title) → Promise (the title,
7
7
  * pressed, becomes a field; Enter or leaving it saves), onClose?(uid) (the host
8
- * lights the row), openIni?(id) }
8
+ * lights the row), openIni?(id),
9
+ * full?: true → the full popup over the work side of the popup (work-ds-quick-edit, WorkStatesDS 4 and 6): ← and the
10
+ * path (path?: [crumb]) go back to the initiative, chat?() shows the popup's chat, × closes the task and the popup
11
+ * (closeAll?()); head?(t) → html under the title (a milestone's date, done test and suggestion), its presses go to
12
+ * headPress?(button, { refresh, close }) }
9
13
  * closeTask() closes it, as ✕, Esc or a press outside do. Esc closes only the small popup.
10
14
  *
11
15
  * Inside: the kind (Task or Milestone, pressed to switch) and the title; the one task card (pm/task-card.js mountCard: status, due, owner, notes,
@@ -22,6 +26,7 @@ if (typeof document !== 'undefined' && document.head && !document.querySelector(
22
26
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
23
27
  const SVG = (d) => `<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
24
28
  const P = {
29
+ back: 'M19 12H5M11 6l-6 6 6 6',
25
30
  x: 'M6 6l12 12M18 6L6 18', up: 'M7 14l5-5 5 5', down: 'M7 10l5 5 5-5', chat: 'M4 5h16v11H9l-5 4z', more: 'M5 12h.01M12 12h.01M19 12h.01',
26
31
  dia: 'M12 4l8 8-8 8-8-8z', box: 'M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z',
27
32
  };
@@ -40,15 +45,24 @@ async function rowOf(uid, ctx) {
40
45
 
41
46
  export function closeTask() {
42
47
  if (!S) return;
43
- const { el, scrim, uid, ctx, prevFocus } = S;
48
+ const S0 = S, { el, scrim, uid, ctx, prevFocus } = S;
44
49
  S = null;
45
50
  document.removeEventListener('keydown', onKey, true);
51
+ if (S0.ro) S0.ro.disconnect(); if (S0.offPop) document.removeEventListener('click', S0.offPop, true); window.removeEventListener('resize', place);
46
52
  el.remove(); scrim.remove();
47
53
  document.body.classList.remove('ctp-on');
48
54
  if (ctx.onClose) ctx.onClose(uid);
49
55
  if (prevFocus && prevFocus.isConnected) prevFocus.focus();
50
56
  }
51
57
 
58
+ /** The full popup takes the place of the popup's work side; with no popup open it stays centred. */
59
+ function place() {
60
+ if (!S || !S.el.classList.contains('ctp-full')) return;
61
+ const L = document.querySelector('.cz-pop .cz-pop-l'), r = L && L.getBoundingClientRect();
62
+ if (!r || !r.width) { S.el.removeAttribute('style'); return; }
63
+ Object.assign(S.el.style, { left: r.left + 'px', top: r.top + 'px', width: r.width + 'px', height: r.height + 'px' });
64
+ }
65
+
52
66
  function onKey(e) {
53
67
  if (!S) return;
54
68
  if (e.key === 'Escape') {
@@ -71,6 +85,16 @@ export async function openTask(uid, ctx = {}) {
71
85
  document.body.append(scrim, el);
72
86
  document.body.classList.add('ctp-on');
73
87
  S = { el, scrim, ctx, uid, prevFocus: document.activeElement };
88
+ // the full popup lies over the work side of the popup and follows its size (the chat opening beside it narrows it)
89
+ if (ctx.full) {
90
+ el.classList.add('ctp-full'); scrim.classList.add('ctp-full');
91
+ const L = document.querySelector('.cz-pop .cz-pop-l');
92
+ if (L && typeof ResizeObserver !== 'undefined') { S.ro = new ResizeObserver(place); S.ro.observe(L); }
93
+ window.addEventListener('resize', place); place();
94
+ // the popup behind closing (its scrim or its own ×) takes the full popup with it
95
+ S.offPop = (e) => { if (e.target.closest && e.target.closest('.cz-pop [data-pop="close"]')) closeTask(); };
96
+ document.addEventListener('click', S.offPop, true);
97
+ }
74
98
  document.addEventListener('keydown', onKey, true);
75
99
  el.addEventListener('click', press);
76
100
  // the status pick waits for the day (point 18): the card's own press is held here, the line opens under the card
@@ -96,9 +120,20 @@ async function show(uid) {
96
120
  const title = !t.jira && ctx.rename ? `<button type="button" class="ctp-t" data-ctp-rename aria-label="${esc('Rename ' + t.title)}">${esc(t.title)}</button>` : `<span class="ctp-t">${esc(t.title)}</span>`;
97
121
  const step = L.length > 1 && i >= 0 ? ib(`data-ctp-step="-1"${i === 0 ? ' disabled' : ''}`, 'Previous task', P.up) + ib(`data-ctp-step="1"${i === L.length - 1 ? ' disabled' : ''}`, 'Next task', P.down) : '';
98
122
  const more = !t.jira ? ib('data-ctp-more aria-haspopup="menu"', 'More for this task', P.more) : '';
99
- S.el.setAttribute('aria-label', 'Task: ' + t.title);
100
- S.el.innerHTML = `<div class="ctp-h">${kind}${title}<span class="ctp-tools">${step}${more}${ib('data-ctp-close', 'Close', P.x)}</span></div>`
101
- + '<div class="ctp-b"></div><div class="ctp-when" hidden></div>';
123
+ S.el.setAttribute('aria-label', (t.milestone ? 'Milestone: ' : 'Task: ') + t.title);
124
+ if (ctx.full) {
125
+ // WorkStatesDS 4 and 6: ← and the path back to the initiative, then chat, ⋯ and ×; the kind and the title under it
126
+ const path = ctx.path || [], last = path.length - 1;
127
+ const crumbs = path.map((p, k) => (k === last ? `<button type="button" class="ctp-cr" data-ctp-close>${esc(p)}</button>` : `<span class="ctp-cr">${esc(p)}</span>`)).join('<span class="ctp-sep" aria-hidden="true">›</span>');
128
+ const head = ctx.head ? ctx.head(t) : '';
129
+ S.el.innerHTML = `<div class="ctp-h ctp-fh">${ib('data-ctp-close', 'Back to ' + (path[last] || 'the initiative'), P.back)}<nav class="ctp-path" aria-label="Where this is">${crumbs}</nav>`
130
+ + `<span class="ctp-tools">${step}${ctx.chat ? ib('data-ctp-chat', 'Ask PMOS about this', P.chat) : ''}${more}${ib('data-ctp-x', 'Close', P.x)}</span></div>`
131
+ + `<div class="ctp-th">${kind}${title}</div>${head ? `<div class="ctp-hx">${head}</div>` : ''}`
132
+ + '<div class="ctp-b"></div><div class="ctp-when" hidden></div>';
133
+ } else {
134
+ S.el.innerHTML = `<div class="ctp-h">${kind}${title}<span class="ctp-tools">${step}${more}${ib('data-ctp-close', 'Close', P.x)}</span></div>`
135
+ + '<div class="ctp-b"></div><div class="ctp-when" hidden></div>';
136
+ }
102
137
  const base = boardSaver({ ws: ctx.ws, board: raw.board || ctx.board, t, post: (p, b) => ctx.pmPost(p, b) });
103
138
  const save = (patch) => {
104
139
  // a status the PM dated earlier carries that day; Undo and every other change go as they always did
@@ -147,7 +182,10 @@ async function press(e) {
147
182
  if (!S) return;
148
183
  const b = e.target.closest('button'); if (!b || b.disabled || !S.el.contains(b)) return;
149
184
  const d = b.dataset, ctx = S.ctx, t = S.t;
185
+ if (b.closest('.ctp-hx')) { if (ctx.headPress) { const s0 = S; await ctx.headPress(b, { refresh: () => { if (S === s0) show(s0.uid); }, close: closeTask }); } return; }
150
186
  if ('ctpClose' in d) { closeTask(); return; }
187
+ if ('ctpChat' in d) { if (ctx.chat) ctx.chat(); return; }
188
+ if ('ctpX' in d) { const all = ctx.closeAll; closeTask(); if (all) all(); return; }
151
189
  if (d.ctpStep) { const L = ctx.list ? ctx.list() : [], j = L.indexOf(S.uid) + Number(d.ctpStep); if (j >= 0 && j < L.length) show(L[j]); return; }
152
190
  if ('ctpRename' in d && t && ctx.rename) { renameField(b); return; }
153
191
  if ('ctpKind' in d && t) { kindOf(!t.milestone); return; }
@@ -104,7 +104,8 @@ function editions(list) {
104
104
  if (!x.ed) { out.push({ x, older: [] }); continue; }
105
105
  let r = by.get(x.ed);
106
106
  if (!r) { r = { x, older: [] }; by.set(x.ed, r); out.push(r); continue; }
107
- const better = (x.v || 0) > (r.x.v || 0) || ((x.v || 0) === (r.x.v || 0) && newest(x, r.x) < 0);
107
+ // a file a merge replaced (x.old) never stands over the file that replaced it, however recently it was touched
108
+ const better = !!r.x.old !== !!x.old ? !x.old : (x.v || 0) > (r.x.v || 0) || ((x.v || 0) === (r.x.v || 0) && newest(x, r.x) < 0);
108
109
  if (better) { r.older.push(r.x); r.x = x; } else r.older.push(x);
109
110
  }
110
111
  for (const r of out) r.older.sort((a, b) => (b.v || 0) - (a.v || 0) || newest(a, b));
@@ -321,9 +321,13 @@ export function breakdownOf(r, v, o = {}) {
321
321
  const [ta, tb] = taskSpan(all);
322
322
  const rn = ran[i] || {};
323
323
  let a = '', b = '';
324
- if (s.status === 'done') { a = isoOf(rn.from) || ta; b = isoOf(rn.to) || tb; }
325
- else if (s.status === 'now') { const pv = ran.slice(0, i).reverse().find((q) => q.to || q.from) || {}; a = isoOf(rn.from) || isoOf(pv.to) || ta || isoOf(pv.from); b = isoOf(r.end) || tb; } // no recorded start: since the last date the record holds before it // the stage in progress runs to the plan end: late is said against the plan
324
+ // a stage's bar runs from its tasks' earliest start to their latest end (a task with no start counts from its due date). Wawan,
325
+ // 2026-11-20: "just apply the start and end date" — the recorded stage moves are when someone pressed through the workflow, not when
326
+ // the work ran, so they are used only for a stage with no dated task
327
+ if (s.status === 'done') { a = ta || isoOf(rn.from); b = tb || isoOf(rn.to); }
328
+ else if (s.status === 'now') { const pv = ran.slice(0, i).reverse().find((q) => q.to || q.from) || {}; a = ta || isoOf(rn.from) || isoOf(pv.to) || isoOf(pv.from); b = isoOf(r.end) || tb; } // no dated task: since the last date the record holds before it // the stage in progress runs to the plan end: late is said against the plan
326
329
  else if (s.status !== 'skip') { a = ta; b = tb; }
330
+ if (a && b && b < a) b = a;
327
331
  const live = s.status === 'now' && r.status !== 'done' && !r.ended;
328
332
  const dl = b && (s.status === 'now' || s.status === 'next') ? dateLate(b, t, live || ts.some((x) => !x.closed)) : { text: b && s.status === 'done' ? '' : '', late: false };
329
333
  const isOpen = holds(all, f) ? true : shut.has(s.key) ? false : open.has(s.key) ? true : s.status === 'now';
@@ -382,16 +386,25 @@ const KIND_OF_ITEM = { doc: 'Document', link: 'Link', meeting: 'Meeting notes',
382
386
  export function artefactsOf(v, o = {}) {
383
387
  const t = todayOf(o), out = [], seen = new Set();
384
388
  const key = (s) => norm(s).replace(/[^a-z0-9]+/g, ' ').trim();
389
+ // a file a merge replaced (the Library's `old`: its frontmatter `superseded_by:` or the merge's banner) is not a row: it folds under the file
390
+ // that replaced it as an earlier version, so the Artefacts list shows the merged file and the merge ✦ resolves itself (2026-11-20)
391
+ const pk = (p) => String(p || '').replace(/^\.?\//, '').replace(/^pmos\//, '');
392
+ const olds = new Map(), paths = new Set();
393
+ for (const it of o.items || []) if (it && it.old) { const k = pk(it.old); if (!olds.has(k)) olds.set(k, []); olds.get(k).push(it); paths.add(pk((it.open && it.open.doc && it.open.doc.path) || it.path)); }
385
394
  for (const it of o.items || []) {
386
- if (!it || !it.name || seen.has(key(it.name))) continue;
395
+ if (!it || !it.name || it.old || seen.has(key(it.name))) continue;
387
396
  seen.add(key(it.name));
388
397
  out.push({ id: it.id, title: it.name, kind: it.kindText || KIND_OF_ITEM[it.kind] || 'Document', when: it.updated ? dayText(it.updated, t) || it.updated : '', came: it.came || '', item: it, link: it.kind === 'link',
389
398
  type: it.type || '', path: (it.open && it.open.doc && it.open.doc.path) || '', akind: it.kind, at: Date.parse(it.updated || '') || 0,
390
399
  // the Library's own Kind (lib/library-items.js kindOf, PR #1376) when it is a specific one; the popup's resolver only fills in for older servers
391
400
  kindName: it.kindText && !/^(Document|Meeting notes|Link|File)$/.test(it.kindText) ? (it.kindText === 'Rubric' ? 'Eval rubric' : it.kindText) : '' });
401
+ const p = out[out.length - 1].path, was = p ? olds.get(pk(p)) : null;
402
+ if (p) paths.add(pk(p));
403
+ if (was && was.length) out[out.length - 1].olds = was.map((w) => ({ id: w.id, title: w.name, item: w, path: (w.open && w.open.doc && w.open.doc.path) || '', when: w.updated ? dayText(w.updated, t) || w.updated : '', at: Date.parse(w.updated || '') || 0 }));
392
404
  }
393
405
  for (const d of o.docs || []) {
394
406
  if (!d || !d.title || seen.has(key(d.title))) continue;
407
+ if (d.path && paths.has(pk(d.path))) continue; // the same file under another name, or a file a merge replaced
395
408
  if (d.path || d.link) {
396
409
  seen.add(key(d.title));
397
410
  const lk = d.link && d.link.url;
@@ -38,7 +38,8 @@ export const VIEW_CONTROLS = [
38
38
  '[data-wkopen]', '[data-wknav]', '[data-wkmenu]', '.wk-menu [data-wktlsw]', '[data-wkdl="on"]', '[data-wkdl="back"]',
39
39
  '#bdFind', '#roFind', '#bdFilter', '.wk-menu [data-wkf]', '.wk-menu [data-wkmore]', '.wk-menu [data-wksortp]', '.wk-menu [data-wksortx]', '.wk-menu [data-wkreset]',
40
40
  // the popup of a row, read only (Part A 4): its close and its edge, Details, a stage's fold, the done and far folds
41
- '.cz-pop [data-pop="close"]', '.pw [data-pw-details]', '.pw [data-pw-fold]', '.pw [data-pw-more]', '.pw [data-pw-grip]', '.pw [data-pw-done]', '.pw [data-pw-far]', '.pw [data-pw-tl]', '.pw [data-pw-span]', '.hi-pop [data-sp]',
41
+ // its path and ← back to the page it came from (the design-system popup, #1432: "Work ›" and "Back to Work") only navigate
42
+ '.cz-pop [data-pop="close"]', '.cz-pop [data-cz-vw-path]', '.cz-pop [data-cz-vw="back"]', '.pw [data-pw-details]', '.pw [data-pw-fold]', '.pw [data-pw-more]', '.pw [data-pw-grip]', '.pw [data-pw-done]', '.pw [data-pw-far]', '.pw [data-pw-tl]', '.pw [data-pw-span]', '.hi-pop [data-sp]',
42
43
  ].join(',');
43
44
 
44
45
  /** The Board's static toolbar and chips: hidden, so the page's own script keeps the elements it holds. */
@@ -13,8 +13,9 @@
13
13
  * 1 one line, the height and colours of the Board row line (10 px). Each stage is a part of it on its own dates, with a 2 px notch between
14
14
  * parts: done parts grey, the current part blue, later parts light. No numbers. Hover names the stage and its dates; a click goes to that
15
15
  * stage in Tasks.
16
- * 2 the dates of a stage: a done stage ran from its move into it to its move out (the board moves), else the days of its tasks; the current
17
- * stage from its move into it to its latest task due date; a later stage the days of its tasks. With none on record the part is dashed
16
+ * 2 the dates of a stage: the days of its tasks, from the earliest start to the latest end (a task with no start counts from its due date;
17
+ * Wawan, 2026-11-20: "just apply the start and end date"). Only a stage with no dated task falls back to the board moves: a done stage
18
+ * from its move into it to its move out, the current one from its move into it. A later stage has its tasks' days. With none on record the part is dashed
18
19
  * and shares the room between its neighbours evenly. A date is never invented.
19
20
  * 3 the milestone tasks are ◇ on the line, the Board's shapes: done filled, late orange, the end ◇ bigger. Its name above (cut at 24
20
21
  * characters, the whole name on hover), its date below. A name that would run into the next one aligns its right edge to its own ◇.
@@ -108,8 +109,8 @@ export function lineOf(r, o = {}) {
108
109
  const [ta, tb] = taskSpan(rows.filter((x) => x.sec === s.key && !x.wont));
109
110
  const rn = ran[i] || {};
110
111
  let a = null, b = null;
111
- if (s.status === 'done') { a = day(rn.from) || ta; b = day(rn.to) || tb; }
112
- else if (s.status === 'now') { a = day(rn.from) || ta; b = tb && (!a || tb >= a) ? tb : null; }
112
+ if (s.status === 'done') { a = ta || day(rn.from); b = tb || day(rn.to); }
113
+ else if (s.status === 'now') { a = ta || day(rn.from); b = tb && (!a || tb >= a) ? tb : null; }
113
114
  else if (s.status !== 'skip') { a = ta; b = tb; }
114
115
  if (a && b && b < a) b = a;
115
116
  return { key: s.key, name: s.name, ms: !!s.ms, cls: finished ? 'done' : s.status, why: s.why || '', a, b, dated: !!(a || b) };