create-pmos 0.687.0 → 0.688.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 +23 -23
- 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 +22 -22
- package/workspace/guide/cli.md +1 -0
- package/workspace/lib/pmos-verbs.js +1 -1
- package/workspace/lib/task-jira.js +107 -23
- package/workspace/lib/tracker-cli.js +21 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/test-files.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.688.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": {
|
|
@@ -34,46 +34,46 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-22T09:
|
|
37
|
+
"v": "0.688.0",
|
|
38
|
+
"at": "2026-11-22T09:05:24.774Z",
|
|
39
39
|
"f": 4,
|
|
40
40
|
"prs": [
|
|
41
|
-
{
|
|
42
|
-
"n": 1507,
|
|
43
|
-
"t": "List pmos jira digest in the CLI guide",
|
|
44
|
-
"s": "List pmos jira digest in the CLI guide",
|
|
45
|
-
"k": "fix"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"n": 1508,
|
|
49
|
-
"t": "Design drift counts a .style.cssText assignment once",
|
|
50
|
-
"s": "Design drift counts a .style.cssText assignment once",
|
|
51
|
-
"k": "fix"
|
|
52
|
-
},
|
|
53
41
|
{
|
|
54
42
|
"n": 1512,
|
|
55
43
|
"t": "Pmos pages shows each page's fix count before new features",
|
|
56
44
|
"s": "Pmos pages shows each page's fix count before new features",
|
|
57
45
|
"k": "new"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"n": 1502,
|
|
49
|
+
"t": "Done days and owners from the tracker, one sync number per product",
|
|
50
|
+
"s": "Done days and owners from the tracker, one sync number per product",
|
|
51
|
+
"k": "new"
|
|
58
52
|
}
|
|
59
53
|
]
|
|
60
54
|
},
|
|
61
55
|
{
|
|
62
|
-
"v": "0.
|
|
63
|
-
"at": "2026-11-22T08:
|
|
56
|
+
"v": "0.686.0",
|
|
57
|
+
"at": "2026-11-22T08:54:30.609Z",
|
|
64
58
|
"f": 4,
|
|
65
59
|
"prs": [
|
|
66
|
-
{
|
|
67
|
-
"n": 1497,
|
|
68
|
-
"t": "A decision journal with dated outcome checks (A331)",
|
|
69
|
-
"s": "A decision journal with dated outcome checks (A331)",
|
|
70
|
-
"k": "new"
|
|
71
|
-
},
|
|
72
60
|
{
|
|
73
61
|
"n": 1495,
|
|
74
62
|
"t": "A daily standup digest from the tracker",
|
|
75
63
|
"s": "A daily standup digest from the tracker",
|
|
76
64
|
"k": "new"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"n": 1507,
|
|
68
|
+
"t": "List pmos jira digest in the CLI guide",
|
|
69
|
+
"s": "List pmos jira digest in the CLI guide",
|
|
70
|
+
"k": "fix"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"n": 1508,
|
|
74
|
+
"t": "Design drift counts a .style.cssText assignment once",
|
|
75
|
+
"s": "Design drift counts a .style.cssText assignment once",
|
|
76
|
+
"k": "fix"
|
|
77
77
|
}
|
|
78
78
|
]
|
|
79
79
|
},
|
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-22T09:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T09:05:21Z"}
|
|
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-22T09:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T09:05:21Z"}
|
|
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-22T09:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T09:05:21Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-22T09:
|
|
3
|
+
"v": "0.688.0",
|
|
4
|
+
"at": "2026-11-22T09:05:24.774Z",
|
|
5
5
|
"f": 4,
|
|
6
6
|
"prs": [
|
|
7
|
-
{
|
|
8
|
-
"n": 1507,
|
|
9
|
-
"t": "List pmos jira digest in the CLI guide",
|
|
10
|
-
"s": "List pmos jira digest in the CLI guide",
|
|
11
|
-
"k": "fix"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"n": 1508,
|
|
15
|
-
"t": "Design drift counts a .style.cssText assignment once",
|
|
16
|
-
"s": "Design drift counts a .style.cssText assignment once",
|
|
17
|
-
"k": "fix"
|
|
18
|
-
},
|
|
19
7
|
{
|
|
20
8
|
"n": 1512,
|
|
21
9
|
"t": "Pmos pages shows each page's fix count before new features",
|
|
22
10
|
"s": "Pmos pages shows each page's fix count before new features",
|
|
23
11
|
"k": "new"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"n": 1502,
|
|
15
|
+
"t": "Done days and owners from the tracker, one sync number per product",
|
|
16
|
+
"s": "Done days and owners from the tracker, one sync number per product",
|
|
17
|
+
"k": "new"
|
|
24
18
|
}
|
|
25
19
|
]
|
|
26
20
|
},
|
|
27
21
|
{
|
|
28
|
-
"v": "0.
|
|
29
|
-
"at": "2026-11-22T08:
|
|
22
|
+
"v": "0.686.0",
|
|
23
|
+
"at": "2026-11-22T08:54:30.609Z",
|
|
30
24
|
"f": 4,
|
|
31
25
|
"prs": [
|
|
32
|
-
{
|
|
33
|
-
"n": 1497,
|
|
34
|
-
"t": "A decision journal with dated outcome checks (A331)",
|
|
35
|
-
"s": "A decision journal with dated outcome checks (A331)",
|
|
36
|
-
"k": "new"
|
|
37
|
-
},
|
|
38
26
|
{
|
|
39
27
|
"n": 1495,
|
|
40
28
|
"t": "A daily standup digest from the tracker",
|
|
41
29
|
"s": "A daily standup digest from the tracker",
|
|
42
30
|
"k": "new"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"n": 1507,
|
|
34
|
+
"t": "List pmos jira digest in the CLI guide",
|
|
35
|
+
"s": "List pmos jira digest in the CLI guide",
|
|
36
|
+
"k": "fix"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"n": 1508,
|
|
40
|
+
"t": "Design drift counts a .style.cssText assignment once",
|
|
41
|
+
"s": "Design drift counts a .style.cssText assignment once",
|
|
42
|
+
"k": "fix"
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
},
|
package/workspace/guide/cli.md
CHANGED
|
@@ -767,6 +767,7 @@ Before a launch date, `pmos launch` lists what is not ready in one place. It rea
|
|
|
767
767
|
|
|
768
768
|
- `pmos tracker done [--moved N] [--left N] [--not-found N]` records the time of the read for this repository and the counts of what it found. It moves no item.
|
|
769
769
|
- `pmos tracker status` says when tracker items were last read for this repository.
|
|
770
|
+
- `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.
|
|
770
771
|
|
|
771
772
|
### pmos source
|
|
772
773
|
|
|
@@ -62,7 +62,7 @@ const VERBS = Object.freeze({
|
|
|
62
62
|
help: 'pmos launch check|list — what is not ready before a launch date: tasks, tracker tickets, sign-offs, open questions (pmos launch help)' }),
|
|
63
63
|
// Not a pm-os-absorb verb (run: null): tracker-read-freshness added it through the same table.
|
|
64
64
|
tracker: Object.freeze({ module: 'tracker-cli.js', run: null, guide: 'cli.md',
|
|
65
|
-
help: 'pmos tracker done|status —
|
|
65
|
+
help: 'pmos tracker done|status|sync — when tracker items were last read, and how much of this repository matches the last Jira read (pmos tracker help)' }),
|
|
66
66
|
// Not a pm-os-absorb verb (run: null): briefing-source-flow added it through the same table.
|
|
67
67
|
source: Object.freeze({ module: 'source-cli.js', run: null, guide: 'cli.md',
|
|
68
68
|
help: 'pmos source save|status|show — the stored read of each tool the Briefing uses: Mail, Slack, Confluence and the rest (pmos source help)' }),
|
|
@@ -15,11 +15,21 @@
|
|
|
15
15
|
* trackerLines(lines, snapOf) PURE → [task-update line] the state changes the last Jira read makes (see THE RULE). They are
|
|
16
16
|
* added to the folded lines in memory (lib/routes-boards.js readLedger) and never written to a file
|
|
17
17
|
* staleOf(keys, snap, now) PURE → { stale, since, keys } whether the read these keys rest on is older than STALE_MS
|
|
18
|
+
* syncOf(lines, snapOf) PURE → { read, inSync, unread, pct, quiet, rows } how much of PMOS matches the last read (A439)
|
|
19
|
+
* readLines(root) → the task ledger lines of the repository, parsed
|
|
18
20
|
*
|
|
19
21
|
* THE RULE. The read sets the state of a task nobody changed since it was made or imported. When someone changed the state in PMOS, the
|
|
20
22
|
* read wins only when it is newer and Jira moved the ticket after that change (its last update or its resolution day); a read with
|
|
21
23
|
* neither time may only close the task. So a task the PM reopened stays open until Jira moves. A reading the search did not return
|
|
22
24
|
* (marked stale) changes nothing.
|
|
25
|
+
* DONE DAY (A438, initiative tracker-dates-owners-sync). A task done in PMOS whose ticket Jira closed takes Jira's resolution day as
|
|
26
|
+
* the day it finished, also when it was already done before the read (imported as Done, so its done day was the import day). A day
|
|
27
|
+
* the PM gave by hand (`happened` on their own line) stays. A ticket that is not closed gives no day.
|
|
28
|
+
* OWNER (A440). Jira's assignee becomes the owner when PMOS has none, an agent id, or the owner the task was made or imported with.
|
|
29
|
+
* An owner someone set later by hand stays: syncOf names the difference. An unassigned ticket clears nothing, and an assignee that is
|
|
30
|
+
* a bot or an agent is never taken. "Dana" and "Dana Lee" are the same person.
|
|
31
|
+
* SYNC (A439). After the read is applied, a task the read returned is in sync when its state, done day and owner match the reading.
|
|
32
|
+
* pct = in sync ÷ read; the tasks the read did not return are counted apart (unread). quiet at 95% or more (zero is silence).
|
|
23
33
|
* STALE. The Jira read is due every day: a read older than 26 hours (lib/freshness.js, jira stale_after_ms) is stale, and so is a task
|
|
24
34
|
* key no read has covered yet. A forecast never rests on a stale read (lib/forecast.js, lib/kind-control.js).
|
|
25
35
|
*
|
|
@@ -49,12 +59,19 @@ function keyedTasks(lines) {
|
|
|
49
59
|
if (e.kind === 'task') {
|
|
50
60
|
if (all.has(e.task) || typeof e.initiative !== 'string') continue;
|
|
51
61
|
// stateAt is the time someone CHANGED the state: the state a task was created (or imported) with is no decision
|
|
52
|
-
all.set(e.task, { task: e.task, initiative: e.initiative, title: String(e.title || ''), state: e.state || 'To do', stateAt: null
|
|
62
|
+
all.set(e.task, { task: e.task, initiative: e.initiative, title: String(e.title || ''), state: e.state || 'To do', stateAt: null,
|
|
63
|
+
owner: typeof e.owner === 'string' && e.owner.trim() ? e.owner.trim() : null, ownerAt: null, since: null, dayByHand: false });
|
|
53
64
|
} else if (e.kind === 'task-update') {
|
|
54
65
|
const t = all.get(e.task); if (!t) continue;
|
|
55
66
|
if (typeof e.initiative === 'string' && e.initiative) t.initiative = e.initiative;
|
|
56
67
|
if (typeof e.title === 'string' && e.title.trim()) t.title = e.title.trim();
|
|
57
|
-
if (typeof e.state === 'string' && e.state) {
|
|
68
|
+
if (typeof e.state === 'string' && e.state) {
|
|
69
|
+
t.state = e.state === 'In review' ? 'In progress' : e.state; t.stateAt = e.at || t.stateAt;
|
|
70
|
+
// the done day, as scripts/boards.js folds `since`: the line's `happened`, else the day it was written
|
|
71
|
+
t.since = typeof e.happened === 'string' ? e.happened : String(e.at || '').slice(0, 10) || null;
|
|
72
|
+
t.dayByHand = typeof e.happened === 'string' && e.by !== BY;
|
|
73
|
+
}
|
|
74
|
+
if (typeof e.owner === 'string') { t.owner = e.owner.trim() || null; if (e.by !== BY) t.ownerAt = e.at || t.ownerAt || 'by-hand'; }
|
|
58
75
|
} else if (e.kind === 'task-remove') {
|
|
59
76
|
if (all.has(e.task)) { removed.set(e.task, all.get(e.task)); all.delete(e.task); }
|
|
60
77
|
} else if (e.kind === 'task-restore') {
|
|
@@ -78,11 +95,7 @@ function keysByInitiative(lines) {
|
|
|
78
95
|
}
|
|
79
96
|
/** keysByInitiative from the repository's own task ledger; an empty Map when it cannot be read. */
|
|
80
97
|
function readKeys(root) {
|
|
81
|
-
|
|
82
|
-
try { raw = require('./task-store.js').readStore(root); } catch { raw = null; }
|
|
83
|
-
const lines = [];
|
|
84
|
-
for (const x of raw || []) { if (typeof x !== 'string') { lines.push(x); continue; } try { lines.push(JSON.parse(x)); } catch { /* a torn line */ } }
|
|
85
|
-
return keysByInitiative(lines);
|
|
98
|
+
return keysByInitiative(readLines(root));
|
|
86
99
|
}
|
|
87
100
|
|
|
88
101
|
/** A Jira reading as a task state. */
|
|
@@ -100,33 +113,104 @@ function stateOf(rd) {
|
|
|
100
113
|
* readSnapshot). Each line is { at: the read's time, by: 'tracker:jira', kind: 'task-update', task, state, why, tracker: true }.
|
|
101
114
|
*/
|
|
102
115
|
function trackerLines(lines, snapOf) {
|
|
103
|
-
const out = [];
|
|
104
|
-
const snap = (
|
|
116
|
+
const out = [];
|
|
117
|
+
const snap = snapMemo(snapOf);
|
|
105
118
|
for (const t of keyedTasks(lines).values()) {
|
|
106
119
|
if (t.state === 'Archived') continue;
|
|
107
120
|
const s = snap(t.initiative);
|
|
108
121
|
if (!s || !s.fetchedAt || !s.tickets || !s.tickets.get) continue;
|
|
109
122
|
const rd = s.tickets.get(t.key);
|
|
110
123
|
if (!rd || rd.stale) continue;
|
|
124
|
+
const readAt = ms(s.fetchedAt);
|
|
125
|
+
if (!readAt) continue;
|
|
126
|
+
const line = {}; const why = [];
|
|
127
|
+
// STATE (read-tracker-daily)
|
|
111
128
|
const want = stateOf(rd);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
let state = t.state;
|
|
130
|
+
if (want && want !== t.state && readAt > ms(t.stateAt)) {
|
|
131
|
+
const changed = ms(t.stateAt);
|
|
132
|
+
let take = true;
|
|
133
|
+
if (changed) {
|
|
134
|
+
// someone changed the state in PMOS: Jira wins only when it moved after that (its last update or resolution), or, when the read
|
|
135
|
+
// carries neither time, only to close the task
|
|
136
|
+
const jiraAt = Math.max(ms(rd.updated), ms(rd.resolved));
|
|
137
|
+
const closes = want === 'Done' || want === "Won't do";
|
|
138
|
+
if (jiraAt ? jiraAt <= changed : !closes) take = false;
|
|
139
|
+
}
|
|
140
|
+
if (take) { line.state = want; state = want; why.push(`Jira says ${String(rd.status || want).slice(0, 40)}`); }
|
|
141
|
+
}
|
|
142
|
+
// DONE DAY (A438): Jira's resolution day when the task is done and the ticket closed, unless the PM gave the day by hand
|
|
143
|
+
const closed = want === 'Done' || want === "Won't do";
|
|
144
|
+
const day = /^\d{4}-\d{2}-\d{2}$/.test(String(rd.resolved || '')) ? rd.resolved : null;
|
|
145
|
+
if (closed && day && state === want && (line.state || (!t.dayByHand && t.since !== day))) {
|
|
146
|
+
line.happened = day;
|
|
147
|
+
if (!line.state) { line.state = state; why.push(`Jira closed it on ${day}`); }
|
|
121
148
|
}
|
|
122
|
-
//
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
149
|
+
// OWNER (A440): Jira's assignee, unless someone set the owner by hand
|
|
150
|
+
const who = humanAssignee(rd.assignee);
|
|
151
|
+
if (who && !samePerson(who, t.owner) && (!t.ownerAt || isAgent(t.owner))) { line.owner = who; why.push(`Jira assignee ${who}`); }
|
|
152
|
+
if (!Object.keys(line).length) continue;
|
|
153
|
+
out.push({ at: s.fetchedAt, by: BY, kind: 'task-update', task: t.task, ...line, tracker: true,
|
|
154
|
+
why: `${why.join('; ')} (${t.key}, read ${String(s.fetchedAt).slice(0, 16).replace('T', ' ')} UTC)` });
|
|
126
155
|
}
|
|
127
156
|
return out.sort((a, b) => String(a.at).localeCompare(String(b.at)));
|
|
128
157
|
}
|
|
129
158
|
|
|
159
|
+
function snapMemo(snapOf) {
|
|
160
|
+
const snaps = new Map();
|
|
161
|
+
return (ini) => { if (!snaps.has(ini)) { let s = null; try { s = snapOf(ini) || null; } catch { s = null; } snaps.set(ini, s); } return snaps.get(ini); };
|
|
162
|
+
}
|
|
163
|
+
// an owner or assignee that is an agent, a bot or an automation, never a person
|
|
164
|
+
const AGENT = /^(agent|bot|ai|tracker|system)[:/]|^(claude|pmos|agent|bot|system|automation)$|\[bot\]$|\bbot\b|automation for|^jira automation/i;
|
|
165
|
+
const isAgent = (name) => !!name && AGENT.test(String(name).trim());
|
|
166
|
+
const humanAssignee = (a) => { const n = typeof a === 'string' ? a.trim() : ''; return n && !isAgent(n) ? n : null; };
|
|
167
|
+
const words = (n) => String(n || '').toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
168
|
+
/** Whether two names are the same person: equal ignoring case and marks, or one's words are all in the other ("Dana", "Dana Lee"). */
|
|
169
|
+
function samePerson(a, b) {
|
|
170
|
+
const x = words(a), y = words(b);
|
|
171
|
+
if (!x.length || !y.length) return false;
|
|
172
|
+
const [short, long] = x.length <= y.length ? [x, y] : [y, x];
|
|
173
|
+
return short.every((w) => long.includes(w));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* How much of PMOS matches the last Jira read (A439). The read is applied first (trackerLines), so what is left is what PMOS keeps on
|
|
178
|
+
* purpose: a state changed after Jira's last move, a done day or an owner set by hand. Each row is
|
|
179
|
+
* { task, key, title, initiative, field: 'state' | 'done day' | 'owner', pmos, tracker }.
|
|
180
|
+
*/
|
|
181
|
+
function syncOf(lines, snapOf) {
|
|
182
|
+
const snap = snapMemo(snapOf);
|
|
183
|
+
const all = (lines || []).concat(trackerLines(lines, snap));
|
|
184
|
+
let read = 0, inSync = 0, unread = 0; const rows = [];
|
|
185
|
+
for (const t of keyedTasks(all).values()) {
|
|
186
|
+
if (t.state === 'Archived') continue;
|
|
187
|
+
const s = snap(t.initiative);
|
|
188
|
+
const rd = s && s.fetchedAt && s.tickets && s.tickets.get ? s.tickets.get(t.key) : null;
|
|
189
|
+
if (!rd || rd.stale) { unread++; continue; }
|
|
190
|
+
read++;
|
|
191
|
+
const diff = [];
|
|
192
|
+
const want = stateOf(rd);
|
|
193
|
+
if (want && want !== t.state) diff.push(['state', t.state, want]);
|
|
194
|
+
const day = /^\d{4}-\d{2}-\d{2}$/.test(String(rd.resolved || '')) ? rd.resolved : null;
|
|
195
|
+
if (day && (want === 'Done' || want === "Won't do") && t.state === want && t.since !== day) diff.push(['done day', t.since, day]);
|
|
196
|
+
const who = humanAssignee(rd.assignee);
|
|
197
|
+
if (who && !samePerson(who, t.owner)) diff.push(['owner', t.owner, who]);
|
|
198
|
+
if (!diff.length) { inSync++; continue; }
|
|
199
|
+
for (const [field, pmos, tracker] of diff) rows.push({ task: t.task, key: t.key, title: t.title, initiative: t.initiative, field, pmos: pmos || null, tracker });
|
|
200
|
+
}
|
|
201
|
+
const pct = read ? Math.floor((inSync / read) * 100) : null;
|
|
202
|
+
return { read, inSync, unread, pct, quiet: pct === null || pct >= 95, rows };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** The task ledger lines of the repository (lib/task-store.js), parsed; [] when it cannot be read. */
|
|
206
|
+
function readLines(root) {
|
|
207
|
+
let raw = null;
|
|
208
|
+
try { raw = require('./task-store.js').readStore(root); } catch { raw = null; }
|
|
209
|
+
const lines = [];
|
|
210
|
+
for (const x of raw || []) { if (typeof x !== 'string') { lines.push(x); continue; } try { lines.push(JSON.parse(x)); } catch { /* a torn line */ } }
|
|
211
|
+
return lines;
|
|
212
|
+
}
|
|
213
|
+
|
|
130
214
|
/** Whether the read `keys` rest on is stale: no read, a read older than STALE_MS, or keys the read did not return. */
|
|
131
215
|
function staleOf(keys, snap, now = Date.now()) {
|
|
132
216
|
const list = [...new Set((keys || []).filter(Boolean))];
|
|
@@ -137,4 +221,4 @@ function staleOf(keys, snap, now = Date.now()) {
|
|
|
137
221
|
return { stale: old || missing.length > 0, since: snap.fetchedAt, keys: old ? list : missing };
|
|
138
222
|
}
|
|
139
223
|
|
|
140
|
-
module.exports = { STALE_MS, BY, keyOf, keyedTasks, keysByInitiative, readKeys, stateOf, trackerLines, staleOf };
|
|
224
|
+
module.exports = { STALE_MS, BY, keyOf, keyedTasks, keysByInitiative, readKeys, readLines, stateOf, trackerLines, staleOf, syncOf, samePerson, isAgent };
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* tracker-read-freshness).
|
|
4
4
|
* pmos tracker done [--moved N] [--left N] [--not-found N] [--json]
|
|
5
5
|
* pmos tracker status [--json]
|
|
6
|
+
* pmos tracker sync [--json | --number] how much of PMOS matches the last Jira read here (initiative tracker-dates-owners-sync, A439)
|
|
6
7
|
* The repository is the one this terminal is in. The record is kept in the per-user runtime folder (lib/tracker-read.js),
|
|
7
8
|
* never in a repository. This command calls no tracker and moves no item.
|
|
8
9
|
*/
|
|
@@ -10,11 +11,12 @@ const { execFileSync } = require('child_process');
|
|
|
10
11
|
const stateRoot = require('./state-root');
|
|
11
12
|
const TR = require('./tracker-read.js');
|
|
12
13
|
|
|
13
|
-
const COMMANDS = { tracker: ['done', 'status'] };
|
|
14
|
+
const COMMANDS = { tracker: ['done', 'status', 'sync'] };
|
|
14
15
|
const USAGE = [
|
|
15
16
|
'usage: pmos tracker done|status — when tracker items were last read for this repository',
|
|
16
17
|
' pmos tracker done [--moved N] [--left N] [--not-found N] the tracker-refresh skill runs this as its last step',
|
|
17
18
|
' pmos tracker status when the last read finished, and what it found',
|
|
19
|
+
' pmos tracker sync [--number] how much of PMOS matches the last Jira read: state, done day, owner',
|
|
18
20
|
' every command: [--json]',
|
|
19
21
|
'This command never calls a tracker and moves no item.',
|
|
20
22
|
];
|
|
@@ -26,7 +28,7 @@ function parseArgs(argv) {
|
|
|
26
28
|
if (!t.startsWith('--')) { out._.push(t); continue; }
|
|
27
29
|
const eq = t.indexOf('=');
|
|
28
30
|
const key = eq > 0 ? t.slice(2, eq) : t.slice(2);
|
|
29
|
-
if (key === 'json' || key === 'help') out[key] = true;
|
|
31
|
+
if (key === 'json' || key === 'help' || key === 'number') out[key] = true;
|
|
30
32
|
else if (eq > 0) out[key] = t.slice(eq + 1);
|
|
31
33
|
else if (argv[i + 1] !== undefined) out[key] = argv[++i];
|
|
32
34
|
else out[key] = '';
|
|
@@ -60,9 +62,26 @@ function run(argv, { say = console.log, env = process.env, stateDir, cwd = proce
|
|
|
60
62
|
out({ ok: true, ...rec }, `tracker items read at ${rec.read_at} for ${rec.root}. The freshness line shows it.`);
|
|
61
63
|
return 0;
|
|
62
64
|
}
|
|
65
|
+
if (sub === 'sync') return sync(root, a, say);
|
|
63
66
|
const rec = TR.read(dir, root);
|
|
64
67
|
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');
|
|
65
68
|
return 0;
|
|
66
69
|
}
|
|
67
70
|
|
|
71
|
+
/** `pmos tracker sync`: the sync number of this repository (lib/task-jira.js syncOf). Reads the task ledger and the Jira snapshots
|
|
72
|
+
* the last read saved; calls no tracker and writes nothing. --number prints the number alone on the last line (the health read). */
|
|
73
|
+
function sync(root, a, say) {
|
|
74
|
+
const TJ = require('./task-jira.js');
|
|
75
|
+
const JS = require('./jira-status.js');
|
|
76
|
+
const s = TJ.syncOf(TJ.readLines(root), (ini) => JS.readSnapshot(root, ini));
|
|
77
|
+
console.log(`[tracker-sync] root=${root} read=${s.read} in_sync=${s.inSync} unread=${s.unread} pct=${s.pct === null ? 'none' : s.pct}`);
|
|
78
|
+
if (a.json) { say(JSON.stringify({ ok: true, root, ...s })); return 0; }
|
|
79
|
+
if (a.number) { say(s.pct === null ? 'none' : String(s.pct)); return 0; }
|
|
80
|
+
if (s.pct === null) { say(s.unread ? `No task here has a Jira reading yet (${s.unread} can't be read).` : 'No task here names a Jira ticket.'); return 0; }
|
|
81
|
+
const differ = s.read - s.inSync;
|
|
82
|
+
say(`${s.pct}% in sync with Jira (${differ} of ${s.read} differ${s.unread ? `, ${s.unread} can't be read` : ''}).`);
|
|
83
|
+
for (const r of s.rows) say(` ${r.key} ${r.field}: PMOS ${r.pmos || 'none'}, Jira ${r.tracker} · ${r.title.slice(0, 60)}`);
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
68
87
|
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.688.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.688.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED