create-pmos 0.689.0 → 0.691.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 +15 -3
- 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 +14 -2
- package/workspace/guide/cli.md +7 -0
- package/workspace/guide/initiatives-and-next-steps.md +13 -1
- package/workspace/guide/settings-and-switches.md +1 -1
- package/workspace/lib/autonomy.js +41 -9
- 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-premium.js +7 -4
- package/workspace/lib/kind-scope.js +73 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/proposals.js +5 -1
- package/workspace/lib/routes-intake.js +7 -3
- package/workspace/lib/routes-proposals.js +5 -2
- package/workspace/lib/settings-store.js +3 -0
- 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-asks.js +4 -3
- package/workspace/public/pm/bd-ini-panel.js +1 -1
- package/workspace/public/pm/cozy-settings.js +9 -0
- package/workspace/public/pm/home-app.js +1 -1
- package/workspace/public/pm/home-ini-model.js +1 -1
- package/workspace/public/pm/home-ini.js +6 -3
- package/workspace/public/pm/premium-initiative-head.js +17 -6
- package/workspace/test-lists/kind-scopes-lifecycle-stages.json +9 -0
- package/workspace/test-lists/one-change-record-no-source-no-auto.json +9 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* factory-cli.js — `pmos factory`: one view of everything PMOS changed by itself (initiative one-change-record-no-source-no-auto).
|
|
3
|
+
*
|
|
4
|
+
* pmos factory today [--days N] [--json] [--unsourced] [--root <dir>]
|
|
5
|
+
* Per line (product, project, SDLC) and station: changes, applied by PMOS, kept, undone, ignored, applied with no source, and
|
|
6
|
+
* background runs. --days 7 covers the last 7 days (default: today). --json prints the totals and the lines. --unsourced prints the
|
|
7
|
+
* percent of self-applied changes that cite no source as one number on the last line (the initiative's health number).
|
|
8
|
+
*
|
|
9
|
+
* Read-only: it folds the ledgers with lib/change-record.js and writes nothing. Exit codes: 0 done, 1 refused, 2 usage. */
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const { execFileSync } = require('child_process');
|
|
12
|
+
const CR = require('./change-record.js');
|
|
13
|
+
|
|
14
|
+
const COMMANDS = { factory: ['today'] };
|
|
15
|
+
const USAGE = [
|
|
16
|
+
'usage: pmos factory today [--days N] [--json] [--unsourced] — everything PMOS changed by itself, in one record',
|
|
17
|
+
' pmos factory today per line and station: changes, applied, kept, undone, ignored, with no source, runs (today)',
|
|
18
|
+
' pmos factory today --days 7 the same over the last 7 days',
|
|
19
|
+
' pmos factory today --unsourced one number: the percent of changes PMOS applied by itself that cite no source',
|
|
20
|
+
'A change that cites no source never applies by itself: it waits for you (no source, no auto).',
|
|
21
|
+
];
|
|
22
|
+
const flag = (args, k) => { const i = args.indexOf('--' + k); return i >= 0 ? (args[i + 1] === undefined || args[i + 1].startsWith('--') ? true : args[i + 1]) : undefined; };
|
|
23
|
+
function repoRoot(cwd) { try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; } catch { return cwd; } }
|
|
24
|
+
const pad = (s, n) => String(s).padEnd(n);
|
|
25
|
+
const num = (v, n = 6) => String(v).padStart(n);
|
|
26
|
+
|
|
27
|
+
function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), env = process.env, now = Date.now(), runtimeDir } = {}) {
|
|
28
|
+
const args = argv[0] === 'factory' ? argv.slice(1) : argv.slice();
|
|
29
|
+
const verb = args[0];
|
|
30
|
+
if (!verb || ['help', '--help', '-h'].includes(verb)) { for (const l of USAGE) say(l); return verb ? 0 : 2; }
|
|
31
|
+
if (!COMMANDS.factory.includes(verb)) { say(`unknown factory command "${verb}" — one of ${COMMANDS.factory.join(', ')}`); return 2; }
|
|
32
|
+
const d = flag(args, 'days');
|
|
33
|
+
const days = d === undefined ? 1 : Number(d);
|
|
34
|
+
if (!Number.isInteger(days) || days < 1 || days > 90) { say('--days is a whole number from 1 to 90'); return 2; }
|
|
35
|
+
const root = typeof flag(args, 'root') === 'string' ? path.resolve(cwd, flag(args, 'root')) : repoRoot(cwd);
|
|
36
|
+
let rt = runtimeDir;
|
|
37
|
+
if (rt === undefined) { try { rt = require('./state-root.js').defaultRoot({ env }); } catch { rt = null; } }
|
|
38
|
+
const input = CR.read(root, { runtimeDir: rt });
|
|
39
|
+
if (!input.stateDir) { say('✗ this repository has no PMOS state folder (pmos/state, state or .pmos)'); return 1; }
|
|
40
|
+
let ws = null; try { ws = require('./driver.js').wsIdOf(root); } catch { /* no id: every outbox draft counts */ }
|
|
41
|
+
if (ws) input.outbox = input.outbox.filter((l) => !l.ws || l.ws === ws);
|
|
42
|
+
const { rows, runs } = CR.rows(input, { now });
|
|
43
|
+
const S = CR.summary(rows, runs, { now, days });
|
|
44
|
+
if (flag(args, 'json')) { say(JSON.stringify({ ok: true, ...S })); return 0; }
|
|
45
|
+
if (flag(args, 'unsourced')) {
|
|
46
|
+
say(`${S.unsourced} of ${S.applied} changes PMOS applied by itself ${days === 1 ? 'today' : `in the last ${days} days`} cite no source`);
|
|
47
|
+
say(String(S.unsourced_pct));
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
say(`What PMOS changed ${days === 1 ? 'today' : `in the last ${days} days`}: ${S.total} ${S.total === 1 ? 'change' : 'changes'}, ${S.applied} applied by itself, ${S.unsourced} with no source (${S.unsourced_pct}%)`);
|
|
51
|
+
if (!S.lines.length) { say(' nothing yet'); return 0; }
|
|
52
|
+
say(' ' + pad('Line', 9) + pad('Station', 13) + ['changes', 'applied', 'kept', 'undone', 'ignored', 'no src', 'runs'].map((h) => h.padStart(8)).join(''));
|
|
53
|
+
for (const l of S.lines) say(' ' + pad(CR.LINE_NAMES[l.line] || l.line, 9) + pad(l.station, 13) + [l.changes, l.applied, l.kept, l.undone, l.ignored, l.unsourced, l.runs].map((v) => num(v, 8)).join(''));
|
|
54
|
+
if (S.applied) say(` ${S.joined} of ${S.applied} self-applied changes joined to where they came from`);
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -171,7 +171,12 @@ function lesson({ stateDir, root, ws, area, run, text, now = Date.now(), env = p
|
|
|
171
171
|
const st = L.fold(ledgerOf(stateDir));
|
|
172
172
|
if ([...st.fixes.values()].some((f) => f.source === run)) return { ok: false, error: 'this run already recorded its one lesson' };
|
|
173
173
|
const A = require('./autonomy.js');
|
|
174
|
-
|
|
174
|
+
// no source, no auto (A443): the lesson cites the signals of its area; with none it waits for the PM
|
|
175
|
+
const sigs = signals || signalsOf(stateDir);
|
|
176
|
+
const n = sigs.filter((s) => L.slug(s.area) === area).length;
|
|
177
|
+
const src = n ? [`${n} signals in ${area}`] : [];
|
|
178
|
+
const d = A.decide({ stateDir, job: JOB, product: ws, cls: 'B', undoable: true, now, env, sources: src });
|
|
179
|
+
if (d.nosrc) A.logHeld(JOB, ws, area);
|
|
175
180
|
const ref = 'im-' + crypto.createHash('sha256').update(`${ws}:${area}:${run}:${t}`).digest('hex').slice(0, 10);
|
|
176
181
|
if (!d.apply) {
|
|
177
182
|
append(stateDir, { ev: 'wawan', area, why: `a lesson waits for you (${d.why}): ${t}` }, now);
|
|
@@ -182,11 +187,9 @@ function lesson({ stateDir, root, ws, area, run, text, now = Date.now(), env = p
|
|
|
182
187
|
const stale = new Date(now + STALE_DAYS * L.DAY).toISOString().slice(0, 10);
|
|
183
188
|
const w = core.write(root, { op: 'add', text: t, by: 'agent:improve', source: `improve:${ref}`, stale_after: stale, confidence: 'unconfirmed' });
|
|
184
189
|
if (!w.ok) return { ok: false, error: w.error };
|
|
185
|
-
const sigs = signals || signalsOf(stateDir);
|
|
186
|
-
const n = sigs.filter((s) => L.slug(s.area) === area).length;
|
|
187
190
|
append(stateDir, { ev: 'fix', fix: ref, area, case: null, source: run, files: [] }, now);
|
|
188
191
|
append(stateDir, { ev: 'lesson', ref, area, text: t }, now);
|
|
189
|
-
A.recordApplied(stateDir, { job: JOB, product: ws, ref, title: `Learned: ${t}`, cls: 'B', why: `${n} signals in ${area}`, run }, { now });
|
|
192
|
+
A.recordApplied(stateDir, { job: JOB, product: ws, ref, title: `Learned: ${t}`, cls: 'B', why: `${n} signals in ${area}`, run, src }, { now });
|
|
190
193
|
return { ok: true, ref, applied: true };
|
|
191
194
|
}
|
|
192
195
|
function propose({ stateDir, ws, area, run, text, ini = null, now = Date.now() } = {}) {
|
|
@@ -26,6 +26,7 @@ const shortDate = (v) => { const d = isoDay(v); return d ? d.getDate() + ' ' + M
|
|
|
26
26
|
const plural = (n, one, many) => (n === 1 ? one : many);
|
|
27
27
|
const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
28
28
|
const cap1 = (s) => (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : '');
|
|
29
|
+
const KS = require('./kind-scope.js'); // the kind marks each stage owned, watched or hidden, and a project hides the product documents
|
|
29
30
|
const SP = require('./status-proof.js'); // T3: a status renders only with its source and read time
|
|
30
31
|
const STATUS_LABEL = { 'no signal': 'No signal', 'on track': 'On track', 'at risk': 'At risk', late: 'Late', 'on hold': 'On hold', done: 'Done', cancelled: 'Cancelled' };
|
|
31
32
|
const DOC_STATE = { missing: 'Not started', draft: 'Draft', ok: 'Up to date', stale: 'Stale', due: 'Due' };
|
|
@@ -126,19 +127,21 @@ function build(f) {
|
|
|
126
127
|
const dd = f.docs || null;
|
|
127
128
|
// D99: an initiative on a library workflow groups its documents under its own stages (dd.phases), not Discover/Plan/Build/Evaluate
|
|
128
129
|
const phases = dd && Array.isArray(dd.phases) && dd.phases.length ? dd.phases.slice() : null;
|
|
130
|
+
const kindOf = ['product', 'sdlc', 'project'].includes(row.kind) ? row.kind : 'product';
|
|
129
131
|
const all = dd ? (dd.docs || []).map((d) => ({
|
|
130
132
|
key: d.key, title: d.title, what: d.for || '', st: d.st, state: d.kind === 'live' ? 'Live' : DOC_STATE[d.st] || d.st || '', by: BY[d.by] || d.by || '', byKey: d.by || '',
|
|
131
133
|
when: d.when ? shortDate(d.when) : '', at: d.when || '', cat: phases ? (d.other ? null : d.cat || null) : d.cat === 'Do' ? 'Build' : d.cat === 'Learn' ? 'Evaluate' : d.cat || 'Board', ...(d.other ? { other: true } : {}), path: d.open && d.open.path ? d.open.path : null, slot: d.st === 'draft' && d.draft && d.draft.slot ? d.draft.slot : '', running: !!d.running, tech: TECH.has(d.key), kind: d.kind || '', reader: d.reader || '', cadence: d.cadence || '', sections: ((GUIDE[d.key] || {}).sections || []).slice(),
|
|
132
134
|
act: d.act && d.act.do === 'draft' ? { kind: 'draft', label: d.running ? 'Drafting' : d.act.label || 'Draft it' } : null,
|
|
133
135
|
from: d.from && d.from.text ? { path: d.from.path, heading: d.from.heading, text: d.from.text, cut: !!d.from.cut } : null,
|
|
136
|
+
...(KS.docHidden(kindOf, d.key) ? { hidden: true } : {}), // folded, never dropped (pm/home-ini.js docsView)
|
|
134
137
|
})) : [];
|
|
135
138
|
const custom = (f.custom || []).map((d) => Object.assign(Custom.rowOf(d), { added: shortDate(d.at), at: d.at || '', cat: d.phase || 'Board' }));
|
|
136
139
|
const rows = all.concat(custom);
|
|
137
|
-
const core = rows.filter((d) => !d.tech);
|
|
140
|
+
const core = rows.filter((d) => !d.tech && !d.hidden); // a hidden document is not counted or offered, only folded
|
|
138
141
|
const cnt = { all: core.length, none: core.filter((d) => d.st === 'missing').length, draft: core.filter((d) => d.st === 'draft').length, ok: core.filter((d) => d.st === 'ok' || d.st === 'live').length };
|
|
139
142
|
const nLinked = core.filter((d) => d.st === 'linked').length;
|
|
140
143
|
if (nLinked) cnt.linked = nLinked; // a key only when an added document is linked
|
|
141
|
-
const docs = dd || custom.length ? { rows, counts: cnt, techCount: rows.length
|
|
144
|
+
const docs = dd || custom.length ? { rows, counts: cnt, techCount: rows.filter((d) => d.tech).length, ...(rows.some((d) => d.hidden) ? { hiddenCount: rows.filter((d) => d.hidden).length } : {}),
|
|
142
145
|
cap: core.length ? [cnt.draft ? cnt.draft + ' ' + plural(cnt.draft, 'draft', 'drafts') + ' to review' : '', cnt.none ? cnt.none + ' not started' : '', cnt.ok ? cnt.ok + ' up to date' : '', nLinked ? nLinked + ' linked' : ''].filter(Boolean).join(' · ') : '',
|
|
143
146
|
scope: (dd && dd.scope) || 'initiative:' + id, missing: !dd, ...(phases ? { phases, cur: dd.cat || phases[0] } : {}) } : { rows: [], counts: { all: 0, none: 0, draft: 0, ok: 0 }, techCount: 0, cap: '', missing: true };
|
|
144
147
|
if (!dd && !missing.includes('core documents')) missing.push('core documents');
|
|
@@ -147,7 +150,7 @@ function build(f) {
|
|
|
147
150
|
const phase = Math.max(0, PHASE_OF_CAT[row.cat] != null ? PHASE_OF_CAT[row.cat] : Math.max(0, cur >= 0 && names.length ? Math.floor(cur / Math.max(1, names.length) * 4) : 0));
|
|
148
151
|
const help = [];
|
|
149
152
|
const docAt = (d) => (docs.phases ? docs.phases.indexOf(d.cat) <= docs.phases.indexOf(docs.cur) && docs.phases.includes(d.cat) : DOC_CAT_ORDER.indexOf(d.cat) <= phase);
|
|
150
|
-
const nd = docs.rows.find((d) => d.st === 'missing' && !d.tech && d.act && d.act.kind === 'draft' && docAt(d));
|
|
153
|
+
const nd = docs.rows.find((d) => d.st === 'missing' && !d.tech && !d.hidden && d.act && d.act.kind === 'draft' && docAt(d));
|
|
151
154
|
if (nd) help.push({ label: 'Draft the ' + nd.title.toLowerCase(), kind: 'draft', key: nd.key });
|
|
152
155
|
const wantsOptions = bad || (lad && lad.next && /^(review|accept)$/.test(lad.next.step));
|
|
153
156
|
if (wantsOptions) help.push({ label: lad ? 'Summarise the review findings' : 'Lay out the options', kind: 'ask', q: lad ? 'Summarise the review findings for this initiative, from the evidence you can read in this repository. Say what you could not find.' : 'Lay out the options for this initiative, from what you can read in this repository, and say what you could not find. Do not recommend one unless the records do.' });
|
|
@@ -166,7 +169,7 @@ function build(f) {
|
|
|
166
169
|
pending: !!f.pending,
|
|
167
170
|
header: { text: 'Real data · as of ' + hhmm(now) + (missing.length ? ' · not read: ' + missing.join(', ') : ''), missing },
|
|
168
171
|
board: { name: board.name || '', id: board.id || null, ws: board.ws || null },
|
|
169
|
-
id, key, title: clip(row.title || id, 160), lane: row.lane || '', kind:
|
|
172
|
+
id, key, title: clip(row.title || id, 160), lane: row.lane || '', kind: kindOf, scope: KS.scopeOf(kindOf), anchor: row.anchor || '',
|
|
170
173
|
// the bar's presses (initiative premium-board-actions): the workflow, the lifecycle and the archive entry the row holds
|
|
171
174
|
acts: {
|
|
172
175
|
self: !!board.self, stages: moveNames, stage: (own ? names[cur] : row.stage) || null,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* kind-scope.js — how far an initiative's kind of work reaches along the one lifecycle (initiative kind-scopes-lifecycle-stages; design doc
|
|
3
|
+
* "Grill: one factory for PM, project and SDLC work", agreed by Wawan 2026-11-22). PURE, except `count` and the CLI below.
|
|
4
|
+
*
|
|
5
|
+
* One workspace, one initiative, three views. The three kinds (lib/work-kind.js) are not three products: they are three scopes on the same
|
|
6
|
+
* eight stages. For each stage the kind says owned (PMOS drives it with you), watched (read from where others do it) or hidden (left off).
|
|
7
|
+
*
|
|
8
|
+
* Stage project product sdlc
|
|
9
|
+
* Triage, Discover hidden owned owned
|
|
10
|
+
* Plan, Prioritize owned owned owned
|
|
11
|
+
* Build watched (Jira) watched (Jira) owned (the factory opens pull requests)
|
|
12
|
+
* Deliver, Monitor, Evaluate owned owned owned
|
|
13
|
+
* Gate Plan before start PRD and done test before build Done test and kill before build
|
|
14
|
+
*
|
|
15
|
+
* A project also hides the product documents (problem statement, research notes, PRD, eval rubric, design). HIDDEN IS NEVER REMOVED: the
|
|
16
|
+
* stage stays in Move to a stage, the current stage always shows, and a hidden document sits in one closed fold. Nothing here writes.
|
|
17
|
+
*
|
|
18
|
+
* scopeOf(kind) → { kind, label, stages: { key: 'owned'|'watched'|'hidden' }, hidden: [keys], watch: { key: source }, gate }
|
|
19
|
+
* docHidden(kind, docKey) → bool
|
|
20
|
+
* prePick(name, lane, role) → { kind, cue } lib/work-kind.js fromName, with the PM's role as the default when the name gives no cue
|
|
21
|
+
* count(root) → n initiatives whose kind hides at least one stage (the health number)
|
|
22
|
+
*
|
|
23
|
+
* node lib/kind-scope.js count [root] prints that number on its last line */
|
|
24
|
+
const fs = require('fs');
|
|
25
|
+
const path = require('path');
|
|
26
|
+
const WK = require('./work-kind.js');
|
|
27
|
+
|
|
28
|
+
const STAGES = ['triage', 'discover', 'plan', 'prioritize', 'build', 'deliver', 'monitor', 'evaluate'];
|
|
29
|
+
const all = (v) => Object.fromEntries(STAGES.map((k) => [k, v]));
|
|
30
|
+
const TABLE = Object.freeze({
|
|
31
|
+
project: Object.freeze({ ...all('owned'), triage: 'hidden', discover: 'hidden', build: 'watched' }),
|
|
32
|
+
product: Object.freeze({ ...all('owned'), build: 'watched' }),
|
|
33
|
+
sdlc: Object.freeze(all('owned')),
|
|
34
|
+
});
|
|
35
|
+
const WATCH = Object.freeze({ project: { build: 'Jira' }, product: { build: 'Jira' }, sdlc: {} });
|
|
36
|
+
const GATE = Object.freeze({ project: 'Plan before start', product: 'PRD and done test before build', sdlc: 'Done test and kill before build' });
|
|
37
|
+
const PRODUCT_DOCS = Object.freeze(new Set(['problem', 'research', 'prd', 'rubric', 'design']));
|
|
38
|
+
const LOG = '[kind-scope]';
|
|
39
|
+
|
|
40
|
+
function scopeOf(kind) {
|
|
41
|
+
const k = WK.kindOf(kind), stages = TABLE[k];
|
|
42
|
+
return { kind: k, label: WK.LABEL[k], stages: { ...stages }, hidden: STAGES.filter((s) => stages[s] === 'hidden'), watch: { ...WATCH[k] }, gate: GATE[k] };
|
|
43
|
+
}
|
|
44
|
+
const docHidden = (kind, key) => WK.kindOf(kind) === 'project' && PRODUCT_DOCS.has(String(key || ''));
|
|
45
|
+
|
|
46
|
+
/** The New initiative pre-pick: a cue in the name wins; else the PM's role (Settings › General › Your role); else Product. */
|
|
47
|
+
function prePick(name, lane, role) {
|
|
48
|
+
const k = WK.fromName(name, lane);
|
|
49
|
+
if (k.cue || !WK.valid(role) || role === k.kind) return k;
|
|
50
|
+
return { kind: role, cue: '' };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const kindLine = (text) => { const m = /^---\n([\s\S]*?)\n---/.exec(text); const l = m && /^kind:\s*(.+)$/m.exec(m[1]); return l ? WK.kindOf(l[1]) : 'product'; };
|
|
54
|
+
function count(root) {
|
|
55
|
+
let n = 0;
|
|
56
|
+
for (const d of ['planning/initiatives', 'pmos/state/initiatives', 'pmos/planning/initiatives']) {
|
|
57
|
+
let names = [];
|
|
58
|
+
try { names = fs.readdirSync(path.join(root, d)).filter((f) => f.endsWith('.md')); } catch { continue; }
|
|
59
|
+
for (const f of names) { let t = ''; try { t = fs.readFileSync(path.join(root, d, f), 'utf8'); } catch { continue; } if (scopeOf(kindLine(t)).hidden.length) n++; }
|
|
60
|
+
}
|
|
61
|
+
return n;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (require.main === module) {
|
|
65
|
+
const [verb, root] = process.argv.slice(2);
|
|
66
|
+
if (verb !== 'count') { console.error('usage: node lib/kind-scope.js count [root]'); process.exit(2); }
|
|
67
|
+
const r = path.resolve(root || process.cwd());
|
|
68
|
+
const n = count(r);
|
|
69
|
+
console.log(LOG + ' initiatives whose kind hides a stage in ' + r);
|
|
70
|
+
console.log(String(n));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = { STAGES, TABLE, GATE, PRODUCT_DOCS, LOG, scopeOf, docHidden, prePick, count };
|
|
@@ -143,6 +143,9 @@ const VERBS = Object.freeze({
|
|
|
143
143
|
help: 'pmos owner brief|budget — a unit owner\'s daily brief now, and its Driver runs a day (pmos owner help)' }),
|
|
144
144
|
driver: Object.freeze({ module: 'driver-cli.js', run: null, guide: 'cli.md',
|
|
145
145
|
help: 'pmos driver propose|status|keep|return|drop|undo|pause|resume|mode … — the Initiative Driver: class A and B changes apply with Undo, the rest wait for you (pmos driver help)' }),
|
|
146
|
+
// one-change-record-no-source-no-auto: everything PMOS changed by itself, in one record (lib/change-record.js)
|
|
147
|
+
factory: Object.freeze({ module: 'factory-cli.js', run: null, guide: 'cli.md',
|
|
148
|
+
help: 'pmos factory today [--days N] — everything PMOS changed by itself, per line and station, with what cites no source (pmos factory help)' }),
|
|
146
149
|
// D106 (Full autonomy now): what agents do by themselves, and the goals they work on until done
|
|
147
150
|
autonomy: Object.freeze({ module: 'autonomy-cli.js', run: null, guide: 'cli.md',
|
|
148
151
|
help: 'pmos autonomy status|restore — what agents applied by themselves (with Undo) and the jobs back to propose (pmos autonomy help)' }),
|
|
@@ -537,7 +537,11 @@ function viewOf(F, ini, o = {}) {
|
|
|
537
537
|
const grillHidden = o.grillAll ? [] : grill.slice(GRILL_SHOWN).map((p) => ({ id: p.id, group: 'grill', type: p.type, title: p.title, why: p.why, at: p.at, sig: p.sig, sources: p.sources, data: p.data, items: [] }));
|
|
538
538
|
if (!o.grillAll) for (const p of grill.slice(GRILL_SHOWN)) props.splice(props.indexOf(p), 1);
|
|
539
539
|
if (today != null) for (const p of datesOf(ini, T, { today, filed: [...F.props.values()].filter((x) => x.group === 'dates' && x.ini === ini), stages: o.stages, links: o.links, settle: o.settle, drops: F.drops })) if (!kept.has(p.id + ':' + p.sig)) props.push(p);
|
|
540
|
-
|
|
540
|
+
// one-change-record-no-source-no-auto: a link cites where it was read (the PRD line, a Jira dependency); a link guessed from the plan's
|
|
541
|
+
// order or from two dates that meet cites nothing, so lib/source-guard.js holds it for the PM instead of adding it by itself
|
|
542
|
+
const SG = require('./source-guard.js');
|
|
543
|
+
for (const lp of o.linkProps || []) props.push({ id: 'lk:' + lp.id, group: 'links', type: lp.kind, section: 'sure', link: lp, title: '', why: lp.why || '',
|
|
544
|
+
sources: SG.LINK_SOURCES[lp.source] ? [{ label: SG.LINK_SOURCES[lp.source], ref: String(lp.why || '').slice(0, 300) }] : [], items: [] });
|
|
541
545
|
// ✕ on one item drops that item for good: the page sends its signature
|
|
542
546
|
for (const p of props) if (p.group !== 'links') p.items = p.items.map((x) => ({ ...x, sig: itemSig(p, x) }));
|
|
543
547
|
props.sort((a, b) => ORDER[a.group] - ORDER[b.group] || (a.group === 'grill' ? ((a.data && a.data.rank) || 5) - ((b.data && b.data.rank) || 5) : 0) || (a.section === 'sure' ? 0 : a.section === 'check' ? 1 : 2) - (b.section === 'sure' ? 0 : b.section === 'check' ? 1 : 2));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* routes-intake.js — planning-flows run 4: the one-line intake draft.
|
|
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
|
-
* (lib/work-kind.js fromName; kind_cue '' when the name tells nothing
|
|
4
|
+
* (lib/work-kind.js fromName; kind_cue '' when the name tells nothing,
|
|
5
|
+
* and then the kind is the PM's role, setting work.role)
|
|
5
6
|
* Drafts only. Creating the initiative stays with createInitiative, which refuses an unanchored create. */
|
|
6
7
|
const path = require('path');
|
|
7
8
|
const guard = require('./pm-guard.js');
|
|
8
9
|
const { repoScript } = require('./repo-script.js');
|
|
9
10
|
const intake = require(repoScript('intake.js'));
|
|
10
|
-
const
|
|
11
|
+
const KS = require('./kind-scope.js');
|
|
11
12
|
|
|
12
13
|
const ROOT = path.resolve(__dirname, '..', '..');
|
|
13
14
|
|
|
@@ -22,7 +23,10 @@ module.exports = {
|
|
|
22
23
|
if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
|
|
23
24
|
if (typeof body.line !== 'string' || !body.line.trim()) { ctx.json(res, { ok: false, error: 'line is required' }, 400); return true; }
|
|
24
25
|
const draft = intake.intakeDraft({ line: body.line, root: ctx.root || ROOT, acknowledged: body.acknowledged === true });
|
|
25
|
-
|
|
26
|
+
// the PM's role (Settings › General › Your role) is the default when the name gives no cue; a cue still wins (lib/kind-scope.js)
|
|
27
|
+
let role = 'product'; try { role = require('./settings-store.js').get(ctx.runtimeDir, 'work.role'); } catch { role = 'product'; }
|
|
28
|
+
const k = KS.prePick(body.line, draft && draft.lane, role);
|
|
29
|
+
if (!k.cue && k.kind !== 'product') console.log(KS.LOG + ' intake kind ' + k.kind + ' from the role');
|
|
26
30
|
ctx.json(res, { ok: true, draft: { ...draft, kind: k.kind, kind_cue: k.cue } });
|
|
27
31
|
return true;
|
|
28
32
|
},
|
|
@@ -154,6 +154,7 @@ function undoCore(ctx, p, g, id) {
|
|
|
154
154
|
* mode is not auto stay for the PM. → { applied: [{ ini, batch, group, title }], held: n } */
|
|
155
155
|
function autoKeep(ctx, w, { modeOf = () => 'auto', now } = {}) {
|
|
156
156
|
const A = require('./autonomy.js');
|
|
157
|
+
const SGc = require('./source-guard.js');
|
|
157
158
|
const dir = dirOf(ctx, w);
|
|
158
159
|
const out = { applied: [], held: 0 };
|
|
159
160
|
if (!dir) return out;
|
|
@@ -170,12 +171,14 @@ function autoKeep(ctx, w, { modeOf = () => 'auto', now } = {}) {
|
|
|
170
171
|
if (!v) continue;
|
|
171
172
|
for (const x of v.groups.flatMap((gr) => gr.props)) {
|
|
172
173
|
const cls = A.classOfProposal(x);
|
|
173
|
-
const
|
|
174
|
+
const src = SGc.citedOf(x); // no source, no auto (A443), in every group
|
|
175
|
+
const d = A.decide({ stateDir: dir, job: `propose:${x.group}`, product: w.id, cls, mode: modeOf(board.id), undoable: true, now, settingsDir: ctx.runtimeDir || null, sources: src });
|
|
176
|
+
if (!d.apply && !src.length) A.logHeld(`propose:${x.group}`, w.id, x.id);
|
|
174
177
|
if (!d.apply) { out.held++; continue; }
|
|
175
178
|
try {
|
|
176
179
|
const r = keepCore(ctx, p, g, f, ini, [x], {}, { auto: true, group: x.group });
|
|
177
180
|
if (!r.keptIds.length) { out.held++; continue; } // nothing landed (a verdict no longer due, a pull request not opened): nothing to list
|
|
178
|
-
A.recordApplied(dir, { job: `propose:${x.group}`, product: w.id, ref: r.batch, title: x.title || x.why || x.group, cls, ini, why: x.title && x.why && x.why !== x.title ? x.why : '' }, { now, settingsDir: ctx.runtimeDir || null });
|
|
181
|
+
A.recordApplied(dir, { job: `propose:${x.group}`, product: w.id, ref: r.batch, title: x.title || x.why || x.group, cls, ini, why: x.title && x.why && x.why !== x.title ? x.why : '', src }, { now, settingsDir: ctx.runtimeDir || null });
|
|
179
182
|
out.applied.push({ ini, batch: r.batch, group: x.group, title: x.title || x.why || '' });
|
|
180
183
|
} catch { out.held++; }
|
|
181
184
|
}
|
|
@@ -36,6 +36,9 @@ const DEFS = Object.freeze({
|
|
|
36
36
|
// the premium Briefing: which workspaces it reads (initiative briefing-premium-products). null = every one except the home workspace.
|
|
37
37
|
'ws.briefing.include': { section: 'workspaces', scope: 'computer', type: 'ids', max: 50, def: null },
|
|
38
38
|
'board.template': one('boards', 'ws', ['product', 'project', 'simple'], 'product'),
|
|
39
|
+
// Settings › General › Your role (initiative kind-scopes-lifecycle-stages): the kind a new initiative starts as when its name gives no cue
|
|
40
|
+
// (lib/kind-scope.js prePick). Each initiative can still change its kind. Project hides Triage, Discover and the product documents.
|
|
41
|
+
'work.role': one('general', 'computer', ['product', 'project', 'sdlc'], 'product'),
|
|
39
42
|
'board.rules': one('boards', 'ws', ['warn', 'off'], 'warn'),
|
|
40
43
|
'board.templates': { section: 'boards', scope: 'computer', type: 'templates', def: TEMPLATES },
|
|
41
44
|
'conn.cal.window': one('connectors', 'computer', ['7-14', '14-30', '30-60'], '14-30'),
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* kindsOf(p) → [kind] the different kinds of source a proposal cites, e.g. ['jira', 'meeting']
|
|
7
7
|
* kindOf(text) → kind the kind of one source label or ref
|
|
8
8
|
* bigOf(p) → '' | 'close' | 'rename' | 'date' a change that needs two kinds of source
|
|
9
|
+
* citedOf(x) → [label] what ANY agent change cites (one-change-record-no-source-no-auto): its sources, its items'
|
|
10
|
+
* sources, its claims' sources, a link's PRD or Jira source, a build's work item. [] = no source
|
|
11
|
+
* noReason(why) → bool a reason that says it has none ("No reason found") or is empty
|
|
9
12
|
*
|
|
10
13
|
* THE RULE. It applies to the plan changes on a product: the groups in PLAN (dates, status, names, found, links).
|
|
11
14
|
* 1. No source, or a date proposal that found no reason (`noReason`): held.
|
|
@@ -76,4 +79,26 @@ function holdOf(p) {
|
|
|
76
79
|
return null;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
/* ── no source, no auto, in every job kind (initiative one-change-record-no-source-no-auto; idea A443) ──
|
|
83
|
+
* #1440 holds the plan groups above. This widens the one question "does the change cite anything?" to every change an agent makes:
|
|
84
|
+
* a ✦ proposal of any group, an Initiative Driver proposal, a default, a role agent's write. lib/autonomy.js makes a change that cites
|
|
85
|
+
* nothing class C, so it waits for the PM like a change others see. A link's own source (lib/task-links.js proposalsOf) counts when it
|
|
86
|
+
* names where the link was read (the PRD, a Jira dependency, a teammate's link); a link inferred from the plan's order or from two dates
|
|
87
|
+
* that meet is a guess and cites nothing. */
|
|
88
|
+
const LINK_SOURCES = { prd: 'PRD', jira: 'Jira', you: 'You' };
|
|
89
|
+
const NO_REASON = /^\s*(no reason( found)?|none|n\/a|-)?\s*\.?\s*$/i;
|
|
90
|
+
const noReason = (why) => NO_REASON.test(String(why == null ? '' : why));
|
|
91
|
+
function citedOf(x) {
|
|
92
|
+
if (!isObj(x)) return [];
|
|
93
|
+
const out = [];
|
|
94
|
+
const add = (s) => { if (isObj(s)) { const t = [s.label, s.ref].filter((v) => typeof v === 'string' && v.trim()).join(' '); if (t) out.push(t); } else if (typeof s === 'string' && s.trim()) out.push(s); };
|
|
95
|
+
for (const s of Array.isArray(x.sources) ? x.sources : []) add(s);
|
|
96
|
+
for (const it of Array.isArray(x.items) ? x.items : []) if (isObj(it) && it.source) add(String(it.source));
|
|
97
|
+
for (const c of Array.isArray(x.claims) ? x.claims : []) for (const s of (isObj(c) && Array.isArray(c.sources) ? c.sources : [])) add(s);
|
|
98
|
+
if (isObj(x.link) && LINK_SOURCES[x.link.source]) add({ label: LINK_SOURCES[x.link.source], ref: x.link.why || '' });
|
|
99
|
+
if (x.group === 'build' && isObj(x.data) && typeof x.data.item === 'string' && x.data.item) add({ label: 'Work item', ref: x.data.item });
|
|
100
|
+
if (x.noReason === true) return [];
|
|
101
|
+
return [...new Set(out)];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
module.exports = { citedOf, noReason, LINK_SOURCES, holdOf, kindsOf, kindOf, bigOf, shiftOf, PLAN, BIG_DAYS, KIND_NAMES };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.691.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.691.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -162,7 +162,7 @@ export async function openNew(from, ask) {
|
|
|
162
162
|
const d = ask ? ask.draft || {} : {};
|
|
163
163
|
// kind: the one picked; kindBy: 'pmos' while PMOS's pre-pick from the name stands, 'you' once the PM taps one (then it never changes)
|
|
164
164
|
const dk = d.kind && WK.KINDS.includes(d.kind) && d.kind_cue ? d.kind : null;
|
|
165
|
-
N = { ask: ask || null, links: [], files: [], lean: d.lane || null, prior: ask ? ask.prior || [] : [], ack: false, close: null, kind: dk || 'product', kindBy: dk ? 'pmos' : null };
|
|
165
|
+
N = { ask: ask || null, links: [], files: [], lean: d.lane || null, prior: ask ? ask.prior || [] : [], ack: false, close: null, kind: dk || (WK.KINDS.includes(d.kind) ? d.kind : 'product'), kindBy: dk ? 'pmos' : null }; // no cue: the PM's role (work.role), no ✦ line
|
|
166
166
|
const body = `<form class="bd-form bd-new" data-form="new2"${ask ? ` data-ask="${esc(ask.id)}"` : ''} novalidate>`
|
|
167
167
|
+ (ask ? `<p class="bd-quote">“${esc(ask.line)}”</p>` : '')
|
|
168
168
|
+ `<label class="bd-field">Name<input class="bd-inp" name="title" maxlength="120" value="${esc(d.title || '')}" placeholder="For example: Partner SSO audit trail" autocomplete="off"></label>`
|
|
@@ -190,8 +190,9 @@ function lean(text) {
|
|
|
190
190
|
const r = text.trim().length > 3 ? await pmPost('/api/intake/draft', { line: text.trim() }).catch(() => null) : null;
|
|
191
191
|
if (!N) return;
|
|
192
192
|
if (r && r.ok && r.draft) { N.lean = r.draft.lane || N.lean; if (!N.ask) N.prior = r.draft.prior_rejections || []; }
|
|
193
|
-
// PMOS's pre-pick follows the name until the PM taps a kind; a name that tells nothing goes back to
|
|
194
|
-
|
|
193
|
+
// 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 ›
|
|
194
|
+
// Your role; the draft's kind then) with no ✦ line
|
|
195
|
+
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; }
|
|
195
196
|
const k = $('#nwKind'), h = $('#nwHints'); if (k) k.innerHTML = kindBox(); if (h) h.innerHTML = hintsHtml();
|
|
196
197
|
}, 350);
|
|
197
198
|
}
|
|
@@ -70,7 +70,7 @@ async function readPage(r, force) {
|
|
|
70
70
|
pmGet('/api/home-desk' + (w.ws ? '?ws=' + encodeURIComponent(w.ws) : '')).catch(() => null)]);
|
|
71
71
|
const m = x && x.ok && x.model;
|
|
72
72
|
const was = JSON.stringify(PAGE.get(r.id) || { gate: null, docs: [], people: [] });
|
|
73
|
-
const now = { gate: m && !ownWf(r) ? gateOf(m.gateSteps || m.checks) : null, docs: m ? MD.docRows(m) : [], people: (d && d.ok && d.stakeholders && d.stakeholders[r.id]) || [] };
|
|
73
|
+
const now = { gate: m && !ownWf(r) ? gateOf(m.gateSteps || m.checks, m.scope) : null, docs: m ? MD.docRows(m).filter((d) => !d.hidden) : [], people: (d && d.ok && d.stakeholders && d.stakeholders[r.id]) || [] };
|
|
74
74
|
PAGE.set(r.id, now);
|
|
75
75
|
if (JSON.stringify(now) !== was) refresh(); // only when the read changed what shows, and never under the PM's hand (refresh skips a focused body)
|
|
76
76
|
}
|
|
@@ -111,6 +111,7 @@ function general() {
|
|
|
111
111
|
const upd = ready() ? `<div class="ev-card ev-upd">${adFace('needs-you')}<span class="pm-badge blue">Update</span><p><b>PMOS ${esc(latest())} is ready.</b> <span class="ev-mut">${esc(firstLine())}</span></p><button type="button" class="ev-btn sm" data-ev-go="updates">What's new</button><button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button></div>` : '';
|
|
112
112
|
return trow('Theme', 'Auto follows your computer', seg('Theme', 'theme', theme, [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']]))
|
|
113
113
|
+ trow('Product', 'Which products Today, Work and Goals read', `<button type="button" class="ev-pick" data-ev-products aria-haspopup="menu">${esc(pname)} ${svg(ICON.down, 14)}</button>`)
|
|
114
|
+
+ trow('New work starts as', 'The kind a new initiative starts as. Project hides Triage, Discover and the product documents. Each initiative can change it.', seg('New work starts as', 'work.role', roleVal(), [['product', 'Product'], ['project', 'Project'], ['sdlc', 'Full SDLC']]))
|
|
114
115
|
+ trow('Your day', 'When the end-of-day card shows', `<label class="ev-vh" for="evDay">Your day ends at</label><select id="evDay" class="ev-inp" data-ev-day>${hours.map((h) => `<option value="${h}"${h === end ? ' selected' : ''}>${pad(h)}:00</option>`).join('')}</select>`)
|
|
115
116
|
+ trow('Your impact', 'Adler’s sprout and your impact log. Only you see it. Nothing leaves PMOS.', sw(impactOn(), 'data-ev-impact', 'Your impact'))
|
|
116
117
|
+ trow('Agents write to Jira', 'Only after you press Commit. Never on their own.', (ready() ? '' : adFace('needs-you', 24)) + '<span class="pm-badge">Fixed</span>')
|
|
@@ -119,6 +120,9 @@ function general() {
|
|
|
119
120
|
+ trow('Adler', 'How much of PMOS’s face shows, motion, celebrations, quiet hours and Dress for the day', subBtn('adler'))
|
|
120
121
|
+ trow('Jev and Laya', 'The TypeSafe key, Laya on this computer and the repositories it reads', subBtn('jl'));
|
|
121
122
|
}
|
|
123
|
+
/* Your role (initiative kind-scopes-lifecycle-stages): work.role, the kind a new initiative starts as when its name gives no cue */
|
|
124
|
+
const roleVal = () => { const r = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((x) => x.key === 'work.role') : null; return r && r.value ? r.value : 'product'; };
|
|
125
|
+
const ROLE_SAY = { product: 'Saved. New initiatives start as Product work.', project: 'Saved. New initiatives start as Project work: Triage, Discover and the product documents stay folded away.', sdlc: 'Saved. New initiatives start as Full SDLC work.' };
|
|
122
126
|
/* General › Extras (U4): the row's › opens the sub-panel; its ‹ comes back to General */
|
|
123
127
|
const subBtn = (k) => `<button type="button" class="ev-ib pm-btn" data-ev-sub="${k}" aria-label="${esc(SUBS[k])}" title="${esc(SUBS[k])}">${svg(CHEV, 18)}</button>`;
|
|
124
128
|
const subHead = (k) => `<div class="ev-dr-hd"><button type="button" class="ev-ib pm-btn" data-ev-sub="" aria-label="Back to ${esc((SECTIONS.find((x) => x[0] === T.sec) || SECTIONS[0])[1])}" title="Back">${svg(BACK, 18)}</button><h4 class="ev-grow">${esc(SUBS[k])}</h4></div>`;
|
|
@@ -621,6 +625,11 @@ async function press(e) {
|
|
|
621
625
|
if (t.dataset.evGo) { T.sec = t.dataset.evGo; T.sub = ''; draw(); return; }
|
|
622
626
|
if (t.dataset.evSub !== undefined) { const k = t.dataset.evSub, was = T.sub; T.sub = k; T.dress = false; T.more = false; T.bday = false; T.msg = ''; draw(); const f = T.el.querySelector(k ? '[data-ev-sub=""]' : `[data-ev-sub="${was}"]`); if (f) f.focus(); return; }
|
|
623
627
|
if (t.dataset.evSeg && t.dataset.evSeg.startsWith('claude.way:')) { await saveWay(t.dataset.evSeg.slice(11), t.dataset.v); return; }
|
|
628
|
+
if (t.dataset.evSeg === 'work.role') {
|
|
629
|
+
const r = await pmPost('/api/settings', { key: 'work.role', value: t.dataset.v });
|
|
630
|
+
const row = r && r.ok && T.set && Array.isArray(T.set.settings) ? T.set.settings.find((x) => x.key === 'work.role') : null; if (row) row.value = r.value;
|
|
631
|
+
T.msg = r && r.ok ? ROLE_SAY[t.dataset.v] || 'Saved.' : (r && r.error) || 'Not saved.'; draw(); return;
|
|
632
|
+
}
|
|
624
633
|
if (t.dataset.evSeg === 'theme') { const M = await import('./cozy-nav.js'); M.setTheme(t.dataset.v); draw(); return; }
|
|
625
634
|
if (t.dataset.evSeg && t.dataset.evSeg.startsWith('grill.')) {
|
|
626
635
|
const key = t.dataset.evSeg, value = key === 'grill.cap' ? Number(t.dataset.v) : t.dataset.v;
|
|
@@ -783,7 +783,7 @@ function iniViewOf(id) {
|
|
|
783
783
|
const p = programOf(S.D.programs || [], row.ws || (B.board || {}).ws || '', id);
|
|
784
784
|
const IM = S.IM && S.IMid === id ? S.IM : null; // W1: the page model's gate line (the spec ladder), when the page model is read
|
|
785
785
|
return iniView(rowFor({ ...row, trail: t || row.trail || null }), { steps: B.steps || STEPS, today: B.today, usual: WFM.usualOf(S.D.trail, row),
|
|
786
|
-
gate: IM && !(row.wf && row.wf.id && row.wf.id !== 'product-feature') ? gateOf(IM.gateSteps || IM.checks) : null,
|
|
786
|
+
gate: IM && !(row.wf && row.wf.id && row.wf.id !== 'product-feature') ? gateOf(IM.gateSteps || IM.checks, IM.scope) : null,
|
|
787
787
|
ask: need ? { title: need.name, n: H.needsOf(S.D).filter((r) => r.ini === id).length, propose: (need.row && need.row.propose) || null } : null, program: p ? { id: p.id, title: p.title } : null, jiraReadAt: ((B.jira || {}).readAt) || '',
|
|
788
788
|
// the card (batch 18 item 1): Claude's line while a session works on it, the stakeholders
|
|
789
789
|
claude: (() => { const w = S.D.sessions.find((s) => H.iniOfSession(s) === id && s.shown === 'working'); return w ? 'I’m working on “' + H.nameOf(w) + '”. I’ll say here when it is ready.' : ''; })(),
|
|
@@ -132,7 +132,7 @@ export function docRows(M) {
|
|
|
132
132
|
const kind = custom ? (d.link ? (/Slides/.test(d.link.kind || '') ? 'Slides' : 'Linked') : 'Added') : KIND[d.key] || 'Document';
|
|
133
133
|
const phase = phases.includes(d.cat) ? d.cat : null;
|
|
134
134
|
return { key: d.key, title: d.title, kind, chip: CHIP[kind] || 'Other', core: !custom, phase, st: d.st || 'missing', state: d.state || '', by: d.by || '', when: d.when || (d.added ? 'added ' + d.added : ''), path: d.path || null,
|
|
135
|
-
slot: d.slot || '', act: d.act || null, running: !!d.running, link: d.link || null, look: LOOK.has(d.st), what: d.what || '', ...(d.other ? { other: true } : {}) };
|
|
135
|
+
slot: d.slot || '', act: d.act || null, running: !!d.running, link: d.link || null, look: LOOK.has(d.st) && !d.hidden, what: d.what || '', ...(d.other ? { other: true } : {}), ...(d.hidden ? { hidden: true } : {}) };
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
/** The pill a document row shows: its state, Skipped (an earlier stage did without it), Not started. */
|
|
@@ -560,15 +560,18 @@ function docRowHtml(d, cur, later, phases) {
|
|
|
560
560
|
function docsView(id, M) {
|
|
561
561
|
const rows = MD.docRows(M), { phases, cur } = MD.docPhases(M);
|
|
562
562
|
if (!rows.length) return '<div class="hi-v hi-v2" data-hi-v="docs">' + VW().czSummary({ text: M.docs && M.docs.missing ? 'The core documents could not be read.' : 'This initiative has no core document yet.', primary: { label: 'Add a document', act: 'adddoc' } }) + '</div>';
|
|
563
|
-
|
|
564
|
-
const
|
|
563
|
+
// the kind's scope (lib/kind-scope.js): a project's product documents are hidden. They fold into one closed section at the end, never dropped
|
|
564
|
+
const shown = rows.filter((d) => !d.hidden), hid = rows.filter((d) => d.hidden);
|
|
565
|
+
const G = MD.docGroups(shown, M.acts && M.acts.stage, { ...X.doc, phases, cur });
|
|
566
|
+
const look = shown.filter((d) => d.look), miss = shown.filter((d) => !d.path && d.act && d.act.kind === 'draft' && !d.running);
|
|
565
567
|
const said = look.slice(0, 2).map((d) => d.title + ' ' + String(MD.docPill(d, cur, phases)[0] || '').toLowerCase()).concat(miss.filter((d) => !d.look).slice(0, 1).map((d) => 'The ' + d.title + ' is not written yet'));
|
|
566
568
|
const first = miss[0] || null, open = !first && look.find((d) => d.path);
|
|
567
569
|
const pri = first ? { label: 'Draft the ' + first.title, act: 'draft:' + first.key } : open ? { label: 'Open ' + open.title, act: 'open:' + open.key } : null;
|
|
568
570
|
const sum = VW().czSummary({ line: look.length ? look.length + (look.length === 1 ? ' needs a look' : ' need a look') : '', tone: look.length ? 'warn' : '',
|
|
569
571
|
text: said.length ? said.map((x) => x.replace(/^./, (c) => c.toUpperCase())).join('. ') + '.' : 'Every document is in place for ' + (cur || 'this stage') + '.',
|
|
570
572
|
meta: rows.length + (rows.length === 1 ? ' document' : ' documents') + ' · filter and sort are under More', extra: M.docs && M.docs.cap ? `<p class="czs-meta" data-ov-dsum>${esc(M.docs.cap)}</p>` : '', primary: pri });
|
|
571
|
-
const secs = VW().czSections(G.map((g, i) => ({ id: 'd:' + (g.key || i), title: g.title || 'Documents', count: g.rows.length, open: i === 0, html: g.rows.map((d) => docRowHtml(d, cur, g.later, phases)).join('') }))
|
|
573
|
+
const secs = VW().czSections(G.map((g, i) => ({ id: 'd:' + (g.key || i), title: g.title || 'Documents', count: g.rows.length, open: i === 0, html: g.rows.map((d) => docRowHtml(d, cur, g.later, phases)).join('') }))
|
|
574
|
+
.concat(hid.length ? [{ id: 'd:hidden', title: 'Product documents', count: hid.length, open: false, html: hid.map((d) => docRowHtml(d, cur, false, phases)).join('') }] : []), { key: 'docs' });
|
|
572
575
|
return '<div class="hi-v hi-v2" data-hi-v="docs">' + sum + (secs || '<p class="hi-empty">No document matches.</p>') + '</div>';
|
|
573
576
|
}
|
|
574
577
|
function stageView(id, M, ask) {
|
|
@@ -56,8 +56,11 @@ const GATE_SAY = {
|
|
|
56
56
|
review: { done: 'reviewed', no: 'not reviewed' },
|
|
57
57
|
approved: { done: 'PRD approved', no: 'PRD not approved' },
|
|
58
58
|
};
|
|
59
|
-
/** steps: the model's gateSteps (lib/initiative-premium.js: the ladder's spec rungs in order), else the engine checks.
|
|
60
|
-
|
|
59
|
+
/** steps: the model's gateSteps (lib/initiative-premium.js: the ladder's spec rungs in order), else the engine checks. scope: the model's
|
|
60
|
+
* scope (lib/kind-scope.js). A project's gate is "Plan before start" (the Project control in the Viewer, lib/kind-control.js), and its
|
|
61
|
+
* product documents are hidden, so it gets no PRD gate line here. */
|
|
62
|
+
export function gateOf(steps, scope) {
|
|
63
|
+
if (scope && scope.kind === 'project') return null;
|
|
61
64
|
const parts = [];
|
|
62
65
|
const list = (steps || []).filter((x) => x && GATE_SAY[x.k]);
|
|
63
66
|
const keys = list.some((x) => !GATE_KEYS.has(x.k)) ? list.map((x) => x.k) : ['prototype', 'spec', 'contract'];
|
|
@@ -91,6 +94,7 @@ export function stageKey(name) {
|
|
|
91
94
|
}
|
|
92
95
|
const dayOf = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
93
96
|
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
97
|
+
const listOf = (a) => (a.length < 2 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1]);
|
|
94
98
|
|
|
95
99
|
/** The card's model. M: the page model; now: ms. */
|
|
96
100
|
/** The steps of the initiative's own workflow (D99): Product feature is the eight above; another workflow sends its stages on the row
|
|
@@ -102,7 +106,13 @@ function stepsOf(m) {
|
|
|
102
106
|
}
|
|
103
107
|
export function headModel(M, now = Date.now()) {
|
|
104
108
|
const m = M || {}, head = m.head || {}, acts = m.acts || {}, ov = m.overview || {};
|
|
105
|
-
const own = stepsOf(m)
|
|
109
|
+
const own = stepsOf(m);
|
|
110
|
+
// the kind's scope (lib/kind-scope.js): a stage the kind hides is left off the eight, never the current one; Move to a stage still has it
|
|
111
|
+
const sc = !own && m.scope && m.scope.stages ? m.scope : null;
|
|
112
|
+
const key0 = own ? null : m.oneStage && m.oneStage.step ? m.oneStage.step : stageKey(head.stage || acts.stage);
|
|
113
|
+
const hide = new Set(sc ? (sc.hidden || []).filter((k) => k !== key0) : []);
|
|
114
|
+
const LIST = own || STEPS.filter((s) => !hide.has(s.key));
|
|
115
|
+
const hidden = STEPS.filter((s) => hide.has(s.key)).map((s) => s.label);
|
|
106
116
|
// W1: on Product feature the stage is the one stage (lib/one-stage.js: the PM's word, Jira, the plan, the files); Shipped, On hold and
|
|
107
117
|
// Cancelled stand on the step under them and name themselves
|
|
108
118
|
const one = m.oneStage && m.oneStage.step ? m.oneStage : null;
|
|
@@ -155,7 +165,7 @@ export function headModel(M, now = Date.now()) {
|
|
|
155
165
|
const done = items.filter((x) => x.kind === 'done'), rest = items.filter((x) => x.kind !== 'done');
|
|
156
166
|
const life = acts.life || null;
|
|
157
167
|
const turn = rest.some((x) => x.kind === 'you') ? 'you' : life === 'hold' || life === 'cancelled' || rest.some((x) => x.kind === 'risk') ? 'stalled'
|
|
158
|
-
: rest.some((x) => x.kind === 'jira') || (!own && (key === 'build' || key === 'deliver')) ? 'jira' : 'agents';
|
|
168
|
+
: rest.some((x) => x.kind === 'jira') || (!own && ((key === 'build' && !(sc && sc.stages.build === 'owned')) || key === 'deliver')) ? 'jira' : 'agents'; // Full SDLC owns Build: the factory, not Jira
|
|
159
169
|
const TURN = { you: 'Your turn', agents: 'Agents working', jira: 'Engineers on it', stalled: life === 'hold' ? 'On hold' : life === 'cancelled' ? 'Cancelled' : 'Stalled' };
|
|
160
170
|
// time in the stage: a record that holds it (stageSince, usualDays) first, then the planned finish, then say it is not recorded
|
|
161
171
|
let time = '', over = false, clock = null;
|
|
@@ -182,10 +192,11 @@ export function headModel(M, now = Date.now()) {
|
|
|
182
192
|
const payoff = !cur ? '' : own ? (next ? next.label + ' starts.' : 'It is the last stage of ' + m.wf.name + '.') + anchor : PAYOFF[cur.key] + anchor;
|
|
183
193
|
return {
|
|
184
194
|
key, at, total: LIST.length, turn, turnLabel: TURN[turn],
|
|
185
|
-
source: stageSource(m), gate: own ? null : gateOf(m.gateSteps || m.checks),
|
|
195
|
+
source: stageSource(m), gate: own ? null : gateOf(m.gateSteps || m.checks, sc), hidden,
|
|
186
196
|
stage: cur ? (at + 1) + ' of ' + LIST.length + ' · ' + cur.label : head.stage ? head.stage + ' · not on the lifecycle' : 'No stage on record',
|
|
187
197
|
prev: prev ? prev.label : '', cur: cur ? cur.label : head.stage || '', toReach: next ? next.label : cur ? 'Done' : '',
|
|
188
|
-
ladderAria: cur ? 'Stage ' + (at + 1) + ' of ' + LIST.length + ': ' + cur.label + '.' + (next ? ' Next stage: ' + next.label + '.' : '') : 'No stage on the lifecycle.'
|
|
198
|
+
ladderAria: (cur ? 'Stage ' + (at + 1) + ' of ' + LIST.length + ': ' + cur.label + '.' + (next ? ' Next stage: ' + next.label + '.' : '') : 'No stage on the lifecycle.')
|
|
199
|
+
+ (hidden.length ? ' ' + listOf(hidden) + (hidden.length === 1 ? ' is' : ' are') + ' hidden for ' + (sc.kind === 'project' ? 'project' : sc.kind) + ' work; Move to a stage still reaches ' + (hidden.length === 1 ? 'it' : 'them') + '.' : ''),
|
|
189
200
|
// one bar a stage of its workflow; a stage PMOS judged it skips stays as a dashed bar (stage card D)
|
|
190
201
|
steps: own ? m.wfStages.map((s) => ({ label: s.name, ms: !!s.milestone, cls: s.status === 'skipped' && !(m.wfStage && s.key === m.wfStage.key) ? 'skip' : s.status === 'done' ? 'done' : s.status === 'current' ? 'now' : '' }))
|
|
191
202
|
: LIST.map((s, i) => ({ label: s.label, ms: !!s.ms, cls: at < 0 ? '' : i < at ? 'done' : i === at ? 'now' : '' })),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Kind of work marks each lifecycle stage owned, watched or hidden (initiative kind-scopes-lifecycle-stages, done test C1-C11). Pure checks over the table, the premium model and the Viewer head, plus the role setting. No server, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"kind-scope.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"kind-scope.test.js": 5
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -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
|
+
}
|