create-pmos 0.690.0 → 0.692.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 +22 -16
- 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 +21 -2
- package/workspace/guide/cli.md +10 -1
- package/workspace/lib/autonomy.js +41 -9
- package/workspace/lib/board-premium.js +10 -2
- package/workspace/lib/change-record.js +303 -0
- package/workspace/lib/default-decisions.js +2 -1
- package/workspace/lib/driver-decide.js +6 -3
- package/workspace/lib/factory-cli.js +58 -0
- package/workspace/lib/improve-runs.js +7 -4
- package/workspace/lib/initiative-cli.js +31 -4
- package/workspace/lib/initiative-origin.js +131 -0
- package/workspace/lib/initiative-writer.js +35 -2
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/proposals.js +5 -1
- package/workspace/lib/routes-boards.js +4 -1
- package/workspace/lib/routes-proposals.js +5 -2
- package/workspace/lib/source-guard.js +26 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-work.js +24 -5
- package/workspace/test-lists/one-change-record-no-source-no-auto.json +9 -0
- package/workspace/test-lists/who-raised-each-idea.json +5 -0
|
@@ -34,9 +34,10 @@ export const COLS = [
|
|
|
34
34
|
{ k: 'program', n: 'Program', w: 150, on: false },
|
|
35
35
|
{ k: 'goal', n: 'Goal', w: 170, on: false },
|
|
36
36
|
{ k: 'wf', n: 'Workflow', w: 140, on: false },
|
|
37
|
+
{ k: 'origin', n: 'Raised by', w: 150, on: false }, // who raised it (who-raised-each-idea, bet A445): lib/initiative-origin.js on the row
|
|
37
38
|
];
|
|
38
39
|
const byK = Object.fromEntries(COLS.map((c) => [c.k, c]));
|
|
39
|
-
export const GROUPS = [['goal', 'Goal'], ['product', 'Product'], ['stage', 'Stage'], ['status', 'Status'], ['program', 'Program'], ['none', 'No groups']];
|
|
40
|
+
export const GROUPS = [['goal', 'Goal'], ['product', 'Product'], ['stage', 'Stage'], ['status', 'Status'], ['program', 'Program'], ['origin', 'Raised by'], ['none', 'No groups']];
|
|
40
41
|
// the scale tabs (WorkDS, 2026-11-20): Week, Month, Quarter, Year and Full; the number is the window's length in days (Full fits the rows)
|
|
41
42
|
export const SPANS = [['week', 'Week', 42], ['month', 'Month', 152], ['quarter', 'Quarter', 456], ['year', 'Year', 1096], ['full', 'Full', 0]];
|
|
42
43
|
const OLD_SPAN = { half: 'quarter', y2: 'year', y5: 'year' }; // a view kept before the scale tabs
|
|
@@ -94,6 +95,16 @@ export function moveCol(k, before) {
|
|
|
94
95
|
/** The columns to draw beside Initiative: the ones switched on, in their order; Product leaves by itself with one product. */
|
|
95
96
|
export const colsShown = (v, o = {}) => v.cols.filter((c) => c.on && !(c.k === 'product' && !o.many)).map((c) => c.k);
|
|
96
97
|
|
|
98
|
+
/* ── who raised it (who-raised-each-idea) ── the server reads it (lib/initiative-origin.js) and the row carries { kind, name, label, group }:
|
|
99
|
+
* "You", "Dana · teammate", "Acme · customer", "PMOS", "From the tracker". A row with none shows nothing and falls in "Not recorded". A copy
|
|
100
|
+
* never says "You" to a reader: it says "The PM". */
|
|
101
|
+
export const NO_ORIGIN = 'Not recorded';
|
|
102
|
+
const ORIGIN_ORDER = ['You', 'Teammates', 'Customers', 'PMOS', 'From the tracker'];
|
|
103
|
+
const roYou = (s) => (RO && s === 'You' ? 'The PM' : s);
|
|
104
|
+
export const originText = (r) => (r && r.origin && r.origin.label ? roYou(r.origin.label) : '');
|
|
105
|
+
export const originGroup = (r) => (r && r.origin && r.origin.group ? roYou(r.origin.group) : '');
|
|
106
|
+
const originPos = (g) => { const i = ORIGIN_ORDER.indexOf(g === 'The PM' ? 'You' : g); return i < 0 ? ORIGIN_ORDER.length : i; };
|
|
107
|
+
|
|
97
108
|
/* ── dates ───────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
98
109
|
export const day = (v) => { if (v instanceof Date) return new Date(v.getFullYear(), v.getMonth(), v.getDate()); const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
99
110
|
const today = (now) => day(now || new Date());
|
|
@@ -149,14 +160,16 @@ export function groupsOf(rows, by, o = {}) {
|
|
|
149
160
|
stage: (r) => stageText(r),
|
|
150
161
|
status: (r) => statusText(r),
|
|
151
162
|
program: (r) => (o.programOf && o.programOf(r)) || '',
|
|
163
|
+
origin: (r) => originGroup(r),
|
|
152
164
|
}[by];
|
|
153
165
|
if (!keyOf) return null;
|
|
154
|
-
const none = { goal: 'No goal yet', product: 'No product', stage: 'No stage', status: 'No status', program: 'No program' }[by];
|
|
166
|
+
const none = { goal: 'No goal yet', product: 'No product', stage: 'No stage', status: 'No status', program: 'No program', origin: NO_ORIGIN }[by];
|
|
155
167
|
const m = new Map();
|
|
156
168
|
for (const r of rows) { const k = keyOf(r) || ''; if (!m.has(k)) m.set(k, []); m.get(k).push(r); }
|
|
157
169
|
let G = [...m.entries()].map(([k, rs]) => ({ key: by + ':' + (k || '-'), name: k || none, rows: rs, empty: !k }));
|
|
158
170
|
if (by === 'stage') G.sort((a, b) => (a.empty - b.empty) || (Math.min(...a.rows.map(posOf)) - Math.min(...b.rows.map(posOf))));
|
|
159
171
|
else if (by === 'status') { const O = { 'To do': 0, 'In progress': 1, Done: 2 }; G.sort((a, b) => (O[a.name] ?? 9) - (O[b.name] ?? 9)); }
|
|
172
|
+
else if (by === 'origin') G.sort((a, b) => (a.empty - b.empty) || originPos(a.name) - originPos(b.name));
|
|
160
173
|
else G.sort((a, b) => a.empty - b.empty);
|
|
161
174
|
// one group that holds every row and names nothing (no goal yet anywhere) says nothing: the list is flat (zero is silence)
|
|
162
175
|
return G.length === 1 && G[0].empty ? null : G;
|
|
@@ -182,7 +195,7 @@ export function addSort(k) {
|
|
|
182
195
|
return write({ ...read(), sorts: S });
|
|
183
196
|
}
|
|
184
197
|
export const dropSort = (k) => write({ ...read(), sorts: read().sorts.filter((x) => x.k !== k) });
|
|
185
|
-
export const SORT_KEYS = [['title', 'Initiative'], ['stage', 'Stage'], ['date', 'Date'], ['ms', 'Next milestone'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program']];
|
|
198
|
+
export const SORT_KEYS = [['title', 'Initiative'], ['stage', 'Stage'], ['date', 'Date'], ['ms', 'Next milestone'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['origin', 'Raised by']];
|
|
186
199
|
const str = (v) => String(v || '~');
|
|
187
200
|
/** Stage order: the row's own workflow's place, else (no workflow on record) the lifecycle's order by name, so Discover comes before Build. */
|
|
188
201
|
const LIFE = ['triage', 'discover', 'discovery', 'plan', 'prioritize', 'build', 'deliver', 'monitor', 'evaluate', 'completed', 'closed'];
|
|
@@ -198,6 +211,7 @@ const SORTS = {
|
|
|
198
211
|
program: (a, b, o) => str(o.programOf && o.programOf(a)).localeCompare(str(o.programOf && o.programOf(b))),
|
|
199
212
|
goal: (a, b, o) => str(o.goalOf && o.goalOf(a)).localeCompare(str(o.goalOf && o.goalOf(b))),
|
|
200
213
|
wf: (a, b) => String(wfOf(a).name).localeCompare(String(wfOf(b).name)),
|
|
214
|
+
origin: (a, b) => originPos(originGroup(a) || '~') - originPos(originGroup(b) || '~') || str(originText(a)).localeCompare(str(originText(b))),
|
|
201
215
|
};
|
|
202
216
|
const sortRows = (rows, o) => {
|
|
203
217
|
const S = read().sorts.filter((x) => SORTS[x.k]); if (!S.length) return rows;
|
|
@@ -206,7 +220,7 @@ const sortRows = (rows, o) => {
|
|
|
206
220
|
|
|
207
221
|
/* ── filter (round 3): every facet takes several values; each value says how many rows it holds, and one that holds none is not shown.
|
|
208
222
|
* The filter lives for this page (the view is what PMOS remembers). ── */
|
|
209
|
-
const FACETS = [['need', 'Needs'], ['stage', 'Stage'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['owner', 'Owner'], ['sprint', 'Sprint']];
|
|
223
|
+
const FACETS = [['need', 'Needs'], ['stage', 'Stage'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['owner', 'Owner'], ['origin', 'Raised by'], ['sprint', 'Sprint']];
|
|
210
224
|
const NEEDS = [['you', 'Waits on you'], ['late', 'Late'], ['risk', 'At risk'], ['blocked', 'Blocked']];
|
|
211
225
|
const FL = Object.fromEntries(FACETS.map(([k]) => [k, new Set()]));
|
|
212
226
|
const RO_FACETS = new Set(['need', 'stage', 'status', 'product', 'program']); // a copy filters on what its table draws; never owner, sprint or "waits on you"
|
|
@@ -223,6 +237,7 @@ function valuesOf(r, k, o) {
|
|
|
223
237
|
if (k === 'product') { const v = o.product ? o.product(r) : r.product; return v ? [v] : []; }
|
|
224
238
|
if (k === 'program') return [(o.programOf && o.programOf(r)) || 'No program'];
|
|
225
239
|
if (k === 'owner') return [r.owner || 'No owner'];
|
|
240
|
+
if (k === 'origin') return [originGroup(r) || NO_ORIGIN];
|
|
226
241
|
if (k === 'sprint') return [...new Set((t.tickets || []).map((x) => x.sprint).filter(Boolean))];
|
|
227
242
|
return [];
|
|
228
243
|
}
|
|
@@ -238,6 +253,7 @@ export function facetsOf(rows, o = {}) {
|
|
|
238
253
|
if (k === 'need') vals = NEEDS.map(([x]) => vals.find((y) => y.v === x)).filter(Boolean);
|
|
239
254
|
else if (k === 'stage') { const rep = (v) => rows.find((r) => stageText(r) === v); vals.sort((a, b) => stageCmp(rep(a.v), rep(b.v))); }
|
|
240
255
|
else if (k === 'sprint') vals.sort((a, b) => String(b.v).localeCompare(String(a.v), undefined, { numeric: true }));
|
|
256
|
+
else if (k === 'origin') vals.sort((a, b) => originPos(a.v) - originPos(b.v));
|
|
241
257
|
else vals.sort((a, b) => b.n - a.n || String(a.v).localeCompare(String(b.v)));
|
|
242
258
|
// a value that is on but holds no row now stays, so it can be taken off
|
|
243
259
|
for (const v of FL[k]) if (!vals.some((y) => y.v === v)) vals.push({ v, word: k === 'need' ? needWord(v) : v, n: 0, on: true });
|
|
@@ -260,7 +276,8 @@ export function showingHtml(hidden) {
|
|
|
260
276
|
const and = (k) => [...FL[k]].map((v) => (k === 'need' ? needWord(v) : v)).join(k === 'need' ? ' or ' : ' and ');
|
|
261
277
|
const what = ['need', 'stage', 'status', 'sprint'].filter((k) => FL[k].size).map(and).join(' · ') || (Q ? 'the initiatives named “' + Q + '”' : 'the initiatives');
|
|
262
278
|
const of = ['product', 'program'].filter((k) => FL[k].size).map(and).join(' · '), by = FL.owner.size ? and('owner') : '';
|
|
263
|
-
|
|
279
|
+
const from = FL.origin.size ? [...FL.origin].map((v) => (v === NO_ORIGIN ? 'nobody on record' : v === 'You' ? 'you' : v)).join(' or ') : '';
|
|
280
|
+
return `<div class="wk-showing" role="status"><span>Showing ${esc(what)}${of ? ' of ' + esc(of) : ''}${by ? ' owned by ' + esc(by) : ''}${from ? ' raised by ' + esc(from) : ''}</span>${hidden ? `<span class="q">· ${hidden} hidden</span>` : ''}<span class="q">·</span><button type="button" class="wk-sa" data-wkclear>Show all</button></div>`;
|
|
264
281
|
}
|
|
265
282
|
|
|
266
283
|
/* ── the timeline's window ───────────────────────────────────────────────────────────────────────────────────── */
|
|
@@ -323,6 +340,7 @@ function cellHtml(r, k, o) {
|
|
|
323
340
|
if (k === 'program') return `<td>${esc((o.programOf && o.programOf(r)) || '')}</td>`;
|
|
324
341
|
if (k === 'goal') return `<td>${esc((o.goalOf && o.goalOf(r)) || '')}</td>`;
|
|
325
342
|
if (k === 'wf') return `<td>${esc(wfOf(r).name)}</td>`;
|
|
343
|
+
if (k === 'origin') return `<td>${esc(originText(r))}</td>`; // none: an empty cell (zero is silence)
|
|
326
344
|
return '<td></td>';
|
|
327
345
|
}
|
|
328
346
|
const words = (r, keys, o) => keys.map((k) => {
|
|
@@ -334,6 +352,7 @@ const words = (r, keys, o) => keys.map((k) => {
|
|
|
334
352
|
if (k === 'program') return (o.programOf && o.programOf(r)) || '';
|
|
335
353
|
if (k === 'goal') return (o.goalOf && o.goalOf(r)) || '';
|
|
336
354
|
if (k === 'wf') return wfOf(r).name;
|
|
355
|
+
if (k === 'origin') return originText(r) ? 'raised by ' + originText(r) : '';
|
|
337
356
|
return '';
|
|
338
357
|
}).filter(Boolean).join(', ');
|
|
339
358
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "One record of every agent change, and no source, no auto (initiative one-change-record-no-source-no-auto, done test C1-C12): the source rule in every job kind, the read-only fold of the change ledgers, and pmos factory today. Pure checks plus a kit-layout fixture in a temp folder. No connector, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"change-record.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"change-record.test.js": 5
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "who-raised-each-idea (bet A445): who raised each initiative. The parser and rule (lib/initiative-origin.js), the writer's raised_by line, pmos initiative raised-by, the coverage number, the Board row and the Work list's Raised by column, group, sort and filter (public/pm/bd-work.js). No browser.",
|
|
3
|
+
"modules": ["initiative-origin.test.js"],
|
|
4
|
+
"seconds": { "initiative-origin.test.js": 4 }
|
|
5
|
+
}
|