create-pmos 0.749.0 → 0.750.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 +14 -20
- 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 +13 -0
- package/workspace/guide/cli.md +1 -0
- package/workspace/guide/programs.md +1 -0
- package/workspace/lib/repeat-requests.js +123 -0
- package/workspace/lib/routes-intake.js +45 -2
- package/workspace/lib/tracker-cli.js +42 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +2 -1
- package/workspace/public/pm/bd-asks.js +19 -5
- package/workspace/test-lists/repeat-requests.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.750.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,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.750.0",
|
|
38
|
+
"at": "2026-11-23T17:16:14.272Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1685,
|
|
43
|
+
"t": "Count similar past requests before a one-off",
|
|
44
|
+
"s": "Count similar past requests before a one-off",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.749.0",
|
|
38
51
|
"at": "2026-11-23T17:01:32.549Z",
|
|
@@ -622,25 +635,6 @@
|
|
|
622
635
|
}
|
|
623
636
|
}
|
|
624
637
|
]
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
"v": "0.726.0",
|
|
628
|
-
"at": "2026-11-23T04:24:12.361Z",
|
|
629
|
-
"f": 4,
|
|
630
|
-
"prs": [
|
|
631
|
-
{
|
|
632
|
-
"n": 1604,
|
|
633
|
-
"t": "What the chat writes shows on the workspace cards",
|
|
634
|
-
"s": "What the chat writes shows on the workspace cards",
|
|
635
|
-
"k": "fix",
|
|
636
|
-
"try": {
|
|
637
|
-
"steps": [
|
|
638
|
-
"In an initiative's chat, ask it to write the case."
|
|
639
|
-
],
|
|
640
|
-
"see": "The case shows on the workspace card."
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
]
|
|
644
638
|
}
|
|
645
639
|
]
|
|
646
640
|
}
|
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-23T17:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-23T17:16: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-23T17:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-23T17:16: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-23T17:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-23T17:16:11Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.750.0",
|
|
4
|
+
"at": "2026-11-23T17:16:14.272Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1685,
|
|
9
|
+
"t": "Count similar past requests before a one-off",
|
|
10
|
+
"s": "Count similar past requests before a one-off",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.749.0",
|
|
4
17
|
"at": "2026-11-23T17:01:32.549Z",
|
package/workspace/guide/cli.md
CHANGED
|
@@ -925,6 +925,7 @@ Before the tickets of an initiative go to the engineers, `pmos ready` shows whic
|
|
|
925
925
|
- `pmos tracker status` says when tracker items were last read for this repository.
|
|
926
926
|
- `pmos tracker sync` says how much of this repository's tasks match the last Jira read, as one percent, and lists each task that differs: its state, its done day or its owner. The read already sets the state, the done day (Jira's resolution day) and the owner (Jira's assignee), so what is left is what someone set by hand. Tasks the read could not return are counted apart. `--number` prints the percent alone; `--json` prints all of it. It calls no tracker and writes nothing.
|
|
927
927
|
- `pmos tracker match` lists the initiatives the last Jira read does not cover, and the epic or ticket that most likely holds each one's work. `--number` prints the share of initiatives with tasks that the read covers. `--file` proposes each match under the initiative's ✦ for you to approve; after every read, `pmos tracker done` does the same. It calls no tracker and moves no item.
|
|
928
|
+
- `pmos tracker repeats "<ask>"` says how many times the same thing was asked before: the stored tickets and the boards' earlier asks that share most of its words, with up to 3 of them. From 2, it suggests building it once as a setting others can use. With no ask, it gives the share of stored tickets that repeat; `--number` prints that share alone. It calls no tracker and writes nothing.
|
|
928
929
|
|
|
929
930
|
### pmos source
|
|
930
931
|
|
|
@@ -23,6 +23,7 @@ On a computer the Board place is **Work**: one list of initiatives with the time
|
|
|
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. A bar that starts or ends outside the span stops at the timeline's edge, so the columns beside it always show. 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**.
|
|
26
|
+
- **Asked before.** In **New asks**, an ask that was asked before says so under it, for example "Asked 3 times before: OPS-12 Monitoring access for finance, …". PMOS counts the tickets in the stored Jira reads and the board's earlier asks that share most of its words. From 2, it suggests building it once, as a setting others can use, not a one-off. An ask never asked before shows nothing. The New initiative form shows the same line while you type the name.
|
|
26
27
|
- **Sort.** Press a column title to sort by it. Press it again to go back to your usual order.
|
|
27
28
|
- **Edit in place.** Press the Stage of a row to move the initiative to another stage. The toast has **Undo**.
|
|
28
29
|
- **Open.** Press a row to open the initiative in the popup, with the chat beside it.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* repeat-requests.js — how many times an ask was asked before (bet A264, initiative repeat-request-count; proof T126, 2026-11-23).
|
|
3
|
+
*
|
|
4
|
+
* WHY. A PM decides whether to build a customer's or a stakeholder's special ask as a one-off without knowing it was asked before.
|
|
5
|
+
* Proof T126 found 22 of the latest 100 request tickets on a test product are two kinds that repeat (10 monitoring access requests,
|
|
6
|
+
* 12 ad hoc verification tickets), and nothing in PMOS counted them. Here PMOS counts the similar earlier requests of one ask: in the
|
|
7
|
+
* Jira reads it already stores, and in the board's earlier asks.
|
|
8
|
+
*
|
|
9
|
+
* similar(a, b) PURE → bool two word lists ask for the same thing
|
|
10
|
+
* ticketsOf(reads) PURE → [{ key, title, at }] stored readings, each key once, no epics
|
|
11
|
+
* countFor(line, pool, o) PURE → { count, jira, asks, examples: [{ ref, title, kind }], setting, say } say is '' at 0
|
|
12
|
+
* share(tickets) PURE → { tickets, repeating, pct } tickets with 2 or more similar others (the health number)
|
|
13
|
+
* poolOf(root) → [{ key, title, at }] the stored Jira tickets of a repository (cached by the files' times)
|
|
14
|
+
* askPool(asks, self, board) PURE → the board's earlier asks, any state, without the ask itself
|
|
15
|
+
* decorate(root, asks, all, board) → the asks, each with `repeats`
|
|
16
|
+
*
|
|
17
|
+
* THE MATCH. The words lib/tracker-match.js compares (lower case, no common words, no ticket keys, no numbers). Similar when the two
|
|
18
|
+
* share 2 or more words and at least half the words of the shorter one: "Grant Grafana monitoring access to ops" and "Monitoring access
|
|
19
|
+
* for finance" share "monitoring" and "access", half of the shorter. One shared word is never enough.
|
|
20
|
+
* THE LINE. 0 says nothing. 1: "Asked once before: …". 2 or more adds that others want it too, so build it once as a setting.
|
|
21
|
+
*
|
|
22
|
+
* BOUNDARY. No network and no write. It reads the stored Jira reads and the asks it is given.
|
|
23
|
+
*/
|
|
24
|
+
const fs = require('fs');
|
|
25
|
+
const path = require('path');
|
|
26
|
+
const TM = require('./tracker-match.js');
|
|
27
|
+
|
|
28
|
+
const LOG = '[repeat-requests]';
|
|
29
|
+
const EXAMPLES = 3;
|
|
30
|
+
const one = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
|
|
31
|
+
|
|
32
|
+
/** PURE. a, b: word lists (TM.tokens). */
|
|
33
|
+
function similar(a, b) {
|
|
34
|
+
const A = new Set(a), B = new Set(b);
|
|
35
|
+
if (A.size < 2 || B.size < 2) return false;
|
|
36
|
+
let n = 0; for (const w of A) if (B.has(w)) n++;
|
|
37
|
+
return n >= 2 && n / Math.min(A.size, B.size) >= 0.5;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** PURE. reads: [{ src, snap: { tickets: Map } }] (lib/tracker-match.js storedReads). Each key once; an epic is a body of work, not a request. */
|
|
41
|
+
function ticketsOf(reads) {
|
|
42
|
+
const by = new Map();
|
|
43
|
+
for (const x of reads || []) {
|
|
44
|
+
for (const r of (x && x.snap && x.snap.tickets ? x.snap.tickets.values() : [])) {
|
|
45
|
+
if (!r || !r.key || by.has(r.key) || /^epic$/i.test(String(r.type || '')) || !String(r.summary || '').trim()) continue;
|
|
46
|
+
by.set(r.key, { key: r.key, title: String(r.summary), at: String(r.created || r.resolved || (r.sprint && r.sprint.start) || '') });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return [...by.values()];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** PURE. The board's earlier asks, in any state, without the ask itself (and without asks of other boards when `board` is given). */
|
|
53
|
+
function askPool(asks, self, board) {
|
|
54
|
+
return (asks || []).filter((a) => a && a.id !== self && (!board || a.board === board) && String(a.line || '').trim())
|
|
55
|
+
.map((a) => ({ ask: a.id, title: String(a.line), at: String(a.at || ''), state: a.state || 'open' }));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** PURE. The line a card shows for a count. '' at 0. */
|
|
59
|
+
function sayOf(r) {
|
|
60
|
+
if (!r || !r.count) return '';
|
|
61
|
+
const names = r.examples.map((x) => (x.kind === 'jira' ? x.ref + ' ' + one(x.title, 60) : 'an earlier ask "' + one(x.title, 60) + '"'));
|
|
62
|
+
const more = r.count - r.examples.length;
|
|
63
|
+
const list = names.join(', ') + (more > 0 ? ` and ${more} more` : '');
|
|
64
|
+
const head = r.count === 1 ? 'Asked once before: ' : `Asked ${r.count} times before: `;
|
|
65
|
+
return head + list + '.' + (r.setting ? ' Others want it too: build it once, as a setting others can use, not a one-off.' : '');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** PURE. line: the ask. pool: { tickets: [{ key, title, at }], asks: [{ ask, title, at }] }. o.max: examples (3). */
|
|
69
|
+
function countFor(line, pool = {}, o = {}) {
|
|
70
|
+
const want = TM.tokens(line);
|
|
71
|
+
const hits = [];
|
|
72
|
+
for (const t of pool.tickets || []) if (similar(want, TM.tokens(t.title))) hits.push({ ref: t.key, title: t.title, kind: 'jira', at: t.at || '' });
|
|
73
|
+
for (const a of pool.asks || []) if (similar(want, TM.tokens(a.title))) hits.push({ ref: a.ask, title: a.title, kind: 'ask', at: a.at || '' });
|
|
74
|
+
hits.sort((a, b) => String(b.at).localeCompare(String(a.at)) || String(a.ref).localeCompare(String(b.ref)));
|
|
75
|
+
const r = { count: hits.length, jira: hits.filter((h) => h.kind === 'jira').length, asks: hits.filter((h) => h.kind === 'ask').length,
|
|
76
|
+
examples: hits.slice(0, o.max || EXAMPLES).map((h) => ({ ref: h.ref, title: one(h.title, 140), kind: h.kind })), setting: hits.length >= 2 };
|
|
77
|
+
r.say = sayOf(r);
|
|
78
|
+
return r;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** PURE. The health number: the tickets that have 2 or more similar others, of all stored tickets. */
|
|
82
|
+
function share(tickets) {
|
|
83
|
+
const tok = (tickets || []).map((t) => TM.tokens(t.title));
|
|
84
|
+
let repeating = 0;
|
|
85
|
+
for (let i = 0; i < tok.length; i++) {
|
|
86
|
+
let n = 0;
|
|
87
|
+
for (let j = 0; j < tok.length && n < 2; j++) if (i !== j && similar(tok[i], tok[j])) n++;
|
|
88
|
+
if (n >= 2) repeating++;
|
|
89
|
+
}
|
|
90
|
+
return { tickets: tok.length, repeating, pct: tok.length ? Math.round((repeating / tok.length) * 100) : null };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ── the repository ── */
|
|
94
|
+
const cache = new Map(); // root → { sig, tickets }
|
|
95
|
+
/** The stored Jira tickets of a repository. Read again only when a stored read file changed (its name, size or time). */
|
|
96
|
+
function poolOf(root) {
|
|
97
|
+
let sig = '';
|
|
98
|
+
try {
|
|
99
|
+
const dir = require('./jira-tickets.js').jiraDir(root);
|
|
100
|
+
sig = fs.readdirSync(dir).filter((n) => n.endsWith('.md')).sort().map((n) => { const s = fs.statSync(path.join(dir, n)); return n + ':' + s.size + ':' + s.mtimeMs; }).join('|');
|
|
101
|
+
} catch { return []; }
|
|
102
|
+
const c = cache.get(root);
|
|
103
|
+
if (c && c.sig === sig) return c.tickets;
|
|
104
|
+
const tickets = ticketsOf(TM.storedReads(root));
|
|
105
|
+
cache.set(root, { sig, tickets });
|
|
106
|
+
return tickets;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The asks, each with its `repeats` (countFor). all: every ask of the board's ledger, any state. A failed read gives no count. */
|
|
110
|
+
function decorate(root, asks, all, board) {
|
|
111
|
+
let tickets = [];
|
|
112
|
+
try { tickets = poolOf(root); } catch { tickets = []; }
|
|
113
|
+
return (asks || []).map((a) => {
|
|
114
|
+
try { return { ...a, repeats: countFor(a.line, { tickets, asks: askPool(all, a.id, board || a.board) }) }; } catch { return a; }
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** One `[repeat-requests]` line (the health log of repeat-request-count). */
|
|
119
|
+
function log(fields) {
|
|
120
|
+
console.log(LOG + ' ' + Object.entries(fields).map(([k, v]) => `${k}=${v == null ? 'none' : typeof v === 'string' && /\s/.test(v) ? JSON.stringify(v) : v}`).join(' '));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
module.exports = { LOG, EXAMPLES, similar, ticketsOf, askPool, countFor, sayOf, share, poolOf, decorate, log };
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* POST /api/intake/draft { line, acknowledged? } → { ok, draft } draft.kind and draft.kind_cue: the kind of work the name reads as
|
|
4
4
|
* (lib/work-kind.js fromName; kind_cue '' when the name tells nothing,
|
|
5
5
|
* and then the kind is the PM's role, setting work.role)
|
|
6
|
+
* ws (board, ask): draft.repeats, the similar earlier requests (repeat-request-count)
|
|
7
|
+
* POST /api/ask-repeats { ws, board? } → { ok, repeats: { <ask id>: { count, jira, asks, examples, setting, say } } } the open asks'
|
|
8
|
+
* similar earlier requests (repeat-request-count, lib/repeat-requests.js)
|
|
6
9
|
* Drafts only. Creating the initiative stays with createInitiative, which refuses an unanchored create. */
|
|
7
10
|
const path = require('path');
|
|
8
11
|
const guard = require('./pm-guard.js');
|
|
@@ -12,9 +15,49 @@ const KS = require('./kind-scope.js');
|
|
|
12
15
|
|
|
13
16
|
const ROOT = path.resolve(__dirname, '..', '..');
|
|
14
17
|
|
|
18
|
+
/** repeat-request-count (A264): how many times the line was asked before, in the workspace's stored Jira reads and its board's earlier
|
|
19
|
+
* asks (lib/repeat-requests.js). Only with `ws`; null when that workspace is not known or its reads fail. */
|
|
20
|
+
function repeatsOf(ctx, body) {
|
|
21
|
+
if (typeof body.ws !== 'string' || !body.ws || !ctx.getWs) return null;
|
|
22
|
+
try {
|
|
23
|
+
const w = ctx.getWs(body.ws);
|
|
24
|
+
if (!w || w.id !== body.ws || !w.root) return null;
|
|
25
|
+
const all = asksOf(ctx, w);
|
|
26
|
+
const RR = require('./repeat-requests.js');
|
|
27
|
+
const board = typeof body.board === 'string' && body.board ? body.board : null;
|
|
28
|
+
return RR.countFor(body.line, { tickets: RR.poolOf(w.root), asks: RR.askPool(all, typeof body.ask === 'string' ? body.ask : null, board) });
|
|
29
|
+
} catch { return null; }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** POST /api/ask-repeats { ws, board } → { ok, repeats: { <ask id>: countFor result } } for the board's open asks (repeat-request-count). */
|
|
33
|
+
async function askRepeats(req, res, ctx) {
|
|
34
|
+
const got = await ctx.readJson(req);
|
|
35
|
+
if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
|
|
36
|
+
const body = got.body || {};
|
|
37
|
+
const g = guard.requirePagePress(req, body);
|
|
38
|
+
if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
|
|
39
|
+
const w = typeof body.ws === 'string' && body.ws && ctx.getWs ? ctx.getWs(body.ws) : null;
|
|
40
|
+
if (!w || w.id !== body.ws || !w.root) { ctx.json(res, { ok: false, error: 'ws names no registered workspace' }, 404); return true; }
|
|
41
|
+
const board = typeof body.board === 'string' && body.board ? body.board : null;
|
|
42
|
+
const RR = require('./repeat-requests.js');
|
|
43
|
+
const all = asksOf(ctx, w);
|
|
44
|
+
const open = all.filter((a) => a.state === 'open' && (!board || a.board === board));
|
|
45
|
+
const repeats = {};
|
|
46
|
+
for (const a of RR.decorate(w.root, open, all, null)) if (a.repeats) repeats[a.id] = a.repeats;
|
|
47
|
+
const n = Object.values(repeats).filter((r) => r.count > 0).length;
|
|
48
|
+
RR.log({ root: w.root, board: board || 'all', open: open.length, repeated: n });
|
|
49
|
+
ctx.json(res, { ok: true, repeats });
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
/** Every ask of a workspace's boards ledger, any state. [] when it cannot be read. */
|
|
53
|
+
function asksOf(ctx, w) {
|
|
54
|
+
try { const RB = require('./routes-boards.js'); return [...require(repoScript('boards.js')).fold(RB.readLedger(ctx, w)).asks.values()]; } catch { return []; }
|
|
55
|
+
}
|
|
56
|
+
|
|
15
57
|
module.exports = {
|
|
16
|
-
prefixes: ['/api/intake'],
|
|
58
|
+
prefixes: ['/api/intake', '/api/ask-repeats'],
|
|
17
59
|
handle: async (req, res, url, ctx) => {
|
|
60
|
+
if (req.method === 'POST' && url.pathname === '/api/ask-repeats') return askRepeats(req, res, ctx);
|
|
18
61
|
if (req.method !== 'POST' || url.pathname !== '/api/intake/draft') return false;
|
|
19
62
|
const got = await ctx.readJson(req);
|
|
20
63
|
if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
|
|
@@ -27,7 +70,7 @@ module.exports = {
|
|
|
27
70
|
let role = 'product'; try { role = require('./settings-store.js').get(ctx.runtimeDir, 'work.role'); } catch { role = 'product'; }
|
|
28
71
|
const k = KS.prePick(body.line, draft && draft.lane, role);
|
|
29
72
|
if (!k.cue && k.kind !== 'product') console.log(KS.LOG + ' intake kind ' + k.kind + ' from the role');
|
|
30
|
-
ctx.json(res, { ok: true, draft: { ...draft, kind: k.kind, kind_cue: k.cue } });
|
|
73
|
+
ctx.json(res, { ok: true, draft: { ...draft, kind: k.kind, kind_cue: k.cue, repeats: repeatsOf(ctx, body) } });
|
|
31
74
|
return true;
|
|
32
75
|
},
|
|
33
76
|
};
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* pmos tracker match [--json | --number | --file] the initiatives the Jira read does not cover, and the epic or ticket that most likely
|
|
8
8
|
* holds each one's work (initiative link-tracker-work, A465; lib/tracker-match.js). --file files them
|
|
9
9
|
* under each initiative's ✦ for the PM's ✓; `done` files them after every read
|
|
10
|
+
* pmos tracker repeats ["<ask>"] [--json | --number] how many times an ask was asked before, in the stored Jira reads and the boards'
|
|
11
|
+
* earlier asks (initiative repeat-request-count, A264; lib/repeat-requests.js). With no ask: the share
|
|
12
|
+
* of stored tickets that repeat (--number prints it alone, the health read)
|
|
10
13
|
* The repository is the one this terminal is in. The record is kept in the per-user runtime folder (lib/tracker-read.js),
|
|
11
14
|
* never in a repository. This command calls no tracker and moves no item.
|
|
12
15
|
*/
|
|
@@ -14,7 +17,7 @@ const { execFileSync } = require('child_process');
|
|
|
14
17
|
const stateRoot = require('./state-root');
|
|
15
18
|
const TR = require('./tracker-read.js');
|
|
16
19
|
|
|
17
|
-
const COMMANDS = { tracker: ['done', 'status', 'sync', 'match'] };
|
|
20
|
+
const COMMANDS = { tracker: ['done', 'status', 'sync', 'match', 'repeats'] };
|
|
18
21
|
const USAGE = [
|
|
19
22
|
'usage: pmos tracker done|status — when tracker items were last read for this repository',
|
|
20
23
|
' pmos tracker done [--moved N] [--left N] [--not-found N] the tracker-refresh skill runs this as its last step',
|
|
@@ -22,6 +25,8 @@ const USAGE = [
|
|
|
22
25
|
' pmos tracker sync [--number] how much of PMOS matches the last Jira read: state, done day, owner',
|
|
23
26
|
' pmos tracker match [--number | --file] the initiatives the Jira read does not cover, and the epic or ticket',
|
|
24
27
|
' that most likely holds their work; --file proposes it under each ✦',
|
|
28
|
+
' pmos tracker repeats ["<ask>"] [--number] how many times an ask was asked before (stored Jira reads, earlier asks);',
|
|
29
|
+
' with no ask, the share of stored tickets that repeat',
|
|
25
30
|
' every command: [--json]',
|
|
26
31
|
'This command never calls a tracker and moves no item. Only the PM\'s ✓ links a proposed match.',
|
|
27
32
|
];
|
|
@@ -74,6 +79,7 @@ function run(argv, { say = console.log, env = process.env, stateDir, cwd = proce
|
|
|
74
79
|
}
|
|
75
80
|
if (sub === 'sync') return sync(root, a, say);
|
|
76
81
|
if (sub === 'match') return match(root, a, say);
|
|
82
|
+
if (sub === 'repeats') return repeats(root, a, say);
|
|
77
83
|
const rec = TR.read(dir, root);
|
|
78
84
|
out({ ok: true, record: rec }, rec ? `tracker items last read at ${rec.read_at} (moved ${rec.moved ?? '?'}, left ${rec.left ?? '?'}, not found ${rec.not_found ?? '?'})` : 'tracker items not read yet for this repository');
|
|
79
85
|
return 0;
|
|
@@ -123,4 +129,39 @@ function match(root, a, say) {
|
|
|
123
129
|
return 0;
|
|
124
130
|
}
|
|
125
131
|
|
|
132
|
+
/** The asks of this repository's boards ledger (<state>/boards.jsonl), any state. [] when there is none. */
|
|
133
|
+
function asksOf(root) {
|
|
134
|
+
try {
|
|
135
|
+
const dir = require('./tracker-match.js').proposalsDir(root);
|
|
136
|
+
if (!dir) return [];
|
|
137
|
+
const lines = require('fs').readFileSync(require('path').join(dir, 'boards.jsonl'), 'utf8').split('\n').filter(Boolean)
|
|
138
|
+
.map((l) => { try { return JSON.parse(l); } catch { return null; } }).filter(Boolean);
|
|
139
|
+
const B = require(require('./repo-script.js').repoScript('boards.js'));
|
|
140
|
+
return [...B.fold(lines).asks.values()];
|
|
141
|
+
} catch { return []; }
|
|
142
|
+
}
|
|
143
|
+
/** `pmos tracker repeats`: how many times an ask was asked before (lib/repeat-requests.js), or, with no ask, the share of stored tickets
|
|
144
|
+
* that repeat. Reads the stored Jira reads and the boards ledger; calls no tracker and writes nothing. */
|
|
145
|
+
function repeats(root, a, say) {
|
|
146
|
+
const RR = require('./repeat-requests.js');
|
|
147
|
+
const line = a._.slice(1).join(' ').trim();
|
|
148
|
+
const tickets = RR.poolOf(root);
|
|
149
|
+
const s = RR.share(tickets);
|
|
150
|
+
if (!line) {
|
|
151
|
+
RR.log({ root, tickets: s.tickets, repeating: s.repeating, pct: s.pct });
|
|
152
|
+
if (a.json) { say(JSON.stringify({ ok: true, root, ...s })); return 0; }
|
|
153
|
+
if (a.number) { say(s.pct === null ? 'none' : String(s.pct)); return 0; }
|
|
154
|
+
if (!s.tickets) { say('No Jira read is stored here yet, so PMOS has nothing to count.'); return 0; }
|
|
155
|
+
say(`${s.pct}% of the stored tickets repeat: ${s.repeating} of ${s.tickets} have 2 or more others that ask for the same thing.`);
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
const r = RR.countFor(line, { tickets, asks: RR.askPool(asksOf(root), null, null) });
|
|
159
|
+
RR.log({ root, count: r.count, jira: r.jira, asks: r.asks });
|
|
160
|
+
if (a.json) { say(JSON.stringify({ ok: true, root, line, ...r })); return 0; }
|
|
161
|
+
if (a.number) { say(String(r.count)); return 0; }
|
|
162
|
+
if (!r.count) { say(s.tickets ? 'Not asked before: no stored ticket and no earlier ask is about the same thing.' : 'No Jira read is stored here yet, and no earlier ask is about the same thing.'); return 0; }
|
|
163
|
+
say(r.say);
|
|
164
|
+
return 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
126
167
|
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.750.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.750.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -297,7 +297,8 @@ const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', {
|
|
|
297
297
|
/* P the POST allow-list and the refusals */
|
|
298
298
|
const all = P.posts.concat(I.posts);
|
|
299
299
|
const other = all.filter((x) => !ALLOWED.test(x.path) && x.path !== '/api/briefing-premium/seen' // an opened popup's record (popup context slice 11, R1) is not a press
|
|
300
|
-
&& x.path !== '/api/loose-props/rows'
|
|
300
|
+
&& x.path !== '/api/loose-props/rows' // what Home shows loose, sent once when it changed so Claude can propose a clean-up (batch 13 item 3); it changes no work
|
|
301
|
+
&& x.path !== '/api/ask-repeats'); // New asks reads how many times each ask was asked before (repeat-request-count); it writes nothing
|
|
301
302
|
ok('P1 the pages post only to the asks, move, lifecycle, archive, initiative-layout and proposals/look routes', all.length > 10 && !other.length, JSON.stringify(other));
|
|
302
303
|
const noNonce = await post('/api/boards/move', { id: 'fx-bare', to: ready.model.board.stages[1] }, { 'Content-Type': 'application/json', Origin: BASE });
|
|
303
304
|
const lifeNo = await post('/api/lifecycle', { initiative_id: 'fx-bare', state: 'on-hold' }, { 'Content-Type': 'application/json', Origin: BASE });
|
|
@@ -34,7 +34,7 @@ const krShort = (a) => { const s = String(a || ''); if (!s) return ''; if (/^hea
|
|
|
34
34
|
const WHY_NOT = ['Out of scope', 'Already planned', 'Not now', 'Other'];
|
|
35
35
|
|
|
36
36
|
/* ── New asks (BdAsks, BdPhone) ─────────────────────────────────────────────────────────────────────────────────── */
|
|
37
|
-
let declining = null, expanded = null, picked = {};
|
|
37
|
+
let declining = null, expanded = null, picked = {}, reps = {}; // reps: ask id → its similar earlier requests (POST /api/ask-repeats)
|
|
38
38
|
const asksOf = () => ((M().asks && M().asks.rows) || []);
|
|
39
39
|
function askCard(a, i, phone) {
|
|
40
40
|
if (phone && i > 0 && expanded !== a.id) return `<button type="button" class="bd-acard row" data-askopen="${esc(a.id)}">${avatar(a.by || a.source)}<span class="tx"><b>${esc(a.by || a.source || 'Someone')}</b> · “${esc(a.line)}”</span>${SV(I.next)}</button>`;
|
|
@@ -43,6 +43,7 @@ function askCard(a, i, phone) {
|
|
|
43
43
|
const product = prod && prod.name ? `<div class="bd-aprod"><span class="bd-chip sm"><b>${esc(prod.name)}</b></span><span class="bd-amut">Why: ${esc(prod.why || '')}</span></div>` : '';
|
|
44
44
|
const pills = [a.draft.lane ? `<span class="bd-pill">Suggest: ${esc(cap(a.draft.lane))}</span>` : '', a.draft.anchor ? `<span class="bd-pill">${esc(krShort(a.draft.anchor))}</span>` : '', a.close ? `<span class="bd-pill w">Close to: ${esc(a.close.title)}</span>` : ''].join('');
|
|
45
45
|
const prior = (a.prior || []).length ? `<p class="bd-warn sm">Close to something you declined: “${esc(a.prior[0].title)}”.</p>` : '';
|
|
46
|
+
const rep = repeatsHtml(reps[a.id]);
|
|
46
47
|
if (declining === a.id) {
|
|
47
48
|
return `<div class="bd-acard" data-ask="${esc(a.id)}">${who}<p class="bd-aq">“${esc(a.line)}”</p>${product}<p class="bd-lbl">Why not</p><div class="bd-chips" role="radiogroup" aria-label="Why not">${WHY_NOT.map((w, j) => `<button type="button" class="bd-chip${j === 0 ? ' on' : ''}" role="radio" aria-checked="${j === 0}" data-whynot="${esc(w)}">${esc(w)}</button>`).join('')}</div>`
|
|
48
49
|
+ `<input class="bd-inp sm" name="why" maxlength="400" placeholder="Say a little more, optional" aria-label="Why not, in your words"><p class="bd-amsg" role="status"></p>`
|
|
@@ -51,8 +52,10 @@ function askCard(a, i, phone) {
|
|
|
51
52
|
const btns = phone
|
|
52
53
|
? `<button type="button" class="bd-btn solid wide" data-askact="accept" data-id="${esc(a.id)}">Accept to ${esc(firstStage(a))}</button><div class="bd-arow two">${a.close ? `<button type="button" class="bd-btn" data-askact="add" data-id="${esc(a.id)}">Add to existing</button>` : ''}<button type="button" class="bd-btn ghost" data-askact="decline" data-id="${esc(a.id)}">Decline</button></div>`
|
|
53
54
|
: `<div class="bd-arow"><button type="button" class="bd-btn sm solid" data-askact="accept" data-id="${esc(a.id)}">Accept to ${esc(firstStage(a))}</button>${a.close ? `<button type="button" class="bd-btn sm" data-askact="add" data-id="${esc(a.id)}">Add to ${esc(a.close.title)}</button>` : ''}<button type="button" class="bd-btn sm ghost" data-askact="decline" data-id="${esc(a.id)}">Decline</button></div>`;
|
|
54
|
-
return `<div class="bd-acard" data-ask="${esc(a.id)}">${who}<p class="bd-aq">“${esc(a.line)}”</p>${product}${pills ? `<div class="bd-pills">${pills}</div>` : ''}${prior}${btns}<p class="bd-amsg" role="status"></p></div>`;
|
|
55
|
+
return `<div class="bd-acard" data-ask="${esc(a.id)}">${who}<p class="bd-aq">“${esc(a.line)}”</p>${product}${pills ? `<div class="bd-pills">${pills}</div>` : ''}${prior}${rep}${btns}<p class="bd-amsg" role="status"></p></div>`;
|
|
55
56
|
}
|
|
57
|
+
/** repeat-request-count (A264): how many times the ask was asked before (lib/repeat-requests.js say). Nothing when never. */
|
|
58
|
+
const repeatsHtml = (r) => (r && r.count > 0 && r.say ? `<div class="bd-need" data-repeats="${r.count}">${SV(I.info)}<span>${esc(r.say)}</span></div>` : '');
|
|
56
59
|
const firstStage = (a) => (a && a.stages && a.stages[0]) || (M().board.stages || [])[0] || 'Triage';
|
|
57
60
|
function unsureHtml(L) {
|
|
58
61
|
if (!L.length) return '';
|
|
@@ -73,6 +76,15 @@ function asksHtml() {
|
|
|
73
76
|
export function openAsks(btn) {
|
|
74
77
|
declining = null; expanded = null;
|
|
75
78
|
Pop.open(asksHtml(), btn, { label: 'New asks', width: 520, cls: 'bd-asks' });
|
|
79
|
+
loadRepeats();
|
|
80
|
+
}
|
|
81
|
+
/** repeat-request-count (A264): the open asks' similar earlier requests, one read per workspace; the cards redraw when they come. */
|
|
82
|
+
async function loadRepeats() {
|
|
83
|
+
const L = asksOf(), wss = [...new Set(L.map((a) => boardOfAsk(a).ws).filter(Boolean))];
|
|
84
|
+
const got = await Promise.all(wss.map((ws) => pmPost('/api/ask-repeats', { ws, ...(M().board.all ? {} : { board: M().board.id }) }).catch(() => null)));
|
|
85
|
+
let any = false;
|
|
86
|
+
for (const r of got) if (r && r.ok && r.repeats) for (const [id, x] of Object.entries(r.repeats)) { reps[id] = x; if (x.count > 0) any = true; }
|
|
87
|
+
if (any && Pop.isOpen() && Pop.el().querySelector('#hAsks')) redrawAsks();
|
|
76
88
|
}
|
|
77
89
|
const redrawAsks = () => Pop.redraw(asksHtml());
|
|
78
90
|
async function acceptAsk(a, btn) {
|
|
@@ -130,7 +142,7 @@ const kindBox = () => WK.segHtml(N.kind, N.kindBy === 'pmos', !!M().board.factor
|
|
|
130
142
|
function hintsHtml() {
|
|
131
143
|
const p = N.prior && N.prior[0] && !N.ack ? `<div class="bd-warn"><b>Close to something you declined</b><span>“${esc(N.prior[0].title)}” was set aside in ${esc(N.prior[0].file)}.</span><div class="bd-arow"><button type="button" class="bd-btn sm" data-newact="seewhy">See why</button><button type="button" class="bd-btn sm ghost" data-newact="ack">It is different</button></div></div>` : '';
|
|
132
144
|
const c = N.close ? `<div class="bd-need">${SV(I.info)}<span>Also close to <button type="button" class="bd-dlink" data-newact="close">${esc(N.close.title)}</button> in ${esc(N.close.stage || 'its stage')}. Add to it instead?</span></div>` : '';
|
|
133
|
-
return p + c;
|
|
145
|
+
return p + c + repeatsHtml(N.repeats);
|
|
134
146
|
}
|
|
135
147
|
/** The open initiative a new name is close to (the model's rule for asks, run on the page as the PM types). */
|
|
136
148
|
function closeOf(text) {
|
|
@@ -188,9 +200,11 @@ function lean(text) {
|
|
|
188
200
|
leanT = setTimeout(async () => {
|
|
189
201
|
if (!N) return;
|
|
190
202
|
N.close = text.trim().length > 3 ? closeOf(text) : null;
|
|
191
|
-
const
|
|
203
|
+
const ws = (N.ask && N.ask.ws) || M().board.ws || null, board = M().board.all ? null : M().board.id || null;
|
|
204
|
+
const r = text.trim().length > 3 ? await pmPost('/api/intake/draft', { line: text.trim(), ...(ws ? { ws } : {}), ...(board ? { board } : {}), ...(N.ask && N.ask.id ? { ask: N.ask.id } : {}) }).catch(() => null) : null;
|
|
192
205
|
if (!N) return;
|
|
193
|
-
|
|
206
|
+
N.repeats = null;
|
|
207
|
+
if (r && r.ok && r.draft) { N.lean = r.draft.lane || N.lean; if (!N.ask) N.prior = r.draft.prior_rejections || []; N.repeats = r.draft.repeats || null; }
|
|
194
208
|
// PMOS's pre-pick follows the name until the PM taps a kind; a name that tells nothing goes back to the PM's role (Settings › General ›
|
|
195
209
|
// Your role; the draft's kind then) with no ✦ line
|
|
196
210
|
if (N.kindBy !== 'you') { const dr = r && r.ok && r.draft, cue = dr && dr.kind_cue && WK.KINDS.includes(dr.kind); N.kind = cue ? dr.kind : dr && WK.KINDS.includes(dr.kind) ? dr.kind : 'product'; N.kindBy = cue ? 'pmos' : null; }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "repeat-request-count (A264): how many times an ask was asked before, from the stored Jira reads and the board's earlier asks (lib/repeat-requests.js, pmos tracker repeats).",
|
|
3
|
+
"modules": [
|
|
4
|
+
"repeat-requests.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"repeat-requests.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|