create-pmos 0.651.0 → 0.653.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.651.0",
3
+ "version": "0.653.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.653.0",
38
+ "at": "2026-11-22T01:04:14.172Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1436,
43
+ "t": "The Initiatives | Backlog switch is a tablist with its label again",
44
+ "s": "The Initiatives | Backlog switch is a tablist with its label again",
45
+ "k": "fix"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.652.0",
51
+ "at": "2026-11-20T09:04:15.002Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1434,
56
+ "t": "A done merge resolves its ✦, merged artefacts fold the old files, stage bars follow task dates",
57
+ "s": "A done merge resolves its ✦, merged artefacts fold the old files, stage bars follow task dates",
58
+ "k": "fix"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.651.0",
38
64
  "at": "2026-11-20T07:19:20.677Z",
@@ -284,32 +310,6 @@
284
310
  "k": "fix"
285
311
  }
286
312
  ]
287
- },
288
- {
289
- "v": "0.628.0",
290
- "at": "2026-11-19T06:53:24.081Z",
291
- "f": 4,
292
- "prs": [
293
- {
294
- "n": 1409,
295
- "t": "The work popup fills its width; done tasks muted, not struck through",
296
- "s": "The work popup fills its width; done tasks muted, not struck through",
297
- "k": "fix"
298
- }
299
- ]
300
- },
301
- {
302
- "v": "0.627.0",
303
- "at": "2026-11-19T06:18:29.854Z",
304
- "f": 4,
305
- "prs": [
306
- {
307
- "n": 1408,
308
- "t": "Sprint band layout and theme names",
309
- "s": "Sprint band layout and theme names",
310
- "k": "fix"
311
- }
312
- ]
313
313
  }
314
314
  ]
315
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@e9a16d4c
2
- assembled: 2026-11-20
1
+ kernel-source: pmos@7b0d18fd
2
+ assembled: 2026-11-22
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-20T07:19:17Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T01: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-20T07:19:17Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T01: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-20T07:19:17Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T01:04:11Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  Newest first, ISO dates.
4
4
 
5
- ## 2026-11-20
5
+ ## 2026-11-22
6
6
 
7
7
  - Adopted OKF v0.2 (D73).
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.653.0",
4
+ "at": "2026-11-22T01:04:14.172Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1436,
9
+ "t": "The Initiatives | Backlog switch is a tablist with its label again",
10
+ "s": "The Initiatives | Backlog switch is a tablist with its label again",
11
+ "k": "fix"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.652.0",
17
+ "at": "2026-11-20T09:04:15.002Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1434,
22
+ "t": "A done merge resolves its ✦, merged artefacts fold the old files, stage bars follow task dates",
23
+ "s": "A done merge resolves its ✦, merged artefacts fold the old files, stage bars follow task dates",
24
+ "k": "fix"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.651.0",
4
30
  "at": "2026-11-20T07:19:20.677Z",
@@ -14,7 +14,7 @@ The Backlog lists every open task of the products you picked, the way Jira's bac
14
14
  1. Go to **Board**. Work shows.
15
15
  2. Press **Backlog** on the switch at the top, **Initiatives | Backlog**. The number beside it is how many tasks are open.
16
16
 
17
- On a phone the switch has its own line above the list. PMOS remembers your choice for each pick of products.
17
+ On a phone the switch has its own line above the list. PMOS remembers your choice for each pick of products. A screen reader reads the switch as a set of tabs named "Work".
18
18
 
19
19
  The Work page uses the PMOS design system (see [Layout](layout.md#the-design-system)): the switch is its Tabs, the toolbar buttons its Buttons, and the timeline its chart colours. Done is leaf green, now is blue, planned is grey, and late and the today line are the alert colour.
20
20
 
@@ -140,7 +140,7 @@ 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.
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
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
145
 
146
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.
@@ -148,7 +148,7 @@ Press the rest of a row, or a milestone, to open it as a full popup in place of
148
148
  The right column has two blocks:
149
149
 
150
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.
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.
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.
152
152
 
153
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.
154
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.651.0",
3
+ "version": "0.653.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.651.0",
9
+ "version": "0.653.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.651.0",
3
+ "version": "0.653.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). */
@@ -652,7 +652,7 @@ export function sync(api) {
652
652
  const p = get(PREFS, {}) || {}; SORT = BM.SORTS.some(([k]) => k === p.sort) ? p.sort : 'due'; FOLD = p.fold && typeof p.fold === 'object' ? p.fold : {};
653
653
  const crumb = document.getElementById('crumbHost'), ib = document.getElementById('ibBody');
654
654
  if (!crumb || !ib) return;
655
- sw = document.createElement('span'); sw.className = 'bk-sw pm-tabs'; // the system's Tabs (design-system ui/components/Tabs) sw.setAttribute('role', 'tablist'); sw.setAttribute('aria-label', 'Work');
655
+ sw = document.createElement('span'); sw.className = 'bk-sw pm-tabs'; sw.setAttribute('role', 'tablist'); sw.setAttribute('aria-label', 'Work'); // the system's Tabs (design-system ui/components/Tabs)
656
656
  // on a desk the switch sits in the toolbar after the product picker; on a phone the toolbar is full, so it takes its own line above the list
657
657
  const PH = matchMedia('(max-width: 760px)');
658
658
  const place = () => { if (PH.matches) ib.insertAdjacentElement('beforebegin', sw); else (crumb.closest('.wk-path') || crumb).insertAdjacentElement('afterend', sw); sw.classList.toggle('bk-sw-row', PH.matches); };
@@ -200,7 +200,8 @@ export function artsHtml(arts, o = {}) {
200
200
  const R = (arts || []).map((a, i) => ({ a, i })).filter((x) => !(o.ro && x.a.missing));
201
201
  if (o.ro && !R.length) return '';
202
202
  const rows = R.map(({ a, i }) => {
203
- 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(' · ');
204
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>`;
205
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>`;
206
207
  }).join('');
@@ -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>` : '';
@@ -521,7 +523,7 @@ export function wire(body, h0, x0) {
521
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; }
522
524
  // a milestone ◇ opens its full popup (WorkStatesDS 6); a Jira one and a phone keep the small card
523
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; }
524
- if (d.pwArt != null) { openArt(W.artefacts[+d.pwArt], h, x); 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; }
525
527
  if ('pwAddart' in d) { addArt(x, h); return; }
526
528
  });
527
529
  body.addEventListener('keydown', async (e) => {
@@ -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) };