create-pmos 0.615.0 → 0.616.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 +44 -14
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +43 -0
- package/workspace/guide/backlog.md +70 -0
- package/workspace/guide/cli.md +1 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/layout.md +3 -2
- package/workspace/guide/programs.md +1 -1
- package/workspace/guide/routine.md +1 -1
- package/workspace/lib/backlog.js +323 -0
- package/workspace/lib/day-run.js +3 -2
- package/workspace/lib/doc-library.js +26 -3
- package/workspace/lib/jira-status.js +4 -1
- package/workspace/lib/mention-cli.js +7 -5
- package/workspace/lib/mention-store.js +9 -5
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-backlog.js +283 -0
- package/workspace/lib/routes-boards.js +13 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.css +158 -0
- package/workspace/public/pm/bd-backlog.js +531 -0
- package/workspace/public/pm/bk-model.js +169 -0
- package/workspace/public/pm/cozy-pick.js +6 -3
- package/workspace/public/pm/cozy-routine.js +3 -2
- package/workspace/public/pm/cozy-today-app.js +23 -5
- package/workspace/public/pm/cozy-today-model.js +44 -10
- package/workspace/public/pm/cozy-today-page.css +9 -1
- package/workspace/public/pm/cozy-today-view.js +14 -9
- package/workspace/public/pm/home-app.js +5 -0
- package/workspace/public/pm/mention-one-model.js +6 -4
- package/workspace/public/pm/premium-board.js +21 -3
- package/workspace/public/pm/premium-goals.js +12 -9
- package/workspace/public/pm/premium-library.js +15 -3
- package/workspace/public/premium-board.html +1 -0
- package/workspace/skills/morning-brief.skill +1 -1
- package/workspace/test-lists/backlog.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.616.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,49 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.616.0",
|
|
38
|
+
"at": "2026-11-19T03:35:36.328Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1393,
|
|
43
|
+
"t": "Library By names a known person or nothing; Product uses the shared product name",
|
|
44
|
+
"s": "Library By names a known person or nothing; Product uses the shared product name",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"n": 1388,
|
|
49
|
+
"t": "The Backlog in Work, every task in one list, and PMOS finishing tasks itself",
|
|
50
|
+
"s": "The Backlog in Work, every task in one list, and PMOS finishing tasks itself",
|
|
51
|
+
"k": "new"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"n": 1396,
|
|
55
|
+
"t": "Routine prints products by the shared productName()",
|
|
56
|
+
"s": "Routine prints products by the shared productName()",
|
|
57
|
+
"k": "fix"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"n": 1398,
|
|
61
|
+
"t": "Product chip and headings say the product's name, not its folder",
|
|
62
|
+
"s": "Product chip and headings say the product's name, not its folder",
|
|
63
|
+
"k": "fix"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"n": 1392,
|
|
67
|
+
"t": "Today: PMOS clears an ask someone else answered; audit round 2 fixes",
|
|
68
|
+
"s": "Today: PMOS clears an ask someone else answered; audit round 2 fixes",
|
|
69
|
+
"k": "new"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"n": 1397,
|
|
73
|
+
"t": "Work and its product chip print each product's display name",
|
|
74
|
+
"s": "Work and its product chip print each product's display name",
|
|
75
|
+
"k": "fix"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
36
79
|
{
|
|
37
80
|
"v": "0.615.0",
|
|
38
81
|
"at": "2026-11-19T03:15:37.053Z",
|
|
@@ -411,19 +454,6 @@
|
|
|
411
454
|
"k": "new"
|
|
412
455
|
}
|
|
413
456
|
]
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
"v": "0.596.0",
|
|
417
|
-
"at": "2026-11-18T03:21:21.557Z",
|
|
418
|
-
"f": 4,
|
|
419
|
-
"prs": [
|
|
420
|
-
{
|
|
421
|
-
"n": 1333,
|
|
422
|
-
"t": "Settings › Connectors as a directory you can connect from",
|
|
423
|
-
"s": "Settings › Connectors as a directory you can connect from",
|
|
424
|
-
"k": "new"
|
|
425
|
-
}
|
|
426
|
-
]
|
|
427
457
|
}
|
|
428
458
|
]
|
|
429
459
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-19T03:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-19T03:35:33Z"}
|
|
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-19T03:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-19T03:35:33Z"}
|
|
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-19T03:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-19T03:35:33Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,47 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.616.0",
|
|
4
|
+
"at": "2026-11-19T03:35:36.328Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1393,
|
|
9
|
+
"t": "Library By names a known person or nothing; Product uses the shared product name",
|
|
10
|
+
"s": "Library By names a known person or nothing; Product uses the shared product name",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"n": 1388,
|
|
15
|
+
"t": "The Backlog in Work, every task in one list, and PMOS finishing tasks itself",
|
|
16
|
+
"s": "The Backlog in Work, every task in one list, and PMOS finishing tasks itself",
|
|
17
|
+
"k": "new"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"n": 1396,
|
|
21
|
+
"t": "Routine prints products by the shared productName()",
|
|
22
|
+
"s": "Routine prints products by the shared productName()",
|
|
23
|
+
"k": "fix"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"n": 1398,
|
|
27
|
+
"t": "Product chip and headings say the product's name, not its folder",
|
|
28
|
+
"s": "Product chip and headings say the product's name, not its folder",
|
|
29
|
+
"k": "fix"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"n": 1392,
|
|
33
|
+
"t": "Today: PMOS clears an ask someone else answered; audit round 2 fixes",
|
|
34
|
+
"s": "Today: PMOS clears an ask someone else answered; audit round 2 fixes",
|
|
35
|
+
"k": "new"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"n": 1397,
|
|
39
|
+
"t": "Work and its product chip print each product's display name",
|
|
40
|
+
"s": "Work and its product chip print each product's display name",
|
|
41
|
+
"k": "fix"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
2
45
|
{
|
|
3
46
|
"v": "0.615.0",
|
|
4
47
|
"at": "2026-11-19T03:15:37.053Z",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Guide
|
|
3
|
+
title: "The Backlog"
|
|
4
|
+
description: "Every open task of your products in one list, the way Jira lists them, and the tasks PMOS takes and finishes itself."
|
|
5
|
+
timestamp: 2026-11-19
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# The Backlog
|
|
9
|
+
|
|
10
|
+
The Backlog lists every open task of the products you picked, the way Jira's backlog lists them. It holds PMOS tasks and Jira tickets together. Stage belongs to an initiative and not to a task, so the Backlog has no Stage column.
|
|
11
|
+
|
|
12
|
+
## Open it
|
|
13
|
+
|
|
14
|
+
1. Go to **Board**. Work shows.
|
|
15
|
+
2. Press **Backlog** on the switch at the top, **Initiatives | Backlog**. The number beside it is how many tasks are open.
|
|
16
|
+
|
|
17
|
+
On a phone the switch has its own line above the list. PMOS remembers your choice for each pick of products.
|
|
18
|
+
|
|
19
|
+
## The columns
|
|
20
|
+
|
|
21
|
+
| Column | What it shows |
|
|
22
|
+
|---|---|
|
|
23
|
+
| Task | The name. □ is a task and ◇ is a milestone. Press the name to open the task. |
|
|
24
|
+
| Jira ticket | The key, when the task is a Jira ticket. |
|
|
25
|
+
| Epic | The epic of the Jira ticket, or **No epic**. |
|
|
26
|
+
| Initiative | The initiative that holds the task. In No home it is empty, or it shows ✦ the initiative PMOS proposes. |
|
|
27
|
+
| Who | The task owner, else the Jira assignee. When PMOS has the task, it shows **PMOS**. |
|
|
28
|
+
| State | The state, how late the task is, and what PMOS does or why the task waits for you. |
|
|
29
|
+
|
|
30
|
+
## The groups
|
|
31
|
+
|
|
32
|
+
The groups show in this order. An empty group does not show.
|
|
33
|
+
|
|
34
|
+
1. **Needs your review.** PMOS finished these tasks and cannot pass them alone.
|
|
35
|
+
2. **PMOS is working.** You do not need to do anything. The ⋯ menu has **Stop** and **Give to a person**.
|
|
36
|
+
3. **PMOS can take these.** PMOS has what it needs to start. Press ✓ to give one task to PMOS, or ✕ to keep it from PMOS. **Yes to these 5** gives only the rows you can see. After you open the whole group, it says **Yes to all**. After a yes, one line with **Undo** shows.
|
|
37
|
+
4. **With people.** A person has the task.
|
|
38
|
+
5. **Nobody has these.** No person or agent has the task.
|
|
39
|
+
6. **No home.** The task is in no initiative, for example a Jira ticket of a sprint that no initiative holds. PMOS proposes an initiative only when the ticket's epic is the epic of that initiative. Press ✓ to put the ticket there, or ✕ to refuse the proposal. Jira is not changed.
|
|
40
|
+
7. **Done by PMOS today.** PMOS finished these by itself today. Each one has **Undo**.
|
|
41
|
+
|
|
42
|
+
The quick filters at the top count each group alone. Group filters add to each other. **Jira tickets** and **This sprint** narrow the list. The tune button holds **Sort** and the filters for Initiative, Who, Epic, Sprint and Status. When a filter is on, a line says what shows and how many tasks are hidden.
|
|
43
|
+
|
|
44
|
+
Tick rows to give them to PMOS or to a person, move them to an initiative, set a date, or archive them. On a phone, a long press on a row shows the tick boxes.
|
|
45
|
+
|
|
46
|
+
## What PMOS can take
|
|
47
|
+
|
|
48
|
+
What PMOS can take depends on the initiative's kind of work and on the task's own words. The line under the filters names the kind, for example "Most work here runs as Full SDLC (3 of 5 initiatives)". **Change** lists each initiative with its kind of work, and you can change each one there. This is the same setting as the one in the initiative's popup.
|
|
49
|
+
|
|
50
|
+
| Kind of work | What PMOS can take |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Product management | Documents, and replies that it drafts and you send. |
|
|
53
|
+
| Project management | The same, and chasing dates and status notes. |
|
|
54
|
+
| Full SDLC | The same, and tests and checks. Where a factory runs in the product's repository, a build task becomes a pull request. |
|
|
55
|
+
|
|
56
|
+
PMOS does not offer a milestone, a task that someone works on, or a task whose words do not tell it what to do.
|
|
57
|
+
|
|
58
|
+
## When PMOS asks you
|
|
59
|
+
|
|
60
|
+
PMOS asks you to review a result only when it is necessary:
|
|
61
|
+
|
|
62
|
+
- **A message that goes out always waits.** The reason says who it goes to, for example "goes out to Daryl".
|
|
63
|
+
- **A pull request waits only when its changed files touch a guarded part:** migrations, sign-in, payments, personal data, secrets, CI, dependencies or a public API. It also waits when PMOS cannot read its files. Any other pull request stays in **PMOS is working**, and the repository's own checks decide. PMOS never merges a pull request.
|
|
64
|
+
- **A document waits only when it goes to other people.** The reason says who, for example "goes to the CFO". A document for you finishes by itself and goes to **Done by PMOS today**.
|
|
65
|
+
|
|
66
|
+
PMOS reads Jira and never writes to it.
|
|
67
|
+
|
|
68
|
+
**Review** shows what PMOS made. A message shows in full, and you can change its words before you send it. A pull request shows its summary, the files it changes, its checks and a link to it. A document shows as it is written. ✓ approves the result. The return arrow sends the result back to PMOS with one line on what to change.
|
|
69
|
+
|
|
70
|
+
Nothing starts by itself. PMOS proposes the tasks it can take, and starts a task only after you press yes.
|
package/workspace/guide/cli.md
CHANGED
|
@@ -83,6 +83,7 @@ These commands post nothing:
|
|
|
83
83
|
- `pmos mention stands <id> --settled "<line>" [--open "<line>"]` saves Where it stands.
|
|
84
84
|
- `pmos mention watch <id> --what "<Samuel’s tag>" --text "<the offer>"` offers to watch for a dated promise.
|
|
85
85
|
- `pmos mention landed <id> --text "<Samuel’s tag landed.>"` says that the promise landed.
|
|
86
|
+
- `pmos mention answered <id> --who "<name>" --text "<their line>" [--on <ISO>]` says that someone else answered and the asker accepted it. The ask leaves Today into PMOS handled, with the line quoted and Undo.
|
|
86
87
|
- `pmos mention looks <id> --who "<name>" --text "<their line>" [--on <ISO>]` says that someone else may have answered, with their line quoted. Today shows it under the ask with ✓ ✕; nothing closes until you confirm.
|
|
87
88
|
|
|
88
89
|
### pmos lead: PMOS's leads in popups
|
package/workspace/guide/index.md
CHANGED
|
@@ -57,6 +57,7 @@ PMOS has three places: **Home**, **Board** and **Intelligence**. The round menu
|
|
|
57
57
|
- [The Board](programs.md): the top row, what a status means, All products, groupings, the stage track, Kanban, timeline and List, the program panel, milestones, a published read-only copy of a Board, and the core documents of each level.
|
|
58
58
|
- [Statuses, the lifecycle and workflows](statuses.md): what each status means and where it comes from, the steps every initiative goes through, and Settings › Workspaces › Workflows.
|
|
59
59
|
- [Initiatives: the Roadmap, next steps, the Driver and done](initiatives-and-next-steps.md): one ranked list of initiatives, how PMOS works out the next steps and who owns each, the Initiative Driver, and integrated work from a merged commit to Done.
|
|
60
|
+
- [The Backlog](backlog.md): every open task of your products in one list, Jira-style; No home; the tasks PMOS can take, and when it asks you to review.
|
|
60
61
|
- [An initiative's tasks](breakdown.md): tasks under their initiative, tasks an agent adds, and who made a change.
|
|
61
62
|
- [Jira tickets](jira.md): Jira tickets drafted from the PRD, pushed when you select them, their status and the sprints.
|
|
62
63
|
|
|
@@ -133,7 +133,8 @@ A Jira date and the planned finish of an initiative get no ✓: PMOS cannot writ
|
|
|
133
133
|
|
|
134
134
|
- **Kind** says what the thing is: PRD, Strategic brief, Design brief, Done test, Meeting notes, Prototype, Link · Confluence, and so on. PMOS reads it from the file's `type` first, then from its title ("Brief: …") and its file name. When the title only repeats the kind, the name leaves it out: "Brief: Scarlet lucky draw" shows as "Scarlet lucky draw", Kind Strategic brief.
|
|
135
135
|
- **About** is the program and the initiative ("Project Ascent › Tender new CIAM"). It is empty when it repeats the name.
|
|
136
|
-
- **By** is **You**, **PMOS** (an agent wrote it) or a person
|
|
136
|
+
- **By** is **You**, **PMOS** (an agent wrote it) or the name of a person in People. A git author that People does not know shows nothing, not the raw handle.
|
|
137
|
+
- **Product** is the product's display name, the same one the scope chip shows. A work copy or a worktree shows the product it is a copy of.
|
|
137
138
|
- **State** is **Draft**, **Final** or **Issued**, with the edition when there is more than one ("Final · v3"). Older editions fold under the newest: press **2 earlier** to see them.
|
|
138
139
|
- Grouped by New, the checks PMOS keeps for one initiative (done test, rubric, retro) fold into one **Checks** row.
|
|
139
140
|
|
|
@@ -148,7 +149,7 @@ The notes of a held meeting look the same wherever you open them: a short summar
|
|
|
148
149
|
|
|
149
150
|
## Goals
|
|
150
151
|
|
|
151
|
-
**Goals** in the navigation answers "Am I on track? What do I do?" for the products you chose at the top left. It reads your OKR file as one hierarchy: the North Star, then each objective with its key results, the levers behind them and the initiatives that move them.
|
|
152
|
+
**Goals** in the navigation answers "Am I on track? What do I do?" for the products you chose at the top left. The product choice and each product's heading show the product's name, such as IDPF, not the name of its folder. It reads your OKR file as one hierarchy: the North Star, then each objective with its key results, the levers behind them and the initiatives that move them.
|
|
152
153
|
|
|
153
154
|
1. The card at the top is the North Star. When PMOS drafted one, press the tick to approve it or the cross to drop it. You can undo either for a moment.
|
|
154
155
|
2. Each key result shows its reading against its target and the days left. A grey dot and a dash mean nothing reads it yet: the line under it says what it waits on. PMOS never shows a number it did not read.
|
|
@@ -19,7 +19,7 @@ A cancelled or archived initiative leaves its program's views: the band, the pro
|
|
|
19
19
|
|
|
20
20
|
On a computer the Board place is **Work**: one list of initiatives with the timeline on its right. There are no List, By stage, Track or Timeline views to choose.
|
|
21
21
|
|
|
22
|
-
- **The columns.** Initiative, Product, Stage, Next milestone and Date, in this order. **Next milestone** is the name of the milestone. When an initiative has no milestone, the cell is empty and the date is the end of its plan. Only a late or at-risk date has colour, for example "4 Nov · 14 days late". The Product column does not show when you pick one product.
|
|
22
|
+
- **The columns.** Initiative, Product, Stage, Next milestone and Date, in this order. **Next milestone** is the name of the milestone. When an initiative has no milestone, the cell is empty and the date is the end of its plan. Only a late or at-risk date has colour, for example "4 Nov · 14 days late". The Product column does not show when you pick one product. A product shows by its display name, for example **IDPF**, in the Product column, the filter and the product chip at the top. A work copy or a worktree shows as its product.
|
|
23
23
|
- **The groups.** The rows are under their goals. An initiative with no goal is under **No goal yet**.
|
|
24
24
|
- **The timeline.** Each bar is the same bar as on the Board: dark grey is done, blue is now, light grey is still planned. Every milestone is a diamond at its date; press it to see its card. A thin line shows a gap in the plan, and an orange line goes from a missed date to today. Press a bar to see the stages of its workflow in a card, each with its date when it has one. Press outside the card or press Esc to close it. An initiative with no start and no end has an empty timeline cell. Closed and completed initiatives fold into one last line, for example **11 closed**; press it to show them. The span chooser at the top left of the timeline has **Quarter**, **Half**, **Year**, **2 yr**, **5 yr** and **Full**. **Full** shows every bar from the earliest start to the latest end. The button beside it hides the timeline. The key is under the list.
|
|
25
25
|
- **The view menu.** Press the tune button. **Filter** comes first: Needs (late, at risk, waits on you, blocked), Stage, Status, Product, Program, Owner and Sprint. Each value shows how many initiatives it holds, and you can pick several at once. A line above the table says what shows, for example "Showing Build and Deliver of IDPF · 14 hidden · Show all", and the tune button shows how many filters are on. **Sort** takes up to three keys: press a column to add it, press it again to turn it round, and press its × to take it out. **PMOS order** puts what needs you first. **View** has **Group by** and the **Timeline** switch. **Columns** opens a switch for each column; drag a column to change the order (or use Alt+↑ and Alt+↓). PMOS remembers the view in this browser, and **Reset** shows when the view is not the usual one. If the sprint in the Jira reading has ended, the menu says so, for example "MAD Sprint 115 has ended, showing MAD Sprint 116". The ⋯ menu has **New asks**, **Sprints and releases**, **Shared with me** and **Read Jira again**.
|
|
@@ -16,7 +16,7 @@ Routine is one table. Each row has these columns:
|
|
|
16
16
|
|---|---|
|
|
17
17
|
| Routine | The name of the report, the source, the job or the task. |
|
|
18
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. |
|
|
19
|
+
| Product | The product the routine belongs to, by the same name as on every other page (IDPF, not a folder name). This column shows only when the table holds routines of two products or more. |
|
|
20
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
21
|
| When | How often it repeats, in short words, for example "Every two weeks, Wed 09:00". |
|
|
22
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. |
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* backlog.js — every open task of a product in one list, the way Jira's backlog lists them (initiative work-backlog; Exploring 2 canvas page
|
|
3
|
+
* "Backlog: every task in one list", boards BkList and BkSelect; brief nav-structure/backlog/build-brief.md).
|
|
4
|
+
*
|
|
5
|
+
* Wawan (2026-11-19): "better to have the Backlog page that list all the tasks just like Jira did, so this no stage or no EPIC stays there
|
|
6
|
+
* instead of on the initiative." "Indicate which one is Jira tickets and its EPIC." "Stage not apply to task, it only apply to initiative."
|
|
7
|
+
* Part B (his pick "Yes, build all of it" on the decision card, 2026-11-19): "depends on the work type … agent can work on task by itself …
|
|
8
|
+
* human is verifying only when necessary".
|
|
9
|
+
*
|
|
10
|
+
* PURE: no file, process, network or clock of its own. lib/routes-backlog.js reads the board, the Jira readings, the gives ledger and the day
|
|
11
|
+
* runs, and passes them in with `today`.
|
|
12
|
+
*
|
|
13
|
+
* tasksOf(input) → [task] every open task of one board: its PMOS tasks, its Jira tickets, and the tickets of its sprints that
|
|
14
|
+
* no initiative holds (No home). One shape for both kinds.
|
|
15
|
+
* takeOf(task, mode, o) → { what, review, to } | null what PMOS can do with a task in this kind of work, in a few words, and the one
|
|
16
|
+
* review object the result needs (pr | message | doc | null). PROVEN ONLY: a task the words do not
|
|
17
|
+
* place is not offered (null), and PMOS does not guess.
|
|
18
|
+
* reviewWhy(review, to, guard) → string | '' why a result waits for the PM, in two or three words ('' = it finishes by itself)
|
|
19
|
+
* guardOf(draft) → why a pull request waits: the guarded part its changed files touch (GUARDS), 'files unread' when no
|
|
20
|
+
* file can be read; the agent's "Guarded: …" line only adds. '' = the repo's checks decide
|
|
21
|
+
* filesOf(draft) → the files a pull request changes, read from the agent's result
|
|
22
|
+
* messageTo(title) · docTo(title) → who a message or a document goes to, from the task's words; '' = unnamed / the PM
|
|
23
|
+
* agentOf(give, runTask, today) → { state, why, draft? } | null where PMOS stands on a task it was given (working | review | done |
|
|
24
|
+
* failed), read from the day run that holds it
|
|
25
|
+
* proposeHome(task, epicHome) → { ini, why } | null the initiative a No home ticket belongs in, only when a record proves it: the
|
|
26
|
+
* ticket's epic is the epic an initiative names
|
|
27
|
+
* foldGives(lines) → Map task-key → the live give or decline of each task (the last line wins; undo and stop clear it)
|
|
28
|
+
* runTaskId(ws, board, task, n) → 't-<12 hex>' the day-run task id of the n-th give of a task
|
|
29
|
+
* modeOf(kinds) → 'product' | 'project' | 'sdlc' a product's kind of work: the one most of its initiatives carry
|
|
30
|
+
*
|
|
31
|
+
* A TASK: { id, src: pmos|jira, key, title, ini, iniTitle, kind: Task|Story|Bug|Milestone, milestone, epic: { key, name } | null,
|
|
32
|
+
* who, whoKind: pm|person|none, state: To do|In progress|In review, due, late, sprint: { name, state } | null, mode, take, propose,
|
|
33
|
+
* agent, declined, ws, board, url }. Its `id` is the PMOS task id or the Jira key. Done, Won't do and Archived are not open and are not
|
|
34
|
+
* listed, except a task PMOS finished today (agent.state 'done'), which "Done by PMOS today" lists with its Undo.
|
|
35
|
+
*
|
|
36
|
+
* WHAT NEEDS A REVIEW (Wawan, 2026-11-19: "human is verifying when only and only necessary"; design check 1, point 4):
|
|
37
|
+
* a message that goes out always waits (outward, the standing rule)
|
|
38
|
+
* a pull request waits only when its changed files touch a guarded part (the AUTO-MERGE GUARDRAIL list, GUARDS:
|
|
39
|
+
* migrations, auth, payments, personal data, secrets, CI, dependencies, public API), when its files
|
|
40
|
+
* cannot be read, or when the agent marks it "Guarded: …" (a mark adds a review, never removes one). Any
|
|
41
|
+
* other pull request stays in "PMOS is working": the repository's own checks decide, and PMOS never
|
|
42
|
+
* merges in a product repository (D65).
|
|
43
|
+
* a document that goes to others waits ("goes to the CFO"; "goes to people" when the words share it with no one named)
|
|
44
|
+
* a document for the PM finishes by itself, with Undo
|
|
45
|
+
* A Jira ticket is not a reason by itself: PMOS does not write to Jira (D88); its status is read. */
|
|
46
|
+
const crypto = require('crypto');
|
|
47
|
+
|
|
48
|
+
const KINDS = Object.freeze(['product', 'project', 'sdlc']);
|
|
49
|
+
const MODE_LABEL = Object.freeze({ product: 'Product management', project: 'Project management', sdlc: 'Full SDLC' });
|
|
50
|
+
const OPEN = new Set(['To do', 'In progress', 'In review']);
|
|
51
|
+
const DAY = 864e5;
|
|
52
|
+
const JIRA_KEY = /^[A-Z][A-Z0-9_]*-\d+$/;
|
|
53
|
+
const ME = /^(pm|you|me|wawan)$/i;
|
|
54
|
+
|
|
55
|
+
const str = (v, n = 200) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
56
|
+
const dayNum = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) / DAY : null; };
|
|
57
|
+
const word = (re) => (t) => re.test(t);
|
|
58
|
+
|
|
59
|
+
/** A product's kind of work: the kind most of its initiatives carry (ties go to the wider kind: sdlc, then project); product with none. */
|
|
60
|
+
function modeOf(kinds) {
|
|
61
|
+
const n = countKinds(kinds);
|
|
62
|
+
const top = Math.max(n.product, n.project, n.sdlc);
|
|
63
|
+
return top ? ['sdlc', 'project', 'product'].find((k) => n[k] === top) : 'product';
|
|
64
|
+
}
|
|
65
|
+
/** How many initiatives carry each kind of work: { product, project, sdlc } (the mode line says "9 of 12 initiatives" from it). */
|
|
66
|
+
function countKinds(kinds) {
|
|
67
|
+
const n = { product: 0, project: 0, sdlc: 0 };
|
|
68
|
+
for (const k of kinds || []) if (KINDS.includes(k)) n[k]++;
|
|
69
|
+
return n;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ── what PMOS can do with a task (proven only: the task's own words and kind of work decide) ── */
|
|
73
|
+
const IS_MESSAGE = word(/\b(reply|respond|answer|e-?mail|message|send|notify|announce|invite|ask (?:\w+ )?(?:for|about|to)|tell)\b/i);
|
|
74
|
+
const IS_CHASE = word(/\b(chase|follow[- ]?up|remind|status (?:note|update|report)|weekly (?:note|update|report)|nudge)\b/i);
|
|
75
|
+
const IS_DOC = word(/\b(research|compare|comparison|analy[sz]e|analysis|document|write[- ]?up|write|draft|spec|prd|brief|summary|summari[sz]e|report|notes?|outline|evaluate|evaluation|assess|assessment|audit|investigate|find out|options|proposal|recommend\w*|criteria|checklist|plan for|faq|glossary)\b/i);
|
|
76
|
+
const IS_CHECK = word(/\b(test|check|verify|parity|establish (?:the )?current|reproduce|confirm (?:the )?behaviou?r)\b/i);
|
|
77
|
+
const IS_BUILD = word(/\b(build|implement|fix|remove|add|refactor|rate[- ]limit|migrate|endpoint|api|bug|deprecat\w*|upgrade|wire|hook up|rename|delete|ui|page|button|screen|flow|feature|cache|login|sign[- ]?in|otp)\b/i);
|
|
78
|
+
|
|
79
|
+
/* who a result goes to, read from the task's words only (proven only: no name, no audience) */
|
|
80
|
+
const ROLE = /^(?:the\s+)?(cfo|ceo|cto|coo|cpo|board|legal(?: team)?|finance(?: team)?|vendors?|clients?|customers?|stakeholders|leadership|execs?|management|[a-z]+ team)\b/i;
|
|
81
|
+
const UPPER_ROLE = /^(cfo|ceo|cto|coo|cpo)$/i;
|
|
82
|
+
const roleName = (m) => (UPPER_ROLE.test(m) ? 'the ' + m.toUpperCase() : /^(board|leadership|management|stakeholders|execs?)$/i.test(m) ? 'the ' + m.toLowerCase() : m.toLowerCase());
|
|
83
|
+
const MSG_VERB = /\b(?:reply to|respond to|answer|e-?mail|message|tell|ask|remind|chase|nudge|notify|invite|follow[- ]?up with|send (?:it |this )?to|write to)\s+/i;
|
|
84
|
+
/** The person or audience a message goes to: "Reply to Daryl: …" → "Daryl"; "Chase finance for the PO" → "finance"; '' when unnamed. */
|
|
85
|
+
function messageTo(title) {
|
|
86
|
+
const t = str(title, 400), m = MSG_VERB.exec(t);
|
|
87
|
+
if (!m) return '';
|
|
88
|
+
const rest = t.slice(m.index + m[0].length);
|
|
89
|
+
const r = ROLE.exec(rest);
|
|
90
|
+
if (r) return roleName(r[1]);
|
|
91
|
+
const n = /^(?:the\s+)?([A-Z][a-z][\w'-]*(?:\s+[A-Z][a-z][\w'-]*)?)/.exec(rest);
|
|
92
|
+
return n ? n[1] : '';
|
|
93
|
+
}
|
|
94
|
+
/** The audience a document goes to, when the words name one ("Budget summary for the CFO"), or 'people' when the words share it with no
|
|
95
|
+
* one named ("Present the findings", "share", "circulate", "publish"): it waits either way. '' = a document for the PM. */
|
|
96
|
+
const IS_SHARE = /\b(share|present|circulate|publish|distribute|hand ?out|post|send)\b/i;
|
|
97
|
+
function docTo(title) {
|
|
98
|
+
const t = str(title, 400);
|
|
99
|
+
const re = /\b(?:for|to|with)\s+/gi;
|
|
100
|
+
let m;
|
|
101
|
+
while ((m = re.exec(t))) { const r = ROLE.exec(t.slice(m.index + m[0].length)); if (r) return roleName(r[1]); }
|
|
102
|
+
return IS_SHARE.test(t) ? 'people' : '';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* What PMOS can do with `task` in this kind of work, or null → { what, review: 'pr' | 'message' | 'doc' | null, to }. o: { factory } — a
|
|
107
|
+
* D65 factory runs in the product's repository (only then a build task becomes a pull request PMOS opens; lib/work-kind.js factoryRuns).
|
|
108
|
+
* A milestone, a task someone already works on, and a task the words do not place are not offered.
|
|
109
|
+
* review 'pr' waits only when the result is guarded (agentOf reads that from the agent's result); 'doc' is a document that goes to others.
|
|
110
|
+
*/
|
|
111
|
+
function takeOf(task, mode, o = {}) {
|
|
112
|
+
if (!task || task.milestone) return null;
|
|
113
|
+
if (task.state !== 'To do') return null; // In progress or In review: someone is on it
|
|
114
|
+
const t = str(task.title, 400);
|
|
115
|
+
if (!t) return null;
|
|
116
|
+
const m = KINDS.includes(mode) ? mode : 'product';
|
|
117
|
+
const doc = (what) => { const to = docTo(t); return { what, review: to ? 'doc' : null, to }; };
|
|
118
|
+
if (m === 'sdlc' && o.factory && (IS_BUILD(t) || (task.src === 'jira' && /^(bug|story)$/i.test(task.kind || '')))) {
|
|
119
|
+
if (IS_CHECK(t) && !IS_BUILD(t)) return doc('tests it and writes what it found');
|
|
120
|
+
return { what: 'opens a pull request', review: 'pr', to: '' };
|
|
121
|
+
}
|
|
122
|
+
if (((m === 'project' || m === 'sdlc') && IS_CHASE(t)) || IS_MESSAGE(t)) return { what: 'drafts it, you send', review: 'message', to: messageTo(t) };
|
|
123
|
+
if (m === 'sdlc' && IS_CHECK(t)) return doc('tests each row');
|
|
124
|
+
if (IS_DOC(t)) { const d = doc('writes it up'); if (d.to) d.what = 'writes it for ' + d.to; return d; }
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Why a result waits for the PM, in two or three words; '' when it finishes by itself. to: who it goes to; guard: the agent's own words for
|
|
129
|
+
* the guarded part a pull request touches ("changes sign-in"). */
|
|
130
|
+
function reviewWhy(review, to, guard) {
|
|
131
|
+
if (review === 'message') return 'goes out to ' + (to || 'people');
|
|
132
|
+
if (review === 'doc') return to ? 'goes to ' + to : '';
|
|
133
|
+
if (review === 'pr') return guard ? str(guard, 40) : '';
|
|
134
|
+
return '';
|
|
135
|
+
}
|
|
136
|
+
/* the AUTO-MERGE GUARDRAIL list, read from the files a pull request changes (design check 2: from the facts, never the agent's word alone).
|
|
137
|
+
* The first rule a file meets names the reason, in two or three words. */
|
|
138
|
+
const GUARDS = [
|
|
139
|
+
[/(^|\/)(migrations?|migrate)\/|\.sql$|(^|\/)schema\.(prisma|rb|sql)$/i, 'changes the database'],
|
|
140
|
+
[/(^|[\/_.-])(auth\w*|login|log-?in|sign-?in|signin|session|oauth|oidc|saml|sso|otp|mfa|2fa|password|passwd|token|jwt)([\/_.-]|$)/i, 'changes sign-in'],
|
|
141
|
+
[/(^|[\/_.-])(pay\w*|billing|checkout|stripe|invoice|subscription|refund)([\/_.-]|$)/i, 'changes payments'],
|
|
142
|
+
[/(^|[\/_.-])(pii|personal|gdpr|privacy|consent|user-?data|profile)([\/_.-]|$)/i, 'touches personal data'],
|
|
143
|
+
[/(^|\/)\.env(\.|$)|(^|[\/_.-])(secrets?|credentials?|vault|keystore)([\/_.-]|$)|\.(pem|key|p12)$/i, 'touches secrets'],
|
|
144
|
+
[/^\.github\/|(^|\/)\.gitlab-ci\.yml$|(^|\/)\.circleci\/|(^|\/)jenkinsfile$|(^|\/)\.buildkite\/|(^|\/)azure-pipelines\.yml$/i, 'changes CI'],
|
|
145
|
+
[/(^|\/)(package(-lock)?\.json|yarn\.lock|pnpm-lock\.yaml|npm-shrinkwrap\.json|requirements[\w-]*\.txt|pyproject\.toml|poetry\.lock|go\.(mod|sum)|gemfile(\.lock)?|pom\.xml|build\.gradle(\.kts)?|cargo\.(toml|lock)|composer\.(json|lock))$/i, 'changes dependencies'],
|
|
146
|
+
[/(^|[\/_.-])(openapi|swagger)([\/_.-]|$)|(^|\/)public[-_]?api\/|(^|\/)api\/v\d+\/|\.proto$|(^|\/)schema\.graphql$/i, 'changes the public API'],
|
|
147
|
+
];
|
|
148
|
+
/** The files a pull request changes, from the agent's result: draft.files, diff headers, and one path per line under "Files". */
|
|
149
|
+
function filesOf(draft) {
|
|
150
|
+
if (!draft) return [];
|
|
151
|
+
const out = new Set();
|
|
152
|
+
for (const f of Array.isArray(draft.files) ? draft.files : []) if (typeof f === 'string' && f.trim()) out.add(f.trim());
|
|
153
|
+
const B = String(draft.body || '');
|
|
154
|
+
for (const m of B.matchAll(/^diff --git a\/(\S+)/gm)) out.add(m[1]);
|
|
155
|
+
for (const m of B.matchAll(/^[ \t]*(?:[-*]|[MADR]\t?)[ \t]+([\w@.\/-]+\/[\w@.\/-]+|[\w@.-]+\.\w{1,8})[ \t]*$/gm)) out.add(m[1]);
|
|
156
|
+
return [...out].slice(0, 400);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Does a pull request wait for the PM, and why, in two or three words; '' = it does not (the repository's checks decide).
|
|
160
|
+
* From the facts: each changed file against the guardrail list. The files cannot be read → it waits ("files unread"). The agent's own
|
|
161
|
+
* "Guarded: …" line may add a review, never take one away.
|
|
162
|
+
*/
|
|
163
|
+
function guardOf(draft) {
|
|
164
|
+
if (!draft) return 'files unread';
|
|
165
|
+
const files = filesOf(draft);
|
|
166
|
+
if (!files.length) return 'files unread';
|
|
167
|
+
for (const f of files) for (const [re, why] of GUARDS) if (re.test(f)) return why;
|
|
168
|
+
const m = /^\s*guarded\s*:\s*(.+)$/im.exec(String(draft.summary || '') + '\n' + String(draft.body || '').slice(0, 2000));
|
|
169
|
+
return m ? str(m[1].replace(/[.;]+$/, ''), 40) : '';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* ── where PMOS stands on a task it was given ── */
|
|
173
|
+
/**
|
|
174
|
+
* give: the live give line ({ at, run, review, why }); rt: the day run's task with that id, or null; today: 'YYYY-MM-DD'.
|
|
175
|
+
* → { state: 'working' | 'review' | 'done' | 'failed', why, draft?, at? } or null when the give has no task in the runs read (gone).
|
|
176
|
+
* working waiting or working in the day run, or sending after the PM's yes
|
|
177
|
+
* review a draft waits for the PM: a message, or a result whose kind needs a review (give.review) and the PM has not approved
|
|
178
|
+
* done finished: an auto result, an approved one, or a sent message. Only a task finished today is listed (Done by PMOS today)
|
|
179
|
+
* failed the day run says so; the Backlog puts it back where it came from, with the reason (honest state)
|
|
180
|
+
*/
|
|
181
|
+
function agentOf(give, rt, today) {
|
|
182
|
+
if (!give || !give.run) return null;
|
|
183
|
+
const isToday = (at) => String(at || '').slice(0, 10) === today;
|
|
184
|
+
if (!rt) return give.approvedAt ? { state: 'done', why: 'approved', at: give.approvedAt, today: isToday(give.approvedAt) } : null;
|
|
185
|
+
const draft = rt.draft ? { summary: str(rt.draft.summary, 240), body: String(rt.draft.body || '').slice(0, 8000), link: rt.draft.link || null, at: rt.draft.at || null } : null;
|
|
186
|
+
const st = rt.status;
|
|
187
|
+
if (st === 'waiting' || st === 'working') return { state: 'working', why: st === 'waiting' ? 'starts soon' : rt.progress ? str(rt.progress, 80) : 'working on it', draft: null };
|
|
188
|
+
if (st === 'sending') return { state: 'working', why: 'sending what you approved', draft };
|
|
189
|
+
if (st === 'failed') return { state: 'failed', why: str(rt.error || 'it stopped before it finished', 160), draft };
|
|
190
|
+
const doneAt = (rt.decided && rt.decided.action === 'approve' && rt.decided.at) || (draft && draft.at) || give.at;
|
|
191
|
+
if (st === 'sent') return { state: 'done', why: 'sent', draft, at: doneAt, today: isToday(doneAt) };
|
|
192
|
+
if (st === 'review') return { state: 'review', why: give.why || reviewWhy('message', give.to), to: give.to || '', draft };
|
|
193
|
+
if (st === 'done') {
|
|
194
|
+
if (!give.approvedAt && give.review === 'pr') {
|
|
195
|
+
const guard = guardOf(draft);
|
|
196
|
+
if (guard) return { state: 'review', why: reviewWhy('pr', '', guard), guard, draft };
|
|
197
|
+
// not guarded: the repository's own checks decide; PMOS never merges (D65), so the row stays here until the task closes
|
|
198
|
+
return { state: 'working', why: draft && draft.link ? "Pull request open · the repo's checks decide" : 'passed its checks, no pull request link', pr: true, draft };
|
|
199
|
+
}
|
|
200
|
+
if (!give.approvedAt && give.review === 'doc' && give.to) return { state: 'review', why: reviewWhy('doc', give.to), to: give.to, draft };
|
|
201
|
+
const at = give.approvedAt || doneAt;
|
|
202
|
+
return { state: 'done', why: give.approvedAt ? 'approved' : 'passed its checks', draft, at, today: isToday(at) };
|
|
203
|
+
}
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* ── the gives ledger (<runtime>/backlog/gives.jsonl, written by lib/routes-backlog.js) ── */
|
|
208
|
+
const keyOf = (ws, board, task) => `${ws}\u0000${board}\u0000${task}`;
|
|
209
|
+
/** The live state of each task: { give: { at, run, review, why, n, approvedAt? } | null, declined: { at } | null, n }. */
|
|
210
|
+
function foldGives(lines) {
|
|
211
|
+
const by = new Map();
|
|
212
|
+
for (const e of lines || []) {
|
|
213
|
+
if (!e || typeof e !== 'object' || typeof e.task !== 'string') continue;
|
|
214
|
+
const k = keyOf(e.ws || '', e.board || '', e.task);
|
|
215
|
+
const cur = by.get(k) || { give: null, declined: null, n: 0 };
|
|
216
|
+
if (e.ev === 'give' && typeof e.run === 'string') { cur.n += 1; cur.give = { at: e.at || null, run: e.run, review: e.review || null, why: e.why || '', to: e.to || '', what: e.what || '', n: cur.n, src: e.src || 'pmos' }; cur.declined = null; }
|
|
217
|
+
else if (e.ev === 'approve' && cur.give) cur.give = { ...cur.give, approvedAt: e.at || null };
|
|
218
|
+
else if (e.ev === 'stop' || e.ev === 'undo') cur.give = null;
|
|
219
|
+
else if (e.ev === 'decline') cur.declined = { at: e.at || null };
|
|
220
|
+
else if (e.ev === 'undecline') cur.declined = null;
|
|
221
|
+
by.set(k, cur);
|
|
222
|
+
}
|
|
223
|
+
return by;
|
|
224
|
+
}
|
|
225
|
+
/** The day-run task id of the n-th give of a task: the same give is the same id, a new give after an Undo is a new one. */
|
|
226
|
+
const runTaskId = (ws, board, task, n) => 't-' + crypto.createHash('sha1').update(`backlog\u0000${keyOf(ws, board, task)}\u0000${n}`).digest('hex').slice(0, 12);
|
|
227
|
+
|
|
228
|
+
/** The initiative a No home ticket belongs in, when a record proves it: its epic is the Jira epic an initiative names. */
|
|
229
|
+
function proposeHome(task, epicHome) {
|
|
230
|
+
if (!task || task.ini || !task.epic || !task.epic.key) return null;
|
|
231
|
+
const h = epicHome && epicHome.get(task.epic.key);
|
|
232
|
+
return h ? { ini: h.id, title: h.title, why: 'its epic ' + task.epic.key + ' belongs to it' } : null;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Every open task of one board. input: {
|
|
237
|
+
* ws, board, product, today,
|
|
238
|
+
* items the board's work items (lib/routes-boards.js itemsOf): PMOS tasks (src pmos) and Jira tickets (src jira) of its initiatives
|
|
239
|
+
* inis [{ id, title, kind, epics }] the board's open initiatives
|
|
240
|
+
* readings Map key → a Jira reading { key, summary, status, category, type, parent, parentName, assignee, sprint, url } from every
|
|
241
|
+
* snapshot of the board and the whole-sprint read (lib/jira-status.js)
|
|
242
|
+
* sprintKeys [key] the tickets the whole-sprint read holds: the ones no initiative holds are No home
|
|
243
|
+
* moves Map KEY → initiative id (the ticket-move lines: a ticket the PM placed)
|
|
244
|
+
* homeless [PMOS task item] tasks of this board whose initiative is on no board row
|
|
245
|
+
* gives foldGives(...) · runTasks Map run-task id → day-run task · factory bool · me: the PM's own name
|
|
246
|
+
* } */
|
|
247
|
+
function tasksOf(input) {
|
|
248
|
+
const I = input || {};
|
|
249
|
+
const today = I.today || new Date().toISOString().slice(0, 10), t0 = dayNum(today);
|
|
250
|
+
const iniBy = new Map((I.inis || []).map((r) => [r.id, r]));
|
|
251
|
+
const R = I.readings instanceof Map ? I.readings : new Map();
|
|
252
|
+
const epicHome = new Map();
|
|
253
|
+
for (const r of I.inis || []) for (const e of r.epics || []) if (JIRA_KEY.test(e) && !epicHome.has(e)) epicHome.set(e, { id: r.id, title: r.title });
|
|
254
|
+
const mode = modeOf((I.inis || []).map((r) => r.kind));
|
|
255
|
+
const G = I.gives instanceof Map ? I.gives : new Map(), RT = I.runTasks instanceof Map ? I.runTasks : new Map();
|
|
256
|
+
const me = str(I.me, 80).toLowerCase();
|
|
257
|
+
const out = [], seen = new Set();
|
|
258
|
+
const whoOf = (owner) => {
|
|
259
|
+
const o = str(owner, 80);
|
|
260
|
+
if (!o) return { who: '', whoKind: 'none' };
|
|
261
|
+
if (ME.test(o) || (me && o.toLowerCase() === me)) return { who: 'You', whoKind: 'pm' };
|
|
262
|
+
return { who: o, whoKind: 'person' };
|
|
263
|
+
};
|
|
264
|
+
const epicOf = (key) => {
|
|
265
|
+
if (!key) return null;
|
|
266
|
+
const rd = R.get(key);
|
|
267
|
+
// the name: the epic's own reading, else the parent name a child's reading carries (lib/jira-status.js parentName)
|
|
268
|
+
let name = rd && rd.summary ? rd.summary : '';
|
|
269
|
+
if (!name) for (const x of R.values()) if (x && x.parent === key && x.parentName) { name = x.parentName; break; }
|
|
270
|
+
return { key, name: str(name, 120) };
|
|
271
|
+
};
|
|
272
|
+
const push = (t) => {
|
|
273
|
+
const g = G.get(keyOf(I.ws || '', I.board || '', t.id)) || { give: null, declined: null };
|
|
274
|
+
const ini = t.ini ? iniBy.get(t.ini) : null;
|
|
275
|
+
const m = ini && KINDS.includes(ini.kind) ? ini.kind : mode;
|
|
276
|
+
const due = dayNum(t.due), late = due != null && t0 != null && due < t0 && OPEN.has(t.state) ? t0 - due : 0;
|
|
277
|
+
const agent0 = g.give ? agentOf({ ...g.give, src: t.src }, RT.get(g.give.run) || null, today) : null;
|
|
278
|
+
const agent = agent0 ? { ...agent0, review: g.give.review || null } : null;
|
|
279
|
+
if (!OPEN.has(t.state) && !(agent && agent.state === 'done' && agent.today)) return;
|
|
280
|
+
const take = agent && agent.state !== 'failed' ? null : takeOf(t, m, { factory: !!I.factory });
|
|
281
|
+
const row = { ...t, iniTitle: ini ? str(ini.title, 160) : '', mode: m, late, take, agent, declined: !!g.declined, given: g.give ? { at: g.give.at, n: g.give.n, run: g.give.run } : null,
|
|
282
|
+
ws: I.ws || '', board: I.board || '', product: I.product || '' };
|
|
283
|
+
if (!row.ini) row.propose = row.declined ? null : proposeHome(row, epicHome); // ✕ on a proposal: not there
|
|
284
|
+
out.push(row);
|
|
285
|
+
};
|
|
286
|
+
for (const w of I.items || []) {
|
|
287
|
+
if (!w || w.kind === 'Epic' || !w.uid) continue;
|
|
288
|
+
const id = w.src === 'jira' ? String(w.key || w.uid).toUpperCase() : String(w.uid);
|
|
289
|
+
if (seen.has(id)) continue;
|
|
290
|
+
seen.add(id);
|
|
291
|
+
if (w.src === 'jira') {
|
|
292
|
+
const rd = R.get(id) || {};
|
|
293
|
+
const ini = (I.moves && I.moves.get(id)) || w.ini || null;
|
|
294
|
+
push({ id, src: 'jira', key: id, title: str(w.title || rd.summary || id, 300), ini: ini && iniBy.has(ini) ? ini : null, kind: str(rd.type || w.kind || 'Task', 20), milestone: !!w.milestone,
|
|
295
|
+
epic: epicOf(w.epic || rd.parent || null), ...whoOf(rd.assignee), state: OPEN.has(w.status) ? w.status : w.status || 'To do', due: w.end || null,
|
|
296
|
+
sprint: rd.sprint && rd.sprint.name ? { name: str(rd.sprint.name, 80), state: rd.sprint.state || '' } : null, url: rd.url || null });
|
|
297
|
+
} else {
|
|
298
|
+
push({ id, src: 'pmos', key: '', title: str(w.title, 300), ini: iniBy.has(w.ini) ? w.ini : null, kind: w.milestone ? 'Milestone' : 'Task', milestone: !!w.milestone, epic: null,
|
|
299
|
+
...whoOf(w.owner), state: w.status === "Won't do" || w.status === 'Archived' || w.status === 'Done' ? w.status : OPEN.has(w.status) ? w.status : 'To do', due: w.end || null, sprint: null, url: null, item: !!w.item });
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// the tickets of the board's sprints that no initiative holds: No home, unless the PM placed one (a ticket-move line)
|
|
303
|
+
for (const k0 of I.sprintKeys || []) {
|
|
304
|
+
const id = String(k0).toUpperCase();
|
|
305
|
+
if (seen.has(id)) continue;
|
|
306
|
+
const rd = R.get(id);
|
|
307
|
+
if (!rd || rd.category === 'done' || /^epic$/i.test(rd.type || '')) continue;
|
|
308
|
+
seen.add(id);
|
|
309
|
+
const placed = I.moves && I.moves.get(id);
|
|
310
|
+
push({ id, src: 'jira', key: id, title: str(rd.summary || id, 300), ini: placed && iniBy.has(placed) ? placed : null, kind: str(rd.type || 'Task', 20), milestone: false,
|
|
311
|
+
epic: epicOf(rd.parent || null), ...whoOf(rd.assignee), state: rd.category === 'doing' ? 'In progress' : 'To do', due: null,
|
|
312
|
+
sprint: rd.sprint && rd.sprint.name ? { name: str(rd.sprint.name, 80), state: rd.sprint.state || '' } : null, url: rd.url || null });
|
|
313
|
+
}
|
|
314
|
+
for (const w of I.homeless || []) {
|
|
315
|
+
if (!w || !w.uid || seen.has(w.uid)) continue;
|
|
316
|
+
seen.add(w.uid);
|
|
317
|
+
push({ id: String(w.uid), src: 'pmos', key: '', title: str(w.title, 300), ini: null, kind: w.milestone ? 'Milestone' : 'Task', milestone: !!w.milestone, epic: null, ...whoOf(w.owner),
|
|
318
|
+
state: OPEN.has(w.status) ? w.status : w.status || 'To do', due: w.end || null, sprint: null, url: null });
|
|
319
|
+
}
|
|
320
|
+
return out;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
module.exports = { KINDS, MODE_LABEL, GUARDS, modeOf, countKinds, takeOf, reviewWhy, guardOf, filesOf, messageTo, docTo, agentOf, foldGives, runTaskId, proposeHome, tasksOf, keyOf };
|