create-pmos 0.611.0 → 0.613.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 +105 -27
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-calendar-2-test.js +3 -2
- package/workspace/briefing-premium-calendar-3-test.js +1 -1
- package/workspace/briefing-premium-calendar-test.js +1 -1
- package/workspace/briefing-premium-insights-test.js +1 -1
- package/workspace/briefing-premium-test.js +1 -1
- package/workspace/changelog.json +104 -0
- package/workspace/guide/layout.md +52 -18
- package/workspace/guide/programs.md +3 -3
- package/workspace/guide/routine.md +28 -13
- package/workspace/guide/settings-and-switches.md +1 -1
- package/workspace/lib/board-premium.js +12 -4
- package/workspace/lib/cos-chat.js +1 -0
- package/workspace/lib/doc-library.js +43 -12
- package/workspace/lib/doc-path.js +30 -0
- package/workspace/lib/engine/boards.js +4 -2
- package/workspace/lib/events-place.js +190 -38
- package/workspace/lib/events-stated.js +129 -0
- package/workspace/lib/initiative-chat.js +1 -0
- package/workspace/lib/insights-premium.js +13 -1
- package/workspace/lib/library-find.js +162 -0
- package/workspace/lib/library-items.js +196 -24
- package/workspace/lib/notes.js +3 -0
- package/workspace/lib/plan-items.js +17 -3
- package/workspace/lib/routes-artefacts.js +5 -2
- package/workspace/lib/routes-boards.js +6 -2
- package/workspace/lib/routes-doc-sheet.js +1 -0
- package/workspace/lib/routes-events-place.js +47 -10
- package/workspace/lib/routes-library.js +74 -8
- package/workspace/lib/routes-report-setups.js +13 -2
- package/workspace/lib/routine-reports.js +36 -4
- package/workspace/lib/status-when.js +36 -0
- package/workspace/lib/task-items.js +5 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-meet-test.js +2 -1
- package/workspace/premium-vw-notes-test.js +3 -2
- package/workspace/public/pm/artefact-kind.js +87 -0
- package/workspace/public/pm/bd-ini-panel.js +6 -6
- package/workspace/public/pm/bd-span.js +7 -1
- package/workspace/public/pm/bd-work.css +62 -0
- package/workspace/public/pm/bd-work.js +195 -68
- package/workspace/public/pm/cozy-bar.css +11 -0
- package/workspace/public/pm/cozy-bar.js +99 -0
- package/workspace/public/pm/cozy-day-pick.css +27 -0
- package/workspace/public/pm/cozy-day-pick.js +97 -0
- package/workspace/public/pm/cozy-ev.css +0 -4
- package/workspace/public/pm/cozy-events-view.js +165 -33
- package/workspace/public/pm/cozy-events.css +75 -3
- package/workspace/public/pm/cozy-events.js +86 -18
- package/workspace/public/pm/cozy-goals.css +172 -0
- package/workspace/public/pm/cozy-library.css +106 -17
- package/workspace/public/pm/cozy-nav.js +2 -3
- package/workspace/public/pm/cozy-pick.css +3 -0
- package/workspace/public/pm/cozy-pop-work.css +83 -24
- package/workspace/public/pm/cozy-pop-work.js +313 -72
- package/workspace/public/pm/cozy-popup.css +11 -2
- package/workspace/public/pm/cozy-popup.js +67 -9
- package/workspace/public/pm/cozy-routine-job.js +203 -0
- package/workspace/public/pm/cozy-routine-model.js +139 -31
- package/workspace/public/pm/cozy-routine-pop.js +164 -42
- package/workspace/public/pm/cozy-routine.css +61 -8
- package/workspace/public/pm/cozy-routine.js +207 -28
- package/workspace/public/pm/cozy-settings.js +1 -5
- package/workspace/public/pm/cozy-status-when.js +48 -0
- package/workspace/public/pm/cozy-viewer.js +19 -8
- package/workspace/public/pm/cozy-vw-mtg.css +39 -0
- package/workspace/public/pm/goals-model.js +205 -0
- package/workspace/public/pm/goals-open.js +124 -0
- package/workspace/public/pm/home-chat.js +4 -2
- package/workspace/public/pm/home-ini.js +8 -6
- package/workspace/public/pm/ini-edit.js +3 -1
- package/workspace/public/pm/ini-view-model.js +1 -1
- package/workspace/public/pm/library-model.js +170 -42
- package/workspace/public/pm/library-open.js +8 -5
- package/workspace/public/pm/page-chat.js +12 -2
- package/workspace/public/pm/pop-work-model.js +199 -41
- package/workspace/public/pm/premium-board.js +108 -43
- package/workspace/public/pm/premium-goals.js +213 -0
- package/workspace/public/pm/premium-library.js +376 -62
- package/workspace/public/pm/premium-shell.js +1 -1
- package/workspace/public/pm/premium-vw-mtg.js +79 -1
- package/workspace/public/pm/scope-chip.js +207 -0
- package/workspace/public/premium-events.html +3 -1
- package/workspace/public/premium-goals.html +37 -0
- package/workspace/public/premium-library.html +15 -7
- package/workspace/public/premium-routine.html +2 -0
- package/workspace/server.js +2 -1
- package/workspace/test-lists/doc-path.json +9 -0
- package/workspace/test-lists/goals-place.json +9 -0
- package/workspace/test-lists/status-when.json +9 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Routine: everything that repeats"
|
|
4
|
-
timestamp: 2026-11-
|
|
4
|
+
timestamp: 2026-11-19
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Routine: everything that repeats
|
|
@@ -15,20 +15,26 @@ Routine is one table. Each row has these columns:
|
|
|
15
15
|
| Column | What it shows |
|
|
16
16
|
|---|---|
|
|
17
17
|
| Routine | The name of the report, the source, the job or the task. |
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
18
|
+
| Type | Report, Read, PMOS job or Your task. |
|
|
19
|
+
| Product | The product the routine belongs to. This column shows only when the table holds routines of two products or more. |
|
|
20
|
+
| What it does | For a report, who it tells. A report that names no reader tells you. For a read or a job, what it does. |
|
|
21
|
+
| When | How often it repeats, in short words, for example "Every two weeks, Wed 09:00". |
|
|
22
|
+
| Next | The day it runs next, for example "2 Dec" or "Tonight". "Paused" when it is off. "Proposed" when PMOS proposes it. A read that runs every few minutes leaves it empty. |
|
|
23
|
+
| (switch) | Pauses the routine, or starts it again. Every row has the same switch. |
|
|
22
24
|
|
|
23
25
|
The rows are in these groups, in this order:
|
|
24
26
|
|
|
25
|
-
1. **Waits for you.**
|
|
26
|
-
2. **Reports.** Every report that is
|
|
27
|
-
3. **PMOS reads.** The sources PMOS reads. Each service of Your tools is
|
|
27
|
+
1. **Waits for you.** Reports that PMOS proposes. Each shows the schedule PMOS proposes, and its switch is off. Turn the switch on to start it. To drop a proposal, point at the row and press ✕. You have 10 seconds to press **Undo**.
|
|
28
|
+
2. **Reports.** Every report that repeats. A report shows once. When the same report is in two products or in a work copy of a product, the table shows one row for it. Reports that do not repeat (one-time reports and drafts) are in one line at the end of the group. Press that line to show them.
|
|
29
|
+
3. **PMOS reads.** The sources PMOS reads. Each service of Your tools (Mail, Slack and the others) is its own row with its own switch. Turn a service off and PMOS reads it only when you press read.
|
|
28
30
|
4. **PMOS jobs.** The jobs PMOS runs by itself, such as the day check and the initiative driver.
|
|
29
31
|
5. **Your tasks.** Your own scheduled tasks.
|
|
30
32
|
|
|
31
|
-
A group with no rows does not show. Use the kinds at the top (All, Reports, Reads, PMOS jobs, Your tasks) to show one kind. PMOS remembers the kind you chose on this computer.
|
|
33
|
+
A group with no rows does not show. Use the kinds at the top (All, Reports, Reads, PMOS jobs, Your tasks) to show one kind. Each kind shows how many routines it holds. PMOS remembers the kind you chose on this computer.
|
|
34
|
+
|
|
35
|
+
The chip on the left of the kinds is the same chip as on Events. Tick products, programs or projects to show only their routines. The products you tick are the same as on Work. A report shows under a program or a project when its setup is about it. Reads and PMOS jobs serve every product, so they always show. When you tick a program or a project, they fold to their heading, so its reports come first. Press the heading to open them. When the chip hides routines, one grey line says how many. Press **Show all** to show them on this page. What you ticked does not change.
|
|
36
|
+
|
|
37
|
+
When PMOS cannot give a row a name that you can read, it holds the row back and says so in one grey line. Press **Show** to see those rows.
|
|
32
38
|
|
|
33
39
|
## PMOS did
|
|
34
40
|
|
|
@@ -36,14 +42,23 @@ The line at the top says how many things PMOS did since yesterday, and how many
|
|
|
36
42
|
|
|
37
43
|
## Open a routine
|
|
38
44
|
|
|
39
|
-
Press a row. The routine opens in the popup
|
|
45
|
+
Press a row. The routine opens in the popup. When Ask PMOS is hidden, press **Ask PMOS** to show it on the right.
|
|
46
|
+
|
|
47
|
+
Every routine has the same parts:
|
|
48
|
+
|
|
49
|
+
- **Instruction.** What PMOS does in each run, in plain words. For your own tasks and for reports, press the pencil or type in the box, then press ✓ to save. Press **Undo** to go back to the old words. A read or a PMOS job that PMOS wrote shows its instruction without a box and says **Built in**. You can still change how often it runs, and turn it off.
|
|
50
|
+
- **Setup.** The grey box: On, Repeats, Next, Tells, After the run and Built from. Press a value to change it.
|
|
51
|
+
- **Last runs.** The last five runs, and why a run failed.
|
|
52
|
+
- **▶** at the top runs it now. For a report, PMOS drafts the next issue now.
|
|
53
|
+
- **⋯** at the top has **Delete** for your own tasks and reports. A report that PMOS proposes has **Drop**. The row goes at once, and you have 10 seconds to press **Undo**. A deleted report keeps its issues.
|
|
54
|
+
|
|
55
|
+
You can also tell PMOS in the chat what to change, for example "send it on Thursdays" or "run it every two hours".
|
|
40
56
|
|
|
41
|
-
|
|
42
|
-
- **A read, a job or a task.** Its setup: Active, Next run, Repeats, PMOS's proposed rhythm, History, and ▶ to run it now.
|
|
57
|
+
A report also shows its newest issue. When it is a draft, PMOS asks **Issue this draft?** Press ✓ to issue it, or ✕ to stop PMOS from asking about that draft. Issuing freezes the issue. PMOS sends nothing, so you send it from your own mail. Use the chooser to read an older issue. Press the pencil beside the issue to open the full reader, where you can edit, present, share and download the report.
|
|
43
58
|
|
|
44
59
|
## Add a routine
|
|
45
60
|
|
|
46
|
-
Press **+** at the top right. Ask PMOS
|
|
61
|
+
Press **+** at the top right. The popup opens with an empty setup, and Ask PMOS asks **What should repeat?** Tell PMOS what to do, how often and who it tells. PMOS fills in the setup and the instruction, and asks you once before it starts.
|
|
47
62
|
|
|
48
63
|
## Settings
|
|
49
64
|
|
|
@@ -11,7 +11,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
|
|
|
11
11
|
|
|
12
12
|
| Section | What it holds |
|
|
13
13
|
|---|---|
|
|
14
|
-
| General | The theme (Light, Dark or Auto),
|
|
14
|
+
| General | The theme (Light, Dark or Auto), the products Home, the Board and Intelligence read, when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
|
|
15
15
|
| PMOS | **How PMOS decides** for each kind of change, the calls that are **Always yours**, and PMOS's **Lessons**. Then the Claude profile that new sessions start with, the Anthropic API key for PMOS's own runs, Sharpen prompts, and **Checks**: when PMOS grills an initiative by itself and the monthly credit for its checks. |
|
|
16
16
|
| Connectors | Every connector your Claude session has, and a directory of services you can connect. A switch chooses only what PMOS reads on its own. PMOS reads and never posts. |
|
|
17
17
|
| Workspaces | The repositories PMOS works in. Remove forgets the address only; the folder is not deleted. Add one by its folder path. The **Workflows ›** row opens the stages each kind of initiative goes through, inside Settings, which then takes the whole window. See [Workflows](statuses.md). |
|
|
@@ -337,7 +337,7 @@ function build(f) {
|
|
|
337
337
|
// the start too: the Tasks Timeline draws a bar from the start to the due day (batch 9 item 5b)
|
|
338
338
|
taskBy.get(w.ini).push({ uid: w.uid, title: clip(w.title || '', 160), status: w.status || 'To do', owner: w.owner || '', start: w.start || '', end: w.end || '', ...(w.from ? { from: { stage: w.from.stage, finish: w.from.finish } } : {}),
|
|
339
339
|
// one view (feedback batch 6 item 1): its place in the breakdown, and a breakdown item's own stage and order
|
|
340
|
-
...(typeof w.section === 'string' ? { section: w.section } : {}), ...(w.itemStage ? { itemStage: w.itemStage } : {}), ...(Number.isFinite(w.order) ? { order: w.order } : {}), ...(Number.isFinite(w.rank) ? { rank: w.rank } : {}), ...(w.store === 'item' ? { item: true } : {}), ...(w.milestone ? { milestone: true } : {}) });
|
|
340
|
+
...(typeof w.section === 'string' ? { section: w.section } : {}), ...(w.itemStage ? { itemStage: w.itemStage } : {}), ...(Number.isFinite(w.order) ? { order: w.order } : {}), ...(Number.isFinite(w.rank) ? { rank: w.rank } : {}), ...(w.store === 'item' ? { item: true } : {}), ...(w.milestone ? { milestone: true } : {}), ...(w.since ? { since: w.since } : {}) });
|
|
341
341
|
}
|
|
342
342
|
// the milestones of each initiative (feedback batch 11 item 3): its tasks flagged ◇, PMOS and Jira alike, at their due dates. Won't do and
|
|
343
343
|
// Archived take one off the timeline; one with no due date is not drawn (the Tasks list asks for the date)
|
|
@@ -378,14 +378,22 @@ function build(f) {
|
|
|
378
378
|
const sprints = Array.isArray(sp.sprints) ? sp.sprints : [];
|
|
379
379
|
// The current sprint: the active one, else the next to start, else the latest closed by its end date (the list sorts closed sprints by name, oldest first).
|
|
380
380
|
const latestClosed = sprints.filter((s) => s.state === 'closed').sort((a, b) => String(b.end || '').localeCompare(String(a.end || '')) || String(b.name).localeCompare(String(a.name), undefined, { numeric: true }))[0];
|
|
381
|
-
|
|
381
|
+
// Work round 3 (Wawan, 2026-11-19: "it stays on MAD 115 even though it has already moved to the other sprint"): a reading can still mark a
|
|
382
|
+
// sprint active after its end date, or hold two active ones. Today decides: the sprint whose dates hold today (the latest start), else the
|
|
383
|
+
// open one with the latest start; an open one whose end has passed gives way to a later open one, and `passed` names it so the page says so.
|
|
384
|
+
const d10 = (v) => (v ? String(v).slice(0, 10) : '');
|
|
385
|
+
const openS = sprints.filter((s) => s.state !== 'closed').sort((a, b) => d10(b.start).localeCompare(d10(a.start)) || String(b.name).localeCompare(String(a.name), undefined, { numeric: true }));
|
|
386
|
+
const holds = openS.find((s) => d10(s.start) && d10(s.end) && d10(s.start) <= todayIso && todayIso <= d10(s.end));
|
|
387
|
+
const live = holds || openS.find((s) => s.state === 'active') || openS.slice().reverse().find((s) => d10(s.start) > todayIso) || openS[0] || null;
|
|
388
|
+
const stale = sprints.filter((s) => s.state === 'active' && s !== live && d10(s.end) && d10(s.end) < todayIso).sort((a, b) => d10(b.end).localeCompare(d10(a.end)))[0] || null;
|
|
389
|
+
const active = sp.source === 'jira' ? (live || latestClosed || null) : null;
|
|
382
390
|
const goalText = active && active.goal ? (typeof active.goal === 'object' ? active.goal.text || '' : String(active.goal)) : '';
|
|
383
391
|
const wd = (a, b) => { const x = isoDay(a), y = isoDay(b); if (!x || !y) return null; let n = 0; for (const d = new Date(x); d <= y; d.setDate(d.getDate() + 1)) if (d.getDay() % 6) n++; return n; }; // weekdays, both ends counted
|
|
384
392
|
const sprint = active
|
|
385
393
|
? (() => {
|
|
386
394
|
const k = active.counts || {}, c = { done: k.done || 0, doing: k.doing || 0, todo: k.todo || 0 }, tot = c.done + c.doing + c.todo, st = active.start && String(active.start).slice(0, 10), en = active.end && String(active.end).slice(0, 10);
|
|
387
395
|
const open = active.state !== 'closed', len = st && en ? wd(st, en) : null, at = len && todayIso >= st ? Math.min(len, wd(st, todayIso)) : null, left = open && en ? days(todayIso, en) : null;
|
|
388
|
-
return { cap: open && len && at != null ? 'day ' + at + ' of ' + len : active.state || '', name: active.name, state: active.state, start: st ? shortDate(st) : '', end: en ? shortDate(en) : '', counts: c,
|
|
396
|
+
return { cap: open && len && at != null ? 'day ' + at + ' of ' + len : active.state || '', name: active.name, state: active.state, passed: stale ? stale.name : '', over: !!(open && en && en < todayIso), start: st ? shortDate(st) : '', end: en ? shortDate(en) : '', counts: c,
|
|
389
397
|
pct: tot ? { done: +(c.done / tot * 100).toFixed(1), doing: +(c.doing / tot * 100).toFixed(1) } : { done: 0, doing: 0 },
|
|
390
398
|
goal: goalText ? clip(goalText, 300) : '', tickets: (active.issues || []).slice(0, 40).map((i) => ({ key: i.key, title: clip(i.summary || i.key, 120), status: i.status || ({ done: 'Done', doing: 'Doing', todo: 'To do' })[i.category] || '' })), review: left == null ? '' : left < 0 ? 'Sprint ended ' + plural(-left, 'a day', -left + ' days') + ' ago.' : left === 0 ? 'Sprint review is today.' : 'Sprint review in ' + left + ' ' + plural(left, 'day', 'days') + '.' };
|
|
391
399
|
})()
|
|
@@ -443,7 +451,7 @@ function build(f) {
|
|
|
443
451
|
// the Agreed design (premium-agreed-design): the eight steps with the board's own count in each, the Jira read time and the chip counts
|
|
444
452
|
steps: STEPS.map((st, i) => ({ ...st, count: stages.filter((c) => stepIndex(c.stage, c.cat) === i).reduce((n, c) => n + c.count, 0) })),
|
|
445
453
|
jira: { source: sp.source || 'none', readAt: sp.readAt || null, release: nr && nr.at ? { name: nr.name || nr.id, at: shortDate(String(nr.at).slice(0, 10)), iso: String(nr.at).slice(0, 10) } : null,
|
|
446
|
-
sprint: active ? { name: active.name, start: active.start ? String(active.start).slice(0, 10) : null, end: active.end ? String(active.end).slice(0, 10) : null } : null,
|
|
454
|
+
sprint: active ? { name: active.name, start: active.start ? String(active.start).slice(0, 10) : null, end: active.end ? String(active.end).slice(0, 10) : null, passed: stale ? stale.name : '', over: !!(active.state !== 'closed' && d10(active.end) && d10(active.end) < todayIso) } : null,
|
|
447
455
|
// every sprint of the reading, oldest first, with its points where the reading holds them (initiative premium-uncovered-features, BdSprint)
|
|
448
456
|
sprints: sp.source === 'jira' ? sprints.slice().sort((a, b) => String(a.start || '').localeCompare(String(b.start || ''))).map((x) => {
|
|
449
457
|
const iss = x.issues || [], pts = iss.filter((i) => Number.isFinite(i.points)), k = x.counts || {};
|
|
@@ -55,6 +55,7 @@ const RULE = [
|
|
|
55
55
|
'Never from this chat: accept a run, anchor or dispose an initiative, approve a contract, merge a pull request. These stay on the PM-only pages. Say where each one waits and stop.',
|
|
56
56
|
'You are the chief: the one live session over every Program, Product and Project. Each unit has one owner, a record with a daily brief, never a session; an initiative in a program is the program\'s, else its product\'s. Never ask another session; read the records. `pmos units` lists the units and their briefs. You may run these yourself: `pmos owner brief [<unit>]` (a fresh brief now), `pmos team dispatch --unit <unit>` (the roles for the unit\'s first open initiative), `pmos team pause|resume --unit <unit>` (stop or restart the role runs on a unit). When the same lesson shows in two units, file it with `pmos propose` as a workspace rule the PM keeps or drops.',
|
|
57
57
|
'Answer in plain sentences, the answer first. Never start with "I can help with".',
|
|
58
|
+
'Speak to the PM as "you", in the first person ("I archived them"). Never write "The PM says" or speak of the PM in the third person.',
|
|
58
59
|
].join('\n');
|
|
59
60
|
|
|
60
61
|
/** The message as typed into a live session. page: the "You are on …" chip's words, or '' when the PM dropped it. */
|
|
@@ -62,12 +62,38 @@ const git = (cwd, args) => execFileSync('git', args, { cwd, encoding: 'utf8', ma
|
|
|
62
62
|
/** path → YYYY-MM-DD of its last commit (one git log; merge commits are skipped, their changes are in their parents). */
|
|
63
63
|
function commitDates(root) {
|
|
64
64
|
const out = new Map();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
for (const [p, c] of commitInfo(root)) out.set(p, c.day);
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Who wrote a commit, for the Library's By column: 'PMOS' when an agent wrote it (the author or a Co-Authored-By trailer is an agent or a
|
|
70
|
+
* bot), 'You' when the author is the repository's own git user, null for a squash merge of a pull request with no agent trailer (the
|
|
71
|
+
* merger is not the writer), else the author's name. PURE. */
|
|
72
|
+
const AGENT_RE = /noreply@anthropic\.com|claude\.ai\/code|\bclaude\b|\bpmos\b|\[bot\]|github-actions|dependabot|copilot|codex/i;
|
|
73
|
+
function byOf({ name = '', email = '', co = '', subject = '' } = {}, me = '') {
|
|
74
|
+
if (AGENT_RE.test(name) || AGENT_RE.test(email) || AGENT_RE.test(co)) return 'PMOS';
|
|
75
|
+
// a squash merge of a pull request ("… (#1362)") names who merged it, not who wrote the file: By cannot be told
|
|
76
|
+
if (/\(#\d+\)\s*$/.test(subject)) return null;
|
|
77
|
+
if (me && email && email.toLowerCase() === String(me).toLowerCase()) return 'You';
|
|
78
|
+
return String(name || '').trim() || null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** path → { day, by } of its last commit (one git log). */
|
|
82
|
+
function commitInfo(root) {
|
|
83
|
+
const out = new Map();
|
|
84
|
+
let text = '', me = '';
|
|
85
|
+
try { me = git(root, ['config', 'user.email']).trim(); } catch { me = ''; }
|
|
86
|
+
try { text = git(root, ['log', '--format=%x01%cs%x02%an%x02%ae%x02%s%x02%(trailers:key=Co-Authored-By,key=Claude-Session,valueonly,separator=%x03)%x04', '--name-only', '--', '*.md']); } catch { return out; }
|
|
87
|
+
let cur = null;
|
|
88
|
+
for (const raw of text.split('\n')) {
|
|
89
|
+
const line = raw.trim();
|
|
90
|
+
if (raw.startsWith('\x01')) {
|
|
91
|
+
const [day, name, email, subject, rest] = raw.slice(1).split('\x02');
|
|
92
|
+
const co = String(rest || '').split('\x04')[0];
|
|
93
|
+
cur = { day, by: byOf({ name, email, co, subject }, me) };
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (line && cur && !line.includes('\x04') && !out.has(line)) out.set(line, cur);
|
|
71
97
|
}
|
|
72
98
|
return out;
|
|
73
99
|
}
|
|
@@ -86,7 +112,7 @@ const cache = new Map(); // root -> { key, value }
|
|
|
86
112
|
* The library of one repository.
|
|
87
113
|
* owners: () => Map path → { id, title } — the library's own attribution (server.js initiativeIndex), real initiatives
|
|
88
114
|
* only. It is called only when the repository state changed, because the index reads every planning file.
|
|
89
|
-
* Returns { ok, files: [{path,title,category,date,initiative}], initiatives: {id: {title, short}}, kinds, edges: [[from, to, kind]], categories }.
|
|
115
|
+
* Returns { ok, files: [{path,title,category,date,initiative,status,type,by}], initiatives: {id: {title, short}}, kinds, edges: [[from, to, kind]], categories }.
|
|
90
116
|
* `from` and `to` index `files`; `kind` indexes `kinds`.
|
|
91
117
|
*/
|
|
92
118
|
function library(root, { stateDir, owners = () => new Map() } = {}) {
|
|
@@ -97,12 +123,16 @@ function library(root, { stateDir, owners = () => new Map() } = {}) {
|
|
|
97
123
|
const { graph, unreadable } = kgCli.graphFor(root, stateDir ? { stateDir } : {});
|
|
98
124
|
let own = new Map();
|
|
99
125
|
try { own = owners() || new Map(); } catch { /* no attribution: every file has no initiative */ }
|
|
100
|
-
const
|
|
126
|
+
const info = commitInfo(root);
|
|
101
127
|
const dirty = dirtyPaths(root);
|
|
102
128
|
const dayOf = (rel) => {
|
|
103
|
-
if (!dirty.has(rel) &&
|
|
104
|
-
try { return fs.statSync(path.join(root, rel)).mtime.toISOString().slice(0, 10); } catch { return
|
|
129
|
+
if (!dirty.has(rel) && info.has(rel)) return info.get(rel).day;
|
|
130
|
+
try { return fs.statSync(path.join(root, rel)).mtime.toISOString().slice(0, 10); } catch { return info.has(rel) ? info.get(rel).day : null; }
|
|
105
131
|
};
|
|
132
|
+
// an uncommitted change is the PM's own, until it is committed
|
|
133
|
+
// the file's own frontmatter (author, by, owner) names who wrote it first; then the last commit
|
|
134
|
+
const writer = (n) => { const m = /(?:^|\s)(?:author|by|owner):\s*"?([^"\n]{2,60}?)"?(?=\s+[a-z_]+:|\s*---|$)/i.exec(String(n.card || '')); return m ? m[1].trim() : null; };
|
|
135
|
+
const byOfPath = (rel, n) => writer(n) || (dirty.has(rel) || !info.has(rel) ? 'You' : info.get(rel).by);
|
|
106
136
|
// An initiative is named by its record's title (planning/initiatives/<id>.md), else by the index's title for it.
|
|
107
137
|
const titleOf = new Map(graph.nodes.map((n) => [n.id, n.title]));
|
|
108
138
|
const named = (o) => String(titleOf.get(`planning/initiatives/${o.id}.md`) || o.title || o.id);
|
|
@@ -110,7 +140,8 @@ function library(root, { stateDir, owners = () => new Map() } = {}) {
|
|
|
110
140
|
const files = graph.nodes.map((n) => {
|
|
111
141
|
const o = own.get(n.id) || null;
|
|
112
142
|
if (o && !initiatives[o.id]) initiatives[o.id] = { title: named(o), short: shortTitle(named(o)) };
|
|
113
|
-
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
|
|
143
|
+
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,
|
|
144
|
+
type: n.type ? String(n.type) : null, by: byOfPath(n.id, n) };
|
|
114
145
|
});
|
|
115
146
|
const index = new Map(files.map((f, i) => [f.path, i]));
|
|
116
147
|
const seen = new Set();
|
|
@@ -128,4 +159,4 @@ function library(root, { stateDir, owners = () => new Map() } = {}) {
|
|
|
128
159
|
return value;
|
|
129
160
|
}
|
|
130
161
|
|
|
131
|
-
module.exports = { CATEGORIES, KINDS, categoryOf, shortTitle, kindOf, library, commitDates };
|
|
162
|
+
module.exports = { CATEGORIES, KINDS, categoryOf, shortTitle, kindOf, library, commitDates, commitInfo, byOf };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* doc-path.js — one way to find a document a record names (popup round 3 point 17: "pmos/planning/prd/smrt-news-feed-prd.md could not be
|
|
3
|
+
* read").
|
|
4
|
+
*
|
|
5
|
+
* candidates(rel) → the paths to try, in order: as given; then, in a kit repository, the same path with its leading "pmos/" taken
|
|
6
|
+
* off or put on (a record written from the repository root says "pmos/planning/…", one written from the kit
|
|
7
|
+
* folder says "planning/…"); a doubled "pmos/pmos/" once only. Never a path that leaves the root (the callers
|
|
8
|
+
* still guard every read with their own root check).
|
|
9
|
+
* resolve(root, rel, exists?) → the first candidate that exists under root, else rel unchanged (the caller's read then says why it failed)
|
|
10
|
+
*
|
|
11
|
+
* Pure but for exists (fs.existsSync by default). Used by GET /api/doc (server.js readTextDocWhy) and the document page's reads
|
|
12
|
+
* (lib/routes-doc-sheet.js resolveDoc), so both find the same file. */
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
|
|
16
|
+
function candidates(rel) {
|
|
17
|
+
const r = String(rel == null ? '' : rel).trim().replace(/\\/g, '/').replace(/^\.\//, '');
|
|
18
|
+
if (!r) return [];
|
|
19
|
+
const out = [r];
|
|
20
|
+
const once = r.replace(/^(pmos\/)+/, 'pmos/');
|
|
21
|
+
if (once !== r) out.push(once);
|
|
22
|
+
if (/^pmos\//.test(once)) out.push(once.slice(5)); else out.push('pmos/' + r);
|
|
23
|
+
return [...new Set(out)];
|
|
24
|
+
}
|
|
25
|
+
function resolve(root, rel, exists = (p) => { try { return fs.statSync(p).isFile(); } catch { return false; } }) {
|
|
26
|
+
if (!root) return rel;
|
|
27
|
+
for (const c of candidates(rel)) if (exists(path.resolve(root, c))) return c;
|
|
28
|
+
return rel;
|
|
29
|
+
}
|
|
30
|
+
module.exports = { candidates, resolve };
|
|
@@ -301,7 +301,9 @@ function fold(events) {
|
|
|
301
301
|
if (typeof e.title === 'string' && e.title.trim()) t.title = e.title.trim(); // a rename (canvas RnATask)
|
|
302
302
|
if (typeof e.owner === 'string') t.owner = e.owner.trim() || null; // the Viewer's edits (canvas XetX1Rest); '' clears
|
|
303
303
|
if (typeof e.notes === 'string') t.notes = e.notes;
|
|
304
|
-
|
|
304
|
+
// happened: the day a status move really happened, apart from `at`, when it was recorded (popup round 3 point 18)
|
|
305
|
+
t.history.push({ at: e.at || null, by: e.by || null, state: e.state || null, start: e.start || null, due: e.due || null, why: e.why || '', ...(typeof e.happened === 'string' ? { happened: e.happened } : {}) });
|
|
306
|
+
if (taskState(e.state)) t.since = typeof e.happened === 'string' ? e.happened : String(e.at || '').slice(0, 10) || null;
|
|
305
307
|
} else if (e.kind === 'task-section' && typeof e.task === 'string' && e.task && typeof e.section === 'string') {
|
|
306
308
|
sections.set(e.task, e.section);
|
|
307
309
|
} else if (e.kind === 'task-milestone' && typeof e.task === 'string' && e.task && typeof e.milestone === 'boolean') {
|
|
@@ -414,7 +416,7 @@ function itemStatus(status, category) {
|
|
|
414
416
|
/** A PMOS task as a work item. */
|
|
415
417
|
function taskItem(t) {
|
|
416
418
|
return { uid: t.id, key: '', kind: t.kind === 'Epic' ? 'Epic' : 'Task', src: 'pmos', title: t.title, status: t.state, blocked: false, owner: t.owner || null, notes: t.notes || '',
|
|
417
|
-
ini: t.initiative, epic: t.epic || null, start: t.start || null, end: t.due || null, ref: t.id, board: t.board, ...(t.from ? { from: { ...t.from } } : {}) };
|
|
419
|
+
ini: t.initiative, epic: t.epic || null, start: t.start || null, end: t.due || null, ref: t.id, board: t.board, ...(t.since ? { since: t.since } : {}), ...(t.from ? { from: { ...t.from } } : {}) };
|
|
418
420
|
}
|
|
419
421
|
/** Progress per item, and an epic's status, progress, blocked flag and dates rolled up from its items. Mutates and returns items. */
|
|
420
422
|
function rollupItems(items) {
|